panopticon-cli 0.4.33 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +96 -210
  2. package/dist/{agents-VLK4BMVA.js → agents-E43Y3HNU.js} +5 -5
  3. package/dist/{chunk-ASY7T35E.js → chunk-AAFQANKW.js} +231 -76
  4. package/dist/chunk-AAFQANKW.js.map +1 -0
  5. package/dist/{chunk-KJ2TRXNK.js → chunk-FTCPTHIJ.js} +47 -420
  6. package/dist/chunk-FTCPTHIJ.js.map +1 -0
  7. package/dist/{chunk-PI7Y3PSN.js → chunk-GR6ZZMCX.js} +25 -6
  8. package/dist/chunk-GR6ZZMCX.js.map +1 -0
  9. package/dist/chunk-HJSM6E6U.js +1038 -0
  10. package/dist/chunk-HJSM6E6U.js.map +1 -0
  11. package/dist/{chunk-BKCWRMUX.js → chunk-HZT2AOPN.js} +81 -9
  12. package/dist/chunk-HZT2AOPN.js.map +1 -0
  13. package/dist/{chunk-XFR2DLMR.js → chunk-NTO3EDB3.js} +3 -3
  14. package/dist/{chunk-XFR2DLMR.js.map → chunk-NTO3EDB3.js.map} +1 -1
  15. package/dist/{chunk-RBUO57TC.js → chunk-PPRFKTVC.js} +2 -2
  16. package/dist/chunk-PPRFKTVC.js.map +1 -0
  17. package/dist/{chunk-XKT5MHPT.js → chunk-WQG2TYCB.js} +2 -2
  18. package/dist/cli/index.js +1383 -880
  19. package/dist/cli/index.js.map +1 -1
  20. package/dist/dashboard/prompts/work-agent.md +2 -0
  21. package/dist/dashboard/public/assets/{index-UjZq6ykz.css → index-BxpjweAL.css} +1 -1
  22. package/dist/dashboard/public/assets/index-DQHkwvvJ.js +743 -0
  23. package/dist/dashboard/public/index.html +2 -2
  24. package/dist/dashboard/server.js +3593 -2052
  25. package/dist/index.d.ts +10 -1
  26. package/dist/index.js +5 -3
  27. package/dist/index.js.map +1 -1
  28. package/dist/{specialist-context-T3NBMCIE.js → specialist-context-ZC6A4M3I.js} +4 -4
  29. package/dist/{specialist-logs-CVKD3YJ3.js → specialist-logs-KLGJCEUL.js} +4 -4
  30. package/dist/{specialists-TKAP6T6Z.js → specialists-O4HWDJL5.js} +4 -4
  31. package/dist/{traefik-QX4ZV4YG.js → traefik-QN7R5I6V.js} +2 -2
  32. package/dist/{workspace-manager-KLHUCIZV.js → workspace-manager-IE4JL2JP.js} +2 -2
  33. package/package.json +1 -1
  34. package/scripts/stop-hook +7 -0
  35. package/scripts/work-agent-stop-hook +137 -0
  36. package/skills/myn-standards/SKILL.md +351 -0
  37. package/skills/write-spec/SKILL.md +138 -0
  38. package/dist/chunk-7XNJJBH6.js +0 -538
  39. package/dist/chunk-7XNJJBH6.js.map +0 -1
  40. package/dist/chunk-ASY7T35E.js.map +0 -1
  41. package/dist/chunk-BKCWRMUX.js.map +0 -1
  42. package/dist/chunk-KJ2TRXNK.js.map +0 -1
  43. package/dist/chunk-PI7Y3PSN.js.map +0 -1
  44. package/dist/chunk-RBUO57TC.js.map +0 -1
  45. package/dist/dashboard/public/assets/index-kAJqtLDO.js +0 -708
  46. /package/dist/{agents-VLK4BMVA.js.map → agents-E43Y3HNU.js.map} +0 -0
  47. /package/dist/{chunk-XKT5MHPT.js.map → chunk-WQG2TYCB.js.map} +0 -0
  48. /package/dist/{specialist-context-T3NBMCIE.js.map → specialist-context-ZC6A4M3I.js.map} +0 -0
  49. /package/dist/{specialist-logs-CVKD3YJ3.js.map → specialist-logs-KLGJCEUL.js.map} +0 -0
  50. /package/dist/{specialists-TKAP6T6Z.js.map → specialists-O4HWDJL5.js.map} +0 -0
  51. /package/dist/{traefik-QX4ZV4YG.js.map → traefik-QN7R5I6V.js.map} +0 -0
  52. /package/dist/{workspace-manager-KLHUCIZV.js.map → workspace-manager-IE4JL2JP.js.map} +0 -0
@@ -1,708 +0,0 @@
1
- var Vx=e=>{throw TypeError(e)};var Wh=(e,t,n)=>t.has(e)||Vx("Cannot "+n);var L=(e,t,n)=>(Wh(e,t,"read from private field"),n?n.call(e):t.get(e)),ce=(e,t,n)=>t.has(e)?Vx("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),se=(e,t,n,r)=>(Wh(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),be=(e,t,n)=>(Wh(e,t,"access private method"),n);var $c=(e,t,n,r)=>({set _(s){se(e,t,s,n)},get _(){return L(e,t,r)}});function sj(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var ad=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Na(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ij(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),n}var Lw={exports:{}},Zd={},Aw={exports:{}},je={};/**
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 xc=Symbol.for("react.element"),oj=Symbol.for("react.portal"),aj=Symbol.for("react.fragment"),lj=Symbol.for("react.strict_mode"),cj=Symbol.for("react.profiler"),uj=Symbol.for("react.provider"),dj=Symbol.for("react.context"),hj=Symbol.for("react.forward_ref"),fj=Symbol.for("react.suspense"),pj=Symbol.for("react.memo"),mj=Symbol.for("react.lazy"),Yx=Symbol.iterator;function gj(e){return e===null||typeof e!="object"?null:(e=Yx&&e[Yx]||e["@@iterator"],typeof e=="function"?e:null)}var Ow={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Iw=Object.assign,Bw={};function ja(e,t,n){this.props=e,this.context=t,this.refs=Bw,this.updater=n||Ow}ja.prototype.isReactComponent={};ja.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")};ja.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Fw(){}Fw.prototype=ja.prototype;function zg(e,t,n){this.props=e,this.context=t,this.refs=Bw,this.updater=n||Ow}var $g=zg.prototype=new Fw;$g.constructor=zg;Iw($g,ja.prototype);$g.isPureReactComponent=!0;var Qx=Array.isArray,zw=Object.prototype.hasOwnProperty,Hg={current:null},$w={key:!0,ref:!0,__self:!0,__source:!0};function Hw(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)zw.call(t,r)&&!$w.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];s.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:xc,type:e,key:i,ref:o,props:s,_owner:Hg.current}}function vj(e,t){return{$$typeof:xc,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Wg(e){return typeof e=="object"&&e!==null&&e.$$typeof===xc}function xj(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Xx=/\/+/g;function Uh(e,t){return typeof e=="object"&&e!==null&&e.key!=null?xj(""+e.key):t.toString(36)}function Du(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case xc:case oj:o=!0}}if(o)return o=e,s=s(o),e=r===""?"."+Uh(o,0):r,Qx(s)?(n="",e!=null&&(n=e.replace(Xx,"$&/")+"/"),Du(s,t,n,"",function(u){return u})):s!=null&&(Wg(s)&&(s=vj(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(Xx,"$&/")+"/")+e)),t.push(s)),1;if(o=0,r=r===""?".":r+":",Qx(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+Uh(i,l);o+=Du(i,t,n,c,s)}else if(c=gj(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+Uh(i,l++),o+=Du(i,t,n,c,s);else if(i==="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 o}function Hc(e,t,n){if(e==null)return e;var r=[],s=0;return Du(e,r,"","",function(i){return t.call(n,i,s++)}),r}function yj(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var pn={current:null},Mu={transition:null},_j={ReactCurrentDispatcher:pn,ReactCurrentBatchConfig:Mu,ReactCurrentOwner:Hg};function Ww(){throw Error("act(...) is not supported in production builds of React.")}je.Children={map:Hc,forEach:function(e,t,n){Hc(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Hc(e,function(){t++}),t},toArray:function(e){return Hc(e,function(t){return t})||[]},only:function(e){if(!Wg(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};je.Component=ja;je.Fragment=aj;je.Profiler=cj;je.PureComponent=zg;je.StrictMode=lj;je.Suspense=fj;je.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_j;je.act=Ww;je.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=Iw({},e.props),s=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=Hg.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)zw.call(t,c)&&!$w.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:xc,type:e.type,key:s,ref:i,props:r,_owner:o}};je.createContext=function(e){return e={$$typeof:dj,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:uj,_context:e},e.Consumer=e};je.createElement=Hw;je.createFactory=function(e){var t=Hw.bind(null,e);return t.type=e,t};je.createRef=function(){return{current:null}};je.forwardRef=function(e){return{$$typeof:hj,render:e}};je.isValidElement=Wg;je.lazy=function(e){return{$$typeof:mj,_payload:{_status:-1,_result:e},_init:yj}};je.memo=function(e,t){return{$$typeof:pj,type:e,compare:t===void 0?null:t}};je.startTransition=function(e){var t=Mu.transition;Mu.transition={};try{e()}finally{Mu.transition=t}};je.unstable_act=Ww;je.useCallback=function(e,t){return pn.current.useCallback(e,t)};je.useContext=function(e){return pn.current.useContext(e)};je.useDebugValue=function(){};je.useDeferredValue=function(e){return pn.current.useDeferredValue(e)};je.useEffect=function(e,t){return pn.current.useEffect(e,t)};je.useId=function(){return pn.current.useId()};je.useImperativeHandle=function(e,t,n){return pn.current.useImperativeHandle(e,t,n)};je.useInsertionEffect=function(e,t){return pn.current.useInsertionEffect(e,t)};je.useLayoutEffect=function(e,t){return pn.current.useLayoutEffect(e,t)};je.useMemo=function(e,t){return pn.current.useMemo(e,t)};je.useReducer=function(e,t,n){return pn.current.useReducer(e,t,n)};je.useRef=function(e){return pn.current.useRef(e)};je.useState=function(e){return pn.current.useState(e)};je.useSyncExternalStore=function(e,t,n){return pn.current.useSyncExternalStore(e,t,n)};je.useTransition=function(){return pn.current.useTransition()};je.version="18.3.1";Aw.exports=je;var v=Aw.exports;const Ke=Na(v),Ug=sj({__proto__:null,default:Ke},[v]);/**
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 bj=v,wj=Symbol.for("react.element"),Sj=Symbol.for("react.fragment"),kj=Object.prototype.hasOwnProperty,Cj=bj.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Nj={key:!0,ref:!0,__self:!0,__source:!0};function Uw(e,t,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)kj.call(t,r)&&!Nj.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:wj,type:e,key:i,ref:o,props:s,_owner:Cj.current}}Zd.Fragment=Sj;Zd.jsx=Uw;Zd.jsxs=Uw;Lw.exports=Zd;var a=Lw.exports,mp={},qw={exports:{}},Vn={},Kw={exports:{}},Vw={};/**
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(D,H){var N=D.length;D.push(H);e:for(;0<N;){var B=N-1>>>1,O=D[B];if(0<s(O,H))D[B]=H,D[N]=O,N=B;else break e}}function n(D){return D.length===0?null:D[0]}function r(D){if(D.length===0)return null;var H=D[0],N=D.pop();if(N!==H){D[0]=N;e:for(var B=0,O=D.length,k=O>>>1;B<k;){var W=2*(B+1)-1,Q=D[W],z=W+1,X=D[z];if(0>s(Q,N))z<O&&0>s(X,Q)?(D[B]=X,D[z]=N,B=z):(D[B]=Q,D[W]=N,B=W);else if(z<O&&0>s(X,N))D[B]=X,D[z]=N,B=z;else break e}}return H}function s(D,H){var N=D.sortIndex-H.sortIndex;return N!==0?N:D.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],h=1,d=null,p=3,f=!1,m=!1,g=!1,b=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(D){for(var H=n(u);H!==null;){if(H.callback===null)r(u);else if(H.startTime<=D)r(u),H.sortIndex=H.expirationTime,t(c,H);else break;H=n(u)}}function w(D){if(g=!1,_(D),!m)if(n(c)!==null)m=!0,$(C);else{var H=n(u);H!==null&&q(w,H.startTime-D)}}function C(D,H){m=!1,g&&(g=!1,x(T),T=-1),f=!0;var N=p;try{for(_(H),d=n(c);d!==null&&(!(d.expirationTime>H)||D&&!I());){var B=d.callback;if(typeof B=="function"){d.callback=null,p=d.priorityLevel;var O=B(d.expirationTime<=H);H=e.unstable_now(),typeof O=="function"?d.callback=O:d===n(c)&&r(c),_(H)}else r(c);d=n(c)}if(d!==null)var k=!0;else{var W=n(u);W!==null&&q(w,W.startTime-H),k=!1}return k}finally{d=null,p=N,f=!1}}var S=!1,R=null,T=-1,F=5,P=-1;function I(){return!(e.unstable_now()-P<F)}function A(){if(R!==null){var D=e.unstable_now();P=D;var H=!0;try{H=R(!0,D)}finally{H?M():(S=!1,R=null)}}else S=!1}var M;if(typeof y=="function")M=function(){y(A)};else if(typeof MessageChannel<"u"){var j=new MessageChannel,E=j.port2;j.port1.onmessage=A,M=function(){E.postMessage(null)}}else M=function(){b(A,0)};function $(D){R=D,S||(S=!0,M())}function q(D,H){T=b(function(){D(e.unstable_now())},H)}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(D){D.callback=null},e.unstable_continueExecution=function(){m||f||(m=!0,$(C))},e.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<D?Math.floor(1e3/D):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(D){switch(p){case 1:case 2:case 3:var H=3;break;default:H=p}var N=p;p=H;try{return D()}finally{p=N}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(D,H){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var N=p;p=D;try{return H()}finally{p=N}},e.unstable_scheduleCallback=function(D,H,N){var B=e.unstable_now();switch(typeof N=="object"&&N!==null?(N=N.delay,N=typeof N=="number"&&0<N?B+N:B):N=B,D){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=N+O,D={id:h++,callback:H,priorityLevel:D,startTime:N,expirationTime:O,sortIndex:-1},N>B?(D.sortIndex=N,t(u,D),n(c)===null&&D===n(u)&&(g?(x(T),T=-1):g=!0,q(w,N-B))):(D.sortIndex=O,t(c,D),m||f||(m=!0,$(C))),D},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(D){var H=p;return function(){var N=p;p=H;try{return D.apply(this,arguments)}finally{p=N}}}})(Vw);Kw.exports=Vw;var jj=Kw.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 Ej=v,Kn=jj;function G(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);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 Yw=new Set,Il={};function po(e,t){pa(e,t),pa(e+"Capture",t)}function pa(e,t){for(Il[e]=t,e=0;e<t.length;e++)Yw.add(t[e])}var vs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gp=Object.prototype.hasOwnProperty,Rj=/^[: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]*$/,Gx={},Jx={};function Tj(e){return gp.call(Jx,e)?!0:gp.call(Gx,e)?!1:Rj.test(e)?Jx[e]=!0:(Gx[e]=!0,!1)}function Pj(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Dj(e,t,n,r){if(t===null||typeof t>"u"||Pj(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.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 mn(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var qt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){qt[e]=new mn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];qt[t]=new mn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){qt[e]=new mn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){qt[e]=new mn(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){qt[e]=new mn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){qt[e]=new mn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){qt[e]=new mn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){qt[e]=new mn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){qt[e]=new mn(e,5,!1,e.toLowerCase(),null,!1,!1)});var qg=/[\-:]([a-z])/g;function Kg(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(qg,Kg);qt[t]=new mn(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(qg,Kg);qt[t]=new mn(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(qg,Kg);qt[t]=new mn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){qt[e]=new mn(e,1,!1,e.toLowerCase(),null,!1,!1)});qt.xlinkHref=new mn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){qt[e]=new mn(e,1,!1,e.toLowerCase(),null,!0,!0)});function Vg(e,t,n,r){var s=qt.hasOwnProperty(t)?qt[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Dj(t,n,s,r)&&(n=null),r||s===null?Tj(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):s.mustUseProperty?e[s.propertyName]=n===null?s.type===3?!1:"":n:(t=s.attributeName,r=s.attributeNamespace,n===null?e.removeAttribute(t):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Ss=Ej.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Wc=Symbol.for("react.element"),Mo=Symbol.for("react.portal"),Lo=Symbol.for("react.fragment"),Yg=Symbol.for("react.strict_mode"),vp=Symbol.for("react.profiler"),Qw=Symbol.for("react.provider"),Xw=Symbol.for("react.context"),Qg=Symbol.for("react.forward_ref"),xp=Symbol.for("react.suspense"),yp=Symbol.for("react.suspense_list"),Xg=Symbol.for("react.memo"),zs=Symbol.for("react.lazy"),Gw=Symbol.for("react.offscreen"),Zx=Symbol.iterator;function Ha(e){return e===null||typeof e!="object"?null:(e=Zx&&e[Zx]||e["@@iterator"],typeof e=="function"?e:null)}var et=Object.assign,qh;function ll(e){if(qh===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);qh=t&&t[1]||""}return`
34
- `+qh+e}var Kh=!1;function Vh(e,t){if(!e||Kh)return"";Kh=!0;var n=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(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var s=u.stack.split(`
35
- `),i=r.stack.split(`
36
- `),o=s.length-1,l=i.length-1;1<=o&&0<=l&&s[o]!==i[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==i[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==i[l]){var c=`
37
- `+s[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{Kh=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ll(e):""}function Mj(e){switch(e.tag){case 5:return ll(e.type);case 16:return ll("Lazy");case 13:return ll("Suspense");case 19:return ll("SuspenseList");case 0:case 2:case 15:return e=Vh(e.type,!1),e;case 11:return e=Vh(e.type.render,!1),e;case 1:return e=Vh(e.type,!0),e;default:return""}}function _p(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 Lo:return"Fragment";case Mo:return"Portal";case vp:return"Profiler";case Yg:return"StrictMode";case xp:return"Suspense";case yp:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Xw:return(e.displayName||"Context")+".Consumer";case Qw:return(e._context.displayName||"Context")+".Provider";case Qg:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Xg:return t=e.displayName||null,t!==null?t:_p(e.type)||"Memo";case zs:t=e._payload,e=e._init;try{return _p(e(t))}catch{}}return null}function Lj(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 _p(t);case 8:return t===Yg?"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 vi(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Jw(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Aj(e){var t=Jw(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Uc(e){e._valueTracker||(e._valueTracker=Aj(e))}function Zw(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Jw(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ld(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 bp(e,t){var n=t.checked;return et({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ey(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=vi(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function e1(e,t){t=t.checked,t!=null&&Vg(e,"checked",t,!1)}function wp(e,t){e1(e,t);var n=vi(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Sp(e,t.type,n):t.hasOwnProperty("defaultValue")&&Sp(e,t.type,vi(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ty(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Sp(e,t,n){(t!=="number"||ld(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var cl=Array.isArray;function Vo(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+vi(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function kp(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(G(91));return et({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ny(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(G(92));if(cl(n)){if(1<n.length)throw Error(G(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:vi(n)}}function t1(e,t){var n=vi(t.value),r=vi(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function ry(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function n1(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 Cp(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?n1(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var qc,r1=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,s){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(qc=qc||document.createElement("div"),qc.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=qc.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Bl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var yl={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},Oj=["Webkit","ms","Moz","O"];Object.keys(yl).forEach(function(e){Oj.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),yl[t]=yl[e]})});function s1(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||yl.hasOwnProperty(e)&&yl[e]?(""+t).trim():t+"px"}function i1(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=s1(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var Ij=et({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 Np(e,t){if(t){if(Ij[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(G(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(G(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(G(61))}if(t.style!=null&&typeof t.style!="object")throw Error(G(62))}}function jp(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 Ep=null;function Gg(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Rp=null,Yo=null,Qo=null;function sy(e){if(e=bc(e)){if(typeof Rp!="function")throw Error(G(280));var t=e.stateNode;t&&(t=sh(t),Rp(e.stateNode,e.type,t))}}function o1(e){Yo?Qo?Qo.push(e):Qo=[e]:Yo=e}function a1(){if(Yo){var e=Yo,t=Qo;if(Qo=Yo=null,sy(e),t)for(e=0;e<t.length;e++)sy(t[e])}}function l1(e,t){return e(t)}function c1(){}var Yh=!1;function u1(e,t,n){if(Yh)return e(t,n);Yh=!0;try{return l1(e,t,n)}finally{Yh=!1,(Yo!==null||Qo!==null)&&(c1(),a1())}}function Fl(e,t){var n=e.stateNode;if(n===null)return null;var r=sh(n);if(r===null)return null;n=r[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":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(G(231,t,typeof n));return n}var Tp=!1;if(vs)try{var Wa={};Object.defineProperty(Wa,"passive",{get:function(){Tp=!0}}),window.addEventListener("test",Wa,Wa),window.removeEventListener("test",Wa,Wa)}catch{Tp=!1}function Bj(e,t,n,r,s,i,o,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(h){this.onError(h)}}var _l=!1,cd=null,ud=!1,Pp=null,Fj={onError:function(e){_l=!0,cd=e}};function zj(e,t,n,r,s,i,o,l,c){_l=!1,cd=null,Bj.apply(Fj,arguments)}function $j(e,t,n,r,s,i,o,l,c){if(zj.apply(this,arguments),_l){if(_l){var u=cd;_l=!1,cd=null}else throw Error(G(198));ud||(ud=!0,Pp=u)}}function mo(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function d1(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 iy(e){if(mo(e)!==e)throw Error(G(188))}function Hj(e){var t=e.alternate;if(!t){if(t=mo(e),t===null)throw Error(G(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return iy(s),e;if(i===r)return iy(s),t;i=i.sibling}throw Error(G(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o)throw Error(G(189))}}if(n.alternate!==r)throw Error(G(190))}if(n.tag!==3)throw Error(G(188));return n.stateNode.current===n?e:t}function h1(e){return e=Hj(e),e!==null?f1(e):null}function f1(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=f1(e);if(t!==null)return t;e=e.sibling}return null}var p1=Kn.unstable_scheduleCallback,oy=Kn.unstable_cancelCallback,Wj=Kn.unstable_shouldYield,Uj=Kn.unstable_requestPaint,ct=Kn.unstable_now,qj=Kn.unstable_getCurrentPriorityLevel,Jg=Kn.unstable_ImmediatePriority,m1=Kn.unstable_UserBlockingPriority,dd=Kn.unstable_NormalPriority,Kj=Kn.unstable_LowPriority,g1=Kn.unstable_IdlePriority,eh=null,Ur=null;function Vj(e){if(Ur&&typeof Ur.onCommitFiberRoot=="function")try{Ur.onCommitFiberRoot(eh,e,void 0,(e.current.flags&128)===128)}catch{}}var Sr=Math.clz32?Math.clz32:Xj,Yj=Math.log,Qj=Math.LN2;function Xj(e){return e>>>=0,e===0?32:31-(Yj(e)/Qj|0)|0}var Kc=64,Vc=4194304;function ul(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 hd(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~s;l!==0?r=ul(l):(i&=o,i!==0&&(r=ul(i)))}else o=n&~s,o!==0?r=ul(o):i!==0&&(r=ul(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Sr(t),s=1<<n,r|=e[n],t&=~s;return r}function Gj(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 Jj(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-Sr(i),l=1<<o,c=s[o];c===-1?(!(l&n)||l&r)&&(s[o]=Gj(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function Dp(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function v1(){var e=Kc;return Kc<<=1,!(Kc&4194240)&&(Kc=64),e}function Qh(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function yc(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Sr(t),e[t]=n}function Zj(e,t){var n=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 r=e.eventTimes;for(e=e.expirationTimes;0<n;){var s=31-Sr(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function Zg(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Sr(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var Oe=0;function x1(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var y1,ev,_1,b1,w1,Mp=!1,Yc=[],ii=null,oi=null,ai=null,zl=new Map,$l=new Map,Us=[],eE="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 ay(e,t){switch(e){case"focusin":case"focusout":ii=null;break;case"dragenter":case"dragleave":oi=null;break;case"mouseover":case"mouseout":ai=null;break;case"pointerover":case"pointerout":zl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":$l.delete(t.pointerId)}}function Ua(e,t,n,r,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},t!==null&&(t=bc(t),t!==null&&ev(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function tE(e,t,n,r,s){switch(t){case"focusin":return ii=Ua(ii,e,t,n,r,s),!0;case"dragenter":return oi=Ua(oi,e,t,n,r,s),!0;case"mouseover":return ai=Ua(ai,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return zl.set(i,Ua(zl.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,$l.set(i,Ua($l.get(i)||null,e,t,n,r,s)),!0}return!1}function S1(e){var t=Li(e.target);if(t!==null){var n=mo(t);if(n!==null){if(t=n.tag,t===13){if(t=d1(n),t!==null){e.blockedOn=t,w1(e.priority,function(){_1(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Lu(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Lp(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ep=r,n.target.dispatchEvent(r),Ep=null}else return t=bc(n),t!==null&&ev(t),e.blockedOn=n,!1;t.shift()}return!0}function ly(e,t,n){Lu(e)&&n.delete(t)}function nE(){Mp=!1,ii!==null&&Lu(ii)&&(ii=null),oi!==null&&Lu(oi)&&(oi=null),ai!==null&&Lu(ai)&&(ai=null),zl.forEach(ly),$l.forEach(ly)}function qa(e,t){e.blockedOn===t&&(e.blockedOn=null,Mp||(Mp=!0,Kn.unstable_scheduleCallback(Kn.unstable_NormalPriority,nE)))}function Hl(e){function t(s){return qa(s,e)}if(0<Yc.length){qa(Yc[0],e);for(var n=1;n<Yc.length;n++){var r=Yc[n];r.blockedOn===e&&(r.blockedOn=null)}}for(ii!==null&&qa(ii,e),oi!==null&&qa(oi,e),ai!==null&&qa(ai,e),zl.forEach(t),$l.forEach(t),n=0;n<Us.length;n++)r=Us[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Us.length&&(n=Us[0],n.blockedOn===null);)S1(n),n.blockedOn===null&&Us.shift()}var Xo=Ss.ReactCurrentBatchConfig,fd=!0;function rE(e,t,n,r){var s=Oe,i=Xo.transition;Xo.transition=null;try{Oe=1,tv(e,t,n,r)}finally{Oe=s,Xo.transition=i}}function sE(e,t,n,r){var s=Oe,i=Xo.transition;Xo.transition=null;try{Oe=4,tv(e,t,n,r)}finally{Oe=s,Xo.transition=i}}function tv(e,t,n,r){if(fd){var s=Lp(e,t,n,r);if(s===null)of(e,t,r,pd,n),ay(e,r);else if(tE(s,e,t,n,r))r.stopPropagation();else if(ay(e,r),t&4&&-1<eE.indexOf(e)){for(;s!==null;){var i=bc(s);if(i!==null&&y1(i),i=Lp(e,t,n,r),i===null&&of(e,t,r,pd,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else of(e,t,r,null,n)}}var pd=null;function Lp(e,t,n,r){if(pd=null,e=Gg(r),e=Li(e),e!==null)if(t=mo(e),t===null)e=null;else if(n=t.tag,n===13){if(e=d1(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return pd=e,null}function k1(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(qj()){case Jg:return 1;case m1:return 4;case dd:case Kj:return 16;case g1:return 536870912;default:return 16}default:return 16}}var ni=null,nv=null,Au=null;function C1(){if(Au)return Au;var e,t=nv,n=t.length,r,s="value"in ni?ni.value:ni.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===s[i-r];r++);return Au=s.slice(e,1<r?1-r:void 0)}function Ou(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 Qc(){return!0}function cy(){return!1}function Yn(e){function t(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Qc:cy,this.isPropagationStopped=cy,this}return et(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Qc)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Qc)},persist:function(){},isPersistent:Qc}),t}var Ea={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},rv=Yn(Ea),_c=et({},Ea,{view:0,detail:0}),iE=Yn(_c),Xh,Gh,Ka,th=et({},_c,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:sv,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!==Ka&&(Ka&&e.type==="mousemove"?(Xh=e.screenX-Ka.screenX,Gh=e.screenY-Ka.screenY):Gh=Xh=0,Ka=e),Xh)},movementY:function(e){return"movementY"in e?e.movementY:Gh}}),uy=Yn(th),oE=et({},th,{dataTransfer:0}),aE=Yn(oE),lE=et({},_c,{relatedTarget:0}),Jh=Yn(lE),cE=et({},Ea,{animationName:0,elapsedTime:0,pseudoElement:0}),uE=Yn(cE),dE=et({},Ea,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),hE=Yn(dE),fE=et({},Ea,{data:0}),dy=Yn(fE),pE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},mE={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"},gE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function vE(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=gE[e])?!!t[e]:!1}function sv(){return vE}var xE=et({},_c,{key:function(e){if(e.key){var t=pE[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ou(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?mE[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:sv,charCode:function(e){return e.type==="keypress"?Ou(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ou(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),yE=Yn(xE),_E=et({},th,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hy=Yn(_E),bE=et({},_c,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:sv}),wE=Yn(bE),SE=et({},Ea,{propertyName:0,elapsedTime:0,pseudoElement:0}),kE=Yn(SE),CE=et({},th,{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}),NE=Yn(CE),jE=[9,13,27,32],iv=vs&&"CompositionEvent"in window,bl=null;vs&&"documentMode"in document&&(bl=document.documentMode);var EE=vs&&"TextEvent"in window&&!bl,N1=vs&&(!iv||bl&&8<bl&&11>=bl),fy=" ",py=!1;function j1(e,t){switch(e){case"keyup":return jE.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function E1(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ao=!1;function RE(e,t){switch(e){case"compositionend":return E1(t);case"keypress":return t.which!==32?null:(py=!0,fy);case"textInput":return e=t.data,e===fy&&py?null:e;default:return null}}function TE(e,t){if(Ao)return e==="compositionend"||!iv&&j1(e,t)?(e=C1(),Au=nv=ni=null,Ao=!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 N1&&t.locale!=="ko"?null:t.data;default:return null}}var PE={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 my(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!PE[e.type]:t==="textarea"}function R1(e,t,n,r){o1(r),t=md(t,"onChange"),0<t.length&&(n=new rv("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var wl=null,Wl=null;function DE(e){z1(e,0)}function nh(e){var t=Bo(e);if(Zw(t))return e}function ME(e,t){if(e==="change")return t}var T1=!1;if(vs){var Zh;if(vs){var ef="oninput"in document;if(!ef){var gy=document.createElement("div");gy.setAttribute("oninput","return;"),ef=typeof gy.oninput=="function"}Zh=ef}else Zh=!1;T1=Zh&&(!document.documentMode||9<document.documentMode)}function vy(){wl&&(wl.detachEvent("onpropertychange",P1),Wl=wl=null)}function P1(e){if(e.propertyName==="value"&&nh(Wl)){var t=[];R1(t,Wl,e,Gg(e)),u1(DE,t)}}function LE(e,t,n){e==="focusin"?(vy(),wl=t,Wl=n,wl.attachEvent("onpropertychange",P1)):e==="focusout"&&vy()}function AE(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return nh(Wl)}function OE(e,t){if(e==="click")return nh(t)}function IE(e,t){if(e==="input"||e==="change")return nh(t)}function BE(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Nr=typeof Object.is=="function"?Object.is:BE;function Ul(e,t){if(Nr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!gp.call(t,s)||!Nr(e[s],t[s]))return!1}return!0}function xy(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function yy(e,t){var n=xy(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=xy(n)}}function D1(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?D1(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function M1(){for(var e=window,t=ld();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ld(e.document)}return t}function ov(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 FE(e){var t=M1(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&D1(n.ownerDocument.documentElement,n)){if(r!==null&&ov(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=yy(n,i);var o=yy(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var zE=vs&&"documentMode"in document&&11>=document.documentMode,Oo=null,Ap=null,Sl=null,Op=!1;function _y(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Op||Oo==null||Oo!==ld(r)||(r=Oo,"selectionStart"in r&&ov(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Sl&&Ul(Sl,r)||(Sl=r,r=md(Ap,"onSelect"),0<r.length&&(t=new rv("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Oo)))}function Xc(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Io={animationend:Xc("Animation","AnimationEnd"),animationiteration:Xc("Animation","AnimationIteration"),animationstart:Xc("Animation","AnimationStart"),transitionend:Xc("Transition","TransitionEnd")},tf={},L1={};vs&&(L1=document.createElement("div").style,"AnimationEvent"in window||(delete Io.animationend.animation,delete Io.animationiteration.animation,delete Io.animationstart.animation),"TransitionEvent"in window||delete Io.transitionend.transition);function rh(e){if(tf[e])return tf[e];if(!Io[e])return e;var t=Io[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in L1)return tf[e]=t[n];return e}var A1=rh("animationend"),O1=rh("animationiteration"),I1=rh("animationstart"),B1=rh("transitionend"),F1=new Map,by="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 bi(e,t){F1.set(e,t),po(t,[e])}for(var nf=0;nf<by.length;nf++){var rf=by[nf],$E=rf.toLowerCase(),HE=rf[0].toUpperCase()+rf.slice(1);bi($E,"on"+HE)}bi(A1,"onAnimationEnd");bi(O1,"onAnimationIteration");bi(I1,"onAnimationStart");bi("dblclick","onDoubleClick");bi("focusin","onFocus");bi("focusout","onBlur");bi(B1,"onTransitionEnd");pa("onMouseEnter",["mouseout","mouseover"]);pa("onMouseLeave",["mouseout","mouseover"]);pa("onPointerEnter",["pointerout","pointerover"]);pa("onPointerLeave",["pointerout","pointerover"]);po("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));po("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));po("onBeforeInput",["compositionend","keypress","textInput","paste"]);po("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));po("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));po("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var dl="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(" "),WE=new Set("cancel close invalid load scroll toggle".split(" ").concat(dl));function wy(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,$j(r,t,void 0,e),e.currentTarget=null}function z1(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;wy(s,l,u),i=c}else for(o=0;o<r.length;o++){if(l=r[o],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;wy(s,l,u),i=c}}}if(ud)throw e=Pp,ud=!1,Pp=null,e}function He(e,t){var n=t[$p];n===void 0&&(n=t[$p]=new Set);var r=e+"__bubble";n.has(r)||($1(t,e,2,!1),n.add(r))}function sf(e,t,n){var r=0;t&&(r|=4),$1(n,e,r,t)}var Gc="_reactListening"+Math.random().toString(36).slice(2);function ql(e){if(!e[Gc]){e[Gc]=!0,Yw.forEach(function(n){n!=="selectionchange"&&(WE.has(n)||sf(n,!1,e),sf(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Gc]||(t[Gc]=!0,sf("selectionchange",!1,t))}}function $1(e,t,n,r){switch(k1(t)){case 1:var s=rE;break;case 4:s=sE;break;default:s=tv}n=s.bind(null,t,n,e),s=void 0,!Tp||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function of(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;o=o.return}for(;l!==null;){if(o=Li(l),o===null)return;if(c=o.tag,c===5||c===6){r=i=o;continue e}l=l.parentNode}}r=r.return}u1(function(){var u=i,h=Gg(n),d=[];e:{var p=F1.get(e);if(p!==void 0){var f=rv,m=e;switch(e){case"keypress":if(Ou(n)===0)break e;case"keydown":case"keyup":f=yE;break;case"focusin":m="focus",f=Jh;break;case"focusout":m="blur",f=Jh;break;case"beforeblur":case"afterblur":f=Jh;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=uy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=aE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=wE;break;case A1:case O1:case I1:f=uE;break;case B1:f=kE;break;case"scroll":f=iE;break;case"wheel":f=NE;break;case"copy":case"cut":case"paste":f=hE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=hy}var g=(t&4)!==0,b=!g&&e==="scroll",x=g?p!==null?p+"Capture":null:p;g=[];for(var y=u,_;y!==null;){_=y;var w=_.stateNode;if(_.tag===5&&w!==null&&(_=w,x!==null&&(w=Fl(y,x),w!=null&&g.push(Kl(y,w,_)))),b)break;y=y.return}0<g.length&&(p=new f(p,m,null,n,h),d.push({event:p,listeners:g}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",f=e==="mouseout"||e==="pointerout",p&&n!==Ep&&(m=n.relatedTarget||n.fromElement)&&(Li(m)||m[xs]))break e;if((f||p)&&(p=h.window===h?h:(p=h.ownerDocument)?p.defaultView||p.parentWindow:window,f?(m=n.relatedTarget||n.toElement,f=u,m=m?Li(m):null,m!==null&&(b=mo(m),m!==b||m.tag!==5&&m.tag!==6)&&(m=null)):(f=null,m=u),f!==m)){if(g=uy,w="onMouseLeave",x="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(g=hy,w="onPointerLeave",x="onPointerEnter",y="pointer"),b=f==null?p:Bo(f),_=m==null?p:Bo(m),p=new g(w,y+"leave",f,n,h),p.target=b,p.relatedTarget=_,w=null,Li(h)===u&&(g=new g(x,y+"enter",m,n,h),g.target=_,g.relatedTarget=b,w=g),b=w,f&&m)t:{for(g=f,x=m,y=0,_=g;_;_=wo(_))y++;for(_=0,w=x;w;w=wo(w))_++;for(;0<y-_;)g=wo(g),y--;for(;0<_-y;)x=wo(x),_--;for(;y--;){if(g===x||x!==null&&g===x.alternate)break t;g=wo(g),x=wo(x)}g=null}else g=null;f!==null&&Sy(d,p,f,g,!1),m!==null&&b!==null&&Sy(d,b,m,g,!0)}}e:{if(p=u?Bo(u):window,f=p.nodeName&&p.nodeName.toLowerCase(),f==="select"||f==="input"&&p.type==="file")var C=ME;else if(my(p))if(T1)C=IE;else{C=AE;var S=LE}else(f=p.nodeName)&&f.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(C=OE);if(C&&(C=C(e,u))){R1(d,C,n,h);break e}S&&S(e,p,u),e==="focusout"&&(S=p._wrapperState)&&S.controlled&&p.type==="number"&&Sp(p,"number",p.value)}switch(S=u?Bo(u):window,e){case"focusin":(my(S)||S.contentEditable==="true")&&(Oo=S,Ap=u,Sl=null);break;case"focusout":Sl=Ap=Oo=null;break;case"mousedown":Op=!0;break;case"contextmenu":case"mouseup":case"dragend":Op=!1,_y(d,n,h);break;case"selectionchange":if(zE)break;case"keydown":case"keyup":_y(d,n,h)}var R;if(iv)e:{switch(e){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else Ao?j1(e,n)&&(T="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(T="onCompositionStart");T&&(N1&&n.locale!=="ko"&&(Ao||T!=="onCompositionStart"?T==="onCompositionEnd"&&Ao&&(R=C1()):(ni=h,nv="value"in ni?ni.value:ni.textContent,Ao=!0)),S=md(u,T),0<S.length&&(T=new dy(T,e,null,n,h),d.push({event:T,listeners:S}),R?T.data=R:(R=E1(n),R!==null&&(T.data=R)))),(R=EE?RE(e,n):TE(e,n))&&(u=md(u,"onBeforeInput"),0<u.length&&(h=new dy("onBeforeInput","beforeinput",null,n,h),d.push({event:h,listeners:u}),h.data=R))}z1(d,t)})}function Kl(e,t,n){return{instance:e,listener:t,currentTarget:n}}function md(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Fl(e,n),i!=null&&r.unshift(Kl(e,i,s)),i=Fl(e,t),i!=null&&r.push(Kl(e,i,s))),e=e.return}return r}function wo(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Sy(e,t,n,r,s){for(var i=t._reactName,o=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,s?(c=Fl(n,i),c!=null&&o.unshift(Kl(n,c,l))):s||(c=Fl(n,i),c!=null&&o.push(Kl(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var UE=/\r\n?/g,qE=/\u0000|\uFFFD/g;function ky(e){return(typeof e=="string"?e:""+e).replace(UE,`
38
- `).replace(qE,"")}function Jc(e,t,n){if(t=ky(t),ky(e)!==t&&n)throw Error(G(425))}function gd(){}var Ip=null,Bp=null;function Fp(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 zp=typeof setTimeout=="function"?setTimeout:void 0,KE=typeof clearTimeout=="function"?clearTimeout:void 0,Cy=typeof Promise=="function"?Promise:void 0,VE=typeof queueMicrotask=="function"?queueMicrotask:typeof Cy<"u"?function(e){return Cy.resolve(null).then(e).catch(YE)}:zp;function YE(e){setTimeout(function(){throw e})}function af(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){e.removeChild(s),Hl(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);Hl(t)}function li(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 Ny(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Ra=Math.random().toString(36).slice(2),$r="__reactFiber$"+Ra,Vl="__reactProps$"+Ra,xs="__reactContainer$"+Ra,$p="__reactEvents$"+Ra,QE="__reactListeners$"+Ra,XE="__reactHandles$"+Ra;function Li(e){var t=e[$r];if(t)return t;for(var n=e.parentNode;n;){if(t=n[xs]||n[$r]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Ny(e);e!==null;){if(n=e[$r])return n;e=Ny(e)}return t}e=n,n=e.parentNode}return null}function bc(e){return e=e[$r]||e[xs],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Bo(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(G(33))}function sh(e){return e[Vl]||null}var Hp=[],Fo=-1;function wi(e){return{current:e}}function Ue(e){0>Fo||(e.current=Hp[Fo],Hp[Fo]=null,Fo--)}function $e(e,t){Fo++,Hp[Fo]=e.current,e.current=t}var xi={},nn=wi(xi),Tn=wi(!1),Gi=xi;function ma(e,t){var n=e.type.contextTypes;if(!n)return xi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Pn(e){return e=e.childContextTypes,e!=null}function vd(){Ue(Tn),Ue(nn)}function jy(e,t,n){if(nn.current!==xi)throw Error(G(168));$e(nn,t),$e(Tn,n)}function H1(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(G(108,Lj(e)||"Unknown",s));return et({},n,r)}function xd(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||xi,Gi=nn.current,$e(nn,e),$e(Tn,Tn.current),!0}function Ey(e,t,n){var r=e.stateNode;if(!r)throw Error(G(169));n?(e=H1(e,t,Gi),r.__reactInternalMemoizedMergedChildContext=e,Ue(Tn),Ue(nn),$e(nn,e)):Ue(Tn),$e(Tn,n)}var is=null,ih=!1,lf=!1;function W1(e){is===null?is=[e]:is.push(e)}function GE(e){ih=!0,W1(e)}function Si(){if(!lf&&is!==null){lf=!0;var e=0,t=Oe;try{var n=is;for(Oe=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}is=null,ih=!1}catch(s){throw is!==null&&(is=is.slice(e+1)),p1(Jg,Si),s}finally{Oe=t,lf=!1}}return null}var zo=[],$o=0,yd=null,_d=0,nr=[],rr=0,Ji=null,ds=1,hs="";function Ei(e,t){zo[$o++]=_d,zo[$o++]=yd,yd=e,_d=t}function U1(e,t,n){nr[rr++]=ds,nr[rr++]=hs,nr[rr++]=Ji,Ji=e;var r=ds;e=hs;var s=32-Sr(r)-1;r&=~(1<<s),n+=1;var i=32-Sr(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,ds=1<<32-Sr(t)+s|n<<s|r,hs=i+e}else ds=1<<i|n<<s|r,hs=e}function av(e){e.return!==null&&(Ei(e,1),U1(e,1,0))}function lv(e){for(;e===yd;)yd=zo[--$o],zo[$o]=null,_d=zo[--$o],zo[$o]=null;for(;e===Ji;)Ji=nr[--rr],nr[rr]=null,hs=nr[--rr],nr[rr]=null,ds=nr[--rr],nr[rr]=null}var Wn=null,Hn=null,Ve=!1,wr=null;function q1(e,t){var n=or(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Ry(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Wn=e,Hn=li(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Wn=e,Hn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Ji!==null?{id:ds,overflow:hs}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=or(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Wn=e,Hn=null,!0):!1;default:return!1}}function Wp(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Up(e){if(Ve){var t=Hn;if(t){var n=t;if(!Ry(e,t)){if(Wp(e))throw Error(G(418));t=li(n.nextSibling);var r=Wn;t&&Ry(e,t)?q1(r,n):(e.flags=e.flags&-4097|2,Ve=!1,Wn=e)}}else{if(Wp(e))throw Error(G(418));e.flags=e.flags&-4097|2,Ve=!1,Wn=e}}}function Ty(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Wn=e}function Zc(e){if(e!==Wn)return!1;if(!Ve)return Ty(e),Ve=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Fp(e.type,e.memoizedProps)),t&&(t=Hn)){if(Wp(e))throw K1(),Error(G(418));for(;t;)q1(e,t),t=li(t.nextSibling)}if(Ty(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(G(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Hn=li(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Hn=null}}else Hn=Wn?li(e.stateNode.nextSibling):null;return!0}function K1(){for(var e=Hn;e;)e=li(e.nextSibling)}function ga(){Hn=Wn=null,Ve=!1}function cv(e){wr===null?wr=[e]:wr.push(e)}var JE=Ss.ReactCurrentBatchConfig;function Va(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(G(309));var r=n.stateNode}if(!r)throw Error(G(147,e));var s=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(o){var l=s.refs;o===null?delete l[i]:l[i]=o},t._stringRef=i,t)}if(typeof e!="string")throw Error(G(284));if(!n._owner)throw Error(G(290,e))}return e}function eu(e,t){throw e=Object.prototype.toString.call(t),Error(G(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Py(e){var t=e._init;return t(e._payload)}function V1(e){function t(x,y){if(e){var _=x.deletions;_===null?(x.deletions=[y],x.flags|=16):_.push(y)}}function n(x,y){if(!e)return null;for(;y!==null;)t(x,y),y=y.sibling;return null}function r(x,y){for(x=new Map;y!==null;)y.key!==null?x.set(y.key,y):x.set(y.index,y),y=y.sibling;return x}function s(x,y){return x=hi(x,y),x.index=0,x.sibling=null,x}function i(x,y,_){return x.index=_,e?(_=x.alternate,_!==null?(_=_.index,_<y?(x.flags|=2,y):_):(x.flags|=2,y)):(x.flags|=1048576,y)}function o(x){return e&&x.alternate===null&&(x.flags|=2),x}function l(x,y,_,w){return y===null||y.tag!==6?(y=mf(_,x.mode,w),y.return=x,y):(y=s(y,_),y.return=x,y)}function c(x,y,_,w){var C=_.type;return C===Lo?h(x,y,_.props.children,w,_.key):y!==null&&(y.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===zs&&Py(C)===y.type)?(w=s(y,_.props),w.ref=Va(x,y,_),w.return=x,w):(w=Wu(_.type,_.key,_.props,null,x.mode,w),w.ref=Va(x,y,_),w.return=x,w)}function u(x,y,_,w){return y===null||y.tag!==4||y.stateNode.containerInfo!==_.containerInfo||y.stateNode.implementation!==_.implementation?(y=gf(_,x.mode,w),y.return=x,y):(y=s(y,_.children||[]),y.return=x,y)}function h(x,y,_,w,C){return y===null||y.tag!==7?(y=Qi(_,x.mode,w,C),y.return=x,y):(y=s(y,_),y.return=x,y)}function d(x,y,_){if(typeof y=="string"&&y!==""||typeof y=="number")return y=mf(""+y,x.mode,_),y.return=x,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Wc:return _=Wu(y.type,y.key,y.props,null,x.mode,_),_.ref=Va(x,null,y),_.return=x,_;case Mo:return y=gf(y,x.mode,_),y.return=x,y;case zs:var w=y._init;return d(x,w(y._payload),_)}if(cl(y)||Ha(y))return y=Qi(y,x.mode,_,null),y.return=x,y;eu(x,y)}return null}function p(x,y,_,w){var C=y!==null?y.key:null;if(typeof _=="string"&&_!==""||typeof _=="number")return C!==null?null:l(x,y,""+_,w);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Wc:return _.key===C?c(x,y,_,w):null;case Mo:return _.key===C?u(x,y,_,w):null;case zs:return C=_._init,p(x,y,C(_._payload),w)}if(cl(_)||Ha(_))return C!==null?null:h(x,y,_,w,null);eu(x,_)}return null}function f(x,y,_,w,C){if(typeof w=="string"&&w!==""||typeof w=="number")return x=x.get(_)||null,l(y,x,""+w,C);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Wc:return x=x.get(w.key===null?_:w.key)||null,c(y,x,w,C);case Mo:return x=x.get(w.key===null?_:w.key)||null,u(y,x,w,C);case zs:var S=w._init;return f(x,y,_,S(w._payload),C)}if(cl(w)||Ha(w))return x=x.get(_)||null,h(y,x,w,C,null);eu(y,w)}return null}function m(x,y,_,w){for(var C=null,S=null,R=y,T=y=0,F=null;R!==null&&T<_.length;T++){R.index>T?(F=R,R=null):F=R.sibling;var P=p(x,R,_[T],w);if(P===null){R===null&&(R=F);break}e&&R&&P.alternate===null&&t(x,R),y=i(P,y,T),S===null?C=P:S.sibling=P,S=P,R=F}if(T===_.length)return n(x,R),Ve&&Ei(x,T),C;if(R===null){for(;T<_.length;T++)R=d(x,_[T],w),R!==null&&(y=i(R,y,T),S===null?C=R:S.sibling=R,S=R);return Ve&&Ei(x,T),C}for(R=r(x,R);T<_.length;T++)F=f(R,x,T,_[T],w),F!==null&&(e&&F.alternate!==null&&R.delete(F.key===null?T:F.key),y=i(F,y,T),S===null?C=F:S.sibling=F,S=F);return e&&R.forEach(function(I){return t(x,I)}),Ve&&Ei(x,T),C}function g(x,y,_,w){var C=Ha(_);if(typeof C!="function")throw Error(G(150));if(_=C.call(_),_==null)throw Error(G(151));for(var S=C=null,R=y,T=y=0,F=null,P=_.next();R!==null&&!P.done;T++,P=_.next()){R.index>T?(F=R,R=null):F=R.sibling;var I=p(x,R,P.value,w);if(I===null){R===null&&(R=F);break}e&&R&&I.alternate===null&&t(x,R),y=i(I,y,T),S===null?C=I:S.sibling=I,S=I,R=F}if(P.done)return n(x,R),Ve&&Ei(x,T),C;if(R===null){for(;!P.done;T++,P=_.next())P=d(x,P.value,w),P!==null&&(y=i(P,y,T),S===null?C=P:S.sibling=P,S=P);return Ve&&Ei(x,T),C}for(R=r(x,R);!P.done;T++,P=_.next())P=f(R,x,T,P.value,w),P!==null&&(e&&P.alternate!==null&&R.delete(P.key===null?T:P.key),y=i(P,y,T),S===null?C=P:S.sibling=P,S=P);return e&&R.forEach(function(A){return t(x,A)}),Ve&&Ei(x,T),C}function b(x,y,_,w){if(typeof _=="object"&&_!==null&&_.type===Lo&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case Wc:e:{for(var C=_.key,S=y;S!==null;){if(S.key===C){if(C=_.type,C===Lo){if(S.tag===7){n(x,S.sibling),y=s(S,_.props.children),y.return=x,x=y;break e}}else if(S.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===zs&&Py(C)===S.type){n(x,S.sibling),y=s(S,_.props),y.ref=Va(x,S,_),y.return=x,x=y;break e}n(x,S);break}else t(x,S);S=S.sibling}_.type===Lo?(y=Qi(_.props.children,x.mode,w,_.key),y.return=x,x=y):(w=Wu(_.type,_.key,_.props,null,x.mode,w),w.ref=Va(x,y,_),w.return=x,x=w)}return o(x);case Mo:e:{for(S=_.key;y!==null;){if(y.key===S)if(y.tag===4&&y.stateNode.containerInfo===_.containerInfo&&y.stateNode.implementation===_.implementation){n(x,y.sibling),y=s(y,_.children||[]),y.return=x,x=y;break e}else{n(x,y);break}else t(x,y);y=y.sibling}y=gf(_,x.mode,w),y.return=x,x=y}return o(x);case zs:return S=_._init,b(x,y,S(_._payload),w)}if(cl(_))return m(x,y,_,w);if(Ha(_))return g(x,y,_,w);eu(x,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,y!==null&&y.tag===6?(n(x,y.sibling),y=s(y,_),y.return=x,x=y):(n(x,y),y=mf(_,x.mode,w),y.return=x,x=y),o(x)):n(x,y)}return b}var va=V1(!0),Y1=V1(!1),bd=wi(null),wd=null,Ho=null,uv=null;function dv(){uv=Ho=wd=null}function hv(e){var t=bd.current;Ue(bd),e._currentValue=t}function qp(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Go(e,t){wd=e,uv=Ho=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(En=!0),e.firstContext=null)}function ur(e){var t=e._currentValue;if(uv!==e)if(e={context:e,memoizedValue:t,next:null},Ho===null){if(wd===null)throw Error(G(308));Ho=e,wd.dependencies={lanes:0,firstContext:e}}else Ho=Ho.next=e;return t}var Ai=null;function fv(e){Ai===null?Ai=[e]:Ai.push(e)}function Q1(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,fv(t)):(n.next=s.next,s.next=n),t.interleaved=n,ys(e,r)}function ys(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var $s=!1;function pv(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function X1(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 ps(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ci(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Me&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,ys(e,n)}return s=r.interleaved,s===null?(t.next=t,fv(r)):(t.next=s.next,s.next=t),r.interleaved=t,ys(e,n)}function Iu(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Zg(e,n)}}function Dy(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Sd(e,t,n,r){var s=e.updateQueue;$s=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var h=e.alternate;h!==null&&(h=h.updateQueue,l=h.lastBaseUpdate,l!==o&&(l===null?h.firstBaseUpdate=u:l.next=u,h.lastBaseUpdate=c))}if(i!==null){var d=s.baseState;o=0,h=u=c=null,l=i;do{var p=l.lane,f=l.eventTime;if((r&p)===p){h!==null&&(h=h.next={eventTime:f,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=e,g=l;switch(p=t,f=n,g.tag){case 1:if(m=g.payload,typeof m=="function"){d=m.call(f,d,p);break e}d=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,p=typeof m=="function"?m.call(f,d,p):m,p==null)break e;d=et({},d,p);break e;case 2:$s=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=s.effects,p===null?s.effects=[l]:p.push(l))}else f={eventTime:f,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},h===null?(u=h=f,c=d):h=h.next=f,o|=p;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;p=l,l=p.next,p.next=null,s.lastBaseUpdate=p,s.shared.pending=null}}while(!0);if(h===null&&(c=d),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=h,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);eo|=o,e.lanes=o,e.memoizedState=d}}function My(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(G(191,s));s.call(r)}}}var wc={},qr=wi(wc),Yl=wi(wc),Ql=wi(wc);function Oi(e){if(e===wc)throw Error(G(174));return e}function mv(e,t){switch($e(Ql,t),$e(Yl,e),$e(qr,wc),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Cp(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Cp(t,e)}Ue(qr),$e(qr,t)}function xa(){Ue(qr),Ue(Yl),Ue(Ql)}function G1(e){Oi(Ql.current);var t=Oi(qr.current),n=Cp(t,e.type);t!==n&&($e(Yl,e),$e(qr,n))}function gv(e){Yl.current===e&&(Ue(qr),Ue(Yl))}var Je=wi(0);function kd(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.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 cf=[];function vv(){for(var e=0;e<cf.length;e++)cf[e]._workInProgressVersionPrimary=null;cf.length=0}var Bu=Ss.ReactCurrentDispatcher,uf=Ss.ReactCurrentBatchConfig,Zi=0,Ze=null,bt=null,Pt=null,Cd=!1,kl=!1,Xl=0,ZE=0;function Yt(){throw Error(G(321))}function xv(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Nr(e[n],t[n]))return!1;return!0}function yv(e,t,n,r,s,i){if(Zi=i,Ze=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Bu.current=e===null||e.memoizedState===null?r4:s4,e=n(r,s),kl){i=0;do{if(kl=!1,Xl=0,25<=i)throw Error(G(301));i+=1,Pt=bt=null,t.updateQueue=null,Bu.current=i4,e=n(r,s)}while(kl)}if(Bu.current=Nd,t=bt!==null&&bt.next!==null,Zi=0,Pt=bt=Ze=null,Cd=!1,t)throw Error(G(300));return e}function _v(){var e=Xl!==0;return Xl=0,e}function Ar(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pt===null?Ze.memoizedState=Pt=e:Pt=Pt.next=e,Pt}function dr(){if(bt===null){var e=Ze.alternate;e=e!==null?e.memoizedState:null}else e=bt.next;var t=Pt===null?Ze.memoizedState:Pt.next;if(t!==null)Pt=t,bt=e;else{if(e===null)throw Error(G(310));bt=e,e={memoizedState:bt.memoizedState,baseState:bt.baseState,baseQueue:bt.baseQueue,queue:bt.queue,next:null},Pt===null?Ze.memoizedState=Pt=e:Pt=Pt.next=e}return Pt}function Gl(e,t){return typeof t=="function"?t(e):t}function df(e){var t=dr(),n=t.queue;if(n===null)throw Error(G(311));n.lastRenderedReducer=e;var r=bt,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var l=o=null,c=null,u=i;do{var h=u.lane;if((Zi&h)===h)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var d={lane:h,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=d,o=r):c=c.next=d,Ze.lanes|=h,eo|=h}u=u.next}while(u!==null&&u!==i);c===null?o=r:c.next=l,Nr(r,t.memoizedState)||(En=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do i=s.lane,Ze.lanes|=i,eo|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function hf(e){var t=dr(),n=t.queue;if(n===null)throw Error(G(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=e(i,o.action),o=o.next;while(o!==s);Nr(i,t.memoizedState)||(En=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function J1(){}function Z1(e,t){var n=Ze,r=dr(),s=t(),i=!Nr(r.memoizedState,s);if(i&&(r.memoizedState=s,En=!0),r=r.queue,bv(nS.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Pt!==null&&Pt.memoizedState.tag&1){if(n.flags|=2048,Jl(9,tS.bind(null,n,r,s,t),void 0,null),Ot===null)throw Error(G(349));Zi&30||eS(n,t,s)}return s}function eS(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ze.updateQueue,t===null?(t={lastEffect:null,stores:null},Ze.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function tS(e,t,n,r){t.value=n,t.getSnapshot=r,rS(t)&&sS(e)}function nS(e,t,n){return n(function(){rS(t)&&sS(e)})}function rS(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Nr(e,n)}catch{return!0}}function sS(e){var t=ys(e,1);t!==null&&kr(t,e,1,-1)}function Ly(e){var t=Ar();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Gl,lastRenderedState:e},t.queue=e,e=e.dispatch=n4.bind(null,Ze,e),[t.memoizedState,e]}function Jl(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Ze.updateQueue,t===null?(t={lastEffect:null,stores:null},Ze.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function iS(){return dr().memoizedState}function Fu(e,t,n,r){var s=Ar();Ze.flags|=e,s.memoizedState=Jl(1|t,n,void 0,r===void 0?null:r)}function oh(e,t,n,r){var s=dr();r=r===void 0?null:r;var i=void 0;if(bt!==null){var o=bt.memoizedState;if(i=o.destroy,r!==null&&xv(r,o.deps)){s.memoizedState=Jl(t,n,i,r);return}}Ze.flags|=e,s.memoizedState=Jl(1|t,n,i,r)}function Ay(e,t){return Fu(8390656,8,e,t)}function bv(e,t){return oh(2048,8,e,t)}function oS(e,t){return oh(4,2,e,t)}function aS(e,t){return oh(4,4,e,t)}function lS(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 cS(e,t,n){return n=n!=null?n.concat([e]):null,oh(4,4,lS.bind(null,t,e),n)}function wv(){}function uS(e,t){var n=dr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&xv(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function dS(e,t){var n=dr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&xv(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function hS(e,t,n){return Zi&21?(Nr(n,t)||(n=v1(),Ze.lanes|=n,eo|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,En=!0),e.memoizedState=n)}function e4(e,t){var n=Oe;Oe=n!==0&&4>n?n:4,e(!0);var r=uf.transition;uf.transition={};try{e(!1),t()}finally{Oe=n,uf.transition=r}}function fS(){return dr().memoizedState}function t4(e,t,n){var r=di(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},pS(e))mS(t,n);else if(n=Q1(e,t,n,r),n!==null){var s=fn();kr(n,e,r,s),gS(n,t,r)}}function n4(e,t,n){var r=di(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(pS(e))mS(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,l=i(o,n);if(s.hasEagerState=!0,s.eagerState=l,Nr(l,o)){var c=t.interleaved;c===null?(s.next=s,fv(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=Q1(e,t,s,r),n!==null&&(s=fn(),kr(n,e,r,s),gS(n,t,r))}}function pS(e){var t=e.alternate;return e===Ze||t!==null&&t===Ze}function mS(e,t){kl=Cd=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function gS(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Zg(e,n)}}var Nd={readContext:ur,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},r4={readContext:ur,useCallback:function(e,t){return Ar().memoizedState=[e,t===void 0?null:t],e},useContext:ur,useEffect:Ay,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Fu(4194308,4,lS.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Fu(4194308,4,e,t)},useInsertionEffect:function(e,t){return Fu(4,2,e,t)},useMemo:function(e,t){var n=Ar();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ar();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=t4.bind(null,Ze,e),[r.memoizedState,e]},useRef:function(e){var t=Ar();return e={current:e},t.memoizedState=e},useState:Ly,useDebugValue:wv,useDeferredValue:function(e){return Ar().memoizedState=e},useTransition:function(){var e=Ly(!1),t=e[0];return e=e4.bind(null,e[1]),Ar().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ze,s=Ar();if(Ve){if(n===void 0)throw Error(G(407));n=n()}else{if(n=t(),Ot===null)throw Error(G(349));Zi&30||eS(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,Ay(nS.bind(null,r,i,e),[e]),r.flags|=2048,Jl(9,tS.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Ar(),t=Ot.identifierPrefix;if(Ve){var n=hs,r=ds;n=(r&~(1<<32-Sr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Xl++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=ZE++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},s4={readContext:ur,useCallback:uS,useContext:ur,useEffect:bv,useImperativeHandle:cS,useInsertionEffect:oS,useLayoutEffect:aS,useMemo:dS,useReducer:df,useRef:iS,useState:function(){return df(Gl)},useDebugValue:wv,useDeferredValue:function(e){var t=dr();return hS(t,bt.memoizedState,e)},useTransition:function(){var e=df(Gl)[0],t=dr().memoizedState;return[e,t]},useMutableSource:J1,useSyncExternalStore:Z1,useId:fS,unstable_isNewReconciler:!1},i4={readContext:ur,useCallback:uS,useContext:ur,useEffect:bv,useImperativeHandle:cS,useInsertionEffect:oS,useLayoutEffect:aS,useMemo:dS,useReducer:hf,useRef:iS,useState:function(){return hf(Gl)},useDebugValue:wv,useDeferredValue:function(e){var t=dr();return bt===null?t.memoizedState=e:hS(t,bt.memoizedState,e)},useTransition:function(){var e=hf(Gl)[0],t=dr().memoizedState;return[e,t]},useMutableSource:J1,useSyncExternalStore:Z1,useId:fS,unstable_isNewReconciler:!1};function vr(e,t){if(e&&e.defaultProps){t=et({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Kp(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:et({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var ah={isMounted:function(e){return(e=e._reactInternals)?mo(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=fn(),s=di(e),i=ps(r,s);i.payload=t,n!=null&&(i.callback=n),t=ci(e,i,s),t!==null&&(kr(t,e,s,r),Iu(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=fn(),s=di(e),i=ps(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=ci(e,i,s),t!==null&&(kr(t,e,s,r),Iu(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=fn(),r=di(e),s=ps(n,r);s.tag=2,t!=null&&(s.callback=t),t=ci(e,s,r),t!==null&&(kr(t,e,r,n),Iu(t,e,r))}};function Oy(e,t,n,r,s,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!Ul(n,r)||!Ul(s,i):!0}function vS(e,t,n){var r=!1,s=xi,i=t.contextType;return typeof i=="object"&&i!==null?i=ur(i):(s=Pn(t)?Gi:nn.current,r=t.contextTypes,i=(r=r!=null)?ma(e,s):xi),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=ah,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function Iy(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&ah.enqueueReplaceState(t,t.state,null)}function Vp(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},pv(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=ur(i):(i=Pn(t)?Gi:nn.current,s.context=ma(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Kp(e,t,i,n),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&ah.enqueueReplaceState(s,s.state,null),Sd(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function ya(e,t){try{var n="",r=t;do n+=Mj(r),r=r.return;while(r);var s=n}catch(i){s=`
39
- Error generating stack: `+i.message+`
40
- `+i.stack}return{value:e,source:t,stack:s,digest:null}}function ff(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Yp(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var o4=typeof WeakMap=="function"?WeakMap:Map;function xS(e,t,n){n=ps(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Ed||(Ed=!0,sm=r),Yp(e,t)},n}function yS(e,t,n){n=ps(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){Yp(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Yp(e,t),typeof r!="function"&&(ui===null?ui=new Set([this]):ui.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function By(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new o4;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=_4.bind(null,e,t,n),t.then(e,e))}function Fy(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 zy(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=ps(-1,1),t.tag=2,ci(n,t,1))),n.lanes|=1),e)}var a4=Ss.ReactCurrentOwner,En=!1;function un(e,t,n,r){t.child=e===null?Y1(t,null,n,r):va(t,e.child,n,r)}function $y(e,t,n,r,s){n=n.render;var i=t.ref;return Go(t,s),r=yv(e,t,n,r,i,s),n=_v(),e!==null&&!En?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,_s(e,t,s)):(Ve&&n&&av(t),t.flags|=1,un(e,t,r,s),t.child)}function Hy(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!Tv(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,_S(e,t,i,r,s)):(e=Wu(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:Ul,n(o,r)&&e.ref===t.ref)return _s(e,t,s)}return t.flags|=1,e=hi(i,r),e.ref=t.ref,e.return=t,t.child=e}function _S(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(Ul(i,r)&&e.ref===t.ref)if(En=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(En=!0);else return t.lanes=e.lanes,_s(e,t,s)}return Qp(e,t,n,r,s)}function bS(e,t,n){var r=t.pendingProps,s=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},$e(Uo,$n),$n|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,$e(Uo,$n),$n|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,$e(Uo,$n),$n|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,$e(Uo,$n),$n|=r;return un(e,t,s,n),t.child}function wS(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Qp(e,t,n,r,s){var i=Pn(n)?Gi:nn.current;return i=ma(t,i),Go(t,s),n=yv(e,t,n,r,i,s),r=_v(),e!==null&&!En?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,_s(e,t,s)):(Ve&&r&&av(t),t.flags|=1,un(e,t,n,s),t.child)}function Wy(e,t,n,r,s){if(Pn(n)){var i=!0;xd(t)}else i=!1;if(Go(t,s),t.stateNode===null)zu(e,t),vS(t,n,r),Vp(t,n,r,s),r=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=ur(u):(u=Pn(n)?Gi:nn.current,u=ma(t,u));var h=n.getDerivedStateFromProps,d=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||c!==u)&&Iy(t,o,r,u),$s=!1;var p=t.memoizedState;o.state=p,Sd(t,r,o,s),c=t.memoizedState,l!==r||p!==c||Tn.current||$s?(typeof h=="function"&&(Kp(t,n,h,r),c=t.memoizedState),(l=$s||Oy(t,n,l,r,p,c,u))?(d||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=u,r=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,X1(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:vr(t.type,l),o.props=u,d=t.pendingProps,p=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=ur(c):(c=Pn(n)?Gi:nn.current,c=ma(t,c));var f=n.getDerivedStateFromProps;(h=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==d||p!==c)&&Iy(t,o,r,c),$s=!1,p=t.memoizedState,o.state=p,Sd(t,r,o,s);var m=t.memoizedState;l!==d||p!==m||Tn.current||$s?(typeof f=="function"&&(Kp(t,n,f,r),m=t.memoizedState),(u=$s||Oy(t,n,u,r,p,m,c)||!1)?(h||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=u):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return Xp(e,t,n,r,i,s)}function Xp(e,t,n,r,s,i){wS(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return s&&Ey(t,n,!1),_s(e,t,i);r=t.stateNode,a4.current=t;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=va(t,e.child,null,i),t.child=va(t,null,l,i)):un(e,t,l,i),t.memoizedState=r.state,s&&Ey(t,n,!0),t.child}function SS(e){var t=e.stateNode;t.pendingContext?jy(e,t.pendingContext,t.pendingContext!==t.context):t.context&&jy(e,t.context,!1),mv(e,t.containerInfo)}function Uy(e,t,n,r,s){return ga(),cv(s),t.flags|=256,un(e,t,n,r),t.child}var Gp={dehydrated:null,treeContext:null,retryLane:0};function Jp(e){return{baseLanes:e,cachePool:null,transitions:null}}function kS(e,t,n){var r=t.pendingProps,s=Je.current,i=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),$e(Je,s&1),e===null)return Up(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):(o=r.children,e=r.fallback,i?(r=t.mode,i=t.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=uh(o,r,0,null),e=Qi(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Jp(n),t.memoizedState=Gp,e):Sv(t,o));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return l4(e,t,o,r,l,s,n);if(i){i=r.fallback,o=t.mode,s=e.child,l=s.sibling;var c={mode:"hidden",children:r.children};return!(o&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=hi(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=hi(l,i):(i=Qi(i,o,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,o=e.child.memoizedState,o=o===null?Jp(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=Gp,r}return i=e.child,e=i.sibling,r=hi(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Sv(e,t){return t=uh({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function tu(e,t,n,r){return r!==null&&cv(r),va(t,e.child,null,n),e=Sv(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function l4(e,t,n,r,s,i,o){if(n)return t.flags&256?(t.flags&=-257,r=ff(Error(G(422))),tu(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=uh({mode:"visible",children:r.children},s,0,null),i=Qi(i,s,o,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&va(t,e.child,null,o),t.child.memoizedState=Jp(o),t.memoizedState=Gp,i);if(!(t.mode&1))return tu(e,t,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(G(419)),r=ff(i,r,void 0),tu(e,t,o,r)}if(l=(o&e.childLanes)!==0,En||l){if(r=Ot,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=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:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,ys(e,s),kr(r,e,s,-1))}return Rv(),r=ff(Error(G(421))),tu(e,t,o,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=b4.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,Hn=li(s.nextSibling),Wn=t,Ve=!0,wr=null,e!==null&&(nr[rr++]=ds,nr[rr++]=hs,nr[rr++]=Ji,ds=e.id,hs=e.overflow,Ji=t),t=Sv(t,r.children),t.flags|=4096,t)}function qy(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),qp(e.return,t,n)}function pf(e,t,n,r,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function CS(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(un(e,t,r.children,n),r=Je.current,r&2)r=r&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&&qy(e,n,t);else if(e.tag===19)qy(e,n,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}r&=1}if($e(Je,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&kd(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),pf(t,!1,s,n,i);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&kd(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}pf(t,!0,n,null,i);break;case"together":pf(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function zu(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function _s(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),eo|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(G(153));if(t.child!==null){for(e=t.child,n=hi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=hi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function c4(e,t,n){switch(t.tag){case 3:SS(t),ga();break;case 5:G1(t);break;case 1:Pn(t.type)&&xd(t);break;case 4:mv(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;$e(bd,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?($e(Je,Je.current&1),t.flags|=128,null):n&t.child.childLanes?kS(e,t,n):($e(Je,Je.current&1),e=_s(e,t,n),e!==null?e.sibling:null);$e(Je,Je.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return CS(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),$e(Je,Je.current),r)break;return null;case 22:case 23:return t.lanes=0,bS(e,t,n)}return _s(e,t,n)}var NS,Zp,jS,ES;NS=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Zp=function(){};jS=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,Oi(qr.current);var i=null;switch(n){case"input":s=bp(e,s),r=bp(e,r),i=[];break;case"select":s=et({},s,{value:void 0}),r=et({},r,{value:void 0}),i=[];break;case"textarea":s=kp(e,s),r=kp(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=gd)}Np(n,r);var o;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var l=s[u];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Il.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(l=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(i||(i=[]),i.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Il.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&He("scroll",e),i||l===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};ES=function(e,t,n,r){n!==r&&(t.flags|=4)};function Ya(e,t){if(!Ve)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Qt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function u4(e,t,n){var r=t.pendingProps;switch(lv(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qt(t),null;case 1:return Pn(t.type)&&vd(),Qt(t),null;case 3:return r=t.stateNode,xa(),Ue(Tn),Ue(nn),vv(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Zc(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,wr!==null&&(am(wr),wr=null))),Zp(e,t),Qt(t),null;case 5:gv(t);var s=Oi(Ql.current);if(n=t.type,e!==null&&t.stateNode!=null)jS(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(G(166));return Qt(t),null}if(e=Oi(qr.current),Zc(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[$r]=t,r[Vl]=i,e=(t.mode&1)!==0,n){case"dialog":He("cancel",r),He("close",r);break;case"iframe":case"object":case"embed":He("load",r);break;case"video":case"audio":for(s=0;s<dl.length;s++)He(dl[s],r);break;case"source":He("error",r);break;case"img":case"image":case"link":He("error",r),He("load",r);break;case"details":He("toggle",r);break;case"input":ey(r,i),He("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},He("invalid",r);break;case"textarea":ny(r,i),He("invalid",r)}Np(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&Jc(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&Jc(r.textContent,l,e),s=["children",""+l]):Il.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&He("scroll",r)}switch(n){case"input":Uc(r),ty(r,i,!0);break;case"textarea":Uc(r),ry(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=gd)}r=s,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=n1(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[$r]=t,e[Vl]=r,NS(e,t,!1,!1),t.stateNode=e;e:{switch(o=jp(n,r),n){case"dialog":He("cancel",e),He("close",e),s=r;break;case"iframe":case"object":case"embed":He("load",e),s=r;break;case"video":case"audio":for(s=0;s<dl.length;s++)He(dl[s],e);s=r;break;case"source":He("error",e),s=r;break;case"img":case"image":case"link":He("error",e),He("load",e),s=r;break;case"details":He("toggle",e),s=r;break;case"input":ey(e,r),s=bp(e,r),He("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=et({},r,{value:void 0}),He("invalid",e);break;case"textarea":ny(e,r),s=kp(e,r),He("invalid",e);break;default:s=r}Np(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?i1(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&r1(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Bl(e,c):typeof c=="number"&&Bl(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Il.hasOwnProperty(i)?c!=null&&i==="onScroll"&&He("scroll",e):c!=null&&Vg(e,i,c,o))}switch(n){case"input":Uc(e),ty(e,r,!1);break;case"textarea":Uc(e),ry(e);break;case"option":r.value!=null&&e.setAttribute("value",""+vi(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Vo(e,!!r.multiple,i,!1):r.defaultValue!=null&&Vo(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=gd)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Qt(t),null;case 6:if(e&&t.stateNode!=null)ES(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(G(166));if(n=Oi(Ql.current),Oi(qr.current),Zc(t)){if(r=t.stateNode,n=t.memoizedProps,r[$r]=t,(i=r.nodeValue!==n)&&(e=Wn,e!==null))switch(e.tag){case 3:Jc(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Jc(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[$r]=t,t.stateNode=r}return Qt(t),null;case 13:if(Ue(Je),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ve&&Hn!==null&&t.mode&1&&!(t.flags&128))K1(),ga(),t.flags|=98560,i=!1;else if(i=Zc(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(G(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(G(317));i[$r]=t}else ga(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Qt(t),i=!1}else wr!==null&&(am(wr),wr=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Je.current&1?kt===0&&(kt=3):Rv())),t.updateQueue!==null&&(t.flags|=4),Qt(t),null);case 4:return xa(),Zp(e,t),e===null&&ql(t.stateNode.containerInfo),Qt(t),null;case 10:return hv(t.type._context),Qt(t),null;case 17:return Pn(t.type)&&vd(),Qt(t),null;case 19:if(Ue(Je),i=t.memoizedState,i===null)return Qt(t),null;if(r=(t.flags&128)!==0,o=i.rendering,o===null)if(r)Ya(i,!1);else{if(kt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=kd(e),o!==null){for(t.flags|=128,Ya(i,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,e=o.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return $e(Je,Je.current&1|2),t.child}e=e.sibling}i.tail!==null&&ct()>_a&&(t.flags|=128,r=!0,Ya(i,!1),t.lanes=4194304)}else{if(!r)if(e=kd(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ya(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Ve)return Qt(t),null}else 2*ct()-i.renderingStartTime>_a&&n!==1073741824&&(t.flags|=128,r=!0,Ya(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ct(),t.sibling=null,n=Je.current,$e(Je,r?n&1|2:n&1),t):(Qt(t),null);case 22:case 23:return Ev(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?$n&1073741824&&(Qt(t),t.subtreeFlags&6&&(t.flags|=8192)):Qt(t),null;case 24:return null;case 25:return null}throw Error(G(156,t.tag))}function d4(e,t){switch(lv(t),t.tag){case 1:return Pn(t.type)&&vd(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return xa(),Ue(Tn),Ue(nn),vv(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return gv(t),null;case 13:if(Ue(Je),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(G(340));ga()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ue(Je),null;case 4:return xa(),null;case 10:return hv(t.type._context),null;case 22:case 23:return Ev(),null;case 24:return null;default:return null}}var nu=!1,Zt=!1,h4=typeof WeakSet=="function"?WeakSet:Set,le=null;function Wo(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){it(e,t,r)}else n.current=null}function em(e,t,n){try{n()}catch(r){it(e,t,r)}}var Ky=!1;function f4(e,t){if(Ip=fd,e=M1(),ov(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,h=0,d=e,p=null;t:for(;;){for(var f;d!==n||s!==0&&d.nodeType!==3||(l=o+s),d!==i||r!==0&&d.nodeType!==3||(c=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(f=d.firstChild)!==null;)p=d,d=f;for(;;){if(d===e)break t;if(p===n&&++u===s&&(l=o),p===i&&++h===r&&(c=o),(f=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=f}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Bp={focusedElem:e,selectionRange:n},fd=!1,le=t;le!==null;)if(t=le,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,le=e;else for(;le!==null;){t=le;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var g=m.memoizedProps,b=m.memoizedState,x=t.stateNode,y=x.getSnapshotBeforeUpdate(t.elementType===t.type?g:vr(t.type,g),b);x.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var _=t.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(G(163))}}catch(w){it(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,le=e;break}le=t.return}return m=Ky,Ky=!1,m}function Cl(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&em(t,n,i)}s=s.next}while(s!==r)}}function lh(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function tm(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function RS(e){var t=e.alternate;t!==null&&(e.alternate=null,RS(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[$r],delete t[Vl],delete t[$p],delete t[QE],delete t[XE])),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 TS(e){return e.tag===5||e.tag===3||e.tag===4}function Vy(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||TS(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 nm(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=gd));else if(r!==4&&(e=e.child,e!==null))for(nm(e,t,n),e=e.sibling;e!==null;)nm(e,t,n),e=e.sibling}function rm(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(rm(e,t,n),e=e.sibling;e!==null;)rm(e,t,n),e=e.sibling}var zt=null,_r=!1;function Ps(e,t,n){for(n=n.child;n!==null;)PS(e,t,n),n=n.sibling}function PS(e,t,n){if(Ur&&typeof Ur.onCommitFiberUnmount=="function")try{Ur.onCommitFiberUnmount(eh,n)}catch{}switch(n.tag){case 5:Zt||Wo(n,t);case 6:var r=zt,s=_r;zt=null,Ps(e,t,n),zt=r,_r=s,zt!==null&&(_r?(e=zt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):zt.removeChild(n.stateNode));break;case 18:zt!==null&&(_r?(e=zt,n=n.stateNode,e.nodeType===8?af(e.parentNode,n):e.nodeType===1&&af(e,n),Hl(e)):af(zt,n.stateNode));break;case 4:r=zt,s=_r,zt=n.stateNode.containerInfo,_r=!0,Ps(e,t,n),zt=r,_r=s;break;case 0:case 11:case 14:case 15:if(!Zt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&em(n,t,o),s=s.next}while(s!==r)}Ps(e,t,n);break;case 1:if(!Zt&&(Wo(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){it(n,t,l)}Ps(e,t,n);break;case 21:Ps(e,t,n);break;case 22:n.mode&1?(Zt=(r=Zt)||n.memoizedState!==null,Ps(e,t,n),Zt=r):Ps(e,t,n);break;default:Ps(e,t,n)}}function Yy(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new h4),t.forEach(function(r){var s=w4.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function pr(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:zt=l.stateNode,_r=!1;break e;case 3:zt=l.stateNode.containerInfo,_r=!0;break e;case 4:zt=l.stateNode.containerInfo,_r=!0;break e}l=l.return}if(zt===null)throw Error(G(160));PS(i,o,s),zt=null,_r=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){it(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)DS(t,e),t=t.sibling}function DS(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(pr(t,e),Pr(e),r&4){try{Cl(3,e,e.return),lh(3,e)}catch(g){it(e,e.return,g)}try{Cl(5,e,e.return)}catch(g){it(e,e.return,g)}}break;case 1:pr(t,e),Pr(e),r&512&&n!==null&&Wo(n,n.return);break;case 5:if(pr(t,e),Pr(e),r&512&&n!==null&&Wo(n,n.return),e.flags&32){var s=e.stateNode;try{Bl(s,"")}catch(g){it(e,e.return,g)}}if(r&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,o=n!==null?n.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&e1(s,i),jp(l,o);var u=jp(l,i);for(o=0;o<c.length;o+=2){var h=c[o],d=c[o+1];h==="style"?i1(s,d):h==="dangerouslySetInnerHTML"?r1(s,d):h==="children"?Bl(s,d):Vg(s,h,d,u)}switch(l){case"input":wp(s,i);break;case"textarea":t1(s,i);break;case"select":var p=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var f=i.value;f!=null?Vo(s,!!i.multiple,f,!1):p!==!!i.multiple&&(i.defaultValue!=null?Vo(s,!!i.multiple,i.defaultValue,!0):Vo(s,!!i.multiple,i.multiple?[]:"",!1))}s[Vl]=i}catch(g){it(e,e.return,g)}}break;case 6:if(pr(t,e),Pr(e),r&4){if(e.stateNode===null)throw Error(G(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(g){it(e,e.return,g)}}break;case 3:if(pr(t,e),Pr(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Hl(t.containerInfo)}catch(g){it(e,e.return,g)}break;case 4:pr(t,e),Pr(e);break;case 13:pr(t,e),Pr(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(Nv=ct())),r&4&&Yy(e);break;case 22:if(h=n!==null&&n.memoizedState!==null,e.mode&1?(Zt=(u=Zt)||h,pr(t,e),Zt=u):pr(t,e),Pr(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!h&&e.mode&1)for(le=e,h=e.child;h!==null;){for(d=le=h;le!==null;){switch(p=le,f=p.child,p.tag){case 0:case 11:case 14:case 15:Cl(4,p,p.return);break;case 1:Wo(p,p.return);var m=p.stateNode;if(typeof m.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(g){it(r,n,g)}}break;case 5:Wo(p,p.return);break;case 22:if(p.memoizedState!==null){Xy(d);continue}}f!==null?(f.return=p,le=f):Xy(d)}h=h.sibling}e:for(h=null,d=e;;){if(d.tag===5){if(h===null){h=d;try{s=d.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=d.stateNode,c=d.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=s1("display",o))}catch(g){it(e,e.return,g)}}}else if(d.tag===6){if(h===null)try{d.stateNode.nodeValue=u?"":d.memoizedProps}catch(g){it(e,e.return,g)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===e)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;d.sibling===null;){if(d.return===null||d.return===e)break e;h===d&&(h=null),d=d.return}h===d&&(h=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:pr(t,e),Pr(e),r&4&&Yy(e);break;case 21:break;default:pr(t,e),Pr(e)}}function Pr(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(TS(n)){var r=n;break e}n=n.return}throw Error(G(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Bl(s,""),r.flags&=-33);var i=Vy(e);rm(e,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,l=Vy(e);nm(e,l,o);break;default:throw Error(G(161))}}catch(c){it(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function p4(e,t,n){le=e,MS(e)}function MS(e,t,n){for(var r=(e.mode&1)!==0;le!==null;){var s=le,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||nu;if(!o){var l=s.alternate,c=l!==null&&l.memoizedState!==null||Zt;l=nu;var u=Zt;if(nu=o,(Zt=c)&&!u)for(le=s;le!==null;)o=le,c=o.child,o.tag===22&&o.memoizedState!==null?Gy(s):c!==null?(c.return=o,le=c):Gy(s);for(;i!==null;)le=i,MS(i),i=i.sibling;le=s,nu=l,Zt=u}Qy(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,le=i):Qy(e)}}function Qy(e){for(;le!==null;){var t=le;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Zt||lh(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Zt)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:vr(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&My(t,i,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}My(t,o,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var h=u.memoizedState;if(h!==null){var d=h.dehydrated;d!==null&&Hl(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(G(163))}Zt||t.flags&512&&tm(t)}catch(p){it(t,t.return,p)}}if(t===e){le=null;break}if(n=t.sibling,n!==null){n.return=t.return,le=n;break}le=t.return}}function Xy(e){for(;le!==null;){var t=le;if(t===e){le=null;break}var n=t.sibling;if(n!==null){n.return=t.return,le=n;break}le=t.return}}function Gy(e){for(;le!==null;){var t=le;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{lh(4,t)}catch(c){it(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){it(t,s,c)}}var i=t.return;try{tm(t)}catch(c){it(t,i,c)}break;case 5:var o=t.return;try{tm(t)}catch(c){it(t,o,c)}}}catch(c){it(t,t.return,c)}if(t===e){le=null;break}var l=t.sibling;if(l!==null){l.return=t.return,le=l;break}le=t.return}}var m4=Math.ceil,jd=Ss.ReactCurrentDispatcher,kv=Ss.ReactCurrentOwner,lr=Ss.ReactCurrentBatchConfig,Me=0,Ot=null,pt=null,Ut=0,$n=0,Uo=wi(0),kt=0,Zl=null,eo=0,ch=0,Cv=0,Nl=null,jn=null,Nv=0,_a=1/0,ss=null,Ed=!1,sm=null,ui=null,ru=!1,ri=null,Rd=0,jl=0,im=null,$u=-1,Hu=0;function fn(){return Me&6?ct():$u!==-1?$u:$u=ct()}function di(e){return e.mode&1?Me&2&&Ut!==0?Ut&-Ut:JE.transition!==null?(Hu===0&&(Hu=v1()),Hu):(e=Oe,e!==0||(e=window.event,e=e===void 0?16:k1(e.type)),e):1}function kr(e,t,n,r){if(50<jl)throw jl=0,im=null,Error(G(185));yc(e,n,r),(!(Me&2)||e!==Ot)&&(e===Ot&&(!(Me&2)&&(ch|=n),kt===4&&qs(e,Ut)),Dn(e,r),n===1&&Me===0&&!(t.mode&1)&&(_a=ct()+500,ih&&Si()))}function Dn(e,t){var n=e.callbackNode;Jj(e,t);var r=hd(e,e===Ot?Ut:0);if(r===0)n!==null&&oy(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&oy(n),t===1)e.tag===0?GE(Jy.bind(null,e)):W1(Jy.bind(null,e)),VE(function(){!(Me&6)&&Si()}),n=null;else{switch(x1(r)){case 1:n=Jg;break;case 4:n=m1;break;case 16:n=dd;break;case 536870912:n=g1;break;default:n=dd}n=$S(n,LS.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function LS(e,t){if($u=-1,Hu=0,Me&6)throw Error(G(327));var n=e.callbackNode;if(Jo()&&e.callbackNode!==n)return null;var r=hd(e,e===Ot?Ut:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Td(e,r);else{t=r;var s=Me;Me|=2;var i=OS();(Ot!==e||Ut!==t)&&(ss=null,_a=ct()+500,Yi(e,t));do try{x4();break}catch(l){AS(e,l)}while(!0);dv(),jd.current=i,Me=s,pt!==null?t=0:(Ot=null,Ut=0,t=kt)}if(t!==0){if(t===2&&(s=Dp(e),s!==0&&(r=s,t=om(e,s))),t===1)throw n=Zl,Yi(e,0),qs(e,r),Dn(e,ct()),n;if(t===6)qs(e,r);else{if(s=e.current.alternate,!(r&30)&&!g4(s)&&(t=Td(e,r),t===2&&(i=Dp(e),i!==0&&(r=i,t=om(e,i))),t===1))throw n=Zl,Yi(e,0),qs(e,r),Dn(e,ct()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(G(345));case 2:Ri(e,jn,ss);break;case 3:if(qs(e,r),(r&130023424)===r&&(t=Nv+500-ct(),10<t)){if(hd(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){fn(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=zp(Ri.bind(null,e,jn,ss),t);break}Ri(e,jn,ss);break;case 4:if(qs(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var o=31-Sr(r);i=1<<o,o=t[o],o>s&&(s=o),r&=~i}if(r=s,r=ct()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*m4(r/1960))-r,10<r){e.timeoutHandle=zp(Ri.bind(null,e,jn,ss),r);break}Ri(e,jn,ss);break;case 5:Ri(e,jn,ss);break;default:throw Error(G(329))}}}return Dn(e,ct()),e.callbackNode===n?LS.bind(null,e):null}function om(e,t){var n=Nl;return e.current.memoizedState.isDehydrated&&(Yi(e,t).flags|=256),e=Td(e,t),e!==2&&(t=jn,jn=n,t!==null&&am(t)),e}function am(e){jn===null?jn=e:jn.push.apply(jn,e)}function g4(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!Nr(i(),s))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;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 qs(e,t){for(t&=~Cv,t&=~ch,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Sr(t),r=1<<n;e[n]=-1,t&=~r}}function Jy(e){if(Me&6)throw Error(G(327));Jo();var t=hd(e,0);if(!(t&1))return Dn(e,ct()),null;var n=Td(e,t);if(e.tag!==0&&n===2){var r=Dp(e);r!==0&&(t=r,n=om(e,r))}if(n===1)throw n=Zl,Yi(e,0),qs(e,t),Dn(e,ct()),n;if(n===6)throw Error(G(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ri(e,jn,ss),Dn(e,ct()),null}function jv(e,t){var n=Me;Me|=1;try{return e(t)}finally{Me=n,Me===0&&(_a=ct()+500,ih&&Si())}}function to(e){ri!==null&&ri.tag===0&&!(Me&6)&&Jo();var t=Me;Me|=1;var n=lr.transition,r=Oe;try{if(lr.transition=null,Oe=1,e)return e()}finally{Oe=r,lr.transition=n,Me=t,!(Me&6)&&Si()}}function Ev(){$n=Uo.current,Ue(Uo)}function Yi(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,KE(n)),pt!==null)for(n=pt.return;n!==null;){var r=n;switch(lv(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&vd();break;case 3:xa(),Ue(Tn),Ue(nn),vv();break;case 5:gv(r);break;case 4:xa();break;case 13:Ue(Je);break;case 19:Ue(Je);break;case 10:hv(r.type._context);break;case 22:case 23:Ev()}n=n.return}if(Ot=e,pt=e=hi(e.current,null),Ut=$n=t,kt=0,Zl=null,Cv=ch=eo=0,jn=Nl=null,Ai!==null){for(t=0;t<Ai.length;t++)if(n=Ai[t],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}Ai=null}return e}function AS(e,t){do{var n=pt;try{if(dv(),Bu.current=Nd,Cd){for(var r=Ze.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Cd=!1}if(Zi=0,Pt=bt=Ze=null,kl=!1,Xl=0,kv.current=null,n===null||n.return===null){kt=1,Zl=t,pt=null;break}e:{var i=e,o=n.return,l=n,c=t;if(t=Ut,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,h=l,d=h.tag;if(!(h.mode&1)&&(d===0||d===11||d===15)){var p=h.alternate;p?(h.updateQueue=p.updateQueue,h.memoizedState=p.memoizedState,h.lanes=p.lanes):(h.updateQueue=null,h.memoizedState=null)}var f=Fy(o);if(f!==null){f.flags&=-257,zy(f,o,l,i,t),f.mode&1&&By(i,u,t),t=f,c=u;var m=t.updateQueue;if(m===null){var g=new Set;g.add(c),t.updateQueue=g}else m.add(c);break e}else{if(!(t&1)){By(i,u,t),Rv();break e}c=Error(G(426))}}else if(Ve&&l.mode&1){var b=Fy(o);if(b!==null){!(b.flags&65536)&&(b.flags|=256),zy(b,o,l,i,t),cv(ya(c,l));break e}}i=c=ya(c,l),kt!==4&&(kt=2),Nl===null?Nl=[i]:Nl.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var x=xS(i,c,t);Dy(i,x);break e;case 1:l=c;var y=i.type,_=i.stateNode;if(!(i.flags&128)&&(typeof y.getDerivedStateFromError=="function"||_!==null&&typeof _.componentDidCatch=="function"&&(ui===null||!ui.has(_)))){i.flags|=65536,t&=-t,i.lanes|=t;var w=yS(i,l,t);Dy(i,w);break e}}i=i.return}while(i!==null)}BS(n)}catch(C){t=C,pt===n&&n!==null&&(pt=n=n.return);continue}break}while(!0)}function OS(){var e=jd.current;return jd.current=Nd,e===null?Nd:e}function Rv(){(kt===0||kt===3||kt===2)&&(kt=4),Ot===null||!(eo&268435455)&&!(ch&268435455)||qs(Ot,Ut)}function Td(e,t){var n=Me;Me|=2;var r=OS();(Ot!==e||Ut!==t)&&(ss=null,Yi(e,t));do try{v4();break}catch(s){AS(e,s)}while(!0);if(dv(),Me=n,jd.current=r,pt!==null)throw Error(G(261));return Ot=null,Ut=0,kt}function v4(){for(;pt!==null;)IS(pt)}function x4(){for(;pt!==null&&!Wj();)IS(pt)}function IS(e){var t=zS(e.alternate,e,$n);e.memoizedProps=e.pendingProps,t===null?BS(e):pt=t,kv.current=null}function BS(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=d4(n,t),n!==null){n.flags&=32767,pt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{kt=6,pt=null;return}}else if(n=u4(n,t,$n),n!==null){pt=n;return}if(t=t.sibling,t!==null){pt=t;return}pt=t=e}while(t!==null);kt===0&&(kt=5)}function Ri(e,t,n){var r=Oe,s=lr.transition;try{lr.transition=null,Oe=1,y4(e,t,n,r)}finally{lr.transition=s,Oe=r}return null}function y4(e,t,n,r){do Jo();while(ri!==null);if(Me&6)throw Error(G(327));n=e.finishedWork;var s=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(G(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(Zj(e,i),e===Ot&&(pt=Ot=null,Ut=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ru||(ru=!0,$S(dd,function(){return Jo(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=lr.transition,lr.transition=null;var o=Oe;Oe=1;var l=Me;Me|=4,kv.current=null,f4(e,n),DS(n,e),FE(Bp),fd=!!Ip,Bp=Ip=null,e.current=n,p4(n),Uj(),Me=l,Oe=o,lr.transition=i}else e.current=n;if(ru&&(ru=!1,ri=e,Rd=s),i=e.pendingLanes,i===0&&(ui=null),Vj(n.stateNode),Dn(e,ct()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)s=t[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(Ed)throw Ed=!1,e=sm,sm=null,e;return Rd&1&&e.tag!==0&&Jo(),i=e.pendingLanes,i&1?e===im?jl++:(jl=0,im=e):jl=0,Si(),null}function Jo(){if(ri!==null){var e=x1(Rd),t=lr.transition,n=Oe;try{if(lr.transition=null,Oe=16>e?16:e,ri===null)var r=!1;else{if(e=ri,ri=null,Rd=0,Me&6)throw Error(G(331));var s=Me;for(Me|=4,le=e.current;le!==null;){var i=le,o=i.child;if(le.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(le=u;le!==null;){var h=le;switch(h.tag){case 0:case 11:case 15:Cl(8,h,i)}var d=h.child;if(d!==null)d.return=h,le=d;else for(;le!==null;){h=le;var p=h.sibling,f=h.return;if(RS(h),h===u){le=null;break}if(p!==null){p.return=f,le=p;break}le=f}}}var m=i.alternate;if(m!==null){var g=m.child;if(g!==null){m.child=null;do{var b=g.sibling;g.sibling=null,g=b}while(g!==null)}}le=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,le=o;else e:for(;le!==null;){if(i=le,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Cl(9,i,i.return)}var x=i.sibling;if(x!==null){x.return=i.return,le=x;break e}le=i.return}}var y=e.current;for(le=y;le!==null;){o=le;var _=o.child;if(o.subtreeFlags&2064&&_!==null)_.return=o,le=_;else e:for(o=y;le!==null;){if(l=le,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:lh(9,l)}}catch(C){it(l,l.return,C)}if(l===o){le=null;break e}var w=l.sibling;if(w!==null){w.return=l.return,le=w;break e}le=l.return}}if(Me=s,Si(),Ur&&typeof Ur.onPostCommitFiberRoot=="function")try{Ur.onPostCommitFiberRoot(eh,e)}catch{}r=!0}return r}finally{Oe=n,lr.transition=t}}return!1}function Zy(e,t,n){t=ya(n,t),t=xS(e,t,1),e=ci(e,t,1),t=fn(),e!==null&&(yc(e,1,t),Dn(e,t))}function it(e,t,n){if(e.tag===3)Zy(e,e,n);else for(;t!==null;){if(t.tag===3){Zy(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(ui===null||!ui.has(r))){e=ya(n,e),e=yS(t,e,1),t=ci(t,e,1),e=fn(),t!==null&&(yc(t,1,e),Dn(t,e));break}}t=t.return}}function _4(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=fn(),e.pingedLanes|=e.suspendedLanes&n,Ot===e&&(Ut&n)===n&&(kt===4||kt===3&&(Ut&130023424)===Ut&&500>ct()-Nv?Yi(e,0):Cv|=n),Dn(e,t)}function FS(e,t){t===0&&(e.mode&1?(t=Vc,Vc<<=1,!(Vc&130023424)&&(Vc=4194304)):t=1);var n=fn();e=ys(e,t),e!==null&&(yc(e,t,n),Dn(e,n))}function b4(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),FS(e,n)}function w4(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(G(314))}r!==null&&r.delete(t),FS(e,n)}var zS;zS=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Tn.current)En=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return En=!1,c4(e,t,n);En=!!(e.flags&131072)}else En=!1,Ve&&t.flags&1048576&&U1(t,_d,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;zu(e,t),e=t.pendingProps;var s=ma(t,nn.current);Go(t,n),s=yv(null,t,r,e,s,n);var i=_v();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Pn(r)?(i=!0,xd(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,pv(t),s.updater=ah,t.stateNode=s,s._reactInternals=t,Vp(t,r,e,n),t=Xp(null,t,r,!0,i,n)):(t.tag=0,Ve&&i&&av(t),un(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(zu(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=k4(r),e=vr(r,e),s){case 0:t=Qp(null,t,r,e,n);break e;case 1:t=Wy(null,t,r,e,n);break e;case 11:t=$y(null,t,r,e,n);break e;case 14:t=Hy(null,t,r,vr(r.type,e),n);break e}throw Error(G(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:vr(r,s),Qp(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:vr(r,s),Wy(e,t,r,s,n);case 3:e:{if(SS(t),e===null)throw Error(G(387));r=t.pendingProps,i=t.memoizedState,s=i.element,X1(e,t),Sd(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=ya(Error(G(423)),t),t=Uy(e,t,r,n,s);break e}else if(r!==s){s=ya(Error(G(424)),t),t=Uy(e,t,r,n,s);break e}else for(Hn=li(t.stateNode.containerInfo.firstChild),Wn=t,Ve=!0,wr=null,n=Y1(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ga(),r===s){t=_s(e,t,n);break e}un(e,t,r,n)}t=t.child}return t;case 5:return G1(t),e===null&&Up(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,Fp(r,s)?o=null:i!==null&&Fp(r,i)&&(t.flags|=32),wS(e,t),un(e,t,o,n),t.child;case 6:return e===null&&Up(t),null;case 13:return kS(e,t,n);case 4:return mv(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=va(t,null,r,n):un(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:vr(r,s),$y(e,t,r,s,n);case 7:return un(e,t,t.pendingProps,n),t.child;case 8:return un(e,t,t.pendingProps.children,n),t.child;case 12:return un(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,$e(bd,r._currentValue),r._currentValue=o,i!==null)if(Nr(i.value,o)){if(i.children===s.children&&!Tn.current){t=_s(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=ps(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var h=u.pending;h===null?c.next=c:(c.next=h.next,h.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),qp(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(G(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),qp(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}un(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Go(t,n),s=ur(s),r=r(s),t.flags|=1,un(e,t,r,n),t.child;case 14:return r=t.type,s=vr(r,t.pendingProps),s=vr(r.type,s),Hy(e,t,r,s,n);case 15:return _S(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:vr(r,s),zu(e,t),t.tag=1,Pn(r)?(e=!0,xd(t)):e=!1,Go(t,n),vS(t,r,s),Vp(t,r,s,n),Xp(null,t,r,!0,e,n);case 19:return CS(e,t,n);case 22:return bS(e,t,n)}throw Error(G(156,t.tag))};function $S(e,t){return p1(e,t)}function S4(e,t,n,r){this.tag=e,this.key=n,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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function or(e,t,n,r){return new S4(e,t,n,r)}function Tv(e){return e=e.prototype,!(!e||!e.isReactComponent)}function k4(e){if(typeof e=="function")return Tv(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Qg)return 11;if(e===Xg)return 14}return 2}function hi(e,t){var n=e.alternate;return n===null?(n=or(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Wu(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")Tv(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Lo:return Qi(n.children,s,i,t);case Yg:o=8,s|=8;break;case vp:return e=or(12,n,t,s|2),e.elementType=vp,e.lanes=i,e;case xp:return e=or(13,n,t,s),e.elementType=xp,e.lanes=i,e;case yp:return e=or(19,n,t,s),e.elementType=yp,e.lanes=i,e;case Gw:return uh(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Qw:o=10;break e;case Xw:o=9;break e;case Qg:o=11;break e;case Xg:o=14;break e;case zs:o=16,r=null;break e}throw Error(G(130,e==null?e:typeof e,""))}return t=or(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Qi(e,t,n,r){return e=or(7,e,r,t),e.lanes=n,e}function uh(e,t,n,r){return e=or(22,e,r,t),e.elementType=Gw,e.lanes=n,e.stateNode={isHidden:!1},e}function mf(e,t,n){return e=or(6,e,null,t),e.lanes=n,e}function gf(e,t,n){return t=or(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function C4(e,t,n,r,s){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=Qh(0),this.expirationTimes=Qh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qh(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Pv(e,t,n,r,s,i,o,l,c){return e=new C4(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=or(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},pv(i),e}function N4(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Mo,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function HS(e){if(!e)return xi;e=e._reactInternals;e:{if(mo(e)!==e||e.tag!==1)throw Error(G(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Pn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(G(171))}if(e.tag===1){var n=e.type;if(Pn(n))return H1(e,n,t)}return t}function WS(e,t,n,r,s,i,o,l,c){return e=Pv(n,r,!0,e,s,i,o,l,c),e.context=HS(null),n=e.current,r=fn(),s=di(n),i=ps(r,s),i.callback=t??null,ci(n,i,s),e.current.lanes=s,yc(e,s,r),Dn(e,r),e}function dh(e,t,n,r){var s=t.current,i=fn(),o=di(s);return n=HS(n),t.context===null?t.context=n:t.pendingContext=n,t=ps(i,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=ci(s,t,o),e!==null&&(kr(e,s,o,i),Iu(e,s,o)),o}function Pd(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 e0(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Dv(e,t){e0(e,t),(e=e.alternate)&&e0(e,t)}function j4(){return null}var US=typeof reportError=="function"?reportError:function(e){console.error(e)};function Mv(e){this._internalRoot=e}hh.prototype.render=Mv.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(G(409));dh(e,t,null,null)};hh.prototype.unmount=Mv.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;to(function(){dh(null,e,null,null)}),t[xs]=null}};function hh(e){this._internalRoot=e}hh.prototype.unstable_scheduleHydration=function(e){if(e){var t=b1();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Us.length&&t!==0&&t<Us[n].priority;n++);Us.splice(n,0,e),n===0&&S1(e)}};function Lv(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function fh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function t0(){}function E4(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=Pd(o);i.call(u)}}var o=WS(t,r,e,0,null,!1,!1,"",t0);return e._reactRootContainer=o,e[xs]=o.current,ql(e.nodeType===8?e.parentNode:e),to(),o}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var u=Pd(c);l.call(u)}}var c=Pv(e,0,!1,null,null,!1,!1,"",t0);return e._reactRootContainer=c,e[xs]=c.current,ql(e.nodeType===8?e.parentNode:e),to(function(){dh(t,c,n,r)}),c}function ph(e,t,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var l=s;s=function(){var c=Pd(o);l.call(c)}}dh(t,o,e,s)}else o=E4(n,t,e,s,r);return Pd(o)}y1=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=ul(t.pendingLanes);n!==0&&(Zg(t,n|1),Dn(t,ct()),!(Me&6)&&(_a=ct()+500,Si()))}break;case 13:to(function(){var r=ys(e,1);if(r!==null){var s=fn();kr(r,e,1,s)}}),Dv(e,1)}};ev=function(e){if(e.tag===13){var t=ys(e,134217728);if(t!==null){var n=fn();kr(t,e,134217728,n)}Dv(e,134217728)}};_1=function(e){if(e.tag===13){var t=di(e),n=ys(e,t);if(n!==null){var r=fn();kr(n,e,t,r)}Dv(e,t)}};b1=function(){return Oe};w1=function(e,t){var n=Oe;try{return Oe=e,t()}finally{Oe=n}};Rp=function(e,t,n){switch(t){case"input":if(wp(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=sh(r);if(!s)throw Error(G(90));Zw(r),wp(r,s)}}}break;case"textarea":t1(e,n);break;case"select":t=n.value,t!=null&&Vo(e,!!n.multiple,t,!1)}};l1=jv;c1=to;var R4={usingClientEntryPoint:!1,Events:[bc,Bo,sh,o1,a1,jv]},Qa={findFiberByHostInstance:Li,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},T4={bundleType:Qa.bundleType,version:Qa.version,rendererPackageName:Qa.rendererPackageName,rendererConfig:Qa.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ss.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=h1(e),e===null?null:e.stateNode},findFiberByHostInstance:Qa.findFiberByHostInstance||j4,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 su=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!su.isDisabled&&su.supportsFiber)try{eh=su.inject(T4),Ur=su}catch{}}Vn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=R4;Vn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Lv(t))throw Error(G(200));return N4(e,t,null,n)};Vn.createRoot=function(e,t){if(!Lv(e))throw Error(G(299));var n=!1,r="",s=US;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=Pv(e,1,!1,null,null,n,!1,r,s),e[xs]=t.current,ql(e.nodeType===8?e.parentNode:e),new Mv(t)};Vn.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(G(188)):(e=Object.keys(e).join(","),Error(G(268,e)));return e=h1(t),e=e===null?null:e.stateNode,e};Vn.flushSync=function(e){return to(e)};Vn.hydrate=function(e,t,n){if(!fh(t))throw Error(G(200));return ph(null,e,t,!0,n)};Vn.hydrateRoot=function(e,t,n){if(!Lv(e))throw Error(G(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=US;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=WS(t,null,e,1,n??null,s,!1,i,o),e[xs]=t.current,ql(e),r)for(e=0;e<r.length;e++)n=r[e],s=n._getVersion,s=s(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,s]:t.mutableSourceEagerHydrationData.push(n,s);return new hh(t)};Vn.render=function(e,t,n){if(!fh(t))throw Error(G(200));return ph(null,e,t,!1,n)};Vn.unmountComponentAtNode=function(e){if(!fh(e))throw Error(G(40));return e._reactRootContainer?(to(function(){ph(null,null,e,!1,function(){e._reactRootContainer=null,e[xs]=null})}),!0):!1};Vn.unstable_batchedUpdates=jv;Vn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!fh(n))throw Error(G(200));if(e==null||e._reactInternals===void 0)throw Error(G(38));return ph(e,t,n,!1,r)};Vn.version="18.3.1-next-f1338f8080-20240426";function qS(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(qS)}catch(e){console.error(e)}}qS(),qw.exports=Vn;var ar=qw.exports;const P4=Na(ar);var n0=ar;mp.createRoot=n0.createRoot,mp.hydrateRoot=n0.hydrateRoot;var Ta=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},D4={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Vs,Fg,_w,M4=(_w=class{constructor(){ce(this,Vs,D4);ce(this,Fg,!1)}setTimeoutProvider(e){se(this,Vs,e)}setTimeout(e,t){return L(this,Vs).setTimeout(e,t)}clearTimeout(e){L(this,Vs).clearTimeout(e)}setInterval(e,t){return L(this,Vs).setInterval(e,t)}clearInterval(e){L(this,Vs).clearInterval(e)}},Vs=new WeakMap,Fg=new WeakMap,_w),Ii=new M4;function L4(e){setTimeout(e,0)}var no=typeof window>"u"||"Deno"in globalThis;function dn(){}function A4(e,t){return typeof e=="function"?e(t):e}function lm(e){return typeof e=="number"&&e>=0&&e!==1/0}function KS(e,t){return Math.max(e+(t||0)-Date.now(),0)}function fi(e,t){return typeof e=="function"?e(t):e}function Zn(e,t){return typeof e=="function"?e(t):e}function r0(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:l}=e;if(o){if(r){if(t.queryHash!==Av(o,t.options))return!1}else if(!ec(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||s&&s!==t.state.fetchStatus||i&&!i(t))}function s0(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(ro(t.options.mutationKey)!==ro(i))return!1}else if(!ec(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function Av(e,t){return((t==null?void 0:t.queryKeyHashFn)||ro)(e)}function ro(e){return JSON.stringify(e,(t,n)=>cm(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function ec(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>ec(e[n],t[n])):!1}var O4=Object.prototype.hasOwnProperty;function VS(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=i0(e)&&i0(t);if(!r&&!(cm(e)&&cm(t)))return t;const i=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),l=o.length,c=r?new Array(l):{};let u=0;for(let h=0;h<l;h++){const d=r?h:o[h],p=e[d],f=t[d];if(p===f){c[d]=p,(r?h<i:O4.call(e,d))&&u++;continue}if(p===null||f===null||typeof p!="object"||typeof f!="object"){c[d]=f;continue}const m=VS(p,f,n+1);c[d]=m,m===p&&u++}return i===l&&u===i?e:c}function Dd(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function i0(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function cm(e){if(!o0(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!o0(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function o0(e){return Object.prototype.toString.call(e)==="[object Object]"}function I4(e){return new Promise(t=>{Ii.setTimeout(t,e)})}function um(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?VS(e,t):t}function B4(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function F4(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Ov=Symbol();function YS(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Ov?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Iv(e,t){return typeof e=="function"?e(...t):!!e}function z4(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var Fi,Ys,na,bw,$4=(bw=class extends Ta{constructor(){super();ce(this,Fi);ce(this,Ys);ce(this,na);se(this,na,t=>{if(!no&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){L(this,Ys)||this.setEventListener(L(this,na))}onUnsubscribe(){var t;this.hasListeners()||((t=L(this,Ys))==null||t.call(this),se(this,Ys,void 0))}setEventListener(t){var n;se(this,na,t),(n=L(this,Ys))==null||n.call(this),se(this,Ys,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){L(this,Fi)!==t&&(se(this,Fi,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof L(this,Fi)=="boolean"?L(this,Fi):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Fi=new WeakMap,Ys=new WeakMap,na=new WeakMap,bw),Bv=new $4;function dm(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var H4=L4;function W4(){let e=[],t=0,n=l=>{l()},r=l=>{l()},s=H4;const i=l=>{t?e.push(l):s(()=>{n(l)})},o=()=>{const l=e;e=[],l.length&&s(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||o()}return c},batchCalls:l=>(...c)=>{i(()=>{l(...c)})},schedule:i,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{s=l}}}var St=W4(),ra,Qs,sa,ww,U4=(ww=class extends Ta{constructor(){super();ce(this,ra,!0);ce(this,Qs);ce(this,sa);se(this,sa,t=>{if(!no&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){L(this,Qs)||this.setEventListener(L(this,sa))}onUnsubscribe(){var t;this.hasListeners()||((t=L(this,Qs))==null||t.call(this),se(this,Qs,void 0))}setEventListener(t){var n;se(this,sa,t),(n=L(this,Qs))==null||n.call(this),se(this,Qs,t(this.setOnline.bind(this)))}setOnline(t){L(this,ra)!==t&&(se(this,ra,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return L(this,ra)}},ra=new WeakMap,Qs=new WeakMap,sa=new WeakMap,ww),Md=new U4;function q4(e){return Math.min(1e3*2**e,3e4)}function QS(e){return(e??"online")==="online"?Md.isOnline():!0}var hm=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function XS(e){let t=!1,n=0,r;const s=dm(),i=()=>s.status!=="pending",o=g=>{var b;if(!i()){const x=new hm(g);p(x),(b=e.onCancel)==null||b.call(e,x)}},l=()=>{t=!0},c=()=>{t=!1},u=()=>Bv.isFocused()&&(e.networkMode==="always"||Md.isOnline())&&e.canRun(),h=()=>QS(e.networkMode)&&e.canRun(),d=g=>{i()||(r==null||r(),s.resolve(g))},p=g=>{i()||(r==null||r(),s.reject(g))},f=()=>new Promise(g=>{var b;r=x=>{(i()||u())&&g(x)},(b=e.onPause)==null||b.call(e)}).then(()=>{var g;r=void 0,i()||(g=e.onContinue)==null||g.call(e)}),m=()=>{if(i())return;let g;const b=n===0?e.initialPromise:void 0;try{g=b??e.fn()}catch(x){g=Promise.reject(x)}Promise.resolve(g).then(d).catch(x=>{var S;if(i())return;const y=e.retry??(no?0:3),_=e.retryDelay??q4,w=typeof _=="function"?_(n,x):_,C=y===!0||typeof y=="number"&&n<y||typeof y=="function"&&y(n,x);if(t||!C){p(x);return}n++,(S=e.onFail)==null||S.call(e,n,x),I4(w).then(()=>u()?void 0:f()).then(()=>{t?p(x):m()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:l,continueRetry:c,canStart:h,start:()=>(h()?m():f().then(m),s)}}var zi,Sw,GS=(Sw=class{constructor(){ce(this,zi)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),lm(this.gcTime)&&se(this,zi,Ii.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(no?1/0:5*60*1e3))}clearGcTimeout(){L(this,zi)&&(Ii.clearTimeout(L(this,zi)),se(this,zi,void 0))}},zi=new WeakMap,Sw),$i,ia,Jn,Hi,Rt,fc,Wi,xr,rs,kw,K4=(kw=class extends GS{constructor(t){super();ce(this,xr);ce(this,$i);ce(this,ia);ce(this,Jn);ce(this,Hi);ce(this,Rt);ce(this,fc);ce(this,Wi);se(this,Wi,!1),se(this,fc,t.defaultOptions),this.setOptions(t.options),this.observers=[],se(this,Hi,t.client),se(this,Jn,L(this,Hi).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,se(this,$i,l0(this.options)),this.state=t.state??L(this,$i),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=L(this,Rt))==null?void 0:t.promise}setOptions(t){if(this.options={...L(this,fc),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=l0(this.options);n.data!==void 0&&(this.setState(a0(n.data,n.dataUpdatedAt)),se(this,$i,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&L(this,Jn).remove(this)}setData(t,n){const r=um(this.state.data,t,this.options);return be(this,xr,rs).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){be(this,xr,rs).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=L(this,Rt))==null?void 0:r.promise;return(s=L(this,Rt))==null||s.cancel(t),n?n.then(dn).catch(dn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(L(this,$i))}isActive(){return this.observers.some(t=>Zn(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ov||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>fi(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!KS(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=L(this,Rt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=L(this,Rt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),L(this,Jn).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(L(this,Rt)&&(L(this,Wi)?L(this,Rt).cancel({revert:!0}):L(this,Rt).cancelRetry()),this.scheduleGc()),L(this,Jn).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||be(this,xr,rs).call(this,{type:"invalidate"})}async fetch(t,n){var c,u,h,d,p,f,m,g,b,x,y,_;if(this.state.fetchStatus!=="idle"&&((c=L(this,Rt))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(L(this,Rt))return L(this,Rt).continueRetry(),L(this,Rt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(C=>C.options.queryFn);w&&this.setOptions(w.options)}const r=new AbortController,s=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(se(this,Wi,!0),r.signal)})},i=()=>{const w=YS(this.options,n),S=(()=>{const R={client:L(this,Hi),queryKey:this.queryKey,meta:this.meta};return s(R),R})();return se(this,Wi,!1),this.options.persister?this.options.persister(w,S,this):w(S)},l=(()=>{const w={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:L(this,Hi),state:this.state,fetchFn:i};return s(w),w})();(u=this.options.behavior)==null||u.onFetch(l,this),se(this,ia,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((h=l.fetchOptions)==null?void 0:h.meta))&&be(this,xr,rs).call(this,{type:"fetch",meta:(d=l.fetchOptions)==null?void 0:d.meta}),se(this,Rt,XS({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,onCancel:w=>{w instanceof hm&&w.revert&&this.setState({...L(this,ia),fetchStatus:"idle"}),r.abort()},onFail:(w,C)=>{be(this,xr,rs).call(this,{type:"failed",failureCount:w,error:C})},onPause:()=>{be(this,xr,rs).call(this,{type:"pause"})},onContinue:()=>{be(this,xr,rs).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const w=await L(this,Rt).start();if(w===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(w),(f=(p=L(this,Jn).config).onSuccess)==null||f.call(p,w,this),(g=(m=L(this,Jn).config).onSettled)==null||g.call(m,w,this.state.error,this),w}catch(w){if(w instanceof hm){if(w.silent)return L(this,Rt).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw be(this,xr,rs).call(this,{type:"error",error:w}),(x=(b=L(this,Jn).config).onError)==null||x.call(b,w,this),(_=(y=L(this,Jn).config).onSettled)==null||_.call(y,this.state.data,w,this),w}finally{this.scheduleGc()}}},$i=new WeakMap,ia=new WeakMap,Jn=new WeakMap,Hi=new WeakMap,Rt=new WeakMap,fc=new WeakMap,Wi=new WeakMap,xr=new WeakSet,rs=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...JS(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...a0(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return se(this,ia,t.manual?s:void 0),s;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),St.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),L(this,Jn).notify({query:this,type:"updated",action:t})})},kw);function JS(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:QS(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function a0(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function l0(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Cn,Te,pc,cn,Ui,oa,os,Xs,mc,aa,la,qi,Ki,Gs,ca,Le,hl,fm,pm,mm,gm,vm,xm,ym,ZS,Cw,V4=(Cw=class extends Ta{constructor(t,n){super();ce(this,Le);ce(this,Cn);ce(this,Te);ce(this,pc);ce(this,cn);ce(this,Ui);ce(this,oa);ce(this,os);ce(this,Xs);ce(this,mc);ce(this,aa);ce(this,la);ce(this,qi);ce(this,Ki);ce(this,Gs);ce(this,ca,new Set);this.options=n,se(this,Cn,t),se(this,Xs,null),se(this,os,dm()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(L(this,Te).addObserver(this),c0(L(this,Te),this.options)?be(this,Le,hl).call(this):this.updateResult(),be(this,Le,gm).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return _m(L(this,Te),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return _m(L(this,Te),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,be(this,Le,vm).call(this),be(this,Le,xm).call(this),L(this,Te).removeObserver(this)}setOptions(t){const n=this.options,r=L(this,Te);if(this.options=L(this,Cn).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Zn(this.options.enabled,L(this,Te))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");be(this,Le,ym).call(this),L(this,Te).setOptions(this.options),n._defaulted&&!Dd(this.options,n)&&L(this,Cn).getQueryCache().notify({type:"observerOptionsUpdated",query:L(this,Te),observer:this});const s=this.hasListeners();s&&u0(L(this,Te),r,this.options,n)&&be(this,Le,hl).call(this),this.updateResult(),s&&(L(this,Te)!==r||Zn(this.options.enabled,L(this,Te))!==Zn(n.enabled,L(this,Te))||fi(this.options.staleTime,L(this,Te))!==fi(n.staleTime,L(this,Te)))&&be(this,Le,fm).call(this);const i=be(this,Le,pm).call(this);s&&(L(this,Te)!==r||Zn(this.options.enabled,L(this,Te))!==Zn(n.enabled,L(this,Te))||i!==L(this,Gs))&&be(this,Le,mm).call(this,i)}getOptimisticResult(t){const n=L(this,Cn).getQueryCache().build(L(this,Cn),t),r=this.createResult(n,t);return Q4(this,r)&&(se(this,cn,r),se(this,oa,this.options),se(this,Ui,L(this,Te).state)),r}getCurrentResult(){return L(this,cn)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&L(this,os).status==="pending"&&L(this,os).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){L(this,ca).add(t)}getCurrentQuery(){return L(this,Te)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=L(this,Cn).defaultQueryOptions(t),r=L(this,Cn).getQueryCache().build(L(this,Cn),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return be(this,Le,hl).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),L(this,cn)))}createResult(t,n){var F;const r=L(this,Te),s=this.options,i=L(this,cn),o=L(this,Ui),l=L(this,oa),u=t!==r?t.state:L(this,pc),{state:h}=t;let d={...h},p=!1,f;if(n._optimisticResults){const P=this.hasListeners(),I=!P&&c0(t,n),A=P&&u0(t,r,n,s);(I||A)&&(d={...d,...JS(h.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:m,errorUpdatedAt:g,status:b}=d;f=d.data;let x=!1;if(n.placeholderData!==void 0&&f===void 0&&b==="pending"){let P;i!=null&&i.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(P=i.data,x=!0):P=typeof n.placeholderData=="function"?n.placeholderData((F=L(this,la))==null?void 0:F.state.data,L(this,la)):n.placeholderData,P!==void 0&&(b="success",f=um(i==null?void 0:i.data,P,n),p=!0)}if(n.select&&f!==void 0&&!x)if(i&&f===(o==null?void 0:o.data)&&n.select===L(this,mc))f=L(this,aa);else try{se(this,mc,n.select),f=n.select(f),f=um(i==null?void 0:i.data,f,n),se(this,aa,f),se(this,Xs,null)}catch(P){se(this,Xs,P)}L(this,Xs)&&(m=L(this,Xs),f=L(this,aa),g=Date.now(),b="error");const y=d.fetchStatus==="fetching",_=b==="pending",w=b==="error",C=_&&y,S=f!==void 0,T={status:b,fetchStatus:d.fetchStatus,isPending:_,isSuccess:b==="success",isError:w,isInitialLoading:C,isLoading:C,data:f,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>u.dataUpdateCount||d.errorUpdateCount>u.errorUpdateCount,isFetching:y,isRefetching:y&&!_,isLoadingError:w&&!S,isPaused:d.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:w&&S,isStale:Fv(t,n),refetch:this.refetch,promise:L(this,os),isEnabled:Zn(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const P=T.data!==void 0,I=T.status==="error"&&!P,A=E=>{I?E.reject(T.error):P&&E.resolve(T.data)},M=()=>{const E=se(this,os,T.promise=dm());A(E)},j=L(this,os);switch(j.status){case"pending":t.queryHash===r.queryHash&&A(j);break;case"fulfilled":(I||T.data!==j.value)&&M();break;case"rejected":(!I||T.error!==j.reason)&&M();break}}return T}updateResult(){const t=L(this,cn),n=this.createResult(L(this,Te),this.options);if(se(this,Ui,L(this,Te).state),se(this,oa,this.options),L(this,Ui).data!==void 0&&se(this,la,L(this,Te)),Dd(n,t))return;se(this,cn,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!L(this,ca).size)return!0;const o=new Set(i??L(this,ca));return this.options.throwOnError&&o.add("error"),Object.keys(L(this,cn)).some(l=>{const c=l;return L(this,cn)[c]!==t[c]&&o.has(c)})};be(this,Le,ZS).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&be(this,Le,gm).call(this)}},Cn=new WeakMap,Te=new WeakMap,pc=new WeakMap,cn=new WeakMap,Ui=new WeakMap,oa=new WeakMap,os=new WeakMap,Xs=new WeakMap,mc=new WeakMap,aa=new WeakMap,la=new WeakMap,qi=new WeakMap,Ki=new WeakMap,Gs=new WeakMap,ca=new WeakMap,Le=new WeakSet,hl=function(t){be(this,Le,ym).call(this);let n=L(this,Te).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(dn)),n},fm=function(){be(this,Le,vm).call(this);const t=fi(this.options.staleTime,L(this,Te));if(no||L(this,cn).isStale||!lm(t))return;const r=KS(L(this,cn).dataUpdatedAt,t)+1;se(this,qi,Ii.setTimeout(()=>{L(this,cn).isStale||this.updateResult()},r))},pm=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(L(this,Te)):this.options.refetchInterval)??!1},mm=function(t){be(this,Le,xm).call(this),se(this,Gs,t),!(no||Zn(this.options.enabled,L(this,Te))===!1||!lm(L(this,Gs))||L(this,Gs)===0)&&se(this,Ki,Ii.setInterval(()=>{(this.options.refetchIntervalInBackground||Bv.isFocused())&&be(this,Le,hl).call(this)},L(this,Gs)))},gm=function(){be(this,Le,fm).call(this),be(this,Le,mm).call(this,be(this,Le,pm).call(this))},vm=function(){L(this,qi)&&(Ii.clearTimeout(L(this,qi)),se(this,qi,void 0))},xm=function(){L(this,Ki)&&(Ii.clearInterval(L(this,Ki)),se(this,Ki,void 0))},ym=function(){const t=L(this,Cn).getQueryCache().build(L(this,Cn),this.options);if(t===L(this,Te))return;const n=L(this,Te);se(this,Te,t),se(this,pc,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},ZS=function(t){St.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(L(this,cn))}),L(this,Cn).getQueryCache().notify({query:L(this,Te),type:"observerResultsUpdated"})})},Cw);function Y4(e,t){return Zn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function c0(e,t){return Y4(e,t)||e.state.data!==void 0&&_m(e,t,t.refetchOnMount)}function _m(e,t,n){if(Zn(t.enabled,e)!==!1&&fi(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Fv(e,t)}return!1}function u0(e,t,n,r){return(e!==t||Zn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Fv(e,n)}function Fv(e,t){return Zn(t.enabled,e)!==!1&&e.isStaleByTime(fi(t.staleTime,e))}function Q4(e,t){return!Dd(e.getCurrentResult(),t)}function d0(e){return{onFetch:(t,n)=>{var h,d,p,f,m;const r=t.options,s=(p=(d=(h=t.fetchOptions)==null?void 0:h.meta)==null?void 0:d.fetchMore)==null?void 0:p.direction,i=((f=t.state.data)==null?void 0:f.pages)||[],o=((m=t.state.data)==null?void 0:m.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let g=!1;const b=_=>{z4(_,()=>t.signal,()=>g=!0)},x=YS(t.options,t.fetchOptions),y=async(_,w,C)=>{if(g)return Promise.reject();if(w==null&&_.pages.length)return Promise.resolve(_);const R=(()=>{const I={client:t.client,queryKey:t.queryKey,pageParam:w,direction:C?"backward":"forward",meta:t.options.meta};return b(I),I})(),T=await x(R),{maxPages:F}=t.options,P=C?F4:B4;return{pages:P(_.pages,T,F),pageParams:P(_.pageParams,w,F)}};if(s&&i.length){const _=s==="backward",w=_?X4:h0,C={pages:i,pageParams:o},S=w(r,C);l=await y(C,S,_)}else{const _=e??i.length;do{const w=c===0?o[0]??r.initialPageParam:h0(r,l);if(c>0&&w==null)break;l=await y(l,w),c++}while(c<_)}return l};t.options.persister?t.fetchFn=()=>{var g,b;return(b=(g=t.options).persister)==null?void 0:b.call(g,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function h0(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function X4(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var gc,Br,Jt,Vi,Fr,Bs,Nw,G4=(Nw=class extends GS{constructor(t){super();ce(this,Fr);ce(this,gc);ce(this,Br);ce(this,Jt);ce(this,Vi);se(this,gc,t.client),this.mutationId=t.mutationId,se(this,Jt,t.mutationCache),se(this,Br,[]),this.state=t.state||ek(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){L(this,Br).includes(t)||(L(this,Br).push(t),this.clearGcTimeout(),L(this,Jt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){se(this,Br,L(this,Br).filter(n=>n!==t)),this.scheduleGc(),L(this,Jt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){L(this,Br).length||(this.state.status==="pending"?this.scheduleGc():L(this,Jt).remove(this))}continue(){var t;return((t=L(this,Vi))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,c,u,h,d,p,f,m,g,b,x,y,_,w,C,S,R;const n=()=>{be(this,Fr,Bs).call(this,{type:"continue"})},r={client:L(this,gc),meta:this.options.meta,mutationKey:this.options.mutationKey};se(this,Vi,XS({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(T,F)=>{be(this,Fr,Bs).call(this,{type:"failed",failureCount:T,error:F})},onPause:()=>{be(this,Fr,Bs).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>L(this,Jt).canRun(this)}));const s=this.state.status==="pending",i=!L(this,Vi).canStart();try{if(s)n();else{be(this,Fr,Bs).call(this,{type:"pending",variables:t,isPaused:i}),L(this,Jt).config.onMutate&&await L(this,Jt).config.onMutate(t,this,r);const F=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t,r));F!==this.state.context&&be(this,Fr,Bs).call(this,{type:"pending",context:F,variables:t,isPaused:i})}const T=await L(this,Vi).start();return await((u=(c=L(this,Jt).config).onSuccess)==null?void 0:u.call(c,T,t,this.state.context,this,r)),await((d=(h=this.options).onSuccess)==null?void 0:d.call(h,T,t,this.state.context,r)),await((f=(p=L(this,Jt).config).onSettled)==null?void 0:f.call(p,T,null,this.state.variables,this.state.context,this,r)),await((g=(m=this.options).onSettled)==null?void 0:g.call(m,T,null,t,this.state.context,r)),be(this,Fr,Bs).call(this,{type:"success",data:T}),T}catch(T){try{await((x=(b=L(this,Jt).config).onError)==null?void 0:x.call(b,T,t,this.state.context,this,r))}catch(F){Promise.reject(F)}try{await((_=(y=this.options).onError)==null?void 0:_.call(y,T,t,this.state.context,r))}catch(F){Promise.reject(F)}try{await((C=(w=L(this,Jt).config).onSettled)==null?void 0:C.call(w,void 0,T,this.state.variables,this.state.context,this,r))}catch(F){Promise.reject(F)}try{await((R=(S=this.options).onSettled)==null?void 0:R.call(S,void 0,T,t,this.state.context,r))}catch(F){Promise.reject(F)}throw be(this,Fr,Bs).call(this,{type:"error",error:T}),T}finally{L(this,Jt).runNext(this)}}},gc=new WeakMap,Br=new WeakMap,Jt=new WeakMap,Vi=new WeakMap,Fr=new WeakSet,Bs=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),St.batch(()=>{L(this,Br).forEach(r=>{r.onMutationUpdate(t)}),L(this,Jt).notify({mutation:this,type:"updated",action:t})})},Nw);function ek(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var as,yr,vc,jw,J4=(jw=class extends Ta{constructor(t={}){super();ce(this,as);ce(this,yr);ce(this,vc);this.config=t,se(this,as,new Set),se(this,yr,new Map),se(this,vc,0)}build(t,n,r){const s=new G4({client:t,mutationCache:this,mutationId:++$c(this,vc)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){L(this,as).add(t);const n=iu(t);if(typeof n=="string"){const r=L(this,yr).get(n);r?r.push(t):L(this,yr).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(L(this,as).delete(t)){const n=iu(t);if(typeof n=="string"){const r=L(this,yr).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&L(this,yr).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=iu(t);if(typeof n=="string"){const r=L(this,yr).get(n),s=r==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=iu(t);if(typeof n=="string"){const s=(r=L(this,yr).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){St.batch(()=>{L(this,as).forEach(t=>{this.notify({type:"removed",mutation:t})}),L(this,as).clear(),L(this,yr).clear()})}getAll(){return Array.from(L(this,as))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>s0(n,r))}findAll(t={}){return this.getAll().filter(n=>s0(t,n))}notify(t){St.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return St.batch(()=>Promise.all(t.map(n=>n.continue().catch(dn))))}},as=new WeakMap,yr=new WeakMap,vc=new WeakMap,jw);function iu(e){var t;return(t=e.options.scope)==null?void 0:t.id}var ls,Js,Nn,cs,gs,Uu,bm,Ew,Z4=(Ew=class extends Ta{constructor(n,r){super();ce(this,gs);ce(this,ls);ce(this,Js);ce(this,Nn);ce(this,cs);se(this,ls,n),this.setOptions(r),this.bindMethods(),be(this,gs,Uu).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const r=this.options;this.options=L(this,ls).defaultMutationOptions(n),Dd(this.options,r)||L(this,ls).getMutationCache().notify({type:"observerOptionsUpdated",mutation:L(this,Nn),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&ro(r.mutationKey)!==ro(this.options.mutationKey)?this.reset():((s=L(this,Nn))==null?void 0:s.state.status)==="pending"&&L(this,Nn).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=L(this,Nn))==null||n.removeObserver(this)}onMutationUpdate(n){be(this,gs,Uu).call(this),be(this,gs,bm).call(this,n)}getCurrentResult(){return L(this,Js)}reset(){var n;(n=L(this,Nn))==null||n.removeObserver(this),se(this,Nn,void 0),be(this,gs,Uu).call(this),be(this,gs,bm).call(this)}mutate(n,r){var s;return se(this,cs,r),(s=L(this,Nn))==null||s.removeObserver(this),se(this,Nn,L(this,ls).getMutationCache().build(L(this,ls),this.options)),L(this,Nn).addObserver(this),L(this,Nn).execute(n)}},ls=new WeakMap,Js=new WeakMap,Nn=new WeakMap,cs=new WeakMap,gs=new WeakSet,Uu=function(){var r;const n=((r=L(this,Nn))==null?void 0:r.state)??ek();se(this,Js,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},bm=function(n){St.batch(()=>{var r,s,i,o,l,c,u,h;if(L(this,cs)&&this.hasListeners()){const d=L(this,Js).variables,p=L(this,Js).context,f={client:L(this,ls),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(r=L(this,cs)).onSuccess)==null||s.call(r,n.data,d,p,f)}catch(m){Promise.reject(m)}try{(o=(i=L(this,cs)).onSettled)==null||o.call(i,n.data,null,d,p,f)}catch(m){Promise.reject(m)}}else if((n==null?void 0:n.type)==="error"){try{(c=(l=L(this,cs)).onError)==null||c.call(l,n.error,d,p,f)}catch(m){Promise.reject(m)}try{(h=(u=L(this,cs)).onSettled)==null||h.call(u,void 0,n.error,d,p,f)}catch(m){Promise.reject(m)}}}this.listeners.forEach(d=>{d(L(this,Js))})})},Ew),zr,Rw,eR=(Rw=class extends Ta{constructor(t={}){super();ce(this,zr);this.config=t,se(this,zr,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??Av(s,n);let o=this.get(i);return o||(o=new K4({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){L(this,zr).has(t.queryHash)||(L(this,zr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=L(this,zr).get(t.queryHash);n&&(t.destroy(),n===t&&L(this,zr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){St.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return L(this,zr).get(t)}getAll(){return[...L(this,zr).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>r0(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>r0(t,r)):n}notify(t){St.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){St.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){St.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},zr=new WeakMap,Rw),rt,Zs,ei,ua,da,ti,ha,fa,Tw,tR=(Tw=class{constructor(e={}){ce(this,rt);ce(this,Zs);ce(this,ei);ce(this,ua);ce(this,da);ce(this,ti);ce(this,ha);ce(this,fa);se(this,rt,e.queryCache||new eR),se(this,Zs,e.mutationCache||new J4),se(this,ei,e.defaultOptions||{}),se(this,ua,new Map),se(this,da,new Map),se(this,ti,0)}mount(){$c(this,ti)._++,L(this,ti)===1&&(se(this,ha,Bv.subscribe(async e=>{e&&(await this.resumePausedMutations(),L(this,rt).onFocus())})),se(this,fa,Md.subscribe(async e=>{e&&(await this.resumePausedMutations(),L(this,rt).onOnline())})))}unmount(){var e,t;$c(this,ti)._--,L(this,ti)===0&&((e=L(this,ha))==null||e.call(this),se(this,ha,void 0),(t=L(this,fa))==null||t.call(this),se(this,fa,void 0))}isFetching(e){return L(this,rt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return L(this,Zs).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=L(this,rt).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=L(this,rt).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(fi(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return L(this,rt).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=L(this,rt).get(r.queryHash),i=s==null?void 0:s.state.data,o=A4(t,i);if(o!==void 0)return L(this,rt).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return St.batch(()=>L(this,rt).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=L(this,rt).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=L(this,rt);St.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=L(this,rt);return St.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=St.batch(()=>L(this,rt).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(dn).catch(dn)}invalidateQueries(e,t={}){return St.batch(()=>(L(this,rt).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=St.batch(()=>L(this,rt).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(dn)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(dn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=L(this,rt).build(this,t);return n.isStaleByTime(fi(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(dn).catch(dn)}fetchInfiniteQuery(e){return e.behavior=d0(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(dn).catch(dn)}ensureInfiniteQueryData(e){return e.behavior=d0(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Md.isOnline()?L(this,Zs).resumePausedMutations():Promise.resolve()}getQueryCache(){return L(this,rt)}getMutationCache(){return L(this,Zs)}getDefaultOptions(){return L(this,ei)}setDefaultOptions(e){se(this,ei,e)}setQueryDefaults(e,t){L(this,ua).set(ro(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...L(this,ua).values()],n={};return t.forEach(r=>{ec(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){L(this,da).set(ro(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...L(this,da).values()],n={};return t.forEach(r=>{ec(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...L(this,ei).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Av(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Ov&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...L(this,ei).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){L(this,rt).clear(),L(this,Zs).clear()}},rt=new WeakMap,Zs=new WeakMap,ei=new WeakMap,ua=new WeakMap,da=new WeakMap,ti=new WeakMap,ha=new WeakMap,fa=new WeakMap,Tw),tk=v.createContext(void 0),rn=e=>{const t=v.useContext(tk);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},nR=({client:e,children:t})=>(v.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(tk.Provider,{value:e,children:t})),nk=v.createContext(!1),rR=()=>v.useContext(nk);nk.Provider;function sR(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var iR=v.createContext(sR()),oR=()=>v.useContext(iR),aR=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Iv(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},lR=e=>{v.useEffect(()=>{e.clearReset()},[e])},cR=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Iv(n,[e.error,r])),uR=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},dR=(e,t)=>e.isLoading&&e.isFetching&&!t,hR=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,f0=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function fR(e,t,n){var p,f,m,g;const r=rR(),s=oR(),i=rn(),o=i.defaultQueryOptions(e);(f=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||f.call(p,o);const l=i.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",uR(o),aR(o,s,l),lR(s);const c=!i.getQueryCache().get(o.queryHash),[u]=v.useState(()=>new t(i,o)),h=u.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(v.useSyncExternalStore(v.useCallback(b=>{const x=d?u.subscribe(St.batchCalls(b)):dn;return u.updateResult(),x},[u,d]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),v.useEffect(()=>{u.setOptions(o)},[o,u]),hR(o,h))throw f0(o,u,s);if(cR({result:h,errorResetBoundary:s,throwOnError:o.throwOnError,query:l,suspense:o.suspense}))throw h.error;if((g=(m=i.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||g.call(m,o,h),o.experimental_prefetchInRender&&!no&&dR(h,r)){const b=c?f0(o,u,s):l==null?void 0:l.promise;b==null||b.catch(dn).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?h:u.trackResult(h)}function ue(e,t){return fR(e,V4)}function xe(e,t){const n=rn(),[r]=v.useState(()=>new Z4(n,e));v.useEffect(()=>{r.setOptions(e)},[r,e]);const s=v.useSyncExternalStore(v.useCallback(o=>r.subscribe(St.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=v.useCallback((o,l)=>{r.mutate(o,l).catch(dn)},[r]);if(s.error&&Iv(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}/**
41
- * @license lucide-react v0.400.0 - ISC
42
- *
43
- * This source code is licensed under the ISC license.
44
- * See the LICENSE file in the root directory of this source tree.
45
- */const pR=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),rk=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).join(" ");/**
46
- * @license lucide-react v0.400.0 - ISC
47
- *
48
- * This source code is licensed under the ISC license.
49
- * See the LICENSE file in the root directory of this source tree.
50
- */var mR={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
51
- * @license lucide-react v0.400.0 - ISC
52
- *
53
- * This source code is licensed under the ISC license.
54
- * See the LICENSE file in the root directory of this source tree.
55
- */const gR=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...l},c)=>v.createElement("svg",{ref:c,...mR,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:rk("lucide",s),...l},[...o.map(([u,h])=>v.createElement(u,h)),...Array.isArray(i)?i:[i]]));/**
56
- * @license lucide-react v0.400.0 - ISC
57
- *
58
- * This source code is licensed under the ISC license.
59
- * See the LICENSE file in the root directory of this source tree.
60
- */const ne=(e,t)=>{const n=v.forwardRef(({className:r,...s},i)=>v.createElement(gR,{ref:i,iconNode:t,className:rk(`lucide-${pR(e)}`,r),...s}));return n.displayName=`${e}`,n};/**
61
- * @license lucide-react v0.400.0 - ISC
62
- *
63
- * This source code is licensed under the ISC license.
64
- * See the LICENSE file in the root directory of this source tree.
65
- */const ba=ne("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
66
- * @license lucide-react v0.400.0 - ISC
67
- *
68
- * This source code is licensed under the ISC license.
69
- * See the LICENSE file in the root directory of this source tree.
70
- */const zv=ne("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/**
71
- * @license lucide-react v0.400.0 - ISC
72
- *
73
- * This source code is licensed under the ISC license.
74
- * See the LICENSE file in the root directory of this source tree.
75
- */const wm=ne("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
76
- * @license lucide-react v0.400.0 - ISC
77
- *
78
- * This source code is licensed under the ISC license.
79
- * See the LICENSE file in the root directory of this source tree.
80
- */const vR=ne("BarChart3",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
81
- * @license lucide-react v0.400.0 - ISC
82
- *
83
- * This source code is licensed under the ISC license.
84
- * See the LICENSE file in the root directory of this source tree.
85
- */const xR=ne("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
86
- * @license lucide-react v0.400.0 - ISC
87
- *
88
- * This source code is licensed under the ISC license.
89
- * See the LICENSE file in the root directory of this source tree.
90
- */const sk=ne("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
91
- * @license lucide-react v0.400.0 - ISC
92
- *
93
- * This source code is licensed under the ISC license.
94
- * See the LICENSE file in the root directory of this source tree.
95
- */const ik=ne("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/**
96
- * @license lucide-react v0.400.0 - ISC
97
- *
98
- * This source code is licensed under the ISC license.
99
- * See the LICENSE file in the root directory of this source tree.
100
- */const p0=ne("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
101
- * @license lucide-react v0.400.0 - ISC
102
- *
103
- * This source code is licensed under the ISC license.
104
- * See the LICENSE file in the root directory of this source tree.
105
- */const $v=ne("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
106
- * @license lucide-react v0.400.0 - ISC
107
- *
108
- * This source code is licensed under the ISC license.
109
- * See the LICENSE file in the root directory of this source tree.
110
- */const yR=ne("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
111
- * @license lucide-react v0.400.0 - ISC
112
- *
113
- * This source code is licensed under the ISC license.
114
- * See the LICENSE file in the root directory of this source tree.
115
- */const ok=ne("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/**
116
- * @license lucide-react v0.400.0 - ISC
117
- *
118
- * This source code is licensed under the ISC license.
119
- * See the LICENSE file in the root directory of this source tree.
120
- */const El=ne("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
121
- * @license lucide-react v0.400.0 - ISC
122
- *
123
- * This source code is licensed under the ISC license.
124
- * See the LICENSE file in the root directory of this source tree.
125
- */const mh=ne("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
126
- * @license lucide-react v0.400.0 - ISC
127
- *
128
- * This source code is licensed under the ISC license.
129
- * See the LICENSE file in the root directory of this source tree.
130
- */const Sc=ne("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
131
- * @license lucide-react v0.400.0 - ISC
132
- *
133
- * This source code is licensed under the ISC license.
134
- * See the LICENSE file in the root directory of this source tree.
135
- */const so=ne("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
136
- * @license lucide-react v0.400.0 - ISC
137
- *
138
- * This source code is licensed under the ISC license.
139
- * See the LICENSE file in the root directory of this source tree.
140
- */const Yr=ne("CircleCheckBig",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
141
- * @license lucide-react v0.400.0 - ISC
142
- *
143
- * This source code is licensed under the ISC license.
144
- * See the LICENSE file in the root directory of this source tree.
145
- */const Di=ne("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
146
- * @license lucide-react v0.400.0 - ISC
147
- *
148
- * This source code is licensed under the ISC license.
149
- * See the LICENSE file in the root directory of this source tree.
150
- */const _R=ne("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
151
- * @license lucide-react v0.400.0 - ISC
152
- *
153
- * This source code is licensed under the ISC license.
154
- * See the LICENSE file in the root directory of this source tree.
155
- */const bR=ne("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{width:"6",height:"6",x:"9",y:"9",key:"1wrtvo"}]]);/**
156
- * @license lucide-react v0.400.0 - ISC
157
- *
158
- * This source code is licensed under the ISC license.
159
- * See the LICENSE file in the root directory of this source tree.
160
- */const bs=ne("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
161
- * @license lucide-react v0.400.0 - ISC
162
- *
163
- * This source code is licensed under the ISC license.
164
- * See the LICENSE file in the root directory of this source tree.
165
- */const ak=ne("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
166
- * @license lucide-react v0.400.0 - ISC
167
- *
168
- * This source code is licensed under the ISC license.
169
- * See the LICENSE file in the root directory of this source tree.
170
- */const wR=ne("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/**
171
- * @license lucide-react v0.400.0 - ISC
172
- *
173
- * This source code is licensed under the ISC license.
174
- * See the LICENSE file in the root directory of this source tree.
175
- */const wa=ne("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
176
- * @license lucide-react v0.400.0 - ISC
177
- *
178
- * This source code is licensed under the ISC license.
179
- * See the LICENSE file in the root directory of this source tree.
180
- */const Sm=ne("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
181
- * @license lucide-react v0.400.0 - ISC
182
- *
183
- * This source code is licensed under the ISC license.
184
- * See the LICENSE file in the root directory of this source tree.
185
- */const lk=ne("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
186
- * @license lucide-react v0.400.0 - ISC
187
- *
188
- * This source code is licensed under the ISC license.
189
- * See the LICENSE file in the root directory of this source tree.
190
- */const SR=ne("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
191
- * @license lucide-react v0.400.0 - ISC
192
- *
193
- * This source code is licensed under the ISC license.
194
- * See the LICENSE file in the root directory of this source tree.
195
- */const ck=ne("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
196
- * @license lucide-react v0.400.0 - ISC
197
- *
198
- * This source code is licensed under the ISC license.
199
- * See the LICENSE file in the root directory of this source tree.
200
- */const km=ne("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
201
- * @license lucide-react v0.400.0 - ISC
202
- *
203
- * This source code is licensed under the ISC license.
204
- * See the LICENSE file in the root directory of this source tree.
205
- */const go=ne("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
206
- * @license lucide-react v0.400.0 - ISC
207
- *
208
- * This source code is licensed under the ISC license.
209
- * See the LICENSE file in the root directory of this source tree.
210
- */const Qr=ne("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
211
- * @license lucide-react v0.400.0 - ISC
212
- *
213
- * This source code is licensed under the ISC license.
214
- * See the LICENSE file in the root directory of this source tree.
215
- */const kc=ne("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
216
- * @license lucide-react v0.400.0 - ISC
217
- *
218
- * This source code is licensed under the ISC license.
219
- * See the LICENSE file in the root directory of this source tree.
220
- */const io=ne("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
221
- * @license lucide-react v0.400.0 - ISC
222
- *
223
- * This source code is licensed under the ISC license.
224
- * See the LICENSE file in the root directory of this source tree.
225
- */const kR=ne("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
226
- * @license lucide-react v0.400.0 - ISC
227
- *
228
- * This source code is licensed under the ISC license.
229
- * See the LICENSE file in the root directory of this source tree.
230
- */const m0=ne("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
231
- * @license lucide-react v0.400.0 - ISC
232
- *
233
- * This source code is licensed under the ISC license.
234
- * See the LICENSE file in the root directory of this source tree.
235
- */const Cm=ne("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
236
- * @license lucide-react v0.400.0 - ISC
237
- *
238
- * This source code is licensed under the ISC license.
239
- * See the LICENSE file in the root directory of this source tree.
240
- */const uk=ne("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
241
- * @license lucide-react v0.400.0 - ISC
242
- *
243
- * This source code is licensed under the ISC license.
244
- * See the LICENSE file in the root directory of this source tree.
245
- */const Nm=ne("GitMerge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);/**
246
- * @license lucide-react v0.400.0 - ISC
247
- *
248
- * This source code is licensed under the ISC license.
249
- * See the LICENSE file in the root directory of this source tree.
250
- */const Hv=ne("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/**
251
- * @license lucide-react v0.400.0 - ISC
252
- *
253
- * This source code is licensed under the ISC license.
254
- * See the LICENSE file in the root directory of this source tree.
255
- */const g0=ne("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
256
- * @license lucide-react v0.400.0 - ISC
257
- *
258
- * This source code is licensed under the ISC license.
259
- * See the LICENSE file in the root directory of this source tree.
260
- */const CR=ne("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]);/**
261
- * @license lucide-react v0.400.0 - ISC
262
- *
263
- * This source code is licensed under the ISC license.
264
- * See the LICENSE file in the root directory of this source tree.
265
- */const dk=ne("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
266
- * @license lucide-react v0.400.0 - ISC
267
- *
268
- * This source code is licensed under the ISC license.
269
- * See the LICENSE file in the root directory of this source tree.
270
- */const hk=ne("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
271
- * @license lucide-react v0.400.0 - ISC
272
- *
273
- * This source code is licensed under the ISC license.
274
- * See the LICENSE file in the root directory of this source tree.
275
- */const NR=ne("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
276
- * @license lucide-react v0.400.0 - ISC
277
- *
278
- * This source code is licensed under the ISC license.
279
- * See the LICENSE file in the root directory of this source tree.
280
- */const fk=ne("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
281
- * @license lucide-react v0.400.0 - ISC
282
- *
283
- * This source code is licensed under the ISC license.
284
- * See the LICENSE file in the root directory of this source tree.
285
- */const oo=ne("List",[["line",{x1:"8",x2:"21",y1:"6",y2:"6",key:"7ey8pc"}],["line",{x1:"8",x2:"21",y1:"12",y2:"12",key:"rjfblc"}],["line",{x1:"8",x2:"21",y1:"18",y2:"18",key:"c3b1m8"}],["line",{x1:"3",x2:"3.01",y1:"6",y2:"6",key:"1g7gq3"}],["line",{x1:"3",x2:"3.01",y1:"12",y2:"12",key:"1pjlvk"}],["line",{x1:"3",x2:"3.01",y1:"18",y2:"18",key:"28t2mc"}]]);/**
286
- * @license lucide-react v0.400.0 - ISC
287
- *
288
- * This source code is licensed under the ISC license.
289
- * See the LICENSE file in the root directory of this source tree.
290
- */const ye=ne("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
291
- * @license lucide-react v0.400.0 - ISC
292
- *
293
- * This source code is licensed under the ISC license.
294
- * See the LICENSE file in the root directory of this source tree.
295
- */const jR=ne("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
296
- * @license lucide-react v0.400.0 - ISC
297
- *
298
- * This source code is licensed under the ISC license.
299
- * See the LICENSE file in the root directory of this source tree.
300
- */const ER=ne("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
301
- * @license lucide-react v0.400.0 - ISC
302
- *
303
- * This source code is licensed under the ISC license.
304
- * See the LICENSE file in the root directory of this source tree.
305
- */const RR=ne("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
306
- * @license lucide-react v0.400.0 - ISC
307
- *
308
- * This source code is licensed under the ISC license.
309
- * See the LICENSE file in the root directory of this source tree.
310
- */const jm=ne("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
311
- * @license lucide-react v0.400.0 - ISC
312
- *
313
- * This source code is licensed under the ISC license.
314
- * See the LICENSE file in the root directory of this source tree.
315
- */const TR=ne("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
316
- * @license lucide-react v0.400.0 - ISC
317
- *
318
- * This source code is licensed under the ISC license.
319
- * See the LICENSE file in the root directory of this source tree.
320
- */const PR=ne("MoveDown",[["path",{d:"M8 18L12 22L16 18",key:"cskvfv"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/**
321
- * @license lucide-react v0.400.0 - ISC
322
- *
323
- * This source code is licensed under the ISC license.
324
- * See the LICENSE file in the root directory of this source tree.
325
- */const DR=ne("MoveUp",[["path",{d:"M8 6L12 2L16 6",key:"1yvkyx"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/**
326
- * @license lucide-react v0.400.0 - ISC
327
- *
328
- * This source code is licensed under the ISC license.
329
- * See the LICENSE file in the root directory of this source tree.
330
- */const Rn=ne("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
331
- * @license lucide-react v0.400.0 - ISC
332
- *
333
- * This source code is licensed under the ISC license.
334
- * See the LICENSE file in the root directory of this source tree.
335
- */const MR=ne("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
336
- * @license lucide-react v0.400.0 - ISC
337
- *
338
- * This source code is licensed under the ISC license.
339
- * See the LICENSE file in the root directory of this source tree.
340
- */const us=ne("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
341
- * @license lucide-react v0.400.0 - ISC
342
- *
343
- * This source code is licensed under the ISC license.
344
- * See the LICENSE file in the root directory of this source tree.
345
- */const Cc=ne("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
346
- * @license lucide-react v0.400.0 - ISC
347
- *
348
- * This source code is licensed under the ISC license.
349
- * See the LICENSE file in the root directory of this source tree.
350
- */const LR=ne("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/**
351
- * @license lucide-react v0.400.0 - ISC
352
- *
353
- * This source code is licensed under the ISC license.
354
- * See the LICENSE file in the root directory of this source tree.
355
- */const AR=ne("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
356
- * @license lucide-react v0.400.0 - ISC
357
- *
358
- * This source code is licensed under the ISC license.
359
- * See the LICENSE file in the root directory of this source tree.
360
- */const pk=ne("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
361
- * @license lucide-react v0.400.0 - ISC
362
- *
363
- * This source code is licensed under the ISC license.
364
- * See the LICENSE file in the root directory of this source tree.
365
- */const mk=ne("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
366
- * @license lucide-react v0.400.0 - ISC
367
- *
368
- * This source code is licensed under the ISC license.
369
- * See the LICENSE file in the root directory of this source tree.
370
- */const OR=ne("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
371
- * @license lucide-react v0.400.0 - ISC
372
- *
373
- * This source code is licensed under the ISC license.
374
- * See the LICENSE file in the root directory of this source tree.
375
- */const v0=ne("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
376
- * @license lucide-react v0.400.0 - ISC
377
- *
378
- * This source code is licensed under the ISC license.
379
- * See the LICENSE file in the root directory of this source tree.
380
- */const tc=ne("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
381
- * @license lucide-react v0.400.0 - ISC
382
- *
383
- * This source code is licensed under the ISC license.
384
- * See the LICENSE file in the root directory of this source tree.
385
- */const IR=ne("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
386
- * @license lucide-react v0.400.0 - ISC
387
- *
388
- * This source code is licensed under the ISC license.
389
- * See the LICENSE file in the root directory of this source tree.
390
- */const Wv=ne("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
391
- * @license lucide-react v0.400.0 - ISC
392
- *
393
- * This source code is licensed under the ISC license.
394
- * See the LICENSE file in the root directory of this source tree.
395
- */const ao=ne("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
396
- * @license lucide-react v0.400.0 - ISC
397
- *
398
- * This source code is licensed under the ISC license.
399
- * See the LICENSE file in the root directory of this source tree.
400
- */const gk=ne("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
401
- * @license lucide-react v0.400.0 - ISC
402
- *
403
- * This source code is licensed under the ISC license.
404
- * See the LICENSE file in the root directory of this source tree.
405
- */const Uv=ne("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
406
- * @license lucide-react v0.400.0 - ISC
407
- *
408
- * This source code is licensed under the ISC license.
409
- * See the LICENSE file in the root directory of this source tree.
410
- */const tn=ne("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
411
- * @license lucide-react v0.400.0 - ISC
412
- *
413
- * This source code is licensed under the ISC license.
414
- * See the LICENSE file in the root directory of this source tree.
415
- */const vk=ne("Undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);/**
416
- * @license lucide-react v0.400.0 - ISC
417
- *
418
- * This source code is licensed under the ISC license.
419
- * See the LICENSE file in the root directory of this source tree.
420
- */const xk=ne("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
421
- * @license lucide-react v0.400.0 - ISC
422
- *
423
- * This source code is licensed under the ISC license.
424
- * See the LICENSE file in the root directory of this source tree.
425
- */const qv=ne("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
426
- * @license lucide-react v0.400.0 - ISC
427
- *
428
- * This source code is licensed under the ISC license.
429
- * See the LICENSE file in the root directory of this source tree.
430
- */const nc=ne("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
431
- * @license lucide-react v0.400.0 - ISC
432
- *
433
- * This source code is licensed under the ISC license.
434
- * See the LICENSE file in the root directory of this source tree.
435
- */const mt=ne("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
436
- * @license lucide-react v0.400.0 - ISC
437
- *
438
- * This source code is licensed under the ISC license.
439
- * See the LICENSE file in the root directory of this source tree.
440
- */const BR=ne("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),Kv=v.createContext(null);function ks(){const e=v.useContext(Kv);if(!e)throw new Error("useConfirm must be used within DialogProvider");return e.confirm}function Pa(){const e=v.useContext(Kv);if(!e)throw new Error("useAlert must be used within DialogProvider");return e.alert}function FR({options:e,onConfirm:t,onCancel:n}){const r=v.useRef(null),s=v.useRef(null),i=e.variant==="destructive";return v.useEffect(()=>{var o,l;i?(o=r.current)==null||o.focus():(l=s.current)==null||l.focus()},[i]),v.useEffect(()=>{const o=l=>{l.key==="Escape"&&n()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[n]),a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[100]",onClick:n,children:a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg shadow-2xl w-full max-w-md mx-4 animate-fade-in",onClick:o=>o.stopPropagation(),role:"alertdialog","aria-modal":"true","aria-labelledby":"dialog-title","aria-describedby":"dialog-message",children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-divider",children:[i?a.jsx(tn,{className:"w-5 h-5 text-red-400 shrink-0"}):a.jsx(dk,{className:"w-5 h-5 text-blue-400 shrink-0"}),a.jsx("h3",{id:"dialog-title",className:"text-lg font-semibold text-content",children:e.title})]}),a.jsx("div",{className:"px-4 py-4",children:a.jsx("p",{id:"dialog-message",className:"text-sm text-content-body whitespace-pre-line",children:e.message})}),a.jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-divider",children:[a.jsx("button",{ref:r,onClick:n,className:"px-4 py-2 rounded text-sm bg-surface-overlay text-content-body hover:bg-surface-emphasis transition-colors",children:e.cancelLabel||"Cancel"}),a.jsx("button",{ref:s,onClick:t,className:`px-4 py-2 rounded text-sm font-medium transition-colors ${i?"bg-red-600 text-white hover:bg-red-700":"bg-blue-600 text-white hover:bg-blue-700"}`,children:e.confirmLabel||"Confirm"})]})]})})}function zR({options:e,onClose:t}){const n=v.useRef(null);v.useEffect(()=>{var i;(i=n.current)==null||i.focus()},[]),v.useEffect(()=>{const i=o=>{(o.key==="Escape"||o.key==="Enter")&&t()};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[t]);const r={info:a.jsx(dk,{className:"w-5 h-5 text-blue-400 shrink-0"}),error:a.jsx(bs,{className:"w-5 h-5 text-red-400 shrink-0"}),success:a.jsx(Yr,{className:"w-5 h-5 text-green-400 shrink-0"})},s=e.variant||"info";return a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[100]",onClick:t,children:a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg shadow-2xl w-full max-w-md mx-4 animate-fade-in",onClick:i=>i.stopPropagation(),role:"alertdialog","aria-modal":"true","aria-labelledby":"alert-title","aria-describedby":"alert-message",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-divider",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[r[s],a.jsx("h3",{id:"alert-title",className:"text-lg font-semibold text-content",children:e.title||(s==="error"?"Error":s==="success"?"Success":"Notice")})]}),a.jsx("button",{onClick:t,className:"text-content-subtle hover:text-content-body transition-colors",children:a.jsx(mt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"px-4 py-4",children:a.jsx("p",{id:"alert-message",className:"text-sm text-content-body whitespace-pre-line",children:e.message})}),a.jsx("div",{className:"flex items-center justify-end px-4 py-3 border-t border-divider",children:a.jsx("button",{ref:n,onClick:t,className:"px-4 py-2 rounded text-sm bg-blue-600 text-white hover:bg-blue-700 transition-colors font-medium",children:"OK"})})]})})}function $R({children:e}){const[t,n]=v.useState(null),r=v.useRef(null),s=v.useCallback(()=>{r.current&&(r.current.resolve(!1),r.current=null)},[]),i=v.useCallback(h=>(s(),new Promise(d=>{const p={type:"confirm",options:h,resolve:d};r.current=p,n(p)})),[s]),o=v.useCallback(h=>(s(),new Promise(d=>{const p={type:"alert",options:h,resolve:()=>d()};r.current=p,n(p)})),[s]),l=v.useCallback(()=>{t==null||t.resolve(!0),r.current=null,n(null)},[t]),c=v.useCallback(()=>{t==null||t.resolve(!1),r.current=null,n(null)},[t]),u=v.useCallback(()=>{t==null||t.resolve(!1),r.current=null,n(null)},[t]);return a.jsxs(Kv.Provider,{value:{confirm:i,alert:o},children:[e,(t==null?void 0:t.type)==="confirm"&&a.jsx(FR,{options:t.options,onConfirm:l,onCancel:c}),(t==null?void 0:t.type)==="alert"&&a.jsx(zR,{options:t.options,onClose:u})]})}const gh=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Da(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Vv(e){return"nodeType"in e}function gn(e){var t,n;return e?Da(e)?e:Vv(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Yv(e){const{Document:t}=gn(e);return e instanceof t}function Nc(e){return Da(e)?!1:e instanceof gn(e).HTMLElement}function yk(e){return e instanceof gn(e).SVGElement}function Ma(e){return e?Da(e)?e.document:Vv(e)?Yv(e)?e:Nc(e)||yk(e)?e.ownerDocument:document:document:document}const ws=gh?v.useLayoutEffect:v.useEffect;function vh(e){const t=v.useRef(e);return ws(()=>{t.current=e}),v.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function HR(){const e=v.useRef(null),t=v.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=v.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function rc(e,t){t===void 0&&(t=[e]);const n=v.useRef(e);return ws(()=>{n.current!==e&&(n.current=e)},t),n}function jc(e,t){const n=v.useRef();return v.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Ld(e){const t=vh(e),n=v.useRef(null),r=v.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function Ad(e){const t=v.useRef();return v.useEffect(()=>{t.current=e},[e]),t.current}let vf={};function xh(e,t){return v.useMemo(()=>{if(t)return t;const n=vf[e]==null?0:vf[e]+1;return vf[e]=n,e+"-"+n},[e,t])}function _k(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((i,o)=>{const l=Object.entries(o);for(const[c,u]of l){const h=i[c];h!=null&&(i[c]=h+e*u)}return i},{...t})}}const Zo=_k(1),Od=_k(-1);function WR(e){return"clientX"in e&&"clientY"in e}function Qv(e){if(!e)return!1;const{KeyboardEvent:t}=gn(e.target);return t&&e instanceof t}function UR(e){if(!e)return!1;const{TouchEvent:t}=gn(e.target);return t&&e instanceof t}function Id(e){if(UR(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return WR(e)?{x:e.clientX,y:e.clientY}:null}const sc=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[sc.Translate.toString(e),sc.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),x0="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function qR(e){return e.matches(x0)?e:e.querySelector(x0)}const KR={display:"none"};function VR(e){let{id:t,value:n}=e;return Ke.createElement("div",{id:t,style:KR},n)}function YR(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Ke.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function QR(){const[e,t]=v.useState("");return{announce:v.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const bk=v.createContext(null);function XR(e){const t=v.useContext(bk);v.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function GR(){const[e]=v.useState(()=>new Set),t=v.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[v.useCallback(r=>{let{type:s,event:i}=r;e.forEach(o=>{var l;return(l=o[s])==null?void 0:l.call(o,i)})},[e]),t]}const JR={draggable:`
441
- To pick up a draggable item, press the space bar.
442
- While dragging, use the arrow keys to move the item.
443
- Press space again to drop the item in its new position, or press escape to cancel.
444
- `},ZR={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function e3(e){let{announcements:t=ZR,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=JR}=e;const{announce:i,announcement:o}=QR(),l=xh("DndLiveRegion"),[c,u]=v.useState(!1);if(v.useEffect(()=>{u(!0)},[]),XR(v.useMemo(()=>({onDragStart(d){let{active:p}=d;i(t.onDragStart({active:p}))},onDragMove(d){let{active:p,over:f}=d;t.onDragMove&&i(t.onDragMove({active:p,over:f}))},onDragOver(d){let{active:p,over:f}=d;i(t.onDragOver({active:p,over:f}))},onDragEnd(d){let{active:p,over:f}=d;i(t.onDragEnd({active:p,over:f}))},onDragCancel(d){let{active:p,over:f}=d;i(t.onDragCancel({active:p,over:f}))}}),[i,t])),!c)return null;const h=Ke.createElement(Ke.Fragment,null,Ke.createElement(VR,{id:r,value:s.draggable}),Ke.createElement(YR,{id:l,announcement:o}));return n?ar.createPortal(h,n):h}var wt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(wt||(wt={}));function Bd(){}function y0(e,t){return v.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function t3(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return v.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const jr=Object.freeze({x:0,y:0});function n3(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function r3(e,t){const n=Id(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function s3(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function i3(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function _0(e){let{left:t,top:n,height:r,width:s}=e;return[{x:t,y:n},{x:t+s,y:n},{x:t,y:n+r},{x:t+s,y:n+r}]}function o3(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}const a3=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=_0(t),i=[];for(const o of r){const{id:l}=o,c=n.get(l);if(c){const u=_0(c),h=s.reduce((p,f,m)=>p+n3(u[m],f),0),d=Number((h/4).toFixed(4));i.push({id:l,data:{droppableContainer:o,value:d}})}}return i.sort(s3)};function l3(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=s-r,l=i-n;if(r<s&&n<i){const c=t.width*t.height,u=e.width*e.height,h=o*l,d=h/(c+u-h);return Number(d.toFixed(4))}return 0}const c3=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=[];for(const i of r){const{id:o}=i,l=n.get(o);if(l){const c=l3(l,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort(i3)};function u3(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function wk(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:jr}function d3(e){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];return s.reduce((o,l)=>({...o,top:o.top+e*l.y,bottom:o.bottom+e*l.y,left:o.left+e*l.x,right:o.right+e*l.x}),{...n})}}const h3=d3(1);function Sk(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function f3(e,t,n){const r=Sk(t);if(!r)return e;const{scaleX:s,scaleY:i,x:o,y:l}=r,c=e.left-o-(1-s)*parseFloat(n),u=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),h=s?e.width/s:e.width,d=i?e.height/i:e.height;return{width:h,height:d,top:u,right:c+h,bottom:u+d,left:c}}const p3={ignoreTransform:!1};function Ec(e,t){t===void 0&&(t=p3);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:h}=gn(e).getComputedStyle(e);u&&(n=f3(n,u,h))}const{top:r,left:s,width:i,height:o,bottom:l,right:c}=n;return{top:r,left:s,width:i,height:o,bottom:l,right:c}}function b0(e){return Ec(e,{ignoreTransform:!0})}function m3(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function g3(e,t){return t===void 0&&(t=gn(e).getComputedStyle(e)),t.position==="fixed"}function v3(e,t){t===void 0&&(t=gn(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=t[s];return typeof i=="string"?n.test(i):!1})}function Xv(e,t){const n=[];function r(s){if(t!=null&&n.length>=t||!s)return n;if(Yv(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!Nc(s)||yk(s)||n.includes(s))return n;const i=gn(e).getComputedStyle(s);return s!==e&&v3(s,i)&&n.push(s),g3(s,i)?n:r(s.parentNode)}return e?r(e):n}function kk(e){const[t]=Xv(e,1);return t??null}function xf(e){return!gh||!e?null:Da(e)?e:Vv(e)?Yv(e)||e===Ma(e).scrollingElement?window:Nc(e)?e:null:null}function Ck(e){return Da(e)?e.scrollX:e.scrollLeft}function Nk(e){return Da(e)?e.scrollY:e.scrollTop}function Em(e){return{x:Ck(e),y:Nk(e)}}var Dt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Dt||(Dt={}));function jk(e){return!gh||!e?!1:e===document.scrollingElement}function Ek(e){const t={x:0,y:0},n=jk(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},s=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,o=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:s,isLeft:i,isBottom:o,isRight:l,maxScroll:r,minScroll:t}}const x3={x:.2,y:.2};function y3(e,t,n,r,s){let{top:i,left:o,right:l,bottom:c}=n;r===void 0&&(r=10),s===void 0&&(s=x3);const{isTop:u,isBottom:h,isLeft:d,isRight:p}=Ek(e),f={x:0,y:0},m={x:0,y:0},g={height:t.height*s.y,width:t.width*s.x};return!u&&i<=t.top+g.height?(f.y=Dt.Backward,m.y=r*Math.abs((t.top+g.height-i)/g.height)):!h&&c>=t.bottom-g.height&&(f.y=Dt.Forward,m.y=r*Math.abs((t.bottom-g.height-c)/g.height)),!p&&l>=t.right-g.width?(f.x=Dt.Forward,m.x=r*Math.abs((t.right-g.width-l)/g.width)):!d&&o<=t.left+g.width&&(f.x=Dt.Backward,m.x=r*Math.abs((t.left+g.width-o)/g.width)),{direction:f,speed:m}}function _3(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}const{top:t,left:n,right:r,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function Rk(e){return e.reduce((t,n)=>Zo(t,Em(n)),jr)}function b3(e){return e.reduce((t,n)=>t+Ck(n),0)}function w3(e){return e.reduce((t,n)=>t+Nk(n),0)}function Tk(e,t){if(t===void 0&&(t=Ec),!e)return;const{top:n,left:r,bottom:s,right:i}=t(e);kk(e)&&(s<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const S3=[["x",["left","right"],b3],["y",["top","bottom"],w3]];class Gv{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Xv(n),s=Rk(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,l]of S3)for(const c of o)Object.defineProperty(this,c,{get:()=>{const u=l(r),h=s[i]-u;return this.rect[c]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Rl{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var s;(s=this.target)==null||s.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function k3(e){const{EventTarget:t}=gn(e);return e instanceof t?e:Ma(e)}function yf(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var er;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(er||(er={}));function w0(e){e.preventDefault()}function C3(e){e.stopPropagation()}var Be;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Be||(Be={}));const Pk={start:[Be.Space,Be.Enter],cancel:[Be.Esc],end:[Be.Space,Be.Enter,Be.Tab]},N3=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Be.Right:return{...n,x:n.x+25};case Be.Left:return{...n,x:n.x-25};case Be.Down:return{...n,y:n.y+25};case Be.Up:return{...n,y:n.y-25}}};class Jv{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Rl(Ma(n)),this.windowListeners=new Rl(gn(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(er.Resize,this.handleCancel),this.windowListeners.add(er.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(er.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Tk(r),n(jr)}handleKeyDown(t){if(Qv(t)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:i=Pk,coordinateGetter:o=N3,scrollBehavior:l="smooth"}=s,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=r.current,h=u?{x:u.left,y:u.top}:jr;this.referenceCoordinates||(this.referenceCoordinates=h);const d=o(t,{active:n,context:r.current,currentCoordinates:h});if(d){const p=Od(d,h),f={x:0,y:0},{scrollableAncestors:m}=r.current;for(const g of m){const b=t.code,{isTop:x,isRight:y,isLeft:_,isBottom:w,maxScroll:C,minScroll:S}=Ek(g),R=_3(g),T={x:Math.min(b===Be.Right?R.right-R.width/2:R.right,Math.max(b===Be.Right?R.left:R.left+R.width/2,d.x)),y:Math.min(b===Be.Down?R.bottom-R.height/2:R.bottom,Math.max(b===Be.Down?R.top:R.top+R.height/2,d.y))},F=b===Be.Right&&!y||b===Be.Left&&!_,P=b===Be.Down&&!w||b===Be.Up&&!x;if(F&&T.x!==d.x){const I=g.scrollLeft+p.x,A=b===Be.Right&&I<=C.x||b===Be.Left&&I>=S.x;if(A&&!p.y){g.scrollTo({left:I,behavior:l});return}A?f.x=g.scrollLeft-I:f.x=b===Be.Right?g.scrollLeft-C.x:g.scrollLeft-S.x,f.x&&g.scrollBy({left:-f.x,behavior:l});break}else if(P&&T.y!==d.y){const I=g.scrollTop+p.y,A=b===Be.Down&&I<=C.y||b===Be.Up&&I>=S.y;if(A&&!p.x){g.scrollTo({top:I,behavior:l});return}A?f.y=g.scrollTop-I:f.y=b===Be.Down?g.scrollTop-C.y:g.scrollTop-S.y,f.y&&g.scrollBy({top:-f.y,behavior:l});break}}this.handleMove(t,Zo(Od(d,this.referenceCoordinates),f))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Jv.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Pk,onActivation:s}=t,{active:i}=n;const{code:o}=e.nativeEvent;if(r.start.includes(o)){const l=i.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function S0(e){return!!(e&&"distance"in e)}function k0(e){return!!(e&&"delay"in e)}class Zv{constructor(t,n,r){var s;r===void 0&&(r=k3(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:o}=i;this.props=t,this.events=n,this.document=Ma(o),this.documentListeners=new Rl(this.document),this.listeners=new Rl(r),this.windowListeners=new Rl(gn(o)),this.initialCoordinates=(s=Id(i))!=null?s:jr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(er.Resize,this.handleCancel),this.windowListeners.add(er.DragStart,w0),this.windowListeners.add(er.VisibilityChange,this.handleCancel),this.windowListeners.add(er.ContextMenu,w0),this.documentListeners.add(er.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(k0(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(S0(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:s}=this.props;s(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(er.Click,C3,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(er.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:l}}=i;if(!s)return;const c=(n=Id(t))!=null?n:jr,u=Od(s,c);if(!r&&l){if(S0(l)){if(l.tolerance!=null&&yf(u,l.tolerance))return this.handleCancel();if(yf(u,l.distance))return this.handleStart()}if(k0(l)&&yf(u,l.tolerance))return this.handleCancel();this.handlePending(l,u);return}t.cancelable&&t.preventDefault(),o(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Be.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const j3={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ex extends Zv{constructor(t){const{event:n}=t,r=Ma(n.target);super(t,j3,r)}}ex.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const E3={move:{name:"mousemove"},end:{name:"mouseup"}};var Rm;(function(e){e[e.RightClick=2]="RightClick"})(Rm||(Rm={}));class R3 extends Zv{constructor(t){super(t,E3,Ma(t.event.target))}}R3.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Rm.RightClick?!1:(r==null||r({event:n}),!0)}}];const _f={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class T3 extends Zv{constructor(t){super(t,_f)}static setup(){return window.addEventListener(_f.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(_f.move.name,t)};function t(){}}}T3.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:s}=n;return s.length>1?!1:(r==null||r({event:n}),!0)}}];var Tl;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Tl||(Tl={}));var Fd;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Fd||(Fd={}));function P3(e){let{acceleration:t,activator:n=Tl.Pointer,canScroll:r,draggingRect:s,enabled:i,interval:o=5,order:l=Fd.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:h,delta:d,threshold:p}=e;const f=M3({delta:d,disabled:!i}),[m,g]=HR(),b=v.useRef({x:0,y:0}),x=v.useRef({x:0,y:0}),y=v.useMemo(()=>{switch(n){case Tl.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Tl.DraggableRect:return s}},[n,s,c]),_=v.useRef(null),w=v.useCallback(()=>{const S=_.current;if(!S)return;const R=b.current.x*x.current.x,T=b.current.y*x.current.y;S.scrollBy(R,T)},[]),C=v.useMemo(()=>l===Fd.TreeOrder?[...u].reverse():u,[l,u]);v.useEffect(()=>{if(!i||!u.length||!y){g();return}for(const S of C){if((r==null?void 0:r(S))===!1)continue;const R=u.indexOf(S),T=h[R];if(!T)continue;const{direction:F,speed:P}=y3(S,T,y,t,p);for(const I of["x","y"])f[I][F[I]]||(P[I]=0,F[I]=0);if(P.x>0||P.y>0){g(),_.current=S,m(w,o),b.current=P,x.current=F;return}}b.current={x:0,y:0},x.current={x:0,y:0},g()},[t,w,r,g,i,o,JSON.stringify(y),JSON.stringify(f),m,u,C,h,JSON.stringify(p)])}const D3={x:{[Dt.Backward]:!1,[Dt.Forward]:!1},y:{[Dt.Backward]:!1,[Dt.Forward]:!1}};function M3(e){let{delta:t,disabled:n}=e;const r=Ad(t);return jc(s=>{if(n||!r||!s)return D3;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Dt.Backward]:s.x[Dt.Backward]||i.x===-1,[Dt.Forward]:s.x[Dt.Forward]||i.x===1},y:{[Dt.Backward]:s.y[Dt.Backward]||i.y===-1,[Dt.Forward]:s.y[Dt.Forward]||i.y===1}}},[n,t,r])}function L3(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return jc(s=>{var i;return t==null?null:(i=r??s)!=null?i:null},[r,t])}function A3(e,t){return v.useMemo(()=>e.reduce((n,r)=>{const{sensor:s}=r,i=s.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,r)}));return[...n,...i]},[]),[e,t])}var ic;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ic||(ic={}));var Tm;(function(e){e.Optimized="optimized"})(Tm||(Tm={}));const C0=new Map;function O3(e,t){let{dragging:n,dependencies:r,config:s}=t;const[i,o]=v.useState(null),{frequency:l,measure:c,strategy:u}=s,h=v.useRef(e),d=b(),p=rc(d),f=v.useCallback(function(x){x===void 0&&(x=[]),!p.current&&o(y=>y===null?x:y.concat(x.filter(_=>!y.includes(_))))},[p]),m=v.useRef(null),g=jc(x=>{if(d&&!n)return C0;if(!x||x===C0||h.current!==e||i!=null){const y=new Map;for(let _ of e){if(!_)continue;if(i&&i.length>0&&!i.includes(_.id)&&_.rect.current){y.set(_.id,_.rect.current);continue}const w=_.node.current,C=w?new Gv(c(w),w):null;_.rect.current=C,C&&y.set(_.id,C)}return y}return x},[e,i,n,d,c]);return v.useEffect(()=>{h.current=e},[e]),v.useEffect(()=>{d||f()},[n,d]),v.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),v.useEffect(()=>{d||typeof l!="number"||m.current!==null||(m.current=setTimeout(()=>{f(),m.current=null},l))},[l,d,f,...r]),{droppableRects:g,measureDroppableContainers:f,measuringScheduled:i!=null};function b(){switch(u){case ic.Always:return!1;case ic.BeforeDragging:return n;default:return!n}}}function tx(e,t){return jc(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function I3(e,t){return tx(e,t)}function B3(e){let{callback:t,disabled:n}=e;const r=vh(t),s=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return v.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function yh(e){let{callback:t,disabled:n}=e;const r=vh(t),s=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return v.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function F3(e){return new Gv(Ec(e),e)}function N0(e,t,n){t===void 0&&(t=F3);const[r,s]=v.useState(null);function i(){s(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??n)!=null?u:null}const h=t(e);return JSON.stringify(c)===JSON.stringify(h)?c:h})}const o=B3({callback(c){if(e)for(const u of c){const{type:h,target:d}=u;if(h==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),l=yh({callback:i});return ws(()=>{i(),e?(l==null||l.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),o==null||o.disconnect())},[e]),r}function z3(e){const t=tx(e);return wk(e,t)}const j0=[];function $3(e){const t=v.useRef(e),n=jc(r=>e?r&&r!==j0&&e&&t.current&&e.parentNode===t.current.parentNode?r:Xv(e):j0,[e]);return v.useEffect(()=>{t.current=e},[e]),n}function H3(e){const[t,n]=v.useState(null),r=v.useRef(e),s=v.useCallback(i=>{const o=xf(i.target);o&&n(l=>l?(l.set(o,Em(o)),new Map(l)):null)},[]);return v.useEffect(()=>{const i=r.current;if(e!==i){o(i);const l=e.map(c=>{const u=xf(c);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,Em(u)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=e}return()=>{o(e),o(i)};function o(l){l.forEach(c=>{const u=xf(c);u==null||u.removeEventListener("scroll",s)})}},[s,e]),v.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>Zo(i,o),jr):Rk(e):jr,[e,t])}function E0(e,t){t===void 0&&(t=[]);const n=v.useRef(null);return v.useEffect(()=>{n.current=null},t),v.useEffect(()=>{const r=e!==jr;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Od(e,n.current):jr}function W3(e){v.useEffect(()=>{if(!gh)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function U3(e,t){return v.useMemo(()=>e.reduce((n,r)=>{let{eventName:s,handler:i}=r;return n[s]=o=>{i(o,t)},n},{}),[e,t])}function Dk(e){return v.useMemo(()=>e?m3(e):null,[e])}const R0=[];function q3(e,t){t===void 0&&(t=Ec);const[n]=e,r=Dk(n?gn(n):null),[s,i]=v.useState(R0);function o(){i(()=>e.length?e.map(c=>jk(c)?r:new Gv(t(c),c)):R0)}const l=yh({callback:o});return ws(()=>{l==null||l.disconnect(),o(),e.forEach(c=>l==null?void 0:l.observe(c))},[e]),s}function Mk(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Nc(t)?t:e}function K3(e){let{measure:t}=e;const[n,r]=v.useState(null),s=v.useCallback(u=>{for(const{target:h}of u)if(Nc(h)){r(d=>{const p=t(h);return d?{...d,width:p.width,height:p.height}:p});break}},[t]),i=yh({callback:s}),o=v.useCallback(u=>{const h=Mk(u);i==null||i.disconnect(),h&&(i==null||i.observe(h)),r(h?t(h):null)},[t,i]),[l,c]=Ld(o);return v.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const V3=[{sensor:ex,options:{}},{sensor:Jv,options:{}}],Y3={current:{}},qu={draggable:{measure:b0},droppable:{measure:b0,strategy:ic.WhileDragging,frequency:Tm.Optimized},dragOverlay:{measure:Ec}};class Pl extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Q3={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Pl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Bd},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:qu,measureDroppableContainers:Bd,windowRect:null,measuringScheduled:!1},Lk={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Bd,draggableNodes:new Map,over:null,measureDroppableContainers:Bd},Rc=v.createContext(Lk),Ak=v.createContext(Q3);function X3(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Pl}}}function G3(e,t){switch(t.type){case wt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case wt.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case wt.DragEnd:case wt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case wt.RegisterDroppable:{const{element:n}=t,{id:r}=n,s=new Pl(e.droppable.containers);return s.set(r,n),{...e,droppable:{...e.droppable,containers:s}}}case wt.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Pl(e.droppable.containers);return o.set(n,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case wt.UnregisterDroppable:{const{id:n,key:r}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const i=new Pl(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function J3(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:s}=v.useContext(Rc),i=Ad(r),o=Ad(n==null?void 0:n.id);return v.useEffect(()=>{if(!t&&!r&&i&&o!=null){if(!Qv(i)||document.activeElement===i.target)return;const l=s.get(o);if(!l)return;const{activatorNode:c,node:u}=l;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const h of[c.current,u.current]){if(!h)continue;const d=qR(h);if(d){d.focus();break}}})}},[r,t,s,o,i]),null}function Ok(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...r}),n):n}function Z3(e){return v.useMemo(()=>({draggable:{...qu.draggable,...e==null?void 0:e.draggable},droppable:{...qu.droppable,...e==null?void 0:e.droppable},dragOverlay:{...qu.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function e5(e){let{activeNode:t,measure:n,initialRect:r,config:s=!0}=e;const i=v.useRef(!1),{x:o,y:l}=typeof s=="boolean"?{x:s,y:s}:s;ws(()=>{if(!o&&!l||!t){i.current=!1;return}if(i.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const h=n(u),d=wk(h,r);if(o||(d.x=0),l||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const p=kk(u);p&&p.scrollBy({top:d.y,left:d.x})}},[t,o,l,r,n])}const _h=v.createContext({...jr,scaleX:1,scaleY:1});var Hs;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Hs||(Hs={}));const t5=v.memo(function(t){var n,r,s,i;let{id:o,accessibility:l,autoScroll:c=!0,children:u,sensors:h=V3,collisionDetection:d=c3,measuring:p,modifiers:f,...m}=t;const g=v.useReducer(G3,void 0,X3),[b,x]=g,[y,_]=GR(),[w,C]=v.useState(Hs.Uninitialized),S=w===Hs.Initialized,{draggable:{active:R,nodes:T,translate:F},droppable:{containers:P}}=b,I=R!=null?T.get(R):null,A=v.useRef({initial:null,translated:null}),M=v.useMemo(()=>{var De;return R!=null?{id:R,data:(De=I==null?void 0:I.data)!=null?De:Y3,rect:A}:null},[R,I]),j=v.useRef(null),[E,$]=v.useState(null),[q,D]=v.useState(null),H=rc(m,Object.values(m)),N=xh("DndDescribedBy",o),B=v.useMemo(()=>P.getEnabled(),[P]),O=Z3(p),{droppableRects:k,measureDroppableContainers:W,measuringScheduled:Q}=O3(B,{dragging:S,dependencies:[F.x,F.y],config:O.droppable}),z=L3(T,R),X=v.useMemo(()=>q?Id(q):null,[q]),re=ae(),ie=I3(z,O.draggable.measure);e5({activeNode:R!=null?T.get(R):null,config:re.layoutShiftCompensation,initialRect:ie,measure:O.draggable.measure});const de=N0(z,O.draggable.measure,ie),qe=N0(z?z.parentElement:null),Se=v.useRef({activatorEvent:null,active:null,activeNode:z,collisionRect:null,collisions:null,droppableRects:k,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),he=P.getNodeFor((n=Se.current.over)==null?void 0:n.id),Nt=K3({measure:O.dragOverlay.measure}),yn=(r=Nt.nodeRef.current)!=null?r:z,te=S?(s=Nt.rect)!=null?s:de:null,fe=!!(Nt.nodeRef.current&&Nt.rect),Re=z3(fe?null:de),tt=Dk(yn?gn(yn):null),Ae=$3(S?he??z:null),jt=q3(Ae),Kt=Ok(f,{transform:{x:F.x-Re.x,y:F.y-Re.y,scaleX:1,scaleY:1},activatorEvent:q,active:M,activeNodeRect:de,containerNodeRect:qe,draggingNodeRect:te,over:Se.current.over,overlayNodeRect:Nt.rect,scrollableAncestors:Ae,scrollableAncestorRects:jt,windowRect:tt}),Ln=X?Zo(X,F):null,Es=H3(Ae),hr=E0(Es),K=E0(Es,[de]),Z=Zo(Kt,hr),pe=te?h3(te,Kt):null,ve=M&&pe?d({active:M,collisionRect:pe,droppableRects:k,droppableContainers:B,pointerCoordinates:Ln}):null,Ee=o3(ve,"id"),[nt,_n]=v.useState(null),bn=fe?Kt:Zo(Kt,K),Rr=u3(bn,(i=nt==null?void 0:nt.rect)!=null?i:null,de),Qn=v.useRef(null),vt=v.useCallback((De,Qe)=>{let{sensor:Et,options:An}=Qe;if(j.current==null)return;const Vt=T.get(j.current);if(!Vt)return;const Bt=De.nativeEvent,On=new Et({active:j.current,activeNode:Vt,event:Bt,options:An,context:Se,onAbort(Ft){if(!T.get(Ft))return;const{onDragAbort:Tr}=H.current,ts={id:Ft};Tr==null||Tr(ts),y({type:"onDragAbort",event:ts})},onPending(Ft,Rs,Tr,ts){if(!T.get(Ft))return;const{onDragPending:za}=H.current,Ts={id:Ft,constraint:Rs,initialCoordinates:Tr,offset:ts};za==null||za(Ts),y({type:"onDragPending",event:Ts})},onStart(Ft){const Rs=j.current;if(Rs==null)return;const Tr=T.get(Rs);if(!Tr)return;const{onDragStart:ts}=H.current,Fa={activatorEvent:Bt,active:{id:Rs,data:Tr.data,rect:A}};ar.unstable_batchedUpdates(()=>{ts==null||ts(Fa),C(Hs.Initializing),x({type:wt.DragStart,initialCoordinates:Ft,active:Rs}),y({type:"onDragStart",event:Fa}),$(Qn.current),D(Bt)})},onMove(Ft){x({type:wt.DragMove,coordinates:Ft})},onEnd:bo(wt.DragEnd),onCancel:bo(wt.DragCancel)});Qn.current=On;function bo(Ft){return async function(){const{active:Tr,collisions:ts,over:Fa,scrollAdjustedTranslate:za}=Se.current;let Ts=null;if(Tr&&za){const{cancelDrop:$a}=H.current;Ts={activatorEvent:Bt,active:Tr,collisions:ts,delta:za,over:Fa},Ft===wt.DragEnd&&typeof $a=="function"&&await Promise.resolve($a(Ts))&&(Ft=wt.DragCancel)}j.current=null,ar.unstable_batchedUpdates(()=>{x({type:Ft}),C(Hs.Uninitialized),_n(null),$(null),D(null),Qn.current=null;const $a=Ft===wt.DragEnd?"onDragEnd":"onDragCancel";if(Ts){const Hh=H.current[$a];Hh==null||Hh(Ts),y({type:$a,event:Ts})}})}}},[T]),fr=v.useCallback((De,Qe)=>(Et,An)=>{const Vt=Et.nativeEvent,Bt=T.get(An);if(j.current!==null||!Bt||Vt.dndKit||Vt.defaultPrevented)return;const On={active:Bt};De(Et,Qe.options,On)===!0&&(Vt.dndKit={capturedBy:Qe.sensor},j.current=An,vt(Et,Qe))},[T,vt]),on=A3(h,fr);W3(h),ws(()=>{de&&w===Hs.Initializing&&C(Hs.Initialized)},[de,w]),v.useEffect(()=>{const{onDragMove:De}=H.current,{active:Qe,activatorEvent:Et,collisions:An,over:Vt}=Se.current;if(!Qe||!Et)return;const Bt={active:Qe,activatorEvent:Et,collisions:An,delta:{x:Z.x,y:Z.y},over:Vt};ar.unstable_batchedUpdates(()=>{De==null||De(Bt),y({type:"onDragMove",event:Bt})})},[Z.x,Z.y]),v.useEffect(()=>{const{active:De,activatorEvent:Qe,collisions:Et,droppableContainers:An,scrollAdjustedTranslate:Vt}=Se.current;if(!De||j.current==null||!Qe||!Vt)return;const{onDragOver:Bt}=H.current,On=An.get(Ee),bo=On&&On.rect.current?{id:On.id,rect:On.rect.current,data:On.data,disabled:On.disabled}:null,Ft={active:De,activatorEvent:Qe,collisions:Et,delta:{x:Vt.x,y:Vt.y},over:bo};ar.unstable_batchedUpdates(()=>{_n(bo),Bt==null||Bt(Ft),y({type:"onDragOver",event:Ft})})},[Ee]),ws(()=>{Se.current={activatorEvent:q,active:M,activeNode:z,collisionRect:pe,collisions:ve,droppableRects:k,draggableNodes:T,draggingNode:yn,draggingNodeRect:te,droppableContainers:P,over:nt,scrollableAncestors:Ae,scrollAdjustedTranslate:Z},A.current={initial:te,translated:pe}},[M,z,ve,pe,T,yn,te,k,P,nt,Ae,Z]),P3({...re,delta:F,draggingRect:pe,pointerCoordinates:Ln,scrollableAncestors:Ae,scrollableAncestorRects:jt});const zc=v.useMemo(()=>({active:M,activeNode:z,activeNodeRect:de,activatorEvent:q,collisions:ve,containerNodeRect:qe,dragOverlay:Nt,draggableNodes:T,droppableContainers:P,droppableRects:k,over:nt,measureDroppableContainers:W,scrollableAncestors:Ae,scrollableAncestorRects:jt,measuringConfiguration:O,measuringScheduled:Q,windowRect:tt}),[M,z,de,q,ve,qe,Nt,T,P,k,nt,W,Ae,jt,O,Q,tt]),V=v.useMemo(()=>({activatorEvent:q,activators:on,active:M,activeNodeRect:de,ariaDescribedById:{draggable:N},dispatch:x,draggableNodes:T,over:nt,measureDroppableContainers:W}),[q,on,M,de,x,N,T,nt,W]);return Ke.createElement(bk.Provider,{value:_},Ke.createElement(Rc.Provider,{value:V},Ke.createElement(Ak.Provider,{value:zc},Ke.createElement(_h.Provider,{value:Rr},u)),Ke.createElement(J3,{disabled:(l==null?void 0:l.restoreFocus)===!1})),Ke.createElement(e3,{...l,hiddenTextDescribedById:N}));function ae(){const De=(E==null?void 0:E.autoScrollEnabled)===!1,Qe=typeof c=="object"?c.enabled===!1:c===!1,Et=S&&!De&&!Qe;return typeof c=="object"?{...c,enabled:Et}:{enabled:Et}}}),n5=v.createContext(null),T0="button",r5="Draggable";function s5(e){let{id:t,data:n,disabled:r=!1,attributes:s}=e;const i=xh(r5),{activators:o,activatorEvent:l,active:c,activeNodeRect:u,ariaDescribedById:h,draggableNodes:d,over:p}=v.useContext(Rc),{role:f=T0,roleDescription:m="draggable",tabIndex:g=0}=s??{},b=(c==null?void 0:c.id)===t,x=v.useContext(b?_h:n5),[y,_]=Ld(),[w,C]=Ld(),S=U3(o,t),R=rc(n);ws(()=>(d.set(t,{id:t,key:i,node:y,activatorNode:w,data:R}),()=>{const F=d.get(t);F&&F.key===i&&d.delete(t)}),[d,t]);const T=v.useMemo(()=>({role:f,tabIndex:g,"aria-disabled":r,"aria-pressed":b&&f===T0?!0:void 0,"aria-roledescription":m,"aria-describedby":h.draggable}),[r,f,g,b,m,h.draggable]);return{active:c,activatorEvent:l,activeNodeRect:u,attributes:T,isDragging:b,listeners:r?void 0:S,node:y,over:p,setNodeRef:_,setActivatorNodeRef:C,transform:x}}function i5(){return v.useContext(Ak)}const o5="Droppable",a5={timeout:25};function l5(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:s}=e;const i=xh(o5),{active:o,dispatch:l,over:c,measureDroppableContainers:u}=v.useContext(Rc),h=v.useRef({disabled:n}),d=v.useRef(!1),p=v.useRef(null),f=v.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:b}={...a5,...s},x=rc(g??r),y=v.useCallback(()=>{if(!d.current){d.current=!0;return}f.current!=null&&clearTimeout(f.current),f.current=setTimeout(()=>{u(Array.isArray(x.current)?x.current:[x.current]),f.current=null},b)},[b]),_=yh({callback:y,disabled:m||!o}),w=v.useCallback((T,F)=>{_&&(F&&(_.unobserve(F),d.current=!1),T&&_.observe(T))},[_]),[C,S]=Ld(w),R=rc(t);return v.useEffect(()=>{!_||!C.current||(_.disconnect(),d.current=!1,_.observe(C.current))},[C,_]),v.useEffect(()=>(l({type:wt.RegisterDroppable,element:{id:r,key:i,disabled:n,node:C,rect:p,data:R}}),()=>l({type:wt.UnregisterDroppable,key:i,id:r})),[r]),v.useEffect(()=>{n!==h.current.disabled&&(l({type:wt.SetDroppableDisabled,id:r,key:i,disabled:n}),h.current.disabled=n)},[r,i,n,l]),{active:o,rect:p,isOver:(c==null?void 0:c.id)===r,node:C,over:c,setNodeRef:S}}function c5(e){let{animation:t,children:n}=e;const[r,s]=v.useState(null),[i,o]=v.useState(null),l=Ad(n);return!n&&!r&&l&&s(l),ws(()=>{if(!i)return;const c=r==null?void 0:r.key,u=r==null?void 0:r.props.id;if(c==null||u==null){s(null);return}Promise.resolve(t(u,i)).then(()=>{s(null)})},[t,r,i]),Ke.createElement(Ke.Fragment,null,n,r?v.cloneElement(r,{ref:o}):null)}const u5={x:0,y:0,scaleX:1,scaleY:1};function d5(e){let{children:t}=e;return Ke.createElement(Rc.Provider,{value:Lk},Ke.createElement(_h.Provider,{value:u5},t))}const h5={position:"fixed",touchAction:"none"},f5=e=>Qv(e)?"transform 250ms ease":void 0,p5=v.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:s,children:i,className:o,rect:l,style:c,transform:u,transition:h=f5}=e;if(!l)return null;const d=s?u:{...u,scaleX:1,scaleY:1},p={...h5,width:l.width,height:l.height,top:l.top,left:l.left,transform:sc.Transform.toString(d),transformOrigin:s&&r?r3(r,l):void 0,transition:typeof h=="function"?h(r):h,...c};return Ke.createElement(n,{className:o,style:p,ref:t},i)}),Ik=e=>t=>{let{active:n,dragOverlay:r}=t;const s={},{styles:i,className:o}=e;if(i!=null&&i.active)for(const[l,c]of Object.entries(i.active))c!==void 0&&(s[l]=n.node.style.getPropertyValue(l),n.node.style.setProperty(l,c));if(i!=null&&i.dragOverlay)for(const[l,c]of Object.entries(i.dragOverlay))c!==void 0&&r.node.style.setProperty(l,c);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(const[c,u]of Object.entries(s))n.node.style.setProperty(c,u);o!=null&&o.active&&n.node.classList.remove(o.active)}},m5=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:sc.Transform.toString(t)},{transform:sc.Transform.toString(n)}]},g5={duration:250,easing:"ease",keyframes:m5,sideEffects:Ik({styles:{active:{opacity:"0"}}})};function v5(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:s}=e;return vh((i,o)=>{if(t===null)return;const l=n.get(i);if(!l)return;const c=l.node.current;if(!c)return;const u=Mk(o);if(!u)return;const{transform:h}=gn(o).getComputedStyle(o),d=Sk(h);if(!d)return;const p=typeof t=="function"?t:x5(t);return Tk(c,s.draggable.measure),p({active:{id:i,data:l.data,node:c,rect:s.draggable.measure(c)},draggableNodes:n,dragOverlay:{node:o,rect:s.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:s,transform:d})})}function x5(e){const{duration:t,easing:n,sideEffects:r,keyframes:s}={...g5,...e};return i=>{let{active:o,dragOverlay:l,transform:c,...u}=i;if(!t)return;const h={x:l.rect.left-o.rect.left,y:l.rect.top-o.rect.top},d={scaleX:c.scaleX!==1?o.rect.width*c.scaleX/l.rect.width:1,scaleY:c.scaleY!==1?o.rect.height*c.scaleY/l.rect.height:1},p={x:c.x-h.x,y:c.y-h.y,...d},f=s({...u,active:o,dragOverlay:l,transform:{initial:c,final:p}}),[m]=f,g=f[f.length-1];if(JSON.stringify(m)===JSON.stringify(g))return;const b=r==null?void 0:r({active:o,dragOverlay:l,...u}),x=l.node.animate(f,{duration:t,easing:n,fill:"forwards"});return new Promise(y=>{x.onfinish=()=>{b==null||b(),y()}})}}let P0=0;function y5(e){return v.useMemo(()=>{if(e!=null)return P0++,P0},[e])}const _5=Ke.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:s,transition:i,modifiers:o,wrapperElement:l="div",className:c,zIndex:u=999}=e;const{activatorEvent:h,active:d,activeNodeRect:p,containerNodeRect:f,draggableNodes:m,droppableContainers:g,dragOverlay:b,over:x,measuringConfiguration:y,scrollableAncestors:_,scrollableAncestorRects:w,windowRect:C}=i5(),S=v.useContext(_h),R=y5(d==null?void 0:d.id),T=Ok(o,{activatorEvent:h,active:d,activeNodeRect:p,containerNodeRect:f,draggingNodeRect:b.rect,over:x,overlayNodeRect:b.rect,scrollableAncestors:_,scrollableAncestorRects:w,transform:S,windowRect:C}),F=tx(p),P=v5({config:r,draggableNodes:m,droppableContainers:g,measuringConfiguration:y}),I=F?b.setRef:void 0;return Ke.createElement(d5,null,Ke.createElement(c5,{animation:P},d&&R?Ke.createElement(p5,{key:R,id:d.id,ref:I,as:l,activatorEvent:h,adjustScale:t,className:c,transition:i,rect:F,style:{zIndex:u,...s},transform:T},n):null))}),D0=["backlog","todo","in_progress","in_review","done"],Ht={Backlog:"backlog",Triage:"backlog",Unknown:"backlog",Todo:"todo","To Do":"todo",Ready:"todo",Unstarted:"todo","In Progress":"in_progress","In Planning":"in_progress",Started:"in_progress",Active:"in_progress","In Review":"in_review",Review:"in_review",QA:"in_review",Testing:"in_review",Done:"done",Completed:"done",Closed:"done",Canceled:"canceled",Cancelled:"canceled",Duplicate:"canceled","Won't Do":"canceled",Wontfix:"canceled"},b5={backlog:"backlog",unstarted:"todo",started:"in_progress",completed:"done",canceled:"canceled",cancelled:"canceled"};var bh={exports:{}},Bk={},Fk={exports:{}},w5="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",S5=w5,k5=S5;function zk(){}function $k(){}$k.resetWarningCache=zk;var C5=function(){function e(r,s,i,o,l,c){if(c!==k5){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:$k,resetWarningCache:zk};return n.PropTypes=n,n};Fk.exports=C5();var Hk=Fk.exports;function Wk(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Wk(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function M0(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Wk(e))&&(r&&(r+=" "),r+=t);return r}const N5=Object.freeze(Object.defineProperty({__proto__:null,clsx:M0,default:M0},Symbol.toStringTag,{value:"Module"})),j5=ij(N5);var ot={},Jr={};Object.defineProperty(Jr,"__esModule",{value:!0});Jr.dontSetMe=D5;Jr.findInArray=E5;Jr.int=P5;Jr.isFunction=R5;Jr.isNum=T5;function E5(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function R5(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function T5(e){return typeof e=="number"&&!isNaN(e)}function P5(e){return parseInt(e,10)}function D5(e,t,n){if(e[t])return new Error("Invalid prop ".concat(t," passed to ").concat(n," - do not set this, set it on the child."))}var vo={};Object.defineProperty(vo,"__esModule",{value:!0});vo.browserPrefixToKey=qk;vo.browserPrefixToStyle=M5;vo.default=void 0;vo.getPrefix=Uk;const bf=["Moz","Webkit","O","ms"];function Uk(){var e;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const n=(e=window.document)===null||e===void 0||(e=e.documentElement)===null||e===void 0?void 0:e.style;if(!n||t in n)return"";for(let r=0;r<bf.length;r++)if(qk(t,bf[r])in n)return bf[r];return""}function qk(e,t){return t?"".concat(t).concat(L5(e)):e}function M5(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e}function L5(e){let t="",n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]==="-"?n=!0:t+=e[r];return t}vo.default=Uk();Object.defineProperty(ot,"__esModule",{value:!0});ot.addClassName=Yk;ot.addEvent=I5;ot.addUserSelectStyles=Y5;ot.createCSSTransform=U5;ot.createSVGTransform=q5;ot.getTouch=K5;ot.getTouchIdentifier=V5;ot.getTranslation=nx;ot.innerHeight=$5;ot.innerWidth=H5;ot.matchesSelector=Vk;ot.matchesSelectorAndParentsTo=O5;ot.offsetXYFromParent=W5;ot.outerHeight=F5;ot.outerWidth=z5;ot.removeClassName=Qk;ot.removeEvent=B5;ot.removeUserSelectStyles=Q5;var Un=Jr,L0=A5(vo);function Kk(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Kk=function(r){return r?n:t})(e)}function A5(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Kk(t);if(n&&n.has(e))return n.get(e);var r={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var o=s?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(r,i,o):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}let ou="";function Vk(e,t){return ou||(ou=(0,Un.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(n){return(0,Un.isFunction)(e[n])})),(0,Un.isFunction)(e[ou])?e[ou](t):!1}function O5(e,t,n){let r=e;do{if(Vk(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function I5(e,t,n,r){if(!e)return;const s={capture:!0,...r};e.addEventListener?e.addEventListener(t,n,s):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n}function B5(e,t,n,r){if(!e)return;const s={capture:!0,...r};e.removeEventListener?e.removeEventListener(t,n,s):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null}function F5(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,Un.int)(n.borderTopWidth),t+=(0,Un.int)(n.borderBottomWidth),t}function z5(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,Un.int)(n.borderLeftWidth),t+=(0,Un.int)(n.borderRightWidth),t}function $5(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,Un.int)(n.paddingTop),t-=(0,Un.int)(n.paddingBottom),t}function H5(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,Un.int)(n.paddingLeft),t-=(0,Un.int)(n.paddingRight),t}function W5(e,t,n){const s=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),i=(e.clientX+t.scrollLeft-s.left)/n,o=(e.clientY+t.scrollTop-s.top)/n;return{x:i,y:o}}function U5(e,t){const n=nx(e,t,"px");return{[(0,L0.browserPrefixToKey)("transform",L0.default)]:n}}function q5(e,t){return nx(e,t,"")}function nx(e,t,n){let{x:r,y:s}=e,i="translate(".concat(r).concat(n,",").concat(s).concat(n,")");if(t){const o="".concat(typeof t.x=="string"?t.x:t.x+n),l="".concat(typeof t.y=="string"?t.y:t.y+n);i="translate(".concat(o,", ").concat(l,")")+i}return i}function K5(e,t){return e.targetTouches&&(0,Un.findInArray)(e.targetTouches,n=>t===n.identifier)||e.changedTouches&&(0,Un.findInArray)(e.changedTouches,n=>t===n.identifier)}function V5(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function Y5(e){if(!e)return;let t=e.getElementById("react-draggable-style-el");t||(t=e.createElement("style"),t.type="text/css",t.id="react-draggable-style-el",t.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
445
- `,t.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
446
- `,e.getElementsByTagName("head")[0].appendChild(t)),e.body&&Yk(e.body,"react-draggable-transparent-selection")}function Q5(e){if(e)try{if(e.body&&Qk(e.body,"react-draggable-transparent-selection"),e.selection)e.selection.empty();else{const t=(e.defaultView||window).getSelection();t&&t.type!=="Caret"&&t.removeAllRanges()}}catch{}}function Yk(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function Qk(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var Zr={};Object.defineProperty(Zr,"__esModule",{value:!0});Zr.canDragX=J5;Zr.canDragY=Z5;Zr.createCoreData=tT;Zr.createDraggableData=nT;Zr.getBoundPosition=X5;Zr.getControlPosition=eT;Zr.snapToGrid=G5;var Fn=Jr,qo=ot;function X5(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r=="string"?r:rT(r);const s=rx(e);if(typeof r=="string"){const{ownerDocument:i}=s,o=i.defaultView;let l;if(r==="parent"?l=s.parentNode:l=i.querySelector(r),!(l instanceof o.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const c=l,u=o.getComputedStyle(s),h=o.getComputedStyle(c);r={left:-s.offsetLeft+(0,Fn.int)(h.paddingLeft)+(0,Fn.int)(u.marginLeft),top:-s.offsetTop+(0,Fn.int)(h.paddingTop)+(0,Fn.int)(u.marginTop),right:(0,qo.innerWidth)(c)-(0,qo.outerWidth)(s)-s.offsetLeft+(0,Fn.int)(h.paddingRight)-(0,Fn.int)(u.marginRight),bottom:(0,qo.innerHeight)(c)-(0,qo.outerHeight)(s)-s.offsetTop+(0,Fn.int)(h.paddingBottom)-(0,Fn.int)(u.marginBottom)}}return(0,Fn.isNum)(r.right)&&(t=Math.min(t,r.right)),(0,Fn.isNum)(r.bottom)&&(n=Math.min(n,r.bottom)),(0,Fn.isNum)(r.left)&&(t=Math.max(t,r.left)),(0,Fn.isNum)(r.top)&&(n=Math.max(n,r.top)),[t,n]}function G5(e,t,n){const r=Math.round(t/e[0])*e[0],s=Math.round(n/e[1])*e[1];return[r,s]}function J5(e){return e.props.axis==="both"||e.props.axis==="x"}function Z5(e){return e.props.axis==="both"||e.props.axis==="y"}function eT(e,t,n){const r=typeof t=="number"?(0,qo.getTouch)(e,t):null;if(typeof t=="number"&&!r)return null;const s=rx(n),i=n.props.offsetParent||s.offsetParent||s.ownerDocument.body;return(0,qo.offsetXYFromParent)(r||e,i,n.props.scale)}function tT(e,t,n){const r=!(0,Fn.isNum)(e.lastX),s=rx(e);return r?{node:s,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:s,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function nT(e,t){const n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function rT(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function rx(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var wh={},Sh={};Object.defineProperty(Sh,"__esModule",{value:!0});Sh.default=sT;function sT(){}Object.defineProperty(wh,"__esModule",{value:!0});wh.default=void 0;var wf=oT(v),wn=sx(Hk),iT=sx(ar),Xt=ot,Ds=Zr,Sf=Jr,Xa=sx(Sh);function sx(e){return e&&e.__esModule?e:{default:e}}function Xk(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Xk=function(r){return r?n:t})(e)}function oT(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Xk(t);if(n&&n.has(e))return n.get(e);var r={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var o=s?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(r,i,o):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function ln(e,t,n){return t=aT(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function aT(e){var t=lT(e,"string");return typeof t=="symbol"?t:String(t)}function lT(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const mr={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let Ms=mr.mouse,kh=class extends wf.Component{constructor(){super(...arguments),ln(this,"dragging",!1),ln(this,"lastX",NaN),ln(this,"lastY",NaN),ln(this,"touchIdentifier",null),ln(this,"mounted",!1),ln(this,"handleDragStart",t=>{if(this.props.onMouseDown(t),!this.props.allowAnyClick&&typeof t.button=="number"&&t.button!==0)return!1;const n=this.findDOMNode();if(!n||!n.ownerDocument||!n.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:r}=n;if(this.props.disabled||!(t.target instanceof r.defaultView.Node)||this.props.handle&&!(0,Xt.matchesSelectorAndParentsTo)(t.target,this.props.handle,n)||this.props.cancel&&(0,Xt.matchesSelectorAndParentsTo)(t.target,this.props.cancel,n))return;t.type==="touchstart"&&t.preventDefault();const s=(0,Xt.getTouchIdentifier)(t);this.touchIdentifier=s;const i=(0,Ds.getControlPosition)(t,s,this);if(i==null)return;const{x:o,y:l}=i,c=(0,Ds.createCoreData)(this,o,l);(0,Xa.default)("DraggableCore: handleDragStart: %j",c),(0,Xa.default)("calling",this.props.onStart),!(this.props.onStart(t,c)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,Xt.addUserSelectStyles)(r),this.dragging=!0,this.lastX=o,this.lastY=l,(0,Xt.addEvent)(r,Ms.move,this.handleDrag),(0,Xt.addEvent)(r,Ms.stop,this.handleDragStop))}),ln(this,"handleDrag",t=>{const n=(0,Ds.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:s}=n;if(Array.isArray(this.props.grid)){let l=r-this.lastX,c=s-this.lastY;if([l,c]=(0,Ds.snapToGrid)(this.props.grid,l,c),!l&&!c)return;r=this.lastX+l,s=this.lastY+c}const i=(0,Ds.createCoreData)(this,r,s);if((0,Xa.default)("DraggableCore: handleDrag: %j",i),this.props.onDrag(t,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const c=document.createEvent("MouseEvents");c.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(c)}return}this.lastX=r,this.lastY=s}),ln(this,"handleDragStop",t=>{if(!this.dragging)return;const n=(0,Ds.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:s}=n;if(Array.isArray(this.props.grid)){let c=r-this.lastX||0,u=s-this.lastY||0;[c,u]=(0,Ds.snapToGrid)(this.props.grid,c,u),r=this.lastX+c,s=this.lastY+u}const i=(0,Ds.createCoreData)(this,r,s);if(this.props.onStop(t,i)===!1||this.mounted===!1)return!1;const l=this.findDOMNode();l&&this.props.enableUserSelectHack&&(0,Xt.removeUserSelectStyles)(l.ownerDocument),(0,Xa.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,l&&((0,Xa.default)("DraggableCore: Removing handlers"),(0,Xt.removeEvent)(l.ownerDocument,Ms.move,this.handleDrag),(0,Xt.removeEvent)(l.ownerDocument,Ms.stop,this.handleDragStop))}),ln(this,"onMouseDown",t=>(Ms=mr.mouse,this.handleDragStart(t))),ln(this,"onMouseUp",t=>(Ms=mr.mouse,this.handleDragStop(t))),ln(this,"onTouchStart",t=>(Ms=mr.touch,this.handleDragStart(t))),ln(this,"onTouchEnd",t=>(Ms=mr.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,Xt.addEvent)(t,mr.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:n}=t;(0,Xt.removeEvent)(n,mr.mouse.move,this.handleDrag),(0,Xt.removeEvent)(n,mr.touch.move,this.handleDrag),(0,Xt.removeEvent)(n,mr.mouse.stop,this.handleDragStop),(0,Xt.removeEvent)(n,mr.touch.stop,this.handleDragStop),(0,Xt.removeEvent)(t,mr.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,Xt.removeUserSelectStyles)(n)}}findDOMNode(){var t,n;return(t=this.props)!==null&&t!==void 0&&t.nodeRef?(n=this.props)===null||n===void 0||(n=n.nodeRef)===null||n===void 0?void 0:n.current:iT.default.findDOMNode(this)}render(){return wf.cloneElement(wf.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};wh.default=kh;ln(kh,"displayName","DraggableCore");ln(kh,"propTypes",{allowAnyClick:wn.default.bool,children:wn.default.node.isRequired,disabled:wn.default.bool,enableUserSelectHack:wn.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:wn.default.arrayOf(wn.default.number),handle:wn.default.string,cancel:wn.default.string,nodeRef:wn.default.object,onStart:wn.default.func,onDrag:wn.default.func,onStop:wn.default.func,onMouseDown:wn.default.func,scale:wn.default.number,className:Sf.dontSetMe,style:Sf.dontSetMe,transform:Sf.dontSetMe});ln(kh,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return c.default}}),e.default=void 0;var t=p(v),n=h(Hk),r=h(ar),s=h(j5),i=ot,o=Zr,l=Jr,c=h(wh),u=h(Sh);function h(y){return y&&y.__esModule?y:{default:y}}function d(y){if(typeof WeakMap!="function")return null;var _=new WeakMap,w=new WeakMap;return(d=function(C){return C?w:_})(y)}function p(y,_){if(y&&y.__esModule)return y;if(y===null||typeof y!="object"&&typeof y!="function")return{default:y};var w=d(_);if(w&&w.has(y))return w.get(y);var C={},S=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var R in y)if(R!=="default"&&Object.prototype.hasOwnProperty.call(y,R)){var T=S?Object.getOwnPropertyDescriptor(y,R):null;T&&(T.get||T.set)?Object.defineProperty(C,R,T):C[R]=y[R]}return C.default=y,w&&w.set(y,C),C}function f(){return f=Object.assign?Object.assign.bind():function(y){for(var _=1;_<arguments.length;_++){var w=arguments[_];for(var C in w)Object.prototype.hasOwnProperty.call(w,C)&&(y[C]=w[C])}return y},f.apply(this,arguments)}function m(y,_,w){return _=g(_),_ in y?Object.defineProperty(y,_,{value:w,enumerable:!0,configurable:!0,writable:!0}):y[_]=w,y}function g(y){var _=b(y,"string");return typeof _=="symbol"?_:String(_)}function b(y,_){if(typeof y!="object"||y===null)return y;var w=y[Symbol.toPrimitive];if(w!==void 0){var C=w.call(y,_);if(typeof C!="object")return C;throw new TypeError("@@toPrimitive must return a primitive value.")}return(_==="string"?String:Number)(y)}class x extends t.Component{static getDerivedStateFromProps(_,w){let{position:C}=_,{prevPropsPosition:S}=w;return C&&(!S||C.x!==S.x||C.y!==S.y)?((0,u.default)("Draggable: getDerivedStateFromProps %j",{position:C,prevPropsPosition:S}),{x:C.x,y:C.y,prevPropsPosition:{...C}}):null}constructor(_){super(_),m(this,"onDragStart",(w,C)=>{if((0,u.default)("Draggable: onDragStart: %j",C),this.props.onStart(w,(0,o.createDraggableData)(this,C))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),m(this,"onDrag",(w,C)=>{if(!this.state.dragging)return!1;(0,u.default)("Draggable: onDrag: %j",C);const S=(0,o.createDraggableData)(this,C),R={x:S.x,y:S.y,slackX:0,slackY:0};if(this.props.bounds){const{x:F,y:P}=R;R.x+=this.state.slackX,R.y+=this.state.slackY;const[I,A]=(0,o.getBoundPosition)(this,R.x,R.y);R.x=I,R.y=A,R.slackX=this.state.slackX+(F-R.x),R.slackY=this.state.slackY+(P-R.y),S.x=R.x,S.y=R.y,S.deltaX=R.x-this.state.x,S.deltaY=R.y-this.state.y}if(this.props.onDrag(w,S)===!1)return!1;this.setState(R)}),m(this,"onDragStop",(w,C)=>{if(!this.state.dragging||this.props.onStop(w,(0,o.createDraggableData)(this,C))===!1)return!1;(0,u.default)("Draggable: onDragStop: %j",C);const R={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:F,y:P}=this.props.position;R.x=F,R.y=P}this.setState(R)}),this.state={dragging:!1,dragged:!1,x:_.position?_.position.x:_.defaultPosition.x,y:_.position?_.position.y:_.defaultPosition.y,prevPropsPosition:{..._.position},slackX:0,slackY:0,isElementSVG:!1},_.position&&!(_.onDrag||_.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var _,w;return(_=(w=this.props)===null||w===void 0||(w=w.nodeRef)===null||w===void 0?void 0:w.current)!==null&&_!==void 0?_:r.default.findDOMNode(this)}render(){const{axis:_,bounds:w,children:C,defaultPosition:S,defaultClassName:R,defaultClassNameDragging:T,defaultClassNameDragged:F,position:P,positionOffset:I,scale:A,...M}=this.props;let j={},E=null;const q=!!!P||this.state.dragging,D=P||S,H={x:(0,o.canDragX)(this)&&q?this.state.x:D.x,y:(0,o.canDragY)(this)&&q?this.state.y:D.y};this.state.isElementSVG?E=(0,i.createSVGTransform)(H,I):j=(0,i.createCSSTransform)(H,I);const N=(0,s.default)(C.props.className||"",R,{[T]:this.state.dragging,[F]:this.state.dragged});return t.createElement(c.default,f({},M,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(C),{className:N,style:{...C.props.style,...j},transform:E}))}}e.default=x,m(x,"displayName","Draggable"),m(x,"propTypes",{...c.default.propTypes,axis:n.default.oneOf(["both","x","y","none"]),bounds:n.default.oneOfType([n.default.shape({left:n.default.number,right:n.default.number,top:n.default.number,bottom:n.default.number}),n.default.string,n.default.oneOf([!1])]),defaultClassName:n.default.string,defaultClassNameDragging:n.default.string,defaultClassNameDragged:n.default.string,defaultPosition:n.default.shape({x:n.default.number,y:n.default.number}),positionOffset:n.default.shape({x:n.default.oneOfType([n.default.number,n.default.string]),y:n.default.oneOfType([n.default.number,n.default.string])}),position:n.default.shape({x:n.default.number,y:n.default.number}),className:l.dontSetMe,style:l.dontSetMe,transform:l.dontSetMe}),m(x,"defaultProps",{...c.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(Bk);const{default:Gk,DraggableCore:cT}=Bk;bh.exports=Gk;bh.exports.default=Gk;bh.exports.DraggableCore=cT;var uT=bh.exports;const dT=Na(uT);var ut=function(){return ut=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},ut.apply(this,arguments)},A0={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},O0={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},au={width:"20px",height:"20px",position:"absolute",zIndex:1},hT={top:ut(ut({},A0),{top:"-5px"}),right:ut(ut({},O0),{left:void 0,right:"-5px"}),bottom:ut(ut({},A0),{top:void 0,bottom:"-5px"}),left:ut(ut({},O0),{left:"-5px"}),topRight:ut(ut({},au),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:ut(ut({},au),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:ut(ut({},au),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:ut(ut({},au),{left:"-10px",top:"-10px",cursor:"nw-resize"})},fT=v.memo(function(e){var t=e.onResizeStart,n=e.direction,r=e.children,s=e.replaceStyles,i=e.className,o=v.useCallback(function(u){t(u,n)},[t,n]),l=v.useCallback(function(u){t(u,n)},[t,n]),c=v.useMemo(function(){return ut(ut({position:"absolute",userSelect:"none"},hT[n]),s??{})},[s,n]);return a.jsx("div",{className:i||void 0,style:c,onMouseDown:o,onTouchStart:l,children:r})}),pT=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(r[i]=s[i])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Or=function(){return Or=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},Or.apply(this,arguments)},mT={width:"auto",height:"auto"},lu=function(e,t,n){return Math.max(Math.min(e,n),t)},I0=function(e,t,n){var r=Math.round(e/t);return r*t+n*(r-1)},So=function(e,t){return new RegExp(e,"i").test(t)},cu=function(e){return!!(e.touches&&e.touches.length)},gT=function(e){return!!((e.clientX||e.clientX===0)&&(e.clientY||e.clientY===0))},B0=function(e,t,n){n===void 0&&(n=0);var r=t.reduce(function(i,o,l){return Math.abs(o-e)<Math.abs(t[i]-e)?l:i},0),s=Math.abs(t[r]-e);return n===0||s<n?t[r]:e},kf=function(e){return e=e.toString(),e==="auto"||e.endsWith("px")||e.endsWith("%")||e.endsWith("vh")||e.endsWith("vw")||e.endsWith("vmax")||e.endsWith("vmin")?e:"".concat(e,"px")},uu=function(e,t,n,r){if(e&&typeof e=="string"){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%")){var s=Number(e.replace("%",""))/100;return t*s}if(e.endsWith("vw")){var s=Number(e.replace("vw",""))/100;return n*s}if(e.endsWith("vh")){var s=Number(e.replace("vh",""))/100;return r*s}}return e},vT=function(e,t,n,r,s,i,o){return r=uu(r,e.width,t,n),s=uu(s,e.height,t,n),i=uu(i,e.width,t,n),o=uu(o,e.height,t,n),{maxWidth:typeof r>"u"?void 0:Number(r),maxHeight:typeof s>"u"?void 0:Number(s),minWidth:typeof i>"u"?void 0:Number(i),minHeight:typeof o>"u"?void 0:Number(o)}},xT=function(e){return Array.isArray(e)?e:[e,e]},yT=["as","ref","style","className","grid","gridGap","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],F0="__resizable_base__",_T=function(e){pT(t,e);function t(n){var r,s,i,o,l=e.call(this,n)||this;return l.ratio=1,l.resizable=null,l.parentLeft=0,l.parentTop=0,l.resizableLeft=0,l.resizableRight=0,l.resizableTop=0,l.resizableBottom=0,l.targetLeft=0,l.targetTop=0,l.delta={width:0,height:0},l.appendBase=function(){if(!l.resizable||!l.window)return null;var c=l.parentNode;if(!c)return null;var u=l.window.document.createElement("div");return u.style.width="100%",u.style.height="100%",u.style.position="absolute",u.style.transform="scale(0, 0)",u.style.left="0",u.style.flex="0 0 100%",u.classList?u.classList.add(F0):u.className+=F0,c.appendChild(u),u},l.removeBase=function(c){var u=l.parentNode;u&&u.removeChild(c)},l.state={isResizing:!1,width:(s=(r=l.propsSize)===null||r===void 0?void 0:r.width)!==null&&s!==void 0?s:"auto",height:(o=(i=l.propsSize)===null||i===void 0?void 0:i.height)!==null&&o!==void 0?o:"auto",direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},l.onResizeStart=l.onResizeStart.bind(l),l.onMouseMove=l.onMouseMove.bind(l),l.onMouseUp=l.onMouseUp.bind(l),l}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||mT},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,r=0;if(this.resizable&&this.window){var s=this.resizable.offsetWidth,i=this.resizable.offsetHeight,o=this.resizable.style.position;o!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:s,r=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:i,this.resizable.style.position=o}return{width:n,height:r}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,r=this.props.size,s=function(l){var c;if(typeof n.state[l]>"u"||n.state[l]==="auto")return"auto";if(n.propsSize&&n.propsSize[l]&&(!((c=n.propsSize[l])===null||c===void 0)&&c.toString().endsWith("%"))){if(n.state[l].toString().endsWith("%"))return n.state[l].toString();var u=n.getParentSize(),h=Number(n.state[l].toString().replace("px","")),d=h/u[l]*100;return"".concat(d,"%")}return kf(n.state[l])},i=r&&typeof r.width<"u"&&!this.state.isResizing?kf(r.width):s("width"),o=r&&typeof r.height<"u"&&!this.state.isResizing?kf(r.height):s("height");return{width:i,height:o}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var n=this.appendBase();if(!n)return{width:0,height:0};var r=!1,s=this.parentNode.style.flexWrap;s!=="wrap"&&(r=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var i={width:n.offsetWidth,height:n.offsetHeight};return r&&(this.parentNode.style.flexWrap=s),this.removeBase(n),i},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var n=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:n.flexBasis!=="auto"?n.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(n,r){var s=this.propsSize&&this.propsSize[r];return this.state[r]==="auto"&&this.state.original[r]===n&&(typeof s>"u"||s==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,r){var s=this.props.boundsByDirection,i=this.state.direction,o=s&&So("left",i),l=s&&So("top",i),c,u;if(this.props.bounds==="parent"){var h=this.parentNode;h&&(c=o?this.resizableRight-this.parentLeft:h.offsetWidth+(this.parentLeft-this.resizableLeft),u=l?this.resizableBottom-this.parentTop:h.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(c=o?this.resizableRight:this.window.innerWidth-this.resizableLeft,u=l?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(c=o?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),u=l?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return c&&Number.isFinite(c)&&(n=n&&n<c?n:c),u&&Number.isFinite(u)&&(r=r&&r<u?r:u),{maxWidth:n,maxHeight:r}},t.prototype.calculateNewSizeFromDirection=function(n,r){var s=this.props.scale||1,i=xT(this.props.resizeRatio||1),o=i[0],l=i[1],c=this.state,u=c.direction,h=c.original,d=this.props,p=d.lockAspectRatio,f=d.lockAspectRatioExtraHeight,m=d.lockAspectRatioExtraWidth,g=h.width,b=h.height,x=f||0,y=m||0;return So("right",u)&&(g=h.width+(n-h.x)*o/s,p&&(b=(g-y)/this.ratio+x)),So("left",u)&&(g=h.width-(n-h.x)*o/s,p&&(b=(g-y)/this.ratio+x)),So("bottom",u)&&(b=h.height+(r-h.y)*l/s,p&&(g=(b-x)*this.ratio+y)),So("top",u)&&(b=h.height-(r-h.y)*l/s,p&&(g=(b-x)*this.ratio+y)),{newWidth:g,newHeight:b}},t.prototype.calculateNewSizeFromAspectRatio=function(n,r,s,i){var o=this.props,l=o.lockAspectRatio,c=o.lockAspectRatioExtraHeight,u=o.lockAspectRatioExtraWidth,h=typeof i.width>"u"?10:i.width,d=typeof s.width>"u"||s.width<0?n:s.width,p=typeof i.height>"u"?10:i.height,f=typeof s.height>"u"||s.height<0?r:s.height,m=c||0,g=u||0;if(l){var b=(p-m)*this.ratio+g,x=(f-m)*this.ratio+g,y=(h-g)/this.ratio+m,_=(d-g)/this.ratio+m,w=Math.max(h,b),C=Math.min(d,x),S=Math.max(p,y),R=Math.min(f,_);n=lu(n,w,C),r=lu(r,S,R)}else n=lu(n,h,d),r=lu(r,p,f);return{newWidth:n,newHeight:r}},t.prototype.setBoundingClientRect=function(){var n=1/(this.props.scale||1);if(this.props.bounds==="parent"){var r=this.parentNode;if(r){var s=r.getBoundingClientRect();this.parentLeft=s.left*n,this.parentTop=s.top*n}}if(this.props.bounds&&typeof this.props.bounds!="string"){var i=this.props.bounds.getBoundingClientRect();this.targetLeft=i.left*n,this.targetTop=i.top*n}if(this.resizable){var o=this.resizable.getBoundingClientRect(),l=o.left,c=o.top,u=o.right,h=o.bottom;this.resizableLeft=l*n,this.resizableRight=u*n,this.resizableTop=c*n,this.resizableBottom=h*n}},t.prototype.onResizeStart=function(n,r){if(!(!this.resizable||!this.window)){var s=0,i=0;if(n.nativeEvent&&gT(n.nativeEvent)?(s=n.nativeEvent.clientX,i=n.nativeEvent.clientY):n.nativeEvent&&cu(n.nativeEvent)&&(s=n.nativeEvent.touches[0].clientX,i=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var o=this.props.onResizeStart(n,r,this.resizable);if(o===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var l,c=this.window.getComputedStyle(this.resizable);if(c.flexBasis!=="auto"){var u=this.parentNode;if(u){var h=this.window.getComputedStyle(u).flexDirection;this.flexDir=h.startsWith("row")?"row":"column",l=c.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var d={original:{x:s,y:i,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:Or(Or({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:r,flexBasis:l};this.setState(d)}},t.prototype.onMouseMove=function(n){var r=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&cu(n))try{n.preventDefault(),n.stopPropagation()}catch{}var s=this.props,i=s.maxWidth,o=s.maxHeight,l=s.minWidth,c=s.minHeight,u=cu(n)?n.touches[0].clientX:n.clientX,h=cu(n)?n.touches[0].clientY:n.clientY,d=this.state,p=d.direction,f=d.original,m=d.width,g=d.height,b=this.getParentSize(),x=vT(b,this.window.innerWidth,this.window.innerHeight,i,o,l,c);i=x.maxWidth,o=x.maxHeight,l=x.minWidth,c=x.minHeight;var y=this.calculateNewSizeFromDirection(u,h),_=y.newHeight,w=y.newWidth,C=this.calculateNewMaxFromBoundary(i,o);this.props.snap&&this.props.snap.x&&(w=B0(w,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(_=B0(_,this.props.snap.y,this.props.snapGap));var S=this.calculateNewSizeFromAspectRatio(w,_,{width:C.maxWidth,height:C.maxHeight},{width:l,height:c});if(w=S.newWidth,_=S.newHeight,this.props.grid){var R=I0(w,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),T=I0(_,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),F=this.props.snapGap||0,P=F===0||Math.abs(R-w)<=F?R:w,I=F===0||Math.abs(T-_)<=F?T:_;w=P,_=I}var A={width:w-f.width,height:_-f.height};if(this.delta=A,m&&typeof m=="string"){if(m.endsWith("%")){var M=w/b.width*100;w="".concat(M,"%")}else if(m.endsWith("vw")){var j=w/this.window.innerWidth*100;w="".concat(j,"vw")}else if(m.endsWith("vh")){var E=w/this.window.innerHeight*100;w="".concat(E,"vh")}}if(g&&typeof g=="string"){if(g.endsWith("%")){var M=_/b.height*100;_="".concat(M,"%")}else if(g.endsWith("vw")){var j=_/this.window.innerWidth*100;_="".concat(j,"vw")}else if(g.endsWith("vh")){var E=_/this.window.innerHeight*100;_="".concat(E,"vh")}}var $={width:this.createSizeForCssProperty(w,"width"),height:this.createSizeForCssProperty(_,"height")};this.flexDir==="row"?$.flexBasis=$.width:this.flexDir==="column"&&($.flexBasis=$.height);var q=this.state.width!==$.width,D=this.state.height!==$.height,H=this.state.flexBasis!==$.flexBasis,N=q||D||H;N&&ar.flushSync(function(){r.setState($)}),this.props.onResize&&N&&this.props.onResize(n,p,this.resizable,A)}},t.prototype.onMouseUp=function(n){var r,s,i=this.state,o=i.isResizing,l=i.direction;i.original,!(!o||!this.resizable)&&(this.props.onResizeStop&&this.props.onResizeStop(n,l,this.resizable,this.delta),this.props.size&&this.setState({width:(r=this.props.size.width)!==null&&r!==void 0?r:"auto",height:(s=this.props.size.height)!==null&&s!==void 0?s:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:Or(Or({},this.state.backgroundStyle),{cursor:"auto"})}))},t.prototype.updateSize=function(n){var r,s;this.setState({width:(r=n.width)!==null&&r!==void 0?r:"auto",height:(s=n.height)!==null&&s!==void 0?s:"auto"})},t.prototype.renderResizer=function(){var n=this,r=this.props,s=r.enable,i=r.handleStyles,o=r.handleClasses,l=r.handleWrapperStyle,c=r.handleWrapperClass,u=r.handleComponent;if(!s)return null;var h=Object.keys(s).map(function(d){return s[d]!==!1?a.jsx(fT,{direction:d,onResizeStart:n.onResizeStart,replaceStyles:i&&i[d],className:o&&o[d],children:u&&u[d]?u[d]:null},d):null});return a.jsx("div",{className:c,style:l,children:h})},t.prototype.render=function(){var n=this,r=Object.keys(this.props).reduce(function(o,l){return yT.indexOf(l)!==-1||(o[l]=n.props[l]),o},{}),s=Or(Or(Or({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(s.flexBasis=this.state.flexBasis);var i=this.props.as||"div";return a.jsxs(i,Or({style:s,className:this.props.className},r,{ref:function(o){o&&(n.resizable=o)},children:[this.state.isResizing&&a.jsx("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer()]}))},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],gridGap:[0,0],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(v.PureComponent);/*! *****************************************************************************
447
- Copyright (c) Microsoft Corporation. All rights reserved.
448
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
449
- this file except in compliance with the License. You may obtain a copy of the
450
- License at http://www.apache.org/licenses/LICENSE-2.0
451
-
452
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
453
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
454
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
455
- MERCHANTABLITY OR NON-INFRINGEMENT.
456
-
457
- See the Apache Version 2.0 License for specific language governing permissions
458
- and limitations under the License.
459
- ***************************************************************************** */var Pm=function(e,t){return Pm=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)r.hasOwnProperty(s)&&(n[s]=r[s])},Pm(e,t)};function bT(e,t){Pm(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var _t=function(){return _t=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},_t.apply(this,arguments)};function wT(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}var ST={width:"auto",height:"auto",display:"inline-block",position:"absolute",top:0,left:0},kT=function(e){return{bottom:e,bottomLeft:e,bottomRight:e,left:e,right:e,top:e,topLeft:e,topRight:e}},CT=function(e){bT(t,e);function t(n){var r=e.call(this,n)||this;return r.resizingPosition={x:0,y:0},r.offsetFromParent={left:0,top:0},r.resizableElement={current:null},r.originalPosition={x:0,y:0},r.state={resizing:!1,bounds:{top:0,right:0,bottom:0,left:0},maxWidth:n.maxWidth,maxHeight:n.maxHeight},r.onResizeStart=r.onResizeStart.bind(r),r.onResize=r.onResize.bind(r),r.onResizeStop=r.onResizeStop.bind(r),r.onDragStart=r.onDragStart.bind(r),r.onDrag=r.onDrag.bind(r),r.onDragStop=r.onDragStop.bind(r),r.getMaxSizesFromProps=r.getMaxSizesFromProps.bind(r),r}return t.prototype.componentDidMount=function(){this.updateOffsetFromParent();var n=this.offsetFromParent,r=n.left,s=n.top,i=this.getDraggablePosition(),o=i.x,l=i.y;this.draggable.setState({x:o-r,y:l-s}),this.forceUpdate()},t.prototype.getDraggablePosition=function(){var n=this.draggable.state,r=n.x,s=n.y;return{x:r,y:s}},t.prototype.getParent=function(){return this.resizable&&this.resizable.parentNode},t.prototype.getParentSize=function(){return this.resizable.getParentSize()},t.prototype.getMaxSizesFromProps=function(){var n=typeof this.props.maxWidth>"u"?Number.MAX_SAFE_INTEGER:this.props.maxWidth,r=typeof this.props.maxHeight>"u"?Number.MAX_SAFE_INTEGER:this.props.maxHeight;return{maxWidth:n,maxHeight:r}},t.prototype.getSelfElement=function(){return this.resizable&&this.resizable.resizable},t.prototype.getOffsetHeight=function(n){var r=this.props.scale;switch(this.props.bounds){case"window":return window.innerHeight/r;case"body":return document.body.offsetHeight/r;default:return n.offsetHeight}},t.prototype.getOffsetWidth=function(n){var r=this.props.scale;switch(this.props.bounds){case"window":return window.innerWidth/r;case"body":return document.body.offsetWidth/r;default:return n.offsetWidth}},t.prototype.onDragStart=function(n,r){this.props.onDragStart&&this.props.onDragStart(n,r);var s=this.getDraggablePosition();if(this.originalPosition=s,!!this.props.bounds){var i=this.getParent(),o=this.props.scale,l;if(this.props.bounds==="parent")l=i;else if(this.props.bounds==="body"){var c=i.getBoundingClientRect(),u=c.left,h=c.top,d=document.body.getBoundingClientRect(),p=-(u-i.offsetLeft*o-d.left)/o,f=-(h-i.offsetTop*o-d.top)/o,m=(document.body.offsetWidth-this.resizable.size.width*o)/o+p,g=(document.body.offsetHeight-this.resizable.size.height*o)/o+f;return this.setState({bounds:{top:f,right:m,bottom:g,left:p}})}else if(this.props.bounds==="window"){if(!this.resizable)return;var b=i.getBoundingClientRect(),x=b.left,y=b.top,_=-(x-i.offsetLeft*o)/o,w=-(y-i.offsetTop*o)/o,m=(window.innerWidth-this.resizable.size.width*o)/o+_,g=(window.innerHeight-this.resizable.size.height*o)/o+w;return this.setState({bounds:{top:w,right:m,bottom:g,left:_}})}else typeof this.props.bounds=="string"?l=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(l=this.props.bounds);if(!(!(l instanceof HTMLElement)||!(i instanceof HTMLElement))){var C=l.getBoundingClientRect(),S=C.left,R=C.top,T=i.getBoundingClientRect(),F=T.left,P=T.top,I=(S-F)/o,A=R-P;if(this.resizable){this.updateOffsetFromParent();var M=this.offsetFromParent;this.setState({bounds:{top:A-M.top,right:I+(l.offsetWidth-this.resizable.size.width)-M.left/o,bottom:A+(l.offsetHeight-this.resizable.size.height)-M.top,left:I-M.left/o}})}}}},t.prototype.onDrag=function(n,r){if(this.props.onDrag){var s=this.offsetFromParent,i=s.left,o=s.top;if(!this.props.dragAxis||this.props.dragAxis==="both")return this.props.onDrag(n,_t(_t({},r),{x:r.x+i,y:r.y+o}));if(this.props.dragAxis==="x")return this.props.onDrag(n,_t(_t({},r),{x:r.x+i,y:this.originalPosition.y+o,deltaY:0}));if(this.props.dragAxis==="y")return this.props.onDrag(n,_t(_t({},r),{x:this.originalPosition.x+i,y:r.y+o,deltaX:0}))}},t.prototype.onDragStop=function(n,r){if(this.props.onDragStop){var s=this.offsetFromParent,i=s.left,o=s.top;if(!this.props.dragAxis||this.props.dragAxis==="both")return this.props.onDragStop(n,_t(_t({},r),{x:r.x+i,y:r.y+o}));if(this.props.dragAxis==="x")return this.props.onDragStop(n,_t(_t({},r),{x:r.x+i,y:this.originalPosition.y+o,deltaY:0}));if(this.props.dragAxis==="y")return this.props.onDragStop(n,_t(_t({},r),{x:this.originalPosition.x+i,y:r.y+o,deltaX:0}))}},t.prototype.onResizeStart=function(n,r,s){n.stopPropagation(),this.setState({resizing:!0});var i=this.props.scale,o=this.offsetFromParent,l=this.getDraggablePosition();if(this.resizingPosition={x:l.x+o.left,y:l.y+o.top},this.originalPosition=l,this.props.bounds){var c=this.getParent(),u=void 0;this.props.bounds==="parent"?u=c:this.props.bounds==="body"?u=document.body:this.props.bounds==="window"?u=window:typeof this.props.bounds=="string"?u=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(u=this.props.bounds);var h=this.getSelfElement();if(h instanceof Element&&(u instanceof HTMLElement||u===window)&&c instanceof HTMLElement){var d=this.getMaxSizesFromProps(),p=d.maxWidth,f=d.maxHeight,m=this.getParentSize();if(p&&typeof p=="string")if(p.endsWith("%")){var g=Number(p.replace("%",""))/100;p=m.width*g}else p.endsWith("px")&&(p=Number(p.replace("px","")));if(f&&typeof f=="string")if(f.endsWith("%")){var g=Number(f.replace("%",""))/100;f=m.height*g}else f.endsWith("px")&&(f=Number(f.replace("px","")));var b=h.getBoundingClientRect(),x=b.left,y=b.top,_=this.props.bounds==="window"?{left:0,top:0}:u.getBoundingClientRect(),w=_.left,C=_.top,S=this.getOffsetWidth(u),R=this.getOffsetHeight(u),T=r.toLowerCase().endsWith("left"),F=r.toLowerCase().endsWith("right"),P=r.startsWith("top"),I=r.startsWith("bottom");if((T||P)&&this.resizable){var A=(x-w)/i+this.resizable.size.width;this.setState({maxWidth:A>Number(p)?p:A})}if(F||this.props.lockAspectRatio&&!T&&!P){var A=S+(w-x)/i;this.setState({maxWidth:A>Number(p)?p:A})}if((P||T)&&this.resizable){var A=(y-C)/i+this.resizable.size.height;this.setState({maxHeight:A>Number(f)?f:A})}if(I||this.props.lockAspectRatio&&!P&&!T){var A=R+(C-y)/i;this.setState({maxHeight:A>Number(f)?f:A})}}}else this.setState({maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight});this.props.onResizeStart&&this.props.onResizeStart(n,r,s)},t.prototype.onResize=function(n,r,s,i){var o=this,l={x:this.originalPosition.x,y:this.originalPosition.y},c=-i.width,u=-i.height,h=["top","left","topLeft","bottomLeft","topRight"];h.includes(r)&&(r==="bottomLeft"?l.x+=c:(r==="topRight"||(l.x+=c),l.y+=u));var d=this.draggable.state;(l.x!==d.x||l.y!==d.y)&&ar.flushSync(function(){o.draggable.setState(l)}),this.updateOffsetFromParent();var p=this.offsetFromParent,f=this.getDraggablePosition().x+p.left,m=this.getDraggablePosition().y+p.top;this.resizingPosition={x:f,y:m},this.props.onResize&&this.props.onResize(n,r,s,i,{x:f,y:m})},t.prototype.onResizeStop=function(n,r,s,i){this.setState({resizing:!1});var o=this.getMaxSizesFromProps(),l=o.maxWidth,c=o.maxHeight;this.setState({maxWidth:l,maxHeight:c}),this.props.onResizeStop&&this.props.onResizeStop(n,r,s,i,this.resizingPosition)},t.prototype.updateSize=function(n){this.resizable&&this.resizable.updateSize({width:n.width,height:n.height})},t.prototype.updatePosition=function(n){this.draggable.setState(n)},t.prototype.updateOffsetFromParent=function(){var n=this.props.scale,r=this.getParent(),s=this.getSelfElement();if(!r||s===null)return{top:0,left:0};var i=r.getBoundingClientRect(),o=i.left,l=i.top,c=s.getBoundingClientRect(),u=this.getDraggablePosition(),h=r.scrollLeft,d=r.scrollTop;this.offsetFromParent={left:c.left-o+h-u.x*n,top:c.top-l+d-u.y*n}},t.prototype.render=function(){var n=this,r=this.props,s=r.disableDragging,i=r.style,o=r.dragHandleClassName,l=r.position,c=r.onMouseDown,u=r.onMouseUp,h=r.dragAxis,d=r.dragGrid,p=r.bounds,f=r.enableUserSelectHack,m=r.cancel,g=r.children;r.onResizeStart,r.onResize,r.onResizeStop,r.onDragStart,r.onDrag,r.onDragStop;var b=r.resizeHandleStyles,x=r.resizeHandleClasses,y=r.resizeHandleComponent,_=r.enableResizing,w=r.resizeGrid,C=r.resizeHandleWrapperClass,S=r.resizeHandleWrapperStyle,R=r.scale,T=r.allowAnyClick,F=r.dragPositionOffset,P=wT(r,["disableDragging","style","dragHandleClassName","position","onMouseDown","onMouseUp","dragAxis","dragGrid","bounds","enableUserSelectHack","cancel","children","onResizeStart","onResize","onResizeStop","onDragStart","onDrag","onDragStop","resizeHandleStyles","resizeHandleClasses","resizeHandleComponent","enableResizing","resizeGrid","resizeHandleWrapperClass","resizeHandleWrapperStyle","scale","allowAnyClick","dragPositionOffset"]),I=this.props.default?_t({},this.props.default):void 0;delete P.default;var A=s||o?{cursor:"auto"}:{cursor:"move"},M=_t(_t(_t({},ST),A),i),j=this.offsetFromParent,E=j.left,$=j.top,q;l&&(q={x:l.x-E,y:l.y-$});var D=this.state.resizing?void 0:q,H=this.state.resizing?"both":h;return v.createElement(dT,{ref:function(N){N&&(n.draggable=N)},handle:o?".".concat(o):void 0,defaultPosition:I,onMouseDown:c,onMouseUp:u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,axis:H,disabled:s,grid:d,bounds:p?this.state.bounds:void 0,position:D,enableUserSelectHack:f,cancel:m,scale:R,allowAnyClick:T,nodeRef:this.resizableElement,positionOffset:F},v.createElement(_T,_t({},P,{ref:function(N){N&&(n.resizable=N,n.resizableElement.current=N.resizable)},defaultSize:I,size:this.props.size,enable:typeof _=="boolean"?kT(_):_,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,style:M,minWidth:this.props.minWidth,minHeight:this.props.minHeight,maxWidth:this.state.resizing?this.state.maxWidth:this.props.maxWidth,maxHeight:this.state.resizing?this.state.maxHeight:this.props.maxHeight,grid:w,handleWrapperClass:C,handleWrapperStyle:S,lockAspectRatio:this.props.lockAspectRatio,lockAspectRatioExtraWidth:this.props.lockAspectRatioExtraWidth,lockAspectRatioExtraHeight:this.props.lockAspectRatioExtraHeight,handleStyles:b,handleClasses:x,handleComponent:y,scale:this.props.scale}),g))},t.defaultProps={maxWidth:Number.MAX_SAFE_INTEGER,maxHeight:Number.MAX_SAFE_INTEGER,scale:1,onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},onDragStart:function(){},onDrag:function(){},onDragStop:function(){}},t}(v.PureComponent);/**
460
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
461
- * @license MIT
462
- *
463
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
464
- * @license MIT
465
- *
466
- * Originally forked from (with the author's permission):
467
- * Fabrice Bellard's javascript vt100 for jslinux:
468
- * http://bellard.org/jslinux/
469
- * Copyright (c) 2011 Fabrice Bellard
470
- */var Jk=Object.defineProperty,NT=Object.getOwnPropertyDescriptor,jT=(e,t)=>{for(var n in t)Jk(e,n,{get:t[n],enumerable:!0})},at=(e,t,n,r)=>{for(var s=r>1?void 0:r?NT(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=(r?o(t,n,s):o(s))||s);return r&&s&&Jk(t,n,s),s},oe=(e,t)=>(n,r)=>t(n,r,e),z0="Terminal input",Dm={get:()=>z0,set:e=>z0=e},$0="Too much output to announce, navigate to rows manually to read",Mm={get:()=>$0,set:e=>$0=e};function ET(e){return e.replace(/\r?\n/g,"\r")}function RT(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function TT(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function PT(e,t,n,r){if(e.stopPropagation(),e.clipboardData){let s=e.clipboardData.getData("text/plain");Zk(s,t,n,r)}}function Zk(e,t,n,r){e=ET(e),e=RT(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function eC(e,t,n){let r=n.getBoundingClientRect(),s=e.clientX-r.left-10,i=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${s}px`,t.style.top=`${i}px`,t.style.zIndex="1000",t.focus()}function H0(e,t,n,r,s){eC(e,t,n),s&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Ws(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Ch(e,t=0,n=e.length){let r="";for(let s=t;s<n;++s){let i=e[s];i>65535?(i-=65536,r+=String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):r+=String.fromCharCode(i)}return r}var DT=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,s=0;if(this._interim){let i=e.charCodeAt(s++);56320<=i&&i<=57343?t[r++]=(this._interim-55296)*1024+i-56320+65536:(t[r++]=this._interim,t[r++]=i),this._interim=0}for(let i=s;i<n;++i){let o=e.charCodeAt(i);if(55296<=o&&o<=56319){if(++i>=n)return this._interim=o,r;let l=e.charCodeAt(i);56320<=l&&l<=57343?t[r++]=(o-55296)*1024+l-56320+65536:(t[r++]=o,t[r++]=l);continue}o!==65279&&(t[r++]=o)}return r}},MT=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,s,i,o,l,c=0,u=0;if(this.interim[0]){let p=!1,f=this.interim[0];f&=(f&224)===192?31:(f&240)===224?15:7;let m=0,g;for(;(g=this.interim[++m]&63)&&m<4;)f<<=6,f|=g;let b=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,x=b-m;for(;u<x;){if(u>=n)return 0;if(g=e[u++],(g&192)!==128){u--,p=!0;break}else this.interim[m++]=g,f<<=6,f|=g&63}p||(b===2?f<128?u--:t[r++]=f:b===3?f<2048||f>=55296&&f<=57343||f===65279||(t[r++]=f):f<65536||f>1114111||(t[r++]=f)),this.interim.fill(0)}let h=n-4,d=u;for(;d<n;){for(;d<h&&!((s=e[d])&128)&&!((i=e[d+1])&128)&&!((o=e[d+2])&128)&&!((l=e[d+3])&128);)t[r++]=s,t[r++]=i,t[r++]=o,t[r++]=l,d+=4;if(s=e[d++],s<128)t[r++]=s;else if((s&224)===192){if(d>=n)return this.interim[0]=s,r;if(i=e[d++],(i&192)!==128){d--;continue}if(c=(s&31)<<6|i&63,c<128){d--;continue}t[r++]=c}else if((s&240)===224){if(d>=n)return this.interim[0]=s,r;if(i=e[d++],(i&192)!==128){d--;continue}if(d>=n)return this.interim[0]=s,this.interim[1]=i,r;if(o=e[d++],(o&192)!==128){d--;continue}if(c=(s&15)<<12|(i&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((s&248)===240){if(d>=n)return this.interim[0]=s,r;if(i=e[d++],(i&192)!==128){d--;continue}if(d>=n)return this.interim[0]=s,this.interim[1]=i,r;if(o=e[d++],(o&192)!==128){d--;continue}if(d>=n)return this.interim[0]=s,this.interim[1]=i,this.interim[2]=o,r;if(l=e[d++],(l&192)!==128){d--;continue}if(c=(s&7)<<18|(i&63)<<12|(o&63)<<6|l&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},tC="",si=" ",Tc=class nC{constructor(){this.fg=0,this.bg=0,this.extended=new zd}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new nC;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},zd=class rC{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new rC(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},cr=class sC extends Tc{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new zd,this.combinedData=""}static fromCharData(t){let n=new sC;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ws(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(r-55296)*1024+s-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},W0="di$target",Lm="di$dependencies",Cf=new Map;function LT(e){return e[Lm]||[]}function It(e){if(Cf.has(e))return Cf.get(e);let t=function(n,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");AT(t,n,s)};return t._id=e,Cf.set(e,t),t}function AT(e,t,n){t[W0]===t?t[Lm].push({id:e,index:n}):(t[Lm]=[{id:e,index:n}],t[W0]=t)}var vn=It("BufferService"),iC=It("CoreMouseService"),xo=It("CoreService"),OT=It("CharsetService"),ix=It("InstantiationService"),oC=It("LogService"),xn=It("OptionsService"),aC=It("OscLinkService"),IT=It("UnicodeService"),Pc=It("DecorationService"),Am=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var h;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],s=this._optionsService.rawOptions.linkHandler,i=new cr,o=n.getTrimmedLength(),l=-1,c=-1,u=!1;for(let d=0;d<o;d++)if(!(c===-1&&!n.hasContent(d))){if(n.loadCell(d,i),i.hasExtendedAttrs()&&i.extended.urlId)if(c===-1){c=d,l=i.extended.urlId;continue}else u=i.extended.urlId!==l;else c!==-1&&(u=!0);if(u||c!==-1&&d===o-1){let p=(h=this._oscLinkService.getLinkData(l))==null?void 0:h.uri;if(p){let f={start:{x:c+1,y:e},end:{x:d+(!u&&d===o-1?1:0),y:e}},m=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{let g=new URL(p);["http:","https:"].includes(g.protocol)||(m=!0)}catch{m=!0}m||r.push({text:p,range:f,activate:(g,b)=>s?s.activate(g,b,f):BT(g,b),hover:(g,b)=>{var x;return(x=s==null?void 0:s.hover)==null?void 0:x.call(s,g,b,f)},leave:(g,b)=>{var x;return(x=s==null?void 0:s.leave)==null?void 0:x.call(s,g,b,f)}})}u=!1,i.hasExtendedAttrs()&&i.extended.urlId?(c=d,l=i.extended.urlId):(c=-1,l=-1)}}t(r)}};Am=at([oe(0,vn),oe(1,xn),oe(2,aC)],Am);function BT(e,t){if(confirm(`Do you want to navigate to ${t}?
471
-
472
- WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Nh=It("CharSizeService"),Cs=It("CoreBrowserService"),ox=It("MouseService"),Ns=It("RenderService"),FT=It("SelectionService"),lC=It("CharacterJoinerService"),La=It("ThemeService"),cC=It("LinkProviderService"),zT=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?U0.isErrorNoTelemetry(e)?new U0(e.message+`
473
-
474
- `+e.stack):new Error(e.message+`
475
-
476
- `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},$T=new zT;function Ku(e){HT(e)||$T.onUnexpectedError(e)}var Om="Canceled";function HT(e){return e instanceof WT?!0:e instanceof Error&&e.name===Om&&e.message===Om}var WT=class extends Error{constructor(){super(Om),this.name=this.message}};function UT(e){return new Error(`Illegal argument: ${e}`)}var U0=class Im extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Im)return t;let n=new Im;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Bm=class uC extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,uC.prototype)}};function In(e,t=0){return e[e.length-(1+t)]}var qT;(e=>{function t(i){return i<0}e.isLessThan=t;function n(i){return i<=0}e.isLessThanOrEqual=n;function r(i){return i>0}e.isGreaterThan=r;function s(i){return i===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(qT||(qT={}));function KT(e,t){let n=this,r=!1,s;return function(){return r||(r=!0,t||(s=e.apply(n,arguments))),s}}var dC;(e=>{function t(w){return w&&typeof w=="object"&&typeof w[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*s(w){yield w}e.single=s;function i(w){return t(w)?w:s(w)}e.wrap=i;function o(w){return w||n}e.from=o;function*l(w){for(let C=w.length-1;C>=0;C--)yield w[C]}e.reverse=l;function c(w){return!w||w[Symbol.iterator]().next().done===!0}e.isEmpty=c;function u(w){return w[Symbol.iterator]().next().value}e.first=u;function h(w,C){let S=0;for(let R of w)if(C(R,S++))return!0;return!1}e.some=h;function d(w,C){for(let S of w)if(C(S))return S}e.find=d;function*p(w,C){for(let S of w)C(S)&&(yield S)}e.filter=p;function*f(w,C){let S=0;for(let R of w)yield C(R,S++)}e.map=f;function*m(w,C){let S=0;for(let R of w)yield*C(R,S++)}e.flatMap=m;function*g(...w){for(let C of w)yield*C}e.concat=g;function b(w,C,S){let R=S;for(let T of w)R=C(R,T);return R}e.reduce=b;function*x(w,C,S=w.length){for(C<0&&(C+=w.length),S<0?S+=w.length:S>w.length&&(S=w.length);C<S;C++)yield w[C]}e.slice=x;function y(w,C=Number.POSITIVE_INFINITY){let S=[];if(C===0)return[S,w];let R=w[Symbol.iterator]();for(let T=0;T<C;T++){let F=R.next();if(F.done)return[S,e.empty()];S.push(F.value)}return[S,{[Symbol.iterator](){return R}}]}e.consume=y;async function _(w){let C=[];for await(let S of w)C.push(S);return Promise.resolve(C)}e.asyncToArray=_})(dC||(dC={}));function lo(e){if(dC.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function VT(...e){return Ye(()=>lo(e))}function Ye(e){return{dispose:KT(()=>{e()})}}var hC=class fC{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{lo(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?fC.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};hC.DISABLE_DISPOSED_WARNING=!1;var pi=hC,Ce=class{constructor(){this._store=new pi,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};Ce.None=Object.freeze({dispose(){}});var Sa=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){var n;this._isDisposed||t===this._value||((n=this._value)==null||n.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){var t;this._isDisposed=!0,(t=this._value)==null||t.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},fs=typeof window=="object"?window:globalThis,Fm=class zm{constructor(t){this.element=t,this.next=zm.Undefined,this.prev=zm.Undefined}};Fm.Undefined=new Fm(void 0);var Xe=Fm,q0=class{constructor(){this._first=Xe.Undefined,this._last=Xe.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Xe.Undefined}clear(){let e=this._first;for(;e!==Xe.Undefined;){let t=e.next;e.prev=Xe.Undefined,e.next=Xe.Undefined,e=t}this._first=Xe.Undefined,this._last=Xe.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Xe(e);if(this._first===Xe.Undefined)this._first=n,this._last=n;else if(t){let s=this._last;this._last=n,n.prev=s,s.next=n}else{let s=this._first;this._first=n,n.next=s,s.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==Xe.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Xe.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Xe.Undefined&&e.next!==Xe.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Xe.Undefined&&e.next===Xe.Undefined?(this._first=Xe.Undefined,this._last=Xe.Undefined):e.next===Xe.Undefined?(this._last=this._last.prev,this._last.next=Xe.Undefined):e.prev===Xe.Undefined&&(this._first=this._first.next,this._first.prev=Xe.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Xe.Undefined;)yield e.element,e=e.next}},YT=globalThis.performance&&typeof globalThis.performance.now=="function",QT=class pC{static create(t){return new pC(t)}constructor(t){this._now=YT&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Wt;(e=>{e.None=()=>Ce.None;function t(A,M){return d(A,()=>{},0,void 0,!0,void 0,M)}e.defer=t;function n(A){return(M,j=null,E)=>{let $=!1,q;return q=A(D=>{if(!$)return q?q.dispose():$=!0,M.call(j,D)},null,E),$&&q.dispose(),q}}e.once=n;function r(A,M,j){return u((E,$=null,q)=>A(D=>E.call($,M(D)),null,q),j)}e.map=r;function s(A,M,j){return u((E,$=null,q)=>A(D=>{M(D),E.call($,D)},null,q),j)}e.forEach=s;function i(A,M,j){return u((E,$=null,q)=>A(D=>M(D)&&E.call($,D),null,q),j)}e.filter=i;function o(A){return A}e.signal=o;function l(...A){return(M,j=null,E)=>{let $=VT(...A.map(q=>q(D=>M.call(j,D))));return h($,E)}}e.any=l;function c(A,M,j,E){let $=j;return r(A,q=>($=M($,q),$),E)}e.reduce=c;function u(A,M){let j,E={onWillAddFirstListener(){j=A($.fire,$)},onDidRemoveLastListener(){j==null||j.dispose()}},$=new ee(E);return M==null||M.add($),$.event}function h(A,M){return M instanceof Array?M.push(A):M&&M.add(A),A}function d(A,M,j=100,E=!1,$=!1,q,D){let H,N,B,O=0,k,W={leakWarningThreshold:q,onWillAddFirstListener(){H=A(z=>{O++,N=M(N,z),E&&!B&&(Q.fire(N),N=void 0),k=()=>{let X=N;N=void 0,B=void 0,(!E||O>1)&&Q.fire(X),O=0},typeof j=="number"?(clearTimeout(B),B=setTimeout(k,j)):B===void 0&&(B=0,queueMicrotask(k))})},onWillRemoveListener(){$&&O>0&&(k==null||k())},onDidRemoveLastListener(){k=void 0,H.dispose()}},Q=new ee(W);return D==null||D.add(Q),Q.event}e.debounce=d;function p(A,M=0,j){return e.debounce(A,(E,$)=>E?(E.push($),E):[$],M,void 0,!0,void 0,j)}e.accumulate=p;function f(A,M=(E,$)=>E===$,j){let E=!0,$;return i(A,q=>{let D=E||!M(q,$);return E=!1,$=q,D},j)}e.latch=f;function m(A,M,j){return[e.filter(A,M,j),e.filter(A,E=>!M(E),j)]}e.split=m;function g(A,M=!1,j=[],E){let $=j.slice(),q=A(N=>{$?$.push(N):H.fire(N)});E&&E.add(q);let D=()=>{$==null||$.forEach(N=>H.fire(N)),$=null},H=new ee({onWillAddFirstListener(){q||(q=A(N=>H.fire(N)),E&&E.add(q))},onDidAddFirstListener(){$&&(M?setTimeout(D):D())},onDidRemoveLastListener(){q&&q.dispose(),q=null}});return E&&E.add(H),H.event}e.buffer=g;function b(A,M){return(j,E,$)=>{let q=M(new y);return A(function(D){let H=q.evaluate(D);H!==x&&j.call(E,H)},void 0,$)}}e.chain=b;let x=Symbol("HaltChainable");class y{constructor(){this.steps=[]}map(M){return this.steps.push(M),this}forEach(M){return this.steps.push(j=>(M(j),j)),this}filter(M){return this.steps.push(j=>M(j)?j:x),this}reduce(M,j){let E=j;return this.steps.push($=>(E=M(E,$),E)),this}latch(M=(j,E)=>j===E){let j=!0,E;return this.steps.push($=>{let q=j||!M($,E);return j=!1,E=$,q?$:x}),this}evaluate(M){for(let j of this.steps)if(M=j(M),M===x)break;return M}}function _(A,M,j=E=>E){let E=(...H)=>D.fire(j(...H)),$=()=>A.on(M,E),q=()=>A.removeListener(M,E),D=new ee({onWillAddFirstListener:$,onDidRemoveLastListener:q});return D.event}e.fromNodeEventEmitter=_;function w(A,M,j=E=>E){let E=(...H)=>D.fire(j(...H)),$=()=>A.addEventListener(M,E),q=()=>A.removeEventListener(M,E),D=new ee({onWillAddFirstListener:$,onDidRemoveLastListener:q});return D.event}e.fromDOMEventEmitter=w;function C(A){return new Promise(M=>n(A)(M))}e.toPromise=C;function S(A){let M=new ee;return A.then(j=>{M.fire(j)},()=>{M.fire(void 0)}).finally(()=>{M.dispose()}),M.event}e.fromPromise=S;function R(A,M){return A(j=>M.fire(j))}e.forward=R;function T(A,M,j){return M(j),A(E=>M(E))}e.runAndSubscribe=T;class F{constructor(M,j){this._observable=M,this._counter=0,this._hasChanged=!1;let E={onWillAddFirstListener:()=>{M.addObserver(this)},onDidRemoveLastListener:()=>{M.removeObserver(this)}};this.emitter=new ee(E),j&&j.add(this.emitter)}beginUpdate(M){this._counter++}handlePossibleChange(M){}handleChange(M,j){this._hasChanged=!0}endUpdate(M){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function P(A,M){return new F(A,M).emitter.event}e.fromObservable=P;function I(A){return(M,j,E)=>{let $=0,q=!1,D={beginUpdate(){$++},endUpdate(){$--,$===0&&(A.reportChanges(),q&&(q=!1,M.call(j)))},handlePossibleChange(){},handleChange(){q=!0}};A.addObserver(D),A.reportChanges();let H={dispose(){A.removeObserver(D)}};return E instanceof pi?E.add(H):Array.isArray(E)&&E.push(H),H}}e.fromObservableLight=I})(Wt||(Wt={}));var $m=class Hm{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Hm._idPool++}`,Hm.all.add(this)}start(t){this._stopWatch=new QT,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};$m.all=new Set,$m._idPool=0;var XT=$m,GT=-1,mC=class gC{constructor(t,n,r=(gC._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let r=this.threshold;if(r<=0||n<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[i,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(i);let c=new eP(l,i);this._errorHandler(c)}return()=>{let i=this._stacks.get(t.value)||0;this._stacks.set(t.value,i-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[r,s]of this._stacks)(!t||n<s)&&(t=[r,s],n=s);return t}};mC._idPool=1;var JT=mC,ZT=class vC{constructor(t){this.value=t}static create(){let t=new Error;return new vC(t.stack??"")}print(){console.warn(this.value.split(`
477
- `).slice(2).join(`
478
- `))}},eP=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},tP=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},nP=0,Nf=class{constructor(e){this.value=e,this.id=nP++}},rP=2,sP,ee=class{constructor(e){var t,n,r,s;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new JT((e==null?void 0:e.onListenerError)??Ku,((n=this._options)==null?void 0:n.leakWarningThreshold)??GT):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new XT(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var e,t,n,r;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(n=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||n.call(t),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,t,n)=>{var o,l,c,u,h;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new tP(`${d}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(((o=this._options)==null?void 0:o.onListenerError)||Ku)(f),Ce.None}if(this._disposed)return Ce.None;t&&(e=e.bind(t));let r=new Nf(e),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=ZT.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Nf?(this._deliveryQueue??(this._deliveryQueue=new iP),this._listeners=[this._listeners,r]):this._listeners.push(r):((c=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null||c.call(l,this),this._listeners=r,(h=(u=this._options)==null?void 0:u.onDidAddFirstListener)==null||h.call(u,this)),this._size++;let i=Ye(()=>{s==null||s(),this._removeListener(r)});return n instanceof pi?n.add(i):Array.isArray(n)&&n.push(i),i}),this._event}_removeListener(e){var s,i,o,l;if((i=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||i.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(l=(o=this._options)==null?void 0:o.onDidRemoveLastListener)==null||l.call(o,this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*rP<=t.length){let c=0;for(let u=0;u<t.length;u++)t[u]?t[c++]=t[u]:r&&(this._deliveryQueue.end--,c<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=c}}_deliver(e,t){var r;if(!e)return;let n=((r=this._options)==null?void 0:r.onListenerError)||Ku;if(!n){e.value(t);return}try{e.value(t)}catch(s){n(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,n,r,s;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof Nf)this._deliver(this._listeners,e);else{let i=this._deliveryQueue;i.enqueue(this,e,this._listeners.length),this._deliverQueue(i)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},iP=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Wm=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ee,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ee,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Wm.INSTANCE=new Wm;var ax=Wm;function oP(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}ax.INSTANCE.onDidChangeZoomLevel;function aP(e){return ax.INSTANCE.getZoomFactor(e)}ax.INSTANCE.onDidChangeFullscreen;var Aa=typeof navigator=="object"?navigator.userAgent:"",Um=Aa.indexOf("Firefox")>=0,lP=Aa.indexOf("AppleWebKit")>=0,lx=Aa.indexOf("Chrome")>=0,cP=!lx&&Aa.indexOf("Safari")>=0;Aa.indexOf("Electron/")>=0;Aa.indexOf("Android")>=0;var jf=!1;if(typeof fs.matchMedia=="function"){let e=fs.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=fs.matchMedia("(display-mode: fullscreen)");jf=e.matches,oP(fs,e,({matches:n})=>{jf&&t.matches||(jf=n)})}var Ko="en",qm=!1,Km=!1,Vu=!1,xC=!1,du,Yu=Ko,K0=Ko,uP,gr,Xi=globalThis,$t,Pw;typeof Xi.vscode<"u"&&typeof Xi.vscode.process<"u"?$t=Xi.vscode.process:typeof process<"u"&&typeof((Pw=process==null?void 0:process.versions)==null?void 0:Pw.node)=="string"&&($t=process);var Dw,dP=typeof((Dw=$t==null?void 0:$t.versions)==null?void 0:Dw.electron)=="string",hP=dP&&($t==null?void 0:$t.type)==="renderer",Mw;if(typeof $t=="object"){qm=$t.platform==="win32",Km=$t.platform==="darwin",Vu=$t.platform==="linux",Vu&&$t.env.SNAP&&$t.env.SNAP_REVISION,$t.env.CI||$t.env.BUILD_ARTIFACTSTAGINGDIRECTORY,du=Ko,Yu=Ko;let e=$t.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);du=t.userLocale,K0=t.osLocale,Yu=t.resolvedLanguage||Ko,uP=(Mw=t.languagePack)==null?void 0:Mw.translationsConfigFile}catch{}xC=!0}else typeof navigator=="object"&&!hP?(gr=navigator.userAgent,qm=gr.indexOf("Windows")>=0,Km=gr.indexOf("Macintosh")>=0,(gr.indexOf("Macintosh")>=0||gr.indexOf("iPad")>=0||gr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Vu=gr.indexOf("Linux")>=0,(gr==null?void 0:gr.indexOf("Mobi"))>=0,Yu=globalThis._VSCODE_NLS_LANGUAGE||Ko,du=navigator.language.toLowerCase(),K0=du):console.error("Unable to resolve platform.");var yC=qm,Kr=Km,fP=Vu,V0=xC,Xr=gr,Ls=Yu,pP;(e=>{function t(){return Ls}e.value=t;function n(){return Ls.length===2?Ls==="en":Ls.length>=3?Ls[0]==="e"&&Ls[1]==="n"&&Ls[2]==="-":!1}e.isDefaultVariant=n;function r(){return Ls==="en"}e.isDefault=r})(pP||(pP={}));var mP=typeof Xi.postMessage=="function"&&!Xi.importScripts;(()=>{if(mP){let e=[];Xi.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let r=0,s=e.length;r<s;r++){let i=e[r];if(i.id===n.data.vscodeScheduleAsyncWork){e.splice(r,1),i.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Xi.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var gP=!!(Xr&&Xr.indexOf("Chrome")>=0);Xr&&Xr.indexOf("Firefox")>=0;!gP&&Xr&&Xr.indexOf("Safari")>=0;Xr&&Xr.indexOf("Edg/")>=0;Xr&&Xr.indexOf("Android")>=0;var ko=typeof navigator=="object"?navigator:{};V0||document.queryCommandSupported&&document.queryCommandSupported("copy")||ko&&ko.clipboard&&ko.clipboard.writeText,V0||ko&&ko.clipboard&&ko.clipboard.readText;var cx=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Ef=new cx,Y0=new cx,Q0=new cx,vP=new Array(230),_C;(e=>{function t(l){return Ef.keyCodeToStr(l)}e.toString=t;function n(l){return Ef.strToKeyCode(l)}e.fromString=n;function r(l){return Y0.keyCodeToStr(l)}e.toUserSettingsUS=r;function s(l){return Q0.keyCodeToStr(l)}e.toUserSettingsGeneral=s;function i(l){return Y0.strToKeyCode(l)||Q0.strToKeyCode(l)}e.fromUserSettings=i;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Ef.keyCodeToStr(l)}e.toElectronAccelerator=o})(_C||(_C={}));var xP=class bC{constructor(t,n,r,s,i){this.ctrlKey=t,this.shiftKey=n,this.altKey=r,this.metaKey=s,this.keyCode=i}equals(t){return t instanceof bC&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",r=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${t}${n}${r}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new yP([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},yP=class{constructor(e){if(e.length===0)throw UT("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function _P(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return _C.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(Um)switch(t){case 59:return 85;case 60:if(fP)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Kr)return 57;break}else if(lP&&(Kr&&t===93||!Kr&&t===92))return 57;return vP[t]||0}var bP=Kr?256:2048,wP=512,SP=1024,kP=Kr?2048:256,X0=class{constructor(e){var n;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(n=t.getModifierState)==null?void 0:n.call(t,"AltGraph"),this.keyCode=_P(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=bP),this.altKey&&(t|=wP),this.shiftKey&&(t|=SP),this.metaKey&&(t|=kP),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new xP(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},G0=new WeakMap;function CP(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var NP=class{static getSameOriginWindowChain(e){let t=G0.get(e);if(!t){t=[],G0.set(e,t);let n=e,r;do r=CP(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,s=this.getSameOriginWindowChain(e);for(let i of s){let o=i.window.deref();if(n+=(o==null?void 0:o.scrollY)??0,r+=(o==null?void 0:o.scrollX)??0,o===t||!i.iframeElement)break;let l=i.iframeElement.getBoundingClientRect();n+=l.top,r+=l.left}return{top:n,left:r}}},hu=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=NP.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},J0=class{constructor(e,t=0,n=0){var s;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(lx){let i=navigator.userAgent.match(/Chrome\/(\d+)/);r=(i?parseInt(i[1]):123)<=122}if(e){let i=e,o=e,l=((s=e.view)==null?void 0:s.devicePixelRatio)||1;if(typeof i.wheelDeltaY<"u")r?this.deltaY=i.wheelDeltaY/(120*l):this.deltaY=i.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let c=e;c.deltaMode===c.DOM_DELTA_LINE?Um&&!Kr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof i.wheelDeltaX<"u")cP&&yC?this.deltaX=-(i.wheelDeltaX/120):r?this.deltaX=i.wheelDeltaX/(120*l):this.deltaX=i.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let c=e;c.deltaMode===c.DOM_DELTA_LINE?Um&&!Kr?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*l):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},wC=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),jP;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof EP?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Wt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:wC})})(jP||(jP={}));var EP=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?wC:(this._emitter||(this._emitter=new ee),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},ux=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Bm("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Bm("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},RP=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new Bm("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=Ye(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},TP;(e=>{async function t(r){let s,i=await Promise.all(r.map(o=>o.then(l=>l,l=>{s||(s=l)})));if(typeof s<"u")throw s;return i}e.settled=t;function n(r){return new Promise(async(s,i)=>{try{await r(s,i)}catch(o){i(o)}})}e.withAsyncBody=n})(TP||(TP={}));var Z0=class Gn{static fromArray(t){return new Gn(n=>{n.emitMany(t)})}static fromPromise(t){return new Gn(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Gn(async n=>{await Promise.all(t.map(async r=>n.emitOne(await r)))})}static merge(t){return new Gn(async n=>{await Promise.all(t.map(async r=>{for await(let s of r)n.emitOne(s)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new ee,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Wt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new Gn(async r=>{for await(let s of t)r.emitOne(n(s))})}map(t){return Gn.map(this,t)}static filter(t,n){return new Gn(async r=>{for await(let s of t)n(s)&&r.emitOne(s)})}filter(t){return Gn.filter(this,t)}static coalesce(t){return Gn.filter(t,n=>!!n)}coalesce(){return Gn.coalesce(this)}static async toPromise(t){let n=[];for await(let r of t)n.push(r);return n}toPromise(){return Gn.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Z0.EMPTY=Z0.fromArray([]);var{getWindow:Wr,getWindowId:PP,onDidRegisterWindow:DP}=function(){let e=new Map,t={window:fs,disposables:new pi};e.set(fs.vscodeWindowId,t);let n=new ee,r=new ee,s=new ee;function i(o,l){return(typeof o=="number"?e.get(o):void 0)??(l?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(o){if(e.has(o.vscodeWindowId))return Ce.None;let l=new pi,c={window:o,disposables:l.add(new pi)};return e.set(o.vscodeWindowId,c),l.add(Ye(()=>{e.delete(o.vscodeWindowId),r.fire(o)})),l.add(ge(o,Tt.BEFORE_UNLOAD,()=>{s.fire(o)})),n.fire(c),l},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:i,getWindow(o){var u;let l=o;if((u=l==null?void 0:l.ownerDocument)!=null&&u.defaultView)return l.ownerDocument.defaultView.window;let c=o;return c!=null&&c.view?c.view.window:fs},getDocument(o){return Wr(o).document}}}(),MP=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function ge(e,t,n,r){return new MP(e,t,n,r)}var e_=function(e,t,n,r){return ge(e,t,n,r)},dx,LP=class extends RP{constructor(e){super(),this.defaultTarget=e&&Wr(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},t_=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Ku(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,s=i=>{n.set(i,!1);let o=e.get(i)??[];for(t.set(i,o),e.set(i,[]),r.set(i,!0);o.length>0;)o.sort(t_.sort),o.shift().execute();r.set(i,!1)};dx=(i,o,l=0)=>{let c=PP(i),u=new t_(o,l),h=e.get(c);return h||(h=[],e.set(c,h)),h.push(u),n.get(c)||(n.set(c,!0),i.requestAnimationFrame(()=>s(c))),u}})();function AP(e){let t=e.getBoundingClientRect(),n=Wr(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Tt={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},OP=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Sn(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Sn(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Sn(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Sn(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Sn(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Sn(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Sn(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Sn(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Sn(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Sn(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Sn(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Sn(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Sn(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Sn(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Sn(e){return typeof e=="number"?`${e}px`:e}function Dl(e){return new OP(e)}var SC=class{constructor(){this._hooks=new pi,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=s;let i=e;try{e.setPointerCapture(t),this._hooks.add(Ye(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{i=Wr(e)}this._hooks.add(ge(i,Tt.POINTER_MOVE,o=>{if(o.buttons!==n){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(ge(i,Tt.POINTER_UP,o=>this.stopMonitoring(!0)))}};function IP(e,t,n){let r=null,s=null;if(typeof n.value=="function"?(r="value",s=n.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(r="get",s=n.get),!s)throw new Error("not supported");let i=`$memoize$${t}`;n[r]=function(...o){return this.hasOwnProperty(i)||Object.defineProperty(this,i,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,o)}),this[i]}}var Lr;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Lr||(Lr={}));var fl=class Gt extends Ce{constructor(){super(),this.dispatched=!1,this.targets=new q0,this.ignoreTargets=new q0,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Wt.runAndSubscribe(DP,({window:t,disposables:n})=>{n.add(ge(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),n.add(ge(t.document,"touchend",r=>this.onTouchEnd(t,r))),n.add(ge(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:fs,disposables:this._store}))}static addTarget(t){if(!Gt.isTouchDevice())return Ce.None;Gt.INSTANCE||(Gt.INSTANCE=new Gt);let n=Gt.INSTANCE.targets.push(t);return Ye(n)}static ignoreTarget(t){if(!Gt.isTouchDevice())return Ce.None;Gt.INSTANCE||(Gt.INSTANCE=new Gt);let n=Gt.INSTANCE.ignoreTargets.push(t);return Ye(n)}static isTouchDevice(){return"ontouchstart"in fs||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,s=t.targetTouches.length;r<s;r++){let i=t.targetTouches.item(r);this.activeTouches[i.identifier]={id:i.identifier,initialTarget:i.target,initialTimeStamp:n,initialPageX:i.pageX,initialPageY:i.pageY,rollingTimestamps:[n],rollingPageX:[i.pageX],rollingPageY:[i.pageY]};let o=this.newGestureEvent(Lr.Start,i.target);o.pageX=i.pageX,o.pageY=i.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let r=Date.now(),s=Object.keys(this.activeTouches).length;for(let i=0,o=n.changedTouches.length;i<o;i++){let l=n.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let c=this.activeTouches[l.identifier],u=Date.now()-c.initialTimeStamp;if(u<Gt.HOLD_DELAY&&Math.abs(c.initialPageX-In(c.rollingPageX))<30&&Math.abs(c.initialPageY-In(c.rollingPageY))<30){let h=this.newGestureEvent(Lr.Tap,c.initialTarget);h.pageX=In(c.rollingPageX),h.pageY=In(c.rollingPageY),this.dispatchEvent(h)}else if(u>=Gt.HOLD_DELAY&&Math.abs(c.initialPageX-In(c.rollingPageX))<30&&Math.abs(c.initialPageY-In(c.rollingPageY))<30){let h=this.newGestureEvent(Lr.Contextmenu,c.initialTarget);h.pageX=In(c.rollingPageX),h.pageY=In(c.rollingPageY),this.dispatchEvent(h)}else if(s===1){let h=In(c.rollingPageX),d=In(c.rollingPageY),p=In(c.rollingTimestamps)-c.rollingTimestamps[0],f=h-c.rollingPageX[0],m=d-c.rollingPageY[0],g=[...this.targets].filter(b=>c.initialTarget instanceof Node&&b.contains(c.initialTarget));this.inertia(t,g,r,Math.abs(f)/p,f>0?1:-1,h,Math.abs(m)/p,m>0?1:-1,d)}this.dispatchEvent(this.newGestureEvent(Lr.End,c.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=n,r.tapCount=0,r}dispatchEvent(t){if(t.type===Lr.Tap){let n=new Date().getTime(),r=0;n-this._lastSetTapCountTime>Gt.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===Lr.Change||t.type===Lr.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let n=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let s=0,i=t.initialTarget;for(;i&&i!==r;)s++,i=i.parentElement;n.push([s,r])}n.sort((r,s)=>r[0]-s[0]);for(let[r,s]of n)s.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,s,i,o,l,c,u){this.handle=dx(t,()=>{let h=Date.now(),d=h-r,p=0,f=0,m=!0;s+=Gt.SCROLL_FRICTION*d,l+=Gt.SCROLL_FRICTION*d,s>0&&(m=!1,p=i*s*d),l>0&&(m=!1,f=c*l*d);let g=this.newGestureEvent(Lr.Change);g.translationX=p,g.translationY=f,n.forEach(b=>b.dispatchEvent(g)),m||this.inertia(t,n,h,s,i,o+p,l,c,u+f)})}onTouchMove(t){let n=Date.now();for(let r=0,s=t.changedTouches.length;r<s;r++){let i=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(i.identifier))){console.warn("end of an UNKNOWN touch",i);continue}let o=this.activeTouches[i.identifier],l=this.newGestureEvent(Lr.Change,o.initialTarget);l.translationX=i.pageX-In(o.rollingPageX),l.translationY=i.pageY-In(o.rollingPageY),l.pageX=i.pageX,l.pageY=i.pageY,this.dispatchEvent(l),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(i.pageX),o.rollingPageY.push(i.pageY),o.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};fl.SCROLL_FRICTION=-.005,fl.HOLD_DELAY=700,fl.CLEAR_TAP_COUNT_TIME=400,at([IP],fl,"isTouchDevice",1);var BP=fl,hx=class extends Ce{onclick(e,t){this._register(ge(e,Tt.CLICK,n=>t(new hu(Wr(e),n))))}onmousedown(e,t){this._register(ge(e,Tt.MOUSE_DOWN,n=>t(new hu(Wr(e),n))))}onmouseover(e,t){this._register(ge(e,Tt.MOUSE_OVER,n=>t(new hu(Wr(e),n))))}onmouseleave(e,t){this._register(ge(e,Tt.MOUSE_LEAVE,n=>t(new hu(Wr(e),n))))}onkeydown(e,t){this._register(ge(e,Tt.KEY_DOWN,n=>t(new X0(n))))}onkeyup(e,t){this._register(ge(e,Tt.KEY_UP,n=>t(new X0(n))))}oninput(e,t){this._register(ge(e,Tt.INPUT,t))}onblur(e,t){this._register(ge(e,Tt.BLUR,t))}onfocus(e,t){this._register(ge(e,Tt.FOCUS,t))}onchange(e,t){this._register(ge(e,Tt.CHANGE,t))}ignoreGesture(e){return BP.ignoreTarget(e)}},n_=11,FP=class extends hx{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=n_+"px",this.domNode.style.height=n_+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new SC),this._register(e_(this.bgDomNode,Tt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(e_(this.domNode,Tt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new LP),this._pointerdownScheduleRepeatTimer=this._register(new ux)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Wr(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},zP=class Vm{constructor(t,n,r,s,i,o,l){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,r=r|0,s=s|0,i=i|0,o=o|0,l=l|0),this.rawScrollLeft=s,this.rawScrollTop=l,n<0&&(n=0),s+n>r&&(s=r-n),s<0&&(s=0),i<0&&(i=0),l+i>o&&(l=o-i),l<0&&(l=0),this.width=n,this.scrollWidth=r,this.scrollLeft=s,this.height=i,this.scrollHeight=o,this.scrollTop=l}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new Vm(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Vm(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let r=this.width!==t.width,s=this.scrollWidth!==t.scrollWidth,i=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,l=this.scrollHeight!==t.scrollHeight,c=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:s,scrollLeftChanged:i,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:c}}},$P=class extends Ce{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ee),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new zP(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var r;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;t?r=new s_(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=s_.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},r_=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Rf(e,t){let n=t-e;return function(r){return e+n*UP(r)}}function HP(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var s_=class Ym{constructor(t,n,r,s){this.from=t,this.to=n,this.duration=s,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,r){if(Math.abs(t-n)>2.5*r){let s,i;return t<n?(s=t+.75*r,i=n-.75*r):(s=t-.75*r,i=n+.75*r),HP(Rf(t,s),Rf(i,n),.33)}return Rf(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let r=this.scrollLeft(n),s=this.scrollTop(n);return new r_(r,s,!1)}return new r_(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return Ym.start(t,n,r)}static start(t,n,r){r=r+10;let s=Date.now()-10;return new Ym(t,n,s,r)}};function WP(e){return Math.pow(e,3)}function UP(e){return 1-WP(1-e)}var qP=class extends Ce{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new ux)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},KP=140,kC=class extends hx{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new qP(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new SC),this._shouldRender=!0,this.domNode=Dl(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(ge(this.domNode.domNode,Tt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new FP(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=Dl(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(ge(this.slider.domNode,Tt.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);n<=s&&s<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let s=AP(this.domNode.domNode);t=e.pageX-s.left,n=e.pageY-s.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{let i=this._sliderOrthogonalPointerPosition(s),o=Math.abs(i-n);if(yC&&o>KP){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let l=this._sliderPointerPosition(s)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(l))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},CC=class Qm{constructor(t,n,r,s,i,o){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=s,this._scrollSize=i,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Qm(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,r,s,i){let o=Math.max(0,r-t),l=Math.max(0,o-2*n),c=s>0&&s>r;if(!c)return{computedAvailableSize:Math.round(o),computedIsNeeded:c,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let u=Math.round(Math.max(20,Math.floor(r*l/s))),h=(l-u)/(s-r),d=i*h;return{computedAvailableSize:Math.round(o),computedIsNeeded:c,computedSliderSize:Math.round(u),computedSliderRatio:h,computedSliderPosition:Math.round(d)}}_refreshComputedValues(){let t=Qm._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,r=this._scrollPosition;return n<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},VP=class extends kC{constructor(e,t,n){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new CC(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,s.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},YP=class extends kC{constructor(e,t,n){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new CC(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,s.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},QP=500,i_=50,XP=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Xm=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,r=1,s=this._rear;do{let i=s===this._front?t:Math.pow(2,-r);if(t-=i,n+=this._memory[s].score*i,s===this._front)break;s=(this._capacity+s-1)%this._capacity,r++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(lx){let n=Wr(t.browserEvent),r=aP(n);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,r){let s=null,i=new XP(t,n,r);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(s=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=i),i.score=this._computeScore(i,s)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),n){let s=Math.abs(t.deltaX),i=Math.abs(t.deltaY),o=Math.abs(n.deltaX),l=Math.abs(n.deltaY),c=Math.max(Math.min(s,o),1),u=Math.max(Math.min(i,l),1),h=Math.max(s,o),d=Math.max(i,l);h%c===0&&d%u===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Xm.INSTANCE=new Xm;var GP=Xm,JP=class extends hx{constructor(e,t,n){super(),this._onScroll=this._register(new ee),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ee),this.onWillScroll=this._onWillScroll.event,this._options=eD(t),this._scrollable=n,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let r={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new YP(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new VP(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Dl(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Dl(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Dl(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new ux),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=lo(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Kr&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new J0(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=lo(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new J0(n))};this._mouseWheelToDispose.push(ge(this._listenOnDomNode,Tt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var s;if((s=e.browserEvent)!=null&&s.defaultPrevented)return;let t=GP.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let i=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+i===0?o=i=0:Math.abs(i)>=Math.abs(o)?o=0:i=0),this._options.flipAxes&&([i,o]=[o,i]);let l=!Kr&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!o&&(o=i,i=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,i=i*this._options.fastScrollSensitivity);let c=this._scrollable.getFutureScrollPosition(),u={};if(i){let h=i_*i,d=c.scrollTop-(h<0?Math.floor(h):Math.ceil(h));this._verticalScrollbar.writeScrollPosition(u,d)}if(o){let h=i_*o,d=c.scrollLeft-(h<0?Math.floor(h):Math.ceil(h));this._horizontalScrollbar.writeScrollPosition(u,d)}u=this._scrollable.validateScrollPosition(u),(c.scrollLeft!==u.scrollLeft||c.scrollTop!==u.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(u):this._scrollable.setScrollPositionNow(u),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?" left":"",s=t?" top":"",i=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${i}${s}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),QP)}},ZP=class extends JP{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function eD(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Kr&&(t.className+=" mac"),t}var Gm=class extends Ce{constructor(e,t,n,r,s,i,o,l){super(),this._bufferService=n,this._optionsService=o,this._renderService=l,this._onRequestScrollLines=this._register(new ee),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new $P({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:u=>dx(r.window,u)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new ZP(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(u=>{this._scrollableElement.updateOptions({handleMouseWheel:!(u&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Wt.runAndSubscribe(i.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=i.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Ye(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Ye(()=>this._styleElement.remove())),this._register(Wt.runAndSubscribe(i.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${i.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${i.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${i.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
479
- `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(u=>this._handleScroll(u)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};Gm=at([oe(2,vn),oe(3,Cs),oe(4,iC),oe(5,La),oe(6,xn),oe(7,Ns)],Gm);var Jm=class extends Ce{constructor(e,t,n,r,s){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(i=>this._removeDecoration(i))),this._register(Ye(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};Jm=at([oe(1,vn),oe(2,Cs),oe(3,Pc),oe(4,Ns)],Jm);var tD=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Dr={full:0,left:0,center:0,right:0},As={full:0,left:0,center:0,right:0},Ga={full:0,left:0,center:0,right:0},$d=class extends Ce{constructor(e,t,n,r,s,i,o,l){var u;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=s,this._optionsService=i,this._themeService=o,this._coreBrowserService=l,this._colorZoneStore=new tD,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(),(u=this._viewportElement.parentElement)==null||u.insertBefore(this._canvas,this._viewportElement),this._register(Ye(()=>{var h;return(h=this._canvas)==null?void 0:h.remove()}));let c=this._canvas.getContext("2d");if(c)this._ctx=c;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);As.full=this._canvas.width,As.left=e,As.center=t,As.right=e,this._refreshDrawHeightConstants(),Ga.full=1,Ga.left=1,Ga.center=1+As.left,Ga.right=1+As.left+As.center}_refreshDrawHeightConstants(){Dr.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Dr.left=t,Dr.center=t,Dr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Dr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Dr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Dr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Dr.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Ga[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Dr[e.position||"full"]/2),As[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Dr[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};$d=at([oe(2,vn),oe(3,Pc),oe(4,Ns),oe(5,xn),oe(6,La),oe(7,Cs)],$d);var Y;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
480
- `,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(Y||(Y={}));var Qu;(e=>(e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"))(Qu||(Qu={}));var NC;(e=>e.ST=`${Y.ESC}\\`)(NC||(NC={}));var Zm=class{constructor(e,t,n,r,s,i){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=s,this._renderService=i,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${Y.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(i.width,1)+"px",this._textarea.style.height=Math.max(i.height,1)+"px",this._textarea.style.lineHeight=i.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Zm=at([oe(2,vn),oe(3,xn),oe(4,xo),oe(5,Ns)],Zm);var Mt=0,Lt=0,At=0,st=0,o_={css:"#00000000",rgba:0},ft;(e=>{function t(s,i,o,l){return l!==void 0?`#${Ni(s)}${Ni(i)}${Ni(o)}${Ni(l)}`:`#${Ni(s)}${Ni(i)}${Ni(o)}`}e.toCss=t;function n(s,i,o,l=255){return(s<<24|i<<16|o<<8|l)>>>0}e.toRgba=n;function r(s,i,o,l){return{css:e.toCss(s,i,o,l),rgba:e.toRgba(s,i,o,l)}}e.toColor=r})(ft||(ft={}));var We;(e=>{function t(c,u){if(st=(u.rgba&255)/255,st===1)return{css:u.css,rgba:u.rgba};let h=u.rgba>>24&255,d=u.rgba>>16&255,p=u.rgba>>8&255,f=c.rgba>>24&255,m=c.rgba>>16&255,g=c.rgba>>8&255;Mt=f+Math.round((h-f)*st),Lt=m+Math.round((d-m)*st),At=g+Math.round((p-g)*st);let b=ft.toCss(Mt,Lt,At),x=ft.toRgba(Mt,Lt,At);return{css:b,rgba:x}}e.blend=t;function n(c){return(c.rgba&255)===255}e.isOpaque=n;function r(c,u,h){let d=Xu.ensureContrastRatio(c.rgba,u.rgba,h);if(d)return ft.toColor(d>>24&255,d>>16&255,d>>8&255)}e.ensureContrastRatio=r;function s(c){let u=(c.rgba|255)>>>0;return[Mt,Lt,At]=Xu.toChannels(u),{css:ft.toCss(Mt,Lt,At),rgba:u}}e.opaque=s;function i(c,u){return st=Math.round(u*255),[Mt,Lt,At]=Xu.toChannels(c.rgba),{css:ft.toCss(Mt,Lt,At,st),rgba:ft.toRgba(Mt,Lt,At,st)}}e.opacity=i;function o(c,u){return st=c.rgba&255,i(c,st*u/255)}e.multiplyOpacity=o;function l(c){return[c.rgba>>24&255,c.rgba>>16&255,c.rgba>>8&255]}e.toColorRGB=l})(We||(We={}));var Ge;(e=>{let t,n;try{let s=document.createElement("canvas");s.width=1,s.height=1;let i=s.getContext("2d",{willReadFrequently:!0});i&&(t=i,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Mt=parseInt(s.slice(1,2).repeat(2),16),Lt=parseInt(s.slice(2,3).repeat(2),16),At=parseInt(s.slice(3,4).repeat(2),16),ft.toColor(Mt,Lt,At);case 5:return Mt=parseInt(s.slice(1,2).repeat(2),16),Lt=parseInt(s.slice(2,3).repeat(2),16),At=parseInt(s.slice(3,4).repeat(2),16),st=parseInt(s.slice(4,5).repeat(2),16),ft.toColor(Mt,Lt,At,st);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let i=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(i)return Mt=parseInt(i[1]),Lt=parseInt(i[2]),At=parseInt(i[3]),st=Math.round((i[5]===void 0?1:parseFloat(i[5]))*255),ft.toColor(Mt,Lt,At,st);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Mt,Lt,At,st]=t.getImageData(0,0,1,1).data,st!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ft.toRgba(Mt,Lt,At,st),css:s}}e.toColor=r})(Ge||(Ge={}));var an;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,s,i){let o=r/255,l=s/255,c=i/255,u=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),h=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),d=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4);return u*.2126+h*.7152+d*.0722}e.relativeLuminance2=n})(an||(an={}));var Xu;(e=>{function t(o,l){if(st=(l&255)/255,st===1)return l;let c=l>>24&255,u=l>>16&255,h=l>>8&255,d=o>>24&255,p=o>>16&255,f=o>>8&255;return Mt=d+Math.round((c-d)*st),Lt=p+Math.round((u-p)*st),At=f+Math.round((h-f)*st),ft.toRgba(Mt,Lt,At)}e.blend=t;function n(o,l,c){let u=an.relativeLuminance(o>>8),h=an.relativeLuminance(l>>8);if(ns(u,h)<c){if(h<u){let f=r(o,l,c),m=ns(u,an.relativeLuminance(f>>8));if(m<c){let g=s(o,l,c),b=ns(u,an.relativeLuminance(g>>8));return m>b?f:g}return f}let d=s(o,l,c),p=ns(u,an.relativeLuminance(d>>8));if(p<c){let f=r(o,l,c),m=ns(u,an.relativeLuminance(f>>8));return p>m?d:f}return d}}e.ensureContrastRatio=n;function r(o,l,c){let u=o>>24&255,h=o>>16&255,d=o>>8&255,p=l>>24&255,f=l>>16&255,m=l>>8&255,g=ns(an.relativeLuminance2(p,f,m),an.relativeLuminance2(u,h,d));for(;g<c&&(p>0||f>0||m>0);)p-=Math.max(0,Math.ceil(p*.1)),f-=Math.max(0,Math.ceil(f*.1)),m-=Math.max(0,Math.ceil(m*.1)),g=ns(an.relativeLuminance2(p,f,m),an.relativeLuminance2(u,h,d));return(p<<24|f<<16|m<<8|255)>>>0}e.reduceLuminance=r;function s(o,l,c){let u=o>>24&255,h=o>>16&255,d=o>>8&255,p=l>>24&255,f=l>>16&255,m=l>>8&255,g=ns(an.relativeLuminance2(p,f,m),an.relativeLuminance2(u,h,d));for(;g<c&&(p<255||f<255||m<255);)p=Math.min(255,p+Math.ceil((255-p)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),m=Math.min(255,m+Math.ceil((255-m)*.1)),g=ns(an.relativeLuminance2(p,f,m),an.relativeLuminance2(u,h,d));return(p<<24|f<<16|m<<8|255)>>>0}e.increaseLuminance=s;function i(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=i})(Xu||(Xu={}));function Ni(e){let t=e.toString(16);return t.length<2?"0"+t:t}function ns(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var nD=class extends Tc{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Hd=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new cr}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),s=0,i=0,o=0,l=t.getFg(0),c=t.getBg(0);for(let u=0;u<t.getTrimmedLength();u++)if(t.loadCell(u,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==c){if(u-s>1){let h=this._getJoinedRanges(r,o,i,t,s);for(let d=0;d<h.length;d++)n.push(h[d])}s=u,o=i,l=this._workCell.fg,c=this._workCell.bg}i+=this._workCell.getChars().length||si.length}if(this._bufferService.cols-s>1){let u=this._getJoinedRanges(r,o,i,t,s);for(let h=0;h<u.length;h++)n.push(u[h])}return n}_getJoinedRanges(e,t,n,r,s){let i=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(i)}catch(l){console.error(l)}for(let l=1;l<this._characterJoiners.length;l++)try{let c=this._characterJoiners[l].handler(i);for(let u=0;u<c.length;u++)Hd._mergeRanges(o,c[u])}catch(c){console.error(c)}return this._stringRangesToCellRanges(o,r,s),o}_stringRangesToCellRanges(e,t,n){let r=0,s=!1,i=0,o=e[r];if(o){for(let l=n;l<this._bufferService.cols;l++){let c=t.getWidth(l),u=t.getString(l).length||si.length;if(c!==0){if(!s&&o[0]<=i&&(o[0]=l,s=!0),o[1]<=i){if(o[1]=l,o=e[++r],!o)break;o[0]<=i?(o[0]=l,s=!0):s=!1}i+=u}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let s=e[r];if(n){if(t[1]<=s[0])return e[r-1][1]=t[1],e;if(t[1]<=s[1])return e[r-1][1]=Math.max(t[1],s[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=s[0])return e.splice(r,0,t),e;if(t[1]<=s[1])return s[0]=Math.min(t[0],s[0]),e;t[0]<s[1]&&(s[0]=Math.min(t[0],s[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Hd=at([oe(0,vn)],Hd);function rD(e){return 57508<=e&&e<=57558}function sD(e){return 9472<=e&&e<=9631}function iD(e){return rD(e)||sD(e)}function oD(){return{css:{canvas:fu(),cell:fu()},device:{canvas:fu(),cell:fu(),char:{width:0,height:0,left:0,top:0}}}}function fu(){return{width:0,height:0}}var eg=class{constructor(e,t,n,r,s,i,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=s,this._decorationService=i,this._themeService=o,this._workCell=new cr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,s,i,o,l,c,u,h){let d=[],p=this._characterJoinerService.getJoinedCharacters(t),f=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<i+1&&(m=i+1);let g,b=0,x="",y=0,_=0,w=0,C=0,S=!1,R=0,T=!1,F=0,P=0,I=[],A=u!==-1&&h!==-1;for(let M=0;M<m;M++){e.loadCell(M,this._workCell);let j=this._workCell.getWidth();if(j===0)continue;let E=!1,$=M>=P,q=M,D=this._workCell;if(p.length>0&&M===p[0][0]&&$){let he=p.shift(),Nt=this._isCellInSelection(he[0],t);for(y=he[0]+1;y<he[1];y++)$&&($=Nt===this._isCellInSelection(y,t));$&&($=!n||i<he[0]||i>=he[1]),$?(E=!0,D=new nD(this._workCell,e.translateToString(!0,he[0],he[1]),he[1]-he[0]),q=he[1]-1,j=D.getWidth()):P=he[1]}let H=this._isCellInSelection(M,t),N=n&&M===i,B=A&&M>=u&&M<=h,O=!1;this._decorationService.forEachDecorationAtCell(M,t,void 0,he=>{O=!0});let k=D.getChars()||si;if(k===" "&&(D.isUnderline()||D.isOverline())&&(k=" "),F=j*l-c.get(k,D.isBold(),D.isItalic()),!g)g=this._document.createElement("span");else if(b&&(H&&T||!H&&!T&&D.bg===_)&&(H&&T&&f.selectionForeground||D.fg===w)&&D.extended.ext===C&&B===S&&F===R&&!N&&!E&&!O&&$){D.isInvisible()?x+=si:x+=k,b++;continue}else b&&(g.textContent=x),g=this._document.createElement("span"),b=0,x="";if(_=D.bg,w=D.fg,C=D.extended.ext,S=B,R=F,T=H,E&&i>=M&&i<=q&&(i=M),!this._coreService.isCursorHidden&&N&&this._coreService.isCursorInitialized){if(I.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&I.push("xterm-cursor-blink"),I.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":I.push("xterm-cursor-outline");break;case"block":I.push("xterm-cursor-block");break;case"bar":I.push("xterm-cursor-bar");break;case"underline":I.push("xterm-cursor-underline");break}}if(D.isBold()&&I.push("xterm-bold"),D.isItalic()&&I.push("xterm-italic"),D.isDim()&&I.push("xterm-dim"),D.isInvisible()?x=si:x=D.getChars()||si,D.isUnderline()&&(I.push(`xterm-underline-${D.extended.underlineStyle}`),x===" "&&(x=" "),!D.isUnderlineColorDefault()))if(D.isUnderlineColorRGB())g.style.textDecorationColor=`rgb(${Tc.toColorRGB(D.getUnderlineColor()).join(",")})`;else{let he=D.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&D.isBold()&&he<8&&(he+=8),g.style.textDecorationColor=f.ansi[he].css}D.isOverline()&&(I.push("xterm-overline"),x===" "&&(x=" ")),D.isStrikethrough()&&I.push("xterm-strikethrough"),B&&(g.style.textDecoration="underline");let W=D.getFgColor(),Q=D.getFgColorMode(),z=D.getBgColor(),X=D.getBgColorMode(),re=!!D.isInverse();if(re){let he=W;W=z,z=he;let Nt=Q;Q=X,X=Nt}let ie,de,qe=!1;this._decorationService.forEachDecorationAtCell(M,t,void 0,he=>{he.options.layer!=="top"&&qe||(he.backgroundColorRGB&&(X=50331648,z=he.backgroundColorRGB.rgba>>8&16777215,ie=he.backgroundColorRGB),he.foregroundColorRGB&&(Q=50331648,W=he.foregroundColorRGB.rgba>>8&16777215,de=he.foregroundColorRGB),qe=he.options.layer==="top")}),!qe&&H&&(ie=this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque,z=ie.rgba>>8&16777215,X=50331648,qe=!0,f.selectionForeground&&(Q=50331648,W=f.selectionForeground.rgba>>8&16777215,de=f.selectionForeground)),qe&&I.push("xterm-decoration-top");let Se;switch(X){case 16777216:case 33554432:Se=f.ansi[z],I.push(`xterm-bg-${z}`);break;case 50331648:Se=ft.toColor(z>>16,z>>8&255,z&255),this._addStyle(g,`background-color:#${a_((z>>>0).toString(16),"0",6)}`);break;case 0:default:re?(Se=f.foreground,I.push("xterm-bg-257")):Se=f.background}switch(ie||D.isDim()&&(ie=We.multiplyOpacity(Se,.5)),Q){case 16777216:case 33554432:D.isBold()&&W<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(W+=8),this._applyMinimumContrast(g,Se,f.ansi[W],D,ie,void 0)||I.push(`xterm-fg-${W}`);break;case 50331648:let he=ft.toColor(W>>16&255,W>>8&255,W&255);this._applyMinimumContrast(g,Se,he,D,ie,de)||this._addStyle(g,`color:#${a_(W.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(g,Se,f.foreground,D,ie,de)||re&&I.push("xterm-fg-257")}I.length&&(g.className=I.join(" "),I.length=0),!N&&!E&&!O&&$?b++:g.textContent=x,F!==this.defaultSpacing&&(g.style.letterSpacing=`${F}px`),d.push(g),M=q}return g&&b&&(g.textContent=x),d}_applyMinimumContrast(e,t,n,r,s,i){if(this._optionsService.rawOptions.minimumContrastRatio===1||iD(r.getCode()))return!1;let o=this._getContrastCache(r),l;if(!s&&!i&&(l=o.getColor(t.rgba,n.rgba)),l===void 0){let c=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);l=We.ensureContrastRatio(s||t,i||n,c),o.setColor((s||t).rgba,(i||n).rgba,l??null)}return l?(this._addStyle(e,`color:${l.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};eg=at([oe(1,lC),oe(2,xn),oe(3,Cs),oe(4,xo),oe(5,Pc),oe(6,La)],eg);function a_(e,t,n){for(;e.length<n;)e=t+e;return e}var aD=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontStyle="italic";let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold",i.style.fontStyle="italic",this._measureElements=[n,r,s,i],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(s),this._container.appendChild(i),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let o=this._measure(e,0);return o>0&&(this._flat[r]=o),o}let s=e;t&&(s+="B"),n&&(s+="I");let i=this._holey.get(s);if(i===void 0){let o=0;t&&(o|=1),n&&(o|=2),i=this._measure(e,o),i>0&&this._holey.set(s,i)}return i}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},lD=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let s=e.buffers.active.ydisp,i=t[1]-s,o=n[1]-s,l=Math.max(i,0),c=Math.min(o,e.rows-1);if(l>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=i,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function cD(){return new lD}var Tf="xterm-dom-renderer-owner-",Xn="xterm-rows",pu="xterm-fg-",l_="xterm-bg-",Ja="xterm-focus",mu="xterm-selection",uD=1,tg=class extends Ce{constructor(e,t,n,r,s,i,o,l,c,u,h,d,p,f){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=s,this._helperContainer=i,this._linkifier2=o,this._charSizeService=c,this._optionsService=u,this._bufferService=h,this._coreService=d,this._coreBrowserService=p,this._themeService=f,this._terminalClass=uD++,this._rowElements=[],this._selectionRenderModel=cD(),this.onRequestRedraw=this._register(new ee).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Xn),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(mu),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=oD(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(m=>this._injectCss(m))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(eg,document),this._element.classList.add(Tf+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(m=>this._handleLinkHover(m))),this._register(this._linkifier2.onHideLinkUnderline(m=>this._handleLinkLeave(m))),this._register(Ye(()=>{this._element.classList.remove(Tf+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new aD(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Xn} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${Xn} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${Xn} .xterm-dim { color: ${We.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${s} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Xn}.${Ja} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Xn}.${Ja} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Xn}.${Ja} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Xn} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Xn} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Xn} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Xn} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Xn} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${mu} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${mu} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${mu} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[i,o]of e.ansi.entries())t+=`${this._terminalSelector} .${pu}${i} { color: ${o.css}; }${this._terminalSelector} .${pu}${i}.xterm-dim { color: ${We.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${l_}${i} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${pu}257 { color: ${We.opaque(e.background).css}; }${this._terminalSelector} .${pu}257.xterm-dim { color: ${We.multiplyOpacity(We.opaque(e.background),.5).css}; }${this._terminalSelector} .${l_}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),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(Ja),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ja),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,s=this._selectionRenderModel.viewportEndRow,i=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(n){let c=e[0]>t[0];l.appendChild(this._createSelectionElement(i,c?t[0]:e[0],c?e[0]:t[0],o-i+1))}else{let c=r===i?e[0]:0,u=i===s?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(i,c,u));let h=o-i-1;if(l.appendChild(this._createSelectionElement(i+1,0,this._bufferService.cols,h)),i!==o){let d=s===o?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(o,0,d))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,t,n,r=1){let s=this._document.createElement("div"),i=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return i+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-i),s.style.height=`${r*this.dimensions.css.cell.height}px`,s.style.top=`${e*this.dimensions.css.cell.height}px`,s.style.left=`${i}px`,s.style.width=`${o}px`,s}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,s=Math.min(n.x,this._bufferService.cols-1),i=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let u=c+n.ydisp,h=this._rowElements[c],d=n.lines.get(u);if(!h||!d)break;h.replaceChildren(...this._rowFactory.createRow(d,u,u===r,o,l,s,i,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Tf}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,s,i){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),s=Math.min(s,this._bufferService.cols);let l=this._bufferService.buffer,c=l.ybase+l.y,u=Math.min(l.x,s-1),h=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=n;f<=r;++f){let m=f+l.ydisp,g=this._rowElements[f],b=l.lines.get(m);if(!g||!b)break;g.replaceChildren(...this._rowFactory.createRow(b,m,m===c,d,p,u,h,this.dimensions.css.cell.width,this._widthCache,i?f===n?e:0:-1,i?(f===r?t:s)-1:-1))}}};tg=at([oe(7,ix),oe(8,Nh),oe(9,xn),oe(10,vn),oe(11,xo),oe(12,Cs),oe(13,La)],tg);var ng=class extends Ce{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ee),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new hD(this._optionsService))}catch{this._measureStrategy=this._register(new dD(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};ng=at([oe(2,xn)],ng);var jC=class extends Ce{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},dD=class extends jC{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},hD=class extends jC{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},fD=class extends Ce{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new pD(this._window)),this._onDprChange=this._register(new ee),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ee),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(Wt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(ge(this._textarea,"focus",()=>this._isFocused=!0)),this._register(ge(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},pD=class extends Ce{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Sa),this._onDprChange=this._register(new ee),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ye(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=ge(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},mD=class extends Ce{constructor(){super(),this.linkProviders=[],this._register(Ye(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function fx(e,t,n){let r=n.getBoundingClientRect(),s=e.getComputedStyle(n),i=parseInt(s.getPropertyValue("padding-left")),o=parseInt(s.getPropertyValue("padding-top"));return[t.clientX-r.left-i,t.clientY-r.top-o]}function gD(e,t,n,r,s,i,o,l,c){if(!i)return;let u=fx(e,t,n);if(u)return u[0]=Math.ceil((u[0]+(c?o/2:0))/o),u[1]=Math.ceil(u[1]/l),u[0]=Math.min(Math.max(u[0],1),r+(c?1:0)),u[1]=Math.min(Math.max(u[1],1),s),u}var rg=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,s){return gD(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(e,t){let n=fx(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};rg=at([oe(0,Ns),oe(1,Nh)],rg);var vD=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},EC={};jT(EC,{getSafariVersion:()=>yD,isChromeOS:()=>DC,isFirefox:()=>RC,isIpad:()=>_D,isIphone:()=>bD,isLegacyEdge:()=>xD,isLinux:()=>px,isMac:()=>Wd,isNode:()=>jh,isSafari:()=>TC,isWindows:()=>PC});var jh=typeof process<"u"&&"title"in process,Dc=jh?"node":navigator.userAgent,Mc=jh?"node":navigator.platform,RC=Dc.includes("Firefox"),xD=Dc.includes("Edge"),TC=/^((?!chrome|android).)*safari/i.test(Dc);function yD(){if(!TC)return 0;let e=Dc.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Wd=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Mc),_D=Mc==="iPad",bD=Mc==="iPhone",PC=["Windows","Win16","Win32","WinCE"].includes(Mc),px=Mc.indexOf("Linux")>=0,DC=/\bCrOS\b/.test(Dc),MC=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),s=e.timeRemaining(),n*1.5>s){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=s}this.clear()}},wD=class extends MC{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},SD=class extends MC{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Ud=!jh&&"requestIdleCallback"in window?SD:wD,kD=class{constructor(){this._queue=new Ud}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},sg=class extends Ce{constructor(e,t,n,r,s,i,o,l,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=s,this._coreBrowserService=l,this._renderer=this._register(new Sa),this._pausedResizeTask=new kD,this._observerDisposable=this._register(new Sa),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 ee),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ee),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ee),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ee),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new vD((u,h)=>this._renderRows(u,h),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new CD(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ye(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var u;return(u=this._renderer.value)==null?void 0:u.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(i.onDecorationRegistered(()=>this._fullRefresh())),this._register(i.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(u=>this._registerIntersectionObserver(u,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=Ye(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var n;return(n=this._renderer.value)==null?void 0:n.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,n){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};sg=at([oe(2,xn),oe(3,Nh),oe(4,xo),oe(5,Pc),oe(6,vn),oe(7,Cs),oe(8,La)],sg);var CD=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function ND(e,t,n,r){let s=n.buffer.x,i=n.buffer.y;if(!n.buffer.hasScrollback)return RD(s,i,e,t,n,r)+Eh(i,t,n,r)+TD(s,i,e,t,n,r);let o;if(i===t)return o=s>e?"D":"C",ac(Math.abs(s-e),oc(o,r));o=i>t?"D":"C";let l=Math.abs(i-t),c=ED(i>t?e:s,n)+(l-1)*n.cols+1+jD(i>t?s:e);return ac(c,oc(o,r))}function jD(e,t){return e-1}function ED(e,t){return t.cols-e}function RD(e,t,n,r,s,i){return Eh(t,r,s,i).length===0?"":ac(AC(e,t,e,t-co(t,s),!1,s).length,oc("D",i))}function Eh(e,t,n,r){let s=e-co(e,n),i=t-co(t,n),o=Math.abs(s-i)-PD(e,t,n);return ac(o,oc(LC(e,t),r))}function TD(e,t,n,r,s,i){let o;Eh(t,r,s,i).length>0?o=r-co(r,s):o=t;let l=r,c=DD(e,t,n,r,s,i);return ac(AC(e,o,n,l,c==="C",s).length,oc(c,i))}function PD(e,t,n){var o;let r=0,s=e-co(e,n),i=t-co(t,n);for(let l=0;l<Math.abs(s-i);l++){let c=LC(e,t)==="A"?-1:1;(o=n.buffer.lines.get(s+c*l))!=null&&o.isWrapped&&r++}return r}function co(e,t){let n=0,r=t.buffer.lines.get(e),s=r==null?void 0:r.isWrapped;for(;s&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),s=r==null?void 0:r.isWrapped;return n}function DD(e,t,n,r,s,i){let o;return Eh(n,r,s,i).length>0?o=r-co(r,s):o=t,e<n&&o<=r||e>=n&&o<r?"C":"D"}function LC(e,t){return e>t?"A":"B"}function AC(e,t,n,r,s,i){let o=e,l=t,c="";for(;(o!==n||l!==r)&&l>=0&&l<i.buffer.lines.length;)o+=s?1:-1,s&&o>i.cols-1?(c+=i.buffer.translateBufferLineToString(l,!1,e,o),o=0,e=0,l++):!s&&o<0&&(c+=i.buffer.translateBufferLineToString(l,!1,0,e+1),o=i.cols-1,e=o,l--);return c+i.buffer.translateBufferLineToString(l,!1,e,o)}function oc(e,t){let n=t?"O":"[";return Y.ESC+n+e}function ac(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}var MD=class{constructor(t){this._bufferService=t,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?t%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)-1]:[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[t,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[Math.max(t,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let t=this.selectionStart,n=this.selectionEnd;return!t||!n?!1:t[1]>n[1]||t[1]===n[1]&&t[0]>n[0]}handleTrim(t){return this.selectionStart&&(this.selectionStart[1]-=t),this.selectionEnd&&(this.selectionEnd[1]-=t),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function c_(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Pf=50,LD=15,AD=50,OD=500,ID=" ",BD=new RegExp(ID,"g"),ig=class extends Ce{constructor(e,t,n,r,s,i,o,l,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=s,this._mouseService=i,this._optionsService=o,this._renderService=l,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new cr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ee),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ee),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ee),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ee),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=u=>this._handleMouseMove(u),this._mouseUpListener=u=>this._handleMouseUp(u),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(u=>this._handleTrim(u)),this._register(this._bufferService.buffers.onBufferActivate(u=>this._handleBufferActivate(u))),this.enable(),this._model=new MD(this._bufferService),this._activeSelectionMode=0,this._register(Ye(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(u=>{u.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let s=e[0]<t[0]?e[0]:t[0],i=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let l=n.translateBufferLineToString(o,!0,s,i);r.push(l)}}else{let s=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],s));for(let i=e[1]+1;i<=t[1]-1;i++){let o=n.lines.get(i),l=n.translateBufferLineToString(i,!0);o!=null&&o.isWrapped?r[r.length-1]+=l:r.push(l)}if(e[1]!==t[1]){let i=n.lines.get(t[1]),o=n.translateBufferLineToString(t[1],!0,0,t[0]);i&&i.isWrapped?r[r.length-1]+=o:r.push(o)}}return r.map(s=>s.replace(BD," ")).join(PC?`\r
481
- `:`
482
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),px&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var s,i;let n=(i=(s=this._linkifier.currentLink)==null?void 0:s.link)==null?void 0:i.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=c_(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=fx(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-Pf),Pf),t/=Pf,t/Math.abs(t)+Math.round(t*(LD-1)))}shouldForceSelection(e){return Wd?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),AD)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Wd&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let r=n.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<OD&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let r=ND(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let s=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:s>1&&t!==r&&(n+=s-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let s=this._bufferService.buffer,i=s.lines.get(e[1]);if(!i)return;let o=s.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(i,e[0]),c=l,u=e[0]-l,h=0,d=0,p=0,f=0;if(o.charAt(l)===" "){for(;l>0&&o.charAt(l-1)===" ";)l--;for(;c<o.length&&o.charAt(c+1)===" ";)c++}else{let b=e[0],x=e[0];i.getWidth(b)===0&&(h++,b--),i.getWidth(x)===2&&(d++,x++);let y=i.getString(x).length;for(y>1&&(f+=y-1,c+=y-1);b>0&&l>0&&!this._isCharWordSeparator(i.loadCell(b-1,this._workCell));){i.loadCell(b-1,this._workCell);let _=this._workCell.getChars().length;this._workCell.getWidth()===0?(h++,b--):_>1&&(p+=_-1,l-=_-1),l--,b--}for(;x<i.length&&c+1<o.length&&!this._isCharWordSeparator(i.loadCell(x+1,this._workCell));){i.loadCell(x+1,this._workCell);let _=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,x++):_>1&&(f+=_-1,c+=_-1),c++,x++}}c++;let m=l+u-h+p,g=Math.min(this._bufferService.cols,c-l+h+d-p-f);if(!(!t&&o.slice(l,c).trim()==="")){if(n&&m===0&&i.getCodePoint(0)!==32){let b=s.lines.get(e[1]-1);if(b&&i.isWrapped&&b.getCodePoint(this._bufferService.cols-1)!==32){let x=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(x){let y=this._bufferService.cols-x.start;m-=y,g+=y}}}if(r&&m+g===this._bufferService.cols&&i.getCodePoint(this._bufferService.cols-1)!==32){let b=s.lines.get(e[1]+1);if(b!=null&&b.isWrapped&&b.getCodePoint(0)!==32){let x=this._getWordAt([0,e[1]+1],!1,!1,!0);x&&(g+=x.length)}}return{start:m,length:g}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=c_(n,this._bufferService.cols)}};ig=at([oe(3,vn),oe(4,xo),oe(5,ox),oe(6,xn),oe(7,Ns),oe(8,Cs)],ig);var u_=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},d_=class{constructor(){this._color=new u_,this._css=new u_}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},xt=Object.freeze((()=>{let e=[Ge.toColor("#2e3436"),Ge.toColor("#cc0000"),Ge.toColor("#4e9a06"),Ge.toColor("#c4a000"),Ge.toColor("#3465a4"),Ge.toColor("#75507b"),Ge.toColor("#06989a"),Ge.toColor("#d3d7cf"),Ge.toColor("#555753"),Ge.toColor("#ef2929"),Ge.toColor("#8ae234"),Ge.toColor("#fce94f"),Ge.toColor("#729fcf"),Ge.toColor("#ad7fa8"),Ge.toColor("#34e2e2"),Ge.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],s=t[n/6%6|0],i=t[n%6];e.push({css:ft.toCss(r,s,i),rgba:ft.toRgba(r,s,i)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:ft.toCss(r,r,r),rgba:ft.toRgba(r,r,r)})}return e})()),Ti=Ge.toColor("#ffffff"),pl=Ge.toColor("#000000"),h_=Ge.toColor("#ffffff"),f_=pl,Za={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},FD=Ti,og=class extends Ce{constructor(e){super(),this._optionsService=e,this._contrastCache=new d_,this._halfContrastCache=new d_,this._onChangeColors=this._register(new ee),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ti,background:pl,cursor:h_,cursorAccent:f_,selectionForeground:void 0,selectionBackgroundTransparent:Za,selectionBackgroundOpaque:We.blend(pl,Za),selectionInactiveBackgroundTransparent:Za,selectionInactiveBackgroundOpaque:We.blend(pl,Za),scrollbarSliderBackground:We.opacity(Ti,.2),scrollbarSliderHoverBackground:We.opacity(Ti,.4),scrollbarSliderActiveBackground:We.opacity(Ti,.5),overviewRulerBorder:Ti,ansi:xt.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Ie(e.foreground,Ti),t.background=Ie(e.background,pl),t.cursor=We.blend(t.background,Ie(e.cursor,h_)),t.cursorAccent=We.blend(t.background,Ie(e.cursorAccent,f_)),t.selectionBackgroundTransparent=Ie(e.selectionBackground,Za),t.selectionBackgroundOpaque=We.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Ie(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=We.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Ie(e.selectionForeground,o_):void 0,t.selectionForeground===o_&&(t.selectionForeground=void 0),We.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=We.opacity(t.selectionBackgroundTransparent,.3)),We.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=We.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Ie(e.scrollbarSliderBackground,We.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Ie(e.scrollbarSliderHoverBackground,We.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Ie(e.scrollbarSliderActiveBackground,We.opacity(t.foreground,.5)),t.overviewRulerBorder=Ie(e.overviewRulerBorder,FD),t.ansi=xt.slice(),t.ansi[0]=Ie(e.black,xt[0]),t.ansi[1]=Ie(e.red,xt[1]),t.ansi[2]=Ie(e.green,xt[2]),t.ansi[3]=Ie(e.yellow,xt[3]),t.ansi[4]=Ie(e.blue,xt[4]),t.ansi[5]=Ie(e.magenta,xt[5]),t.ansi[6]=Ie(e.cyan,xt[6]),t.ansi[7]=Ie(e.white,xt[7]),t.ansi[8]=Ie(e.brightBlack,xt[8]),t.ansi[9]=Ie(e.brightRed,xt[9]),t.ansi[10]=Ie(e.brightGreen,xt[10]),t.ansi[11]=Ie(e.brightYellow,xt[11]),t.ansi[12]=Ie(e.brightBlue,xt[12]),t.ansi[13]=Ie(e.brightMagenta,xt[13]),t.ansi[14]=Ie(e.brightCyan,xt[14]),t.ansi[15]=Ie(e.brightWhite,xt[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=Ie(e.extendedAnsi[r],xt[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};og=at([oe(0,xn)],og);function Ie(e,t){if(e!==void 0)try{return Ge.toColor(e)}catch{}return t}var zD=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},$D=class{constructor(){this._services=new zD,this._services.set(ix,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=LT(e).sort((i,o)=>i.index-o.index),r=[];for(let i of n){let o=this._services.get(i.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${i.id._id}.`);r.push(o)}let s=n.length>0?n[0].index:t.length;if(t.length!==s)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${s+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},HD={trace:0,debug:1,info:2,warn:3,error:4,off:5},WD="xterm.js: ",ag=class extends Ce{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=HD[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":WD)+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};ag=at([oe(0,xn)],ag);var p_=class extends Ce{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ee),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ee),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ee),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+n.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<n.length;r++)this._array[this._getCyclicIndex(e+r)]=n[r];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let r=this._length+n.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let s=t-1;s>=0;s--)this.set(e+s+n,this.get(e+s));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},ke=3,ht=Object.freeze(new Tc),gu=0,Df=2,ml=class OC{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*ke);let s=n||cr.fromCharData([0,tC,1,0]);for(let i=0;i<t;++i)this.setCell(i,s);this.length=t}get(t){let n=this._data[t*ke+0],r=n&2097151;return[this._data[t*ke+1],n&2097152?this._combined[t]:r?Ws(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*ke+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*ke+0]=t|2097152|n[2]<<22):this._data[t*ke+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*ke+0]>>22}hasWidth(t){return this._data[t*ke+0]&12582912}getFg(t){return this._data[t*ke+1]}getBg(t){return this._data[t*ke+2]}hasContent(t){return this._data[t*ke+0]&4194303}getCodePoint(t){let n=this._data[t*ke+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*ke+0]&2097152}getString(t){let n=this._data[t*ke+0];return n&2097152?this._combined[t]:n&2097151?Ws(n&2097151):""}isProtected(t){return this._data[t*ke+2]&536870912}loadCell(t,n){return gu=t*ke,n.content=this._data[gu+0],n.fg=this._data[gu+1],n.bg=this._data[gu+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*ke+0]=n.content,this._data[t*ke+1]=n.fg,this._data[t*ke+2]=n.bg}setCellFromCodepoint(t,n,r,s){s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*ke+0]=n|r<<22,this._data[t*ke+1]=s.fg,this._data[t*ke+2]=s.bg}addCodepointToCell(t,n,r){let s=this._data[t*ke+0];s&2097152?this._combined[t]+=Ws(n):s&2097151?(this._combined[t]=Ws(s&2097151)+Ws(n),s&=-2097152,s|=2097152):s=n|1<<22,r&&(s&=-12582913,s|=r<<22),this._data[t*ke+0]=s}insertCells(t,n,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length-t){let s=new cr;for(let i=this.length-t-n-1;i>=0;--i)this.setCell(t+n+i,this.loadCell(t+i,s));for(let i=0;i<n;++i)this.setCell(t+i,r)}else for(let s=t;s<this.length;++s)this.setCell(s,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,n,r){if(t%=this.length,n<this.length-t){let s=new cr;for(let i=0;i<this.length-t-n;++i)this.setCell(t+i,this.loadCell(t+n+i,s));for(let i=this.length-n;i<this.length;++i)this.setCell(i,r)}else for(let s=t;s<this.length;++s)this.setCell(s,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,n,r,s=!1){if(s){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.setCell(t++,r)}resize(t,n){if(t===this.length)return this._data.length*4*Df<this._data.buffer.byteLength;let r=t*ke;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let s=new Uint32Array(r);s.set(this._data),this._data=s}for(let s=this.length;s<t;++s)this.setCell(s,n)}else{this._data=this._data.subarray(0,r);let s=Object.keys(this._combined);for(let o=0;o<s.length;o++){let l=parseInt(s[o],10);l>=t&&delete this._combined[l]}let i=Object.keys(this._extendedAttrs);for(let o=0;o<i.length;o++){let l=parseInt(i[o],10);l>=t&&delete this._extendedAttrs[l]}}return this.length=t,r*4*Df<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Df<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new OC(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ke+0]&4194303)return t+(this._data[t*ke+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ke+0]&4194303||this._data[t*ke+2]&50331648)return t+(this._data[t*ke+0]>>22);return 0}copyCellsFrom(t,n,r,s,i){let o=t._data;if(i)for(let c=s-1;c>=0;c--){for(let u=0;u<ke;u++)this._data[(r+c)*ke+u]=o[(n+c)*ke+u];o[(n+c)*ke+2]&268435456&&(this._extendedAttrs[r+c]=t._extendedAttrs[n+c])}else for(let c=0;c<s;c++){for(let u=0;u<ke;u++)this._data[(r+c)*ke+u]=o[(n+c)*ke+u];o[(n+c)*ke+2]&268435456&&(this._extendedAttrs[r+c]=t._extendedAttrs[n+c])}let l=Object.keys(t._combined);for(let c=0;c<l.length;c++){let u=parseInt(l[c],10);u>=n&&(this._combined[u-n+r]=t._combined[u])}}translateToString(t,n,r,s){n=n??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),s&&(s.length=0);let i="";for(;n<r;){let o=this._data[n*ke+0],l=o&2097151,c=o&2097152?this._combined[n]:l?Ws(l):si;if(i+=c,s)for(let u=0;u<c.length;++u)s.push(n);n+=o>>22||1}return s&&s.push(n),i}};function UD(e,t,n,r,s,i){let o=[];for(let l=0;l<e.length-1;l++){let c=l,u=e.get(++c);if(!u.isWrapped)continue;let h=[e.get(l)];for(;c<e.length&&u.isWrapped;)h.push(u),u=e.get(++c);if(!i&&r>=l&&r<c){l+=h.length-1;continue}let d=0,p=lc(h,d,t),f=1,m=0;for(;f<h.length;){let b=lc(h,f,t),x=b-m,y=n-p,_=Math.min(x,y);h[d].copyCellsFrom(h[f],m,p,_,!1),p+=_,p===n&&(d++,p=0),m+=_,m===b&&(f++,m=0),p===0&&d!==0&&h[d-1].getWidth(n-1)===2&&(h[d].copyCellsFrom(h[d-1],n-1,p++,1,!1),h[d-1].setCell(n-1,s))}h[d].replaceCells(p,n,s);let g=0;for(let b=h.length-1;b>0&&(b>d||h[b].getTrimmedLength()===0);b--)g++;g>0&&(o.push(l+h.length-g),o.push(g)),l+=h.length-1}return o}function qD(e,t){let n=[],r=0,s=t[r],i=0;for(let o=0;o<e.length;o++)if(s===o){let l=t[++r];e.onDeleteEmitter.fire({index:o-i,amount:l}),o+=l-1,i+=l,s=t[++r]}else n.push(o);return{layout:n,countRemoved:i}}function KD(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let r=0;r<n.length;r++)e.set(r,n[r]);e.length=t.length}function VD(e,t,n){let r=[],s=e.map((c,u)=>lc(e,u,t)).reduce((c,u)=>c+u),i=0,o=0,l=0;for(;l<s;){if(s-l<n){r.push(s-l);break}i+=n;let c=lc(e,o,t);i>c&&(i-=c,o++);let u=e[o].getWidth(i-1)===2;u&&i--;let h=u?n-1:n;r.push(h),l+=h}return r}function lc(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,s=e[t+1].getWidth(0)===2;return r&&s?n-1:n}var IC=class BC{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=BC._nextId++,this._onDispose=this.register(new ee),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),lo(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};IC._nextId=1;var YD=IC,Ct={},Pi=Ct.B;Ct[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Ct.A={"#":"£"};Ct.B=void 0;Ct[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Ct.C=Ct[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ct.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Ct.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Ct.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Ct.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Ct.E=Ct[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Ct.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Ct.H=Ct[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ct["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var m_=4294967295,g_=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=ht.clone(),this.savedCharset=Pi,this.markers=[],this._nullCell=cr.fromCharData([0,tC,1,0]),this._whitespaceCell=cr.fromCharData([0,si,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Ud,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new p_(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new zd),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new zd),this._whitespaceCell}getBlankLine(e,t){return new ml(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>m_?m_:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=ht);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new p_(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(ht),r=0,s=this._getCorrectBufferLength(t);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)r+=+this.lines.get(o).resize(e,n);let i=0;if(this._rows<t)for(let o=this._rows;o<t;o++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new ml(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+i+1?(this.ybase--,i++,this.ydisp>0&&this.ydisp--):this.lines.push(new ml(e,n)));else for(let o=this._rows;o>t;o--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let o=this.lines.length-s;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=s}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),i&&(this.y+=i),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let i=0;i<this.lines.length;i++)r+=+this.lines.get(i).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=UD(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(ht),n);if(r.length>0){let s=qD(this.lines,r);KD(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(ht),s=n;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new ml(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(ht),s=[],i=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let c=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),c.unshift(l);if(!n){let _=this.ybase+this.y;if(_>=o&&_<o+c.length)continue}let u=c[c.length-1].getTrimmedLength(),h=VD(c,this._cols,e),d=h.length-c.length,p;this.ybase===0&&this.y!==this.lines.length-1?p=Math.max(0,this.y-this.lines.maxLength+d):p=Math.max(0,this.lines.length-this.lines.maxLength+d);let f=[];for(let _=0;_<d;_++){let w=this.getBlankLine(ht,!0);f.push(w)}f.length>0&&(s.push({start:o+c.length+i,newLines:f}),i+=f.length),c.push(...f);let m=h.length-1,g=h[m];g===0&&(m--,g=h[m]);let b=c.length-d-1,x=u;for(;b>=0;){let _=Math.min(x,g);if(c[m]===void 0)break;if(c[m].copyCellsFrom(c[b],x-_,g-_,_,!0),g-=_,g===0&&(m--,g=h[m]),x-=_,x===0){b--;let w=Math.max(b,0);x=lc(c,w,this._cols)}}for(let _=0;_<c.length;_++)h[_]<e&&c[_].setCell(h[_],r);let y=d-p;for(;y-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+i)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(s.length>0){let o=[],l=[];for(let g=0;g<this.lines.length;g++)l.push(this.lines.get(g));let c=this.lines.length,u=c-1,h=0,d=s[h];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+i);let p=0;for(let g=Math.min(this.lines.maxLength-1,c+i-1);g>=0;g--)if(d&&d.start>u+p){for(let b=d.newLines.length-1;b>=0;b--)this.lines.set(g--,d.newLines[b]);g++,o.push({index:u+1,amount:d.newLines.length}),p+=d.newLines.length,d=s[++h]}else this.lines.set(g,l[u--]);let f=0;for(let g=o.length-1;g>=0;g--)o[g].index+=f,this.lines.onInsertEmitter.fire(o[g]),f+=o[g].amount;let m=Math.max(0,c+i-this.lines.maxLength);m>0&&this.lines.onTrimEmitter.fire(m)}}translateBufferLineToString(e,t,n=0,r){let s=this.lines.get(e);return s?s.translateToString(t,n,r):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new YD(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},QD=class extends Ce{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ee),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 g_(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new g_(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},FC=2,zC=1,lg=class extends Ce{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ee),this.onResize=this._onResize.event,this._onScroll=this._register(new ee),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,FC),this.rows=Math.max(e.rawOptions.rows||0,zC),this.buffers=this._register(new QD(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let s=n.ybase+n.scrollTop,i=n.ybase+n.scrollBottom;if(n.scrollTop===0){let o=n.lines.isFull;i===n.lines.length-1?o?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(i+1,0,r.clone()),o?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let o=i-s+1;n.lines.shiftElements(s+1,o-1,-1),n.lines.set(i,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};lg=at([oe(0,xn)],lg);var Co={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Wd,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},XD=["normal","bold","100","200","300","400","500","600","700","800","900"],GD=class extends Ce{constructor(e){super(),this._onOptionChange=this._register(new ee),this.onOptionChange=this._onOptionChange.event;let t={...Co};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Ye(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in Co))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in Co))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Co[e]),!JD(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Co[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=XD.includes(t)?t:Co[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function JD(e){return e==="block"||e==="underline"||e==="bar"}function gl(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&gl(e[r],t-1);return n}var v_=Object.freeze({insertMode:!1}),x_=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),cg=class extends Ce{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ee),this.onData=this._onData.event,this._onUserInput=this._register(new ee),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ee),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ee),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=gl(v_),this.decPrivateModes=gl(x_)}reset(){this.modes=gl(v_),this.decPrivateModes=gl(x_)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};cg=at([oe(0,vn),oe(1,oC),oe(2,xn)],cg);var y_={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Mf(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var Lf=String.fromCharCode,__={DEFAULT:e=>{let t=[Mf(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Lf(t[0])}${Lf(t[1])}${Lf(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Mf(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Mf(e,!0)};${e.x};${e.y}${t}`}},ug=class extends Ce{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ee),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(y_))this.addProtocol(r,y_[r]);for(let r of Object.keys(__))this.addEncoding(r,__[r]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=r+0,Math.abs(e.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};ug=at([oe(0,vn),oe(1,xo),oe(2,xn)],ug);var Af=[[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]],ZD=[[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]],yt;function eM(e,t){let n=0,r=t.length-1,s;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(s=n+r>>1,e>t[s][1])n=s+1;else if(e<t[s][0])r=s-1;else return!0;return!1}var tM=class{constructor(){if(this.version="6",!yt){yt=new Uint8Array(65536),yt.fill(1),yt[0]=0,yt.fill(0,1,32),yt.fill(0,127,160),yt.fill(2,4352,4448),yt[9001]=2,yt[9002]=2,yt.fill(2,11904,42192),yt[12351]=1,yt.fill(2,44032,55204),yt.fill(2,63744,64256),yt.fill(2,65040,65050),yt.fill(2,65072,65136),yt.fill(2,65280,65377),yt.fill(2,65504,65511);for(let e=0;e<Af.length;++e)yt.fill(0,Af[e][0],Af[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?yt[e]:eM(e,ZD)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let s=Bi.extractWidth(t);s===0?r=!1:s>n&&(n=s)}return Bi.createPropertyValue(0,n,r)}},Bi=class Gu{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ee,this.onChange=this._onChange.event;let t=new tM;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,r=!1){return(t&16777215)<<3|(n&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,r=0,s=t.length;for(let i=0;i<s;++i){let o=t.charCodeAt(i);if(55296<=o&&o<=56319){if(++i>=s)return n+this.wcwidth(o);let u=t.charCodeAt(i);56320<=u&&u<=57343?o=(o-55296)*1024+u-56320+65536:n+=this.wcwidth(u)}let l=this.charProperties(o,r),c=Gu.extractWidth(l);Gu.extractShouldJoin(l)&&(c-=Gu.extractWidth(r)),n+=c,r=l}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},nM=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function b_(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var el=2147483647,rM=256,$C=class dg{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>rM)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new dg;if(!t.length)return n;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let s=t[r];if(Array.isArray(s))for(let i=0;i<s.length;++i)n.addSubParam(s[i]);else n.addParam(s)}return n}clone(){let t=new dg(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let r=this._subParamsIdx[n]>>8,s=this._subParamsIdx[n]&255;s-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,s))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>el?el:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>el?el:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-n>0?this._subParams.subarray(n,r):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let r=this._subParamsIdx[n]>>8,s=this._subParamsIdx[n]&255;s-r>0&&(t[n]=this._subParams.slice(r,s))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,s=r[n-1];r[n-1]=~s?Math.min(s*10+t,el):t}},tl=[],sM=class{constructor(){this._state=0,this._active=tl,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=tl}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=tl,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||tl,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",Ch(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=tl,this._id=-1,this._state=0}}},Bn=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,n,r){this._hitLimit||(this._data+=Ch(t,n,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let n=!1;if(this._hitLimit)n=!1;else if(t&&(n=this._handler(this._data),n instanceof Promise))return n.then(r=>(this._data="",this._hitLimit=!1,r));return this._data="",this._hitLimit=!1,n}},nl=[],iM=class{constructor(){this._handlers=Object.create(null),this._active=nl,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=nl}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=nl,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||nl,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",Ch(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=nl,this._ident=0}},vl=new $C;vl.addParam(0);var w_=class{constructor(e){this._handler=e,this._data="",this._params=vl,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():vl,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Ch(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=vl,this._data="",this._hitLimit=!1,n));return this._params=vl,this._data="",this._hitLimit=!1,t}},oM=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let s=0;s<e.length;s++)this.table[t<<8|e[s]]=n<<4|r}},tr=160,aM=function(){let e=new oM(4095),t=Array.apply(null,Array(256)).map((l,c)=>c),n=(l,c)=>t.slice(l,c),r=n(32,127),s=n(0,24);s.push(25),s.push.apply(s,n(28,32));let i=n(0,14),o;e.setDefault(1,0),e.addMany(r,0,2,0);for(o in i)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(s,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(s,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(s,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(s,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(s,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(s,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(tr,0,2,0),e.add(tr,8,5,8),e.add(tr,6,0,6),e.add(tr,11,0,11),e.add(tr,13,13,13),e}(),lM=class extends Ce{constructor(e=aM){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new $C,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Ye(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new sM),this._dcsParser=this._register(new iM),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let s=0;s<e.intermediates.length;++s){let i=e.intermediates.charCodeAt(s);if(32>i||i>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=i}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,s){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=s}parse(e,t,n){let r=0,s=0,i=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,i=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let l=this._parseStack.handlers,c=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&c>-1){for(;c>=0&&(o=l[c](this._params),o!==!0);c--)if(o instanceof Promise)return this._parseStack.handlerPos=c,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&c>-1){for(;c>=0&&(o=l[c](),o!==!0);c--)if(o instanceof Promise)return this._parseStack.handlerPos=c,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,i=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let l=i;l<t;++l){switch(r=e[l],s=this._transitions.table[this.currentState<<8|(r<160?r:tr)],s>>4){case 2:for(let p=l+1;;++p){if(p>=t||(r=e[p])<32||r>126&&r<tr){this._printHandler(e,l,p),l=p-1;break}if(++p>=t||(r=e[p])<32||r>126&&r<tr){this._printHandler(e,l,p),l=p-1;break}if(++p>=t||(r=e[p])<32||r>126&&r<tr){this._printHandler(e,l,p),l=p-1;break}if(++p>=t||(r=e[p])<32||r>126&&r<tr){this._printHandler(e,l,p),l=p-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:l,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let c=this._csiHandlers[this._collect<<8|r],u=c?c.length-1:-1;for(;u>=0&&(o=c[u](this._params),o!==!0);u--)if(o instanceof Promise)return this._preserveStack(3,c,u,s,l),o;u<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++l<t&&(r=e[l])>47&&r<60);l--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let h=this._escHandlers[this._collect<<8|r],d=h?h.length-1:-1;for(;d>=0&&(o=h[d](),o!==!0);d--)if(o instanceof Promise)return this._preserveStack(4,h,d,s,l),o;d<0&&this._escHandlerFb(this._collect<<8|r),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|r,this._params);break;case 13:for(let p=l+1;;++p)if(p>=t||(r=e[p])===24||r===26||r===27||r>127&&r<tr){this._dcsParser.put(e,l,p),l=p-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,s,l),o;r===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let p=l+1;;p++)if(p>=t||(r=e[p])<32||r>127&&r<tr){this._oscParser.put(e,l,p),l=p-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,s,l),o;r===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=s&15}}},cM=/^([\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})$/,uM=/^[\da-f]+$/;function S_(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=cM.exec(t);if(n){let r=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/r*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/r*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),uM.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,r=[0,0,0];for(let s=0;s<3;++s){let i=parseInt(t.slice(n*s,n*s+n),16);r[s]=n===1?i<<4:n===2?i:n===3?i>>4:i>>8}return r}}function Of(e,t){let n=e.toString(16),r=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function dM(e,t=16){let[n,r,s]=e;return`rgb:${Of(n,t)}/${Of(r,t)}/${Of(s,t)}`}var hM={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Os=131072,k_=10;function C_(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var N_=5e3,j_=0,fM=class extends Ce{constructor(e,t,n,r,s,i,o,l,c=new lM){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=s,this._oscLinkService=i,this._coreMouseService=o,this._unicodeService=l,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new DT,this._utf8Decoder=new MT,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=ht.clone(),this._eraseAttrDataInternal=ht.clone(),this._onRequestBell=this._register(new ee),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ee),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ee),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ee),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ee),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ee),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ee),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ee),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ee),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ee),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ee),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ee),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ee),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 hg(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(u=>this._activeBuffer=u.activeBuffer)),this._parser.setCsiHandlerFallback((u,h)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(u),params:h.toArray()})}),this._parser.setEscHandlerFallback(u=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(u)})}),this._parser.setExecuteHandlerFallback(u=>{this._logService.debug("Unknown EXECUTE code: ",{code:u})}),this._parser.setOscHandlerFallback((u,h,d)=>{this._logService.debug("Unknown OSC code: ",{identifier:u,action:h,data:d})}),this._parser.setDcsHandlerFallback((u,h,d)=>{h==="HOOK"&&(d=d.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(u),action:h,payload:d})}),this._parser.setPrintHandler((u,h,d)=>this.print(u,h,d)),this._parser.registerCsiHandler({final:"@"},u=>this.insertChars(u)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},u=>this.scrollLeft(u)),this._parser.registerCsiHandler({final:"A"},u=>this.cursorUp(u)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},u=>this.scrollRight(u)),this._parser.registerCsiHandler({final:"B"},u=>this.cursorDown(u)),this._parser.registerCsiHandler({final:"C"},u=>this.cursorForward(u)),this._parser.registerCsiHandler({final:"D"},u=>this.cursorBackward(u)),this._parser.registerCsiHandler({final:"E"},u=>this.cursorNextLine(u)),this._parser.registerCsiHandler({final:"F"},u=>this.cursorPrecedingLine(u)),this._parser.registerCsiHandler({final:"G"},u=>this.cursorCharAbsolute(u)),this._parser.registerCsiHandler({final:"H"},u=>this.cursorPosition(u)),this._parser.registerCsiHandler({final:"I"},u=>this.cursorForwardTab(u)),this._parser.registerCsiHandler({final:"J"},u=>this.eraseInDisplay(u,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},u=>this.eraseInDisplay(u,!0)),this._parser.registerCsiHandler({final:"K"},u=>this.eraseInLine(u,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},u=>this.eraseInLine(u,!0)),this._parser.registerCsiHandler({final:"L"},u=>this.insertLines(u)),this._parser.registerCsiHandler({final:"M"},u=>this.deleteLines(u)),this._parser.registerCsiHandler({final:"P"},u=>this.deleteChars(u)),this._parser.registerCsiHandler({final:"S"},u=>this.scrollUp(u)),this._parser.registerCsiHandler({final:"T"},u=>this.scrollDown(u)),this._parser.registerCsiHandler({final:"X"},u=>this.eraseChars(u)),this._parser.registerCsiHandler({final:"Z"},u=>this.cursorBackwardTab(u)),this._parser.registerCsiHandler({final:"`"},u=>this.charPosAbsolute(u)),this._parser.registerCsiHandler({final:"a"},u=>this.hPositionRelative(u)),this._parser.registerCsiHandler({final:"b"},u=>this.repeatPrecedingCharacter(u)),this._parser.registerCsiHandler({final:"c"},u=>this.sendDeviceAttributesPrimary(u)),this._parser.registerCsiHandler({prefix:">",final:"c"},u=>this.sendDeviceAttributesSecondary(u)),this._parser.registerCsiHandler({final:"d"},u=>this.linePosAbsolute(u)),this._parser.registerCsiHandler({final:"e"},u=>this.vPositionRelative(u)),this._parser.registerCsiHandler({final:"f"},u=>this.hVPosition(u)),this._parser.registerCsiHandler({final:"g"},u=>this.tabClear(u)),this._parser.registerCsiHandler({final:"h"},u=>this.setMode(u)),this._parser.registerCsiHandler({prefix:"?",final:"h"},u=>this.setModePrivate(u)),this._parser.registerCsiHandler({final:"l"},u=>this.resetMode(u)),this._parser.registerCsiHandler({prefix:"?",final:"l"},u=>this.resetModePrivate(u)),this._parser.registerCsiHandler({final:"m"},u=>this.charAttributes(u)),this._parser.registerCsiHandler({final:"n"},u=>this.deviceStatus(u)),this._parser.registerCsiHandler({prefix:"?",final:"n"},u=>this.deviceStatusPrivate(u)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},u=>this.softReset(u)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},u=>this.setCursorStyle(u)),this._parser.registerCsiHandler({final:"r"},u=>this.setScrollRegion(u)),this._parser.registerCsiHandler({final:"s"},u=>this.saveCursor(u)),this._parser.registerCsiHandler({final:"t"},u=>this.windowOptions(u)),this._parser.registerCsiHandler({final:"u"},u=>this.restoreCursor(u)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},u=>this.insertColumns(u)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},u=>this.deleteColumns(u)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},u=>this.selectProtected(u)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},u=>this.requestMode(u,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},u=>this.requestMode(u,!1)),this._parser.setExecuteHandler(Y.BEL,()=>this.bell()),this._parser.setExecuteHandler(Y.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Y.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Y.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Y.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Y.BS,()=>this.backspace()),this._parser.setExecuteHandler(Y.HT,()=>this.tab()),this._parser.setExecuteHandler(Y.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Y.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Qu.IND,()=>this.index()),this._parser.setExecuteHandler(Qu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Qu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Bn(u=>(this.setTitle(u),this.setIconName(u),!0))),this._parser.registerOscHandler(1,new Bn(u=>this.setIconName(u))),this._parser.registerOscHandler(2,new Bn(u=>this.setTitle(u))),this._parser.registerOscHandler(4,new Bn(u=>this.setOrReportIndexedColor(u))),this._parser.registerOscHandler(8,new Bn(u=>this.setHyperlink(u))),this._parser.registerOscHandler(10,new Bn(u=>this.setOrReportFgColor(u))),this._parser.registerOscHandler(11,new Bn(u=>this.setOrReportBgColor(u))),this._parser.registerOscHandler(12,new Bn(u=>this.setOrReportCursorColor(u))),this._parser.registerOscHandler(104,new Bn(u=>this.restoreIndexedColor(u))),this._parser.registerOscHandler(110,new Bn(u=>this.restoreFgColor(u))),this._parser.registerOscHandler(111,new Bn(u=>this.restoreBgColor(u))),this._parser.registerOscHandler(112,new Bn(u=>this.restoreCursorColor(u))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let u in Ct)this._parser.registerEscHandler({intermediates:"(",final:u},()=>this.selectCharset("("+u)),this._parser.registerEscHandler({intermediates:")",final:u},()=>this.selectCharset(")"+u)),this._parser.registerEscHandler({intermediates:"*",final:u},()=>this.selectCharset("*"+u)),this._parser.registerEscHandler({intermediates:"+",final:u},()=>this.selectCharset("+"+u)),this._parser.registerEscHandler({intermediates:"-",final:u},()=>this.selectCharset("-"+u)),this._parser.registerEscHandler({intermediates:".",final:u},()=>this.selectCharset("."+u)),this._parser.registerEscHandler({intermediates:"/",final:u},()=>this.selectCharset("/"+u));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(u=>(this._logService.error("Parsing error: ",u),u)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new w_((u,h)=>this.requestStatusString(u,h)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),N_))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${N_} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,s=this._activeBuffer.y,i=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Os&&(i=this._parseStack.position+Os)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,u=>String.fromCharCode(u)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(u=>u.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Os&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Os))),o||this._dirtyRowTracker.clearRange(),e.length>Os)for(let u=i;u<e.length;u+=Os){let h=u+Os<e.length?u+Os:e.length,d=typeof e=="string"?this._stringDecoder.decode(e.substring(u,h),this._parseBuffer):this._utf8Decoder.decode(e.subarray(u,h),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,d))return this._preserveStack(r,s,d,u),this._logSlowResolvingAsync(n),n}else if(!o){let u=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,u))return this._preserveStack(r,s,u,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(e,t,n){let r,s,i=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,u=this._coreService.modes.insertMode,h=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,h);let p=this._parser.precedingJoinState;for(let f=t;f<n;++f){if(r=e[f],r<127&&i){let x=i[String.fromCharCode(r)];x&&(r=x.charCodeAt(0))}let m=this._unicodeService.charProperties(r,p);s=Bi.extractWidth(m);let g=Bi.extractShouldJoin(m),b=g?Bi.extractWidth(p):0;if(p=m,o&&this._onA11yChar.fire(Ws(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-b>l){if(c){let x=d,y=this._activeBuffer.x-b;for(this._activeBuffer.x=b,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),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),b>0&&d instanceof ml&&d.copyCellsFrom(x,y,0,b,!1);y<l;)x.setCellFromCodepoint(y++,0,1,h)}else if(this._activeBuffer.x=l-1,s===2)continue}if(g&&this._activeBuffer.x){let x=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-x,r,s);for(let y=s-b;--y>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(u&&(d.insertCells(this._activeBuffer.x,s-b,this._activeBuffer.getNullCell(h)),d.getWidth(l-1)===2&&d.setCellFromCodepoint(l-1,0,1,h)),d.setCellFromCodepoint(this._activeBuffer.x++,r,s,h),s>0)for(;--s;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,h)}this._parser.precedingJoinState=p,this._activeBuffer.x<l&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,h),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>C_(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new w_(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Bn(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 e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let 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;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,s=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),s),r&&(i.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var r;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&r.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,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);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.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(e){let t=e.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(ht));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=Bi.extractWidth(t),s=this._activeBuffer.x-r,i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),o=new Uint32Array(i.length*n),l=0;for(let u=0;u<i.length;){let h=i.codePointAt(u)||0;o[l++]=h,u+=h>65535?2:1}let c=l;for(let u=1;u<n;++u)o.copyWithin(c,0,l),c+=l;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(Y.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(Y.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(Y.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(Y.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(Y.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Pi),this._charsetService.setgCharset(1,Pi),this._charsetService.setgCharset(2,Pi),this._charsetService.setgCharset(3,Pi);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.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:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(g=>(g[g.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",g[g.SET=1]="SET",g[g.RESET=2]="RESET",g[g.PERMANENTLY_SET=3]="PERMANENTLY_SET",g[g.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let r=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:i}=this._coreMouseService,o=this._coreService,{buffers:l,cols:c}=this._bufferService,{active:u,alt:h}=l,d=this._optionsService.rawOptions,p=(g,b)=>(o.triggerDataEvent(`${Y.ESC}[${t?"":"?"}${g};${b}$y`),!0),f=g=>g?1:2,m=e.params[0];return t?m===2?p(m,4):m===4?p(m,f(o.modes.insertMode)):m===12?p(m,3):m===20?p(m,f(d.convertEol)):p(m,0):m===1?p(m,f(r.applicationCursorKeys)):m===3?p(m,d.windowOptions.setWinLines?c===80?2:c===132?1:0:0):m===6?p(m,f(r.origin)):m===7?p(m,f(r.wraparound)):m===8?p(m,3):m===9?p(m,f(s==="X10")):m===12?p(m,f(d.cursorBlink)):m===25?p(m,f(!o.isCursorHidden)):m===45?p(m,f(r.reverseWraparound)):m===66?p(m,f(r.applicationKeypad)):m===67?p(m,4):m===1e3?p(m,f(s==="VT200")):m===1002?p(m,f(s==="DRAG")):m===1003?p(m,f(s==="ANY")):m===1004?p(m,f(r.sendFocus)):m===1005?p(m,4):m===1006?p(m,f(i==="SGR")):m===1015?p(m,4):m===1016?p(m,f(i==="SGR_PIXELS")):m===1048?p(m,1):m===47||m===1047||m===1049?p(m,f(u===h)):m===2004?p(m,f(r.bracketedPasteMode)):m===2026?p(m,f(r.synchronizedOutput)):p(m,0)}_updateAttrColor(e,t,n,r,s){return t===2?(e|=50331648,e&=-16777216,e|=Tc.fromColorRGB([n,r,s])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],s=0,i=0;do{if(r[i+s]=e.params[t+i],e.hasSubParams(t+i)){let o=e.getSubParams(t+i),l=0;do r[1]===5&&(s=1),r[i+l+1+s]=o[l];while(++l<o.length&&l+i+1+s<r.length);break}if(r[1]===5&&i+s>=2||r[1]===2&&i+s>=5)break;r[1]&&(s=1)}while(++i+t<e.length&&i+s<r.length);for(let o=2;o<r.length;++o)r[o]===-1&&(r[o]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return i}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=ht.fg,e.bg=ht.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let s=0;s<t;s++)n=e.params[s],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777216|n-90|8):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777216|n-100|8):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(s)?e.getSubParams(s)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=ht.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=ht.bg&16777215):n===38||n===48||n===58?s+=this._extractColor(e,s,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=ht.fg&16777215,r.bg&=-67108864,r.bg|=ht.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Y.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Y.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Y.ESC}[?${t};${n}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=ht.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!C_(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${Y.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>k_&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>k_&&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());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let r=n.shift(),s=n.shift();if(/^\d+$/.exec(r)){let i=parseInt(r);if(E_(i))if(s==="?")t.push({type:0,index:i});else{let o=S_(s);o&&t.push({type:1,index:i,color:o})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,s=n.findIndex(i=>i.startsWith("id="));return s!==-1&&(r=n[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,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(e,t){let n=e.split(";");for(let r=0;r<n.length&&!(t>=this._specialColors.length);++r,++t)if(n[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let s=S_(n[r]);s&&this._onColor.fire([{type:1,index:this._specialColors[t],color:s}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let r=0;r<n.length;++r)if(/^\d+$/.exec(n[r])){let s=parseInt(n[r]);E_(s)&&t.push({type:2,index:s})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,Pi),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(hM[e[0]],Ct[e[1]]||Pi),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=ht.clone(),this._eraseAttrDataInternal=ht.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new cr;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=o=>(this._coreService.triggerDataEvent(`${Y.ESC}${o}${Y.ESC}\\`),!0),r=this._bufferService.buffer,s=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},hg=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(j_=e,e=t,t=j_),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};hg=at([oe(0,vn)],hg);function E_(e){return 0<=e&&e<256}var pM=5e7,R_=12,mM=50,gM=class extends Ce{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new ee),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>pM)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],s=this._action(r,t);if(s){let o=l=>performance.now()-n>=R_?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(n,l);s.catch(l=>(queueMicrotask(()=>{throw l}),Promise.resolve(!1))).then(o);return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-n>=R_)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>mM&&(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()}},fg=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let l=t.addMarker(t.ybase+t.y),c={data:e,id:this._nextId++,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(c,l)),this._dataByLinkId.set(c.id,c),c.id}let n=e,r=this._getEntryIdKey(n),s=this._entriesWithId.get(r);if(s)return this.addLineToLink(s.id,t.ybase+t.y),s.id;let i=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[i]};return i.onDispose(()=>this._removeMarkerFromLink(o,i)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);n.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(n,r))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};fg=at([oe(0,vn)],fg);var T_=!1,vM=class extends Ce{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Sa),this._onBinary=this._register(new ee),this.onBinary=this._onBinary.event,this._onData=this._register(new ee),this.onData=this._onData.event,this._onLineFeed=this._register(new ee),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ee),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ee),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ee),this._instantiationService=new $D,this.optionsService=this._register(new GD(e)),this._instantiationService.setService(xn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(lg)),this._instantiationService.setService(vn,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(ag)),this._instantiationService.setService(oC,this._logService),this.coreService=this._register(this._instantiationService.createInstance(cg)),this._instantiationService.setService(xo,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(ug)),this._instantiationService.setService(iC,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Bi)),this._instantiationService.setService(IT,this.unicodeService),this._charsetService=this._instantiationService.createInstance(nM),this._instantiationService.setService(OT,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(fg),this._instantiationService.setService(aC,this._oscLinkService),this._inputHandler=this._register(new fM(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Wt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Wt.forward(this._bufferService.onResize,this._onResize)),this._register(Wt.forward(this.coreService.onData,this._onData)),this._register(Wt.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new gM((t,n)=>this._inputHandler.parse(t,n))),this._register(Wt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ee),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!T_&&(this._logService.warn("writeSync is unreliable and will be removed soon."),T_=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,FC),t=Math.max(t,zC),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(b_.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(b_(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Ye(()=>{for(let t of e)t.dispose()})}}},xM={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function yM(e,t,n,r){var o;let s={type:0,cancel:!1,key:void 0},i=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?s.key=Y.ESC+"OA":s.key=Y.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?s.key=Y.ESC+"OD":s.key=Y.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?s.key=Y.ESC+"OC":s.key=Y.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?s.key=Y.ESC+"OB":s.key=Y.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":Y.DEL,e.altKey&&(s.key=Y.ESC+s.key);break;case 9:if(e.shiftKey){s.key=Y.ESC+"[Z";break}s.key=Y.HT,s.cancel=!0;break;case 13:s.key=e.altKey?Y.ESC+Y.CR:Y.CR,s.cancel=!0;break;case 27:s.key=Y.ESC,e.altKey&&(s.key=Y.ESC+Y.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;i?s.key=Y.ESC+"[1;"+(i+1)+"D":t?s.key=Y.ESC+"OD":s.key=Y.ESC+"[D";break;case 39:if(e.metaKey)break;i?s.key=Y.ESC+"[1;"+(i+1)+"C":t?s.key=Y.ESC+"OC":s.key=Y.ESC+"[C";break;case 38:if(e.metaKey)break;i?s.key=Y.ESC+"[1;"+(i+1)+"A":t?s.key=Y.ESC+"OA":s.key=Y.ESC+"[A";break;case 40:if(e.metaKey)break;i?s.key=Y.ESC+"[1;"+(i+1)+"B":t?s.key=Y.ESC+"OB":s.key=Y.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(s.key=Y.ESC+"[2~");break;case 46:i?s.key=Y.ESC+"[3;"+(i+1)+"~":s.key=Y.ESC+"[3~";break;case 36:i?s.key=Y.ESC+"[1;"+(i+1)+"H":t?s.key=Y.ESC+"OH":s.key=Y.ESC+"[H";break;case 35:i?s.key=Y.ESC+"[1;"+(i+1)+"F":t?s.key=Y.ESC+"OF":s.key=Y.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=Y.ESC+"[5;"+(i+1)+"~":s.key=Y.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=Y.ESC+"[6;"+(i+1)+"~":s.key=Y.ESC+"[6~";break;case 112:i?s.key=Y.ESC+"[1;"+(i+1)+"P":s.key=Y.ESC+"OP";break;case 113:i?s.key=Y.ESC+"[1;"+(i+1)+"Q":s.key=Y.ESC+"OQ";break;case 114:i?s.key=Y.ESC+"[1;"+(i+1)+"R":s.key=Y.ESC+"OR";break;case 115:i?s.key=Y.ESC+"[1;"+(i+1)+"S":s.key=Y.ESC+"OS";break;case 116:i?s.key=Y.ESC+"[15;"+(i+1)+"~":s.key=Y.ESC+"[15~";break;case 117:i?s.key=Y.ESC+"[17;"+(i+1)+"~":s.key=Y.ESC+"[17~";break;case 118:i?s.key=Y.ESC+"[18;"+(i+1)+"~":s.key=Y.ESC+"[18~";break;case 119:i?s.key=Y.ESC+"[19;"+(i+1)+"~":s.key=Y.ESC+"[19~";break;case 120:i?s.key=Y.ESC+"[20;"+(i+1)+"~":s.key=Y.ESC+"[20~";break;case 121:i?s.key=Y.ESC+"[21;"+(i+1)+"~":s.key=Y.ESC+"[21~";break;case 122:i?s.key=Y.ESC+"[23;"+(i+1)+"~":s.key=Y.ESC+"[23~";break;case 123:i?s.key=Y.ESC+"[24;"+(i+1)+"~":s.key=Y.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?s.key=Y.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?s.key=Y.DEL:e.keyCode===219?s.key=Y.ESC:e.keyCode===220?s.key=Y.FS:e.keyCode===221&&(s.key=Y.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let l=(o=xM[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(l)s.key=Y.ESC+l;else if(e.keyCode>=65&&e.keyCode<=90){let c=e.ctrlKey?e.keyCode-64:e.keyCode+32,u=String.fromCharCode(c);e.shiftKey&&(u=u.toUpperCase()),s.key=Y.ESC+u}else if(e.keyCode===32)s.key=Y.ESC+(e.ctrlKey?Y.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let c=e.code.slice(3,4);e.shiftKey||(c=c.toLowerCase()),s.key=Y.ESC+c,s.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(s.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?s.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(s.key=Y.US),e.key==="@"&&(s.key=Y.NUL));break}return s}var lt=0,_M=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Ud,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Ud,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((s,i)=>this._getKey(s)-this._getKey(i)),t=0,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let s=0;s<r.length;s++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[s]=e[t],t++):r[s]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(lt=this._search(t),lt===-1)||this._getKey(this._array[lt])!==t)return!1;do if(this._array[lt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(lt),!0;while(++lt<this._array.length&&this._getKey(this._array[lt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((s,i)=>s-i),t=0,n=new Array(this._array.length-e.length),r=0;for(let s=0;s<this._array.length;s++)e[t]===s?t++:n[r++]=this._array[s];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(lt=this._search(e),!(lt<0||lt>=this._array.length)&&this._getKey(this._array[lt])===e))do yield this._array[lt];while(++lt<this._array.length&&this._getKey(this._array[lt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(lt=this._search(e),!(lt<0||lt>=this._array.length)&&this._getKey(this._array[lt])===e))do t(this._array[lt]);while(++lt<this._array.length&&this._getKey(this._array[lt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,s=this._getKey(this._array[r]);if(s>e)n=r-1;else if(s<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},If=0,P_=0,bM=class extends Ce{constructor(){super(),this._decorations=new _M(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new ee),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ee),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Ye(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new wM(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,s=0;for(let i of this._decorations.getKeyIterator(t))r=i.options.x??0,s=r+(i.options.width??1),e>=r&&e<s&&(!n||(i.options.layer??"bottom")===n)&&(yield i)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,s=>{If=s.options.x??0,P_=If+(s.options.width??1),e>=If&&e<P_&&(!n||(s.options.layer??"bottom")===n)&&r(s)})}},wM=class extends pi{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ee),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ee),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Ge.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ge.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},SM=1e3,kM=class{constructor(e,t=SM){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let s=r-this._lastRefreshMs,i=this._debounceThresholdMS-s;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},i)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},D_=20,qd=class extends Ce{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let i=0;i<this._terminal.rows;i++)this._rowElements[i]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[i]);if(this._topBoundaryFocusListener=i=>this._handleBoundaryFocus(i,0),this._bottomBoundaryFocusListener=i=>this._handleBoundaryFocus(i,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new kM(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(i=>this._handleResize(i.rows))),this._register(this._terminal.onRender(i=>this._refreshRows(i.start,i.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(i=>this._handleChar(i))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
483
- `))),this._register(this._terminal.onA11yTab(i=>this._handleTab(i))),this._register(this._terminal.onKey(i=>this._handleKey(i.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(ge(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Ye(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<D_+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
484
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===D_+1&&(this._liveRegion.textContent+=Mm.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let s=e;s<=t;s++){let i=n.lines.get(n.ydisp+s),o=[],l=(i==null?void 0:i.translateToString(!0,void 0,void 0,o))||"",c=(n.ydisp+s+1).toString(),u=this._rowElements[s];u&&(l.length===0?(u.textContent=" ",this._rowColumns.set(u,[0,1])):(u.textContent=l,this._rowColumns.set(u,o)),u.setAttribute("aria-posinset",c),u.setAttribute("aria-setsize",r),this._alignRowWidth(u))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],s=n.getAttribute("aria-posinset"),i=t===0?"1":`${this._terminal.buffer.lines.length}`;if(s===i||e.relatedTarget!==r)return;let o,l;if(t===0?(o=n,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=n,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let c=this._createAccessibilityTreeNode();this._rowElements.unshift(c),this._rowContainer.insertAdjacentElement("afterbegin",c)}else{let c=this._createAccessibilityTreeNode();this._rowElements.push(c),this._rowContainer.appendChild(c)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var l;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:((l=r.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(n.node))return;let s=({node:c,offset:u})=>{let h=c instanceof Text?c.parentNode:c,d=parseInt(h==null?void 0:h.getAttribute("aria-posinset"),10)-1;if(isNaN(d))return console.warn("row is invalid. Race condition?"),null;let p=this._rowColumns.get(h);if(!p)return console.warn("columns is null. Race condition?"),null;let f=u<p.length?p[u]:p.slice(-1)[0]+1;return f>=this._terminal.cols&&(++d,f=0),{row:d,column:f}},i=s(t),o=s(n);if(!(!i||!o)){if(i.row>o.row||i.row===o.row&&i.column>=o.column)throw new Error("invalid range");this._terminal.select(i.column,i.row,(o.row-i.row)*this._terminal.cols-i.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var s,i;e.style.transform="";let t=e.getBoundingClientRect().width,n=(i=(s=this._rowColumns.get(e))==null?void 0:s.slice(-1))==null?void 0:i[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};qd=at([oe(1,ix),oe(2,Cs),oe(3,Ns)],qd);var pg=class extends Ce{constructor(e,t,n,r,s){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ee),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ee),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Ye(()=>{var i;lo(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(i=this._activeProviderReplies)==null||i.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(ge(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(ge(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(ge(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(ge(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let r=0;r<n.length;r++){let s=n[r];if(s.classList.contains("xterm"))break;if(s.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var r,s;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(i=>{i==null||i.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[i,o]of this._linkProviderService.linkProviders.entries())t?(s=this._activeProviderReplies)!=null&&s.get(i)&&(n=this._checkLinkProviderResult(i,e,n)):o.provideLinks(e.y,l=>{var u,h;if(this._isMouseOut)return;let c=l==null?void 0:l.map(d=>({link:d}));(u=this._activeProviderReplies)==null||u.set(i,c),n=this._checkLinkProviderResult(i,e,n),((h=this._activeProviderReplies)==null?void 0:h.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let s=t.get(r);if(s)for(let i=0;i<s.length;i++){let o=s[i],l=o.link.range.start.y<e?0:o.link.range.start.x,c=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let u=l;u<=c;u++){if(n.has(u)){s.splice(i--,1);break}n.add(u)}}}}_checkLinkProviderResult(e,t,n){var i;if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),s=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(s=!0);if(!s&&r){let o=r.find(l=>this._linkAtPosition(l.link,t));o&&(n=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let o=0;o<this._activeProviderReplies.size;o++){let l=(i=this._activeProviderReplies.get(o))==null?void 0:i.find(c=>this._linkAtPosition(c.link,t));if(l){n=!0,this._handleNewLink(l);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&CM(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,lo(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.pointerCursor},set:n=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.underline},set:n=>{var r,s,i;(r=this._currentLink)!=null&&r.state&&((i=(s=this._currentLink)==null?void 0:s.state)==null?void 0:i.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let r=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(r,s),this._lastMouseEvent)){let i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._askForLink(i,!1)}})))}_linkHover(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,s=t.y*this._bufferService.cols+t.x;return n<=s&&s<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,s){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:s}}};pg=at([oe(1,ox),oe(2,Ns),oe(3,vn),oe(4,cC)],pg);function CM(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var NM=class extends vM{constructor(e={}){super(e),this._linkifier=this._register(new Sa),this.browser=EC,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Sa),this._onCursorMove=this._register(new ee),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ee),this.onKey=this._onKey.event,this._onRender=this._register(new ee),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ee),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ee),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ee),this.onBell=this._onBell.event,this._onFocus=this._register(new ee),this._onBlur=this._register(new ee),this._onA11yCharEmitter=this._register(new ee),this._onA11yTabEmitter=this._register(new ee),this._onWillOpen=this._register(new ee),this._setup(),this._decorationService=this._instantiationService.createInstance(bM),this._instantiationService.setService(Pc,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(mD),this._instantiationService.setService(cC,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Am)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(Wt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Wt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Wt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Wt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Ye(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,r="";switch(t.index){case 256:n="foreground",r="10";break;case 257:n="background",r="11";break;case 258:n="cursor",r="12";break;default:n="ansi",r="4;"+t.index}switch(t.type){case 0:let s=We.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${Y.ESC}]${r};${dM(s)}${NC.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(i=>i.ansi[t.index]=ft.toColor(...t.color));else{let i=n;this._themeService.modifyColors(o=>o[i]=ft.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(qd,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Y.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Y.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,s=t.getWidth(n),i=this._renderService.dimensions.css.cell.width*s,o=this.buffer.y*this._renderService.dimensions.css.cell.height,l=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=l+"px",this.textarea.style.top=o+"px",this.textarea.style.width=i+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(ge(this.element,"copy",t=>{this.hasSelection()&&TT(t,this._selectionService)}));let e=t=>PT(t,this.textarea,this.coreService,this.optionsService);this._register(ge(this.textarea,"paste",e)),this._register(ge(this.element,"paste",e)),RC?this._register(ge(this.element,"mousedown",t=>{t.button===2&&H0(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(ge(this.element,"contextmenu",t=>{H0(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),px&&this._register(ge(this.element,"auxclick",t=>{t.button===1&&eC(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(ge(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(ge(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(ge(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(ge(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(ge(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(ge(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(ge(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var s;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((s=this.element)==null?void 0:s.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(ge(this.screenElement,"mousemove",i=>this.updateCursorStyle(i))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Dm.get()),DC||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(fD,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Cs,this._coreBrowserService),this._register(ge(this.textarea,"focus",i=>this._handleTextAreaFocus(i))),this._register(ge(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(ng,this._document,this._helperContainer),this._instantiationService.setService(Nh,this._charSizeService),this._themeService=this._instantiationService.createInstance(og),this._instantiationService.setService(La,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Hd),this._instantiationService.setService(lC,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(sg,this.rows,this.screenElement)),this._instantiationService.setService(Ns,this._renderService),this._register(this._renderService.onRenderedViewportChange(i=>this._onRender.fire(i))),this.onResize(i=>this._renderService.resize(i.cols,i.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Zm,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(rg),this._instantiationService.setService(ox,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(pg,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Gm,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(i=>{super.scrollLines(i,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(ig,this.element,this.screenElement,r)),this._instantiationService.setService(FT,this._selectionService),this._register(this._selectionService.onRequestScrollLines(i=>this.scrollLines(i.amount,i.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(i=>this._renderService.handleSelectionChanged(i.start,i.end,i.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(i=>{this.textarea.value=i,this.textarea.focus(),this.textarea.select()})),this._register(Wt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var i;this._selectionService.refresh(),(i=this._viewport)==null||i.queueSync()})),this._register(this._instantiationService.createInstance(Jm,this.screenElement)),this._register(ge(this.element,"mousedown",i=>this._selectionService.handleMouseDown(i))),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(qd,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",i=>this._handleScreenReaderModeOptionChange(i))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance($d,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",i=>{!this._overviewRulerRenderer&&i&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance($d,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(tg,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(i){var u,h,d,p,f;let o=e._mouseService.getMouseReportCoords(i,e.screenElement);if(!o)return!1;let l,c;switch(i.overrideType||i.type){case"mousemove":c=32,i.buttons===void 0?(l=3,i.button!==void 0&&(l=i.button<3?i.button:3)):l=i.buttons&1?0:i.buttons&4?1:i.buttons&2?2:3;break;case"mouseup":c=0,l=i.button<3?i.button:3;break;case"mousedown":c=1,l=i.button<3?i.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(i)===!1)return!1;let m=i.deltaY;if(m===0||e.coreMouseService.consumeWheelEvent(i,(p=(d=(h=(u=e._renderService)==null?void 0:u.dimensions)==null?void 0:h.device)==null?void 0:d.cell)==null?void 0:p.height,(f=e._coreBrowserService)==null?void 0:f.dpr)===0)return!1;c=m<0?0:1,l=4;break;default:return!1}return c===void 0||l===void 0||l>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:l,action:c,ctrl:i.ctrlKey,alt:i.altKey,shift:i.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={mouseup:i=>(n(i),i.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(i)),wheel:i=>(n(i),this.cancel(i,!0)),mousedrag:i=>{i.buttons&&n(i)},mousemove:i=>{i.buttons||n(i)}};this._register(this.coreMouseService.onProtocolChange(i=>{i?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(i)),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()),i&8?r.mousemove||(t.addEventListener("mousemove",s.mousemove),r.mousemove=s.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),i&16?r.wheel||(t.addEventListener("wheel",s.wheel,{passive:!1}),r.wheel=s.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),i&2?r.mouseup||(r.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),i&4?r.mousedrag||(r.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(ge(t,"mousedown",i=>{if(i.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(i)))return n(i),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(i)})),this._register(ge(t,"wheel",i=>{var o,l,c,u,h;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(i)===!1)return!1;if(!this.buffer.hasScrollback){if(i.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(i,(u=(c=(l=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:l.device)==null?void 0:c.cell)==null?void 0:u.height,(h=e._coreBrowserService)==null?void 0:h.dpr)===0)return this.cancel(i,!0);let d=Y.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(i.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(d,!0),this.cancel(i,!0)}}},{passive:!1}))}refresh(e,t){var n;(n=this._renderService)==null||n.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){Zk(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var n;(n=this._selectionService)==null||n.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=yM(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let r=this.rows-1;return this.scrollLines(n.type===2?-r:r),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===Y.ETX||n.key===Y.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(jM(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var n;(n=this._charSizeService)==null||n.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(ht));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(Y.ESC+"[I"):this.coreService.triggerDataEvent(Y.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Y.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Y.ESC}[6;${s};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function jM(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var EM=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},RM=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new cr)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},M_=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new RM(t)}getNullCell(){return new cr}},TM=class extends Ce{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ee),this.onBufferChange=this._onBufferChange.event,this._normal=new M_(this._core.buffers.normal,"normal"),this._alternate=new M_(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)}},PM=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,r)=>t(n,r.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},DM=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},MM=["cols","rows"],Mr=0,LM=class extends Ce{constructor(e){super(),this._core=this._register(new NM(e)),this._addonManager=this._register(new EM),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],n=(r,s)=>{this._checkReadonlyOptions(r),this._core.options[r]=s};for(let r in this._core.options){let s={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,s)}}_checkReadonlyOptions(e){if(MM.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new PM(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new DM(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 TM(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
485
- `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Dm.get()},set promptLabel(e){Dm.set(e)},get tooMuchOutput(){return Mm.get()},set tooMuchOutput(e){Mm.set(e)}}}_verifyIntegers(...e){for(Mr of e)if(Mr===1/0||isNaN(Mr)||Mr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Mr of e)if(Mr&&(Mr===1/0||isNaN(Mr)||Mr%1!==0||Mr<0))throw new Error("This API only accepts positive integers")}};/**
486
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
487
- * @license MIT
488
- *
489
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
490
- * @license MIT
491
- *
492
- * Originally forked from (with the author's permission):
493
- * Fabrice Bellard's javascript vt100 for jslinux:
494
- * http://bellard.org/jslinux/
495
- * Copyright (c) 2011 Fabrice Bellard
496
- */var AM=2,OM=1,IM=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var d;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((d=this._terminal.options.overviewRuler)==null?void 0:d.width)||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue("height")),s=Math.max(0,parseInt(n.getPropertyValue("width"))),i=window.getComputedStyle(this._terminal.element),o={top:parseInt(i.getPropertyValue("padding-top")),bottom:parseInt(i.getPropertyValue("padding-bottom")),right:parseInt(i.getPropertyValue("padding-right")),left:parseInt(i.getPropertyValue("padding-left"))},l=o.top+o.bottom,c=o.right+o.left,u=r-l,h=s-c-t;return{cols:Math.max(AM,Math.floor(h/e.css.cell.width)),rows:Math.max(OM,Math.floor(u/e.css.cell.height))}}};function L_(e,t){let n;return(...r)=>{n&&clearTimeout(n),n=setTimeout(()=>e(...r),t)}}const A_="panopticon.terminal.autoCopyOnSelect",Bf=navigator.platform.toLowerCase().includes("mac");function O_({sessionName:e,onDisconnect:t,autoCopyOnSelect:n}){const r=v.useRef(null),s=v.useRef(null),i=v.useRef(null),o=v.useRef(null),l=v.useRef(0),c=v.useRef(null),u=5,[h,d]=v.useState(!0),[p,f]=v.useState(()=>{if(n!==void 0)return n;const M=localStorage.getItem(A_);return M===null?!0:M==="true"}),[m,g]=v.useState({visible:!1,x:0,y:0,canCopy:!1}),[b,x]=v.useState(!1),y=v.useRef(t);y.current=t,v.useEffect(()=>{try{localStorage.setItem(A_,String(p))}catch(M){console.error("Failed to save auto-copy setting:",M)}},[p]);const _=M=>Math.min(1e3*Math.pow(2,M),3e4),w=v.useCallback(async()=>{const M=s.current;if(!M||!M.hasSelection())return;const j=M.getSelection();try{await navigator.clipboard.writeText(j)}catch(E){console.error("Failed to copy to clipboard:",E);const $=document.createElement("textarea");$.value=j,$.style.position="fixed",$.style.opacity="0",document.body.appendChild($),$.select();try{document.execCommand("copy")}catch(q){console.error("Fallback copy failed:",q)}document.body.removeChild($)}},[]),C=v.useCallback(async()=>{var j;if(s.current)try{const E=await navigator.clipboard.readText();((j=o.current)==null?void 0:j.readyState)===WebSocket.OPEN&&o.current.send(E)}catch(E){console.error("Failed to read from clipboard:",E)}},[]),S=v.useCallback(M=>{const j=s.current;if(!j)return;const E=Bf?M.metaKey:M.ctrlKey;E&&M.key.toLowerCase()==="c"&&j.hasSelection()&&(M.preventDefault(),w()),E&&M.key.toLowerCase()==="v"&&(M.preventDefault(),C())},[w,C]),R=v.useCallback(M=>{M.preventDefault();const j=s.current;j&&g({visible:!0,x:M.clientX,y:M.clientY,canCopy:j.hasSelection()})},[]),T=v.useCallback(()=>{g(M=>({...M,visible:!1}))},[]),F=v.useCallback(()=>{w(),T()},[w,T]),P=v.useCallback(()=>{C(),T()},[C,T]);v.useEffect(()=>{if(!m.visible)return;const M=()=>{T()};return document.addEventListener("click",M),()=>document.removeEventListener("click",M)},[m.visible,T]);const I=v.useCallback(()=>{if(!r.current||!e)return;c.current&&(clearTimeout(c.current),c.current=null);const M=r.current;if(M.clientWidth===0||M.clientHeight===0){console.warn("XTerminal: Container has no size, retrying in 100ms"),setTimeout(()=>I(),100);return}console.log("XTerminal: Creating terminal, container size:",M.clientWidth,"x",M.clientHeight);let j=s.current,E=i.current;if(!j){j=new LM({cursorBlink:!0,cursorStyle:"block",fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',cols:120,rows:29,scrollback:5e3,convertEol:!1,scrollOnUserInput:!0,allowProposedApi:!0,theme:{background:"#1a1a2e",foreground:"#eaeaea",cursor:"#eaeaea",cursorAccent:"#1a1a2e",selectionBackground:"#3a3a5e",black:"#1a1a2e",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#6272a4",magenta:"#ff79c6",cyan:"#8be9fd",white:"#f8f8f2",brightBlack:"#6272a4",brightRed:"#ff6e6e",brightGreen:"#69ff94",brightYellow:"#ffffa5",brightBlue:"#d6acff",brightMagenta:"#ff92df",brightCyan:"#a4ffff",brightWhite:"#ffffff"}}),E=new IM,j.loadAddon(E),j.open(r.current),E.fit(),s.current=j,i.current=E;let X=null;j.onSelectionChange(()=>{!p||!j||(X&&clearTimeout(X),X=setTimeout(()=>{if(j&&j.hasSelection()){const ie=j.getSelection();ie&&navigator.clipboard.writeText(ie).catch(de=>{console.error("Auto-copy failed:",de)})}},300))}),r.current.addEventListener("keydown",S),r.current.addEventListener("contextmenu",R);const re=ie=>{ie.preventDefault(),ie.stopPropagation();const de=Math.round(ie.deltaY/20);j.scrollLines(de)};r.current.addEventListener("wheel",re,{passive:!1})}const q=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal?session=${encodeURIComponent(e)}`,D=new WebSocket(q);D.binaryType="arraybuffer",o.current=D,D.onopen=()=>{console.log("XTerminal: WebSocket opened"),l.current=0,j.clear(),E==null||E.fit(),console.log("XTerminal: Sending initial dimensions:",j.cols,"x",j.rows),D.send(JSON.stringify({type:"resize",cols:j.cols,rows:j.rows}))};const H=localStorage.getItem("DEBUG_TERMINAL")==="1";let N=0;const B=[],O=X=>X.replace(/[\x00-\x1f\x7f-\xff]/g,re=>{const ie=re.charCodeAt(0);return ie===27?"\\e":ie===10?"\\n":ie===13?"\\r":`\\x${ie.toString(16).padStart(2,"0")}`});H&&(console.log("XTerminal: Debug logging enabled. Messages will be logged to console and window.terminalDebugLog"),window.terminalDebugLog=B,window.showTerminalDebug=()=>{B.forEach(X=>console.log(X))});const k=[];let W=!1;const Q=()=>{if(W||k.length===0||!j)return;W=!0;const X=k.shift();H&&console.log(`XTerminal-debug: WRITE len=${X.length}`),j.write(X,()=>{const re=j.buffer.active;re.viewportY>=re.length-j.rows&&j.scrollToBottom(),W=!1,k.length>0&&setTimeout(Q,0)})};D.onmessage=X=>{let re="";if(X.data instanceof ArrayBuffer?re=new TextDecoder().decode(new Uint8Array(X.data)):typeof X.data=="string"&&(re=X.data),H){N++;const ie=`[${new Date().toISOString()}] RECV #${N} len=${re.length}
497
- DATA: ${O(re).slice(0,500)}${re.length>500?"...":""}`;B.push(ie),(N<=20||N%100===0)&&console.log(`XTerminal-debug: RECV #${N} len=${re.length}`)}k.push(re),Q()},D.onclose=X=>{var re,ie;if(console.log("XTerminal: WebSocket closed",X.code,X.reason),!h){j.writeln(`\r
498
- \x1B[33m● Session disconnected\x1B[0m`),(re=y.current)==null||re.call(y);return}if(l.current<u){const de=_(l.current);l.current+=1,j.writeln(`\r
499
- \x1B[33m● Connection lost. Reconnecting in ${de/1e3}s (attempt ${l.current}/${u})...\x1B[0m`),c.current=setTimeout(()=>{I()},de)}else j.writeln(`\r
500
- \x1B[31m● Connection lost after multiple attempts.\x1B[0m`),(ie=y.current)==null||ie.call(y)},D.onerror=X=>{console.error("WebSocket error:",X)},j.onData(X=>{D.readyState===WebSocket.OPEN&&D.send(X)}),j.onResize(({cols:X,rows:re})=>{D.readyState===WebSocket.OPEN&&D.send(JSON.stringify({type:"resize",cols:X,rows:re}))});const z=L_(()=>{D.readyState===WebSocket.OPEN&&(E==null||E.fit())},200);return window.addEventListener("resize",z),()=>{window.removeEventListener("resize",z),d(!1),c.current&&clearTimeout(c.current),D.close(),j==null||j.dispose(),s.current=null,i.current=null}},[e,h,p,S,R]);v.useEffect(()=>{let M=!1,j;const E=setTimeout(()=>{M||(j=I())},50);return()=>{M=!0,clearTimeout(E),j==null||j()}},[I]),v.useEffect(()=>{const M=L_(()=>{var E,$;((E=o.current)==null?void 0:E.readyState)===WebSocket.OPEN&&(($=i.current)==null||$.fit())},200),j=new ResizeObserver(M);return r.current&&j.observe(r.current),()=>{j.disconnect()}},[]);const A=()=>{var M;(M=s.current)==null||M.focus()};return a.jsxs("div",{className:"relative w-full h-full",children:[a.jsx("div",{className:"absolute top-2 right-2 z-10 flex gap-2",children:a.jsx("button",{onClick:()=>x(!b),className:"p-1.5 rounded bg-slate-700/80 hover:bg-slate-600/80 text-slate-300 transition-colors",title:"Terminal settings",children:a.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})})}),b&&a.jsxs("div",{className:"absolute top-10 right-2 z-20 w-64 p-3 rounded-lg bg-slate-800 border border-slate-700 shadow-xl",children:[a.jsx("h3",{className:"text-sm font-semibold text-slate-200 mb-3",children:"Terminal Settings"}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:p,onChange:M=>f(M.target.checked),className:"w-4 h-4 rounded border-slate-600 bg-slate-700 text-blue-500 focus:ring-blue-500"}),a.jsx("span",{className:"text-sm text-slate-300",children:"Auto-copy on selection"})]}),a.jsx("p",{className:"text-xs text-slate-500 mt-2",children:"Automatically copy selected text to clipboard"})]}),a.jsx("div",{ref:r,className:"absolute inset-0",onClick:A,tabIndex:0,style:{padding:"8px",backgroundColor:"#1a1a2e",overflow:"hidden",outline:"none"}}),m.visible&&a.jsxs("div",{className:"fixed z-50 min-w-[120px] py-1 rounded-lg bg-slate-800 border border-slate-700 shadow-xl",style:{left:m.x,top:m.y},onClick:M=>M.stopPropagation(),children:[m.canCopy&&a.jsxs("button",{onClick:F,className:"w-full px-4 py-2 text-left text-sm text-slate-200 hover:bg-slate-700 transition-colors flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),"Copy",a.jsx("span",{className:"ml-auto text-xs text-slate-500",children:Bf?"⌘C":"Ctrl+C"})]}),a.jsxs("button",{onClick:P,className:"w-full px-4 py-2 text-left text-sm text-slate-200 hover:bg-slate-700 transition-colors flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})}),"Paste",a.jsx("span",{className:"ml-auto text-xs text-slate-500",children:Bf?"⌘V":"Ctrl+V"})]})]})]})}function mx({issueId:e,isOpen:t,onClose:n}){var u,h,d,p,f;const{data:r,isLoading:s,isFetching:i,error:o}=ue({queryKey:["beads",e],queryFn:async()=>{const m=await fetch(`/api/issues/${e}/beads`);if(!m.ok)throw new Error("Failed to fetch tasks");return m.json()},enabled:t,staleTime:0,refetchOnMount:"always"});if(!t)return null;const l=((u=r==null?void 0:r.tasks)==null?void 0:u.filter(m=>m.status!=="closed"))||[],c=((h=r==null?void 0:r.tasks)==null?void 0:h.filter(m=>m.status==="closed"))||[];return a.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center",children:[a.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:n}),a.jsxs("div",{className:"relative bg-surface-raised rounded-xl shadow-2xl w-full max-w-lg mx-4 max-h-[70vh] overflow-hidden flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-divider",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(oo,{className:"w-5 h-5 text-green-400"}),a.jsxs("h2",{className:"font-semibold text-content",children:["Tasks: ",e]})]}),a.jsx("button",{onClick:n,className:"p-1 text-content-subtle hover:text-content hover:bg-surface-overlay rounded transition-colors",children:a.jsx(mt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[(s||i)&&!((d=r==null?void 0:r.tasks)!=null&&d.length)&&a.jsxs("div",{className:"space-y-2",children:[[1,2,3].map(m=>a.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border border-divider bg-surface-overlay/30 animate-pulse",children:[a.jsx("div",{className:"w-4 h-4 bg-surface-emphasis rounded-full mt-0.5"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("div",{className:"h-4 bg-surface-emphasis rounded w-3/4"}),a.jsx("div",{className:"h-3 bg-surface-overlay rounded w-1/4"})]})]},m)),a.jsxs("div",{className:"flex items-center justify-center py-2 text-content-muted text-sm",children:[a.jsx(ye,{className:"w-4 h-4 animate-spin mr-2"}),"Loading tasks from workspace..."]})]}),o&&a.jsx("div",{className:"text-red-400 text-center py-8",children:"Failed to load tasks"}),r&&((p=r.tasks)==null?void 0:p.length)===0&&!i&&a.jsxs("div",{className:"text-content-muted text-center py-8",children:[a.jsx(oo,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),a.jsx("p",{children:"No tasks created yet"}),a.jsx("p",{className:"text-xs mt-2",children:"Tasks will appear here once created using beads."})]}),r&&((f=r.tasks)==null?void 0:f.length)>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-4 text-xs text-content-subtle mb-3 pb-3 border-b border-divider",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("div",{className:"w-2 h-2 bg-blue-400 rounded-full"}),l.length," open"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(Yr,{className:"w-3 h-3 text-green-400"}),c.length," closed"]})]}),l.map(m=>a.jsx(I_,{task:m},m.id)),c.length>0&&l.length>0&&a.jsx("div",{className:"text-xs text-content-muted mt-4 mb-2",children:"Completed"}),c.map(m=>a.jsx(I_,{task:m},m.id))]})]}),a.jsxs("div",{className:"px-4 py-3 border-t border-divider text-xs text-content-muted flex items-center justify-between",children:[a.jsxs("span",{children:[(r==null?void 0:r.count)||0," task",(r==null?void 0:r.count)!==1?"s":""]}),a.jsx("span",{className:"text-gray-600",children:"Beads"})]})]})]})}function I_({task:e}){const t={open:"bg-surface-overlay/50 border-divider-strong",in_progress:"bg-blue-900/20 border-blue-600/50",closed:"bg-green-900/20 border-green-600/30 opacity-60"},n={open:a.jsx("div",{className:"w-4 h-4 border-2 border-gray-400 rounded-full"}),in_progress:a.jsx(ye,{className:"w-4 h-4 text-blue-400 animate-spin"}),closed:a.jsx(Yr,{className:"w-4 h-4 text-green-400"})};return a.jsxs("div",{className:`flex items-start gap-3 p-3 rounded-lg border ${t[e.status]}`,children:[a.jsx("div",{className:"mt-0.5",children:n[e.status]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-sm text-content",children:e.title}),a.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[a.jsx("span",{className:"text-xs text-content-muted",children:e.id}),e.blockedBy.length>0&&a.jsxs("span",{className:"flex items-center gap-1 text-xs text-orange-400",children:[a.jsx(wa,{className:"w-3 h-3"}),"Blocked"]}),e.labels.filter(r=>r.startsWith("difficulty:")).map(r=>a.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${r.includes("simple")||r.includes("trivial")?"bg-green-900/50 text-green-400":r.includes("medium")?"bg-yellow-900/50 text-yellow-400":r.includes("complex")||r.includes("hard")?"bg-red-900/50 text-red-400":"bg-surface-overlay text-content-body"}`,children:r.replace("difficulty:","")},r))]})]})]})}const BM=()=>{const e=localStorage.getItem("panopticon.planning.startDocker");return e!==null?e==="true":!1},FM=()=>localStorage.getItem("panopticon.planning.workspaceLocation")==="remote"?"remote":"local";function zM({issue:e,isOpen:t,onClose:n,onComplete:r}){var k,W,Q;const[s,i]=v.useState("checking"),[o,l]=v.useState(null),[c,u]=v.useState(null),[h,d]=v.useState(!1),[p,f]=v.useState({x:-1,y:-1}),[m,g]=v.useState({width:900,height:600}),[b,x]=v.useState(BM),[y,_]=v.useState(FM),[w,C]=v.useState(!1),[S,R]=v.useState(!1),T=v.useRef(!1),F=rn(),P=xe({mutationFn:async()=>{const z=await fetch(`/api/issues/${e.identifier}/start-planning`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({startDocker:b,workspaceLocation:y,shadowMode:w})});if(!z.ok){const X=await z.json();throw new Error(X.error||"Failed to start planning")}return z.json()},onSuccess:z=>{l(z),z.planningAgent.started?(T.current=!0,F.invalidateQueries({queryKey:["planningStatus",e.identifier]}),i("planning")):z.planningAgent.error&&(u(z.planningAgent.error),i("error"))},onError:z=>{u(z.message),i("error")}}),I=ue({queryKey:["planningStatus",e.identifier],queryFn:async()=>{const z=await fetch(`/api/planning/${e.identifier}/status`);if(!z.ok)throw new Error("Failed to get status");return z.json()},enabled:s==="planning",refetchInterval:s==="planning"?2e3:!1}),A=xe({mutationFn:async()=>{const z=await fetch(`/api/planning/${e.identifier}`,{method:"DELETE"});if(!z.ok)throw new Error("Failed to stop planning");const X=await z.json();return(await fetch(`/api/issues/${e.identifier}/complete-planning`,{method:"POST"})).ok||console.warn("Failed to mark planning complete, continuing anyway"),X},onSuccess:()=>{F.invalidateQueries({queryKey:["issues"]}),i("complete")},onError:z=>{console.error("Stop planning failed:",z),u(z.message),i("error")}}),M=xe({mutationFn:async()=>{const z=await fetch(`/api/issues/${e.identifier}/abort-planning`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deleteWorkspace:!1})});if(!z.ok){const X=await z.json();throw new Error(X.error||"Failed to abort planning")}return z.json()},onSuccess:()=>{r(),n()},onError:z=>{u(z.message)}}),j=xe({mutationFn:async()=>{const z=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:e.identifier,phase:"implementation"})});if(!z.ok){const X=await z.json();throw new Error(X.error||"Failed to start agent")}return z.json()},onSuccess:()=>{F.invalidateQueries({queryKey:["agents"]}),F.invalidateQueries({queryKey:["issues"]}),r(),n()},onError:z=>{u(`Failed to start agent: ${z.message}`)}}),E=v.useRef(null);v.useEffect(()=>{const z=E.current!==null&&E.current!==e.identifier;E.current=e.identifier,t?z?(i("checking"),l(null),u(null),d(!1),T.current=!1,F.invalidateQueries({queryKey:["planningStatus",e.identifier]})):(F.invalidateQueries({queryKey:["planningStatus",e.identifier]}),T.current=!1):(i("checking"),l(null),u(null),d(!1),T.current=!1)},[t,e.identifier,F]),v.useEffect(()=>{t&&s==="checking"&&fetch(`/api/planning/${e.identifier}/status`).then(z=>z.json()).then(z=>{z.active?(T.current=!0,i("planning")):z.planningCompleted?i("complete"):i("ready")}).catch(()=>{i("ready")})},[t,e.identifier,s]);const $=()=>{i("starting"),P.mutate()},q=()=>{A.mutate()},D=()=>{confirm(`Abort planning and return to Todo?
501
-
502
- This will:
503
- • Stop the planning agent
504
- • Move the issue back to "Todo"
505
- • Keep the workspace (can be deleted separately)
506
-
507
- Any planning artifacts in the workspace will be preserved.`)&&M.mutate()},H=()=>{j.mutate()};if(!t)return null;const N=p.x===-1?(window.innerWidth-m.width)/2:p.x,B=p.y===-1?(window.innerHeight-m.height)/2:p.y,O=()=>{var X,re;const z=((X=o==null?void 0:o.workspace)==null?void 0:X.path)||((re=I.data)==null?void 0:re.workspacePath);return z?`${z}/docs/${e.identifier}-plan.md`:null};return h?a.jsxs("div",{className:"fixed bottom-4 right-4 z-50 bg-surface-raised rounded-lg shadow-2xl border border-divider px-4 py-2 flex items-center gap-3 cursor-pointer hover:bg-surface-overlay transition-colors",onClick:async()=>{if(s==="complete")try{(await(await fetch(`/api/planning/${e.identifier}/status`)).json()).active&&(T.current=!0,i("planning"))}catch{}d(!1)},children:[a.jsx("div",{className:"w-6 h-6 rounded bg-gradient-to-br from-purple-500 to-blue-500 flex items-center justify-center",children:a.jsx(v0,{className:"w-3 h-3 text-content"})}),a.jsxs("span",{className:"text-sm text-content font-medium",children:["Plan: ",e.identifier]}),s==="planning"&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-2 h-2 bg-purple-400 rounded-full animate-pulse"}),(k=I.data)!=null&&k.isRemote?a.jsx("span",{className:"px-1.5 py-0.5 bg-blue-500/30 text-blue-300 text-xs rounded",children:"Remote"}):a.jsx("span",{className:"px-1.5 py-0.5 bg-gray-500/30 text-content-subtle text-xs rounded",children:"Local"})]}),s==="complete"&&a.jsx("span",{className:"px-1.5 py-0.5 bg-green-500/30 text-green-300 text-xs rounded",children:"Done"})]}):a.jsxs("div",{className:"fixed inset-0 z-50",children:[a.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:()=>d(!0)}),a.jsx(CT,{position:{x:N,y:B},size:m,onDragStop:(z,X)=>f({x:X.x,y:X.y}),onResizeStop:(z,X,re,ie,de)=>{g({width:re.offsetWidth,height:re.offsetHeight}),f({x:de.x,y:de.y})},minWidth:600,minHeight:400,bounds:"window",dragHandleClassName:"drag-handle",enableResizing:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},children:a.jsxs("div",{className:"w-full h-full bg-surface-raised rounded-xl shadow-2xl border border-divider overflow-hidden flex flex-col",children:[a.jsxs("div",{className:"drag-handle flex items-center justify-between px-6 py-4 border-b border-divider cursor-move",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-10 h-10 rounded-lg bg-gradient-to-br from-purple-500 to-blue-500 flex items-center justify-center",children:a.jsx(v0,{className:"w-5 h-5 text-content"})}),a.jsxs("div",{children:[a.jsxs("h2",{className:"text-lg font-semibold text-content",children:["Plan: ",e.identifier]}),a.jsx("p",{className:"text-sm text-content-subtle line-clamp-1",children:e.title})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[s==="planning"&&a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"flex items-center gap-1.5 px-2 py-1 bg-purple-500/20 text-purple-400 text-xs rounded-full",children:[a.jsx("span",{className:"w-2 h-2 bg-purple-400 rounded-full animate-pulse"}),"Planning Active"]}),(W=I.data)!=null&&W.isRemote?a.jsx("span",{className:"px-2 py-1 bg-blue-500/20 text-blue-400 text-xs rounded-full",title:I.data.vmName?`VM: ${I.data.vmName}`:void 0,children:"Remote"}):a.jsx("span",{className:"px-2 py-1 bg-gray-500/20 text-content-subtle text-xs rounded-full",children:"Local"}),a.jsxs("button",{onClick:q,disabled:A.isPending,className:"flex items-center gap-1 px-3 py-1.5 bg-red-600 hover:bg-red-500 text-content text-sm font-medium rounded-lg transition-colors disabled:opacity-50",title:"Stop the planning agent",children:[a.jsx(tc,{className:"w-4 h-4"}),"Stop"]})]}),a.jsx("button",{onClick:()=>d(!0),className:"p-2 text-content-subtle hover:text-content hover:bg-surface-overlay rounded-lg transition-colors",title:"Hide (planning continues in background)",children:a.jsx(mt,{className:"w-5 h-5"})})]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col",children:[s==="checking"&&a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[a.jsx(ye,{className:"w-12 h-12 text-purple-400 animate-spin mb-4"}),a.jsx("p",{className:"text-content-body",children:"Checking session status..."})]}),s==="ready"&&a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8 overflow-y-auto",children:[a.jsx("div",{className:"w-20 h-20 rounded-2xl bg-gradient-to-br from-purple-500/20 to-blue-500/20 border border-purple-500/30 flex items-center justify-center mb-6",children:a.jsx(ao,{className:"w-10 h-10 text-purple-400"})}),["In Planning","Planning","Planned","Discovery"].includes(e.status)?a.jsxs(a.Fragment,{children:[a.jsx("h3",{className:"text-xl font-semibold text-content mb-2",children:"Resume Planning Session"}),a.jsxs("p",{className:"text-content-subtle text-center max-w-md mb-6",children:["This issue is in ",a.jsx("span",{className:"text-purple-400 font-medium",children:'"In Planning"'})," state. You can resume planning or abort to return to Todo."]}),a.jsxs("div",{className:"bg-surface-overlay/50 rounded-lg p-4 mb-6 max-w-md w-full",children:[a.jsx("h4",{className:"text-sm font-medium text-content-body mb-2",children:"Options:"}),a.jsxs("ul",{className:"space-y-2 text-sm text-content-subtle",children:[a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Rn,{className:"w-4 h-4 text-purple-400"}),a.jsxs("span",{children:[a.jsx("strong",{className:"text-purple-400",children:"Resume"})," - Start a new planning agent session"]})]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(mt,{className:"w-4 h-4 text-orange-400"}),a.jsxs("span",{children:[a.jsx("strong",{className:"text-orange-400",children:"Abort"})," - Return issue to Todo (keeps workspace)"]})]})]})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("button",{onClick:D,disabled:M.isPending,className:"flex items-center gap-2 px-5 py-3 bg-orange-600/20 hover:bg-orange-600/30 text-orange-400 rounded-lg transition-colors font-medium disabled:opacity-50",children:[a.jsx(mt,{className:"w-5 h-5"}),M.isPending?"Aborting...":"Abort Planning"]}),a.jsxs("button",{onClick:$,className:"flex items-center gap-2 px-6 py-3 bg-purple-600 hover:bg-purple-500 text-content rounded-lg transition-colors font-medium",children:[a.jsx(Rn,{className:"w-5 h-5"}),"Resume Planning"]})]})]}):a.jsxs(a.Fragment,{children:[a.jsx("h3",{className:"text-xl font-semibold text-content mb-2",children:"Start Planning Session"}),a.jsxs("p",{className:"text-content-subtle text-center max-w-md mb-6",children:["This will move the issue to ",a.jsx("span",{className:"text-purple-400 font-medium",children:'"In Planning"'}),", create a workspace, and start an AI discovery session to help define the implementation plan."]}),a.jsxs("div",{className:"bg-surface-overlay/50 rounded-lg p-4 mb-6 max-w-md w-full",children:[a.jsx("h4",{className:"text-sm font-medium text-content-body mb-2",children:"What happens:"}),a.jsxs("ul",{className:"space-y-2 text-sm text-content-subtle",children:[a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Di,{className:"w-4 h-4 text-green-400"}),'Issue moves to "In Planning" in ',e.source==="github"?"GitHub":"Linear"]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Di,{className:"w-4 h-4 text-green-400"}),"Git worktree created for feature branch"]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Di,{className:"w-4 h-4 text-green-400"}),"Planning agent starts discovery conversation"]})]})]}),a.jsxs("div",{className:"mb-4 w-full max-w-md",children:[a.jsx("label",{className:"text-sm font-medium text-content-body mb-2 block",children:"Workspace Location"}),a.jsxs("div",{className:"flex gap-4",children:[a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"radio",name:"workspaceLocation",value:"local",checked:y==="local",onChange:()=>{_("local"),localStorage.setItem("panopticon.planning.workspaceLocation","local")},className:"w-4 h-4 border-gray-500 bg-surface-overlay text-purple-500 focus:ring-purple-500 focus:ring-offset-gray-800"}),a.jsx("span",{className:"text-sm text-content-body",children:"Local"})]}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"radio",name:"workspaceLocation",value:"remote",checked:y==="remote",onChange:()=>{_("remote"),localStorage.setItem("panopticon.planning.workspaceLocation","remote")},className:"w-4 h-4 border-gray-500 bg-surface-overlay text-purple-500 focus:ring-purple-500 focus:ring-offset-gray-800"}),a.jsx("span",{className:"text-sm text-content-body",children:"Remote (exe.dev)"})]})]})]}),a.jsxs("label",{className:"flex items-center gap-3 mb-4 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:w,onChange:z=>C(z.target.checked),className:"w-4 h-4 rounded border-gray-500 bg-surface-overlay text-blue-500 focus:ring-blue-500 focus:ring-offset-gray-800"}),a.jsxs("span",{className:"text-sm text-content-body",children:["Shadow Engineering",a.jsx("span",{className:"text-content-muted ml-1",children:"(AI observes your workflow, doesn't modify code)"})]})]}),a.jsxs("label",{className:"flex items-center gap-3 mb-6 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:b,onChange:z=>{x(z.target.checked),localStorage.setItem("panopticon.planning.startDocker",String(z.target.checked))},className:"w-4 h-4 rounded border-gray-500 bg-surface-overlay text-purple-500 focus:ring-purple-500 focus:ring-offset-gray-800"}),a.jsxs("span",{className:"text-sm text-content-body",children:["Start Docker containers",a.jsx("span",{className:"text-content-muted ml-1",children:"(dev environment ready for testing)"})]})]}),a.jsxs("button",{onClick:$,className:"flex items-center gap-2 px-6 py-3 bg-purple-600 hover:bg-purple-500 text-content rounded-lg transition-colors font-medium",children:[a.jsx(Rn,{className:"w-5 h-5"}),"Start Planning"]})]})]}),s==="starting"&&a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[a.jsx(ye,{className:"w-12 h-12 text-purple-400 animate-spin mb-4"}),a.jsx("p",{className:"text-content-body",children:"Starting planning session..."}),a.jsx("p",{className:"text-sm text-content-muted mt-2",children:"Moving to In Planning, creating workspace, spawning agent"})]}),s==="planning"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex-1 bg-black relative overflow-hidden",style:{minHeight:"400px"},children:o!=null&&o.planningAgent.sessionName?a.jsx(O_,{sessionName:o.planningAgent.sessionName,onDisconnect:()=>{I.refetch()}}):(Q=I.data)!=null&&Q.sessionName?a.jsx(O_,{sessionName:I.data.sessionName,onDisconnect:()=>{I.refetch()}}):a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"flex items-center gap-2 text-content-muted",children:[a.jsx(ye,{className:"w-4 h-4 animate-spin"}),"Connecting to terminal..."]})})}),a.jsxs("div",{className:"border-t border-divider px-4 py-2 flex items-center justify-between bg-surface-raised",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm text-content-subtle",children:[a.jsx(ao,{className:"w-4 h-4"}),"Interactive planning session"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>R(!0),className:"flex items-center gap-1 px-3 py-1 bg-surface-overlay hover:bg-surface-emphasis text-content-body text-sm rounded transition-colors",title:"View tasks created during planning",children:[a.jsx(oo,{className:"w-4 h-4"}),"Tasks"]}),a.jsxs("button",{onClick:D,disabled:M.isPending,className:"flex items-center gap-1 px-3 py-1 bg-orange-600/20 hover:bg-orange-600/30 text-orange-400 text-sm rounded transition-colors disabled:opacity-50",title:"Stop planning and return to Todo",children:[a.jsx(mt,{className:"w-4 h-4"}),"Abort"]}),a.jsxs("button",{onClick:()=>{A.mutate(),I.refetch()},disabled:A.isPending,className:"flex items-center gap-1 px-3 py-1 bg-green-600/20 hover:bg-green-600/30 text-green-400 text-sm rounded transition-colors disabled:opacity-50",title:"Done - mark planning complete",children:[a.jsx(Di,{className:"w-4 h-4"}),"Done"]})]})]})]}),s==="complete"&&a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[a.jsx("div",{className:"w-16 h-16 rounded-full bg-green-500/20 flex items-center justify-center mb-4",children:a.jsx(Di,{className:"w-10 h-10 text-green-400"})}),a.jsx("h3",{className:"text-xl font-semibold text-content mb-2",children:"Planning Complete"}),a.jsx("p",{className:"text-content-subtle text-center max-w-md mb-6",children:"The planning session has ended. Review the plan and start the execution agent."}),O()&&a.jsx("div",{className:"bg-purple-500/10 border border-purple-500/30 rounded-lg p-4 mb-6 max-w-md w-full",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(io,{className:"w-8 h-8 text-purple-400"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"text-sm text-content-body font-medium",children:"Feature Plan"}),a.jsx("p",{className:"text-xs text-content-muted font-mono truncate",children:O()})]}),a.jsxs("a",{href:`vscode://file${O()}`,className:"flex items-center gap-1 px-3 py-1.5 bg-purple-600 hover:bg-purple-500 text-content text-sm rounded-lg transition-colors",title:"Open in VS Code",children:[a.jsx(Qr,{className:"w-4 h-4"}),"Open"]})]})}),a.jsxs("button",{onClick:()=>R(!0),className:"flex items-center gap-2 px-4 py-2 bg-green-600/20 hover:bg-green-600/30 text-green-400 rounded-lg transition-colors mb-6",children:[a.jsx(oo,{className:"w-5 h-5"}),"View Tasks",a.jsx("span",{className:"text-xs text-green-600",children:"(beads created during planning)"})]}),o&&a.jsxs("div",{className:"bg-surface-overlay/50 rounded-lg p-4 mb-6 max-w-md w-full",children:[a.jsx("p",{className:"text-sm text-content-subtle mb-2",children:"Summary:"}),a.jsxs("ul",{className:"space-y-1 text-sm",children:[a.jsxs("li",{className:"text-content-body",children:[a.jsx("span",{className:"text-content-muted",children:"Issue:"})," ",o.issue.identifier]}),a.jsxs("li",{className:"text-content-body",children:[a.jsx("span",{className:"text-content-muted",children:"State:"})," ",a.jsx("span",{className:"text-purple-400",children:o.issue.newState})]}),o.workspace.created&&a.jsxs("li",{className:"text-content-body",children:[a.jsx("span",{className:"text-content-muted",children:"Workspace:"})," ",a.jsx("span",{className:"text-blue-400 font-mono text-xs",children:o.workspace.path})]})]})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:n,disabled:j.isPending,className:"px-4 py-2 bg-surface-overlay hover:bg-surface-emphasis text-content rounded-lg transition-colors disabled:opacity-50",children:"Close"}),a.jsxs("button",{onClick:H,disabled:j.isPending,className:"flex items-center gap-2 px-4 py-2 bg-blue-600 hover:bg-blue-500 text-content rounded-lg transition-colors disabled:opacity-50",children:[j.isPending?a.jsx(ye,{className:"w-5 h-5 animate-spin"}):a.jsx(Rn,{className:"w-5 h-5"}),j.isPending?"Starting Agent...":"Start Agent"]})]})]}),s==="error"&&a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[a.jsx("div",{className:"w-16 h-16 rounded-full bg-red-500/20 flex items-center justify-center mb-4",children:a.jsx(so,{className:"w-10 h-10 text-red-400"})}),a.jsx("h3",{className:"text-xl font-semibold text-content mb-2",children:"Planning Failed"}),a.jsx("p",{className:"text-red-400 text-center max-w-md mb-6",children:c}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:n,className:"px-4 py-2 bg-surface-overlay hover:bg-surface-emphasis text-content rounded-lg transition-colors",children:"Close"}),a.jsx("button",{onClick:()=>{i("ready"),u(null)},className:"px-4 py-2 bg-purple-600 hover:bg-purple-500 text-content rounded-lg transition-colors",children:"Try Again"})]})]})]})]})}),a.jsx(mx,{issueId:e.identifier,isOpen:S,onClose:()=>R(!1)})]})}function HC(e){const t=e.find(s=>s.startsWith("difficulty:"));if(!t)return null;const n=t.split(":")[1];return["trivial","simple","medium","complex","expert"].includes(n)?n:null}function $M(e){return e.includes("opus-4-6")||e.includes("opus-4.6")?"Opus 4.6":e.includes("opus-4-5")||e.includes("opus-4.5")?"Opus 4.5":e.includes("opus-4-1")?"Opus 4.1":e.includes("opus-4")||e.includes("opus")?"Opus":e.includes("sonnet-4-5")||e.includes("sonnet-4.5")?"Sonnet 4.5":e.includes("sonnet-4")||e.includes("sonnet")?"Sonnet":e.includes("haiku-4-5")||e.includes("haiku-4.5")?"Haiku 4.5":e.includes("haiku")?"Haiku":e}const HM={trivial:"bg-green-900/50 text-green-400",simple:"bg-green-900/50 text-green-400",medium:"bg-yellow-900/50 text-yellow-400",complex:"bg-orange-900/50 text-orange-400",expert:"bg-red-900/50 text-red-400"};function WC({level:e}){const t=HM[e];return a.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs font-medium ${t}`,children:e})}const WM={work:"🤖",review:"👁️",test:"🧪",merge:"🔀"};function UM({type:e,name:t,isConflict:n}){const r=WM[e],s=n?"animate-[pulse_2s_ease-in-out_infinite]":"";return a.jsxs("span",{className:`inline-flex items-center gap-1 text-xs text-blue-400 ${s}`,children:[a.jsx("span",{children:r}),a.jsx("span",{children:t})]})}async function qM(){try{const e=await fetch("/api/costs/by-issue");if(!e.ok)return{};const t=await e.json(),n={};for(const r of t.issues||[])n[r.issueId.toLowerCase()]=r;return n}catch{return{}}}function UC(e){return e>=100?`$${e.toFixed(0)}`:e>=10?`$${e.toFixed(1)}`:e>=1?`$${e.toFixed(2)}`:e>0?`$${e.toFixed(2)}`:""}function qC(e){return e>=50?"bg-red-900/50 text-red-400":e>=20?"bg-orange-900/50 text-orange-400":e>=5?"bg-yellow-900/50 text-yellow-400":"bg-green-900/50 text-green-400"}async function KM(e="current",t=!1){const n=new URLSearchParams;n.set("cycle",e),t&&n.set("includeCompleted","true");const r=await fetch(`/api/issues?${n}`);if(!r.ok)throw new Error("Failed to fetch issues");return r.json()}async function VM(){const e=await fetch("/api/agents");if(!e.ok)throw new Error("Failed to fetch agents");return e.json()}async function YM(){const e=await fetch("/api/specialists");if(!e.ok)throw new Error("Failed to fetch specialists");const t=await e.json();return t.specialists??t}function QM(e,t=!1){var r;const n={backlog:[],todo:[],in_progress:[],in_review:[],done:[]};for(const s of e){if(!t&&((r=s.labels)!=null&&r.some(o=>o.toLowerCase()==="closed-out")))continue;let i;s.targetCanonicalState?i=s.targetCanonicalState:s.shadowStatus?i=s.shadowStatus==="closed"?"done":s.shadowStatus==="in_progress"?Ht[s.status]||"in_progress":Ht[s.status]||"backlog":s.derivedStatus?i=s.derivedStatus==="closed"?"done":s.derivedStatus==="in_progress"?"in_progress":Ht[s.status]||"backlog":i=Ht[s.status]||(s.stateType?b5[s.stateType]:void 0)||"backlog",i==="canceled"?n.done.push(s):n[i]?n[i].push(s):n.backlog.push(s)}return n}function XM(e){const t={},n=[];for(const s of e){const i=s.labels||[];if(i.length===0)n.push(s);else for(const o of i)t[o]||(t[o]=[]),t[o].push(s)}n.length>0&&(t.Uncategorized=n);const r={};return Object.keys(t).sort((s,i)=>s.localeCompare(i)).forEach(s=>{r[s]=t[s]}),r}function GM(e){const t=new Map,n=[];for(const s of e)if(s.project){const i=t.get(s.project.id);i?i.issues.push(s):t.set(s.project.id,{name:s.project.name,color:s.project.color,issues:[s]})}else n.push(s);const r=Array.from(t.values()).sort((s,i)=>s.name.localeCompare(i.name));return n.length>0&&r.push({name:"No Project",issues:n}),r}function JM(e){var l;const t=[],n=[];for(const c of e)(l=c.artifactType)!=null&&l.includes("PortfolioItem")?t.push(c):n.push(c);if(t.length===0)return e.map(c=>({type:"orphan",children:[c]}));const r=new Map;for(const c of t)r.set(c.identifier,c);const s=new Map,i=[];for(const c of n)if(c.parentRef&&r.has(c.parentRef)){const u=s.get(c.parentRef)||[];u.push(c),s.set(c.parentRef,u)}else i.push(c);const o=[];for(const c of t){const u=s.get(c.identifier)||[];o.push({type:"feature",feature:c,children:u})}for(const c of i)o.push({type:"orphan",children:[c]});return o}function gx({issue:e,compact:t=!1}){const n=e.rawTrackerState||e.shadowTrackerStatus,r=e.shadowStatus||e.targetCanonicalState;if(!n||!r)return null;const s=r==="in_progress"?"In Progress":r==="closed"||r==="done"?"Done":r==="in_review"?"In Review":r,i=n.toLowerCase().replace(/[-_\s]/g,""),o=s.toLowerCase().replace(/[-_\s]/g,"");return i===o?null:t?a.jsx("span",{className:"w-2 h-2 rounded-full bg-purple-500 shrink-0",title:`Rally: ${n} → Pan: ${s}`}):a.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[a.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded bg-gray-700/50 text-gray-300",children:[a.jsx(Qr,{className:"w-2.5 h-2.5"}),n]}),a.jsx("span",{className:"text-content-muted",children:"→"}),a.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded bg-purple-900/50 text-purple-300",children:[a.jsx(kc,{className:"w-2.5 h-2.5"}),s]})]})}function ZM({feature:e,childCount:t,isExpanded:n,onToggle:r}){const s=e.completedChildCount??0,i=e.inProgressChildCount??0,o=e.totalChildCount??t,l=o>0?Math.round(s/o*100):0,c=e.derivedStatus&&e.rawTrackerState&&(e.derivedStatus==="in_progress"&&e.rawTrackerState!=="Developing"||e.derivedStatus==="closed"&&e.rawTrackerState!=="Done");return a.jsx("div",{className:"bg-surface-overlay rounded-lg border-l-4 border-l-indigo-500 overflow-hidden",children:a.jsxs("div",{onClick:r,className:"flex items-start gap-2 px-3 py-2.5 cursor-pointer hover:bg-indigo-900/20 transition-colors",children:[n?a.jsx(mh,{className:"w-4 h-4 text-indigo-400 shrink-0 mt-0.5"}):a.jsx(Sc,{className:"w-4 h-4 text-indigo-400 shrink-0 mt-0.5"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.project&&a.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:e.project.color||"#6b7280"}}),a.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onClick:u=>u.stopPropagation(),className:"text-xs font-medium text-indigo-300 hover:text-indigo-200 flex items-center gap-1",children:[a.jsx("span",{children:e.identifier}),a.jsx(Qr,{className:"w-2.5 h-2.5 opacity-50"})]}),c&&a.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs font-medium bg-amber-900/50 text-amber-400",children:"derived"}),a.jsx(gx,{issue:e})]}),a.jsx("p",{className:"text-sm text-content-body mt-1 line-clamp-1",children:e.title}),o>0&&a.jsxs("div",{className:"mt-2",children:[a.jsx("div",{className:"w-full h-1.5 bg-gray-700 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-green-500 rounded-full transition-all",style:{width:`${l}%`}})}),a.jsxs("div",{className:"flex items-center justify-between mt-1",children:[a.jsxs("span",{className:"text-xs text-content-muted",children:[s,"/",o," done",i>0?`, ${i} active`:""]}),a.jsxs("span",{className:"text-xs text-indigo-400",children:[t," in column"]})]})]})]})]})})}function eL({issue:e,agents:t}){const n=Ht[e.status]||"backlog",r=n==="done"?"bg-green-400":n==="in_progress"?"bg-yellow-400":n==="in_review"?"bg-pink-400":"bg-gray-500",s=e.identifier.toLowerCase(),i=t.some(o=>{var l;return((l=o.issueId)==null?void 0:l.toLowerCase())===s&&o.status!=="dead"});return a.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-surface-overlay/50 transition-colors group",children:[a.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${r}`}),a.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-content-subtle hover:text-blue-400 shrink-0",children:e.identifier}),a.jsx("span",{className:"text-xs text-content-body truncate flex-1",children:e.title}),a.jsx(gx,{issue:e,compact:!0}),i&&a.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-400 animate-pulse shrink-0",title:"Agent running"})]})}function B_({issue:e,agents:t,specialists:n,issueCosts:r,selectedIssue:s,onSelectIssue:i,onPlan:o}){const l=s===e.id,c=Ht[e.status]||"backlog",u=c==="done"?"bg-green-400":c==="in_review"?"bg-pink-400":c==="in_progress"?"bg-yellow-400":c==="todo"?"bg-blue-400":"bg-gray-500",h=r[e.identifier.toLowerCase()],d=e.identifier.toLowerCase(),f=!!t.find(b=>{var x;return((x=b.issueId)==null?void 0:x.toLowerCase())===d&&b.status!=="dead"}),m=n.filter(b=>{var x;return((x=b.currentIssue)==null?void 0:x.toLowerCase())===d}),g=HC(e.labels||[]);return a.jsxs("div",{onClick:()=>i(l?null:e.id),className:`flex items-center gap-3 px-4 py-3 hover:bg-surface-overlay/50 transition-colors cursor-pointer ${l?"bg-surface-overlay":""}`,children:[a.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${u}`,title:c}),a.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onClick:b=>b.stopPropagation(),className:"text-xs text-content-subtle hover:text-blue-400 shrink-0 font-mono",children:e.identifier}),a.jsx("span",{className:"text-sm text-content-body truncate flex-1 min-w-0",children:e.title}),e.priority===1&&a.jsx("span",{className:"text-xs text-red-400 font-medium shrink-0",children:"Urgent"}),e.priority===2&&a.jsx("span",{className:"text-xs text-orange-400 font-medium shrink-0",children:"High"}),g&&a.jsx(WC,{level:g}),h&&h.totalCost>0&&a.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${qC(h.totalCost)}`,children:UC(h.totalCost)}),e.assignee&&a.jsxs("span",{className:"text-xs text-content-subtle flex items-center gap-1 shrink-0",children:[a.jsx(qv,{className:"w-3 h-3"}),e.assignee.name.split(" ")[0]]}),f&&a.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-400 animate-pulse shrink-0",title:"Agent running"}),m.map(b=>a.jsx("span",{className:"text-xs text-blue-400 shrink-0",title:`${b.displayName} specialist`,children:b.name==="review-agent"?"👁️":b.name==="test-agent"?"🧪":b.name==="merge-agent"?"🔀":"🤖"},b.name)),a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[!f&&(c==="backlog"||c==="todo")&&a.jsx("button",{onClick:b=>{b.stopPropagation(),o(e)},className:"p-1 text-content-subtle hover:text-blue-400 transition-colors",title:"Plan issue",children:a.jsx(Rn,{className:"w-3.5 h-3.5"})}),a.jsx("button",{onClick:b=>{b.stopPropagation(),i(e.id)},className:"p-1 text-content-subtle hover:text-content transition-colors",title:"View details",children:a.jsx(kc,{className:"w-3.5 h-3.5"})}),a.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onClick:b=>b.stopPropagation(),className:"p-1 text-content-subtle hover:text-content transition-colors",title:"Open in tracker",children:a.jsx(Qr,{className:"w-3.5 h-3.5"})})]})]})}const F_={backlog:"border-divider-strong",todo:"border-blue-600",in_progress:"border-yellow-500",in_review:"border-pink-500",done:"border-green-500"},tL={backlog:"Backlog",todo:"To Do",in_progress:"In Progress",in_review:"In Review",done:"Done"};function nL({selectedIssue:e,onSelectIssue:t}){const n=rn(),[r,s]=v.useState(null),[i,o]=v.useState(new Set),[l,c]=v.useState(null),[u,h]=v.useState(null),[d,p]=v.useState("current"),[f,m]=v.useState(!1),[g,b]=v.useState(null),[x,y]=v.useState(null),[_,w]=v.useState([]),[C,S]=v.useState(!1),[R,T]=v.useState(null),[F,P]=v.useState({open:!1,issue:null,targetStatus:null}),[I,A]=v.useState({open:!1,issue:null}),M=e!==void 0?e:r,j=t||s,{data:E,isLoading:$,error:q}=ue({queryKey:["issues",d,f],queryFn:()=>KM(d,f)}),{data:D=[]}=ue({queryKey:["agents"],queryFn:VM,refetchInterval:5e3}),{data:H=[]}=ue({queryKey:["specialists"],queryFn:YM,refetchInterval:5e3}),N=t3(y0(ex,{activationConstraint:{distance:8}}),y0(Jv)),B=xe({mutationFn:async({issueId:te,targetStatus:fe,syncToTracker:Re})=>{const tt=await fetch(`/api/issues/${te}/move-status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetStatus:fe,syncToTracker:Re})});if(!tt.ok){const Ae=await tt.json();throw new Error(Ae.error||"Failed to move issue")}return tt.json()},onSuccess:()=>{n.invalidateQueries({queryKey:["issues"]})}}),O=v.useCallback(()=>{if(_.length===0)return;const te=_[_.length-1];B.mutate({issueId:te.issueId,targetStatus:te.fromStatus}),w(fe=>fe.slice(0,-1)),S(!1),R&&(clearTimeout(R),T(null))},[_,B,R]);v.useEffect(()=>{const te=fe=>{(fe.metaKey||fe.ctrlKey)&&fe.key==="z"&&(fe.preventDefault(),O())};return window.addEventListener("keydown",te),()=>window.removeEventListener("keydown",te)},[O]);const k=v.useCallback((te,fe,Re)=>{w(Ae=>[...Ae,{issueId:te,fromStatus:fe,toStatus:Re,timestamp:Date.now()}]),S(!0),R&&clearTimeout(R);const tt=setTimeout(()=>{S(!1)},8e3);T(tt)},[R]),W=v.useCallback(te=>{const{active:fe}=te,Re=fe.id,tt=E==null?void 0:E.find(Ae=>Ae.id===Re);tt&&(b(tt),y(Ht[tt.status]))},[E]),Q=v.useCallback(te=>{const{active:fe,over:Re}=te;if(b(null),y(null),!Re)return;const tt=fe.id,Ae=Re.id,jt=E==null?void 0:E.find(hr=>hr.id===tt);if(!jt)return;const Kt=Ht[jt.status];if(Kt===Ae)return;const Ln=jt.identifier.toLowerCase();if(D.some(hr=>{var K;return((K=hr.issueId)==null?void 0:K.toLowerCase())===Ln&&hr.status!=="dead"})){P({open:!0,issue:jt,targetStatus:Ae});return}if(Ae==="done"){A({open:!0,issue:jt});return}k(jt.identifier,Kt,Ae),B.mutate({issueId:jt.identifier,targetStatus:Ae})},[E,D,B,k]),z=v.useCallback(()=>{const{issue:te,targetStatus:fe}=F;if(!te||!fe)return;P({open:!1,issue:null,targetStatus:null});const Re=Ht[te.status];if(fe==="done"){A({open:!0,issue:te});return}k(te.identifier,Re,fe),B.mutate({issueId:te.identifier,targetStatus:fe})},[F,B,k]),X=v.useCallback(async(te,fe)=>{const{issue:Re}=I;if(!Re)return;A({open:!1,issue:null});const tt=Ht[Re.status];if(fe!=null&&fe.stopAgents){const Ae=Re.identifier.toLowerCase(),jt=D.filter(Kt=>{var Ln;return((Ln=Kt.issueId)==null?void 0:Ln.toLowerCase())===Ae});for(const Kt of jt)try{await fetch(`/api/agents/${Kt.id}`,{method:"DELETE"})}catch(Ln){console.error(`Failed to stop agent ${Kt.id}:`,Ln)}}if(fe!=null&&fe.cleanupWorkspace)try{await fetch(`/api/issues/${Re.identifier}/cleanup-workspace`,{method:"POST"})}catch(Ae){console.error(`Failed to cleanup workspace for ${Re.identifier}:`,Ae)}k(Re.identifier,tt,"done"),B.mutate({issueId:Re.identifier,targetStatus:"done",syncToTracker:te}),fe!=null&&fe.stopAgents&&n.invalidateQueries({queryKey:["agents"]})},[I,B,k,D,n]),re={sideEffects:Ik({styles:{active:{opacity:"0.5"}}})},{data:ie={}}=ue({queryKey:["issueCosts"],queryFn:qM,refetchInterval:3e4,staleTime:1e4}),de=v.useMemo(()=>{if(!E)return[];const te=new Map;for(const fe of E)fe.project&&!te.has(fe.project.id)&&te.set(fe.project.id,fe.project);return Array.from(te.values()).sort((fe,Re)=>fe.name.localeCompare(Re.name))},[E]),qe=v.useMemo(()=>E?i.size===0?E:E.filter(te=>te.project&&i.has(te.project.id)):[],[E,i]),Se=v.useMemo(()=>XM(qe),[qe]),he=v.useMemo(()=>GM(qe),[qe]),Nt=te=>{o(fe=>{const Re=new Set(fe);return Re.has(te)?Re.delete(te):Re.add(te),Re})};if($)return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2 animate-pulse",children:[a.jsx("div",{className:"w-4 h-4 bg-surface-overlay rounded"}),a.jsx("div",{className:"w-16 h-4 bg-surface-overlay rounded"}),a.jsx("div",{className:"w-24 h-6 bg-surface-overlay rounded"}),a.jsx("div",{className:"w-20 h-6 bg-surface-overlay rounded"}),a.jsx("div",{className:"w-28 h-6 bg-surface-overlay rounded"})]}),a.jsx("div",{className:"flex gap-4 overflow-x-auto pb-4",children:D0.filter(te=>te!=="backlog").map(te=>a.jsx("div",{className:"flex-shrink-0 w-80",children:a.jsxs("div",{className:`border-t-4 ${F_[te]} bg-surface-raised rounded-lg`,children:[a.jsx("div",{className:"px-4 py-3 border-b border-divider",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("div",{className:"h-5 bg-surface-overlay rounded w-24 animate-pulse"}),a.jsx("div",{className:"h-4 bg-surface-overlay rounded w-6 animate-pulse"})]})}),a.jsx("div",{className:"p-2 space-y-2",children:[1,2,3].map(fe=>a.jsxs("div",{className:"bg-surface-overlay rounded-lg p-3 border-l-4 border-l-divider-strong animate-pulse",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("div",{className:"w-2 h-2 bg-surface-emphasis rounded-full"}),a.jsx("div",{className:"h-4 bg-surface-emphasis rounded w-16"})]}),a.jsx("div",{className:"h-4 bg-surface-emphasis rounded w-full mb-1"}),a.jsx("div",{className:"h-4 bg-surface-emphasis rounded w-3/4"}),a.jsxs("div",{className:"flex gap-2 mt-3",children:[a.jsx("div",{className:"h-5 bg-surface-emphasis rounded w-16"}),a.jsx("div",{className:"h-5 bg-surface-emphasis rounded w-12"})]})]},fe))})]})},te))})]});if(q)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-red-400",children:["Error loading issues: ",q.message]})});const yn=QM(qe,f);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(kR,{className:"w-4 h-4 text-content-subtle"}),a.jsx("span",{className:"text-sm text-content-subtle",children:"Cycle:"}),a.jsx("div",{className:"flex rounded-lg overflow-hidden border border-divider-strong",children:["current","all","backlog"].map(te=>a.jsx("button",{onClick:()=>p(te),className:`px-3 py-1 text-xs transition-colors ${d===te?"bg-blue-600 text-content":"bg-surface-raised text-content-subtle hover:text-content hover:bg-surface-overlay"}`,children:te==="current"?"Current":te==="all"?"All":"Backlog"},te))})]}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:f,onChange:te=>m(te.target.checked),className:"w-4 h-4 rounded border-divider-strong bg-surface-raised text-blue-600 focus:ring-blue-500 focus:ring-offset-surface"}),a.jsx("span",{className:"text-sm text-content-subtle",children:"Include closed-out"})]}),a.jsx("button",{onClick:async()=>{try{await fetch("/api/trackers/refresh",{method:"POST"}),n.invalidateQueries({queryKey:["issues"]})}catch(te){console.error("Refresh failed:",te)}},className:"flex items-center gap-1 px-2 py-1 text-xs text-content-subtle hover:text-content bg-surface-raised hover:bg-surface-overlay rounded transition-colors",title:"Force refresh all trackers",children:a.jsx(Cc,{className:"w-3.5 h-3.5"})}),a.jsxs("span",{className:"text-sm text-content-muted",children:[(E==null?void 0:E.length)||0," issues"]}),de.length>1&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-px h-6 bg-surface-overlay"}),a.jsx("span",{className:"text-sm text-content-subtle",children:"Projects:"}),de.map(te=>a.jsxs("button",{onClick:()=>Nt(te.id),className:`flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors ${i.size===0||i.has(te.id)?"bg-surface-overlay text-content":"bg-surface-raised text-content-muted hover:text-content-body"}`,children:[a.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:te.color||"#6b7280"}}),te.name]},te.id)),i.size>0&&a.jsx("button",{onClick:()=>o(new Set),className:"text-xs text-content-subtle hover:text-content",children:"Clear"})]})]}),d==="all"?a.jsx("div",{className:"space-y-6 overflow-y-auto pb-4",children:Object.entries(Se).map(([te,fe])=>a.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[a.jsx("div",{className:"px-4 py-3 border-b border-divider",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Wv,{className:"w-4 h-4 text-blue-400"}),a.jsx("h3",{className:"font-semibold text-content",children:te}),a.jsxs("span",{className:"text-sm text-content-subtle",children:["(",fe.length,")"]})]})}),a.jsx("div",{className:"divide-y divide-divider",children:fe.map(Re=>a.jsx(B_,{issue:Re,agents:D,specialists:H,issueCosts:ie,selectedIssue:M,onSelectIssue:j,onPlan:c},Re.id))})]},te))}):d==="backlog"?a.jsxs("div",{className:"space-y-6 overflow-y-auto pb-4",children:[he.map(te=>a.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[a.jsx("div",{className:"px-4 py-3 border-b border-divider",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-3 h-3 rounded-full shrink-0",style:{backgroundColor:te.color||"#6b7280"}}),a.jsx("h3",{className:"font-semibold text-content",children:te.name}),a.jsxs("span",{className:"text-sm text-content-subtle",children:["(",te.issues.length,")"]})]})}),a.jsx("div",{className:"divide-y divide-divider",children:te.issues.map(fe=>a.jsx(B_,{issue:fe,agents:D,specialists:H,issueCosts:ie,selectedIssue:M,onSelectIssue:j,onPlan:c},fe.id))})]},te.name)),he.length===0&&a.jsx("div",{className:"text-center py-12 text-content-subtle",children:"No backlog items"})]}):a.jsxs(t5,{sensors:N,collisionDetection:a3,onDragStart:W,onDragEnd:Q,children:[a.jsx("div",{className:"flex gap-4 overflow-x-auto pb-4",children:D0.filter(te=>te!=="backlog").map(te=>a.jsx(sL,{status:te,children:a.jsxs("div",{className:`border-t-4 ${F_[te]} bg-surface-raised rounded-lg transition-colors ${x&&x!==te?"bg-surface-raised/80":""}`,children:[a.jsx("div",{className:"px-4 py-3 border-b border-divider",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-semibold text-content",children:tL[te]}),a.jsx("span",{className:"text-sm text-content-subtle",children:yn[te].length})]})}),a.jsx(rL,{issues:yn[te],agents:D,specialists:H,issueCosts:ie,selectedIssue:M,onSelectIssue:j,onPlan:c,onViewBeads:h})]})},te))}),a.jsx(_5,{dropAnimation:re,children:g?a.jsx(oL,{issue:g}):null})]}),a.jsx(cL,{isVisible:C,onUndo:O,onClose:()=>S(!1)}),a.jsx(aL,{isOpen:F.open,onClose:()=>P({open:!1,issue:null,targetStatus:null}),onConfirm:z,issue:F.issue}),a.jsx(lL,{isOpen:I.open,onClose:()=>A({open:!1,issue:null}),onSync:X,issue:I.issue}),l&&a.jsx(zM,{issue:l,isOpen:!0,onClose:()=>c(null),onComplete:()=>{c(null),n.invalidateQueries({queryKey:["issues"]})}}),u&&a.jsx(uL,{issue:u,onClose:()=>h(null)})]})}function rL({issues:e,agents:t,specialists:n,issueCosts:r,selectedIssue:s,onSelectIssue:i,onPlan:o,onViewBeads:l}){const[c,u]=v.useState(new Set),h=v.useCallback(m=>{u(g=>{const b=new Set(g);return b.has(m)?b.delete(m):b.add(m),b})},[]),p=e.some(m=>{var g;return(g=m.artifactType)==null?void 0:g.includes("PortfolioItem")})?JM(e):null,f=m=>{const g=m.identifier.toLowerCase(),b=t.find(y=>{var _;return((_=y.issueId)==null?void 0:_.toLowerCase())===g&&y.type==="agent"}),x=n.filter(y=>{var _;return((_=y.currentIssue)==null?void 0:_.toLowerCase())===g});return a.jsx(iL,{issue:m,children:a.jsx(dL,{issue:m,workAgent:b,specialists:x,cost:r[m.identifier.toLowerCase()],isSelected:s===m.identifier,onSelect:()=>i(s===m.identifier?null:m.identifier),onPlan:()=>o(m),onViewBeads:y=>l(y)})},m.id)};return e.length===0?a.jsx("div",{className:"p-2 space-y-2 max-h-[calc(100vh-220px)] overflow-y-auto",children:a.jsx("div",{className:"text-center text-content-muted py-8 text-sm",children:"No issues"})}):p?a.jsx("div",{className:"p-2 space-y-2 max-h-[calc(100vh-220px)] overflow-y-auto",children:p.map(m=>{if(m.type==="orphan")return f(m.children[0]);const g=m.feature,b=!c.has(g.identifier);return a.jsxs("div",{className:"space-y-1",children:[a.jsx(ZM,{feature:g,childCount:m.children.length,isExpanded:b,onToggle:()=>h(g.identifier)}),b&&a.jsxs("div",{className:"ml-3 border-l-2 border-indigo-700/30 pl-1",children:[m.children.map(x=>a.jsx(eL,{issue:x,agents:t},x.id)),m.children.length===0&&a.jsx("div",{className:"text-xs text-content-muted py-2 pl-2",children:"No stories in this column"})]})]},`feature-${g.id}`)})}):a.jsx("div",{className:"p-2 space-y-2 max-h-[calc(100vh-220px)] overflow-y-auto",children:e.map(f)})}function sL({status:e,children:t}){const{isOver:n,setNodeRef:r}=l5({id:e});return a.jsx("div",{ref:r,className:`flex-shrink-0 w-80 transition-all ${n?"scale-[1.02]":""}`,children:t})}function iL({issue:e,children:t}){const{attributes:n,listeners:r,setNodeRef:s,transform:i,isDragging:o}=s5({id:e.id,data:{issue:e}}),l=i?{transform:`translate3d(${i.x}px, ${i.y}px, 0)`}:void 0;return a.jsx("div",{ref:s,style:l,...r,...n,className:`${o?"opacity-30":"opacity-100"} cursor-grab active:cursor-grabbing`,children:t})}function oL({issue:e}){return a.jsxs("div",{className:"bg-surface-overlay rounded-lg p-3 border-l-4 border-l-blue-500 shadow-2xl rotate-2 scale-105 opacity-90",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"text-content-subtle text-sm",children:e.identifier})}),a.jsx("p",{className:"text-sm text-content mt-1 line-clamp-2",children:e.title})]})}function aL({isOpen:e,onClose:t,onConfirm:n,issue:r}){return!e||!r?null:a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[a.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:t}),a.jsx("div",{className:"relative bg-surface-raised rounded-xl shadow-2xl w-full max-w-md mx-4 p-6",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"p-2 bg-amber-900/50 rounded-lg",children:a.jsx(tn,{className:"w-6 h-6 text-amber-400"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-lg font-semibold text-content mb-2",children:"Active Agent Warning"}),a.jsxs("p",{className:"text-content-body text-sm mb-4",children:[a.jsx("strong",{children:r.identifier})," has an active agent working on it. Moving this issue may disrupt the agent's work."]}),a.jsx("p",{className:"text-content-subtle text-xs mb-6",children:"Are you sure you want to proceed?"}),a.jsxs("div",{className:"flex gap-3 justify-end",children:[a.jsx("button",{onClick:t,className:"px-4 py-2 text-content-subtle hover:text-content transition-colors text-sm",children:"Cancel"}),a.jsx("button",{onClick:n,className:"px-4 py-2 bg-amber-600 hover:bg-amber-500 text-content rounded-lg transition-colors text-sm",children:"Move Anyway"})]})]})]})})]})}function lL({isOpen:e,onClose:t,onSync:n,issue:r}){const[s,i]=v.useState(!1),[o,l]=v.useState(!1);if(!e||!r)return null;const c=r.source==="github"?"GitHub":"Linear";return a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[a.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:t}),a.jsx("div",{className:"relative bg-surface-raised rounded-xl shadow-2xl w-full max-w-md mx-4 p-6",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"p-2 bg-green-900/50 rounded-lg",children:a.jsx(El,{className:"w-6 h-6 text-green-400"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-lg font-semibold text-content mb-2",children:"Move to Done"}),a.jsxs("p",{className:"text-content-body text-sm mb-4",children:["You're moving ",a.jsx("strong",{children:r.identifier})," to Done."]}),a.jsxs("div",{className:"space-y-2 mb-4 p-3 bg-surface-overlay/50 rounded-lg",children:[a.jsxs("label",{className:"flex items-center gap-2 text-sm text-content-body cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:s,onChange:u=>i(u.target.checked),className:"rounded border-divider-strong bg-surface-overlay text-green-500 focus:ring-green-500"}),"Clean up workspace"]}),a.jsxs("label",{className:"flex items-center gap-2 text-sm text-content-body cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:o,onChange:u=>l(u.target.checked),className:"rounded border-divider-strong bg-surface-overlay text-green-500 focus:ring-green-500"}),"Stop running agents"]})]}),a.jsxs("p",{className:"text-content-subtle text-xs mb-4",children:["Sync status change to ",c,"?"]}),a.jsxs("div",{className:"flex gap-3 justify-end",children:[a.jsx("button",{onClick:()=>n(!1,{cleanupWorkspace:s,stopAgents:o}),className:"px-4 py-2 text-content-subtle hover:text-content transition-colors text-sm",children:"Shadow Only"}),a.jsxs("button",{onClick:()=>n(!0,{cleanupWorkspace:s,stopAgents:o}),className:"px-4 py-2 bg-green-600 hover:bg-green-500 text-content rounded-lg transition-colors text-sm",children:["Sync to ",c]})]})]})]})})]})}function cL({isVisible:e,onUndo:t,onClose:n}){return e?a.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50",children:a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg shadow-xl px-4 py-3 flex items-center gap-4",children:[a.jsx("span",{className:"text-sm text-content-body",children:"Issue moved"}),a.jsxs("button",{onClick:t,className:"flex items-center gap-1 text-sm text-blue-400 hover:text-blue-300 transition-colors",children:[a.jsx(vk,{className:"w-4 h-4"}),"Undo"]}),a.jsx("button",{onClick:n,className:"text-content-muted hover:text-content-subtle",children:a.jsx(mt,{className:"w-4 h-4"})})]})}):null}function uL({issue:e,onClose:t}){var i,o;const{data:n,isLoading:r,error:s}=ue({queryKey:["beads",e.identifier],queryFn:async()=>{const l=await fetch(`/api/issues/${e.identifier}/beads`);if(!l.ok)throw new Error("Failed to fetch tasks");return l.json()}});return a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[a.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:t}),a.jsxs("div",{className:"relative bg-surface-raised rounded-xl shadow-2xl w-full max-w-lg mx-4 max-h-[70vh] overflow-hidden flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-divider",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(oo,{className:"w-5 h-5 text-green-400"}),a.jsxs("h2",{className:"font-semibold text-content",children:["Tasks: ",e.identifier]})]}),a.jsx("button",{onClick:t,className:"p-1 text-content-subtle hover:text-content hover:bg-surface-overlay rounded transition-colors",children:a.jsx(mt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[r&&a.jsxs("div",{className:"flex items-center justify-center py-8 text-content-subtle",children:[a.jsx(ye,{className:"w-5 h-5 animate-spin mr-2"}),"Loading tasks..."]}),s&&a.jsx("div",{className:"text-red-400 text-center py-8",children:"Failed to load tasks"}),n&&((i=n.tasks)==null?void 0:i.length)===0&&a.jsx("div",{className:"text-content-muted text-center py-8",children:"No tasks created yet"}),n&&((o=n.tasks)==null?void 0:o.length)>0&&a.jsx("div",{className:"space-y-2",children:n.tasks.map(l=>a.jsxs("div",{className:`flex items-start gap-3 p-3 rounded-lg ${l.status==="closed"?"bg-green-900/20":l.status==="in_progress"?"bg-blue-900/20":"bg-surface-overlay/50"}`,children:[a.jsx("div",{className:`mt-0.5 ${l.status==="closed"?"text-green-400":l.status==="in_progress"?"text-blue-400":"text-content-subtle"}`,children:l.status==="closed"?a.jsx(Yr,{className:"w-4 h-4"}):l.status==="in_progress"?a.jsx(ye,{className:"w-4 h-4 animate-spin"}):a.jsx("div",{className:"w-4 h-4 border-2 border-current rounded-full"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-sm text-content",children:l.title}),a.jsxs("div",{className:"text-xs text-content-muted mt-1",children:[l.id," · ",l.status]})]})]},l.id))})]}),a.jsxs("div",{className:"px-4 py-3 border-t border-divider text-xs text-content-muted",children:[(n==null?void 0:n.count)||0," task",(n==null?void 0:n.count)!==1?"s":""," · Beads"]})]})]})}function dL({issue:e,workAgent:t,specialists:n=[],cost:r,isSelected:s,onSelect:i,onPlan:o,onViewBeads:l}){var $,q;const c=rn(),u=ks(),h=Pa(),d=t,p=d&&d.status!=="dead"&&d.status!=="stopped",f=d,m=Ht[e.status]||"backlog",g=m==="done"||m==="canceled",b=!g&&((($=e.labels)==null?void 0:$.some(D=>typeof D=="string"&&D.toLowerCase()==="review ready"))??!1),x={0:"border-l-gray-500",1:"border-l-red-500",2:"border-l-orange-500",3:"border-l-yellow-500",4:"border-l-blue-500"},y=xe({mutationFn:async D=>{const H=await fetch(`/api/agents/${D}`,{method:"DELETE"});if(!H.ok)throw new Error("Failed to kill agent");return H.json()},onSuccess:()=>{c.invalidateQueries({queryKey:["agents"]})}}),[_,w]=v.useState(""),[C,S]=v.useState(!1),R=xe({mutationFn:async({agentId:D,message:H})=>{const N=await fetch(`/api/agents/${D}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:H})});if(!N.ok)throw new Error("Failed to send message");return N.json()},onSuccess:()=>{w(""),S(!1)}}),T=async D=>{D.stopPropagation(),f&&await u({title:"Kill Agent",message:`Kill agent ${f.id}?`,variant:"destructive",confirmLabel:"Kill"})&&y.mutate(f.id)},F=D=>{D.stopPropagation(),i()},P=D=>{D.stopPropagation(),S(!C)},I=D=>{D.preventDefault(),D.stopPropagation(),f&&_.trim()&&R.mutate({agentId:f.id,message:_.trim()})},A=xe({mutationFn:async()=>{const D=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:e.identifier})});if(!D.ok){const H=await D.json();throw new Error(H.error||"Failed to start agent")}return D.json()},onSuccess:()=>{c.invalidateQueries({queryKey:["agents"]}),c.invalidateQueries({queryKey:["issues"]})},onError:D=>{h({message:`Failed to start agent: ${D.message}`,variant:"error"})}}),M=async D=>{D.stopPropagation(),await u({title:"Start Agent",message:`Start agent for ${e.identifier}?`,confirmLabel:"Start"})&&A.mutate()},j=D=>{D.stopPropagation(),o()},E=xe({mutationFn:async D=>{const H=await fetch(`/api/issues/${e.identifier}/deep-wipe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deleteWorkspace:D.deleteWorkspace})});if(!H.ok){const N=await H.json();throw new Error(N.error||"Deep wipe failed")}return H.json()},onSuccess:D=>{c.invalidateQueries({queryKey:["issues"]}),c.invalidateQueries({queryKey:["agents"]}),console.log("Deep wipe completed:",D.cleanupLog)}});return a.jsxs("div",{onClick:i,className:`bg-surface-overlay rounded-lg p-3 border-l-4 cursor-pointer transition-all ${x[e.priority]||"border-l-gray-500"} ${s?"ring-2 ring-blue-500 bg-gray-650":"hover:bg-gray-650"} ${p?"bg-blue-900/20":""}`,children:[a.jsx("div",{className:"flex items-start justify-between gap-2",children:a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.project&&a.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:e.project.color||"#6b7280"},title:e.project.name}),p&&a.jsxs("div",{className:"flex gap-0.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"0ms"}}),a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"150ms"}}),a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"300ms"}})]}),a.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onClick:D=>D.stopPropagation(),className:"text-sm font-medium text-content hover:text-blue-400 flex items-center gap-1",children:[e.source==="github"&&a.jsx("span",{title:"GitHub Issue",children:a.jsx(Hv,{className:"w-3 h-3 text-content-subtle"})}),a.jsx("span",{className:"text-content-subtle",children:e.identifier}),a.jsx(Qr,{className:"w-3 h-3 opacity-50"})]}),(()=>{const D=[],H=!!t&&n.length>0||n.length>1;t&&D.push({type:"work",name:"work"});for(const N of n){const B=N.name.replace("-agent","");D.push({type:B,name:B})}return D.map((N,B)=>a.jsx(UM,{type:N.type,name:N.name,isConflict:H},B))})(),d&&d.model&&a.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs font-medium bg-surface-emphasis text-content-body",title:`Model: ${d.model}`,children:$M(d.model)}),d&&d.workspaceLocation&&a.jsxs("span",{className:`flex items-center gap-0.5 px-1.5 py-0.5 rounded text-xs font-medium ${d.workspaceLocation==="remote"?"bg-cyan-900/50 text-cyan-400":"bg-surface-emphasis text-content-body"}`,title:d.workspaceLocation==="remote"?"Running on remote VM (exe.dev)":"Running locally",children:[d.workspaceLocation==="remote"?a.jsx(Sm,{className:"w-3 h-3"}):a.jsx(jm,{className:"w-3 h-3"}),d.workspaceLocation]}),b&&a.jsxs("span",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium bg-green-600 text-content animate-pulse",title:"Agent completed work - ready for human review",children:[a.jsx(ok,{className:"w-3 h-3"}),"Ready"]}),!g&&(f==null?void 0:f.hasPendingQuestion)&&a.jsxs("span",{onClick:D=>{D.stopPropagation(),i()},className:"flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium bg-amber-600 text-content animate-pulse cursor-pointer hover:bg-amber-500",title:`Agent is waiting for user input - click to respond (${f.pendingQuestionCount||1} question${(f.pendingQuestionCount||1)>1?"s":""})`,children:[a.jsx(_R,{className:"w-3 h-3"}),"Input"]}),e.source==="rally"&&a.jsx(gx,{issue:e}),(()=>{const D=HC(e.labels);return D?a.jsx(WC,{level:D}):null})(),e.mergeStatus==="merged"&&a.jsxs("span",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-bold bg-green-900/60 text-green-300 border border-green-500/40 uppercase tracking-wide",title:"Branch verified merged into main",children:[a.jsx(Nm,{className:"w-3 h-3"}),"Merged"]}),((q=e.labels)==null?void 0:q.some(D=>D.toLowerCase()==="needs-close-out"))&&a.jsxs("span",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium bg-amber-900/60 text-amber-400 border border-amber-600/40",title:"Reopened for close-out review — verify this work is complete, then click Close Out",children:[a.jsx(tn,{className:"w-3 h-3"}),"Needs Review"]}),r&&r.totalCost>0&&a.jsxs("span",{className:`ml-auto px-1.5 py-0.5 rounded text-xs font-medium ${qC(r.totalCost)}`,title:`${(r.tokenCount/1e6).toFixed(2)}M tokens${r.model?` • ${r.model.replace("claude-","").replace(/-20[0-9]{6}$/,"")}`:""}${r.durationMinutes?` • ${Math.round(r.durationMinutes)}min`:""}`,children:[a.jsx(go,{className:"w-3 h-3 inline -mt-0.5"}),UC(r.totalCost).slice(1)]})]}),a.jsx("p",{className:"text-sm text-content-body mt-1 line-clamp-2",children:e.title})]})}),a.jsxs("div",{className:"flex items-center gap-2 mt-2 flex-wrap",children:[e.assignee&&a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-content-subtle",children:[a.jsx(qv,{className:"w-3 h-3"}),e.assignee.name.split(" ")[0]]}),(e.labels||[]).filter(D=>typeof D=="string"&&D.toLowerCase()!=="review ready"&&D.toLowerCase()!=="needs-close-out").slice(0,2).map(D=>a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs bg-surface-emphasis text-content-body px-2 py-0.5 rounded",children:[a.jsx(Wv,{className:"w-3 h-3"}),D]},D))]}),p&&a.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-divider-strong",children:[a.jsxs("button",{onClick:F,className:`flex items-center gap-1 text-xs transition-colors ${s?"text-blue-400":"text-content-subtle hover:text-content"}`,children:[a.jsx(kc,{className:"w-3.5 h-3.5"}),"Watch"]}),a.jsxs("button",{onClick:()=>l&&l(e),className:"flex items-center gap-1 text-xs text-green-400 hover:text-green-300 transition-colors",title:"View tasks for this issue",children:[a.jsx(oo,{className:"w-3.5 h-3.5"}),"Tasks"]}),a.jsxs("button",{onClick:P,className:`flex items-center gap-1 text-xs transition-colors ${C?"text-blue-400":"text-content-subtle hover:text-content"}`,children:[a.jsx(ER,{className:"w-3.5 h-3.5"}),"Tell"]}),a.jsxs("button",{onClick:T,disabled:y.isPending,className:"flex items-center gap-1 text-xs text-red-400 hover:text-red-300 transition-colors ml-auto",children:[y.isPending?a.jsx(ye,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(mt,{className:"w-3.5 h-3.5"}),"Kill"]})]}),C&&f&&a.jsx("form",{onSubmit:I,className:"mt-2",onClick:D=>D.stopPropagation(),children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{type:"text",value:_,onChange:D=>w(D.target.value),placeholder:"Type a message...",className:"flex-1 bg-surface-raised text-content text-sm px-3 py-1.5 rounded border border-divider-strong focus:border-blue-500 focus:outline-none",autoFocus:!0}),a.jsx("button",{type:"submit",disabled:!_.trim()||R.isPending,className:"px-3 py-1.5 bg-blue-600 text-content text-sm rounded hover:bg-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:R.isPending?"...":"Send"})]})}),!p&&(Ht[e.status]==="backlog"||Ht[e.status]==="todo")&&a.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-divider-strong flex-wrap",children:[a.jsxs("button",{onClick:j,className:"flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 transition-colors",children:[a.jsx(io,{className:"w-3.5 h-3.5"}),"Plan"]}),a.jsxs("button",{onClick:M,disabled:A.isPending,className:"flex items-center gap-1 text-xs text-content-muted hover:text-content-subtle transition-colors disabled:opacity-50",title:"Plan first recommended",children:[A.isPending?a.jsx(ye,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(Rn,{className:"w-3.5 h-3.5"}),A.isPending?"Starting...":"Start Agent"]}),a.jsx(vu,{issue:e,deepWipeMutation:E})]}),!p&&Ht[e.status]==="in_progress"&&a.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-divider-strong flex-wrap",children:[a.jsxs("button",{onClick:j,className:"flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 transition-colors",children:[a.jsx(io,{className:"w-3.5 h-3.5"}),"Re-plan"]}),a.jsxs("button",{onClick:()=>l&&l(e),className:"flex items-center gap-1 text-xs text-green-400 hover:text-green-300 transition-colors",title:"View tasks for this issue",children:[a.jsx(oo,{className:"w-3.5 h-3.5"}),"Tasks"]}),a.jsxs("button",{onClick:M,className:"flex items-center gap-1 text-xs text-blue-400 hover:text-blue-300 transition-colors",children:[a.jsx(Rn,{className:"w-3.5 h-3.5"}),"Resume Agent"]}),a.jsxs("button",{onClick:async D=>{D.stopPropagation(),await u({title:"Reset Issue",message:`Reset ${e.identifier}?
508
-
509
- This will:
510
- • Kill any running agents (local and remote)
511
- • Move the issue back to To Do in Linear
512
- • Keep the workspace for reference`,variant:"destructive",confirmLabel:"Reset"})&&fetch(`/api/issues/${e.identifier}/reset`,{method:"POST",headers:{"Content-Type":"application/json"}}).then(async()=>{await c.refetchQueries({queryKey:["issues"]}),await c.refetchQueries({queryKey:["agents"]})}).catch(H=>console.error("Reset failed:",H))},className:"flex items-center gap-1 text-xs text-orange-400 hover:text-orange-300 transition-colors",title:"Reset to To Do - kills agents, resets Linear status",children:[a.jsx(vk,{className:"w-3.5 h-3.5"}),"Reset"]}),a.jsx(vu,{issue:e,deepWipeMutation:E})]}),!p&&Ht[e.status]==="in_review"&&a.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-divider-strong flex-wrap",children:[a.jsx(z_,{issue:e,inline:!0}),a.jsx(vu,{issue:e,deepWipeMutation:E})]}),!p&&Ht[e.status]==="done"&&a.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-green-600/30 flex-wrap",children:[a.jsx(z_,{issue:e,inline:!0}),a.jsx(hL,{issue:e}),a.jsx(vu,{issue:e,deepWipeMutation:E})]})]})}function vu({issue:e,deepWipeMutation:t}){const n=ks();return a.jsxs("button",{onClick:async r=>{r.stopPropagation(),await n({title:"Deep Wipe",message:`Deep wipe ${e.identifier}? This will clean up ALL state:
513
-
514
- • Kill agents
515
- • Delete agent state
516
- • Delete workspace & branches
517
- • Reset issue to Todo/Open
518
-
519
- This is irreversible.`,variant:"destructive",confirmLabel:"Wipe Everything"})&&t.mutate({deleteWorkspace:!0})},disabled:t.isPending,className:"flex items-center gap-1 text-xs text-red-400/60 hover:text-red-400 transition-colors disabled:opacity-50 ml-auto",title:"Deep wipe: delete workspace, branches, agent state — start completely fresh",children:[t.isPending?a.jsx(ye,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(gk,{className:"w-3.5 h-3.5"}),t.isPending?"Wiping...":"Wipe"]})}function z_({issue:e,inline:t}){const n=rn(),r=ks(),s=xe({mutationFn:async()=>{const l=await fetch(`/api/issues/${e.identifier}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!l.ok){const c=await l.json();throw new Error(c.error||"Failed to reopen issue")}return l.json()},onSuccess:async()=>{await n.refetchQueries({queryKey:["issues"]})}}),i=async l=>{l.stopPropagation(),await r({title:"Reopen Issue",message:`Reopen ${e.identifier} for re-work?
520
-
521
- This will move it back to In Progress.`,confirmLabel:"Reopen"})&&s.mutate()},o=a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:i,disabled:s.isPending,className:"flex items-center gap-1 text-xs text-orange-400 hover:text-orange-300 transition-colors disabled:opacity-50",children:[s.isPending?a.jsx(ye,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(Cc,{className:"w-3.5 h-3.5"}),s.isPending?"Reopening...":"Reopen"]}),s.isError&&a.jsx("span",{className:"text-xs text-red-400",children:s.error.message})]});return t?o:a.jsx("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-green-600/30",children:o})}function hL({issue:e}){const t=rn(),n=ks(),r=xe({mutationFn:async()=>{const i=await fetch(`/api/issues/${e.identifier}/close-out`,{method:"POST",headers:{"Content-Type":"application/json"}}),o=await i.json();if(!i.ok||!o.success)throw new Error(o.error||"Close-out failed");return o},onSuccess:async()=>{await t.refetchQueries({queryKey:["issues"]})}}),s=async i=>{i.stopPropagation(),await n({title:"Close Out Issue",message:`Close out ${e.identifier}?
522
-
523
- This will:
524
- • Verify branch is merged
525
- • Archive workspace artifacts
526
- • Clean up agent state
527
- • Close issue on tracker
528
- • Apply closed-out label`,variant:"destructive",confirmLabel:"Close Out"})&&r.mutate()};return a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:s,disabled:r.isPending,className:"flex items-center gap-1 text-xs text-blue-400 hover:text-blue-300 transition-colors disabled:opacity-50",children:[r.isPending?a.jsx(ye,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(ok,{className:"w-3.5 h-3.5"}),r.isPending?"Closing out...":"Close Out"]}),r.isError&&a.jsx("span",{className:"text-xs text-red-400",children:r.error.message})]})}const fL={sleeping:"😴",active:"🟢",uninitialized:"⚪",suspended:"⏸️"},pL={sleeping:"Sleeping",active:"Active",uninitialized:"Not Initialized",suspended:"Suspended"},mL={sleeping:"text-blue-400",active:"text-green-400",uninitialized:"text-content-muted",suspended:"text-yellow-400"};async function gL(e){const t=await fetch(`/api/specialists/${e}/wake`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to wake specialist")}}async function vL(e){const t=await fetch(`/api/specialists/${e}/reset`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reinitialize:!1})});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to reset specialist")}}async function xL(e){if(!(await fetch(`/api/agents/${e}`,{method:"DELETE"})).ok)throw new Error("Failed to kill specialist")}async function yL(e,t){const n=await fetch(`/api/agents/${e}/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:t})});if(!n.ok){const r=await n.json();throw new Error(r.error||"Failed to resume agent")}}async function _L(e){const t=await fetch(`/api/agents/${e}/activity?limit=20`);return t.ok?(await t.json()).activity||[]:[]}async function bL(e){const t=await fetch(`/api/specialists/${e}/cost`);return t.ok?t.json():{cost:0,inputTokens:0,outputTokens:0}}function wL(e,t){return ue({queryKey:["specialist-cost",e],queryFn:()=>bL(e),enabled:t,refetchInterval:1e4})}async function SL(e){const t=await fetch(`/api/specialists/${e}/queue`);return t.ok?t.json():{specialistName:e,hasWork:!1,urgentCount:0,totalCount:0,items:[]}}async function kL(e,t){const n=await fetch(`/api/specialists/${e}/queue/${t}`,{method:"DELETE"});if(!n.ok){const r=await n.json();throw new Error(r.error||"Failed to remove queue item")}}async function CL(e,t){const n=await fetch(`/api/specialists/${e}/queue/reorder`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({itemIds:t})});if(!n.ok){const r=await n.json();throw new Error(r.error||"Failed to reorder queue")}}function NL(e){return ue({queryKey:["specialist-queue",e],queryFn:()=>SL(e),refetchInterval:5e3})}function jL(e,t){return ue({queryKey:["activity",e],queryFn:()=>_L(e),enabled:t,refetchInterval:1e4})}function EL(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function RL(e){if(!e)return"Never";const t=new Date(e),r=new Date().getTime()-t.getTime(),s=Math.floor(r/6e4),i=Math.floor(s/60),o=Math.floor(i/24);return o>0?`${o}d ago`:i>0?`${i}h ago`:s>0?`${s}m ago`:"Just now"}function TL({specialist:e,issueInfo:t,onSelect:n,isSelected:r}){const s=rn(),i=ks(),o=Pa(),{data:l}=wL(e.name,e.state!=="uninitialized"),{data:c}=NL(e.name),{data:u}=jL(e.tmuxSession,e.state!=="uninitialized"),[h,d]=v.useState(!1),[p,f]=v.useState(!1),m=xe({mutationFn:()=>gL(e.name),onSuccess:()=>{s.invalidateQueries({queryKey:["specialists"]}),s.invalidateQueries({queryKey:["agents"]})},onError:j=>{o({message:`Failed to wake ${e.displayName}: ${j.message}`,variant:"error"})}}),g=xe({mutationFn:()=>vL(e.name),onSuccess:()=>{s.invalidateQueries({queryKey:["specialists"]})},onError:j=>{o({message:`Failed to reset ${e.displayName}: ${j.message}`,variant:"error"})}}),b=xe({mutationFn:()=>xL(e.tmuxSession),onSuccess:()=>{s.invalidateQueries({queryKey:["specialists"]}),s.invalidateQueries({queryKey:["agents"]})}}),x=xe({mutationFn:j=>yL(e.tmuxSession,j),onSuccess:()=>{s.invalidateQueries({queryKey:["specialists"]}),s.invalidateQueries({queryKey:["agents"]})},onError:j=>{o({message:`Failed to resume ${e.displayName}: ${j.message}`,variant:"error"})}}),y=xe({mutationFn:j=>kL(e.name,j),onSuccess:()=>{s.invalidateQueries({queryKey:["specialist-queue",e.name]})},onError:j=>{o({message:`Failed to remove queue item: ${j.message}`,variant:"error"})}}),_=xe({mutationFn:j=>CL(e.name,j),onSuccess:()=>{s.invalidateQueries({queryKey:["specialist-queue",e.name]})},onError:j=>{o({message:`Failed to reorder queue: ${j.message}`,variant:"error"})}}),w=j=>{j.stopPropagation(),m.mutate()},C=async j=>{j.stopPropagation(),await i({title:"Reset Specialist",message:`Reset ${e.displayName}? This will clear the session file and context.`,variant:"destructive",confirmLabel:"Reset"})&&g.mutate()},S=async j=>{j.stopPropagation(),await i({title:"Kill Specialist",message:`Kill ${e.displayName}?`,variant:"destructive",confirmLabel:"Kill"})&&b.mutate()},R=(j,E)=>{j.stopPropagation(),y.mutate(E)},T=(j,E)=>{if(j.stopPropagation(),!c||E===0)return;const $=[...c.items];[$[E-1],$[E]]=[$[E],$[E-1]],_.mutate($.map(q=>q.id))},F=(j,E)=>{if(j.stopPropagation(),!c||E===c.items.length-1)return;const $=[...c.items];[$[E],$[E+1]]=[$[E+1],$[E]],_.mutate($.map(q=>q.id))},P=j=>{j.stopPropagation(),d(!h)},I=j=>{j.stopPropagation(),f(!p)},A=j=>{j.stopPropagation(),x.mutate(void 0)},M={urgent:"text-red-400",high:"text-orange-400",normal:"text-blue-400",low:"text-content-subtle"};return a.jsxs("div",{onClick:n,className:`p-4 cursor-pointer transition-colors ${r?"bg-surface-overlay":"hover:bg-gray-750"}`,children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx($v,{className:"w-5 h-5 text-purple-400"}),a.jsxs("div",{children:[a.jsxs("div",{className:"font-medium text-content flex items-center gap-2",children:[e.displayName,e.state==="active"?a.jsx(ye,{className:"w-4 h-4 text-green-400 animate-spin"}):a.jsx("span",{className:`text-xs ${mL[e.state]}`,children:fL[e.state]}),c&&c.totalCount>0&&a.jsxs("button",{onClick:P,className:"text-xs text-yellow-400 hover:text-yellow-300 flex items-center gap-1",title:`${c.totalCount} queued task${c.totalCount>1?"s":""}`,children:["(",c.totalCount,")",h?a.jsx(mh,{className:"w-3 h-3"}):a.jsx(Sc,{className:"w-3 h-3"})]})]}),a.jsx("div",{className:"text-sm text-content-subtle",children:e.description}),e.currentIssue&&a.jsxs("div",{className:"text-xs text-cyan-400 mt-1 flex items-center gap-1",children:[a.jsx("span",{className:"text-content-muted",children:"Working on:"}),a.jsx("span",{className:"font-mono",children:e.currentIssue}),t&&a.jsxs("span",{className:"text-content-subtle truncate max-w-[200px]",title:t.title,children:["- ",t.title]})]}),e.sessionId&&!e.currentIssue&&a.jsxs("div",{className:"text-xs text-content-muted font-mono mt-1",children:["Session: ",e.sessionId.slice(0,8),"..."]})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"text-right",children:[a.jsx("div",{className:"text-sm text-content-subtle",children:pL[e.state]}),l&&l.cost>0&&a.jsxs("div",{className:"text-xs text-green-400 font-medium",title:"Total cost",children:["$",l.cost.toFixed(4)]}),e.contextTokens&&a.jsxs("div",{className:"text-xs text-content-muted",children:[EL(e.contextTokens)," tokens"]}),e.lastWake&&a.jsxs("div",{className:"text-xs text-content-muted",children:["Last wake: ",RL(e.lastWake)]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[e.state!=="uninitialized"&&u&&u.length>0&&a.jsx("button",{onClick:I,className:"p-2 text-content-subtle hover:text-blue-400 hover:bg-surface-emphasis rounded",title:`Show activity history (${u.length} entries)`,children:a.jsx(ba,{className:"w-4 h-4"})}),e.state==="suspended"&&a.jsx("button",{onClick:A,disabled:x.isPending,className:"p-2 text-content-subtle hover:text-green-400 hover:bg-surface-emphasis rounded disabled:opacity-50",title:"Resume specialist",children:a.jsx(Rn,{className:"w-4 h-4"})}),(e.state==="sleeping"||e.state==="uninitialized")&&a.jsx("button",{onClick:w,disabled:m.isPending||e.state==="uninitialized",className:"p-2 text-content-subtle hover:text-green-400 hover:bg-surface-emphasis rounded disabled:opacity-50 disabled:cursor-not-allowed",title:e.state==="uninitialized"?"Specialist not initialized - needs session ID":"Wake specialist",children:a.jsx(MR,{className:"w-4 h-4"})}),e.state==="active"&&a.jsx("button",{onClick:S,disabled:b.isPending,className:"p-2 text-content-subtle hover:text-red-400 hover:bg-surface-emphasis rounded",title:"Kill specialist",children:a.jsx(bs,{className:"w-4 h-4"})}),(e.state==="sleeping"||e.state==="uninitialized")&&a.jsx("button",{onClick:C,disabled:g.isPending,className:"p-2 text-content-subtle hover:text-yellow-400 hover:bg-surface-emphasis rounded",title:"Reset specialist (clear session)",children:a.jsx(Cc,{className:"w-4 h-4"})})]})]})]}),h&&c&&c.totalCount>0&&a.jsxs("div",{className:"mt-3 pl-8 border-l-2 border-divider-strong",children:[a.jsxs("div",{className:"text-xs text-content-subtle font-medium mb-2",children:["Queued Tasks (",c.totalCount,")"]}),a.jsx("div",{className:"space-y-2",children:c.items.map((j,E)=>a.jsxs("div",{className:"flex items-center justify-between bg-gray-750 px-3 py-2 rounded text-xs",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[a.jsxs("span",{className:"text-content-muted",children:[E+1,"."]}),a.jsx("span",{className:"text-content font-mono",children:j.payload.issueId||j.payload.message||j.id.substring(0,8)}),a.jsxs("span",{className:`${M[j.priority]} font-medium`,children:["[",j.priority,"]"]}),a.jsx("span",{className:"text-content-muted text-xs",children:j.source})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:$=>T($,E),disabled:E===0||_.isPending,className:"p-1 text-content-subtle hover:text-blue-400 disabled:opacity-30 disabled:cursor-not-allowed",title:"Move up",children:a.jsx(DR,{className:"w-3 h-3"})}),a.jsx("button",{onClick:$=>F($,E),disabled:E===c.items.length-1||_.isPending,className:"p-1 text-content-subtle hover:text-blue-400 disabled:opacity-30 disabled:cursor-not-allowed",title:"Move down",children:a.jsx(PR,{className:"w-3 h-3"})}),a.jsx("button",{onClick:$=>R($,j.id),disabled:y.isPending,className:"p-1 text-content-subtle hover:text-red-400 disabled:opacity-50",title:"Remove from queue",children:a.jsx(gk,{className:"w-3 h-3"})})]})]},j.id))})]}),p&&u&&u.length>0&&a.jsxs("div",{className:"mt-3 pl-8 border-l-2 border-divider-strong",children:[a.jsxs("div",{className:"text-xs text-content-subtle font-medium mb-2",children:["Recent Activity (",u.length,")"]}),a.jsx("div",{className:"space-y-1",children:u.slice().reverse().map((j,E)=>a.jsxs("div",{className:"flex items-center gap-2 bg-gray-750 px-3 py-1.5 rounded text-xs",children:[a.jsx("span",{className:"text-content-muted",children:new Date(j.ts).toLocaleTimeString()}),a.jsx("span",{className:"text-blue-400 font-mono",children:j.tool}),j.action&&a.jsx("span",{className:"text-content-subtle truncate",children:j.action.substring(0,50)})]},E))})]})]})}async function PL(e){const t=await fetch(`/api/agents/${e}/handoff/suggestion`);if(!t.ok)throw new Error("Failed to fetch handoff suggestion");return t.json()}async function DL(e){const t=await fetch(`/api/agents/${e}/cost`);if(!t.ok)throw new Error("Failed to fetch agent cost");return t.json()}function ML(e){return ue({queryKey:["handoff-suggestion",e],queryFn:()=>PL(e),refetchInterval:3e4})}function LL(e){return ue({queryKey:["agent-cost",e],queryFn:()=>DL(e),refetchInterval:6e4})}async function AL(e,t,n){const r=await fetch(`/api/agents/${e}/handoff`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({toModel:t,reason:n})});if(!r.ok){const s=await r.json();throw new Error(s.error||"Failed to execute handoff")}}const OL={opus:"text-purple-400 bg-purple-900/20 border-purple-500/30",sonnet:"text-blue-400 bg-blue-900/20 border-blue-500/30",haiku:"text-green-400 bg-green-900/20 border-green-500/30"};function IL({agentId:e}){const{data:t,isLoading:n}=ML(e),r=rn(),s=ks(),i=Pa(),o=xe({mutationFn:({toModel:u,reason:h})=>AL(e,u,h),onSuccess:()=>{r.invalidateQueries({queryKey:["agents"]}),r.invalidateQueries({queryKey:["handoff-suggestion",e]}),i({message:"Handoff completed successfully",variant:"success"})},onError:u=>{i({message:`Handoff failed: ${u.message}`,variant:"error"})}}),l=async u=>{await s({title:"Confirm Handoff",message:`Hand off ${e} to ${u}?`,confirmLabel:"Hand Off"})&&o.mutate({toModel:u,reason:"Manual handoff from dashboard"})},c=async()=>{t!=null&&t.suggestedModel&&await s({title:"Confirm Handoff",message:`${t.reason}
529
-
530
- Proceed with handoff to ${t.suggestedModel}?`,confirmLabel:"Hand Off"})&&o.mutate({toModel:t.suggestedModel,reason:t.reason})};return n?a.jsx("div",{className:"p-3 bg-surface-raised rounded border border-divider",children:a.jsx("div",{className:"text-sm text-content-subtle",children:"Loading handoff data..."})}):t?a.jsxs("div",{className:"p-3 bg-surface-raised rounded border border-divider space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-content-subtle",children:"Current Model:"}),a.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded border ${OL[t.currentModel]||"text-content-subtle bg-surface-overlay border-divider-strong"}`,children:t.currentModel})]}),t.suggested&&t.suggestedModel&&a.jsxs("div",{className:"flex items-start gap-2 p-2 bg-orange-900/20 border border-orange-500/30 rounded",children:[a.jsx(so,{className:"w-4 h-4 text-orange-400 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-sm font-medium text-orange-400 mb-1",children:"Handoff Suggested"}),a.jsx("div",{className:"text-xs text-content-body mb-2",children:t.reason}),a.jsxs("button",{onClick:c,disabled:o.isPending,className:"flex items-center gap-2 px-3 py-1.5 text-xs font-medium text-content bg-orange-600 hover:bg-orange-500 rounded disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx(wm,{className:"w-3 h-3"}),"Hand off to ",t.suggestedModel]})]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-content-subtle mb-2",children:"Manual Handoff:"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>l("haiku"),disabled:o.isPending||t.currentModel==="haiku",className:"flex-1 px-2 py-1.5 text-xs font-medium text-green-400 bg-green-900/20 hover:bg-green-900/40 border border-green-500/30 rounded disabled:opacity-50 disabled:cursor-not-allowed",children:"Haiku"}),a.jsx("button",{onClick:()=>l("sonnet"),disabled:o.isPending||t.currentModel==="sonnet",className:"flex-1 px-2 py-1.5 text-xs font-medium text-blue-400 bg-blue-900/20 hover:bg-blue-900/40 border border-blue-500/30 rounded disabled:opacity-50 disabled:cursor-not-allowed",children:"Sonnet"}),a.jsx("button",{onClick:()=>l("opus"),disabled:o.isPending||t.currentModel==="opus",className:"flex-1 px-2 py-1.5 text-xs font-medium text-purple-400 bg-purple-900/20 hover:bg-purple-900/40 border border-purple-500/30 rounded disabled:opacity-50 disabled:cursor-not-allowed",children:"Opus"})]})]})]}):null}const BL={healthy:"bg-status-healthy",warning:"bg-status-warning",stuck:"bg-status-stuck",dead:"bg-status-dead",stopped:"bg-gray-500"},FL={active:"🟢",stale:"🟡",warning:"🟠",stuck:"🔴",suspended:"⏸️"},zL={active:"Active",stale:"Stale",warning:"Warning",stuck:"Stuck",suspended:"Suspended"},$L={active:"text-green-400",stale:"text-yellow-400",warning:"text-orange-400",stuck:"text-red-400",suspended:"text-blue-400"};async function HL(e){if(!(await fetch(`/api/agents/${e}`,{method:"DELETE"})).ok)throw new Error("Failed to kill agent")}async function WL(e){const t=await fetch(`/api/agents/${e}/poke`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to poke agent")}}async function UL(e,t){const n=await fetch(`/api/agents/${e}/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:t})});if(!n.ok){const r=await n.json();throw new Error(r.error||"Failed to resume agent")}}async function qL(e){const t=await fetch(`/api/agents/${e}/activity?limit=20`);return t.ok?(await t.json()).activity||[]:[]}function KL(e,t){return ue({queryKey:["activity",e],queryFn:()=>qL(e),enabled:t,refetchInterval:1e4})}function VL(e){const t=new Date(e),r=new Date().getTime()-t.getTime(),s=Math.floor(r/6e4),i=Math.floor(s/60);return i>0?`${i}h ${s%60}m`:`${s}m`}function YL(e){if(e===null)return"unknown";const t=Math.floor(e/1e3),n=Math.floor(t/60),r=Math.floor(n/60);return r>0?`${r}h ago`:n>0?`${n}m ago`:`${t}s ago`}function QL({agent:e,health:t,onSelect:n,isSelected:r}){const s=rn(),i=ks(),o=Pa(),[l,c]=v.useState(!1),[u,h]=v.useState(!1),{data:d}=LL(e.id),{data:p}=KL(e.id,(t==null?void 0:t.isRunning)||(t==null?void 0:t.state)==="suspended"),f=xe({mutationFn:()=>HL(e.id),onSuccess:()=>{s.invalidateQueries({queryKey:["agents"]})}}),m=xe({mutationFn:()=>WL(e.id),onSuccess:()=>{o({message:`Poked ${e.id} successfully`,variant:"success"})},onError:S=>{o({message:`Failed to poke ${e.id}: ${S.message}`,variant:"error"})}}),g=xe({mutationFn:S=>UL(e.id,S),onSuccess:()=>{s.invalidateQueries({queryKey:["agents"]})},onError:S=>{o({message:`Failed to resume ${e.id}: ${S.message}`,variant:"error"})}}),b=async S=>{S.stopPropagation(),await i({title:"Kill Agent",message:`Kill agent ${e.id}?`,variant:"destructive",confirmLabel:"Kill"})&&f.mutate()},x=S=>{S.stopPropagation(),m.mutate()},y=S=>{S.stopPropagation(),g.mutate(void 0)},_=S=>{S.stopPropagation(),h(!u)},w=(t==null?void 0:t.state)==="warning"||(t==null?void 0:t.state)==="stuck",C=S=>{S.stopPropagation(),c(!l)};return a.jsxs("div",{onClick:n,className:`p-4 cursor-pointer transition-colors ${r?"bg-surface-overlay":"hover:bg-gray-750"}`,children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`w-3 h-3 rounded-full ${BL[e.status]}`}),a.jsxs("div",{children:[a.jsxs("div",{className:"font-medium text-content flex items-center gap-2",children:[e.id,t&&a.jsx("span",{className:`text-xs ${$L[t.state]}`,title:`Cloister: ${zL[t.state]}`,children:FL[t.state]})]}),a.jsxs("div",{className:"text-sm text-content-subtle flex items-center gap-2",children:[e.runtime," / ",e.model,d&&d.cost>0&&a.jsxs("span",{className:"flex items-center gap-1 text-xs text-emerald-400",title:"Agent cost so far",children:[a.jsx(go,{className:"w-3 h-3"}),"$",d.cost.toFixed(4)]}),e.contextPercent!=null&&a.jsxs("span",{className:"flex items-center gap-1.5 text-xs",title:`Context: ${e.contextPercent}%${e.initialContextPercent?` (init: ${e.initialContextPercent}%)`:""}`,children:[a.jsx("span",{className:"w-14 h-1.5 bg-gray-700 rounded-full overflow-hidden inline-block",children:a.jsx("span",{className:`block h-full rounded-full transition-all ${e.contextPercent>80?"bg-red-500":e.contextPercent>50?"bg-yellow-500":"bg-emerald-500"}`,style:{width:`${Math.min(e.contextPercent,100)}%`}})}),a.jsxs("span",{className:e.contextPercent>80?"text-red-400":e.contextPercent>50?"text-yellow-400":"text-content-muted",children:[e.contextPercent,"%"]})]})]})]})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"text-right",children:[a.jsxs("div",{className:"flex items-center gap-1 text-sm text-content-subtle",children:[a.jsx(wa,{className:"w-4 h-4"}),VL(e.startedAt)]}),t&&t.timeSinceActivity!==null&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-content-muted",children:[a.jsx(ba,{className:"w-3 h-3"}),YL(t.timeSinceActivity)]}),e.consecutiveFailures>0&&a.jsxs("div",{className:"flex items-center gap-1 text-sm text-orange-400",children:[a.jsx(tn,{className:"w-4 h-4"}),e.consecutiveFailures," failures"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[t&&(t.isRunning||t.state==="suspended")&&p&&p.length>0&&a.jsx("button",{onClick:_,className:"p-2 text-content-subtle hover:text-blue-400 hover:bg-surface-emphasis rounded",title:`Show activity history (${p.length} entries)`,children:a.jsx(ba,{className:"w-4 h-4"})}),e.status!=="stopped"&&a.jsx("button",{onClick:C,className:`p-2 hover:bg-surface-emphasis rounded ${l?"text-blue-400":"text-content-subtle hover:text-blue-400"}`,title:"Model handoff controls",children:a.jsx(zv,{className:"w-4 h-4"})}),(t==null?void 0:t.state)==="suspended"&&a.jsx("button",{onClick:y,disabled:g.isPending,className:"p-2 text-content-subtle hover:text-green-400 hover:bg-surface-emphasis rounded disabled:opacity-50",title:"Resume agent",children:a.jsx(Rn,{className:"w-4 h-4"})}),w&&a.jsx("button",{onClick:x,disabled:m.isPending,className:"p-2 text-content-subtle hover:text-yellow-400 hover:bg-surface-emphasis rounded",title:"Poke agent (send nudge message)",children:a.jsx(sk,{className:"w-4 h-4"})}),(t==null?void 0:t.state)!=="suspended"&&e.status!=="stopped"&&a.jsx("button",{onClick:b,disabled:f.isPending,className:"p-2 text-content-subtle hover:text-red-400 hover:bg-surface-emphasis rounded",title:"Kill agent",children:a.jsx(tc,{className:"w-4 h-4"})})]})]})]}),l&&a.jsx("div",{className:"mt-3 pt-3 border-t border-divider",children:a.jsx(IL,{agentId:e.id})}),u&&p&&p.length>0&&a.jsxs("div",{className:"mt-3 pl-8 border-l-2 border-divider-strong",children:[a.jsxs("div",{className:"text-xs text-content-subtle font-medium mb-2",children:["Recent Activity (",p.length,")"]}),a.jsx("div",{className:"space-y-1",children:p.slice().reverse().map((S,R)=>a.jsxs("div",{className:"flex items-center gap-2 bg-gray-750 px-3 py-1.5 rounded text-xs",children:[a.jsx("span",{className:"text-content-muted",children:new Date(S.ts).toLocaleTimeString()}),a.jsx("span",{className:"text-blue-400 font-mono",children:S.tool}),S.action&&a.jsx("span",{className:"text-content-subtle truncate",children:S.action.substring(0,50)})]},R))})]})]})}async function XL(){const e=await fetch("/api/agents");if(!e.ok)throw new Error("Failed to fetch agents");return e.json()}async function GL(){const e=await fetch("/api/specialists");if(!e.ok)throw new Error("Failed to fetch specialists");const t=await e.json();return t.specialists??t}async function JL(){const e=await fetch("/api/cloister/agents/health");if(!e.ok)throw new Error("Failed to fetch Cloister health");return e.json()}async function ZL(){const e=await fetch("/api/cloister/status");if(!e.ok)throw new Error("Failed to fetch Cloister status");return e.json()}async function eA(){const e=await fetch("/api/activity");return e.ok?e.json():[]}async function tA(){const e=await fetch("/api/issues");return e.ok?(await e.json()).issues||[]:[]}async function nA(){if(!(await fetch("/api/cloister/start",{method:"POST"})).ok)throw new Error("Failed to start Cloister")}async function rA(){if(!(await fetch("/api/cloister/stop",{method:"POST"})).ok)throw new Error("Failed to stop Cloister")}function sA(e){if(!e)return"Never";const t=new Date(e),r=new Date().getTime()-t.getTime(),s=Math.floor(r/1e3),i=Math.floor(s/60);return s<60?`${s}s ago`:i<60?`${i}m ago`:`${Math.floor(i/60)}h ago`}async function iA(){const e=await fetch("/api/specialists/reset-all",{method:"POST",headers:{"Content-Type":"application/json"}});if(!e.ok){const t=await e.json();throw new Error(t.error||"Failed to reset specialists")}}function oA({selectedAgent:e,onSelectAgent:t}){const n=rn(),r=ks(),s=Pa(),{data:i,isLoading:o,error:l}=ue({queryKey:["agents"],queryFn:XL,refetchInterval:3e3}),{data:c,isLoading:u}=ue({queryKey:["specialists"],queryFn:GL,refetchInterval:5e3}),{data:h}=ue({queryKey:["cloister-health"],queryFn:JL,refetchInterval:5e3}),{data:d}=ue({queryKey:["cloister-status"],queryFn:ZL,refetchInterval:5e3}),{data:p}=ue({queryKey:["activity"],queryFn:eA,refetchInterval:5e3}),{data:f}=ue({queryKey:["issues"],queryFn:tA,refetchInterval:3e4}),m=xe({mutationFn:nA,onSuccess:()=>{n.invalidateQueries({queryKey:["cloister-status"]})}}),g=xe({mutationFn:rA,onSuccess:()=>{n.invalidateQueries({queryKey:["cloister-status"]})}}),b=xe({mutationFn:iA,onSuccess:()=>{n.invalidateQueries({queryKey:["specialists"]}),n.invalidateQueries({queryKey:["agents"]})},onError:T=>{s({message:`Failed to reset specialists: ${T.message}`,variant:"error"})}}),x=async()=>{await r({title:"Reset Specialists",message:`Reset ALL specialist agents?
531
-
532
- This will kill any running specialists and clear their session files.`,variant:"destructive",confirmLabel:"Reset All"})&&b.mutate()},y=T=>{if(!T||!f)return;const F=f.find(P=>P.identifier.toLowerCase()===T.toLowerCase());if(F)return{id:F.id,identifier:F.identifier,title:F.title}},_=(c==null?void 0:c.some(T=>T.isRunning))||!1,w=(d==null?void 0:d.running)||!1,C=(p||[]).slice(-5).reverse();if(o||u)return a.jsx("div",{className:"bg-surface-raised rounded-lg p-6",children:a.jsx("div",{className:"text-content-subtle",children:"Loading agents..."})});if(l)return a.jsx("div",{className:"bg-surface-raised rounded-lg p-6",children:a.jsxs("div",{className:"text-red-400",children:["Error: ",l.message]})});const S=(i==null?void 0:i.filter(T=>T.status!=="dead"))||[],R=(c==null?void 0:c.filter(T=>T.enabled))||[];return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-divider flex items-center justify-between",children:[a.jsxs("h2",{className:"font-semibold text-content flex items-center gap-2",children:[a.jsx(wa,{className:"w-5 h-5 text-blue-400"}),"Cloister Deacon"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`text-xs px-2 py-1 rounded ${_?"bg-green-900/50 text-green-400":"bg-surface-overlay text-content-subtle"}`,children:_?"● Specialists Active":"○ Specialists Idle"}),w?a.jsxs("button",{onClick:()=>g.mutate(),disabled:g.isPending,className:"flex items-center gap-1 px-2 py-1 text-xs text-red-400 hover:bg-surface-overlay rounded transition-colors disabled:opacity-50",title:"Stop patrol loop",children:[a.jsx(tc,{className:"w-3 h-3"}),"Stop Patrol"]}):a.jsxs("button",{onClick:()=>m.mutate(),disabled:m.isPending,className:"flex items-center gap-1 px-2 py-1 text-xs text-green-400 hover:bg-surface-overlay rounded transition-colors disabled:opacity-50",title:"Start patrol loop (health monitoring)",children:[a.jsx(Rn,{className:"w-3 h-3"}),"Start Patrol"]})]})]}),a.jsx("div",{className:"p-4",children:a.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-content-subtle",children:"Patrol Status:"})," ",a.jsx("span",{className:w?"text-green-400":"text-content-muted",children:w?"● Running":"○ Stopped"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-content-subtle",children:"Last Check:"})," ",a.jsx("span",{className:"text-content-body",children:sA((d==null?void 0:d.lastCheck)||null)})]}),(d==null?void 0:d.summary)&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Di,{className:"w-4 h-4 text-green-400"}),a.jsxs("span",{className:"text-content-body",children:[d.summary.active," active"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[d.summary.stuck>0?a.jsx(so,{className:"w-4 h-4 text-red-400"}):a.jsx(so,{className:"w-4 h-4 text-content-muted"}),a.jsxs("span",{className:d.summary.stuck>0?"text-red-400":"text-content-subtle",children:[d.summary.stuck," stuck"]})]})]})]})})]}),C.length>0&&a.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[a.jsx("div",{className:"px-4 py-3 border-b border-divider",children:a.jsxs("h2",{className:"font-semibold text-content flex items-center gap-2",children:[a.jsx(ba,{className:"w-5 h-5 text-cyan-400"}),"Recent Activity"]})}),a.jsx("div",{className:"divide-y divide-gray-700",children:C.map(T=>a.jsxs("div",{className:"px-4 py-2 flex items-center gap-3 text-sm",children:[a.jsx("span",{className:"text-content-muted text-xs w-16",children:new Date(T.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}),a.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs ${T.type==="spawn"?"bg-green-900/50 text-green-400":T.type==="complete"?"bg-blue-900/50 text-blue-400":T.type==="error"?"bg-red-900/50 text-red-400":T.type==="deacon"?"bg-purple-900/50 text-purple-400":"bg-surface-overlay text-content-body"}`,children:T.type}),a.jsxs("span",{className:"text-content-body truncate flex-1",children:[T.type==="deacon"?T.command:T.source,T.issueId&&T.type!=="deacon"&&a.jsxs("span",{className:"text-cyan-400 ml-1",children:["(",T.issueId,")"]})]})]},T.id))})]}),a.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-divider flex items-center justify-between",children:[a.jsxs("h2",{className:"font-semibold text-content flex items-center gap-2",children:[a.jsx($v,{className:"w-5 h-5 text-purple-400"}),"Specialist Agents (",R.length,")"]}),a.jsxs("button",{onClick:x,disabled:b.isPending,className:"flex items-center gap-1.5 px-2 py-1 text-xs text-content-subtle hover:text-yellow-400 hover:bg-surface-overlay rounded transition-colors disabled:opacity-50",title:"Reset all specialists (kill & clear sessions)",children:[b.isPending?a.jsx(ye,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(Cc,{className:"w-3.5 h-3.5"}),"Reset All"]})]}),a.jsx("div",{className:"divide-y divide-gray-700",children:R.length===0?a.jsx("div",{className:"p-8 text-center text-content-muted",children:"No specialist agents configured."}):R.map(T=>a.jsx(TL,{specialist:T,issueInfo:y(T.currentIssue),onSelect:()=>t(T.tmuxSession===e?null:T.tmuxSession),isSelected:T.tmuxSession===e},T.name))})]}),a.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[a.jsx("div",{className:"px-4 py-3 border-b border-divider",children:a.jsxs("h2",{className:"font-semibold text-content flex items-center gap-2",children:[a.jsx(ck,{className:"w-5 h-5"}),"Issue Agents (",S.length,")"]})}),a.jsx("div",{className:"divide-y divide-gray-700",children:S.length===0?a.jsxs("div",{className:"p-8 text-center text-content-muted",children:["No agents running. Use"," ",a.jsx("code",{className:"bg-surface-overlay px-2 py-1 rounded",children:"/work-issue"})," to spawn one."]}):S.map(T=>{const F=h==null?void 0:h.agents.find(P=>P.agentId===T.id);return a.jsx(QL,{agent:T,health:F,onSelect:()=>t(T.id===e?null:T.id),isSelected:T.id===e},T.id)})})]})]})}async function aA(e){const t=await fetch(`/api/agents/${e}/output`);if(!t.ok)throw new Error("Failed to fetch output");return(await t.json()).output||""}async function lA(e,t){if(!(await fetch(`/api/agents/${e}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:t})})).ok)throw new Error("Failed to send message")}function cA({agentId:e}){const[t,n]=v.useState(""),r=v.useRef(null),{data:s,isLoading:i,refetch:o}=ue({queryKey:["agent-output",e],queryFn:()=>aA(e),refetchInterval:2e3}),l=xe({mutationFn:u=>lA(e,u),onSuccess:()=>{n(""),setTimeout(()=>o(),500)}});v.useEffect(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},[s]);const c=u=>{u.preventDefault(),t.trim()&&l.mutate(t.trim())};return a.jsxs("div",{className:"bg-gray-800 rounded-lg flex flex-col h-[600px]",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-gray-700 flex items-center justify-between",children:[a.jsxs("h2",{className:"font-semibold text-white flex items-center gap-2",children:[a.jsx(ao,{className:"w-5 h-5"}),e]}),a.jsx("button",{onClick:()=>o(),className:"p-2 text-gray-400 hover:text-white hover:bg-gray-700 rounded",title:"Refresh",children:a.jsx(us,{className:"w-4 h-4"})})]}),a.jsx("pre",{ref:r,className:"flex-1 overflow-auto p-4 terminal-output text-gray-300 bg-gray-900",children:i?a.jsx("span",{className:"text-gray-500",children:"Loading..."}):s||a.jsx("span",{className:"text-gray-500",children:"No output yet"})}),a.jsx("form",{onSubmit:c,className:"p-3 border-t border-gray-700",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{type:"text",value:t,onChange:u=>n(u.target.value),placeholder:"Send message to agent...",className:"flex-1 bg-gray-700 border border-gray-600 rounded px-3 py-2 text-white placeholder-gray-400 focus:outline-none focus:border-blue-500"}),a.jsxs("button",{type:"submit",disabled:!t.trim()||l.isPending,className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[a.jsx(pk,{className:"w-4 h-4"}),"Send"]})]})})]})}async function uA(){const e=await fetch("/api/services/tldr/status");if(!e.ok)throw new Error("Failed to fetch TLDR status");return e.json()}function KC(){const{data:e,isLoading:t,error:n}=ue({queryKey:["tldr-status"],queryFn:uA,refetchInterval:1e4});if(t)return a.jsx("div",{className:"bg-surface-raised rounded-lg p-4 border border-divider",children:a.jsxs("div",{className:"flex items-center gap-2 text-content-subtle",children:[a.jsx(ye,{className:"w-4 h-4 animate-spin"}),a.jsx("span",{className:"text-sm",children:"Loading TLDR status..."})]})});if(n)return a.jsx("div",{className:"bg-surface-raised rounded-lg p-4 border border-divider",children:a.jsxs("div",{className:"flex items-center gap-2 text-red-400",children:[a.jsx(bs,{className:"w-4 h-4"}),a.jsx("span",{className:"text-sm",children:"TLDR status unavailable"})]})});if(!e||e.daemons.length===0)return a.jsx("div",{className:"bg-surface-raised rounded-lg p-4 border border-divider",children:a.jsxs("div",{className:"flex items-center gap-2 text-content-subtle",children:[a.jsx(bs,{className:"w-4 h-4"}),a.jsx("span",{className:"text-sm",children:"TLDR not configured"}),a.jsx("span",{className:"text-xs text-content-muted ml-auto",children:"Run pan setup to enable"})]})});const r=e.daemons.find(i=>i.workspace==="main"),s=e.daemons.filter(i=>i.workspace!=="main");return a.jsxs("div",{className:"space-y-3",children:[r&&a.jsx($_,{daemon:r,label:"Main Index"}),s.length>0&&a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:s.map(i=>a.jsx($_,{daemon:i,label:i.workspace},i.workspace))})]})}function $_({daemon:e,label:t}){const n=e.running&&e.healthy;return a.jsx("div",{className:`rounded-lg p-4 border ${n?"bg-green-900/30 border-green-800/30":"bg-surface-raised border-divider"}`,children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[n?a.jsx(Yr,{className:"w-5 h-5 text-green-400"}):a.jsx(bs,{className:"w-5 h-5 text-gray-400"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-content",children:t}),a.jsxs("div",{className:"text-sm text-content-subtle",children:[e.running?"Running":"Stopped",e.running&&e.pid&&` (PID ${e.pid})`]})]})]}),a.jsxs("div",{className:"text-right",children:[e.fileCount!=null&&a.jsxs("div",{className:"flex items-center gap-1 text-sm text-content",children:[a.jsx(km,{className:"w-3.5 h-3.5 text-content-subtle"}),a.jsxs("span",{children:[e.fileCount.toLocaleString()," files",e.edgeCount!=null&&`, ${e.edgeCount.toLocaleString()} edges`]})]}),e.indexAge&&a.jsxs("div",{className:"text-xs text-content-muted",children:["Updated ",e.indexAge]})]})]})})}async function dA(){const e=await fetch("/api/health/agents");if(!e.ok)throw new Error("Failed to fetch health");return e.json()}const H_={healthy:{icon:Yr,color:"text-green-400",bg:"bg-green-900/30"},warning:{icon:tn,color:"text-yellow-400",bg:"bg-yellow-900/30"},stuck:{icon:wa,color:"text-orange-400",bg:"bg-orange-900/30"},dead:{icon:bs,color:"text-red-400",bg:"bg-red-900/30"}};function hA(){const{data:e,isLoading:t,error:n}=ue({queryKey:["health"],queryFn:dA,refetchInterval:5e3});if(t)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("div",{className:"text-content-subtle",children:"Loading health data..."})});if(n)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-red-400",children:["Error: ",n.message]})});if(!e||e.length===0)return a.jsxs("div",{className:"bg-surface-raised rounded-lg p-8 text-center",children:[a.jsx(ba,{className:"w-12 h-12 text-gray-600 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-medium text-content-subtle",children:"No agents to monitor"}),a.jsx("p",{className:"text-sm text-content-muted mt-2",children:"Health data will appear here when agents are running"})]});const r=e.reduce((s,i)=>(s[i.status]=(s[i.status]||0)+1,s),{});return a.jsxs("div",{className:"space-y-6",children:[a.jsx(KC,{}),a.jsx("div",{className:"grid grid-cols-4 gap-4",children:["healthy","warning","stuck","dead"].map(s=>{const i=H_[s],o=i.icon;return a.jsx("div",{className:`${i.bg} rounded-lg p-4 border border-divider`,children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(o,{className:`w-8 h-8 ${i.color}`}),a.jsxs("div",{children:[a.jsx("div",{className:"text-2xl font-bold text-content",children:r[s]||0}),a.jsx("div",{className:"text-sm text-content-subtle capitalize",children:s})]})]})},s)})}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:e.map(s=>{const i=H_[s.status],o=i.icon;return a.jsxs("div",{className:`${i.bg} rounded-lg p-4 border border-divider`,children:[a.jsx("div",{className:"flex items-start justify-between",children:a.jsxs("div",{children:[a.jsx("div",{className:"font-medium text-content",children:s.agentId}),a.jsxs("div",{className:`flex items-center gap-1 text-sm ${i.color} mt-1`,children:[a.jsx(o,{className:"w-4 h-4"}),a.jsx("span",{className:"capitalize",children:s.status})]})]})}),s.reason&&a.jsx("div",{className:"mt-2 text-sm text-content-subtle italic",children:s.reason}),a.jsxs("div",{className:"mt-4 space-y-2 text-sm",children:[s.lastPing&&a.jsxs("div",{className:"flex justify-between text-content-subtle",children:[a.jsx("span",{children:"Last ping:"}),a.jsx("span",{children:new Date(s.lastPing).toLocaleTimeString()})]}),a.jsxs("div",{className:"flex justify-between text-content-subtle",children:[a.jsx("span",{children:"Failures:"}),a.jsx("span",{className:s.consecutiveFailures>0?"text-orange-400":"",children:s.consecutiveFailures})]}),a.jsxs("div",{className:"flex justify-between text-content-subtle",children:[a.jsx("span",{children:"Kill count:"}),a.jsx("span",{className:s.killCount>0?"text-red-400":"",children:s.killCount})]})]})]},s.agentId)})})]})}function fA(){const[e,t]=v.useState([]),[n,r]=v.useState(!0),[s,i]=v.useState(null),o=async()=>{try{r(!0);const u=await fetch("/api/skills");if(!u.ok)throw new Error("Failed to fetch skills");const h=await u.json();t(h),i(null)}catch(u){i(u instanceof Error?u.message:"Unknown error")}finally{r(!1)}};if(v.useEffect(()=>{o()},[]),n)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx(us,{className:"w-6 h-6 text-content-subtle animate-spin"})});if(s)return a.jsxs("div",{className:"bg-red-900/20 border border-red-800 rounded-lg p-4 text-red-400",children:[a.jsx(so,{className:"w-5 h-5 inline mr-2"}),s]});const l=e.filter(u=>u.source==="panopticon"),c=e.filter(u=>u.source==="claude");return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h2",{className:"text-lg font-semibold text-content",children:"Skills"}),a.jsxs("button",{onClick:o,className:"flex items-center gap-2 px-3 py-1.5 text-sm text-content-subtle hover:text-content hover:bg-surface-overlay rounded-lg transition-colors",children:[a.jsx(us,{className:"w-4 h-4"}),"Refresh"]})]}),e.length===0?a.jsxs("div",{className:"bg-surface-raised rounded-lg p-8 text-center text-content-subtle",children:[a.jsx(Cm,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),a.jsx("p",{children:"No skills found"}),a.jsx("p",{className:"text-sm mt-2",children:"Add skills to ~/.panopticon/skills/ or ~/.claude/skills/"})]}):a.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[a.jsxs("div",{className:"bg-surface-raised rounded-lg p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500"}),a.jsxs("h3",{className:"font-medium text-content",children:["Panopticon (",l.length,")"]})]}),a.jsxs("div",{className:"space-y-2",children:[l.map(u=>a.jsx(W_,{skill:u},u.path)),l.length===0&&a.jsx("p",{className:"text-content-muted text-sm",children:"No Panopticon skills"})]})]}),a.jsxs("div",{className:"bg-surface-raised rounded-lg p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx("div",{className:"w-2 h-2 rounded-full bg-purple-500"}),a.jsxs("h3",{className:"font-medium text-content",children:["Claude (",c.length,")"]})]}),a.jsxs("div",{className:"space-y-2",children:[c.map(u=>a.jsx(W_,{skill:u},u.path)),c.length===0&&a.jsx("p",{className:"text-content-muted text-sm",children:"No Claude skills"})]})]})]}),a.jsxs("div",{className:"bg-surface-raised rounded-lg p-4",children:[a.jsx("h3",{className:"font-medium text-content mb-2",children:"Skill Locations"}),a.jsxs("div",{className:"text-sm text-content-subtle space-y-1",children:[a.jsxs("p",{children:[a.jsx("span",{className:"text-blue-400",children:"Panopticon:"})," ","~/.panopticon/skills/"]}),a.jsxs("p",{children:[a.jsx("span",{className:"text-purple-400",children:"Claude:"})," ~/.claude/skills/"]})]})]})]})}function W_({skill:e}){return a.jsxs("div",{className:"bg-surface-overlay/50 rounded-lg p-3 hover:bg-surface-overlay transition-colors",children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ik,{className:"w-4 h-4 text-content-subtle"}),a.jsx("span",{className:"font-medium text-content",children:e.name})]}),e.hasSkillMd?a.jsxs("span",{className:"flex items-center gap-1 text-xs text-green-400",children:[a.jsx(El,{className:"w-3 h-3"}),"SKILL.md"]}):a.jsxs("span",{className:"flex items-center gap-1 text-xs text-yellow-400",children:[a.jsx(so,{className:"w-3 h-3"}),"No SKILL.md"]})]}),e.description&&a.jsx("p",{className:"mt-2 text-sm text-content-subtle line-clamp-2",children:e.description}),a.jsx("p",{className:"mt-2 text-xs text-content-muted truncate",children:e.path})]})}function pA(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const mA=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gA=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,vA={};function U_(e,t){return(vA.jsx?gA:mA).test(e)}const xA=/[ \t\n\f\r]/g;function yA(e){return typeof e=="object"?e.type==="text"?q_(e.value):!1:q_(e)}function q_(e){return e.replace(xA,"")===""}class Lc{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Lc.prototype.normal={};Lc.prototype.property={};Lc.prototype.space=void 0;function VC(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Lc(n,r,t)}function mg(e){return e.toLowerCase()}class Mn{constructor(t,n){this.attribute=n,this.property=t}}Mn.prototype.attribute="";Mn.prototype.booleanish=!1;Mn.prototype.boolean=!1;Mn.prototype.commaOrSpaceSeparated=!1;Mn.prototype.commaSeparated=!1;Mn.prototype.defined=!1;Mn.prototype.mustUseProperty=!1;Mn.prototype.number=!1;Mn.prototype.overloadedBoolean=!1;Mn.prototype.property="";Mn.prototype.spaceSeparated=!1;Mn.prototype.space=void 0;let _A=0;const _e=yo(),dt=yo(),gg=yo(),J=yo(),ze=yo(),ea=yo(),zn=yo();function yo(){return 2**++_A}const vg=Object.freeze(Object.defineProperty({__proto__:null,boolean:_e,booleanish:dt,commaOrSpaceSeparated:zn,commaSeparated:ea,number:J,overloadedBoolean:gg,spaceSeparated:ze},Symbol.toStringTag,{value:"Module"})),Ff=Object.keys(vg);class vx extends Mn{constructor(t,n,r,s){let i=-1;if(super(t,n),K_(this,"space",s),typeof r=="number")for(;++i<Ff.length;){const o=Ff[i];K_(this,Ff[i],(r&vg[o])===vg[o])}}}vx.prototype.defined=!0;function K_(e,t,n){n&&(e[t]=n)}function Oa(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new vx(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[mg(r)]=r,n[mg(i.attribute)]=r}return new Lc(t,n,e.space)}const YC=Oa({properties:{ariaActiveDescendant:null,ariaAtomic:dt,ariaAutoComplete:null,ariaBusy:dt,ariaChecked:dt,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:ze,ariaCurrent:null,ariaDescribedBy:ze,ariaDetails:null,ariaDisabled:dt,ariaDropEffect:ze,ariaErrorMessage:null,ariaExpanded:dt,ariaFlowTo:ze,ariaGrabbed:dt,ariaHasPopup:null,ariaHidden:dt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ze,ariaLevel:J,ariaLive:null,ariaModal:dt,ariaMultiLine:dt,ariaMultiSelectable:dt,ariaOrientation:null,ariaOwns:ze,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:dt,ariaReadOnly:dt,ariaRelevant:null,ariaRequired:dt,ariaRoleDescription:ze,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:dt,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function QC(e,t){return t in e?e[t]:t}function XC(e,t){return QC(e,t.toLowerCase())}const bA=Oa({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ea,acceptCharset:ze,accessKey:ze,action:null,allow:null,allowFullScreen:_e,allowPaymentRequest:_e,allowUserMedia:_e,alt:null,as:null,async:_e,autoCapitalize:null,autoComplete:ze,autoFocus:_e,autoPlay:_e,blocking:ze,capture:null,charSet:null,checked:_e,cite:null,className:ze,cols:J,colSpan:null,content:null,contentEditable:dt,controls:_e,controlsList:ze,coords:J|ea,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_e,defer:_e,dir:null,dirName:null,disabled:_e,download:gg,draggable:dt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_e,formTarget:null,headers:ze,height:J,hidden:gg,high:J,href:null,hrefLang:null,htmlFor:ze,httpEquiv:ze,id:null,imageSizes:null,imageSrcSet:null,inert:_e,inputMode:null,integrity:null,is:null,isMap:_e,itemId:null,itemProp:ze,itemRef:ze,itemScope:_e,itemType:ze,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_e,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:_e,muted:_e,name:null,nonce:null,noModule:_e,noValidate:_e,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:_e,optimum:J,pattern:null,ping:ze,placeholder:null,playsInline:_e,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_e,referrerPolicy:null,rel:ze,required:_e,reversed:_e,rows:J,rowSpan:J,sandbox:ze,scope:null,scoped:_e,seamless:_e,selected:_e,shadowRootClonable:_e,shadowRootDelegatesFocus:_e,shadowRootMode:null,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:dt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:_e,useMap:null,value:dt,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ze,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:_e,declare:_e,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:_e,noHref:_e,noShade:_e,noWrap:_e,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:dt,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:_e,disableRemotePlayback:_e,prefix:null,property:null,results:J,security:null,unselectable:null},space:"html",transform:XC}),wA=Oa({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:zn,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:ze,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:_e,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ea,g2:ea,glyphName:ea,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:zn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:J,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ze,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:zn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:zn,rev:zn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:zn,requiredFeatures:zn,requiredFonts:zn,requiredFormats:zn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:zn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:zn,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:zn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:QC}),GC=Oa({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),JC=Oa({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:XC}),ZC=Oa({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),SA={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},kA=/[A-Z]/g,V_=/-[a-z]/g,CA=/^data[-\w.:]+$/i;function NA(e,t){const n=mg(t);let r=t,s=Mn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&CA.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(V_,EA);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!V_.test(i)){let o=i.replace(kA,jA);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=vx}return new s(r,t)}function jA(e){return"-"+e.toLowerCase()}function EA(e){return e.charAt(1).toUpperCase()}const RA=VC([YC,bA,GC,JC,ZC],"html"),xx=VC([YC,wA,GC,JC,ZC],"svg");function TA(e){return e.join(" ").trim()}var yx={},Y_=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,PA=/\n/g,DA=/^\s*/,MA=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,LA=/^:\s*/,AA=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,OA=/^[;\s]*/,IA=/^\s+|\s+$/g,BA=`
533
- `,Q_="/",X_="*",Mi="",FA="comment",zA="declaration";function $A(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(m){var g=m.match(PA);g&&(n+=g.length);var b=m.lastIndexOf(BA);r=~b?m.length-b:r+m.length}function i(){var m={line:n,column:r};return function(g){return g.position=new o(m),u(),g}}function o(m){this.start=m,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function l(m){var g=new Error(t.source+":"+n+":"+r+": "+m);if(g.reason=m,g.filename=t.source,g.line=n,g.column=r,g.source=e,!t.silent)throw g}function c(m){var g=m.exec(e);if(g){var b=g[0];return s(b),e=e.slice(b.length),g}}function u(){c(DA)}function h(m){var g;for(m=m||[];g=d();)g!==!1&&m.push(g);return m}function d(){var m=i();if(!(Q_!=e.charAt(0)||X_!=e.charAt(1))){for(var g=2;Mi!=e.charAt(g)&&(X_!=e.charAt(g)||Q_!=e.charAt(g+1));)++g;if(g+=2,Mi===e.charAt(g-1))return l("End of comment missing");var b=e.slice(2,g-2);return r+=2,s(b),e=e.slice(g),r+=2,m({type:FA,comment:b})}}function p(){var m=i(),g=c(MA);if(g){if(d(),!c(LA))return l("property missing ':'");var b=c(AA),x=m({type:zA,property:G_(g[0].replace(Y_,Mi)),value:b?G_(b[0].replace(Y_,Mi)):Mi});return c(OA),x}}function f(){var m=[];h(m);for(var g;g=p();)g!==!1&&(m.push(g),h(m));return m}return u(),f()}function G_(e){return e?e.replace(IA,Mi):Mi}var HA=$A,WA=ad&&ad.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yx,"__esModule",{value:!0});yx.default=qA;const UA=WA(HA);function qA(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,UA.default)(e),s=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:l}=i;s?t(o,l,i):l&&(n=n||{},n[o]=l)}),n}var Rh={};Object.defineProperty(Rh,"__esModule",{value:!0});Rh.camelCase=void 0;var KA=/^--[a-zA-Z0-9_-]+$/,VA=/-([a-z])/g,YA=/^[^-]+$/,QA=/^-(webkit|moz|ms|o|khtml)-/,XA=/^-(ms)-/,GA=function(e){return!e||YA.test(e)||KA.test(e)},JA=function(e,t){return t.toUpperCase()},J_=function(e,t){return"".concat(t,"-")},ZA=function(e,t){return t===void 0&&(t={}),GA(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(XA,J_):e=e.replace(QA,J_),e.replace(VA,JA))};Rh.camelCase=ZA;var eO=ad&&ad.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},tO=eO(yx),nO=Rh;function xg(e,t){var n={};return!e||typeof e!="string"||(0,tO.default)(e,function(r,s){r&&s&&(n[(0,nO.camelCase)(r,t)]=s)}),n}xg.default=xg;var rO=xg;const sO=Na(rO),e2=t2("end"),_x=t2("start");function t2(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function iO(e){const t=_x(e),n=e2(e);if(t&&n)return{start:t,end:n}}function Ml(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Z_(e.position):"start"in e||"end"in e?Z_(e):"line"in e||"column"in e?yg(e):""}function yg(e){return eb(e&&e.line)+":"+eb(e&&e.column)}function Z_(e){return yg(e&&e.start)+"-"+yg(e&&e.end)}function eb(e){return e&&typeof e=="number"?e:1}class sn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(o=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=Ml(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}sn.prototype.file="";sn.prototype.name="";sn.prototype.reason="";sn.prototype.message="";sn.prototype.stack="";sn.prototype.column=void 0;sn.prototype.line=void 0;sn.prototype.ancestors=void 0;sn.prototype.cause=void 0;sn.prototype.fatal=void 0;sn.prototype.place=void 0;sn.prototype.ruleId=void 0;sn.prototype.source=void 0;const bx={}.hasOwnProperty,oO=new Map,aO=/[A-Z]/g,lO=new Set(["table","tbody","thead","tfoot","tr"]),cO=new Set(["td","th"]),n2="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function uO(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=xO(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=vO(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?xx:RA,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=r2(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function r2(e,t,n){if(t.type==="element")return dO(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return hO(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return pO(e,t,n);if(t.type==="mdxjsEsm")return fO(e,t);if(t.type==="root")return mO(e,t,n);if(t.type==="text")return gO(e,t)}function dO(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=xx,e.schema=s),e.ancestors.push(t);const i=i2(e,t.tagName,!1),o=yO(e,t);let l=Sx(e,t);return lO.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!yA(c):!0})),s2(e,o,i,t),wx(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function hO(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}cc(e,t.position)}function fO(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);cc(e,t.position)}function pO(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=xx,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:i2(e,t.name,!0),o=_O(e,t),l=Sx(e,t);return s2(e,o,i,t),wx(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function mO(e,t,n){const r={};return wx(r,Sx(e,t)),e.create(t,e.Fragment,r,n)}function gO(e,t){return t.value}function s2(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function wx(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function vO(e,t,n){return r;function r(s,i,o,l){const u=Array.isArray(o.children)?n:t;return l?u(i,o,l):u(i,o)}}function xO(e,t){return n;function n(r,s,i,o){const l=Array.isArray(i.children),c=_x(r);return t(s,i,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function yO(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&bx.call(t.properties,s)){const i=bO(e,s,t.properties[s]);if(i){const[o,l]=i;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&cO.has(t.tagName)?r=l:n[o]=l}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function _O(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else cc(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else cc(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function Sx(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:oO;for(;++r<t.children.length;){const i=t.children[r];let o;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const u=s.get(c)||0;o=c+"-"+u,s.set(c,u+1)}}const l=r2(e,i,o);l!==void 0&&n.push(l)}return n}function bO(e,t,n){const r=NA(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?pA(n):TA(n)),r.property==="style"){let s=typeof n=="object"?n:wO(e,String(n));return e.stylePropertyNameCase==="css"&&(s=SO(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?SA[r.property]||r.property:r.attribute,n]}}function wO(e,t){try{return sO(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new sn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=n2+"#cannot-parse-style-attribute",s}}function i2(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,o;for(;++i<s.length;){const l=U_(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=o}else r=U_(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return bx.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);cc(e)}function cc(e,t){const n=new sn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=n2+"#cannot-handle-mdx-estrees-without-createevaluater",n}function SO(e){const t={};let n;for(n in e)bx.call(e,n)&&(t[kO(n)]=e[n]);return t}function kO(e){let t=e.replace(aO,CO);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function CO(e){return"-"+e.toLowerCase()}const zf={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},NO={};function kx(e,t){const n=NO,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return o2(e,r,s)}function o2(e,t,n){if(jO(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return tb(e.children,t,n)}return Array.isArray(e)?tb(e,t,n):""}function tb(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=o2(e[s],t,n);return r.join("")}function jO(e){return!!(e&&typeof e=="object")}const nb=document.createElement("i");function Cx(e){const t="&"+e+";";nb.innerHTML=t;const n=nb.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function qn(e,t,n,r){const s=e.length;let i=0,o;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function sr(e,t){return e.length>0?(qn(e,e.length,0,t),e):t}const rb={}.hasOwnProperty;function a2(e){const t={};let n=-1;for(;++n<e.length;)EO(t,e[n]);return t}function EO(e,t){let n;for(n in t){const s=(rb.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){rb.call(s,o)||(s[o]=[]);const l=i[o];RO(s[o],Array.isArray(l)?l:l?[l]:[])}}}function RO(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);qn(e,0,0,r)}function l2(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Cr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const hn=ki(/[A-Za-z]/),en=ki(/[\dA-Za-z]/),TO=ki(/[#-'*+\--9=?A-Z^-~]/);function Kd(e){return e!==null&&(e<32||e===127)}const _g=ki(/\d/),PO=ki(/[\dA-Fa-f]/),DO=ki(/[!-/:-@[-`{-~]/);function me(e){return e!==null&&e<-2}function Fe(e){return e!==null&&(e<0||e===32)}function Ne(e){return e===-2||e===-1||e===32}const Th=ki(new RegExp("\\p{P}|\\p{S}","u")),uo=ki(/\s/);function ki(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ia(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&en(e.charCodeAt(n+1))&&en(e.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),s=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function Pe(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return Ne(c)?(e.enter(n),l(c)):t(c)}function l(c){return Ne(c)&&i++<s?(e.consume(c),l):(e.exit(n),t(c))}}const MO={tokenize:LO};function LO(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Pe(e,t,"linePrefix")}function s(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return me(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),o)}}const AO={tokenize:OO},sb={tokenize:IO};function OO(e){const t=this,n=[];let r=0,s,i,o;return l;function l(_){if(r<n.length){const w=n[r];return t.containerState=w[1],e.attempt(w[0].continuation,c,u)(_)}return u(_)}function c(_){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&y();const w=t.events.length;let C=w,S;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){S=t.events[C][1].end;break}x(r);let R=w;for(;R<t.events.length;)t.events[R][1].end={...S},R++;return qn(t.events,C+1,0,t.events.slice(w)),t.events.length=R,u(_)}return l(_)}function u(_){if(r===n.length){if(!s)return p(_);if(s.currentConstruct&&s.currentConstruct.concrete)return m(_);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(sb,h,d)(_)}function h(_){return s&&y(),x(r),p(_)}function d(_){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(_)}function p(_){return t.containerState={},e.attempt(sb,f,m)(_)}function f(_){return r++,n.push([t.currentConstruct,t.containerState]),p(_)}function m(_){if(_===null){s&&y(),x(0),e.consume(_);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),g(_)}function g(_){if(_===null){b(e.exit("chunkFlow"),!0),x(0),e.consume(_);return}return me(_)?(e.consume(_),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(_),g)}function b(_,w){const C=t.sliceStream(_);if(w&&C.push(null),_.previous=i,i&&(i.next=_),i=_,s.defineSkip(_.start),s.write(C),t.parser.lazy[_.start.line]){let S=s.events.length;for(;S--;)if(s.events[S][1].start.offset<o&&(!s.events[S][1].end||s.events[S][1].end.offset>o))return;const R=t.events.length;let T=R,F,P;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(F){P=t.events[T][1].end;break}F=!0}for(x(r),S=R;S<t.events.length;)t.events[S][1].end={...P},S++;qn(t.events,T+1,0,t.events.slice(R)),t.events.length=S}}function x(_){let w=n.length;for(;w-- >_;){const C=n[w];t.containerState=C[1],C[0].exit.call(t,e)}n.length=_}function y(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function IO(e,t,n){return Pe(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ka(e){if(e===null||Fe(e)||uo(e))return 1;if(Th(e))return 2}function Ph(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const i=e[s].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const bg={name:"attention",resolveAll:BO,tokenize:FO};function BO(e,t){let n=-1,r,s,i,o,l,c,u,h;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},p={...e[n][1].start};ib(d,-c),ib(p,c),o={type:c>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=sr(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=sr(u,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=sr(u,Ph(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=sr(u,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,u=sr(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,qn(e,r-1,n-r+3,u),n=r+u.length-h-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function FO(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=ka(r);let i;return o;function o(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const u=e.exit("attentionSequence"),h=ka(c),d=!h||h===2&&s||n.includes(c),p=!s||s===2&&h||n.includes(r);return u._open=!!(i===42?d:d&&(s||!p)),u._close=!!(i===42?p:p&&(h||!d)),t(c)}}function ib(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const zO={name:"autolink",tokenize:$O};function $O(e,t,n){let r=0;return s;function s(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(f){return hn(f)?(e.consume(f),o):f===64?n(f):u(f)}function o(f){return f===43||f===45||f===46||en(f)?(r=1,l(f)):u(f)}function l(f){return f===58?(e.consume(f),r=0,c):(f===43||f===45||f===46||en(f))&&r++<32?(e.consume(f),l):(r=0,u(f))}function c(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||Kd(f)?n(f):(e.consume(f),c)}function u(f){return f===64?(e.consume(f),h):TO(f)?(e.consume(f),u):n(f)}function h(f){return en(f)?d(f):n(f)}function d(f){return f===46?(e.consume(f),r=0,h):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):p(f)}function p(f){if((f===45||en(f))&&r++<63){const m=f===45?p:d;return e.consume(f),m}return n(f)}}const Ac={partial:!0,tokenize:HO};function HO(e,t,n){return r;function r(i){return Ne(i)?Pe(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||me(i)?t(i):n(i)}}const c2={continuation:{tokenize:UO},exit:qO,name:"blockQuote",tokenize:WO};function WO(e,t,n){const r=this;return s;function s(o){if(o===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return Ne(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function UO(e,t,n){const r=this;return s;function s(o){return Ne(o)?Pe(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(c2,t,n)(o)}}function qO(e){e.exit("blockQuote")}const u2={name:"characterEscape",tokenize:KO};function KO(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s}function s(i){return DO(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const d2={name:"characterReference",tokenize:VO};function VO(e,t,n){const r=this;let s=0,i,o;return l;function l(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),c}function c(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=en,h(d))}function u(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=PO,h):(e.enter("characterReferenceValue"),i=7,o=_g,h(d))}function h(d){if(d===59&&s){const p=e.exit("characterReferenceValue");return o===en&&!Cx(r.sliceSerialize(p))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(d)&&s++<i?(e.consume(d),h):n(d)}}const ob={partial:!0,tokenize:QO},ab={concrete:!0,name:"codeFenced",tokenize:YO};function YO(e,t,n){const r=this,s={partial:!0,tokenize:C};let i=0,o=0,l;return c;function c(S){return u(S)}function u(S){const R=r.events[r.events.length-1];return i=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,l=S,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(S)}function h(S){return S===l?(o++,e.consume(S),h):o<3?n(S):(e.exit("codeFencedFenceSequence"),Ne(S)?Pe(e,d,"whitespace")(S):d(S))}function d(S){return S===null||me(S)?(e.exit("codeFencedFence"),r.interrupt?t(S):e.check(ob,g,w)(S)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(S))}function p(S){return S===null||me(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(S)):Ne(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Pe(e,f,"whitespace")(S)):S===96&&S===l?n(S):(e.consume(S),p)}function f(S){return S===null||me(S)?d(S):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(S))}function m(S){return S===null||me(S)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(S)):S===96&&S===l?n(S):(e.consume(S),m)}function g(S){return e.attempt(s,w,b)(S)}function b(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),x}function x(S){return i>0&&Ne(S)?Pe(e,y,"linePrefix",i+1)(S):y(S)}function y(S){return S===null||me(S)?e.check(ob,g,w)(S):(e.enter("codeFlowValue"),_(S))}function _(S){return S===null||me(S)?(e.exit("codeFlowValue"),y(S)):(e.consume(S),_)}function w(S){return e.exit("codeFenced"),t(S)}function C(S,R,T){let F=0;return P;function P(E){return S.enter("lineEnding"),S.consume(E),S.exit("lineEnding"),I}function I(E){return S.enter("codeFencedFence"),Ne(E)?Pe(S,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):A(E)}function A(E){return E===l?(S.enter("codeFencedFenceSequence"),M(E)):T(E)}function M(E){return E===l?(F++,S.consume(E),M):F>=o?(S.exit("codeFencedFenceSequence"),Ne(E)?Pe(S,j,"whitespace")(E):j(E)):T(E)}function j(E){return E===null||me(E)?(S.exit("codeFencedFence"),R(E)):T(E)}}}function QO(e,t,n){const r=this;return s;function s(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const $f={name:"codeIndented",tokenize:GO},XO={partial:!0,tokenize:JO};function GO(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),Pe(e,i,"linePrefix",5)(u)}function i(u){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?c(u):me(u)?e.attempt(XO,o,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||me(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function JO(e,t,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):me(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):Pe(e,i,"linePrefix",5)(o)}function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):me(o)?s(o):n(o)}}const ZO={name:"codeText",previous:tI,resolve:eI,tokenize:nI};function eI(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function tI(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function nI(e,t,n){let r=0,s,i;return o;function o(d){return e.enter("codeText"),e.enter("codeTextSequence"),l(d)}function l(d){return d===96?(e.consume(d),r++,l):(e.exit("codeTextSequence"),c(d))}function c(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),c):d===96?(i=e.enter("codeTextSequence"),s=0,h(d)):me(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(d))}function u(d){return d===null||d===32||d===96||me(d)?(e.exit("codeTextData"),c(d)):(e.consume(d),u)}function h(d){return d===96?(e.consume(d),s++,h):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(i.type="codeTextData",u(d))}}class rI{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&rl(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),rl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),rl(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);rl(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);rl(this.left,n.reverse())}}}function rl(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function h2(e){const t={};let n=-1,r,s,i,o,l,c,u;const h=new rI(e);for(;++n<h.length;){for(;n in t;)n=t[n];if(r=h.get(n),n&&r[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,sI(h,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(o=h.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(h.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(r[1].end={...h.get(s)[1].start},l=h.slice(s,n),l.unshift(r),h.splice(s,n-s+1,l))}}return qn(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!u}function sI(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,c=[],u={};let h,d,p=-1,f=n,m=0,g=0;const b=[g];for(;f;){for(;e.get(++s)[1]!==f;);i.push(s),f._tokenizer||(h=r.sliceStream(f),f.next||h.push(null),d&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(h),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=f,f=f.next}for(f=n;++p<l.length;)l[p][0]==="exit"&&l[p-1][0]==="enter"&&l[p][1].type===l[p-1][1].type&&l[p][1].start.line!==l[p][1].end.line&&(g=p+1,b.push(g),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):b.pop(),p=b.length;p--;){const x=l.slice(b[p],b[p+1]),y=i.pop();c.push([y,y+x.length-1]),e.splice(y,2,x)}for(c.reverse(),p=-1;++p<c.length;)u[m+c[p][0]]=m+c[p][1],m+=c[p][1]-c[p][0]-1;return u}const iI={resolve:aI,tokenize:lI},oI={partial:!0,tokenize:cI};function aI(e){return h2(e),e}function lI(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?i(l):me(l)?e.check(oI,o,i)(l):(e.consume(l),s)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function cI(e,t,n){const r=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Pe(e,i,"linePrefix")}function i(o){if(o===null||me(o))return n(o);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function f2(e,t,n,r,s,i,o,l,c){const u=c||Number.POSITIVE_INFINITY;let h=0;return d;function d(x){return x===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(x),e.exit(i),p):x===null||x===32||x===41||Kd(x)?n(x):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),g(x))}function p(x){return x===62?(e.enter(i),e.consume(x),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),f(x))}function f(x){return x===62?(e.exit("chunkString"),e.exit(l),p(x)):x===null||x===60||me(x)?n(x):(e.consume(x),x===92?m:f)}function m(x){return x===60||x===62||x===92?(e.consume(x),f):f(x)}function g(x){return!h&&(x===null||x===41||Fe(x))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(x)):h<u&&x===40?(e.consume(x),h++,g):x===41?(e.consume(x),h--,g):x===null||x===32||x===40||Kd(x)?n(x):(e.consume(x),x===92?b:g)}function b(x){return x===40||x===41||x===92?(e.consume(x),g):g(x)}}function p2(e,t,n,r,s,i){const o=this;let l=0,c;return u;function u(f){return e.enter(r),e.enter(s),e.consume(f),e.exit(s),e.enter(i),h}function h(f){return l>999||f===null||f===91||f===93&&!c||f===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(f):f===93?(e.exit(i),e.enter(s),e.consume(f),e.exit(s),e.exit(r),t):me(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||me(f)||l++>999?(e.exit("chunkString"),h(f)):(e.consume(f),c||(c=!Ne(f)),f===92?p:d)}function p(f){return f===91||f===92||f===93?(e.consume(f),l++,d):d(f)}}function m2(e,t,n,r,s,i){let o;return l;function l(p){return p===34||p===39||p===40?(e.enter(r),e.enter(s),e.consume(p),e.exit(s),o=p===40?41:p,c):n(p)}function c(p){return p===o?(e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):(e.enter(i),u(p))}function u(p){return p===o?(e.exit(i),c(o)):p===null?n(p):me(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Pe(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===o||p===null||me(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?d:h)}function d(p){return p===o||p===92?(e.consume(p),h):h(p)}}function Ll(e,t){let n;return r;function r(s){return me(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Ne(s)?Pe(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const uI={name:"definition",tokenize:hI},dI={partial:!0,tokenize:fI};function hI(e,t,n){const r=this;let s;return i;function i(f){return e.enter("definition"),o(f)}function o(f){return p2.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function l(f){return s=Cr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),c):n(f)}function c(f){return Fe(f)?Ll(e,u)(f):u(f)}function u(f){return f2(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function h(f){return e.attempt(dI,d,d)(f)}function d(f){return Ne(f)?Pe(e,p,"whitespace")(f):p(f)}function p(f){return f===null||me(f)?(e.exit("definition"),r.parser.defined.push(s),t(f)):n(f)}}function fI(e,t,n){return r;function r(l){return Fe(l)?Ll(e,s)(l):n(l)}function s(l){return m2(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Ne(l)?Pe(e,o,"whitespace")(l):o(l)}function o(l){return l===null||me(l)?t(l):n(l)}}const pI={name:"hardBreakEscape",tokenize:mI};function mI(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return me(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const gI={name:"headingAtx",resolve:vI,tokenize:xI};function vI(e,t){let n=e.length-2,r=3,s,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},qn(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function xI(e,t,n){let r=0;return s;function s(h){return e.enter("atxHeading"),i(h)}function i(h){return e.enter("atxHeadingSequence"),o(h)}function o(h){return h===35&&r++<6?(e.consume(h),o):h===null||Fe(h)?(e.exit("atxHeadingSequence"),l(h)):n(h)}function l(h){return h===35?(e.enter("atxHeadingSequence"),c(h)):h===null||me(h)?(e.exit("atxHeading"),t(h)):Ne(h)?Pe(e,l,"whitespace")(h):(e.enter("atxHeadingText"),u(h))}function c(h){return h===35?(e.consume(h),c):(e.exit("atxHeadingSequence"),l(h))}function u(h){return h===null||h===35||Fe(h)?(e.exit("atxHeadingText"),l(h)):(e.consume(h),u)}}const yI=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],lb=["pre","script","style","textarea"],_I={concrete:!0,name:"htmlFlow",resolveTo:SI,tokenize:kI},bI={partial:!0,tokenize:NI},wI={partial:!0,tokenize:CI};function SI(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function kI(e,t,n){const r=this;let s,i,o,l,c;return u;function u(k){return h(k)}function h(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),d}function d(k){return k===33?(e.consume(k),p):k===47?(e.consume(k),i=!0,g):k===63?(e.consume(k),s=3,r.interrupt?t:N):hn(k)?(e.consume(k),o=String.fromCharCode(k),b):n(k)}function p(k){return k===45?(e.consume(k),s=2,f):k===91?(e.consume(k),s=5,l=0,m):hn(k)?(e.consume(k),s=4,r.interrupt?t:N):n(k)}function f(k){return k===45?(e.consume(k),r.interrupt?t:N):n(k)}function m(k){const W="CDATA[";return k===W.charCodeAt(l++)?(e.consume(k),l===W.length?r.interrupt?t:A:m):n(k)}function g(k){return hn(k)?(e.consume(k),o=String.fromCharCode(k),b):n(k)}function b(k){if(k===null||k===47||k===62||Fe(k)){const W=k===47,Q=o.toLowerCase();return!W&&!i&&lb.includes(Q)?(s=1,r.interrupt?t(k):A(k)):yI.includes(o.toLowerCase())?(s=6,W?(e.consume(k),x):r.interrupt?t(k):A(k)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(k):i?y(k):_(k))}return k===45||en(k)?(e.consume(k),o+=String.fromCharCode(k),b):n(k)}function x(k){return k===62?(e.consume(k),r.interrupt?t:A):n(k)}function y(k){return Ne(k)?(e.consume(k),y):P(k)}function _(k){return k===47?(e.consume(k),P):k===58||k===95||hn(k)?(e.consume(k),w):Ne(k)?(e.consume(k),_):P(k)}function w(k){return k===45||k===46||k===58||k===95||en(k)?(e.consume(k),w):C(k)}function C(k){return k===61?(e.consume(k),S):Ne(k)?(e.consume(k),C):_(k)}function S(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),c=k,R):Ne(k)?(e.consume(k),S):T(k)}function R(k){return k===c?(e.consume(k),c=null,F):k===null||me(k)?n(k):(e.consume(k),R)}function T(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||Fe(k)?C(k):(e.consume(k),T)}function F(k){return k===47||k===62||Ne(k)?_(k):n(k)}function P(k){return k===62?(e.consume(k),I):n(k)}function I(k){return k===null||me(k)?A(k):Ne(k)?(e.consume(k),I):n(k)}function A(k){return k===45&&s===2?(e.consume(k),$):k===60&&s===1?(e.consume(k),q):k===62&&s===4?(e.consume(k),B):k===63&&s===3?(e.consume(k),N):k===93&&s===5?(e.consume(k),H):me(k)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(bI,O,M)(k)):k===null||me(k)?(e.exit("htmlFlowData"),M(k)):(e.consume(k),A)}function M(k){return e.check(wI,j,O)(k)}function j(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),E}function E(k){return k===null||me(k)?M(k):(e.enter("htmlFlowData"),A(k))}function $(k){return k===45?(e.consume(k),N):A(k)}function q(k){return k===47?(e.consume(k),o="",D):A(k)}function D(k){if(k===62){const W=o.toLowerCase();return lb.includes(W)?(e.consume(k),B):A(k)}return hn(k)&&o.length<8?(e.consume(k),o+=String.fromCharCode(k),D):A(k)}function H(k){return k===93?(e.consume(k),N):A(k)}function N(k){return k===62?(e.consume(k),B):k===45&&s===2?(e.consume(k),N):A(k)}function B(k){return k===null||me(k)?(e.exit("htmlFlowData"),O(k)):(e.consume(k),B)}function O(k){return e.exit("htmlFlow"),t(k)}}function CI(e,t,n){const r=this;return s;function s(o){return me(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function NI(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Ac,t,n)}}const jI={name:"htmlText",tokenize:EI};function EI(e,t,n){const r=this;let s,i,o;return l;function l(N){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(N),c}function c(N){return N===33?(e.consume(N),u):N===47?(e.consume(N),C):N===63?(e.consume(N),_):hn(N)?(e.consume(N),T):n(N)}function u(N){return N===45?(e.consume(N),h):N===91?(e.consume(N),i=0,m):hn(N)?(e.consume(N),y):n(N)}function h(N){return N===45?(e.consume(N),f):n(N)}function d(N){return N===null?n(N):N===45?(e.consume(N),p):me(N)?(o=d,q(N)):(e.consume(N),d)}function p(N){return N===45?(e.consume(N),f):d(N)}function f(N){return N===62?$(N):N===45?p(N):d(N)}function m(N){const B="CDATA[";return N===B.charCodeAt(i++)?(e.consume(N),i===B.length?g:m):n(N)}function g(N){return N===null?n(N):N===93?(e.consume(N),b):me(N)?(o=g,q(N)):(e.consume(N),g)}function b(N){return N===93?(e.consume(N),x):g(N)}function x(N){return N===62?$(N):N===93?(e.consume(N),x):g(N)}function y(N){return N===null||N===62?$(N):me(N)?(o=y,q(N)):(e.consume(N),y)}function _(N){return N===null?n(N):N===63?(e.consume(N),w):me(N)?(o=_,q(N)):(e.consume(N),_)}function w(N){return N===62?$(N):_(N)}function C(N){return hn(N)?(e.consume(N),S):n(N)}function S(N){return N===45||en(N)?(e.consume(N),S):R(N)}function R(N){return me(N)?(o=R,q(N)):Ne(N)?(e.consume(N),R):$(N)}function T(N){return N===45||en(N)?(e.consume(N),T):N===47||N===62||Fe(N)?F(N):n(N)}function F(N){return N===47?(e.consume(N),$):N===58||N===95||hn(N)?(e.consume(N),P):me(N)?(o=F,q(N)):Ne(N)?(e.consume(N),F):$(N)}function P(N){return N===45||N===46||N===58||N===95||en(N)?(e.consume(N),P):I(N)}function I(N){return N===61?(e.consume(N),A):me(N)?(o=I,q(N)):Ne(N)?(e.consume(N),I):F(N)}function A(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),s=N,M):me(N)?(o=A,q(N)):Ne(N)?(e.consume(N),A):(e.consume(N),j)}function M(N){return N===s?(e.consume(N),s=void 0,E):N===null?n(N):me(N)?(o=M,q(N)):(e.consume(N),M)}function j(N){return N===null||N===34||N===39||N===60||N===61||N===96?n(N):N===47||N===62||Fe(N)?F(N):(e.consume(N),j)}function E(N){return N===47||N===62||Fe(N)?F(N):n(N)}function $(N){return N===62?(e.consume(N),e.exit("htmlTextData"),e.exit("htmlText"),t):n(N)}function q(N){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),D}function D(N){return Ne(N)?Pe(e,H,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):H(N)}function H(N){return e.enter("htmlTextData"),o(N)}}const Nx={name:"labelEnd",resolveAll:DI,resolveTo:MI,tokenize:LI},RI={tokenize:AI},TI={tokenize:OI},PI={tokenize:II};function DI(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&qn(e,0,e.length,n),e}function MI(e,t){let n=e.length,r=0,s,i,o,l;for(;n--;)if(s=e[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(o=n);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},h={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",c,t],["enter",u,t]],l=sr(l,e.slice(i+1,i+r+3)),l=sr(l,[["enter",h,t]]),l=sr(l,Ph(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),l=sr(l,[["exit",h,t],e[o-2],e[o-1],["exit",u,t]]),l=sr(l,e.slice(o+1)),l=sr(l,[["exit",c,t]]),qn(e,i,e.length,l),e}function LI(e,t,n){const r=this;let s=r.events.length,i,o;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return l;function l(p){return i?i._inactive?d(p):(o=r.parser.defined.includes(Cr(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),c):n(p)}function c(p){return p===40?e.attempt(RI,h,o?h:d)(p):p===91?e.attempt(TI,h,o?u:d)(p):o?h(p):d(p)}function u(p){return e.attempt(PI,h,d)(p)}function h(p){return t(p)}function d(p){return i._balanced=!0,n(p)}}function AI(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),s}function s(d){return Fe(d)?Ll(e,i)(d):i(d)}function i(d){return d===41?h(d):f2(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return Fe(d)?Ll(e,c)(d):h(d)}function l(d){return n(d)}function c(d){return d===34||d===39||d===40?m2(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):h(d)}function u(d){return Fe(d)?Ll(e,h)(d):h(d)}function h(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function OI(e,t,n){const r=this;return s;function s(l){return p2.call(r,e,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(Cr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function o(l){return n(l)}}function II(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s}function s(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const BI={name:"labelStartImage",resolveAll:Nx.resolveAll,tokenize:FI};function FI(e,t,n){const r=this;return s;function s(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):n(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const zI={name:"labelStartLink",resolveAll:Nx.resolveAll,tokenize:$I};function $I(e,t,n){const r=this;return s;function s(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Hf={name:"lineEnding",tokenize:HI};function HI(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Pe(e,t,"linePrefix")}}const Ju={name:"thematicBreak",tokenize:WI};function WI(e,t,n){let r=0,s;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return s=u,l(u)}function l(u){return u===s?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||me(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===s?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),Ne(u)?Pe(e,l,"whitespace")(u):l(u))}}const kn={continuation:{tokenize:VI},exit:QI,name:"list",tokenize:KI},UI={partial:!0,tokenize:XI},qI={partial:!0,tokenize:YI};function KI(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return l;function l(f){const m=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:_g(f)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Ju,n,u)(f):u(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(f)}return n(f)}function c(f){return _g(f)&&++o<10?(e.consume(f),c):(!r.interrupt||o<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),u(f)):n(f)}function u(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(Ac,r.interrupt?n:h,e.attempt(UI,p,d))}function h(f){return r.containerState.initialBlankLine=!0,i++,p(f)}function d(f){return Ne(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),p):n(f)}function p(f){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function VI(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Ac,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Pe(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Ne(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(qI,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Pe(e,e.attempt(kn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function YI(e,t,n){const r=this;return Pe(e,s,"listItemIndent",r.containerState.size+1);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(i):n(i)}}function QI(e){e.exit(this.containerState.type)}function XI(e,t,n){const r=this;return Pe(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=r.events[r.events.length-1];return!Ne(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const cb={name:"setextUnderline",resolveTo:GI,tokenize:JI};function GI(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function JI(e,t,n){const r=this;let s;return i;function i(u){let h=r.events.length,d;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){d=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),s=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===s?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),Ne(u)?Pe(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||me(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const ZI={tokenize:e6};function e6(e){const t=this,n=e.attempt(Ac,r,e.attempt(this.parser.constructs.flowInitial,s,Pe(e,e.attempt(this.parser.constructs.flow,s,e.attempt(iI,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const t6={resolveAll:v2()},n6=g2("string"),r6=g2("text");function g2(e){return{resolveAll:v2(e==="text"?s6:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,o,l);return o;function o(h){return u(h)?i(h):l(h)}function l(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),c}function c(h){return u(h)?(n.exit("data"),i(h)):(n.consume(h),c)}function u(h){if(h===null)return!0;const d=s[h];let p=-1;if(d)for(;++p<d.length;){const f=d[p];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function v2(e){return t;function t(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return e?e(n,r):n}}function s6(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let i=s.length,o=-1,l=0,c;for(;i--;){const u=s[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(u===-2)c=!0,l++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const i6={42:kn,43:kn,45:kn,48:kn,49:kn,50:kn,51:kn,52:kn,53:kn,54:kn,55:kn,56:kn,57:kn,62:c2},o6={91:uI},a6={[-2]:$f,[-1]:$f,32:$f},l6={35:gI,42:Ju,45:[cb,Ju],60:_I,61:cb,95:Ju,96:ab,126:ab},c6={38:d2,92:u2},u6={[-5]:Hf,[-4]:Hf,[-3]:Hf,33:BI,38:d2,42:bg,60:[zO,jI],91:zI,92:[pI,u2],93:Nx,95:bg,96:ZO},d6={null:[bg,t6]},h6={null:[42,95]},f6={null:[]},p6=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:h6,contentInitial:o6,disable:f6,document:i6,flow:l6,flowInitial:a6,insideSpan:d6,string:c6,text:u6},Symbol.toStringTag,{value:"Module"}));function m6(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let o=[],l=[];const c={attempt:R(C),check:R(S),consume:y,enter:_,exit:w,interrupt:R(S,{interrupt:!0})},u={code:null,containerState:{},defineSkip:g,events:[],now:m,parser:e,previous:null,sliceSerialize:p,sliceStream:f,write:d};let h=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function d(I){return o=sr(o,I),b(),o[o.length-1]!==null?[]:(T(t,0),u.events=Ph(i,u.events,u),u.events)}function p(I,A){return v6(f(I),A)}function f(I){return g6(o,I)}function m(){const{_bufferIndex:I,_index:A,line:M,column:j,offset:E}=r;return{_bufferIndex:I,_index:A,line:M,column:j,offset:E}}function g(I){s[I.line]=I.column,P()}function b(){let I;for(;r._index<o.length;){const A=o[r._index];if(typeof A=="string")for(I=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===I&&r._bufferIndex<A.length;)x(A.charCodeAt(r._bufferIndex));else x(A)}}function x(I){h=h(I)}function y(I){me(I)?(r.line++,r.column=1,r.offset+=I===-3?2:1,P()):I!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=I}function _(I,A){const M=A||{};return M.type=I,M.start=m(),u.events.push(["enter",M,u]),l.push(M),M}function w(I){const A=l.pop();return A.end=m(),u.events.push(["exit",A,u]),A}function C(I,A){T(I,A.from)}function S(I,A){A.restore()}function R(I,A){return M;function M(j,E,$){let q,D,H,N;return Array.isArray(j)?O(j):"tokenize"in j?O([j]):B(j);function B(z){return X;function X(re){const ie=re!==null&&z[re],de=re!==null&&z.null,qe=[...Array.isArray(ie)?ie:ie?[ie]:[],...Array.isArray(de)?de:de?[de]:[]];return O(qe)(re)}}function O(z){return q=z,D=0,z.length===0?$:k(z[D])}function k(z){return X;function X(re){return N=F(),H=z,z.partial||(u.currentConstruct=z),z.name&&u.parser.constructs.disable.null.includes(z.name)?Q():z.tokenize.call(A?Object.assign(Object.create(u),A):u,c,W,Q)(re)}}function W(z){return I(H,N),E}function Q(z){return N.restore(),++D<q.length?k(q[D]):$}}}function T(I,A){I.resolveAll&&!i.includes(I)&&i.push(I),I.resolve&&qn(u.events,A,u.events.length-A,I.resolve(u.events.slice(A),u)),I.resolveTo&&(u.events=I.resolveTo(u.events,u))}function F(){const I=m(),A=u.previous,M=u.currentConstruct,j=u.events.length,E=Array.from(l);return{from:j,restore:$};function $(){r=I,u.previous=A,u.currentConstruct=M,u.events.length=j,l=E,P()}}function P(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function g6(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let o;if(n===s)o=[e[n].slice(r,i)];else{if(o=e.slice(n,s),r>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}i>0&&o.push(e[s].slice(0,i))}return o}function v6(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
534
- `;break}case-3:{o=`\r
535
- `;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&s)continue;o=" ";break}default:o=String.fromCharCode(i)}s=i===-2,r.push(o)}return r.join("")}function x6(e){const r={constructs:a2([p6,...(e||{}).extensions||[]]),content:s(MO),defined:[],document:s(AO),flow:s(ZI),lazy:{},string:s(n6),text:s(r6)};return r;function s(i){return o;function o(l){return m6(r,i,l)}}}function y6(e){for(;!h2(e););return e}const ub=/[\0\t\n\r]/g;function _6(){let e=1,t="",n=!0,r;return s;function s(i,o,l){const c=[];let u,h,d,p,f;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),d=0,t="",n&&(i.charCodeAt(0)===65279&&d++,n=void 0);d<i.length;){if(ub.lastIndex=d,u=ub.exec(i),p=u&&u.index!==void 0?u.index:i.length,f=i.charCodeAt(p),!u){t=i.slice(d);break}if(f===10&&d===p&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),d<p&&(c.push(i.slice(d,p)),e+=p-d),f){case 0:{c.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,c.push(-2);e++<h;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}d=p+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const b6=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function w6(e){return e.replace(b6,S6)}function S6(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return l2(n.slice(i?2:1),i?16:10)}return Cx(n)||e}const x2={}.hasOwnProperty;function k6(e,t,n){return typeof t!="string"&&(n=t,t=void 0),C6(n)(y6(x6(n).document().write(_6()(e,t,!0))))}function C6(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(tt),autolinkProtocol:F,autolinkEmail:F,atxHeading:i(yn),blockQuote:i(de),characterEscape:F,characterReference:F,codeFenced:i(qe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(qe,o),codeText:i(Se,o),codeTextData:F,data:F,codeFlowValue:F,definition:i(he),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(Nt),hardBreakEscape:i(te),hardBreakTrailing:i(te),htmlFlow:i(fe,o),htmlFlowData:F,htmlText:i(fe,o),htmlTextData:F,image:i(Re),label:o,link:i(tt),listItem:i(jt),listItemValue:p,listOrdered:i(Ae,d),listUnordered:i(Ae),paragraph:i(Kt),reference:k,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(yn),strong:i(Ln),thematicBreak:i(hr)},exit:{atxHeading:c(),atxHeadingSequence:C,autolink:c(),autolinkEmail:ie,autolinkProtocol:re,blockQuote:c(),characterEscapeValue:P,characterReferenceMarkerHexadecimal:Q,characterReferenceMarkerNumeric:Q,characterReferenceValue:z,characterReference:X,codeFenced:c(b),codeFencedFence:g,codeFencedFenceInfo:f,codeFencedFenceMeta:m,codeFlowValue:P,codeIndented:c(x),codeText:c(E),codeTextData:P,data:P,definition:c(),definitionDestinationString:w,definitionLabelString:y,definitionTitleString:_,emphasis:c(),hardBreakEscape:c(A),hardBreakTrailing:c(A),htmlFlow:c(M),htmlFlowData:P,htmlText:c(j),htmlTextData:P,image:c(q),label:H,labelText:D,lineEnding:I,link:c($),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:W,resourceDestinationString:N,resourceTitleString:B,resource:O,setextHeading:c(T),setextHeadingLineSequence:R,setextHeadingText:S,strong:c(),thematicBreak:c()}};y2(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(K){let Z={type:"root",children:[]};const pe={stack:[Z],tokenStack:[],config:t,enter:l,exit:u,buffer:o,resume:h,data:n},ve=[];let Ee=-1;for(;++Ee<K.length;)if(K[Ee][1].type==="listOrdered"||K[Ee][1].type==="listUnordered")if(K[Ee][0]==="enter")ve.push(Ee);else{const nt=ve.pop();Ee=s(K,nt,Ee)}for(Ee=-1;++Ee<K.length;){const nt=t[K[Ee][0]];x2.call(nt,K[Ee][1].type)&&nt[K[Ee][1].type].call(Object.assign({sliceSerialize:K[Ee][2].sliceSerialize},pe),K[Ee][1])}if(pe.tokenStack.length>0){const nt=pe.tokenStack[pe.tokenStack.length-1];(nt[1]||db).call(pe,void 0,nt[0])}for(Z.position={start:Is(K.length>0?K[0][1].start:{line:1,column:1,offset:0}),end:Is(K.length>0?K[K.length-2][1].end:{line:1,column:1,offset:0})},Ee=-1;++Ee<t.transforms.length;)Z=t.transforms[Ee](Z)||Z;return Z}function s(K,Z,pe){let ve=Z-1,Ee=-1,nt=!1,_n,bn,Rr,Qn;for(;++ve<=pe;){const vt=K[ve];switch(vt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{vt[0]==="enter"?Ee++:Ee--,Qn=void 0;break}case"lineEndingBlank":{vt[0]==="enter"&&(_n&&!Qn&&!Ee&&!Rr&&(Rr=ve),Qn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Qn=void 0}if(!Ee&&vt[0]==="enter"&&vt[1].type==="listItemPrefix"||Ee===-1&&vt[0]==="exit"&&(vt[1].type==="listUnordered"||vt[1].type==="listOrdered")){if(_n){let fr=ve;for(bn=void 0;fr--;){const on=K[fr];if(on[1].type==="lineEnding"||on[1].type==="lineEndingBlank"){if(on[0]==="exit")continue;bn&&(K[bn][1].type="lineEndingBlank",nt=!0),on[1].type="lineEnding",bn=fr}else if(!(on[1].type==="linePrefix"||on[1].type==="blockQuotePrefix"||on[1].type==="blockQuotePrefixWhitespace"||on[1].type==="blockQuoteMarker"||on[1].type==="listItemIndent"))break}Rr&&(!bn||Rr<bn)&&(_n._spread=!0),_n.end=Object.assign({},bn?K[bn][1].start:vt[1].end),K.splice(bn||ve,0,["exit",_n,vt[2]]),ve++,pe++}if(vt[1].type==="listItemPrefix"){const fr={type:"listItem",_spread:!1,start:Object.assign({},vt[1].start),end:void 0};_n=fr,K.splice(ve,0,["enter",fr,vt[2]]),ve++,pe++,Rr=void 0,Qn=!0}}}return K[Z][1]._spread=nt,pe}function i(K,Z){return pe;function pe(ve){l.call(this,K(ve),ve),Z&&Z.call(this,ve)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(K,Z,pe){this.stack[this.stack.length-1].children.push(K),this.stack.push(K),this.tokenStack.push([Z,pe||void 0]),K.position={start:Is(Z.start),end:void 0}}function c(K){return Z;function Z(pe){K&&K.call(this,pe),u.call(this,pe)}}function u(K,Z){const pe=this.stack.pop(),ve=this.tokenStack.pop();if(ve)ve[0].type!==K.type&&(Z?Z.call(this,K,ve[0]):(ve[1]||db).call(this,K,ve[0]));else throw new Error("Cannot close `"+K.type+"` ("+Ml({start:K.start,end:K.end})+"): it’s not open");pe.position.end=Is(K.end)}function h(){return kx(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function p(K){if(this.data.expectingFirstListItemValue){const Z=this.stack[this.stack.length-2];Z.start=Number.parseInt(this.sliceSerialize(K),10),this.data.expectingFirstListItemValue=void 0}}function f(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.lang=K}function m(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.meta=K}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.value=K.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.value=K.replace(/(\r?\n|\r)$/g,"")}function y(K){const Z=this.resume(),pe=this.stack[this.stack.length-1];pe.label=Z,pe.identifier=Cr(this.sliceSerialize(K)).toLowerCase()}function _(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.title=K}function w(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.url=K}function C(K){const Z=this.stack[this.stack.length-1];if(!Z.depth){const pe=this.sliceSerialize(K).length;Z.depth=pe}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function R(K){const Z=this.stack[this.stack.length-1];Z.depth=this.sliceSerialize(K).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function F(K){const pe=this.stack[this.stack.length-1].children;let ve=pe[pe.length-1];(!ve||ve.type!=="text")&&(ve=Es(),ve.position={start:Is(K.start),end:void 0},pe.push(ve)),this.stack.push(ve)}function P(K){const Z=this.stack.pop();Z.value+=this.sliceSerialize(K),Z.position.end=Is(K.end)}function I(K){const Z=this.stack[this.stack.length-1];if(this.data.atHardBreak){const pe=Z.children[Z.children.length-1];pe.position.end=Is(K.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Z.type)&&(F.call(this,K),P.call(this,K))}function A(){this.data.atHardBreak=!0}function M(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.value=K}function j(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.value=K}function E(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.value=K}function $(){const K=this.stack[this.stack.length-1];if(this.data.inReference){const Z=this.data.referenceType||"shortcut";K.type+="Reference",K.referenceType=Z,delete K.url,delete K.title}else delete K.identifier,delete K.label;this.data.referenceType=void 0}function q(){const K=this.stack[this.stack.length-1];if(this.data.inReference){const Z=this.data.referenceType||"shortcut";K.type+="Reference",K.referenceType=Z,delete K.url,delete K.title}else delete K.identifier,delete K.label;this.data.referenceType=void 0}function D(K){const Z=this.sliceSerialize(K),pe=this.stack[this.stack.length-2];pe.label=w6(Z),pe.identifier=Cr(Z).toLowerCase()}function H(){const K=this.stack[this.stack.length-1],Z=this.resume(),pe=this.stack[this.stack.length-1];if(this.data.inReference=!0,pe.type==="link"){const ve=K.children;pe.children=ve}else pe.alt=Z}function N(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.url=K}function B(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.title=K}function O(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function W(K){const Z=this.resume(),pe=this.stack[this.stack.length-1];pe.label=Z,pe.identifier=Cr(this.sliceSerialize(K)).toLowerCase(),this.data.referenceType="full"}function Q(K){this.data.characterReferenceType=K.type}function z(K){const Z=this.sliceSerialize(K),pe=this.data.characterReferenceType;let ve;pe?(ve=l2(Z,pe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ve=Cx(Z);const Ee=this.stack[this.stack.length-1];Ee.value+=ve}function X(K){const Z=this.stack.pop();Z.position.end=Is(K.end)}function re(K){P.call(this,K);const Z=this.stack[this.stack.length-1];Z.url=this.sliceSerialize(K)}function ie(K){P.call(this,K);const Z=this.stack[this.stack.length-1];Z.url="mailto:"+this.sliceSerialize(K)}function de(){return{type:"blockquote",children:[]}}function qe(){return{type:"code",lang:null,meta:null,value:""}}function Se(){return{type:"inlineCode",value:""}}function he(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Nt(){return{type:"emphasis",children:[]}}function yn(){return{type:"heading",depth:0,children:[]}}function te(){return{type:"break"}}function fe(){return{type:"html",value:""}}function Re(){return{type:"image",title:null,url:"",alt:null}}function tt(){return{type:"link",title:null,url:"",children:[]}}function Ae(K){return{type:"list",ordered:K.type==="listOrdered",start:null,spread:K._spread,children:[]}}function jt(K){return{type:"listItem",spread:K._spread,checked:null,children:[]}}function Kt(){return{type:"paragraph",children:[]}}function Ln(){return{type:"strong",children:[]}}function Es(){return{type:"text",value:""}}function hr(){return{type:"thematicBreak"}}}function Is(e){return{line:e.line,column:e.column,offset:e.offset}}function y2(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?y2(e,r):N6(e,r)}}function N6(e,t){let n;for(n in t)if(x2.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function db(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ml({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ml({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ml({start:t.start,end:t.end})+") is still open")}function j6(e){const t=this;t.parser=n;function n(r){return k6(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function E6(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function R6(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
536
- `}]}function T6(e,t){const n=t.value?t.value+`
537
- `:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function P6(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function D6(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function M6(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Ia(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let o,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=i+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function L6(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function A6(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function _2(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=r:s.push({type:"text",value:r}),s}function O6(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return _2(e,t);const s={src:Ia(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function I6(e,t){const n={src:Ia(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function B6(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function F6(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return _2(e,t);const s={href:Ia(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function z6(e,t){const n={href:Ia(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function $6(e,t,n){const r=e.all(t),s=n?H6(n):b2(t),i={},o=[];if(typeof t.checked=="boolean"){const h=r[0];let d;h&&h.type==="element"&&h.tagName==="p"?d=h:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const h=r[l];(s||l!==0||h.type!=="element"||h.tagName!=="p")&&o.push({type:"text",value:`
538
- `}),h.type==="element"&&h.tagName==="p"&&!s?o.push(...h.children):o.push(h)}const c=r[r.length-1];c&&(s||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
539
- `});const u={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,u),e.applyData(t,u)}function H6(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=b2(n[r])}return t}function b2(e){const t=e.spread;return t??e.children.length>1}function W6(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const o=r[s];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function U6(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function q6(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function K6(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function V6(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),s.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=_x(t.children[1]),c=e2(t.children[t.children.length-1]);l&&c&&(o.position={start:l,end:c}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function Y6(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let c=-1;const u=[];for(;++c<l;){const d=t.children[c],p={},f=o?o[c]:void 0;f&&(p.align=f);let m={type:"element",tagName:i,properties:p,children:[]};d&&(m.children=e.all(d),e.patch(d,m),m=e.applyData(d,m)),u.push(m)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,h),e.applyData(t,h)}function Q6(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const hb=9,fb=32;function X6(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(pb(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(pb(t.slice(s),s>0,!1)),i.join("")}function pb(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===hb||i===fb;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===hb||i===fb;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function G6(e,t){const n={type:"text",value:X6(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function J6(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Z6={blockquote:E6,break:R6,code:T6,delete:P6,emphasis:D6,footnoteReference:M6,heading:L6,html:A6,imageReference:O6,image:I6,inlineCode:B6,linkReference:F6,link:z6,listItem:$6,list:W6,paragraph:U6,root:q6,strong:K6,table:V6,tableCell:Q6,tableRow:Y6,text:G6,thematicBreak:J6,toml:xu,yaml:xu,definition:xu,footnoteDefinition:xu};function xu(){}const w2=-1,Dh=0,Al=1,Vd=2,jx=3,Ex=4,Rx=5,Tx=6,S2=7,k2=8,mb=typeof self=="object"?self:globalThis,eB=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,o]=t[s];switch(i){case Dh:case w2:return n(o,s);case Al:{const l=n([],s);for(const c of o)l.push(r(c));return l}case Vd:{const l=n({},s);for(const[c,u]of o)l[r(c)]=r(u);return l}case jx:return n(new Date(o),s);case Ex:{const{source:l,flags:c}=o;return n(new RegExp(l,c),s)}case Rx:{const l=n(new Map,s);for(const[c,u]of o)l.set(r(c),r(u));return l}case Tx:{const l=n(new Set,s);for(const c of o)l.add(r(c));return l}case S2:{const{name:l,message:c}=o;return n(new mb[l](c),s)}case k2:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(new mb[i](o),s)};return r},gb=e=>eB(new Map,e)(0),No="",{toString:tB}={},{keys:nB}=Object,sl=e=>{const t=typeof e;if(t!=="object"||!e)return[Dh,t];const n=tB.call(e).slice(8,-1);switch(n){case"Array":return[Al,No];case"Object":return[Vd,No];case"Date":return[jx,No];case"RegExp":return[Ex,No];case"Map":return[Rx,No];case"Set":return[Tx,No];case"DataView":return[Al,n]}return n.includes("Array")?[Al,n]:n.includes("Error")?[S2,n]:[Vd,n]},yu=([e,t])=>e===Dh&&(t==="function"||t==="symbol"),rB=(e,t,n,r)=>{const s=(o,l)=>{const c=r.push(o)-1;return n.set(l,c),c},i=o=>{if(n.has(o))return n.get(o);let[l,c]=sl(o);switch(l){case Dh:{let h=o;switch(c){case"bigint":l=k2,h=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);h=null;break;case"undefined":return s([w2],o)}return s([l,h],o)}case Al:{if(c){let p=o;return c==="DataView"?p=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(o)),s([c,[...p]],o)}const h=[],d=s([l,h],o);for(const p of o)h.push(i(p));return d}case Vd:{if(c)switch(c){case"BigInt":return s([c,o.toString()],o);case"Boolean":case"Number":case"String":return s([c,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const h=[],d=s([l,h],o);for(const p of nB(o))(e||!yu(sl(o[p])))&&h.push([i(p),i(o[p])]);return d}case jx:return s([l,o.toISOString()],o);case Ex:{const{source:h,flags:d}=o;return s([l,{source:h,flags:d}],o)}case Rx:{const h=[],d=s([l,h],o);for(const[p,f]of o)(e||!(yu(sl(p))||yu(sl(f))))&&h.push([i(p),i(f)]);return d}case Tx:{const h=[],d=s([l,h],o);for(const p of o)(e||!yu(sl(p)))&&h.push(i(p));return d}}const{message:u}=o;return s([l,{name:c,message:u}],o)};return i},vb=(e,{json:t,lossy:n}={})=>{const r=[];return rB(!(t||n),!!t,new Map,r)(e),r},Yd=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?gb(vb(e,t)):structuredClone(e):(e,t)=>gb(vb(e,t));function sB(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function iB(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function oB(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||sB,r=e.options.footnoteBackLabel||iB,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const h=e.all(u),d=String(u.identifier).toUpperCase(),p=Ia(d.toLowerCase());let f=0;const m=[],g=e.footnoteCounts.get(d);for(;g!==void 0&&++f<=g;){m.length>0&&m.push({type:"text",value:" "});let y=typeof n=="string"?n:n(c,f);typeof y=="string"&&(y={type:"text",value:y}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,f),className:["data-footnote-backref"]},children:Array.isArray(y)?y:[y]})}const b=h[h.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const y=b.children[b.children.length-1];y&&y.type==="text"?y.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...m)}else h.push(...m);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(h,!0)};e.patch(u,x),l.push(x)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Yd(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
540
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
541
- `}]}}const Mh=function(e){if(e==null)return uB;if(typeof e=="function")return Lh(e);if(typeof e=="object")return Array.isArray(e)?aB(e):lB(e);if(typeof e=="string")return cB(e);throw new Error("Expected function, string, or object as test")};function aB(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Mh(e[n]);return Lh(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function lB(e){const t=e;return Lh(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function cB(e){return Lh(t);function t(n){return n&&n.type===e}}function Lh(e){return t;function t(n,r,s){return!!(dB(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function uB(){return!0}function dB(e){return e!==null&&typeof e=="object"&&"type"in e}const C2=[],hB=!0,wg=!1,fB="skip";function N2(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=Mh(s),o=r?-1:1;l(e,void 0,[])();function l(c,u,h){const d=c&&typeof c=="object"?c:{};if(typeof d.type=="string"){const f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=C2,m,g,b;if((!t||i(c,u,h[h.length-1]||void 0))&&(f=pB(n(c,h)),f[0]===wg))return f;if("children"in c&&c.children){const x=c;if(x.children&&f[0]!==fB)for(g=(r?x.children.length:-1)+o,b=h.concat(x);g>-1&&g<x.children.length;){const y=x.children[g];if(m=l(y,g,b)(),m[0]===wg)return m;g=typeof m[1]=="number"?m[1]:g+o}}return f}}}function pB(e){return Array.isArray(e)?e:typeof e=="number"?[hB,e]:e==null?C2:[e]}function Px(e,t,n,r){let s,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,s=n):(i=t,o=n,s=r),N2(e,i,l,s);function l(c,u){const h=u[u.length-1],d=h?h.children.indexOf(c):void 0;return o(c,d,h)}}const Sg={}.hasOwnProperty,mB={};function gB(e,t){const n=t||mB,r=new Map,s=new Map,i=new Map,o={...Z6,...n.handlers},l={all:u,applyData:xB,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:n,patch:vB,wrap:_B};return Px(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const d=h.type==="definition"?r:s,p=String(h.identifier).toUpperCase();d.has(p)||d.set(p,h)}}),l;function c(h,d){const p=h.type,f=l.handlers[p];if(Sg.call(l.handlers,p)&&f)return f(l,h,d);if(l.options.passThrough&&l.options.passThrough.includes(p)){if("children"in h){const{children:g,...b}=h,x=Yd(b);return x.children=l.all(h),x}return Yd(h)}return(l.options.unknownHandler||yB)(l,h,d)}function u(h){const d=[];if("children"in h){const p=h.children;let f=-1;for(;++f<p.length;){const m=l.one(p[f],h);if(m){if(f&&p[f-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=xb(m.value)),!Array.isArray(m)&&m.type==="element")){const g=m.children[0];g&&g.type==="text"&&(g.value=xb(g.value))}Array.isArray(m)?d.push(...m):d.push(m)}}}return d}}function vB(e,t){e.position&&(t.position=iO(e))}function xB(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,Yd(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function yB(e,t){const n=t.data||{},r="value"in t&&!(Sg.call(n,"hProperties")||Sg.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function _B(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
542
- `});++r<e.length;)r&&n.push({type:"text",value:`
543
- `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
544
- `}),n}function xb(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function yb(e,t){const n=gB(e,t),r=n.one(e,void 0),s=oB(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
545
- `},s),i}function bB(e,t){return e&&"run"in e?async function(n,r){const s=yb(n,{file:r,...t});await e.run(s,r)}:function(n,r){return yb(n,{file:r,...e||t})}}function _b(e){if(e)throw e}var Zu=Object.prototype.hasOwnProperty,j2=Object.prototype.toString,bb=Object.defineProperty,wb=Object.getOwnPropertyDescriptor,Sb=function(t){return typeof Array.isArray=="function"?Array.isArray(t):j2.call(t)==="[object Array]"},kb=function(t){if(!t||j2.call(t)!=="[object Object]")return!1;var n=Zu.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Zu.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||Zu.call(t,s)},Cb=function(t,n){bb&&n.name==="__proto__"?bb(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Nb=function(t,n){if(n==="__proto__")if(Zu.call(t,n)){if(wb)return wb(t,n).value}else return;return t[n]},wB=function e(){var t,n,r,s,i,o,l=arguments[0],c=1,u=arguments.length,h=!1;for(typeof l=="boolean"&&(h=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)r=Nb(l,n),s=Nb(t,n),l!==s&&(h&&s&&(kb(s)||(i=Sb(s)))?(i?(i=!1,o=r&&Sb(r)?r:[]):o=r&&kb(r)?r:{},Cb(l,{name:n,newValue:e(h,o,s)})):typeof s<"u"&&Cb(l,{name:n,newValue:s}));return l};const Wf=Na(wB);function kg(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function SB(){const e=[],t={run:n,use:r};return t;function n(...s){let i=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...s);function l(c,...u){const h=e[++i];let d=-1;if(c){o(c);return}for(;++d<s.length;)(u[d]===null||u[d]===void 0)&&(u[d]=s[d]);s=u,h?kB(h,l)(...u):o(null,...u)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function kB(e,t){let n;return r;function r(...o){const l=e.length>o.length;let c;l&&o.push(s);try{c=e.apply(this,o)}catch(u){const h=u;if(l&&n)throw h;return s(h)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(o,...l){n||(n=!0,t(o,...l))}function i(o){s(null,o)}}const Ir={basename:CB,dirname:NB,extname:jB,join:EB,sep:"/"};function CB(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Oc(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,l=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1),l>-1&&(e.codePointAt(s)===t.codePointAt(l--)?l<0&&(r=s):(l=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function NB(e){if(Oc(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function jB(e){Oc(e);let t=e.length,n=-1,r=0,s=-1,i=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function EB(...e){let t=-1,n;for(;++t<e.length;)Oc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":RB(n)}function RB(e){Oc(e);const t=e.codePointAt(0)===47;let n=TB(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function TB(e,t){let n="",r=0,s=-1,i=0,o=-1,l,c;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(s===o-1||i===1))if(s!==o-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=o,i=0;continue}}else if(n.length>0){n="",r=0,s=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,o):n=e.slice(s+1,o),r=o-s-1;s=o,i=0}else l===46&&i>-1?i++:i=-1}return n}function Oc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const PB={cwd:DB};function DB(){return"/"}function Cg(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function MB(e){if(typeof e=="string")e=new URL(e);else if(!Cg(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return LB(e)}function LB(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const Uf=["history","path","basename","stem","extname","dirname"];class E2{constructor(t){let n;t?Cg(t)?n={path:t}:typeof t=="string"||AB(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":PB.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Uf.length;){const i=Uf[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)Uf.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Ir.basename(this.path):void 0}set basename(t){Kf(t,"basename"),qf(t,"basename"),this.path=Ir.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ir.dirname(this.path):void 0}set dirname(t){jb(this.basename,"dirname"),this.path=Ir.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ir.extname(this.path):void 0}set extname(t){if(qf(t,"extname"),jb(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ir.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Cg(t)&&(t=MB(t)),Kf(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ir.basename(this.path,this.extname):void 0}set stem(t){Kf(t,"stem"),qf(t,"stem"),this.path=Ir.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new sn(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function qf(e,t){if(e&&e.includes(Ir.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ir.sep+"`")}function Kf(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function jb(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function AB(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const OB=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},IB={}.hasOwnProperty;class Dx extends OB{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=SB()}copy(){const t=new Dx;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Wf(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Qf("data",this.frozen),this.namespace[t]=n,this):IB.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Qf("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=_u(t),r=this.parser||this.Parser;return Vf("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Vf("process",this.parser||this.Parser),Yf("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const l=_u(t),c=r.parse(l);r.run(c,l,function(h,d,p){if(h||!d||!p)return u(h);const f=d,m=r.stringify(f,p);zB(m)?p.value=m:p.result=m,u(h,p)});function u(h,d){h||!d?o(h):i?i(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),Vf("processSync",this.parser||this.Parser),Yf("processSync",this.compiler||this.Compiler),this.process(t,s),Rb("processSync","process",n),r;function s(i,o){n=!0,_b(i),r=o}}run(t,n,r){Eb(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(o,l){const c=_u(n);s.run(t,c,u);function u(h,d,p){const f=d||t;h?l(h):o?o(f):r(void 0,f,p)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),Rb("runSync","run",r),s;function i(o,l){_b(o),s=l,r=!0}}stringify(t,n){this.freeze();const r=_u(n),s=this.compiler||this.Compiler;return Yf("stringify",s),Eb(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(Qf("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[h,...d]=u;c(h,d)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(s.settings=Wf(!0,s.settings,u.settings))}function l(u){let h=-1;if(u!=null)if(Array.isArray(u))for(;++h<u.length;){const d=u[h];i(d)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,h){let d=-1,p=-1;for(;++d<r.length;)if(r[d][0]===u){p=d;break}if(p===-1)r.push([u,...h]);else if(h.length>0){let[f,...m]=h;const g=r[p][1];kg(g)&&kg(f)&&(f=Wf(!0,g,f)),r[p]=[u,f,...m]}}}}const BB=new Dx().freeze();function Vf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Yf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Qf(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Eb(e){if(!kg(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Rb(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function _u(e){return FB(e)?e:new E2(e)}function FB(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function zB(e){return typeof e=="string"||$B(e)}function $B(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const HB="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Tb=[],Pb={allowDangerousHtml:!0},WB=/^(https?|ircs?|mailto|xmpp)$/i,UB=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Ng(e){const t=qB(e),n=KB(e);return VB(t.runSync(t.parse(n),n),e)}function qB(e){const t=e.rehypePlugins||Tb,n=e.remarkPlugins||Tb,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Pb}:Pb;return BB().use(j6).use(n).use(bB,r).use(t)}function KB(e){const t=e.children||"",n=new E2;return typeof t=="string"&&(n.value=t),n}function VB(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||YB;for(const h of UB)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+HB+h.id,void 0);return Px(e,u),uO(e,{Fragment:a.Fragment,components:s,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function u(h,d,p){if(h.type==="raw"&&p&&typeof d=="number")return o?p.children.splice(d,1):p.children[d]={type:"text",value:h.value},d;if(h.type==="element"){let f;for(f in zf)if(Object.hasOwn(zf,f)&&Object.hasOwn(h.properties,f)){const m=h.properties[f],g=zf[f];(g===null||g.includes(h.tagName))&&(h.properties[f]=c(String(m||""),f,h))}}if(h.type==="element"){let f=n?!n.includes(h.tagName):i?i.includes(h.tagName):!1;if(!f&&r&&typeof d=="number"&&(f=!r(h,d,p)),f&&p&&typeof d=="number")return l&&h.children?p.children.splice(d,1,...h.children):p.children.splice(d,1),d}}}function YB(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||WB.test(e.slice(0,t))?e:""}function ed(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n;if(r<0)return"just now";const s=Math.floor(r/1e3);if(s<60)return"just now";const i=Math.floor(s/60);if(i<60)return`${i}m ago`;const o=Math.floor(i/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function bu(e,t=30){return Date.now()-new Date(e).getTime()>t*60*1e3}function QB(e){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(e),!0;const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),document.body.removeChild(t),!0}catch{return document.body.removeChild(t),!1}}function il(e){return e>=100?`$${e.toFixed(0)}`:e>=10?`$${e.toFixed(1)}`:e>=1?`$${e.toFixed(2)}`:e>0?`$${e.toFixed(3)}`:"$0.00"}function wu(e){return e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function Su(e){return e.includes("opus-4-6")||e.includes("opus-4.6")?"Opus 4.6":e.includes("opus-4-5")||e.includes("opus-4.5")?"Opus 4.5":e.includes("opus-4-1")?"Opus 4.1":e.includes("opus-4")||e.includes("opus")?"Opus 4":e.includes("sonnet-4-5")||e.includes("sonnet-4.5")?"Sonnet 4.5":e.includes("sonnet-4")||e.includes("sonnet")?"Sonnet 4":e.includes("haiku-4-5")||e.includes("haiku-4.5")?"Haiku 4.5":e.includes("haiku-3")?"Haiku 3":e.includes("haiku")?"Haiku 4.5":e}async function XB(e){const t=await fetch(`/api/agents/${e}/output?lines=200`);if(!t.ok)throw new Error("Failed to fetch output");return(await t.json()).output||""}async function GB(e){try{const t=await fetch(`/api/mission-control/planning/${e}`);return t.ok&&(await t.json()).prd||null}catch{return null}}function JB({history:e}){const[t,n]=v.useState(!1),r=[...e].reverse();return a.jsxs("div",{className:"mt-2 border-t border-border/30 pt-1.5",children:[a.jsxs("button",{onClick:()=>n(!t),className:"flex items-center gap-1 text-[10px] text-content-muted hover:text-content-subtle",children:[a.jsx("span",{children:t?"▾":"▸"}),a.jsxs("span",{children:["History (",e.length,")"]})]}),t&&a.jsx("div",{className:"mt-1 space-y-0.5",children:r.map((s,i)=>a.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[a.jsx("span",{className:"text-content-muted w-12 shrink-0",children:ed(s.timestamp)}),a.jsx("span",{className:s.type==="review"?"text-blue-400":s.type==="test"?"text-purple-400":"text-green-400",children:s.type}),a.jsx("span",{className:s.status==="passed"?"text-green-400":s.status==="failed"||s.status==="blocked"?"text-red-400":["reviewing","testing","merging"].includes(s.status)?"text-yellow-400":"text-content-muted",children:s.status}),s.notes&&a.jsxs("span",{className:"text-content-muted truncate",title:s.notes,children:["— ",s.notes.slice(0,60),s.notes.length>60?"...":""]})]},i))})]})}function ZB({agent:e,issueId:t,issueUrl:n,issue:r,onClose:s}){var Qn,vt,fr,on,zc;const i=rn(),o=ks(),[l,c]=v.useState(""),[u,h]=v.useState(!1),[d,p]=v.useState("logs"),f=v.useRef(null),m=v.useRef(null),[g,b]=v.useState(!0),x=e?`tmux attach -t ${e.id}`:"",[y,_]=v.useState(!1),[w,C]=v.useState(!1),{data:S,refetch:R}=ue({queryKey:["agent-output",e==null?void 0:e.id],queryFn:()=>XB(e.id),refetchInterval:(e==null?void 0:e.status)==="stopped"?!1:1e3,enabled:!!e}),[T,F]=v.useState(!1),[P,I]=v.useState(!1),[A,M]=v.useState(0),{data:j}=ue({queryKey:["workspace",t],queryFn:async()=>{const V=await fetch(`/api/workspaces/${t}`);if(!V.ok)throw new Error("Failed to fetch workspace info");const ae=await V.json();if(ae.exists&&T&&F(!1),P&&ae.containers){const De=Object.values(ae.containers),Qe=De.every(Bt=>Bt.running),An=Date.now()-A>2e4,Vt=De.some(Bt=>{var On;return(On=Bt.status)==null?void 0:On.startsWith("exited")});(Qe||An&&Vt)&&I(!1)}return ae},refetchInterval:T||P?2e3:5e3}),{data:E}=ue({queryKey:["review-status",t],queryFn:async()=>{const V=await fetch(`/api/workspaces/${t}/review-status`);if(!V.ok)throw new Error("Failed to fetch review status");return V.json()},refetchInterval:3e4}),{data:$}=ue({queryKey:["prd",t],queryFn:()=>GB(t),staleTime:6e4}),{data:q}=ue({queryKey:["issueCosts",t],queryFn:async()=>{const V=await fetch(`/api/issues/${t}/costs`);if(!V.ok)throw new Error("Failed to fetch costs");return V.json()},refetchInterval:3e4,staleTime:1e4}),D=xe({mutationFn:async()=>{var ae;const V=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:t,projectId:(ae=r==null?void 0:r.project)==null?void 0:ae.id})});if(!V.ok)throw new Error("Failed to start agent");return V.json()},onSuccess:()=>{setTimeout(()=>{i.invalidateQueries({queryKey:["agents"]})},2e3)}}),H=xe({mutationFn:async()=>{var ae;const V=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:t,projectId:(ae=r==null?void 0:r.project)==null?void 0:ae.id})});if(!V.ok)throw new Error("Failed to create workspace");return V.json()},onSuccess:()=>{F(!0),i.invalidateQueries({queryKey:["workspace",t]})}}),N=xe({mutationFn:async()=>{const V=await fetch(`/api/workspaces/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!V.ok){const ae=await V.json();throw new Error(ae.error||"Failed to start containers")}return V.json()},onSuccess:()=>{I(!0),M(Date.now()),setTimeout(()=>{i.invalidateQueries({queryKey:["workspace",t]})},5e3),setTimeout(()=>I(!1),9e4)}}),[B,O]=v.useState(null);v.useEffect(()=>{const V=()=>O(null);if(B)return document.addEventListener("click",V),()=>document.removeEventListener("click",V)},[B]);const k=xe({mutationFn:async({containerName:V,action:ae})=>{const De=await fetch(`/api/workspaces/${t}/containers/${V}/${ae}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!De.ok){const Qe=await De.json();throw new Error(Qe.error||`Failed to ${ae} container`)}return De.json()},onSuccess:()=>{O(null),setTimeout(()=>{i.invalidateQueries({queryKey:["workspace",t]})},2e3)}}),W=(V,ae,De)=>{V.preventDefault(),O({x:V.clientX,y:V.clientY,containerName:ae,isRunning:De})},Q=xe({mutationFn:async()=>{const V=await fetch(`/api/workspaces/${t}/containerize`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!V.ok){const ae=await V.json();throw new Error(ae.error||"Failed to containerize workspace")}return V.json()},onSuccess:()=>{setTimeout(()=>{i.invalidateQueries({queryKey:["workspace",t]})},3e3)}}),z=xe({mutationFn:async()=>{const V=await fetch(`/api/workspaces/${t}/review`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!V.ok){const ae=await V.json();throw new Error(ae.error||"Failed to start review")}return V.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["review-status",t]})}}),X=xe({mutationFn:async()=>{const V=await fetch(`/api/workspaces/${t}/merge`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!V.ok){const ae=await V.json();throw new Error(ae.error||"Failed to merge")}return V.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["agents"]}),i.invalidateQueries({queryKey:["issues"]}),i.invalidateQueries({queryKey:["review-status",t]}),s()}}),re=xe({mutationFn:async()=>{const V=await fetch(`/api/issues/${t}/close`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Closed manually"})});if(!V.ok){const ae=await V.json();throw new Error(ae.error||"Failed to close issue")}return V.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["agents"]}),i.invalidateQueries({queryKey:["issues"]}),s()}}),ie=xe({mutationFn:async V=>{const ae=await fetch(`/api/issues/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:V})});if(!ae.ok){const De=await ae.json();throw new Error(De.error||"Failed to reopen issue")}return ae.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["review-status",t]}),i.invalidateQueries({queryKey:["issues"]})}}),de=xe({mutationFn:async()=>{const V=await fetch(`/api/workspaces/${t}/reset-review`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!V.ok){const ae=await V.json();throw new Error(ae.error||"Failed to reset review cycles")}return V.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["review-status",t]}),i.invalidateQueries({queryKey:["issues"]})}}),qe=xe({mutationFn:async()=>{const V=await fetch(`/api/workspaces/${t}/pending`,{method:"DELETE"});if(!V.ok)throw new Error("Failed to dismiss");return V.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]})}}),Se=xe({mutationFn:async()=>{const V=await fetch(`/api/workspaces/${t}/clean`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!V.ok){const ae=await V.json();throw new Error(ae.error||"Failed to clean workspace")}return V.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["agents"]})}}),he=xe({mutationFn:async()=>{const V=await fetch(`/api/workspaces/${t}/sync-main`,{method:"POST",headers:{"Content-Type":"application/json"}}),ae=await V.json();if(!V.ok)throw new Error(ae.error||"Sync failed");return ae},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["agents"]})}}),Nt=async()=>{await o({title:"Sync Main",message:`Sync main into ${t}?
546
-
547
- This will:
548
- - Auto-commit any uncommitted changes
549
- - Fetch and merge the latest main into the feature branch
550
- - Use the merge agent to resolve any conflicts`,confirmLabel:"Sync"})&&he.mutate()},yn=xe({mutationFn:async()=>{const V=await fetch(`/api/workspaces/${t}/refresh-db`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!V.ok){const ae=await V.json();throw new Error(ae.error||"Failed to refresh database")}return V.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]})}}),te=async()=>{await o({title:"Clean Workspace",message:`Clean and recreate corrupted workspace for ${t}?
551
-
552
- This will:
553
- - Remove the corrupted workspace directory
554
- - Create a fresh workspace`,variant:"destructive",confirmLabel:"Clean & Recreate"})&&Se.mutate()},fe=()=>{N.mutate()},Re=()=>{Q.mutate()},tt=async()=>{const V=(E==null?void 0:E.readyForMerge)||(E==null?void 0:E.reviewStatus)==="passed"||(E==null?void 0:E.testStatus)==="passed",ae=V?`Re-run review & test pipeline for ${t}?
555
-
556
- This will reset the current status and:
557
- - Run strict code review (review-agent)
558
- - Run tests (test-agent)
559
-
560
- MERGE button will appear when both pass.`:`Start review & test pipeline for ${t}?
561
-
562
- This will:
563
- - Run strict code review (review-agent)
564
- - Run tests (test-agent)
565
-
566
- MERGE button will appear when both pass.`;await o({title:V?"Re-run Review":"Start Review",message:ae,confirmLabel:V?"Re-run":"Start Review"})&&z.mutate()},Ae=async()=>{await o({title:"Merge to Main",message:`Merge ${t} to main?
567
-
568
- Review and tests have passed. This will:
569
- - Merge the feature branch to main
570
- - Run final verification tests
571
- - Clean up workspace`,confirmLabel:"Merge"})&&X.mutate()},jt=async()=>{await o({title:"Close Without Merging",message:`Close ${t} without merging? This will:
572
- - Close the issue (no merge)
573
- - Stop any running agent
574
- - Remove the workspace
575
- (Feature branch is preserved for history)`,variant:"destructive",confirmLabel:"Close"})&&re.mutate()},Kt=()=>{const V=prompt(`Reopen ${t} for re-work?
576
-
577
- This will:
578
- - Move the issue to "In Progress"
579
- - Reset review/test/merge status to pending
580
- - Remove any queued specialist tasks
581
- - Append a "Reopened" section to STATE.md
582
-
583
- Optional: enter a reason (or leave blank):`,"");V!==null&&ie.mutate(V||void 0)},Ln=async()=>{await o({title:"Reset Review Cycles",message:`Reset all review/test/merge cycles for ${t}?
584
-
585
- This will:
586
- - Clear review, test, and merge status
587
- - Reset the circuit breaker counter
588
- - Remove queued specialist tasks
589
-
590
- The agent can then request review when ready.
591
- Tracker status will NOT change.`,confirmLabel:"Reset Cycles"})&&de.mutate()},Es=xe({mutationFn:async V=>{if(!e)throw new Error("No agent");if(!(await fetch(`/api/agents/${e.id}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:V})})).ok)throw new Error("Failed to send")},onSuccess:()=>{c(""),setTimeout(()=>R(),500)}}),hr=xe({mutationFn:async()=>{if(!e)throw new Error("No agent");if(!(await fetch(`/api/agents/${e.id}`,{method:"DELETE"})).ok)throw new Error("Failed to kill")},onSuccess:()=>{i.invalidateQueries({queryKey:["agents"]}),s()}}),K=v.useCallback(()=>{QB(x),h(!0),setTimeout(()=>h(!1),2e3)},[x]);v.useEffect(()=>{g&&m.current&&m.current.scrollIntoView({behavior:"auto"})},[S,g]);const Z=v.useCallback(()=>{if(f.current){const{scrollTop:V,scrollHeight:ae,clientHeight:De}=f.current,Qe=ae-V-De<50;b(Qe)}},[]),pe=()=>{l.trim()&&Es.mutate(l.trim())},ve=async()=>{e&&await o({title:"Kill Agent",message:`Kill agent ${e.id}?`,variant:"destructive",confirmLabel:"Kill"})&&hr.mutate()},Ee=e?new Date(e.startedAt):null,nt=Ee?Date.now()-Ee.getTime():0,_n=Math.floor(nt/6e4),bn=Math.floor(_n/60),Rr=bn>0?`${bn}h ${_n%60}m`:`${_n}m`;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex h-full bg-surface-raised border-l border-divider","data-testid":"workspace-panel",children:[a.jsxs("div",{className:"w-64 border-r border-divider flex flex-col overflow-y-auto","data-testid":"workspace-sidebar",children:[a.jsxs("div",{className:"px-3 py-2 border-b border-divider",children:[e?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex gap-0.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"0ms"}}),a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"150ms"}}),a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"300ms"}})]}),a.jsx("span",{className:"text-xs text-content-subtle",children:e.status==="stopped"?"Agent Stopped":"Agent Running"})]}):a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-content-muted"}),a.jsx("span",{className:"text-xs text-content-subtle",children:"No Agent"})]}),a.jsx("h2",{className:"font-mono text-sm text-content font-medium mt-1",children:t.toUpperCase()}),r&&a.jsx("p",{className:"text-xs text-content-subtle mt-1 line-clamp-2",title:r.title,children:r.title})]}),r&&a.jsx("div",{className:"px-3 py-2 border-b border-divider text-xs",children:a.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[a.jsx("span",{className:"px-1.5 py-0.5 bg-surface-overlay text-content rounded text-[10px]",children:r.status}),r.priority>0&&a.jsx("span",{className:`text-[10px] ${r.priority===1?"text-red-400":r.priority===2?"text-orange-400":r.priority===3?"text-yellow-400":"text-blue-400"}`,children:r.priority===1?"Urgent":r.priority===2?"High":r.priority===3?"Medium":"Low"}),r.labels.slice(0,3).map(V=>a.jsx("span",{className:"px-1.5 py-0.5 bg-surface-overlay text-content-muted rounded text-[10px]",children:V},V))]})}),e&&a.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[a.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Agent"}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-content-subtle",children:"Model"}),a.jsx("span",{className:"text-content",children:Su(e.model)})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-content-subtle",children:"Runtime"}),a.jsx("span",{className:"text-content",children:e.runtime})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-content-subtle",children:"Uptime"}),a.jsx("span",{className:"text-content",children:Rr})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-content-subtle",children:"Session"}),a.jsx("span",{className:"text-content font-mono text-[10px]",children:e.id})]})]})]}),(e==null?void 0:e.git)&&a.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs","data-testid":"git-status",children:[a.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Git Status"}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-content",children:[a.jsx(uk,{className:"w-3 h-3"}),a.jsx("span",{className:"font-mono flex-1",children:e.git.branch}),a.jsxs("button",{onClick:Nt,disabled:he.isPending,title:e.git.uncommittedFiles>0?"Will auto-commit changes before syncing":"Sync with main",className:"flex items-center gap-1 px-1.5 py-0.5 text-[10px] bg-surface-overlay/50 text-content-subtle rounded hover:bg-surface-overlay hover:text-content disabled:opacity-40 disabled:cursor-not-allowed",children:[he.isPending?a.jsx(ye,{className:"w-2.5 h-2.5 animate-spin"}):a.jsx(Nm,{className:"w-2.5 h-2.5"}),"Sync"]})]}),e.git.uncommittedFiles>0&&a.jsxs("div",{className:"text-yellow-400 text-[10px] ml-4",children:[e.git.uncommittedFiles," uncommitted files"]}),a.jsx("div",{className:"text-content-subtle text-[10px] mt-1 truncate",title:e.git.latestCommit,children:e.git.latestCommit})]})]}),(e==null?void 0:e.workspace)&&a.jsx("div",{className:"px-3 py-2 border-b border-divider text-xs",children:a.jsxs("div",{className:"flex items-center gap-1.5 text-content-subtle",children:[a.jsx(Cm,{className:"w-3 h-3"}),a.jsx("span",{className:"font-mono truncate text-[10px]",title:e.workspace,children:e.workspace})]})}),!e&&(j==null?void 0:j.exists)&&j.path&&a.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[a.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Workspace"}),a.jsxs("div",{className:"flex items-center gap-1.5 text-content-subtle",children:[a.jsx(Cm,{className:"w-3 h-3"}),a.jsx("span",{className:"font-mono truncate text-[10px]",title:j.path,children:j.path})]}),j.location&&a.jsxs("span",{className:`mt-1.5 inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${j.location==="remote"?"bg-cyan-900/50 text-cyan-400":"bg-surface-overlay text-content-subtle"}`,children:[j.location==="remote"?a.jsx(Sm,{className:"w-3 h-3"}):a.jsx(jm,{className:"w-3 h-3"}),j.location]})]}),a.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[a.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Links"}),a.jsxs("div",{className:"space-y-1.5",children:[n&&a.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[a.jsx(Qr,{className:"w-3 h-3"}),a.jsx("span",{children:t.toUpperCase().startsWith("PAN-")?"GitHub Issue":"Linear Issue"})]}),$&&a.jsxs("button",{onClick:()=>_(!0),className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[a.jsx(io,{className:"w-3 h-3"}),a.jsx("span",{children:"PRD"})]}),a.jsxs("button",{onClick:()=>C(!0),className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[a.jsx(fk,{className:"w-3 h-3"}),a.jsx("span",{children:"Beads Tasks"})]})]})]}),q&&(q.totalCost>0||(((Qn=q.sessions)==null?void 0:Qn.length)??0)>0)&&a.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[a.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Cost"}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-content-subtle",children:"Total"}),a.jsx("span",{className:"text-green-400 font-medium",children:il(q.totalCost)})]}),q.totalTokens>0&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-content-subtle",children:"Tokens"}),a.jsx("span",{className:"text-content",children:wu(q.totalTokens)})]}),Object.keys(q.byModel).length>0&&a.jsx("div",{className:"border-t border-divider pt-1.5 mt-1.5",children:Object.entries(q.byModel).sort(([,V],[,ae])=>ae.cost-V.cost).map(([V,ae])=>a.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[a.jsx("span",{className:"text-content-subtle truncate",title:V,children:Su(V)}),a.jsx("span",{className:"text-content-body",children:il(ae.cost)})]},V))})]})]}),(j==null?void 0:j.corrupted)&&a.jsxs("div",{className:"px-3 py-2 border-b border-divider",children:[a.jsxs("div",{className:"flex items-center gap-2 text-yellow-500 mb-2",children:[a.jsx(tn,{className:"w-4 h-4"}),a.jsx("span",{className:"text-xs font-medium",children:"Workspace Corrupted"}),j.location&&a.jsxs("span",{className:`flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${j.location==="remote"?"bg-cyan-900/50 text-cyan-400":"bg-surface-overlay text-content-subtle"}`,title:j.location==="remote"?"Running on remote VM (exe.dev)":"Running locally",children:[j.location==="remote"?a.jsx(Sm,{className:"w-3 h-3"}):a.jsx(jm,{className:"w-3 h-3"}),j.location]})]}),a.jsx("p",{className:"text-xs text-content-subtle mb-2",children:j.message||"The workspace exists but is not a valid git worktree."}),a.jsx("button",{onClick:te,disabled:Se.isPending,className:"flex items-center gap-1 px-2 py-1 bg-yellow-600 hover:bg-yellow-500 disabled:bg-yellow-800 text-content text-xs rounded transition-colors w-full justify-center",children:Se.isPending?a.jsxs(a.Fragment,{children:[a.jsx(ye,{className:"w-3 h-3 animate-spin"}),"Cleaning..."]}):a.jsxs(a.Fragment,{children:[a.jsx(us,{className:"w-3 h-3"}),"Clean & Recreate"]})}),Se.isError&&a.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:Se.error instanceof Error?Se.error.message:"Failed to clean workspace"}),Se.isSuccess&&a.jsx("div",{className:"text-xs text-green-400 bg-green-900/20 px-2 py-1 rounded mt-2",children:"Workspace cleaned! Recreating..."})]}),(j==null?void 0:j.hasDocker)&&((j==null?void 0:j.frontendUrl)||(j==null?void 0:j.apiUrl))&&a.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[a.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Services"}),a.jsxs("div",{className:"space-y-1.5",children:[j.frontendUrl&&a.jsxs("a",{href:j.frontendUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[a.jsx(g0,{className:"w-3 h-3"}),a.jsx("span",{children:"Frontend"})]}),j.apiUrl&&a.jsxs("a",{href:j.apiUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[a.jsx(g0,{className:"w-3 h-3"}),a.jsx("span",{children:"API"})]})]})]}),(j==null?void 0:j.hasDocker)&&j.containers&&Object.values(j.containers).some(V=>!V.running)&&a.jsxs("div",{className:"px-3 py-2 border-b border-divider",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-yellow-500",children:P?"Starting containers...":"Some containers stopped"}),a.jsx("button",{onClick:fe,disabled:N.isPending||P,className:"flex items-center gap-1 px-2 py-1 bg-green-600 hover:bg-green-500 disabled:bg-green-800 text-content text-xs rounded transition-colors",children:N.isPending||P?a.jsxs(a.Fragment,{children:[a.jsx(ye,{className:"w-3 h-3 animate-spin"}),"Starting..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Rn,{className:"w-3 h-3"}),"Start Containers"]})})]}),N.isError&&a.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:N.error instanceof Error?N.error.message:"Failed to start containers"})]}),(j==null?void 0:j.exists)&&!j.hasDocker&&a.jsxs("div",{className:"px-3 py-2 border-b border-divider",children:[a.jsx("div",{className:"text-content-muted uppercase tracking-wider text-xs mb-2",children:"Containers"}),j.canContainerize?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-content-muted",children:"Git-only workspace"}),a.jsx("button",{onClick:Re,disabled:Q.isPending,className:"flex items-center gap-1 px-2 py-1 bg-purple-600 hover:bg-purple-500 disabled:bg-purple-800 text-content text-xs rounded transition-colors",children:Q.isPending?a.jsxs(a.Fragment,{children:[a.jsx(ye,{className:"w-3 h-3 animate-spin"}),"Setting up..."]}):a.jsxs(a.Fragment,{children:[a.jsx(p0,{className:"w-3 h-3"}),"Containerize"]})})]}),Q.isError&&a.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded",children:Q.error instanceof Error?Q.error.message:"Failed to containerize workspace"})]}):a.jsxs("div",{className:"text-xs text-content-subtle bg-surface-raised px-2 py-2 rounded",children:[a.jsx("span",{className:"text-content-muted",children:"No Docker support."})," This workspace doesn't have container infrastructure set up yet."]})]}),(j==null?void 0:j.containers)&&Object.keys(j.containers).length>0&&a.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[a.jsxs("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:["Containers",a.jsx("span",{className:"text-gray-600 font-normal ml-2",children:"(right-click for options)"})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(j.containers).map(([V,ae])=>{var An;const De=(N.isPending||P)&&!ae.running,Qe=k.isPending&&(B==null?void 0:B.containerName)===V,Et=((An=ae.status)==null?void 0:An.startsWith("exited"))&&!ae.running;return a.jsxs("span",{onContextMenu:Vt=>W(Vt,V,ae.running),className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] cursor-context-menu select-none ${ae.running?"bg-green-900/30 text-green-400 hover:bg-green-900/50":Et?"bg-red-900/30 text-red-400 hover:bg-red-900/50":De||Qe?"bg-yellow-900/30 text-yellow-400 animate-pulse":"bg-surface-overlay text-content-muted hover:bg-surface-emphasis"}`,title:Et?`Container ${ae.status} — right-click for options`:"Right-click for start/stop/restart options",children:[De||Qe?a.jsx(ye,{className:"w-2.5 h-2.5 animate-spin"}):V==="postgres"||V==="redis"?a.jsx(km,{className:"w-2.5 h-2.5"}):a.jsx(p0,{className:"w-2.5 h-2.5"}),V,ae.running&&ae.uptime&&a.jsx("span",{className:"text-content-subtle ml-1",children:ae.uptime}),Et&&a.jsx("span",{className:"text-red-500 ml-1",children:ae.status}),(De||Qe)&&a.jsx("span",{className:"text-yellow-500 ml-1",children:"..."})]},V)})})]}),e&&a.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[a.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Attach Command"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex-1 flex items-center gap-1.5 px-2 py-1.5 bg-surface rounded font-mono text-[11px] text-content-body overflow-hidden",children:[a.jsx(ao,{className:"w-3 h-3 shrink-0 text-blue-400"}),a.jsx("span",{className:"truncate",children:x})]}),a.jsx("button",{onClick:K,className:`p-1.5 rounded transition-colors ${u?"bg-green-900/30 text-green-400":"bg-surface-overlay hover:bg-surface-emphasis text-content-subtle hover:text-content"}`,title:"Copy to clipboard",children:u?a.jsx(El,{className:"w-3.5 h-3.5"}):a.jsx(SR,{className:"w-3.5 h-3.5"})})]})]}),a.jsxs("div",{className:"px-3 py-2 border-b border-divider","data-testid":"workspace-actions",children:[a.jsx("div",{className:"text-xs text-content-muted uppercase tracking-wider mb-2",children:"Actions"}),((vt=j==null?void 0:j.pendingOperation)==null?void 0:vt.type)==="approve"&&j.pendingOperation.status==="running"&&a.jsxs("div",{className:"flex items-center gap-2 text-xs text-blue-400 bg-blue-900/20 px-2 py-1.5 rounded mb-2",children:[a.jsx(ye,{className:"w-3 h-3 animate-spin"}),a.jsx("span",{children:"Merging in progress... (survives tab switches)"})]}),((fr=j==null?void 0:j.pendingOperation)==null?void 0:fr.status)==="failed"&&a.jsxs("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1.5 rounded mb-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"font-medium",children:"Operation failed"}),a.jsx("button",{onClick:()=>qe.mutate(),className:"text-content-subtle hover:text-content",title:"Dismiss",children:a.jsx(mt,{className:"w-3 h-3"})})]}),a.jsx("div",{className:"mt-1 text-content-subtle whitespace-pre-wrap",children:j.pendingOperation.error})]}),E&&(E.reviewStatus!=="pending"||E.testStatus!=="pending")&&a.jsxs("div",{className:`mb-2 p-2 rounded text-xs ${E.updatedAt&&bu(E.updatedAt)?"bg-amber-900/20 border border-amber-700/30":"bg-surface/50"}`,children:[E.updatedAt&&bu(E.updatedAt)&&a.jsxs("div",{className:"flex items-center gap-1 mb-1.5 text-amber-400 text-[10px]",children:[a.jsx(tn,{className:"w-3 h-3"}),a.jsxs("span",{children:["Status may be stale (",ed(E.updatedAt),")"]})]}),a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("span",{className:"text-content-subtle",children:"Review:"}),a.jsx("span",{className:E.reviewStatus==="passed"?"text-green-400":E.reviewStatus==="blocked"||E.reviewStatus==="failed"?"text-red-400":E.reviewStatus==="reviewing"?"text-yellow-400":"text-content-muted",children:E.reviewStatus==="passed"?"✓ Passed":E.reviewStatus==="blocked"?"✗ Blocked":E.reviewStatus==="failed"?"✗ Failed":E.reviewStatus==="reviewing"?"⟳ Reviewing...":"Pending"}),E.updatedAt&&E.reviewStatus!=="pending"&&!bu(E.updatedAt)&&a.jsx("span",{className:"text-content-muted text-[10px]",children:ed(E.updatedAt)})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-content-subtle",children:"Tests:"}),a.jsx("span",{className:E.testStatus==="passed"?"text-green-400":E.testStatus==="failed"?"text-red-400":E.testStatus==="testing"?"text-yellow-400":"text-content-muted",children:E.testStatus==="passed"?"✓ Passed":E.testStatus==="failed"?"✗ Failed":E.testStatus==="testing"?"⟳ Testing...":E.testStatus==="skipped"?"⊘ Skipped":"Pending"}),E.updatedAt&&E.testStatus!=="pending"&&!bu(E.updatedAt)&&a.jsx("span",{className:"text-content-muted text-[10px]",children:ed(E.updatedAt)})]}),(E.autoRequeueCount??0)>0&&a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("span",{className:"text-content-subtle",children:"Review cycles:"}),a.jsxs("span",{className:(E.autoRequeueCount??0)>=3?"text-red-400 font-medium":"text-content-body",children:[E.autoRequeueCount,"/3"]}),(E.autoRequeueCount??0)>=3&&a.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-amber-400 bg-amber-900/20 px-1.5 py-0.5 rounded",children:[a.jsx(tn,{className:"w-2.5 h-2.5"}),"Human intervention needed"]})]}),E.reviewNotes&&a.jsx("div",{className:"mt-1 text-content-subtle text-xs",children:E.reviewNotes}),E.testNotes&&a.jsx("div",{className:"mt-1 text-content-subtle text-xs",children:E.testNotes}),E.history&&E.history.length>0&&a.jsx(JB,{history:E.history})]}),a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[(E==null?void 0:E.readyForMerge)&&(E==null?void 0:E.mergeStatus)!=="merged"&&a.jsxs("button",{"data-testid":"merge-btn",onClick:Ae,disabled:X.isPending||(E==null?void 0:E.mergeStatus)==="merging",className:"flex items-center gap-1 px-2 py-1 text-xs bg-green-600 text-content rounded hover:bg-green-500 disabled:opacity-50 font-medium",children:[X.isPending||(E==null?void 0:E.mergeStatus)==="merging"?a.jsx(ye,{className:"w-3 h-3 animate-spin"}):a.jsx(Yr,{className:"w-3 h-3"}),(E==null?void 0:E.mergeStatus)==="merging"?"MERGING...":"MERGE"]}),(E==null?void 0:E.mergeStatus)==="merged"&&a.jsxs("span",{className:"flex items-center gap-1 px-2 py-1 text-xs bg-green-900/30 text-green-400 rounded font-medium",children:[a.jsx(Yr,{className:"w-3 h-3"}),"MERGED"]}),a.jsxs("button",{"data-testid":"sync-with-main-btn",onClick:Nt,disabled:he.isPending,title:(((on=e==null?void 0:e.git)==null?void 0:on.uncommittedFiles)??0)>0?"Will auto-commit changes before syncing with main":"Sync latest main into this workspace",className:"flex items-center gap-1 px-2 py-1 text-xs bg-surface-overlay/50 text-content-subtle rounded hover:bg-surface-overlay hover:text-content disabled:opacity-50 disabled:cursor-not-allowed",children:[he.isPending?a.jsx(ye,{className:"w-3 h-3 animate-spin"}):a.jsx(Nm,{className:"w-3 h-3"}),he.isPending?"Syncing...":"Sync with Main"]}),a.jsxs("button",{"data-testid":"review-test-btn",onClick:tt,disabled:z.isPending||(E==null?void 0:E.reviewStatus)==="reviewing"||(E==null?void 0:E.testStatus)==="testing",className:`flex items-center gap-1 px-2 py-1 text-xs rounded disabled:opacity-50 ${E!=null&&E.readyForMerge?"bg-surface-overlay/50 text-content-body hover:bg-surface-overlay":"bg-blue-900/30 text-blue-400 hover:bg-blue-900/50"}`,children:[z.isPending||(E==null?void 0:E.reviewStatus)==="reviewing"||(E==null?void 0:E.testStatus)==="testing"?a.jsx(ye,{className:"w-3 h-3 animate-spin"}):a.jsx(us,{className:"w-3 h-3"}),E!=null&&E.readyForMerge?"Re-Review":"Review & Test"]}),e&&e.status!=="stopped"&&a.jsxs("button",{onClick:ve,disabled:hr.isPending,className:"flex items-center gap-1 px-2 py-1 text-xs bg-red-900/30 text-red-400 rounded hover:bg-red-900/50",children:[a.jsx(tc,{className:"w-3 h-3"}),"Stop Agent"]}),a.jsxs("button",{onClick:jt,disabled:re.isPending,className:"flex items-center gap-1 px-2 py-1 text-xs bg-orange-900/30 text-orange-400 rounded hover:bg-orange-900/50 disabled:opacity-50",children:[re.isPending?a.jsx(ye,{className:"w-3 h-3 animate-spin"}):a.jsx(bs,{className:"w-3 h-3"}),"Close (No Merge)"]}),E&&(E.reviewStatus==="passed"||E.reviewStatus==="failed"||E.reviewStatus==="blocked"||E.testStatus==="passed"||E.testStatus==="failed"||E.mergeStatus==="merged")&&a.jsxs("button",{"data-testid":"reopen-btn",onClick:Kt,disabled:ie.isPending,className:"flex items-center gap-1 px-2 py-1 text-xs bg-purple-900/30 text-purple-400 rounded hover:bg-purple-900/50 disabled:opacity-50",children:[ie.isPending?a.jsx(ye,{className:"w-3 h-3 animate-spin"}):a.jsx(us,{className:"w-3 h-3"}),ie.isPending?"Reopening...":"Reopen"]}),E&&(E.reviewStatus!=="pending"||E.testStatus!=="pending")&&a.jsxs("button",{onClick:Ln,disabled:de.isPending,className:"flex items-center gap-1 px-2 py-1 text-xs bg-amber-900/30 text-amber-400 rounded hover:bg-amber-900/50 disabled:opacity-50",children:[de.isPending?a.jsx(ye,{className:"w-3 h-3 animate-spin"}):a.jsx(Cc,{className:"w-3 h-3"}),de.isPending?"Resetting...":"Reset Reviews"]}),(!e||e.status==="stopped")&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>D.mutate(),disabled:D.isPending||D.isSuccess,className:"flex items-center gap-1 px-2 py-1 text-xs bg-blue-600 text-content rounded hover:bg-blue-500 disabled:opacity-50 font-medium",children:[D.isPending?a.jsx(ye,{className:"w-3 h-3 animate-spin"}):D.isSuccess?a.jsx(El,{className:"w-3 h-3"}):a.jsx(Rn,{className:"w-3 h-3"}),D.isPending?"Starting...":D.isSuccess?"Started!":"Start Agent"]}),!(j!=null&&j.exists)&&a.jsxs("button",{onClick:()=>H.mutate(),disabled:H.isPending||H.isSuccess,className:"flex items-center gap-1 px-2 py-1 text-xs bg-surface-overlay text-content rounded hover:bg-surface-emphasis disabled:opacity-50 border border-divider-strong",children:[H.isPending||H.isSuccess?a.jsx(ye,{className:"w-3 h-3 animate-spin"}):a.jsx(m0,{className:"w-3 h-3"}),H.isPending?"Creating...":H.isSuccess?"Setting up...":"Create Workspace"]})]})]}),z.isError&&a.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:z.error instanceof Error?z.error.message:"Failed to start review"}),X.isError&&a.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:X.error instanceof Error?X.error.message:"Failed to merge"}),re.isError&&a.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:re.error instanceof Error?re.error.message:"Failed to close"}),he.isError&&a.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:he.error instanceof Error?he.error.message:"Sync with main failed"}),he.isSuccess&&he.data&&a.jsx("div",{className:"text-xs text-green-400 bg-green-900/20 px-2 py-1 rounded mt-2",children:he.data.alreadyUpToDate?"Already up to date with main":`Synced ${he.data.commitCount??0} commit(s) from main`})]}),a.jsx("div",{className:"flex-1"})]}),a.jsx("div",{className:"flex-1 flex flex-col min-w-0 min-h-0 overflow-hidden",children:e?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-divider",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>p("logs"),className:`px-2 py-1 text-xs rounded transition-colors ${d==="logs"?"bg-surface-overlay text-content":"text-content-subtle hover:text-content"}`,children:"Logs"}),a.jsx("button",{onClick:()=>p("status"),className:`px-2 py-1 text-xs rounded transition-colors ${d==="status"?"bg-surface-overlay text-content":"text-content-subtle hover:text-content"}`,children:"Status"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>R(),className:"p-1 text-content-subtle hover:text-content",title:"Refresh",children:a.jsx(us,{className:"w-3.5 h-3.5"})}),a.jsx("button",{onClick:s,className:"p-1 text-content-subtle hover:text-content",children:a.jsx(mt,{className:"w-3.5 h-3.5"})})]})]}),d==="logs"?a.jsxs(a.Fragment,{children:[a.jsxs("pre",{ref:f,onScroll:Z,className:"flex-1 min-h-0 overflow-auto p-3 bg-surface text-content font-mono text-xs leading-relaxed m-0 whitespace-pre",children:[S||(e.status==="stopped"?"No saved output available.":"Connecting to agent..."),a.jsx("div",{ref:m})]}),e.status!=="stopped"&&a.jsx("div",{className:"p-2 border-t border-divider bg-surface-raised",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"text",value:l,onChange:V=>c(V.target.value),onKeyDown:V=>V.key==="Enter"&&pe(),placeholder:"Send message to agent...",className:"flex-1 px-3 py-2 bg-surface-overlay border border-divider-strong rounded text-sm text-content placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500"}),a.jsxs("button",{onClick:pe,disabled:!l.trim()||Es.isPending,className:"px-3 py-2 bg-blue-600 text-content rounded text-sm font-medium hover:bg-blue-500 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[a.jsx(pk,{className:"w-4 h-4"}),"Send"]})]})})]}):a.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 bg-surface",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium text-content mb-2",children:"Agent Summary"}),a.jsxs("div",{className:"text-xs text-content-body space-y-1",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Issue:"})," ",e.issueId]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Session:"})," ",a.jsx("span",{className:"font-mono text-[10px]",children:e.id})]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Model:"})," ",Su(e.model)]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Runtime:"})," ",e.runtime]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Started:"})," ",Ee==null?void 0:Ee.toLocaleString()]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Uptime:"})," ",Rr]})]})]}),e.workspace&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium text-content mb-2",children:"Workspace"}),a.jsx("div",{className:"text-xs text-content-body space-y-1",children:a.jsx("p",{className:"font-mono text-[10px] break-all",children:e.workspace})})]}),e.git&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium text-content mb-2",children:"Git Status"}),a.jsxs("div",{className:"text-xs text-content-body space-y-1",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Branch:"})," ",a.jsx("span",{className:"font-mono",children:e.git.branch})]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Uncommitted:"})," ",e.git.uncommittedFiles," files"]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Latest:"})," ",e.git.latestCommit]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium text-content mb-2",children:"Health"}),a.jsxs("div",{className:"text-xs text-content-body space-y-1",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Status:"})," ",a.jsx("span",{className:"text-green-400",children:e.status})]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Consecutive Failures:"})," ",e.consecutiveFailures]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Total Restarts:"})," ",e.killCount]})]})]})]})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-divider",children:[a.jsx("span",{className:"text-xs text-content-subtle",children:"Issue Details"}),a.jsx("button",{onClick:s,className:"p-1 text-content-subtle hover:text-content",children:a.jsx(mt,{className:"w-3.5 h-3.5"})})]}),a.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 bg-surface",children:[r&&a.jsx("h2",{className:"text-lg font-medium text-content mb-4",children:r.title}),r&&a.jsxs("div",{className:"space-y-3 mb-6",children:[r.assignee&&a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(qv,{className:"w-4 h-4 text-content-subtle"}),a.jsx("span",{className:"text-content-body",children:r.assignee.name}),r.assignee.email&&a.jsx("span",{className:"text-content-muted text-xs",children:r.assignee.email})]}),r.labels.length>0&&a.jsxs("div",{className:"flex items-center gap-2 text-sm flex-wrap",children:[a.jsx(Wv,{className:"w-4 h-4 text-content-subtle shrink-0"}),r.labels.map(V=>a.jsx("span",{className:"px-2 py-0.5 bg-surface-overlay text-content-body text-xs rounded",children:V},V))]}),a.jsxs("div",{className:"flex items-center gap-2 text-sm text-content-subtle",children:[a.jsx(yR,{className:"w-4 h-4"}),a.jsxs("span",{children:["Updated ",new Date(r.updatedAt).toLocaleDateString()]})]})]}),(r==null?void 0:r.description)&&a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium text-content-subtle mb-2",children:"Description"}),a.jsx("div",{className:"text-sm text-content-body bg-surface-raised rounded p-3 max-h-64 overflow-y-auto prose prose-sm prose-invert prose-p:my-2 prose-headings:my-2 prose-ul:my-1 prose-li:my-0",children:a.jsx(Ng,{children:r.description})})]}),q&&(q.totalCost>0||(((zc=q.sessions)==null?void 0:zc.length)??0)>0)&&a.jsxs("div",{className:"mb-6",children:[a.jsxs("h3",{className:"text-sm font-medium text-content-subtle mb-2 flex items-center gap-2",children:[a.jsx(go,{className:"w-4 h-4"}),"Cost Summary"]}),a.jsxs("div",{className:"bg-surface-raised rounded p-3 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-content-subtle",children:"Total Cost"}),a.jsx("span",{className:"text-xl font-semibold text-green-400",children:il(q.totalCost)})]}),q.totalTokens>0&&a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsxs("span",{className:"text-content-muted flex items-center gap-1",children:[a.jsx(ck,{className:"w-3 h-3"}),"Total Tokens"]}),a.jsx("span",{className:"text-content-body",children:wu(q.totalTokens)})]}),Object.keys(q.byModel).length>0&&a.jsxs("div",{className:"border-t border-divider pt-2",children:[a.jsx("p",{className:"text-xs text-content-muted uppercase tracking-wider mb-2",children:"By Model"}),a.jsx("div",{className:"space-y-1",children:Object.entries(q.byModel).sort(([,V],[,ae])=>ae.cost-V.cost).map(([V,ae])=>a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsx("span",{className:"text-content-subtle truncate",title:V,children:Su(V)}),a.jsxs("div",{className:"text-right",children:[a.jsx("span",{className:"text-content-body",children:il(ae.cost)}),a.jsxs("span",{className:"text-content-muted text-xs ml-1",children:["(",wu(ae.tokens),")"]})]})]},V))})]}),q.byStage&&Object.keys(q.byStage).length>0&&a.jsxs("div",{className:"border-t border-divider pt-2",children:[a.jsx("p",{className:"text-xs text-content-muted uppercase tracking-wider mb-2",children:"By Stage"}),a.jsx("div",{className:"space-y-1",children:Object.entries(q.byStage).sort(([,V],[,ae])=>ae.cost-V.cost).map(([V,ae])=>a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsx("span",{className:"text-content-subtle truncate",title:V,children:V.charAt(0).toUpperCase()+V.slice(1)}),a.jsxs("div",{className:"text-right",children:[a.jsx("span",{className:"text-content-body",children:il(ae.cost)}),a.jsxs("span",{className:"text-content-muted text-xs ml-1",children:["(",wu(ae.tokens),")"]})]})]},V))})]})]})]}),a.jsxs("div",{className:"space-y-3 mt-6",children:[a.jsx("button",{onClick:()=>D.mutate(),disabled:D.isPending||D.isSuccess,className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-blue-600 text-content rounded-lg hover:bg-blue-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:D.isPending?a.jsxs(a.Fragment,{children:[a.jsx(ye,{className:"w-5 h-5 animate-spin"}),a.jsx("span",{className:"font-medium",children:"Starting..."})]}):D.isSuccess?a.jsxs(a.Fragment,{children:[a.jsx(El,{className:"w-5 h-5"}),a.jsx("span",{className:"font-medium",children:"Agent Started!"})]}):a.jsxs(a.Fragment,{children:[a.jsx(Rn,{className:"w-5 h-5"}),a.jsx("span",{className:"font-medium",children:j!=null&&j.exists?"Start Agent in Workspace":"Start Agent"})]})}),!(j!=null&&j.exists)&&a.jsx("button",{onClick:()=>H.mutate(),disabled:H.isPending||H.isSuccess,className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-surface-overlay text-content rounded-lg hover:bg-surface-emphasis transition-colors border border-divider-strong disabled:opacity-50 disabled:cursor-not-allowed",children:H.isPending||H.isSuccess?a.jsxs(a.Fragment,{children:[a.jsx(ye,{className:"w-5 h-5 animate-spin"}),a.jsx("span",{className:"font-medium",children:H.isPending?"Creating workspace...":"Setting up git worktree & skills..."})]}):a.jsxs(a.Fragment,{children:[a.jsx(m0,{className:"w-5 h-5"}),a.jsx("span",{className:"font-medium",children:"Create Workspace Only"})]})}),D.isError&&a.jsx("p",{className:"text-red-400 text-xs",children:"Failed to start agent. Check server logs."}),H.isError&&a.jsx("p",{className:"text-red-400 text-xs",children:"Failed to create workspace. Check server logs."})]}),a.jsxs("div",{className:"text-xs text-content-muted mt-3 space-y-1",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Start Agent:"})," ",j!=null&&j.exists?"Starts autonomous agent in existing workspace":"Creates workspace + starts autonomous agent"]}),!(j!=null&&j.exists)&&a.jsxs("p",{children:[a.jsx("strong",{children:"Create Workspace:"})," Creates git worktree for manual work"]})]})]})]})})]}),B&&a.jsxs("div",{className:"fixed z-50 bg-surface-raised border border-divider-strong rounded shadow-lg py-1 min-w-[140px]",style:{left:B.x,top:B.y},onClick:V=>V.stopPropagation(),children:[a.jsx("div",{className:"px-3 py-1 text-xs text-content-subtle border-b border-divider mb-1",children:B.containerName}),B.isRunning?a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>k.mutate({containerName:B.containerName,action:"restart"}),disabled:k.isPending,className:"w-full text-left px-3 py-1.5 text-xs text-content hover:bg-surface-overlay flex items-center gap-2 disabled:opacity-50",children:[a.jsx(us,{className:"w-3 h-3"}),"Restart"]}),a.jsxs("button",{onClick:()=>k.mutate({containerName:B.containerName,action:"stop"}),disabled:k.isPending,className:"w-full text-left px-3 py-1.5 text-xs text-red-400 hover:bg-surface-overlay flex items-center gap-2 disabled:opacity-50",children:[a.jsx(tc,{className:"w-3 h-3"}),"Stop"]}),B.containerName==="postgres"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"border-t border-divider my-1"}),a.jsxs("button",{onClick:async()=>{await o({title:"Refresh Database",message:`Drop and reload database from seed file?
592
-
593
- This will:
594
- - Stop the API container
595
- - Drop the existing database
596
- - Reload from seed-cleaned.sql
597
- - Restart the API
598
-
599
- All workspace data will be replaced.`,variant:"destructive",confirmLabel:"Refresh DB"})&&(yn.mutate(),O(null))},disabled:yn.isPending,className:"w-full text-left px-3 py-1.5 text-xs text-amber-400 hover:bg-surface-overlay flex items-center gap-2 disabled:opacity-50",children:[a.jsx(km,{className:"w-3 h-3"}),yn.isPending?"Refreshing DB...":"Refresh DB"]})]})]}):a.jsxs("button",{onClick:()=>k.mutate({containerName:B.containerName,action:"start"}),disabled:k.isPending,className:"w-full text-left px-3 py-1.5 text-xs text-green-400 hover:bg-surface-overlay flex items-center gap-2 disabled:opacity-50",children:[a.jsx(Rn,{className:"w-3 h-3"}),"Start"]}),k.isError&&a.jsx("div",{className:"px-3 py-1 text-xs text-red-400 border-t border-divider mt-1",children:k.error instanceof Error?k.error.message:"Action failed"})]}),w&&a.jsx(mx,{issueId:t,isOpen:w,onClose:()=>C(!1)}),y&&$&&a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50",onClick:()=>_(!1),children:a.jsxs("div",{className:"border border-divider rounded-lg shadow-xl w-[700px] max-h-[80vh] flex flex-col",style:{backgroundColor:"#1a1d23"},onClick:V=>V.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-divider",children:[a.jsxs("h2",{className:"text-sm font-medium text-content",children:["PRD — ",t.toUpperCase()]}),a.jsx("button",{onClick:()=>_(!1),className:"text-content-muted hover:text-content",children:a.jsx(mt,{size:18})})]}),a.jsx("div",{className:"overflow-y-auto px-4 py-3 text-xs prose prose-invert prose-sm max-w-none",children:a.jsx(Ng,{children:$})})]})})]})}async function eF(){const e=await fetch("/api/activity");if(!e.ok)throw new Error("Failed to fetch activity");return e.json()}function tF({status:e}){switch(e){case"running":return a.jsx(ye,{className:"w-4 h-4 text-blue-400 animate-spin"});case"completed":return a.jsx(Yr,{className:"w-4 h-4 text-green-400"});case"failed":return a.jsx(bs,{className:"w-4 h-4 text-red-400"})}}function nF(e){return new Date(e).toLocaleTimeString()}function rF({onClose:e}){const{data:t,isLoading:n}=ue({queryKey:["activity"],queryFn:eF,refetchInterval:2e3});return a.jsxs("div",{className:"flex flex-col h-full bg-surface-raised border-l border-divider",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-divider flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ao,{className:"w-5 h-5 text-blue-400"}),a.jsx("h2",{className:"font-medium text-content",children:"Activity Log"})]}),a.jsx("button",{onClick:e,className:"text-content-subtle hover:text-content p-1",children:a.jsx(mt,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:n?a.jsx("div",{className:"flex items-center justify-center h-32 text-content-subtle",children:a.jsx(ye,{className:"w-6 h-6 animate-spin"})}):!t||t.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-content-muted",children:[a.jsx(ao,{className:"w-8 h-8 mb-2 opacity-50"}),a.jsx("p",{className:"text-sm",children:"No activity yet"}),a.jsx("p",{className:"text-xs mt-1",children:"Start an agent or create a workspace to see output here"})]}):a.jsx("div",{className:"divide-y divide-gray-700",children:t.map(r=>a.jsxs("div",{className:"p-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(tF,{status:r.status}),a.jsx("code",{className:"text-sm text-content font-mono flex-1 truncate",children:r.command}),a.jsx("span",{className:"text-xs text-content-muted",children:nF(r.timestamp)})]}),a.jsx("pre",{className:"bg-surface rounded p-2 text-xs text-content-body font-mono overflow-x-auto max-h-96 overflow-y-auto",children:r.output.length>0?r.output.join(`
600
- `):r.status==="running"?"Waiting for output...":"No output"}),a.jsx("div",{className:"mt-2 flex items-center gap-2",children:a.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${r.status==="running"?"bg-blue-900/50 text-blue-400":r.status==="completed"?"bg-green-900/50 text-green-400":"bg-red-900/50 text-red-400"}`,children:r.status})})]},r.id))})})]})}async function sF(){const e=await fetch("/api/convoys");if(!e.ok)throw new Error("Failed to fetch convoys");return(await e.json()).convoys}async function iF(e){const t=await fetch(`/api/convoys/${e}`);if(!t.ok)throw new Error("Failed to fetch convoy status");return t.json()}async function oF(e){const t=await fetch(`/api/convoys/${e}/output`);if(!t.ok)throw new Error("Failed to fetch convoy output");return(await t.json()).outputs}function aF(){return ue({queryKey:["convoys"],queryFn:sF,refetchInterval:5e3})}function lF(e){return ue({queryKey:["convoy",e],queryFn:()=>iF(e),enabled:!!e,refetchInterval:2e3})}function cF(e){return ue({queryKey:["convoy-output",e],queryFn:()=>oF(e),enabled:!!e,refetchInterval:5e3})}function R2({status:e}){switch(e){case"running":return a.jsx(ye,{className:"w-4 h-4 text-blue-400 animate-spin"});case"completed":return a.jsx(Yr,{className:"w-4 h-4 text-green-400"});case"failed":return a.jsx(bs,{className:"w-4 h-4 text-red-400"});case"partial":return a.jsx(so,{className:"w-4 h-4 text-yellow-400"})}}function uF({status:e}){const t={pending:"bg-surface/50 text-content-subtle",running:"bg-blue-900/50 text-blue-400",completed:"bg-green-900/50 text-green-400",failed:"bg-red-900/50 text-red-400"};return a.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${t[e]||t.pending}`,children:e})}function jg(e){return new Date(e).toLocaleString()}function T2(e,t){const n=new Date(e).getTime(),r=t?new Date(t).getTime():Date.now(),s=Math.floor((r-n)/1e3),i=Math.floor(s/3600),o=Math.floor(s%3600/60),l=s%60;return i>0?`${i}h ${o}m ${l}s`:o>0?`${o}m ${l}s`:`${l}s`}function dF({convoy:e}){const{data:t}=cF(e.id);return a.jsxs("div",{className:"border-t border-divider p-4 bg-surface/50",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-content-muted",children:"Template:"}),a.jsx("span",{className:"ml-2 text-content",children:e.template})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-content-muted",children:"Duration:"}),a.jsx("span",{className:"ml-2 text-content",children:T2(e.startedAt,e.completedAt)})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-content-muted",children:"Output:"}),a.jsxs("a",{href:`file://${e.outputDir}`,className:"ml-2 text-blue-400 hover:text-blue-300 inline-flex items-center gap-1",children:[e.outputDir,a.jsx(Qr,{className:"w-3 h-3"})]})]}),e.context.prUrl&&a.jsxs("div",{children:[a.jsx("span",{className:"text-content-muted",children:"PR:"}),a.jsxs("a",{href:e.context.prUrl,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-blue-400 hover:text-blue-300 inline-flex items-center gap-1",children:["View PR",a.jsx(Qr,{className:"w-3 h-3"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-sm font-medium text-content mb-2",children:"Agents"}),e.agents.map(n=>a.jsxs("div",{className:"bg-surface-raised rounded p-3",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(R2,{status:n.status}),a.jsx("span",{className:"font-medium text-content",children:n.role}),a.jsxs("span",{className:"text-xs text-content-muted",children:["(",n.subagent,")"]})]}),a.jsx(uF,{status:n.status})]}),n.startedAt&&a.jsxs("div",{className:"text-xs text-content-muted mb-1",children:["Started: ",jg(n.startedAt),n.completedAt&&` • Completed: ${jg(n.completedAt)}`]}),n.status==="running"&&a.jsxs("div",{className:"text-xs text-content-muted",children:["Tmux: ",a.jsx("code",{className:"text-content-subtle",children:n.tmuxSession})]}),n.status==="completed"&&t&&t[n.role]&&a.jsx("div",{className:"mt-2",children:a.jsxs("details",{className:"text-xs",children:[a.jsx("summary",{className:"cursor-pointer text-blue-400 hover:text-blue-300",children:"View output"}),a.jsxs("pre",{className:"mt-2 bg-surface rounded p-2 text-content-body font-mono overflow-x-auto max-h-64 overflow-y-auto",children:[t[n.role].substring(0,1e3),t[n.role].length>1e3&&`
601
- ... (truncated)`]})]})})]},n.role))]})]})}function hF({onClose:e}){const{data:t,isLoading:n}=aF(),[r,s]=v.useState(null),{data:i}=lF(r||void 0),o=i||r&&(t==null?void 0:t.find(l=>l.id===r));return a.jsxs("div",{className:"flex flex-col h-full bg-surface-raised border-l border-divider",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-divider flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(nc,{className:"w-5 h-5 text-purple-400"}),a.jsx("h2",{className:"font-medium text-content",children:"Convoys"}),t&&t.length>0&&a.jsxs("span",{className:"text-xs text-content-muted",children:["(",t.length,")"]})]}),a.jsx("button",{onClick:e,className:"text-content-subtle hover:text-content p-1",children:a.jsx(mt,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:n?a.jsx("div",{className:"flex items-center justify-center h-32 text-content-subtle",children:a.jsx(ye,{className:"w-6 h-6 animate-spin"})}):!t||t.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-content-muted",children:[a.jsx(nc,{className:"w-8 h-8 mb-2 opacity-50"}),a.jsx("p",{className:"text-sm",children:"No convoys yet"}),a.jsx("p",{className:"text-xs mt-1",children:"Start a convoy to see it here"})]}):a.jsx("div",{className:"divide-y divide-gray-700",children:t.map(l=>a.jsxs("div",{className:"p-3",children:[a.jsxs("button",{onClick:()=>s(r===l.id?null:l.id),className:"w-full text-left",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(R2,{status:l.status}),a.jsx("code",{className:"text-sm text-content font-mono flex-1 truncate",children:l.id}),a.jsx("span",{className:"text-xs text-content-muted",children:T2(l.startedAt,l.completedAt)})]}),a.jsxs("div",{className:"flex items-center gap-3 text-xs text-content-subtle mb-2",children:[a.jsx("span",{className:"text-purple-400",children:l.template}),a.jsx("span",{children:"•"}),a.jsxs("span",{children:[l.agents.filter(c=>c.status==="completed").length,"/",l.agents.length," agents"]}),a.jsx("span",{children:"•"}),a.jsx("span",{children:jg(l.startedAt)})]}),a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${l.status==="running"?"bg-blue-900/50 text-blue-400":l.status==="completed"?"bg-green-900/50 text-green-400":l.status==="failed"?"bg-red-900/50 text-red-400":"bg-yellow-900/50 text-yellow-400"}`,children:l.status})})]}),r===l.id&&o&&a.jsx(dF,{convoy:o})]},l.id))})})]})}async function fF(){const e=await fetch("/api/cloister/status");if(!e.ok)throw new Error("Failed to fetch Cloister status");return e.json()}async function pF(){const e=await fetch("/api/cloister/config");if(!e.ok)throw new Error("Failed to fetch Cloister config");return e.json()}async function mF(e){if(!(await fetch("/api/cloister/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw new Error("Failed to update Cloister config")}async function gF(){if(!(await fetch("/api/cloister/start",{method:"POST"})).ok)throw new Error("Failed to start Cloister")}async function vF(){if(!(await fetch("/api/cloister/stop",{method:"POST"})).ok)throw new Error("Failed to stop Cloister")}async function xF(){const e=await fetch("/api/cloister/emergency-stop",{method:"POST"});if(!e.ok)throw new Error("Failed to execute emergency stop");return e.json()}function yF(){const[e,t]=v.useState(!1),[n,r]=v.useState(!1),[s,i]=v.useState(!1),o=rn(),{data:l,refetch:c}=ue({queryKey:["cloister-status"],queryFn:fF,refetchInterval:1e4}),{data:u}=ue({queryKey:["cloister-config"],queryFn:pF}),h=xe({mutationFn:mF,onSuccess:()=>{o.invalidateQueries({queryKey:["cloister-config"]})}}),d=async()=>{i(!0);try{l!=null&&l.running?await vF():await gF(),await c()}finally{i(!1)}},p=async()=>{await xF(),t(!1),c()},f=()=>{u&&h.mutate({startup:{auto_start:!u.startup.auto_start}})};if(!l)return null;const m=l.summary.warning>0||l.summary.stuck>0,g=l.agentsNeedingAttention.length;return a.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[a.jsx("div",{className:"flex items-center gap-1",title:l.running?"Cloister: Running":"Cloister: Stopped",children:l.running?a.jsx(sk,{className:"w-3.5 h-3.5 text-green-400"}):a.jsx(xR,{className:"w-3.5 h-3.5 text-content-muted"})}),l.running&&l.summary.total>0&&a.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[l.summary.active>0&&a.jsx("span",{className:"text-green-400",children:l.summary.active}),l.summary.warning>0&&a.jsx("span",{className:"text-orange-400",children:l.summary.warning}),l.summary.stuck>0&&a.jsx("span",{className:"text-red-400",children:l.summary.stuck})]}),m&&a.jsx("span",{title:`${g} agent${g!==1?"s":""} need attention`,children:a.jsx(tn,{className:"w-3.5 h-3.5 text-orange-400"})}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:d,disabled:s,className:`px-2 py-0.5 rounded text-xs transition-colors ${s?"bg-surface-emphasis text-content-subtle cursor-wait":l.running?"bg-surface-overlay text-content-body hover:bg-surface-emphasis":"bg-blue-600 text-content hover:bg-blue-700"}`,children:s?(l.running,"..."):l.running?"Pause":"Start"}),e?a.jsxs("div",{className:"flex items-center gap-1 px-2 py-0.5 bg-red-600/20 rounded border border-red-600/30",children:[a.jsx("span",{className:"text-xs text-red-300",children:"Kill all?"}),a.jsx("button",{onClick:p,className:"px-1.5 py-0.5 rounded text-xs bg-red-600 text-content hover:bg-red-700",children:"Yes"}),a.jsx("button",{onClick:()=>t(!1),className:"px-1.5 py-0.5 rounded text-xs bg-surface-overlay text-content-body hover:bg-surface-emphasis",children:"No"})]}):a.jsx("button",{onClick:()=>t(!0),className:"p-1 rounded text-xs bg-red-600/20 text-red-400 border border-red-600/30 hover:bg-red-600/30 transition-colors",title:"Emergency stop - kill all agents",children:a.jsx(bR,{className:"w-3.5 h-3.5"})}),a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>r(!n),className:`p-1 rounded text-xs transition-colors ${n?"bg-surface-emphasis text-content":"bg-surface-overlay text-content-body hover:bg-surface-emphasis"}`,title:"Cloister settings",children:a.jsx(mk,{className:"w-3.5 h-3.5"})}),n&&a.jsx("div",{className:"absolute right-0 top-full mt-2 w-56 bg-surface-raised border border-divider rounded-lg shadow-lg z-50",children:a.jsxs("div",{className:"p-3",children:[a.jsx("div",{className:"text-xs text-content-subtle font-medium mb-2",children:"Settings"}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer hover:bg-surface-overlay/50 rounded px-2 py-1.5 -mx-2",children:[a.jsx("input",{type:"checkbox",checked:(u==null?void 0:u.startup.auto_start)??!0,onChange:f,disabled:h.isPending,className:"w-4 h-4 rounded border-divider-strong bg-surface-overlay text-blue-500 focus:ring-blue-500 focus:ring-offset-gray-800"}),a.jsx("span",{className:"text-sm text-content-body",children:"Auto-start on dashboard launch"})]})]})})]})]})]})}function Db(e){const t=new Date(e),n=t.toLocaleString("default",{month:"short"}),r=t.getDate(),s=t.getHours().toString().padStart(2,"0"),i=t.getMinutes().toString().padStart(2,"0"),o=t.getSeconds().toString().padStart(2,"0");return`${n} ${r}, ${s}:${i}:${o}`}async function _F(e=50){const t=await fetch(`/api/handoffs?limit=${e}`);if(!t.ok)throw new Error("Failed to fetch handoffs");return t.json()}async function bF(){const e=await fetch("/api/handoffs/stats");if(!e.ok)throw new Error("Failed to fetch handoff stats");return e.json()}async function wF(e=50){const t=await fetch(`/api/specialist-handoffs?limit=${e}`);if(!t.ok)throw new Error("Failed to fetch specialist handoffs");return t.json()}async function SF(){const e=await fetch("/api/specialist-handoffs/stats");if(!e.ok)throw new Error("Failed to fetch specialist handoff stats");return e.json()}const Mb={opus:"text-purple-400 bg-purple-900/20 border-purple-500/30",sonnet:"text-blue-400 bg-blue-900/20 border-blue-500/30",haiku:"text-green-400 bg-green-900/20 border-green-500/30"},kF={stuck_escalation:"Stuck Escalation",test_failure:"Test Failure",task_complete:"Task Complete",manual:"Manual"},CF={stuck_escalation:"text-red-400",test_failure:"text-orange-400",task_complete:"text-blue-400",manual:"text-content-subtle"},Lb={"review-agent":"text-purple-400 bg-purple-900/20 border-purple-500/30","test-agent":"text-green-400 bg-green-900/20 border-green-500/30","merge-agent":"text-blue-400 bg-blue-900/20 border-blue-500/30","issue-agent":"text-cyan-400 bg-cyan-900/20 border-cyan-500/30"},NF={queued:"text-yellow-400",processing:"text-blue-400",completed:"text-green-400",failed:"text-red-400"},jF={urgent:"text-red-400",high:"text-orange-400",normal:"text-blue-400",low:"text-content-subtle"};function EF(){var c,u,h,d,p;const{data:e,isLoading:t}=ue({queryKey:["handoffs"],queryFn:()=>_F(50),refetchInterval:1e4}),{data:n,isLoading:r}=ue({queryKey:["handoff-stats"],queryFn:bF,refetchInterval:3e4}),{data:s,isLoading:i}=ue({queryKey:["specialist-handoffs"],queryFn:()=>wF(50),refetchInterval:1e4}),{data:o,isLoading:l}=ue({queryKey:["specialist-handoff-stats"],queryFn:SF,refetchInterval:3e4});return t||r||i||l?a.jsx("div",{className:"p-6",children:a.jsx("div",{className:"text-content-subtle",children:"Loading handoff data..."})}):a.jsxs("div",{className:"p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-bold text-content mb-2",children:"Model Handoffs"}),a.jsx("p",{className:"text-content-subtle",children:"History of automatic and manual model handoffs across agents"})]}),n&&a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[a.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Total Handoffs"}),a.jsx("div",{className:"text-2xl font-bold text-content",children:n.totalHandoffs})]}),a.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[a.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Success Rate"}),a.jsxs("div",{className:"text-2xl font-bold text-green-400",children:[(n.successRate*100).toFixed(0),"%"]})]}),a.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[a.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Most Common Trigger"}),a.jsx("div",{className:"text-sm font-medium text-content",children:((c=Object.entries(n.byTrigger).sort((f,m)=>m[1]-f[1])[0])==null?void 0:c[0])||"N/A"}),a.jsxs("div",{className:"text-xs text-content-muted",children:[((u=Object.entries(n.byTrigger).sort((f,m)=>m[1]-f[1])[0])==null?void 0:u[1])||0," times"]})]}),a.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[a.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Most Popular Target"}),a.jsx("div",{className:"text-sm font-medium text-content",children:((h=Object.entries(n.byModel.to).sort((f,m)=>m[1]-f[1])[0])==null?void 0:h[0])||"N/A"}),a.jsxs("div",{className:"text-xs text-content-muted",children:[((d=Object.entries(n.byModel.to).sort((f,m)=>m[1]-f[1])[0])==null?void 0:d[1])||0," handoffs"]})]})]}),a.jsxs("div",{className:"bg-surface-raised rounded-lg border border-divider overflow-hidden",children:[a.jsx("div",{className:"p-4 border-b border-divider",children:a.jsx("h3",{className:"text-lg font-semibold text-content",children:"Recent Handoffs"})}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-gray-750 text-left text-sm text-content-subtle",children:[a.jsx("th",{className:"px-4 py-3",children:"Timestamp"}),a.jsx("th",{className:"px-4 py-3",children:"Agent"}),a.jsx("th",{className:"px-4 py-3",children:"Transition"}),a.jsx("th",{className:"px-4 py-3",children:"Trigger"}),a.jsx("th",{className:"px-4 py-3",children:"Reason"}),a.jsx("th",{className:"px-4 py-3",children:"Cost"}),a.jsx("th",{className:"px-4 py-3",children:"Status"})]})}),a.jsx("tbody",{className:"text-sm",children:e&&e.handoffs.length>0?e.handoffs.map((f,m)=>a.jsxs("tr",{className:"border-t border-divider hover:bg-gray-750",children:[a.jsx("td",{className:"px-4 py-3 text-content-subtle",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(wa,{className:"w-3 h-3"}),Db(f.timestamp)]})}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("div",{className:"font-medium text-content",children:f.agentId}),a.jsx("div",{className:"text-xs text-content-muted",children:f.issueId})]}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`px-2 py-0.5 text-xs rounded border ${Mb[f.from.model]||"text-content-subtle bg-surface-overlay"}`,children:f.from.model}),a.jsx(wm,{className:"w-3 h-3 text-content-muted"}),a.jsx("span",{className:`px-2 py-0.5 text-xs rounded border ${Mb[f.to.model]||"text-content-subtle bg-surface-overlay"}`,children:f.to.model})]})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`text-xs ${CF[f.trigger]||"text-content-subtle"}`,children:kF[f.trigger]||f.trigger})}),a.jsx("td",{className:"px-4 py-3 text-content-body max-w-xs truncate",children:f.reason}),a.jsx("td",{className:"px-4 py-3 text-emerald-400",children:f.context.costAtHandoff!==void 0?`$${f.context.costAtHandoff.toFixed(4)}`:"-"}),a.jsx("td",{className:"px-4 py-3",children:f.success?a.jsx("span",{className:"text-green-400 text-xs",children:"✓ Success"}):a.jsx("span",{className:"text-red-400 text-xs",title:f.errorMessage,children:"✗ Failed"})})]},`${f.timestamp}-${m}`)):a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"px-4 py-8 text-center text-content-muted",children:"No handoffs recorded yet"})})})]})})]}),a.jsxs("div",{className:"mt-12",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("h2",{className:"text-2xl font-bold text-content mb-2",children:"Specialist Handoffs"}),a.jsx("p",{className:"text-content-subtle",children:"Queue-based work handoffs between specialist agents (review, test, merge)"})]}),o&&a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[a.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Today's Handoffs"}),a.jsx("div",{className:"text-2xl font-bold text-content",children:o.todayCount})]}),a.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[a.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Queue Depth"}),a.jsx("div",{className:"text-2xl font-bold text-orange-400",children:o.queueDepth})]}),a.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[a.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Success Rate"}),a.jsxs("div",{className:"text-2xl font-bold text-green-400",children:[(o.successRate*100).toFixed(0),"%"]})]}),a.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[a.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Most Active"}),a.jsx("div",{className:"text-sm font-medium text-content",children:((p=Object.entries(o.bySpecialist).map(([f,m])=>({name:f,total:m.sent+m.received})).sort((f,m)=>m.total-f.total)[0])==null?void 0:p.name)||"N/A"})]})]}),a.jsxs("div",{className:"bg-surface-raised rounded-lg border border-divider overflow-hidden mt-6",children:[a.jsx("div",{className:"p-4 border-b border-divider",children:a.jsx("h3",{className:"text-lg font-semibold text-content",children:"Recent Specialist Handoffs"})}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-gray-750 text-left text-sm text-content-subtle",children:[a.jsx("th",{className:"px-4 py-3",children:"Timestamp"}),a.jsx("th",{className:"px-4 py-3",children:"Issue"}),a.jsx("th",{className:"px-4 py-3",children:"Transition"}),a.jsx("th",{className:"px-4 py-3",children:"Priority"}),a.jsx("th",{className:"px-4 py-3",children:"Status"}),a.jsx("th",{className:"px-4 py-3",children:"Workspace"})]})}),a.jsx("tbody",{className:"text-sm",children:s&&s.handoffs.length>0?s.handoffs.map(f=>{var m,g;return a.jsxs("tr",{className:"border-t border-divider hover:bg-gray-750",children:[a.jsx("td",{className:"px-4 py-3 text-content-subtle",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(wa,{className:"w-3 h-3"}),Db(f.timestamp)]})}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("div",{className:"font-medium text-content",children:f.issueId}),((m=f.context)==null?void 0:m.branch)&&a.jsx("div",{className:"text-xs text-content-muted",children:f.context.branch})]}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`px-2 py-0.5 text-xs rounded border ${Lb[f.fromSpecialist]||"text-content-subtle bg-surface-overlay"}`,children:f.fromSpecialist}),a.jsx(wm,{className:"w-3 h-3 text-content-muted"}),a.jsx("span",{className:`px-2 py-0.5 text-xs rounded border ${Lb[f.toSpecialist]||"text-content-subtle bg-surface-overlay"}`,children:f.toSpecialist})]})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`text-xs ${jF[f.priority]}`,children:f.priority})}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("span",{className:`text-xs ${NF[f.status]}`,children:f.status}),f.result&&a.jsxs("span",{className:"ml-2 text-xs text-content-muted",children:["(",f.result,")"]})]}),a.jsx("td",{className:"px-4 py-3 text-content-subtle text-xs",children:((g=f.context)==null?void 0:g.workspace)||"-"})]},f.id)}):a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-content-muted",children:"No specialist handoffs recorded yet"})})})]})})]})]})]})}function RF({request:e,isOpen:t,onConfirm:n,onDeny:r,onClose:s}){return!t||!e?null:a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg shadow-2xl w-full max-w-md mx-4",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-divider",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(tn,{className:"w-5 h-5 text-orange-400"}),a.jsx("h3",{className:"text-lg font-semibold text-content",children:"Confirmation Required"})]}),a.jsx("button",{onClick:s,className:"text-content-subtle hover:text-content-body transition-colors",children:a.jsx(mt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-4 space-y-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-content-subtle mb-1",children:"Agent:"}),a.jsx("p",{className:"text-base text-content font-medium",children:e.agentId})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-content-subtle mb-1",children:"Action:"}),a.jsx("p",{className:"text-base text-content font-medium",children:e.action})]}),e.details&&a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-content-subtle mb-1",children:"Details:"}),a.jsx("p",{className:"text-sm text-content-body bg-surface/50 p-2 rounded border border-divider",children:e.details})]}),a.jsx("div",{className:"mt-4 p-3 bg-orange-500/10 border border-orange-500/30 rounded",children:a.jsx("p",{className:"text-sm text-orange-200",children:"⚠️ This action cannot be undone. Please confirm that you want to proceed."})})]}),a.jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-divider bg-surface/30",children:[a.jsx("button",{onClick:r,className:"px-4 py-2 rounded text-sm bg-surface-overlay text-content-body hover:bg-surface-emphasis transition-colors",children:"Deny"}),a.jsx("button",{onClick:n,className:"px-4 py-2 rounded text-sm bg-orange-600 text-content hover:bg-orange-700 transition-colors font-medium",children:"Confirm"})]})]})})}async function TF(){const e=await fetch("/api/metrics/summary");if(!e.ok)throw new Error("Failed to fetch metrics summary");return e.json()}async function PF(){const e=await fetch("/api/handoffs/stats");if(!e.ok)throw new Error("Failed to fetch handoff stats");return e.json()}async function DF(){const e=await fetch("/api/specialist-handoffs/stats");if(!e.ok)throw new Error("Failed to fetch specialist handoff stats");return e.json()}function MF(){const{data:e}=ue({queryKey:["metrics-summary"],queryFn:TF,refetchInterval:3e4}),{data:t}=ue({queryKey:["handoff-stats"],queryFn:PF,refetchInterval:3e4}),{data:n}=ue({queryKey:["specialist-handoff-stats"],queryFn:DF,refetchInterval:3e4});if(!e)return null;const r=t?Object.values(t.byTrigger).reduce((s,i)=>s+i,0):0;return a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-6",children:[a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-4",children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(go,{className:"w-5 h-5 text-green-400"}),a.jsx("span",{className:"text-sm text-content-subtle",children:"Cost Today (UTC)"})]})}),a.jsxs("div",{className:"text-2xl font-bold text-content",children:["$",e.today.totalCost.toFixed(2)]}),e.topSpenders.agents.length>0&&a.jsxs("div",{className:"mt-2 text-xs text-content-muted",children:["Top: ",e.topSpenders.agents[0].agentId," ($",e.topSpenders.agents[0].cost.toFixed(2),")"]})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-4",children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(nc,{className:"w-5 h-5 text-blue-400"}),a.jsx("span",{className:"text-sm text-content-subtle",children:"Agents"})]})}),a.jsxs("div",{className:"text-2xl font-bold text-content",children:[e.today.activeCount," / ",e.today.agentCount]}),a.jsxs("div",{className:"mt-2 text-xs text-content-muted",children:[e.today.activeCount," active, ",e.today.agentCount-e.today.activeCount," ","idle"]})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-4",children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(tn,{className:"w-5 h-5 text-red-400"}),a.jsx("span",{className:"text-sm text-content-subtle",children:"Stuck Agents"})]})}),a.jsx("div",{className:"text-2xl font-bold text-content",children:e.today.stuckCount}),a.jsxs("div",{className:"mt-2 text-xs text-content-muted",children:[e.today.warningCount," warnings"]})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-4",children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(uk,{className:"w-5 h-5 text-cyan-400"}),a.jsx("span",{className:"text-sm text-content-subtle",children:"Specialist Handoffs"})]})}),a.jsx("div",{className:"text-2xl font-bold text-content",children:(n==null?void 0:n.todayCount)??0}),a.jsx("div",{className:"mt-2 text-xs text-content-muted",children:n?`${(n.successRate*100).toFixed(0)}% success rate`:"No data"})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-4",children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Uv,{className:"w-5 h-5 text-purple-400"}),a.jsx("span",{className:"text-sm text-content-subtle",children:"Cost Escalations"})]})}),a.jsx("div",{className:"text-2xl font-bold text-content",children:r}),a.jsx("div",{className:"mt-2 text-xs text-content-muted",children:t?`${(t.successRate*100).toFixed(0)}% success rate`:"No data"})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-4",children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(hk,{className:"w-5 h-5 text-orange-400"}),a.jsx("span",{className:"text-sm text-content-subtle",children:"Queue Depth"})]})}),a.jsx("div",{className:"text-2xl font-bold text-content",children:(n==null?void 0:n.queueDepth)??0}),a.jsx("div",{className:"mt-2 text-xs text-content-muted",children:(n==null?void 0:n.queueDepth)===0?"All clear":`${n==null?void 0:n.queueDepth} pending`})]})]})}async function LF(){const e=await fetch("/api/metrics/summary");if(!e.ok)throw new Error("Failed to fetch metrics summary");return e.json()}async function AF(){const e=await fetch("/api/metrics/costs");if(!e.ok)throw new Error("Failed to fetch cost metrics");return e.json()}function OF(){const{data:e}=ue({queryKey:["metrics-summary"],queryFn:LF,refetchInterval:3e4}),{data:t}=ue({queryKey:["metrics-costs"],queryFn:AF,refetchInterval:3e4});return a.jsxs("div",{className:"p-6 overflow-auto h-full",children:[a.jsx("h1",{className:"text-3xl font-bold text-content mb-6",children:"Metrics Dashboard"}),e&&a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx(go,{className:"w-6 h-6 text-green-400"}),a.jsx("h3",{className:"text-lg font-semibold text-content",children:"Cost Today (UTC)"})]}),a.jsxs("div",{className:"text-3xl font-bold text-content mb-2",children:["$",e.today.totalCost.toFixed(2)]}),a.jsx("div",{className:"text-sm text-content-subtle",children:"Daily total"})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx(Uv,{className:"w-6 h-6 text-blue-400"}),a.jsx("h3",{className:"text-lg font-semibold text-content",children:"Active Agents"})]}),a.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:e.today.activeCount}),a.jsxs("div",{className:"text-sm text-content-subtle",children:["of ",e.today.agentCount," total"]})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx(tn,{className:"w-6 h-6 text-red-400"}),a.jsx("h3",{className:"text-lg font-semibold text-content",children:"Stuck Agents"})]}),a.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:e.today.stuckCount}),a.jsxs("div",{className:"text-sm text-content-subtle",children:[e.today.warningCount," warnings"]})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx(zv,{className:"w-6 h-6 text-purple-400"}),a.jsx("h3",{className:"text-lg font-semibold text-content",children:"Handoffs Today"})]}),a.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:"-"}),a.jsx("div",{className:"text-sm text-content-subtle",children:"Coming soon"})]})]}),t&&a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 mb-8",children:[a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[a.jsx("h3",{className:"text-xl font-semibold text-content mb-4",children:"Top Agents by Cost"}),a.jsxs("div",{className:"space-y-3",children:[t.topAgents.slice(0,10).map((n,r)=>a.jsxs("div",{className:"flex items-center justify-between p-3 bg-surface/50 rounded",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("span",{className:"text-lg font-bold text-content-muted",children:["#",r+1]}),a.jsx("span",{className:"text-content font-mono text-sm",children:n.agentId})]}),a.jsxs("span",{className:"text-green-400 font-semibold",children:["$",n.cost.toFixed(2)]})]},n.agentId)),t.topAgents.length===0&&a.jsx("div",{className:"text-center text-content-muted py-8",children:"No cost data yet"})]})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[a.jsx("h3",{className:"text-xl font-semibold text-content mb-4",children:"Top Issues by Cost"}),a.jsxs("div",{className:"space-y-3",children:[t.topIssues.slice(0,10).map((n,r)=>a.jsxs("div",{className:"flex items-center justify-between p-3 bg-surface/50 rounded",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("span",{className:"text-lg font-bold text-content-muted",children:["#",r+1]}),a.jsx("span",{className:"text-content font-mono text-sm",children:n.issueId})]}),a.jsxs("span",{className:"text-green-400 font-semibold",children:["$",n.cost.toFixed(2)]})]},n.issueId)),t.topIssues.length===0&&a.jsx("div",{className:"text-center text-content-muted py-8",children:"No cost data yet"})]})]})]}),a.jsxs("div",{className:"mb-8",children:[a.jsx("h2",{className:"text-xl font-semibold text-content mb-4",children:"Services"}),a.jsx(KC,{})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[a.jsx("h3",{className:"text-xl font-semibold text-content mb-4",children:"Historical Trends"}),a.jsxs("div",{className:"text-center text-content-muted py-16",children:[a.jsx("p",{className:"mb-2",children:"Charts coming soon"}),a.jsx("p",{className:"text-sm",children:"Cost over time, handoff success rates, and more"})]})]})]})}async function IF(){const e=await fetch("/api/costs/by-issue");if(!e.ok)throw new Error("Failed to fetch costs");return e.json()}function BF(){const[e,t]=v.useState(null),{data:n,isLoading:r}=ue({queryKey:["costs-by-issue"],queryFn:IF,refetchInterval:1e4});if(r)return a.jsx("div",{className:"p-6 h-full flex items-center justify-center",children:a.jsx("div",{className:"text-content-subtle",children:"Loading costs..."})});if(!n)return a.jsx("div",{className:"p-6 h-full flex items-center justify-center",children:a.jsx("div",{className:"text-red-400",children:"Failed to load costs"})});const s=n.issues.reduce((c,u)=>c+u.totalCost,0),i=n.issues.filter(c=>c.budget),o=i.filter(c=>c.totalCost>(c.budget||0)),l=e?n.issues.find(c=>c.issueId===e):null;return a.jsxs("div",{className:"p-6 overflow-auto h-full",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h1",{className:"text-3xl font-bold text-content",children:"Cost Tracking"}),a.jsx("div",{className:"flex items-center gap-3",children:a.jsx("div",{className:`px-3 py-1 rounded text-sm ${n.status==="live"?"bg-green-900/30 text-green-400":n.status==="migrating"?"bg-yellow-900/30 text-yellow-400":"bg-red-900/30 text-red-400"}`,children:n.status==="live"?"● Live":n.status==="migrating"?"⟳ Migrating":"⚠ Stale"})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx(go,{className:"w-6 h-6 text-green-400"}),a.jsx("h3",{className:"text-lg font-semibold text-content",children:"Total Cost"})]}),a.jsxs("div",{className:"text-3xl font-bold text-content mb-2",children:["$",s.toFixed(2)]}),a.jsxs("div",{className:"text-sm text-content-subtle",children:[n.issues.length," issues tracked"]})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx(Uv,{className:"w-6 h-6 text-blue-400"}),a.jsx("h3",{className:"text-lg font-semibold text-content",children:"Event Count"})]}),a.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:n.eventCount.toLocaleString()}),a.jsx("div",{className:"text-sm text-content-subtle",children:"Total events logged"})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx(tn,{className:"w-6 h-6 text-yellow-400"}),a.jsx("h3",{className:"text-lg font-semibold text-content",children:"Budget Warnings"})]}),a.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:n.issues.filter(c=>c.budgetWarning).length}),a.jsxs("div",{className:"text-sm text-content-subtle",children:[i.length," with budgets"]})]}),a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx(BR,{className:"w-6 h-6 text-purple-400"}),a.jsx("h3",{className:"text-lg font-semibold text-content",children:"Over Budget"})]}),a.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:o.length}),a.jsx("div",{className:"text-sm text-content-subtle",children:"Exceeded limit"})]})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[a.jsx("h3",{className:"text-xl font-semibold text-content mb-4",children:"Costs by Issue"}),a.jsx("div",{className:"space-y-2 max-h-[600px] overflow-auto",children:n.issues.map(c=>{const u=c.budget?c.totalCost/c.budget*100:0;return a.jsxs("div",{onClick:()=>t(c.issueId),className:`p-4 rounded-lg cursor-pointer transition-colors ${e===c.issueId?"bg-blue-900/30 border border-blue-500":"bg-surface/50 hover:bg-surface"}`,children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-content font-mono font-semibold",children:c.issueId}),c.budgetWarning&&a.jsx(tn,{className:"w-4 h-4 text-yellow-400"})]}),a.jsxs("span",{className:"text-green-400 font-bold",children:["$",c.totalCost.toFixed(2)]})]}),c.budget&&a.jsxs("div",{className:"mb-2",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs text-content-subtle mb-1",children:[a.jsxs("span",{children:["Budget: $",c.budget.toFixed(2)]}),a.jsxs("span",{children:[u.toFixed(0),"%"]})]}),a.jsx("div",{className:"w-full bg-surface-overlay rounded-full h-2",children:a.jsx("div",{className:`h-2 rounded-full transition-all ${u>=100?"bg-red-500":u>=80?"bg-yellow-500":"bg-green-500"}`,style:{width:`${Math.min(u,100)}%`}})})]}),a.jsxs("div",{className:"flex items-center gap-4 text-xs text-content-subtle",children:[a.jsxs("span",{children:[c.tokenCount.toLocaleString()," tokens"]}),a.jsxs("span",{children:[Object.keys(c.models).length," models"]})]})]},c.issueId)})})]}),a.jsx("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:l?a.jsxs(a.Fragment,{children:[a.jsxs("h3",{className:"text-xl font-semibold text-content mb-4",children:[l.issueId," Details"]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h4",{className:"text-sm font-semibold text-content-subtle mb-3",children:"Token Usage"}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"bg-surface/50 rounded p-3",children:[a.jsx("div",{className:"text-xs text-content-subtle",children:"Input"}),a.jsx("div",{className:"text-lg font-semibold text-content",children:l.inputTokens.toLocaleString()})]}),a.jsxs("div",{className:"bg-surface/50 rounded p-3",children:[a.jsx("div",{className:"text-xs text-content-subtle",children:"Output"}),a.jsx("div",{className:"text-lg font-semibold text-content",children:l.outputTokens.toLocaleString()})]}),a.jsxs("div",{className:"bg-surface/50 rounded p-3",children:[a.jsx("div",{className:"text-xs text-content-subtle",children:"Cache Read"}),a.jsx("div",{className:"text-lg font-semibold text-content",children:l.cacheReadTokens.toLocaleString()})]}),a.jsxs("div",{className:"bg-surface/50 rounded p-3",children:[a.jsx("div",{className:"text-xs text-content-subtle",children:"Cache Write"}),a.jsx("div",{className:"text-lg font-semibold text-content",children:l.cacheWriteTokens.toLocaleString()})]})]})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h4",{className:"text-sm font-semibold text-content-subtle mb-3",children:"By Model"}),a.jsx("div",{className:"space-y-2",children:Object.entries(l.models).map(([c,u])=>a.jsxs("div",{className:"bg-surface/50 rounded p-3",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-sm text-content font-mono",children:c}),a.jsxs("span",{className:"text-sm text-green-400 font-semibold",children:["$",u.cost.toFixed(4)]})]}),a.jsxs("div",{className:"flex items-center gap-4 text-xs text-content-subtle",children:[a.jsxs("span",{children:[u.calls," calls"]}),a.jsxs("span",{children:[u.tokens.toLocaleString()," tokens"]})]})]},c))})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-semibold text-content-subtle mb-3",children:"By Provider"}),a.jsx("div",{className:"space-y-2",children:Object.entries(l.providers).filter(([c,u])=>u>0).map(([c,u])=>a.jsx("div",{className:"bg-surface/50 rounded p-3",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm text-content capitalize",children:c}),a.jsxs("span",{className:"text-sm text-green-400 font-semibold",children:["$",u.toFixed(4)]})]})},c))})]})]}):a.jsx("div",{className:"h-full flex items-center justify-center text-content-muted",children:"Select an issue to view details"})})]})]})}const Mx={anthropic:{name:"Anthropic",models:[{id:"claude-opus-4-6",name:"Claude Opus 4.6",icon:"diamond",tier:"premium",capabilities:["reasoning","code","vision","agentic"],description:"Most capable, best for complex tasks"},{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5",icon:"auto_awesome",tier:"balanced",capabilities:["reasoning","code","vision","agentic"],description:"Great balance of speed and capability"},{id:"claude-haiku-4-5",name:"Claude Haiku 4.5",icon:"bolt",tier:"fast",capabilities:["fast","cost-efficient","code"],description:"Fastest, ideal for simple tasks"}]},openai:{name:"OpenAI",models:[{id:"gpt-4o",name:"GPT-4o",icon:"science",tier:"balanced",capabilities:["reasoning","code","vision"],description:"Versatile multimodal model"},{id:"o1",name:"o1",icon:"psychology",tier:"premium",capabilities:["reasoning","complex-math"],description:"Deep reasoning, slower responses"},{id:"o3-mini",name:"o3-mini",icon:"bolt",tier:"fast",capabilities:["fast","reasoning","code"],description:"Fast reasoning model"}]},google:{name:"Google",models:[{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",icon:"model_training",tier:"premium",capabilities:["reasoning","large-context","code"],description:"1M context, great for large codebases"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash",icon:"bolt",tier:"fast",capabilities:["fast","cost-efficient","reasoning"],description:"Fast and affordable"}]},kimi:{name:"Kimi (Moonshot)",models:[{id:"kimi-k2",name:"Kimi K2",icon:"token",tier:"balanced",capabilities:["reasoning","code","agentic","large-context"],description:"Strong coding, 128K context"},{id:"kimi-k2.5",name:"Kimi K2.5",icon:"model_training",tier:"premium",capabilities:["reasoning","code","agentic","large-context"],description:"Best open-source coding model, 256K context"}]},zai:{name:"Zhipu (GLM)",models:[{id:"glm-4-plus",name:"GLM-4 Plus",icon:"hub",tier:"premium",capabilities:["reasoning","code"],description:"Flagship reasoning model"},{id:"glm-4-air",name:"GLM-4 Air",icon:"cloud",tier:"balanced",capabilities:["reasoning","code","efficiency"],description:"Balanced speed and quality"},{id:"glm-4-flash",name:"GLM-4 Flash",icon:"bolt",tier:"fast",capabilities:["fast","cost-efficient"],description:"Ultra-fast responses"},{id:"glm-4-long",name:"GLM-4 Long",icon:"format_list_bulleted",tier:"balanced",capabilities:["large-context","reasoning"],description:"1M token context window"}]}},Lx={"issue-agent:exploration":["reasoning","large-context"],"issue-agent:implementation":["code","reasoning","agentic"],"issue-agent:testing":["code","reasoning"],"issue-agent:documentation":["reasoning"],"issue-agent:review-response":["reasoning","code"],"specialist-review-agent":["reasoning","code"],"specialist-test-agent":["code","reasoning"],"specialist-merge-agent":["code"],"convoy:security-reviewer":["reasoning","code"],"convoy:performance-reviewer":["reasoning","code"],"convoy:correctness-reviewer":["reasoning","code"],"convoy:synthesis-agent":["reasoning"],"subagent:explore":["fast","reasoning"],"subagent:plan":["reasoning"],"subagent:bash":["fast","code"],"subagent:general-purpose":["reasoning","code"],"prd-agent":["reasoning"],"decomposition-agent":["reasoning"],"triage-agent":["fast","reasoning"],"cli:interactive":["reasoning","code"],"cli:quick-command":["fast"]},FF={"issue-agent:exploration":"Exploration Phase","issue-agent:implementation":"Implementation Phase","issue-agent:testing":"Testing Phase","issue-agent:documentation":"Documentation Phase","issue-agent:review-response":"Review Response Phase","specialist-review-agent":"Review Agent","specialist-test-agent":"Test Agent","specialist-merge-agent":"Merge Agent","convoy:security-reviewer":"Security Reviewer","convoy:performance-reviewer":"Performance Reviewer","convoy:correctness-reviewer":"Correctness Reviewer","convoy:synthesis-agent":"Synthesis Agent","subagent:explore":"Explore Subagent","subagent:plan":"Plan Subagent","subagent:bash":"Bash Subagent","subagent:general-purpose":"General Purpose Subagent","prd-agent":"PRD Agent","decomposition-agent":"Decomposition Agent","triage-agent":"Triage Agent","cli:interactive":"CLI Interactive","cli:quick-command":"CLI Quick Command"},Ks={reasoning:{name:"Reasoning",icon:"psychology",description:"Complex problem solving"},code:{name:"Code",icon:"code",description:"Code generation & analysis"},vision:{name:"Vision",icon:"visibility",description:"Image understanding"},fast:{name:"Fast",icon:"bolt",description:"Quick response times"},"cost-efficient":{name:"Cheap",icon:"savings",description:"Low token cost"},"large-context":{name:"Large Context",icon:"unfold_more",description:"100K+ token window"},"complex-math":{name:"Math",icon:"calculate",description:"Advanced mathematics"},efficiency:{name:"Efficient",icon:"eco",description:"Good value for capability"},agentic:{name:"Agentic",icon:"smart_toy",description:"Multi-step tool use"}};function zF(){return Object.values(Mx).flatMap(e=>e.models)}function P2(e){const t=zF(),n=t.find(s=>s.id===e);if(n)return n;const r=e.toLowerCase();if(r.includes("opus")&&r.includes("4"))return t.find(s=>s.id==="claude-opus-4-6");if(r.includes("sonnet")&&r.includes("4"))return t.find(s=>s.id==="claude-sonnet-4-5");if(r.includes("haiku"))return t.find(s=>s.id==="claude-haiku-4-5");if(r.includes("claude")&&!r.includes("opus")&&!r.includes("haiku"))return t.find(s=>s.id==="claude-sonnet-4-5");if(r.includes("gpt-4o")||r==="gpt4o")return t.find(s=>s.id==="gpt-4o");if(r.includes("o1")&&!r.includes("o3"))return t.find(s=>s.id==="o1");if(r.includes("o3"))return t.find(s=>s.id==="o3-mini");if(r.includes("gemini")&&r.includes("flash"))return t.find(s=>s.id==="gemini-2.5-flash");if(r.includes("gemini"))return t.find(s=>s.id==="gemini-2.5-pro");if(r.includes("kimi")||r.includes("moonshot"))return r.includes("k2.5")||r.includes("2.5")?t.find(s=>s.id==="kimi-k2.5"):t.find(s=>s.id==="kimi-k2");if(r.includes("glm")||r.includes("zhipu")||r.includes("chatglm"))return r.includes("flash")?t.find(s=>s.id==="glm-4-flash"):r.includes("air")?t.find(s=>s.id==="glm-4-air"):r.includes("long")||r.includes("1m")?t.find(s=>s.id==="glm-4-long"):t.find(s=>s.id==="glm-4-plus")}function $F(e,t){const n=P2(e),r=Lx[t]||["reasoning"];if(!n)return{score:0,matched:[],missing:r};const s=r.filter(o=>n.capabilities.includes(o)),i=r.filter(o=>!n.capabilities.includes(o));return{score:r.length>0?s.length/r.length:0,matched:s,missing:i}}function HF({workType:e,currentModel:t,isOverride:n,enabledProviders:r,onApply:s,onRemove:i,onClose:o}){const[l,c]=v.useState(t),u=FF[e]||e,h=Lx[e]||["reasoning"],d=v.useMemo(()=>Object.entries(Mx).filter(([g])=>g==="anthropic"||r.includes(g)),[r]),p=v.useMemo(()=>{let g=null;for(const[b,x]of d)for(const y of x.models){const w=y.capabilities.filter(R=>h.includes(R)).length/h.length,C=y.tier==="balanced"?.1:0,S=w+C;(!g||S>g.score)&&(g={id:y.id,score:S})}return g==null?void 0:g.id},[d,h]),f=()=>{s(l),o()},m=l!==t;return a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 backdrop-blur-sm p-4",children:[a.jsxs("div",{className:"w-full max-w-[680px] bg-surface border border-divider rounded-xl shadow-2xl flex flex-col overflow-hidden",children:[a.jsx("div",{className:"p-6 border-b border-divider",children:a.jsxs("div",{className:"flex justify-between items-start gap-3",children:[a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsx("h1",{className:"text-content tracking-tight text-2xl font-bold",children:"Select Model"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-content-muted text-sm",children:"Task:"}),a.jsx("span",{className:"text-blue-400 font-medium",children:u})]}),a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("span",{className:"text-content-muted text-xs",children:"Needs:"}),h.map(g=>a.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded bg-blue-500/20 text-blue-300 font-medium",children:Ks[g].name},g))]})]}),a.jsx("button",{onClick:o,className:"text-content-muted hover:text-content transition-colors p-1",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})}),a.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar max-h-[450px]",children:d.map(([g,b],x)=>a.jsxs("div",{className:"flex flex-col",children:[x>0&&a.jsx("div",{className:"h-px bg-divider mx-6 my-2"}),a.jsx("h3",{className:"text-content-muted text-xs font-bold uppercase tracking-widest px-6 pb-2 pt-5",children:b.name}),b.models.map(y=>{const _=l===y.id,w=y.id===p,C=y.capabilities.filter(R=>h.includes(R)),S=C.length/h.length;return a.jsxs("div",{onClick:()=>c(y.id),title:y.description,className:`group flex items-center gap-4 px-6 py-3.5 cursor-pointer transition-all border-l-2 ${_?"bg-blue-500/10 border-blue-400 shadow-[0_0_15px_rgba(59,130,246,0.1)]":w?"bg-blue-500/5 border-blue-400/50 hover:bg-blue-500/10":"border-transparent hover:bg-surface-overlay"}`,children:[a.jsx("div",{className:`flex items-center justify-center rounded-lg shrink-0 size-10 transition-colors ${_||w?"bg-blue-500/20":"bg-surface-emphasis group-hover:bg-divider"}`,children:a.jsx("span",{className:`material-symbols-outlined text-xl ${_||w?"text-blue-400":"text-content-muted"}`,children:y.icon})}),a.jsxs("div",{className:"flex flex-1 flex-col justify-center min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("p",{className:`text-content text-sm ${_?"font-bold":"font-medium"} truncate`,children:y.name}),w&&a.jsx("span",{className:"px-2 py-0.5 rounded-full bg-blue-500 text-[9px] text-content font-bold uppercase tracking-tight shrink-0",children:"Best Fit"}),y.tier==="premium"&&!w&&a.jsx("span",{className:"px-2 py-0.5 rounded-full bg-amber-500/20 text-[9px] text-amber-400 font-bold uppercase tracking-tight shrink-0",children:"Premium"}),y.tier==="fast"&&a.jsx("span",{className:"px-2 py-0.5 rounded-full bg-emerald-500/20 text-[9px] text-emerald-400 font-bold uppercase tracking-tight shrink-0",children:"Fast"})]}),a.jsx("div",{className:"flex gap-1.5 mt-1.5 flex-wrap",children:y.capabilities.map(R=>{const T=C.includes(R);return a.jsx("span",{title:Ks[R].description,className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${T?"bg-blue-500/20 text-blue-300":"bg-surface-emphasis text-content-subtle border border-divider"}`,children:Ks[R].name},R)})})]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[S===1?a.jsx("span",{className:"text-emerald-400 text-xs font-bold",children:"100%"}):S>=.5?a.jsxs("span",{className:"text-amber-400 text-xs font-bold",children:[Math.round(S*100),"%"]}):a.jsxs("span",{className:"text-content-muted text-xs font-bold",children:[Math.round(S*100),"%"]}),_&&a.jsx("span",{className:"material-symbols-outlined text-blue-400",children:"check_circle"})]})]},y.id)})]},g))}),a.jsxs("div",{className:"p-5 border-t border-divider bg-surface flex justify-between items-center",children:[a.jsx("div",{children:n&&a.jsx("button",{onClick:()=>{i(),o()},className:"text-rose-400 hover:text-rose-300 text-sm font-medium transition-colors",children:"Remove Override"})}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:o,className:"px-5 py-2 rounded-lg text-content-muted font-medium hover:text-content hover:bg-surface-overlay transition-all text-sm",children:"Cancel"}),a.jsx("button",{onClick:f,disabled:!m&&n,className:"px-6 py-2 rounded-lg bg-blue-500 text-content font-bold hover:bg-blue-400 active:scale-95 transition-all shadow-lg shadow-blue-500/20 disabled:opacity-50 disabled:cursor-not-allowed text-sm",children:"Apply Selection"})]})]})]}),a.jsx("style",{children:`
602
- .custom-scrollbar::-webkit-scrollbar {
603
- width: 4px;
604
- }
605
- .custom-scrollbar::-webkit-scrollbar-track {
606
- background: transparent;
607
- }
608
- .custom-scrollbar::-webkit-scrollbar-thumb {
609
- background: var(--color-overlay);
610
- border-radius: 10px;
611
- }
612
- .custom-scrollbar::-webkit-scrollbar-thumb:hover {
613
- background: #3b82f6;
614
- }
615
- `})]})}async function WF(){const e=await fetch("/api/settings");if(!e.ok)throw new Error("Failed to fetch settings");return e.json()}async function UF(e){const t=await fetch("/api/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.text();throw new Error(n||"Failed to save settings")}}async function qF(){const e=await fetch("/api/settings/optimal-defaults");if(!e.ok)throw new Error("Failed to fetch optimal defaults");return e.json()}async function Ab(e,t,n){const r=await fetch("/api/settings/test-api-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,apiKey:t,model:n})});if(!r.ok)throw new Error("Failed to test API key");return r.json()}const Xf=[{id:"anthropic",name:"Anthropic",icon:"deployed_code",placeholder:"sk-ant-..."},{id:"openai",name:"OpenAI",icon:"auto_awesome",placeholder:"sk-..."},{id:"google",name:"Google",icon:"cloud",placeholder:"AIza..."},{id:"kimi",name:"Kimi (Moonshot)",icon:"token",placeholder:"sk-kimi-..."},{id:"zai",name:"Zhipu (GLM)",icon:"hub",placeholder:"sk-zai-..."}],Ob=[{id:"linear",name:"Linear",icon:"view_kanban",envVar:"LINEAR_API_KEY",placeholder:"lin_api_..."},{id:"github",name:"GitHub",icon:"code",envVar:"GITHUB_TOKEN",placeholder:"ghp_..."},{id:"gitlab",name:"GitLab",icon:"commit",envVar:"GITLAB_TOKEN",placeholder:"glpat-..."},{id:"rally",name:"Rally",icon:"flag",envVar:"RALLY_API_KEY",placeholder:"_abc123..."}],KF=[{name:"Issue Agent Phases",icon:"list_alt",agents:[{id:"issue-agent:exploration",name:"Exploration",icon:"search",description:"Codebase discovery"},{id:"issue-agent:implementation",name:"Implementation",icon:"code",description:"Write the code"},{id:"issue-agent:testing",name:"Testing",icon:"science",description:"Write & run tests"},{id:"issue-agent:documentation",name:"Documentation",icon:"description",description:"Update docs"},{id:"issue-agent:review-response",name:"Review Response",icon:"reply",description:"Address PR feedback"}]},{name:"Specialist Agents",icon:"psychology",agents:[{id:"specialist-review-agent",name:"Review Agent",icon:"rate_review",description:"Automated code reviews"},{id:"specialist-test-agent",name:"Test Agent",icon:"science",description:"Test generation"},{id:"specialist-merge-agent",name:"Merge Agent",icon:"call_merge",description:"Merge conflict resolution"}]},{name:"Convoy Reviewers",icon:"groups",agents:[{id:"convoy:security-reviewer",name:"Security",icon:"shield",description:"Security analysis"},{id:"convoy:performance-reviewer",name:"Performance",icon:"speed",description:"Performance review"},{id:"convoy:correctness-reviewer",name:"Correctness",icon:"check_circle",description:"Logic validation"},{id:"convoy:synthesis-agent",name:"Synthesis",icon:"merge",description:"Combine reviews"}]},{name:"Subagents",icon:"account_tree",agents:[{id:"subagent:explore",name:"Explore",icon:"explore",description:"Codebase exploration"},{id:"subagent:plan",name:"Plan",icon:"event_note",description:"Task breakdown"},{id:"subagent:bash",name:"Bash",icon:"terminal",description:"CLI commands"},{id:"subagent:general-purpose",name:"General",icon:"psychology",description:"General tasks"}]},{name:"Workflow Agents",icon:"route",agents:[{id:"prd-agent",name:"PRD Agent",icon:"article",description:"Product requirements"},{id:"decomposition-agent",name:"Decomposition",icon:"account_tree",description:"Break down epics"},{id:"triage-agent",name:"Triage",icon:"filter_list",description:"Prioritize issues"},{id:"status-review",name:"Status Review",icon:"assessment",description:"AI status reviews (executive-facing)"}]},{name:"CLI Modes",icon:"terminal",agents:[{id:"cli:interactive",name:"Interactive",icon:"chat",description:"Conversation mode"},{id:"cli:quick-command",name:"Quick Command",icon:"bolt",description:"One-shot queries"}]}],Ib="claude-sonnet-4-5";function VF(e){const t=P2(e);return t?t.name:e.includes("claude")?e.includes("opus")?"Opus 4.6":e.includes("haiku")?"Haiku":"Sonnet 4.5":e.includes("gpt")?"GPT-4o":e.includes("gemini")?e.includes("flash")?"Gemini Flash":"Gemini Pro":e.includes("kimi")?e.includes("k2.5")||e.includes("2.5")?"Kimi K2.5":"Kimi K2":e.includes("glm")?"GLM-4":e}function YF(){var H,N;const e=rn(),t=Pa(),{data:n,isLoading:r,error:s}=ue({queryKey:["settings"],queryFn:WF}),[i,o]=v.useState(null),[l,c]=v.useState({}),[u,h]=v.useState({}),[d,p]=v.useState(null),[f,m]=v.useState(null),[g,b]=v.useState({}),[x,y]=v.useState(null),[_,w]=v.useState(null),[C,S]=v.useState({});v.useEffect(()=>{n&&!i&&o(n)},[n,i]);const R=xe({mutationFn:UF,onSuccess:()=>{e.invalidateQueries({queryKey:["settings"]}),e.invalidateQueries({queryKey:["tracker-status"]})}});if(r)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx(ye,{className:"w-8 h-8 text-blue-400 animate-spin"})});if(s||!i)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsxs("div",{className:"text-red-400",children:["Error: ",(s==null?void 0:s.message)||"Failed to load settings"]})});const T=JSON.stringify(i)!==JSON.stringify(n),F=B=>{B!=="anthropic"&&o({...i,models:{...i.models,providers:{...i.models.providers,[B]:!i.models.providers[B]}}})},P=(B,O)=>{B!=="anthropic"&&o({...i,api_keys:{...i.api_keys,[B]:O||void 0}})},I=(B,O)=>{o({...i,tracker_keys:{...i.tracker_keys,[B]:O||void 0}})},A=(B,O)=>{o({...i,models:{...i.models,overrides:{...i.models.overrides,[B]:O}}})},M=B=>{const{[B]:O,...k}=i.models.overrides;o({...i,models:{...i.models,overrides:k}})},j=()=>R.mutate(i),E=()=>o(n||null),$=async()=>{try{const B=await qF(),O={models:{providers:{...(i==null?void 0:i.models.providers)||B.models.providers},overrides:{...B.models.overrides},gemini_thinking_level:B.models.gemini_thinking_level},api_keys:{...(i==null?void 0:i.api_keys)||{}},tracker_keys:{...(i==null?void 0:i.tracker_keys)||{}}};o(O)}catch(B){console.error("Failed to fetch optimal defaults:",B),t({message:"Failed to load optimal defaults: "+B.message,variant:"error"})}},q=async B=>{const O=i==null?void 0:i.api_keys[B];if(O){m(B),b({...g,[B]:null});try{const k=await Ab(B,O);b({...g,[B]:k})}catch{b({...g,[B]:{success:!1,error:"Test failed",response:null,latencyMs:0}})}finally{m(null)}}},D=async(B,O)=>{const k=i==null?void 0:i.api_keys[B];if(!k)return;const W=`${B}:${O}`;w(W),S({...C,[W]:null});try{const Q=await Ab(B,k,O);S({...C,[W]:Q})}catch{S({...C,[W]:{success:!1,error:"Test failed",response:null,latencyMs:0}})}finally{w(null)}};return a.jsxs("div",{className:"max-w-[1200px] mx-auto px-6 md:px-10 py-8 pb-32",children:[a.jsx("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center gap-4 mb-8",children:a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("span",{className:"material-symbols-outlined text-blue-400 text-2xl",children:"settings"}),a.jsx("h1",{className:"text-content text-4xl font-black tracking-tight",children:"Settings"})]}),a.jsx("p",{className:"text-content-muted text-base",children:"Configure AI model orchestration and agent permissions."})]})}),a.jsx("section",{className:"mb-10",children:a.jsx("div",{className:"bg-surface-raised border border-divider rounded-xl overflow-hidden",children:a.jsxs("div",{className:"flex flex-col lg:flex-row",children:[a.jsxs("div",{className:"lg:w-2/5 bg-surface p-8 flex flex-col justify-center items-center border-b lg:border-b-0 lg:border-r border-divider relative overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 opacity-10 pointer-events-none bg-[radial-gradient(circle_at_50%_50%,#3b82f6_0%,transparent_70%)]"}),a.jsxs("div",{className:"relative z-10 flex flex-col items-center gap-6 w-full max-w-xs",children:[a.jsxs("div",{className:"flex items-center justify-between w-full",children:[a.jsx("div",{className:"size-12 rounded-lg bg-surface-emphasis border border-divider-strong flex items-center justify-center shadow-sm",children:a.jsx("span",{className:"material-symbols-outlined text-content-subtle",children:"terminal"})}),a.jsx("div",{className:"flex-1 h-px bg-gradient-to-r from-divider-strong via-blue-500 to-divider-strong mx-2"}),a.jsx("div",{className:"size-12 rounded-lg bg-surface-emphasis border border-divider-strong flex items-center justify-center shadow-sm",children:a.jsx("span",{className:"material-symbols-outlined text-blue-400",children:"account_tree"})}),a.jsx("div",{className:"flex-1 h-px bg-gradient-to-r from-divider via-blue-500 to-divider mx-2"}),a.jsx("div",{className:"size-12 rounded-lg bg-blue-500 flex items-center justify-center shadow-[0_0_20px_rgba(59,130,246,0.4)]",children:a.jsx("span",{className:"material-symbols-outlined text-content",children:"bolt"})})]}),a.jsxs("div",{className:"flex justify-between w-full px-2 text-[10px] uppercase tracking-widest font-bold text-content-muted",children:[a.jsx("span",{children:"Task"}),a.jsx("span",{children:"Capability"}),a.jsx("span",{children:"Model"})]})]})]}),a.jsxs("div",{className:"lg:w-3/5 p-8",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx("span",{className:"px-2 py-0.5 bg-blue-500/10 text-blue-400 text-[10px] font-bold uppercase tracking-wider rounded border border-blue-500/20",children:"Active"}),a.jsx("h3",{className:"text-content text-xl font-bold",children:"Smart Model Selection"})]}),a.jsx("p",{className:"text-content-muted mb-6 leading-relaxed",children:"Panopticon automatically routes tasks to the optimal model based on capabilities, token budget, and latency requirements."}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("span",{className:"material-symbols-outlined text-blue-400 text-sm mt-1",children:"check_circle"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold text-content",children:"Capability Matching"}),a.jsx("p",{className:"text-xs text-content-muted",children:"Best model for each task type"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("span",{className:"material-symbols-outlined text-blue-400 text-sm mt-1",children:"check_circle"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold text-content",children:"Cost Optimization"}),a.jsx("p",{className:"text-xs text-content-muted",children:"Balance performance vs spend"})]})]})]})]})]})})}),a.jsxs("section",{className:"mb-12",children:[a.jsxs("h2",{className:"text-content text-2xl font-bold mb-6 flex items-center gap-3",children:["Provider Configuration",a.jsx("div",{className:"h-px flex-1 bg-divider-strong"})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:Xf.map(B=>{var Q,z,X,re,ie;const O=B.id==="anthropic",k=O||i.models.providers[B.id],W=i.api_keys[B.id]||"";return a.jsxs("div",{className:`bg-surface-raised border rounded-xl p-5 relative transition-colors shadow-sm ${O?"border-blue-500/50 shadow-lg shadow-blue-500/5":"border-divider hover:border-divider-strong"}`,children:[O&&a.jsx("div",{className:"absolute -top-3 right-4",children:a.jsx("span",{className:"bg-blue-500 text-content text-[10px] font-black px-2 py-0.5 rounded uppercase tracking-tighter",children:"Default"})}),a.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[a.jsx("div",{className:"size-10 rounded-lg bg-surface-emphasis border border-divider flex items-center justify-center",children:a.jsx("span",{className:"material-symbols-outlined text-content-subtle",children:B.icon})}),a.jsx("span",{className:"font-bold text-content",children:B.name}),a.jsx("div",{className:"ml-auto",children:a.jsx("button",{onClick:()=>F(B.id),disabled:O,className:`w-10 h-5 rounded-full relative transition-colors ${k?"bg-blue-500":"bg-surface-emphasis"} ${O?"cursor-not-allowed":"cursor-pointer"}`,children:a.jsx("div",{className:`absolute top-0.5 size-4 bg-white rounded-full transition-all ${k?"right-0.5":"left-0.5"}`})})})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"relative",children:[a.jsx("label",{className:"text-[10px] uppercase font-bold text-content-muted mb-1 block",children:"API Key"}),W.startsWith("$")?a.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-lg px-3 py-2",children:[a.jsxs("div",{className:"flex items-center gap-2 text-amber-400 text-xs",children:[a.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"info"}),a.jsxs("span",{children:["Configured via ",a.jsx("code",{className:"font-mono bg-surface-overlay px-1 rounded",children:W})]})]}),a.jsx("p",{className:"text-[10px] text-amber-400/70 mt-1",children:"Set this environment variable or enter the key directly below"}),a.jsx("input",{type:"text",placeholder:B.placeholder,onChange:de=>P(B.id,de.target.value),autoComplete:"off",className:"w-full bg-input-bg border border-divider-strong rounded-lg px-3 py-2 text-xs font-mono mt-2 focus:ring-1 focus:ring-blue-500 focus:border-blue-500 text-content-body"})]}):a.jsxs("div",{className:"relative",children:[a.jsx("input",{type:l[B.id]?"text":"password",value:W,onChange:de=>P(B.id,de.target.value),disabled:O,placeholder:B.placeholder,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"data-lpignore":"true","data-1p-ignore":"true","data-form-type":"other",className:`w-full bg-input-bg border border-divider-strong rounded-lg px-3 py-2 pr-16 text-xs font-mono focus:ring-1 focus:ring-blue-500 focus:border-blue-500 ${O?"cursor-not-allowed text-content-muted":"text-content-body"}`}),!O&&a.jsx("button",{onClick:()=>c({...l,[B.id]:!l[B.id]}),className:"absolute right-8 top-1/2 -translate-y-1/2 text-content-muted hover:text-content-body",children:a.jsx("span",{className:"material-symbols-outlined text-[16px]",children:l[B.id]?"visibility_off":"visibility"})})]})]}),!O&&a.jsxs("div",{className:"flex flex-col gap-2",children:[W&&!W.startsWith("$")&&a.jsxs("button",{onClick:()=>y(B.id),className:"flex items-center justify-center gap-1.5 px-3 py-1.5 bg-blue-500/10 hover:bg-blue-500/20 border border-blue-500/30 rounded-lg text-xs text-blue-400 transition-colors w-full",children:[a.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"view_list"}),"View Models"]}),W&&!W.startsWith("$")&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>q(B.id),disabled:f===B.id,className:"flex items-center gap-1.5 px-3 py-1.5 bg-surface-emphasis hover:bg-divider-strong border border-divider-strong rounded-lg text-xs text-content-body transition-colors disabled:opacity-50",children:[f===B.id?a.jsx(ye,{className:"w-3 h-3 animate-spin"}):a.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"quiz"}),"Test 2+3"]}),g[B.id]&&a.jsxs("div",{className:`flex items-center gap-1 text-xs ${(Q=g[B.id])!=null&&Q.success?"text-green-400":"text-red-400"}`,children:[a.jsx("span",{className:"material-symbols-outlined text-[14px]",children:(z=g[B.id])!=null&&z.success?"check_circle":"error"}),(X=g[B.id])!=null&&X.success?`${(re=g[B.id])==null?void 0:re.latencyMs}ms`:(ie=g[B.id])==null?void 0:ie.error]})]})]})]})]},B.id)})})]}),a.jsxs("section",{className:"mb-12",children:[a.jsxs("h2",{className:"text-content text-2xl font-bold mb-6 flex items-center gap-3",children:["Tracker API Keys",a.jsx("div",{className:"h-px flex-1 bg-divider-strong"})]}),a.jsxs("p",{className:"text-content-muted text-sm mb-6",children:["Configure API keys for your issue trackers. These override environment variables (",Ob.map(B=>B.envVar).join(", "),")."]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:Ob.map(B=>{var k;const O=((k=i.tracker_keys)==null?void 0:k[B.id])||"";return a.jsxs("div",{className:"bg-surface-raised border border-divider rounded-xl p-5 relative transition-colors shadow-sm hover:border-divider-strong",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[a.jsx("div",{className:"size-10 rounded-lg bg-surface-emphasis border border-divider flex items-center justify-center",children:a.jsx("span",{className:"material-symbols-outlined text-content-subtle",children:B.icon})}),a.jsxs("div",{children:[a.jsx("span",{className:"font-bold text-content",children:B.name}),a.jsx("p",{className:"text-[10px] text-content-muted font-mono",children:B.envVar})]})]}),a.jsx("div",{className:"space-y-3",children:a.jsxs("div",{className:"relative",children:[a.jsx("label",{className:"text-[10px] uppercase font-bold text-content-muted mb-1 block",children:"API Key / Token"}),O.startsWith("$")?a.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-lg px-3 py-2",children:[a.jsxs("div",{className:"flex items-center gap-2 text-amber-400 text-xs",children:[a.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"info"}),a.jsxs("span",{children:["Configured via ",a.jsx("code",{className:"font-mono bg-surface-overlay px-1 rounded",children:O})]})]}),a.jsx("input",{type:"text",placeholder:B.placeholder,onChange:W=>I(B.id,W.target.value),autoComplete:"off",className:"w-full bg-input-bg border border-divider-strong rounded-lg px-3 py-2 text-xs font-mono mt-2 focus:ring-1 focus:ring-blue-500 focus:border-blue-500 text-content-body"})]}):a.jsxs("div",{className:"relative",children:[a.jsx("input",{type:u[B.id]?"text":"password",value:O,onChange:W=>I(B.id,W.target.value),placeholder:B.placeholder,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"data-lpignore":"true","data-1p-ignore":"true","data-form-type":"other",className:"w-full bg-input-bg border border-divider-strong rounded-lg px-3 py-2 pr-10 text-xs font-mono focus:ring-1 focus:ring-blue-500 focus:border-blue-500 text-content-body"}),a.jsx("button",{onClick:()=>h({...u,[B.id]:!u[B.id]}),className:"absolute right-2 top-1/2 -translate-y-1/2 text-content-muted hover:text-content-body",children:a.jsx("span",{className:"material-symbols-outlined text-[16px]",children:u[B.id]?"visibility_off":"visibility"})})]})]})})]},B.id)})})]}),a.jsxs("section",{className:"mb-12",children:[a.jsxs("h2",{className:"text-content text-2xl font-bold mb-6 flex items-center gap-3",children:["Model Assignments",a.jsx("div",{className:"h-px flex-1 bg-divider-strong"})]}),a.jsx("div",{className:"space-y-8",children:KF.map(B=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx("span",{className:"material-symbols-outlined text-content-muted text-lg",children:B.icon}),a.jsx("h3",{className:"text-content-body font-semibold text-sm uppercase tracking-wider",children:B.name}),a.jsx("div",{className:"h-px flex-1 bg-divider"})]}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:B.agents.map(O=>{const k=i.models.overrides[O.id]||Ib,W=VF(k),{score:Q,matched:z,missing:X}=$F(k,O.id),re=Lx[O.id]||[],ie=Q>=1,de=Q>=.5&&Q<1,qe=[`${O.name}: ${O.description}`,`Model: ${W}`,`Needs: ${re.map(Se=>Ks[Se].name).join(", ")}`,z.length>0?`✓ Has: ${z.map(Se=>Ks[Se].name).join(", ")}`:"",X.length>0?`✗ Missing: ${X.map(Se=>Ks[Se].name).join(", ")}`:""].filter(Boolean).join(`
616
- `);return a.jsxs("div",{onClick:()=>p(O.id),title:qe,className:`p-3 border rounded-lg cursor-pointer transition-all group ${ie?"bg-emerald-500/5 border-emerald-500/30 hover:border-emerald-500/50 hover:bg-emerald-500/10":de?"bg-amber-500/5 border-amber-500/30 hover:border-amber-500/50 hover:bg-amber-500/10":"bg-rose-500/5 border-rose-500/30 hover:border-rose-500/50 hover:bg-rose-500/10"}`,children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:`material-symbols-outlined text-sm ${ie?"text-emerald-400":de?"text-amber-400":"text-rose-400"}`,children:O.icon}),a.jsxs("span",{className:`text-[9px] font-bold ${ie?"text-emerald-400":de?"text-amber-400":"text-rose-400"}`,children:[Math.round(Q*100),"%"]})]}),a.jsx("p",{className:"text-xs font-semibold text-content truncate",children:O.name}),a.jsx("p",{className:"text-[10px] text-content-muted truncate mb-2",children:W}),a.jsx("div",{className:"flex gap-1 flex-wrap",children:re.slice(0,3).map(Se=>{const he=z.includes(Se);return a.jsx("span",{title:`${Ks[Se].name}: ${he?"Model has this":"Model missing this"}`,className:`text-[8px] px-1 py-0.5 rounded ${he?"bg-emerald-500/20 text-emerald-400":"bg-rose-500/20 text-rose-400"}`,children:Ks[Se].name},Se)})})]},O.id)})})]},B.name))})]}),a.jsx("footer",{className:"fixed bottom-0 left-0 right-0 bg-surface backdrop-blur-md border-t border-divider-strong shadow-[0_-2px_10px_rgba(0,0,0,0.05)] px-6 py-4 z-40",children:a.jsxs("div",{className:"max-w-[1200px] mx-auto flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2 text-content-muted text-sm",children:[R.isSuccess&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"material-symbols-outlined text-green-400",children:"check_circle"}),a.jsx("span",{className:"text-green-400",children:"Settings saved!"})]}),R.isError&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"material-symbols-outlined text-red-400",children:"error"}),a.jsx("span",{className:"text-red-400",children:"Error saving settings"})]})]}),a.jsxs("div",{className:"flex gap-4",children:[a.jsxs("button",{onClick:$,className:"px-6 py-2 text-amber-400 hover:text-amber-300 font-semibold text-sm transition-colors flex items-center gap-1.5",title:"Set all model assignments to research-based optimal defaults",children:[a.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"auto_fix_high"}),"Optimal Defaults"]}),a.jsx("button",{onClick:E,disabled:!T,className:"px-6 py-2 text-content-muted hover:text-content font-semibold text-sm transition-colors disabled:opacity-50",children:"Undo Changes"}),a.jsxs("button",{onClick:j,disabled:!T||R.isPending,className:"px-8 py-2 bg-blue-500 hover:bg-blue-400 text-content font-black rounded-lg transition-all shadow-lg shadow-blue-500/20 text-sm disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[R.isPending&&a.jsx(ye,{className:"w-4 h-4 animate-spin"}),"Save Changes"]})]})]})}),d&&a.jsx(HF,{workType:d,currentModel:i.models.overrides[d]||Ib,isOverride:!!i.models.overrides[d],enabledProviders:Object.entries(i.models.providers).filter(([B,O])=>O).map(([B])=>B),onApply:B=>A(d,B),onRemove:()=>M(d),onClose:()=>p(null)}),x&&a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:a.jsxs("div",{className:"bg-surface-raised border border-divider-strong rounded-xl shadow-2xl max-w-2xl w-full max-h-[80vh] overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-divider",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"material-symbols-outlined text-blue-400",children:(H=Xf.find(B=>B.id===x))==null?void 0:H.icon}),a.jsxs("h3",{className:"text-content text-lg font-bold",children:[(N=Xf.find(B=>B.id===x))==null?void 0:N.name," Models"]})]}),a.jsx("button",{onClick:()=>y(null),className:"text-content-muted hover:text-content transition-colors",children:a.jsx(mt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"p-4 overflow-y-auto max-h-[60vh]",children:(()=>{var k;const B=(i==null?void 0:i.api_keys[x])||"",O=B.startsWith("$");return B?O?a.jsxs("div",{className:"text-center py-8",children:[a.jsx("span",{className:"material-symbols-outlined text-4xl text-amber-500 mb-2",children:"warning"}),a.jsx("p",{className:"text-amber-400",children:"API key configured via environment variable"}),a.jsxs("p",{className:"text-content-muted text-sm mt-1",children:[a.jsx("code",{className:"font-mono bg-surface-overlay px-1 rounded",children:B})," is not set"]}),a.jsx("p",{className:"text-content-muted text-xs mt-2",children:"Set the environment variable or enter the key directly in Settings"})]}):a.jsx("div",{className:"space-y-3",children:(((k=Mx[x])==null?void 0:k.models)||[]).map(W=>{var re;const Q=`${x}:${W.id}`,z=C[Q],X=_===Q;return a.jsx("div",{className:"bg-surface border border-divider rounded-lg p-4 hover:border-divider-strong transition-colors",children:a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("span",{className:"material-symbols-outlined text-content-muted text-sm",children:W.icon}),a.jsx("h4",{className:"text-content font-semibold",children:W.name}),W.tier&&a.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${W.tier==="premium"?"bg-purple-500/20 text-purple-400":W.tier==="balanced"?"bg-blue-500/20 text-blue-400":"bg-emerald-500/20 text-emerald-400"}`,children:W.tier})]}),W.description&&a.jsx("p",{className:"text-xs text-content-muted mb-2",children:W.description}),a.jsx("div",{className:"flex flex-wrap gap-1",children:W.capabilities.map(ie=>a.jsx("span",{className:"text-[9px] px-1.5 py-0.5 bg-surface-emphasis text-content-subtle rounded border border-divider",children:ie},ie))})]}),a.jsxs("div",{className:"flex flex-col items-end gap-2",children:[a.jsxs("button",{onClick:()=>D(x,W.id),disabled:X,className:"flex items-center gap-1.5 px-3 py-1.5 bg-emerald-500/10 hover:bg-emerald-500/20 border border-emerald-500/30 rounded-lg text-xs text-emerald-400 transition-colors disabled:opacity-50 whitespace-nowrap",children:[X?a.jsx(ye,{className:"w-3 h-3 animate-spin"}):a.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"play_arrow"}),"Test 2+3"]}),z&&a.jsxs("div",{className:`flex items-center gap-1 text-xs ${z.success?"text-green-400":"text-red-400"}`,children:[a.jsx("span",{className:"material-symbols-outlined text-[12px]",children:z.success?"check_circle":"error"}),z.success?`${z.latencyMs}ms`:((re=z.error)==null?void 0:re.slice(0,30))||"Failed"]})]})]})},W.id)})}):a.jsxs("div",{className:"text-center py-8",children:[a.jsx("span",{className:"material-symbols-outlined text-4xl text-content-muted mb-2",children:"key_off"}),a.jsx("p",{className:"text-content-muted",children:"Enter an API key to test models"})]})})()}),a.jsx("div",{className:"p-4 border-t border-divider bg-surface",children:a.jsx("p",{className:"text-xs text-content-muted text-center",children:'Test verifies API key and model availability by asking "What is 2+3?"'})})]})})]})}var Bb=1,QF=.9,XF=.8,GF=.17,Gf=.1,Jf=.999,JF=.9999,ZF=.99,ez=/[\\\/_+.#"@\[\(\{&]/,tz=/[\\\/_+.#"@\[\(\{&]/g,nz=/[\s-]/,D2=/[\s-]/g;function Eg(e,t,n,r,s,i,o){if(i===t.length)return s===e.length?Bb:ZF;var l=`${s},${i}`;if(o[l]!==void 0)return o[l];for(var c=r.charAt(i),u=n.indexOf(c,s),h=0,d,p,f,m;u>=0;)d=Eg(e,t,n,r,u+1,i+1,o),d>h&&(u===s?d*=Bb:ez.test(e.charAt(u-1))?(d*=XF,f=e.slice(s,u-1).match(tz),f&&s>0&&(d*=Math.pow(Jf,f.length))):nz.test(e.charAt(u-1))?(d*=QF,m=e.slice(s,u-1).match(D2),m&&s>0&&(d*=Math.pow(Jf,m.length))):(d*=GF,s>0&&(d*=Math.pow(Jf,u-s))),e.charAt(u)!==t.charAt(i)&&(d*=JF)),(d<Gf&&n.charAt(u-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(u-1)!==r.charAt(i))&&(p=Eg(e,t,n,r,u+1,i+2,o),p*Gf>d&&(d=p*Gf)),d>h&&(h=d),u=n.indexOf(c,u+1);return o[l]=h,h}function Fb(e){return e.toLowerCase().replace(D2," ")}function rz(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Eg(e,t,Fb(e),Fb(t),0,0,{})}function mi(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function zb(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function yi(...e){return t=>{let n=!1;const r=e.map(s=>{const i=zb(s,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():zb(e[s],null)}}}}function _o(...e){return v.useCallback(yi(...e),e)}function sz(e,t){const n=v.createContext(t),r=i=>{const{children:o,...l}=i,c=v.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:o})};r.displayName=e+"Provider";function s(i){const o=v.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,s]}function iz(e,t=[]){let n=[];function r(i,o){const l=v.createContext(o),c=n.length;n=[...n,o];const u=d=>{var x;const{scope:p,children:f,...m}=d,g=((x=p==null?void 0:p[e])==null?void 0:x[c])||l,b=v.useMemo(()=>m,Object.values(m));return a.jsx(g.Provider,{value:b,children:f})};u.displayName=i+"Provider";function h(d,p){var g;const f=((g=p==null?void 0:p[e])==null?void 0:g[c])||l,m=v.useContext(f);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[u,h]}const s=()=>{const i=n.map(o=>v.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,oz(s,...t)]}function oz(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const d=c(i)[`__scope${u}`];return{...l,...d}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var uc=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},az=Ug[" useId ".trim().toString()]||(()=>{}),lz=0;function ms(e){const[t,n]=v.useState(az());return uc(()=>{n(r=>r??String(lz++))},[e]),t?`radix-${t}`:""}var cz=Ug[" useInsertionEffect ".trim().toString()]||uc;function uz({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,i,o]=dz({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:s;{const h=v.useRef(e!==void 0);v.useEffect(()=>{const d=h.current;d!==l&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),h.current=l},[l,r])}const u=v.useCallback(h=>{var d;if(l){const p=hz(h)?h(e):h;p!==e&&((d=o.current)==null||d.call(o,p))}else i(h)},[l,e,i,o]);return[c,u]}function dz({defaultProp:e,onChange:t}){const[n,r]=v.useState(e),s=v.useRef(n),i=v.useRef(t);return cz(()=>{i.current=t},[t]),v.useEffect(()=>{var o;s.current!==n&&((o=i.current)==null||o.call(i,n),s.current=n)},[n,s]),[n,r,i]}function hz(e){return typeof e=="function"}function Ic(e){const t=fz(e),n=v.forwardRef((r,s)=>{const{children:i,...o}=r,l=v.Children.toArray(i),c=l.find(mz);if(c){const u=c.props.children,h=l.map(d=>d===c?v.Children.count(u)>1?v.Children.only(null):v.isValidElement(u)?u.props.children:null:d);return a.jsx(t,{...o,ref:s,children:v.isValidElement(u)?v.cloneElement(u,void 0,h):null})}return a.jsx(t,{...o,ref:s,children:i})});return n.displayName=`${e}.Slot`,n}function fz(e){const t=v.forwardRef((n,r)=>{const{children:s,...i}=n;if(v.isValidElement(s)){const o=vz(s),l=gz(i,s.props);return s.type!==v.Fragment&&(l.ref=r?yi(r,o):o),v.cloneElement(s,l)}return v.Children.count(s)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var pz=Symbol("radix.slottable");function mz(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===pz}function gz(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function vz(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var xz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],M2=xz.reduce((e,t)=>{const n=Ic(`Primitive.${t}`),r=v.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function yz(e,t){e&&ar.flushSync(()=>e.dispatchEvent(t))}function dc(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function _z(e,t=globalThis==null?void 0:globalThis.document){const n=dc(e);v.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var bz="DismissableLayer",Rg="dismissableLayer.update",wz="dismissableLayer.pointerDownOutside",Sz="dismissableLayer.focusOutside",$b,L2=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),A2=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:o,onDismiss:l,...c}=e,u=v.useContext(L2),[h,d]=v.useState(null),p=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=v.useState({}),m=_o(t,R=>d(R)),g=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=g.indexOf(b),y=h?g.indexOf(h):-1,_=u.layersWithOutsidePointerEventsDisabled.size>0,w=y>=x,C=Nz(R=>{const T=R.target,F=[...u.branches].some(P=>P.contains(T));!w||F||(s==null||s(R),o==null||o(R),R.defaultPrevented||l==null||l())},p),S=jz(R=>{const T=R.target;[...u.branches].some(P=>P.contains(T))||(i==null||i(R),o==null||o(R),R.defaultPrevented||l==null||l())},p);return _z(R=>{y===u.layers.size-1&&(r==null||r(R),!R.defaultPrevented&&l&&(R.preventDefault(),l()))},p),v.useEffect(()=>{if(h)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&($b=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(h)),u.layers.add(h),Hb(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=$b)}},[h,p,n,u]),v.useEffect(()=>()=>{h&&(u.layers.delete(h),u.layersWithOutsidePointerEventsDisabled.delete(h),Hb())},[h,u]),v.useEffect(()=>{const R=()=>f({});return document.addEventListener(Rg,R),()=>document.removeEventListener(Rg,R)},[]),a.jsx(M2.div,{...c,ref:m,style:{pointerEvents:_?w?"auto":"none":void 0,...e.style},onFocusCapture:mi(e.onFocusCapture,S.onFocusCapture),onBlurCapture:mi(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:mi(e.onPointerDownCapture,C.onPointerDownCapture)})});A2.displayName=bz;var kz="DismissableLayerBranch",Cz=v.forwardRef((e,t)=>{const n=v.useContext(L2),r=v.useRef(null),s=_o(t,r);return v.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),a.jsx(M2.div,{...e,ref:s})});Cz.displayName=kz;function Nz(e,t=globalThis==null?void 0:globalThis.document){const n=dc(e),r=v.useRef(!1),s=v.useRef(()=>{});return v.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let c=function(){O2(wz,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",i),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function jz(e,t=globalThis==null?void 0:globalThis.document){const n=dc(e),r=v.useRef(!1);return v.useEffect(()=>{const s=i=>{i.target&&!r.current&&O2(Sz,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Hb(){const e=new CustomEvent(Rg);document.dispatchEvent(e)}function O2(e,t,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?yz(s,i):s.dispatchEvent(i)}var Ez=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Rz=Ez.reduce((e,t)=>{const n=Ic(`Primitive.${t}`),r=v.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Zf="focusScope.autoFocusOnMount",ep="focusScope.autoFocusOnUnmount",Wb={bubbles:!1,cancelable:!0},Tz="FocusScope",I2=v.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[l,c]=v.useState(null),u=dc(s),h=dc(i),d=v.useRef(null),p=_o(t,g=>c(g)),f=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let g=function(_){if(f.paused||!l)return;const w=_.target;l.contains(w)?d.current=w:Fs(d.current,{select:!0})},b=function(_){if(f.paused||!l)return;const w=_.relatedTarget;w!==null&&(l.contains(w)||Fs(d.current,{select:!0}))},x=function(_){if(document.activeElement===document.body)for(const C of _)C.removedNodes.length>0&&Fs(l)};document.addEventListener("focusin",g),document.addEventListener("focusout",b);const y=new MutationObserver(x);return l&&y.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",b),y.disconnect()}}},[r,l,f.paused]),v.useEffect(()=>{if(l){qb.add(f);const g=document.activeElement;if(!l.contains(g)){const x=new CustomEvent(Zf,Wb);l.addEventListener(Zf,u),l.dispatchEvent(x),x.defaultPrevented||(Pz(Oz(B2(l)),{select:!0}),document.activeElement===g&&Fs(l))}return()=>{l.removeEventListener(Zf,u),setTimeout(()=>{const x=new CustomEvent(ep,Wb);l.addEventListener(ep,h),l.dispatchEvent(x),x.defaultPrevented||Fs(g??document.body,{select:!0}),l.removeEventListener(ep,h),qb.remove(f)},0)}}},[l,u,h,f]);const m=v.useCallback(g=>{if(!n&&!r||f.paused)return;const b=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,x=document.activeElement;if(b&&x){const y=g.currentTarget,[_,w]=Dz(y);_&&w?!g.shiftKey&&x===w?(g.preventDefault(),n&&Fs(_,{select:!0})):g.shiftKey&&x===_&&(g.preventDefault(),n&&Fs(w,{select:!0})):x===y&&g.preventDefault()}},[n,r,f.paused]);return a.jsx(Rz.div,{tabIndex:-1,...o,ref:p,onKeyDown:m})});I2.displayName=Tz;function Pz(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Fs(r,{select:t}),document.activeElement!==n)return}function Dz(e){const t=B2(e),n=Ub(t,e),r=Ub(t.reverse(),e);return[n,r]}function B2(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ub(e,t){for(const n of e)if(!Mz(n,{upTo:t}))return n}function Mz(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Lz(e){return e instanceof HTMLInputElement&&"select"in e}function Fs(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Lz(e)&&t&&e.select()}}var qb=Az();function Az(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Kb(e,t),e.unshift(t)},remove(t){var n;e=Kb(e,t),(n=e[0])==null||n.resume()}}}function Kb(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Oz(e){return e.filter(t=>t.tagName!=="A")}var Iz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Bz=Iz.reduce((e,t)=>{const n=Ic(`Primitive.${t}`),r=v.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Fz="Portal",F2=v.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[s,i]=v.useState(!1);uc(()=>i(!0),[]);const o=n||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?P4.createPortal(a.jsx(Bz.div,{...r,ref:t}),o):null});F2.displayName=Fz;function zz(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var Ah=e=>{const{present:t,children:n}=e,r=$z(t),s=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),i=_o(r.ref,Hz(s));return typeof n=="function"||r.isPresent?v.cloneElement(s,{ref:i}):null};Ah.displayName="Presence";function $z(e){const[t,n]=v.useState(),r=v.useRef(null),s=v.useRef(e),i=v.useRef("none"),o=e?"mounted":"unmounted",[l,c]=zz(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=ku(r.current);i.current=l==="mounted"?u:"none"},[l]),uc(()=>{const u=r.current,h=s.current;if(h!==e){const p=i.current,f=ku(u);e?c("MOUNT"):f==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(h&&p!==f?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),uc(()=>{if(t){let u;const h=t.ownerDocument.defaultView??window,d=f=>{const g=ku(r.current).includes(CSS.escape(f.animationName));if(f.target===t&&g&&(c("ANIMATION_END"),!s.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",u=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},p=f=>{f.target===t&&(i.current=ku(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{h.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:v.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function ku(e){return(e==null?void 0:e.animationName)||"none"}function Hz(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Wz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Bc=Wz.reduce((e,t)=>{const n=Ic(`Primitive.${t}`),r=v.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),tp=0;function Uz(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Vb()),document.body.insertAdjacentElement("beforeend",e[1]??Vb()),tp++,()=>{tp===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),tp--}},[])}function Vb(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Hr=function(){return Hr=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Hr.apply(this,arguments)};function z2(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function qz(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var td="right-scroll-bar-position",nd="width-before-scroll-bar",Kz="with-scroll-bars-hidden",Vz="--removed-body-scroll-bar-size";function np(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Yz(e,t){var n=v.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var Qz=typeof window<"u"?v.useLayoutEffect:v.useEffect,Yb=new WeakMap;function Xz(e,t){var n=Yz(null,function(r){return e.forEach(function(s){return np(s,r)})});return Qz(function(){var r=Yb.get(n);if(r){var s=new Set(r),i=new Set(e),o=n.current;s.forEach(function(l){i.has(l)||np(l,null)}),i.forEach(function(l){s.has(l)||np(l,o)})}Yb.set(n,e)},[e]),n}function Gz(e){return e}function Jz(e,t){t===void 0&&(t=Gz);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var o=t(i,r);return n.push(o),function(){n=n.filter(function(l){return l!==o})}},assignSyncMedium:function(i){for(r=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var o=[];if(n.length){var l=n;n=[],l.forEach(i),o=n}var c=function(){var h=o;o=[],h.forEach(i)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(h){o.push(h),u()},filter:function(h){return o=o.filter(h),n}}}};return s}function Zz(e){e===void 0&&(e={});var t=Jz(null);return t.options=Hr({async:!0,ssr:!1},e),t}var $2=function(e){var t=e.sideCar,n=z2(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return v.createElement(r,Hr({},n))};$2.isSideCarExport=!0;function e$(e,t){return e.useMedium(t),$2}var H2=Zz(),rp=function(){},Oh=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:rp,onWheelCapture:rp,onTouchMoveCapture:rp}),s=r[0],i=r[1],o=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,h=e.enabled,d=e.shards,p=e.sideCar,f=e.noRelative,m=e.noIsolation,g=e.inert,b=e.allowPinchZoom,x=e.as,y=x===void 0?"div":x,_=e.gapMode,w=z2(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=p,S=Xz([n,t]),R=Hr(Hr({},w),s);return v.createElement(v.Fragment,null,h&&v.createElement(C,{sideCar:H2,removeScrollBar:u,shards:d,noRelative:f,noIsolation:m,inert:g,setCallbacks:i,allowPinchZoom:!!b,lockRef:n,gapMode:_}),o?v.cloneElement(v.Children.only(l),Hr(Hr({},R),{ref:S})):v.createElement(y,Hr({},R,{className:c,ref:S}),l))});Oh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Oh.classNames={fullWidth:nd,zeroRight:td};var t$=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function n$(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=t$();return t&&e.setAttribute("nonce",t),e}function r$(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function s$(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var i$=function(){var e=0,t=null;return{add:function(n){e==0&&(t=n$())&&(r$(t,n),s$(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},o$=function(){var e=i$();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},W2=function(){var e=o$(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},a$={left:0,top:0,right:0,gap:0},sp=function(e){return parseInt(e||"",10)||0},l$=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[sp(n),sp(r),sp(s)]},c$=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return a$;var t=l$(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},u$=W2(),ta="data-scroll-locked",d$=function(e,t,n,r){var s=e.left,i=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),`
617
- .`.concat(Kz,` {
618
- overflow: hidden `).concat(r,`;
619
- padding-right: `).concat(l,"px ").concat(r,`;
620
- }
621
- body[`).concat(ta,`] {
622
- overflow: hidden `).concat(r,`;
623
- overscroll-behavior: contain;
624
- `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
625
- padding-left: `.concat(s,`px;
626
- padding-top: `).concat(i,`px;
627
- padding-right: `).concat(o,`px;
628
- margin-left:0;
629
- margin-top:0;
630
- margin-right: `).concat(l,"px ").concat(r,`;
631
- `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
632
- }
633
-
634
- .`).concat(td,` {
635
- right: `).concat(l,"px ").concat(r,`;
636
- }
637
-
638
- .`).concat(nd,` {
639
- margin-right: `).concat(l,"px ").concat(r,`;
640
- }
641
-
642
- .`).concat(td," .").concat(td,` {
643
- right: 0 `).concat(r,`;
644
- }
645
-
646
- .`).concat(nd," .").concat(nd,` {
647
- margin-right: 0 `).concat(r,`;
648
- }
649
-
650
- body[`).concat(ta,`] {
651
- `).concat(Vz,": ").concat(l,`px;
652
- }
653
- `)},Qb=function(){var e=parseInt(document.body.getAttribute(ta)||"0",10);return isFinite(e)?e:0},h$=function(){v.useEffect(function(){return document.body.setAttribute(ta,(Qb()+1).toString()),function(){var e=Qb()-1;e<=0?document.body.removeAttribute(ta):document.body.setAttribute(ta,e.toString())}},[])},f$=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;h$();var i=v.useMemo(function(){return c$(s)},[s]);return v.createElement(u$,{styles:d$(i,!t,s,n?"":"!important")})},Tg=!1;if(typeof window<"u")try{var Cu=Object.defineProperty({},"passive",{get:function(){return Tg=!0,!0}});window.addEventListener("test",Cu,Cu),window.removeEventListener("test",Cu,Cu)}catch{Tg=!1}var jo=Tg?{passive:!1}:!1,p$=function(e){return e.tagName==="TEXTAREA"},U2=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!p$(e)&&n[t]==="visible")},m$=function(e){return U2(e,"overflowY")},g$=function(e){return U2(e,"overflowX")},Xb=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=q2(e,r);if(s){var i=K2(e,r),o=i[1],l=i[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},v$=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},x$=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},q2=function(e,t){return e==="v"?m$(t):g$(t)},K2=function(e,t){return e==="v"?v$(t):x$(t)},y$=function(e,t){return e==="h"&&t==="rtl"?-1:1},_$=function(e,t,n,r,s){var i=y$(e,window.getComputedStyle(t).direction),o=i*r,l=n.target,c=t.contains(l),u=!1,h=o>0,d=0,p=0;do{if(!l)break;var f=K2(e,l),m=f[0],g=f[1],b=f[2],x=g-b-i*m;(m||x)&&q2(e,l)&&(d+=x,p+=m);var y=l.parentNode;l=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(h&&Math.abs(d)<1||!h&&Math.abs(p)<1)&&(u=!0),u},Nu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Gb=function(e){return[e.deltaX,e.deltaY]},Jb=function(e){return e&&"current"in e?e.current:e},b$=function(e,t){return e[0]===t[0]&&e[1]===t[1]},w$=function(e){return`
654
- .block-interactivity-`.concat(e,` {pointer-events: none;}
655
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
656
- `)},S$=0,Eo=[];function k$(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),s=v.useState(S$++)[0],i=v.useState(W2)[0],o=v.useRef(e);v.useEffect(function(){o.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var g=qz([e.lockRef.current],(e.shards||[]).map(Jb),!0).filter(Boolean);return g.forEach(function(b){return b.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),g.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=v.useCallback(function(g,b){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!o.current.allowPinchZoom;var x=Nu(g),y=n.current,_="deltaX"in g?g.deltaX:y[0]-x[0],w="deltaY"in g?g.deltaY:y[1]-x[1],C,S=g.target,R=Math.abs(_)>Math.abs(w)?"h":"v";if("touches"in g&&R==="h"&&S.type==="range")return!1;var T=window.getSelection(),F=T&&T.anchorNode,P=F?F===S||F.contains(S):!1;if(P)return!1;var I=Xb(R,S);if(!I)return!0;if(I?C=R:(C=R==="v"?"h":"v",I=Xb(R,S)),!I)return!1;if(!r.current&&"changedTouches"in g&&(_||w)&&(r.current=C),!C)return!0;var A=r.current||C;return _$(A,b,g,A==="h"?_:w)},[]),c=v.useCallback(function(g){var b=g;if(!(!Eo.length||Eo[Eo.length-1]!==i)){var x="deltaY"in b?Gb(b):Nu(b),y=t.current.filter(function(C){return C.name===b.type&&(C.target===b.target||b.target===C.shadowParent)&&b$(C.delta,x)})[0];if(y&&y.should){b.cancelable&&b.preventDefault();return}if(!y){var _=(o.current.shards||[]).map(Jb).filter(Boolean).filter(function(C){return C.contains(b.target)}),w=_.length>0?l(b,_[0]):!o.current.noIsolation;w&&b.cancelable&&b.preventDefault()}}},[]),u=v.useCallback(function(g,b,x,y){var _={name:g,delta:b,target:x,should:y,shadowParent:C$(x)};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(w){return w!==_})},1)},[]),h=v.useCallback(function(g){n.current=Nu(g),r.current=void 0},[]),d=v.useCallback(function(g){u(g.type,Gb(g),g.target,l(g,e.lockRef.current))},[]),p=v.useCallback(function(g){u(g.type,Nu(g),g.target,l(g,e.lockRef.current))},[]);v.useEffect(function(){return Eo.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",c,jo),document.addEventListener("touchmove",c,jo),document.addEventListener("touchstart",h,jo),function(){Eo=Eo.filter(function(g){return g!==i}),document.removeEventListener("wheel",c,jo),document.removeEventListener("touchmove",c,jo),document.removeEventListener("touchstart",h,jo)}},[]);var f=e.removeScrollBar,m=e.inert;return v.createElement(v.Fragment,null,m?v.createElement(i,{styles:w$(s)}):null,f?v.createElement(f$,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function C$(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const N$=e$(H2,k$);var V2=v.forwardRef(function(e,t){return v.createElement(Oh,Hr({},e,{ref:t,sideCar:N$}))});V2.classNames=Oh.classNames;var j$=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ro=new WeakMap,ju=new WeakMap,Eu={},ip=0,Y2=function(e){return e&&(e.host||Y2(e.parentNode))},E$=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Y2(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},R$=function(e,t,n,r){var s=E$(t,Array.isArray(e)?e:[e]);Eu[n]||(Eu[n]=new WeakMap);var i=Eu[n],o=[],l=new Set,c=new Set(s),u=function(d){!d||l.has(d)||(l.add(d),u(d.parentNode))};s.forEach(u);var h=function(d){!d||c.has(d)||Array.prototype.forEach.call(d.children,function(p){if(l.has(p))h(p);else try{var f=p.getAttribute(r),m=f!==null&&f!=="false",g=(Ro.get(p)||0)+1,b=(i.get(p)||0)+1;Ro.set(p,g),i.set(p,b),o.push(p),g===1&&m&&ju.set(p,!0),b===1&&p.setAttribute(n,"true"),m||p.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",p,x)}})};return h(t),l.clear(),ip++,function(){o.forEach(function(d){var p=Ro.get(d)-1,f=i.get(d)-1;Ro.set(d,p),i.set(d,f),p||(ju.has(d)||d.removeAttribute(r),ju.delete(d)),f||d.removeAttribute(n)}),ip--,ip||(Ro=new WeakMap,Ro=new WeakMap,ju=new WeakMap,Eu={})}},T$=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=j$(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),R$(r,s,n,"aria-hidden")):function(){return null}},Ih="Dialog",[Q2]=iz(Ih),[P$,Er]=Q2(Ih),X2=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=e,l=v.useRef(null),c=v.useRef(null),[u,h]=uz({prop:r,defaultProp:s??!1,onChange:i,caller:Ih});return a.jsx(P$,{scope:t,triggerRef:l,contentRef:c,contentId:ms(),titleId:ms(),descriptionId:ms(),open:u,onOpenChange:h,onOpenToggle:v.useCallback(()=>h(d=>!d),[h]),modal:o,children:n})};X2.displayName=Ih;var G2="DialogTrigger",D$=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Er(G2,n),i=_o(t,s.triggerRef);return a.jsx(Bc.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Ix(s.open),...r,ref:i,onClick:mi(e.onClick,s.onOpenToggle)})});D$.displayName=G2;var Ax="DialogPortal",[M$,J2]=Q2(Ax,{forceMount:void 0}),Z2=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=Er(Ax,t);return a.jsx(M$,{scope:t,forceMount:n,children:v.Children.map(r,o=>a.jsx(Ah,{present:n||i.open,children:a.jsx(F2,{asChild:!0,container:s,children:o})}))})};Z2.displayName=Ax;var Qd="DialogOverlay",eN=v.forwardRef((e,t)=>{const n=J2(Qd,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=Er(Qd,e.__scopeDialog);return i.modal?a.jsx(Ah,{present:r||i.open,children:a.jsx(A$,{...s,ref:t})}):null});eN.displayName=Qd;var L$=Ic("DialogOverlay.RemoveScroll"),A$=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Er(Qd,n);return a.jsx(V2,{as:L$,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(Bc.div,{"data-state":Ix(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),ho="DialogContent",tN=v.forwardRef((e,t)=>{const n=J2(ho,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=Er(ho,e.__scopeDialog);return a.jsx(Ah,{present:r||i.open,children:i.modal?a.jsx(O$,{...s,ref:t}):a.jsx(I$,{...s,ref:t})})});tN.displayName=ho;var O$=v.forwardRef((e,t)=>{const n=Er(ho,e.__scopeDialog),r=v.useRef(null),s=_o(t,n.contentRef,r);return v.useEffect(()=>{const i=r.current;if(i)return T$(i)},[]),a.jsx(nN,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:mi(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:mi(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:mi(e.onFocusOutside,i=>i.preventDefault())})}),I$=v.forwardRef((e,t)=>{const n=Er(ho,e.__scopeDialog),r=v.useRef(!1),s=v.useRef(!1);return a.jsx(nN,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),nN=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,l=Er(ho,n),c=v.useRef(null),u=_o(t,c);return Uz(),a.jsxs(a.Fragment,{children:[a.jsx(I2,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(A2,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Ix(l.open),...o,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx($$,{titleId:l.titleId}),a.jsx(W$,{contentRef:c,descriptionId:l.descriptionId})]})]})}),Ox="DialogTitle",B$=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Er(Ox,n);return a.jsx(Bc.h2,{id:s.titleId,...r,ref:t})});B$.displayName=Ox;var rN="DialogDescription",F$=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Er(rN,n);return a.jsx(Bc.p,{id:s.descriptionId,...r,ref:t})});F$.displayName=rN;var sN="DialogClose",z$=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Er(sN,n);return a.jsx(Bc.button,{type:"button",...r,ref:t,onClick:mi(e.onClick,()=>s.onOpenChange(!1))})});z$.displayName=sN;function Ix(e){return e?"open":"closed"}var iN="DialogTitleWarning",[Wq,oN]=sz(iN,{contentName:ho,titleName:Ox,docsSlug:"dialog"}),$$=({titleId:e})=>{const t=oN(iN),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
657
-
658
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
659
-
660
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},H$="DialogDescriptionWarning",W$=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${oN(H$).contentName}}.`;return v.useEffect(()=>{var i;const s=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},U$=X2,q$=Z2,K$=eN,V$=tN,Y$=Symbol.for("react.lazy"),Xd=Ug[" use ".trim().toString()];function Q$(e){return typeof e=="object"&&e!==null&&"then"in e}function aN(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Y$&&"_payload"in e&&Q$(e._payload)}function X$(e){const t=G$(e),n=v.forwardRef((r,s)=>{let{children:i,...o}=r;aN(i)&&typeof Xd=="function"&&(i=Xd(i._payload));const l=v.Children.toArray(i),c=l.find(Z$);if(c){const u=c.props.children,h=l.map(d=>d===c?v.Children.count(u)>1?v.Children.only(null):v.isValidElement(u)?u.props.children:null:d);return a.jsx(t,{...o,ref:s,children:v.isValidElement(u)?v.cloneElement(u,void 0,h):null})}return a.jsx(t,{...o,ref:s,children:i})});return n.displayName=`${e}.Slot`,n}function G$(e){const t=v.forwardRef((n,r)=>{let{children:s,...i}=n;if(aN(s)&&typeof Xd=="function"&&(s=Xd(s._payload)),v.isValidElement(s)){const o=t9(s),l=e9(i,s.props);return s.type!==v.Fragment&&(l.ref=r?yi(r,o):o),v.cloneElement(s,l)}return v.Children.count(s)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var J$=Symbol("radix.slottable");function Z$(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===J$}function e9(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function t9(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var n9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ci=n9.reduce((e,t)=>{const n=X$(`Primitive.${t}`),r=v.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),ol='[cmdk-group=""]',op='[cmdk-group-items=""]',r9='[cmdk-group-heading=""]',lN='[cmdk-item=""]',Zb=`${lN}:not([aria-disabled="true"])`,Pg="cmdk-item-select",To="data-value",s9=(e,t,n)=>rz(e,t,n),cN=v.createContext(void 0),Fc=()=>v.useContext(cN),uN=v.createContext(void 0),Bx=()=>v.useContext(uN),dN=v.createContext(void 0),hN=v.forwardRef((e,t)=>{let n=Po(()=>{var O,k;return{search:"",value:(k=(O=e.value)!=null?O:e.defaultValue)!=null?k:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Po(()=>new Set),s=Po(()=>new Map),i=Po(()=>new Map),o=Po(()=>new Set),l=fN(e),{label:c,children:u,value:h,onValueChange:d,filter:p,shouldFilter:f,loop:m,disablePointerSelection:g=!1,vimBindings:b=!0,...x}=e,y=ms(),_=ms(),w=ms(),C=v.useRef(null),S=m9();fo(()=>{if(h!==void 0){let O=h.trim();n.current.value=O,R.emit()}},[h]),fo(()=>{S(6,M)},[]);let R=v.useMemo(()=>({subscribe:O=>(o.current.add(O),()=>o.current.delete(O)),snapshot:()=>n.current,setState:(O,k,W)=>{var Q,z,X,re;if(!Object.is(n.current[O],k)){if(n.current[O]=k,O==="search")A(),P(),S(1,I);else if(O==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ie=document.getElementById(w);ie?ie.focus():(Q=document.getElementById(y))==null||Q.focus()}if(S(7,()=>{var ie;n.current.selectedItemId=(ie=j())==null?void 0:ie.id,R.emit()}),W||S(5,M),((z=l.current)==null?void 0:z.value)!==void 0){let ie=k??"";(re=(X=l.current).onValueChange)==null||re.call(X,ie);return}}R.emit()}},emit:()=>{o.current.forEach(O=>O())}}),[]),T=v.useMemo(()=>({value:(O,k,W)=>{var Q;k!==((Q=i.current.get(O))==null?void 0:Q.value)&&(i.current.set(O,{value:k,keywords:W}),n.current.filtered.items.set(O,F(k,W)),S(2,()=>{P(),R.emit()}))},item:(O,k)=>(r.current.add(O),k&&(s.current.has(k)?s.current.get(k).add(O):s.current.set(k,new Set([O]))),S(3,()=>{A(),P(),n.current.value||I(),R.emit()}),()=>{i.current.delete(O),r.current.delete(O),n.current.filtered.items.delete(O);let W=j();S(4,()=>{A(),(W==null?void 0:W.getAttribute("id"))===O&&I(),R.emit()})}),group:O=>(s.current.has(O)||s.current.set(O,new Set),()=>{i.current.delete(O),s.current.delete(O)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:y,inputId:w,labelId:_,listInnerRef:C}),[]);function F(O,k){var W,Q;let z=(Q=(W=l.current)==null?void 0:W.filter)!=null?Q:s9;return O?z(O,n.current.search,k):0}function P(){if(!n.current.search||l.current.shouldFilter===!1)return;let O=n.current.filtered.items,k=[];n.current.filtered.groups.forEach(Q=>{let z=s.current.get(Q),X=0;z.forEach(re=>{let ie=O.get(re);X=Math.max(ie,X)}),k.push([Q,X])});let W=C.current;E().sort((Q,z)=>{var X,re;let ie=Q.getAttribute("id"),de=z.getAttribute("id");return((X=O.get(de))!=null?X:0)-((re=O.get(ie))!=null?re:0)}).forEach(Q=>{let z=Q.closest(op);z?z.appendChild(Q.parentElement===z?Q:Q.closest(`${op} > *`)):W.appendChild(Q.parentElement===W?Q:Q.closest(`${op} > *`))}),k.sort((Q,z)=>z[1]-Q[1]).forEach(Q=>{var z;let X=(z=C.current)==null?void 0:z.querySelector(`${ol}[${To}="${encodeURIComponent(Q[0])}"]`);X==null||X.parentElement.appendChild(X)})}function I(){let O=E().find(W=>W.getAttribute("aria-disabled")!=="true"),k=O==null?void 0:O.getAttribute(To);R.setState("value",k||void 0)}function A(){var O,k,W,Q;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let z=0;for(let X of r.current){let re=(k=(O=i.current.get(X))==null?void 0:O.value)!=null?k:"",ie=(Q=(W=i.current.get(X))==null?void 0:W.keywords)!=null?Q:[],de=F(re,ie);n.current.filtered.items.set(X,de),de>0&&z++}for(let[X,re]of s.current)for(let ie of re)if(n.current.filtered.items.get(ie)>0){n.current.filtered.groups.add(X);break}n.current.filtered.count=z}function M(){var O,k,W;let Q=j();Q&&(((O=Q.parentElement)==null?void 0:O.firstChild)===Q&&((W=(k=Q.closest(ol))==null?void 0:k.querySelector(r9))==null||W.scrollIntoView({block:"nearest"})),Q.scrollIntoView({block:"nearest"}))}function j(){var O;return(O=C.current)==null?void 0:O.querySelector(`${lN}[aria-selected="true"]`)}function E(){var O;return Array.from(((O=C.current)==null?void 0:O.querySelectorAll(Zb))||[])}function $(O){let k=E()[O];k&&R.setState("value",k.getAttribute(To))}function q(O){var k;let W=j(),Q=E(),z=Q.findIndex(re=>re===W),X=Q[z+O];(k=l.current)!=null&&k.loop&&(X=z+O<0?Q[Q.length-1]:z+O===Q.length?Q[0]:Q[z+O]),X&&R.setState("value",X.getAttribute(To))}function D(O){let k=j(),W=k==null?void 0:k.closest(ol),Q;for(;W&&!Q;)W=O>0?f9(W,ol):p9(W,ol),Q=W==null?void 0:W.querySelector(Zb);Q?R.setState("value",Q.getAttribute(To)):q(O)}let H=()=>$(E().length-1),N=O=>{O.preventDefault(),O.metaKey?H():O.altKey?D(1):q(1)},B=O=>{O.preventDefault(),O.metaKey?$(0):O.altKey?D(-1):q(-1)};return v.createElement(Ci.div,{ref:t,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:O=>{var k;(k=x.onKeyDown)==null||k.call(x,O);let W=O.nativeEvent.isComposing||O.keyCode===229;if(!(O.defaultPrevented||W))switch(O.key){case"n":case"j":{b&&O.ctrlKey&&N(O);break}case"ArrowDown":{N(O);break}case"p":case"k":{b&&O.ctrlKey&&B(O);break}case"ArrowUp":{B(O);break}case"Home":{O.preventDefault(),$(0);break}case"End":{O.preventDefault(),H();break}case"Enter":{O.preventDefault();let Q=j();if(Q){let z=new Event(Pg);Q.dispatchEvent(z)}}}}},v.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:v9},c),Bh(e,O=>v.createElement(uN.Provider,{value:R},v.createElement(cN.Provider,{value:T},O))))}),i9=v.forwardRef((e,t)=>{var n,r;let s=ms(),i=v.useRef(null),o=v.useContext(dN),l=Fc(),c=fN(e),u=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:o==null?void 0:o.forceMount;fo(()=>{if(!u)return l.item(s,o==null?void 0:o.id)},[u]);let h=pN(s,i,[e.value,e.children,i],e.keywords),d=Bx(),p=_i(S=>S.value&&S.value===h.current),f=_i(S=>u||l.filter()===!1?!0:S.search?S.filtered.items.get(s)>0:!0);v.useEffect(()=>{let S=i.current;if(!(!S||e.disabled))return S.addEventListener(Pg,m),()=>S.removeEventListener(Pg,m)},[f,e.onSelect,e.disabled]);function m(){var S,R;g(),(R=(S=c.current).onSelect)==null||R.call(S,h.current)}function g(){d.setState("value",h.current,!0)}if(!f)return null;let{disabled:b,value:x,onSelect:y,forceMount:_,keywords:w,...C}=e;return v.createElement(Ci.div,{ref:yi(i,t),...C,id:s,"cmdk-item":"",role:"option","aria-disabled":!!b,"aria-selected":!!p,"data-disabled":!!b,"data-selected":!!p,onPointerMove:b||l.getDisablePointerSelection()?void 0:g,onClick:b?void 0:m},e.children)}),o9=v.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:s,...i}=e,o=ms(),l=v.useRef(null),c=v.useRef(null),u=ms(),h=Fc(),d=_i(f=>s||h.filter()===!1?!0:f.search?f.filtered.groups.has(o):!0);fo(()=>h.group(o),[]),pN(o,l,[e.value,e.heading,c]);let p=v.useMemo(()=>({id:o,forceMount:s}),[s]);return v.createElement(Ci.div,{ref:yi(l,t),...i,"cmdk-group":"",role:"presentation",hidden:d?void 0:!0},n&&v.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),Bh(e,f=>v.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},v.createElement(dN.Provider,{value:p},f))))}),a9=v.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,s=v.useRef(null),i=_i(o=>!o.search);return!n&&!i?null:v.createElement(Ci.div,{ref:yi(s,t),...r,"cmdk-separator":"",role:"separator"})}),l9=v.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,s=e.value!=null,i=Bx(),o=_i(u=>u.search),l=_i(u=>u.selectedItemId),c=Fc();return v.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),v.createElement(Ci.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:s?e.value:o,onChange:u=>{s||i.setState("search",u.target.value),n==null||n(u.target.value)}})}),c9=v.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...s}=e,i=v.useRef(null),o=v.useRef(null),l=_i(u=>u.selectedItemId),c=Fc();return v.useEffect(()=>{if(o.current&&i.current){let u=o.current,h=i.current,d,p=new ResizeObserver(()=>{d=requestAnimationFrame(()=>{let f=u.offsetHeight;h.style.setProperty("--cmdk-list-height",f.toFixed(1)+"px")})});return p.observe(u),()=>{cancelAnimationFrame(d),p.unobserve(u)}}},[]),v.createElement(Ci.div,{ref:yi(i,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:c.listId},Bh(e,u=>v.createElement("div",{ref:yi(o,c.listInnerRef),"cmdk-list-sizer":""},u)))}),u9=v.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:o,...l}=e;return v.createElement(U$,{open:n,onOpenChange:r},v.createElement(q$,{container:o},v.createElement(K$,{"cmdk-overlay":"",className:s}),v.createElement(V$,{"aria-label":e.label,"cmdk-dialog":"",className:i},v.createElement(hN,{ref:t,...l}))))}),d9=v.forwardRef((e,t)=>_i(n=>n.filtered.count===0)?v.createElement(Ci.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),h9=v.forwardRef((e,t)=>{let{progress:n,children:r,label:s="Loading...",...i}=e;return v.createElement(Ci.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Bh(e,o=>v.createElement("div",{"aria-hidden":!0},o)))}),Ol=Object.assign(hN,{List:c9,Item:i9,Input:l9,Group:o9,Separator:a9,Dialog:u9,Empty:d9,Loading:h9});function f9(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function p9(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function fN(e){let t=v.useRef(e);return fo(()=>{t.current=e}),t}var fo=typeof window>"u"?v.useEffect:v.useLayoutEffect;function Po(e){let t=v.useRef();return t.current===void 0&&(t.current=e()),t}function _i(e){let t=Bx(),n=()=>e(t.snapshot());return v.useSyncExternalStore(t.subscribe,n,n)}function pN(e,t,n,r=[]){let s=v.useRef(),i=Fc();return fo(()=>{var o;let l=(()=>{var u;for(let h of n){if(typeof h=="string")return h.trim();if(typeof h=="object"&&"current"in h)return h.current?(u=h.current.textContent)==null?void 0:u.trim():s.current}})(),c=r.map(u=>u.trim());i.value(e,l,c),(o=t.current)==null||o.setAttribute(To,l),s.current=l}),s}var m9=()=>{let[e,t]=v.useState(),n=Po(()=>new Map);return fo(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,s)=>{n.current.set(r,s),t({})}};function g9(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Bh({asChild:e,children:t},n){return e&&v.isValidElement(t)?v.cloneElement(g9(t),{ref:t.ref},n(t.props.children)):n(t)}var v9={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function x9(e,t,n={}){const{cycleFilter:r="current",includeCompletedFilter:s=!1,minQueryLength:i=2,maxResults:o=20,debounceMs:l=150}=n,c=rn(),[u,h]=v.useState(e);v.useEffect(()=>{const m=setTimeout(()=>{h(e)},l);return()=>clearTimeout(m)},[e,l]);const d=c.getQueryData(["issues",r,s]),p=v.useMemo(()=>{if(!u||u.trim().length<i)return[];if(!d||d.length===0)return[];const m=u.toLowerCase().trim(),g=[];for(const b of d){if(t.sources.size>0&&b.source&&!t.sources.has(b.source)||!t.includeCompleted&&(b.status==="Done"||b.status==="Completed"||b.status==="Closed"))continue;let x=0,y=null;const _=b.identifier.toLowerCase();_===m?(x=100,y="identifier"):_.startsWith(m)?(x=80,y="identifier"):_.includes(m)&&(x=60,y="identifier");const w=b.title.toLowerCase();if(w.includes(m)){const C=w.startsWith(m)?70:50;C>x&&(x=C,y="title")}t.deepSearch&&b.description&&b.description.toLowerCase().includes(m)&&20>x&&(x=20,y="description"),x>0&&y&&g.push({issue:b,score:x,matchType:y})}return g.sort((b,x)=>x.score!==b.score?x.score-b.score:b.issue.identifier.localeCompare(x.issue.identifier)),g.slice(0,o)},[u,d,t,i,o]),f=v.useMemo(()=>{const m={};for(const g of p){const b=g.issue.source||"unknown";m[b]||(m[b]=[]),m[b].push(g)}return m},[p]);return{results:p,groupedResults:f,isSearching:e!==u,hasResults:p.length>0,resultCount:p.length}}const y9={linear:"Linear",github:"GitHub",rally:"Rally",gitlab:"GitLab",jira:"Jira",unknown:"Unknown"},_9={0:"text-content-muted",1:"text-red-500",2:"text-orange-500",3:"text-yellow-500",4:"text-blue-500"},b9={backlog:"bg-surface-emphasis",todo:"bg-blue-600",in_progress:"bg-yellow-600",in_review:"bg-pink-600",done:"bg-green-600",canceled:"bg-gray-500"};function w9({groupedResults:e,onSelect:t,onExternalLink:n}){const r=Object.keys(e).sort();return a.jsx(a.Fragment,{children:r.map(s=>a.jsx(Ol.Group,{heading:y9[s]||s,children:e[s].map(i=>{const{issue:o,matchType:l}=i,c=Ht[o.status]||"backlog";return a.jsx(Ol.Item,{value:o.identifier,onSelect:()=>t(o.identifier),className:"px-4 py-3 cursor-pointer hover:bg-surface-overlay transition-colors border-b border-gray-750 last:border-b-0 aria-selected:bg-surface-overlay",children:a.jsxs("div",{className:"flex items-start gap-3",children:[o.project&&a.jsx("span",{className:"w-2 h-2 rounded-full shrink-0 mt-1.5",style:{backgroundColor:o.project.color||"#6b7280"},title:o.project.name}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsxs("span",{className:"text-sm font-medium text-content flex items-center gap-1",children:[o.source==="github"&&a.jsx(Hv,{className:"w-3 h-3 text-content-subtle"}),a.jsx("span",{className:"text-content-subtle",children:o.identifier})]}),a.jsx("span",{className:`px-2 py-0.5 rounded text-xs text-content ${b9[c]||"bg-surface-emphasis"}`,children:o.status}),a.jsx("span",{title:`Priority ${o.priority}`,children:a.jsx(ak,{className:`w-2 h-2 fill-current ${_9[o.priority]||"text-content-muted"}`})}),l&&a.jsxs("span",{className:"text-xs text-content-muted",children:["(",l," match)"]})]}),a.jsx("p",{className:"text-sm text-content-body mt-1 line-clamp-2",children:o.title}),o.labels.length>0&&a.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[o.labels.slice(0,3).map(u=>a.jsx("span",{className:"text-xs bg-surface-overlay text-content-subtle px-2 py-0.5 rounded",children:u},u)),o.labels.length>3&&a.jsxs("span",{className:"text-xs text-content-muted",children:["+",o.labels.length-3," more"]})]})]}),a.jsx("button",{onClick:u=>n(o.url,u),className:"p-1 text-content-subtle hover:text-blue-400 hover:bg-surface-emphasis rounded transition-colors shrink-0",title:"Open in tracker",children:a.jsx(Qr,{className:"w-4 h-4"})})]})},o.id)})},s))})}function S9({isOpen:e,onClose:t,onSelectIssue:n,cycleFilter:r="current",includeCompletedFilter:s=!1}){const[i,o]=v.useState(""),[l,c]=v.useState({sources:new Set,includeCompleted:!1,deepSearch:!1}),{groupedResults:u,isSearching:h,hasResults:d,resultCount:p}=x9(i,l,{cycleFilter:r,includeCompletedFilter:s});v.useEffect(()=>{e||(o(""),c({sources:new Set,includeCompleted:!1,deepSearch:!1}))},[e]),v.useEffect(()=>{const b=x=>{x.key==="Escape"&&t()};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,t]);const f=b=>{c(x=>{const y=new Set(x.sources);return y.has(b)?y.delete(b):y.add(b),{...x,sources:y}})},m=b=>{n(b),t()},g=(b,x)=>{x.stopPropagation(),window.open(b,"_blank","noopener,noreferrer")};return e?a.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",children:[a.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:t}),a.jsx("div",{className:"relative bg-surface-raised rounded-xl shadow-2xl w-full max-w-2xl mx-4 max-h-[70vh] overflow-hidden flex flex-col border border-divider",children:a.jsxs(Ol,{className:"flex flex-col h-full",shouldFilter:!1,children:[a.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-divider",children:[a.jsx(AR,{className:"w-5 h-5 text-content-subtle shrink-0"}),a.jsx(Ol.Input,{value:i,onValueChange:o,placeholder:"Search issues...",className:"flex-1 bg-transparent text-content placeholder-gray-400 focus:outline-none text-base",autoFocus:!0}),a.jsx("button",{onClick:t,className:"p-1 text-content-subtle hover:text-content hover:bg-surface-overlay rounded transition-colors shrink-0",children:a.jsx(mt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-divider bg-gray-850 flex-wrap",children:[a.jsx("span",{className:"text-xs text-content-subtle",children:"Filters:"}),["linear","github","rally"].map(b=>a.jsxs("button",{onClick:()=>f(b),className:`px-2 py-1 text-xs rounded transition-colors ${l.sources.size===0||l.sources.has(b)?"bg-blue-600 text-content":"bg-surface-overlay text-content-subtle hover:text-content"}`,children:[b==="github"&&a.jsx(Hv,{className:"w-3 h-3 inline mr-1"}),b.charAt(0).toUpperCase()+b.slice(1)]},b)),a.jsx("div",{className:"w-px h-4 bg-surface-emphasis"}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:l.includeCompleted,onChange:b=>c(x=>({...x,includeCompleted:b.target.checked})),className:"w-3 h-3 rounded border-divider-strong bg-surface-overlay text-blue-600 focus:ring-blue-500 focus:ring-offset-gray-800"}),a.jsx("span",{className:"text-xs text-content-subtle",children:"Show completed"})]}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:l.deepSearch,onChange:b=>c(x=>({...x,deepSearch:b.target.checked})),className:"w-3 h-3 rounded border-divider-strong bg-surface-overlay text-blue-600 focus:ring-blue-500 focus:ring-offset-gray-800"}),a.jsx("span",{className:"text-xs text-content-subtle",children:"Deep search"})]})]}),a.jsxs(Ol.List,{className:"flex-1 overflow-y-auto",children:[i.length>0&&i.length<2&&a.jsx("div",{className:"px-4 py-8 text-center text-sm text-content-subtle",children:"Type at least 2 characters to search"}),i.length>=2&&h&&a.jsx("div",{className:"px-4 py-8 text-center text-sm text-content-subtle",children:"Searching..."}),i.length>=2&&!h&&!d&&a.jsx("div",{className:"px-4 py-8 text-center text-sm text-content-subtle",children:"No issues found"}),i.length>=2&&!h&&d&&a.jsx(w9,{groupedResults:u,onSelect:m,onExternalLink:g})]}),p>0&&a.jsxs("div",{className:"px-4 py-2 border-t border-divider bg-gray-850 text-xs text-content-subtle flex items-center justify-between",children:[a.jsxs("span",{children:[p," result",p!==1?"s":""]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-surface-overlay rounded text-xs",children:"↑"}),a.jsx("kbd",{className:"px-1.5 py-0.5 bg-surface-overlay rounded text-xs",children:"↓"}),"navigate"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-surface-overlay rounded text-xs",children:"Enter"}),"select"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-surface-overlay rounded text-xs",children:"Esc"}),"close"]})]})]})]})})]}):null}const k9="_missionControl_1fx9v_4",C9="_layout_1fx9v_53",N9="_sidebar_1fx9v_60",j9="_resizeHandle_1fx9v_69",E9="_sidebarHeader_1fx9v_83",R9="_sidebarTitle_1fx9v_88",T9="_sidebarSubtitle_1fx9v_94",P9="_projectTree_1fx9v_100",D9="_projectNode_1fx9v_107",M9="_projectHeader_1fx9v_111",L9="_chevron_1fx9v_131",A9="_chevronOpen_1fx9v_137",O9="_projectName_1fx9v_141",I9="_featureCount_1fx9v_148",B9="_featureItem_1fx9v_155",F9="_featureItemSelected_1fx9v_174",z9="_featureStatus_1fx9v_178",$9="_featureLabel_1fx9v_187",H9="_featureId_sidebar_1fx9v_194",W9="_featureState_1fx9v_202",U9="_featureCost_1fx9v_212",q9="_emptyProject_1fx9v_218",K9="_content_1fx9v_226",V9="_contentEmpty_1fx9v_234",Y9="_featureHeader_1fx9v_244",Q9="_featureTitle_1fx9v_253",X9="_featureId_1fx9v_194",G9="_badgeBar_1fx9v_267",J9="_badge_1fx9v_267",Z9="_badgeDisabled_1fx9v_294",e8="_activityContainer_1fx9v_305",t8="_agentSection_1fx9v_315",n8="_agentSectionExpanded_1fx9v_327",r8="_sectionHeader_1fx9v_331",s8="_sectionChevron_1fx9v_350",i8="_sectionType_1fx9v_356",o8="_typeWork_1fx9v_370",a8="_typeReview_1fx9v_375",l8="_typeTest_1fx9v_380",c8="_typeMerge_1fx9v_385",u8="_sectionModel_1fx9v_392",d8="_sectionTime_1fx9v_398",h8="_sectionCost_1fx9v_404",f8="_costSummary_1fx9v_411",p8="_sectionStatus_1fx9v_419",m8="_statusRunning_1fx9v_426",g8="_statusCompleted_1fx9v_431",v8="_statusFailed_1fx9v_435",x8="_sectionPreview_1fx9v_445",y8="_sectionContent_1fx9v_458",_8="_sectionContentConstrained_1fx9v_474",b8="_sectionResizeHandle_1fx9v_479",w8="_unreadDot_1fx9v_498",S8="_isolationOverlay_1fx9v_507",k8="_isolationHeader_1fx9v_516",C8="_isolationClose_1fx9v_525",N8="_isolationContent_1fx9v_541",j8="_modalOverlay_1fx9v_553",E8="_modalContent_1fx9v_564",R8="_modalHeader_1fx9v_575",T8="_modalTitle_1fx9v_583",P8="_modalClose_1fx9v_589",D8="_modalBody_1fx9v_604",M8="_uploadZone_1fx9v_611",L8="_uploadZoneActive_1fx9v_622",A8="_uploadIcon_1fx9v_628",O8="_uploadText_1fx9v_632",I8="_uploadHint_1fx9v_637",B8="_syncButton_1fx9v_678",F8="_spinning_1fx9v_707",z8="_markdownContent_1fx9v_739",$8="_kbdHint_1fx9v_793",H8="_deaconPanel_1fx9v_810",W8="_deaconHeader_1fx9v_815",U8="_deaconTitle_1fx9v_828",q8="_deaconMeta_1fx9v_836",K8="_deaconActionCount_1fx9v_842",V8="_deaconSpecialists_1fx9v_853",Y8="_deaconSpecRow_1fx9v_859",Q8="_deaconSpecDot_1fx9v_865",X8="_deaconSpecName_1fx9v_872",G8="_deaconSpecFailures_1fx9v_877",J8="_deaconActions_1fx9v_883",Z8="_deaconAction_1fx9v_842",e7="_deaconLogToggle_1fx9v_900",t7="_deaconLogViewer_1fx9v_917",n7="_deaconLogEmpty_1fx9v_928",r7="_deaconLogEntry_1fx9v_934",s7="_deaconLogTime_1fx9v_941",i7="_deaconLogLevel_1fx9v_947",o7="_deaconLogMessage_1fx9v_954",a7="_sidebarFooter_1fx9v_962",l7="_versionLabel_1fx9v_971",U={missionControl:k9,layout:C9,sidebar:N9,resizeHandle:j9,sidebarHeader:E9,sidebarTitle:R9,sidebarSubtitle:T9,projectTree:P9,projectNode:D9,projectHeader:M9,chevron:L9,chevronOpen:A9,projectName:O9,featureCount:I9,featureItem:B9,featureItemSelected:F9,featureStatus:z9,featureLabel:$9,featureId_sidebar:H9,featureState:W9,featureCost:U9,emptyProject:q9,content:K9,contentEmpty:V9,featureHeader:Y9,featureTitle:Q9,featureId:X9,badgeBar:G9,badge:J9,badgeDisabled:Z9,activityContainer:e8,agentSection:t8,agentSectionExpanded:n8,sectionHeader:r8,sectionChevron:s8,sectionType:i8,typeWork:o8,typeReview:a8,typeTest:l8,typeMerge:c8,sectionModel:u8,sectionTime:d8,sectionCost:h8,costSummary:f8,sectionStatus:p8,statusRunning:m8,statusCompleted:g8,statusFailed:v8,sectionPreview:x8,sectionContent:y8,sectionContentConstrained:_8,sectionResizeHandle:b8,unreadDot:w8,isolationOverlay:S8,isolationHeader:k8,isolationClose:C8,isolationContent:N8,modalOverlay:j8,modalContent:E8,modalHeader:R8,modalTitle:T8,modalClose:P8,modalBody:D8,uploadZone:M8,uploadZoneActive:L8,uploadIcon:A8,uploadText:O8,uploadHint:I8,syncButton:B8,spinning:F8,markdownContent:z8,kbdHint:$8,deaconPanel:H8,deaconHeader:W8,deaconTitle:U8,deaconMeta:q8,deaconActionCount:K8,deaconSpecialists:V8,deaconSpecRow:Y8,deaconSpecDot:Q8,deaconSpecName:X8,deaconSpecFailures:G8,deaconActions:J8,deaconAction:Z8,deaconLogToggle:e7,deaconLogViewer:t7,deaconLogEmpty:n7,deaconLogEntry:r7,deaconLogTime:s7,deaconLogLevel:i7,deaconLogMessage:o7,sidebarFooter:a7,versionLabel:l7};function c7({status:e,agentStatus:t,stateLabel:n,isRally:r}){if(r){const s=n==="Done"?"var(--mc-success)":n==="In Progress"?"var(--mc-warning)":"var(--mc-text-muted)";return a.jsx(hk,{size:14,style:{color:s}})}return e==="running"?a.jsx(ye,{size:14,className:U.spinning,style:{color:"var(--mc-success)"}}):t==="suspended"||n==="In Progress"||n==="Suspended"?a.jsx(tn,{size:14,style:{color:"var(--mc-warning)"}}):e==="has_state"?a.jsx(Di,{size:14,style:{color:"var(--mc-text-muted)"}}):a.jsx(ak,{size:14,style:{color:"var(--mc-text-muted)"}})}function u7(e){return e<.01?"<$0.01":e<1?`$${e.toFixed(2)}`:`$${e.toFixed(2)}`}function d7({feature:e,isSelected:t,onSelect:n,title:r,cost:s}){const i=e.isRally&&e.childCount&&e.childCount>0?Math.round((e.completedCount||0)/e.childCount*100):null;return a.jsxs("button",{className:`${U.featureItem} ${t?U.featureItemSelected:""}`,onClick:n,children:[a.jsx("span",{className:U.featureStatus,children:e.isShadow?a.jsx(kc,{size:14,style:{color:"var(--mc-accent)"}}):a.jsx(c7,{status:e.status,agentStatus:e.agentStatus,stateLabel:e.stateLabel,isRally:e.isRally})}),a.jsx("span",{className:U.featureId_sidebar,children:e.issueId}),a.jsx("span",{className:U.featureLabel,children:r||e.issueId}),e.isRally&&e.childCount!=null&&e.childCount>0?a.jsxs("span",{className:U.featureState,title:`${e.completedCount||0}/${e.childCount} stories done${e.inProgressCount?`, ${e.inProgressCount} active`:""}`,children:[e.completedCount||0,"/",e.childCount,i!==null&&a.jsx("span",{style:{display:"inline-block",width:24,height:4,marginLeft:4,background:"var(--mc-border)",borderRadius:2,overflow:"hidden",verticalAlign:"middle"},children:a.jsx("span",{style:{display:"block",width:`${i}%`,height:"100%",background:i===100?"var(--mc-success)":"var(--mc-warning)",borderRadius:2}})})]}):a.jsx("span",{className:U.featureState,children:e.stateLabel}),s!==void 0&&s>0&&a.jsx("span",{className:U.featureCost,children:u7(s)})]})}function h7({name:e,features:t,selectedFeature:n,onSelectFeature:r,issueTitles:s,issueCosts:i}){const[o,l]=v.useState(t.length>0);return a.jsxs("div",{className:U.projectNode,children:[a.jsxs("button",{className:U.projectHeader,onClick:()=>l(!o),children:[a.jsx(Sc,{className:`${U.chevron} ${o?U.chevronOpen:""}`,size:14}),a.jsx("span",{className:U.projectName,children:e}),a.jsx("span",{className:U.featureCount,children:t.length})]}),o&&(t.length>0?t.map(c=>a.jsx(d7,{feature:c,isSelected:n===c.issueId,onSelect:()=>r(c.issueId),title:(s==null?void 0:s[c.issueId.toLowerCase()])||(s==null?void 0:s[c.issueId])||c.title,cost:(i==null?void 0:i[c.issueId.toLowerCase()])||(i==null?void 0:i[c.issueId])},c.issueId)):a.jsx("div",{className:U.emptyProject,children:"(no active features)"}))]})}const f7={work:U.typeWork,review:U.typeReview,test:U.typeTest,merge:U.typeMerge},p7={running:U.statusRunning,completed:U.statusCompleted,failed:U.statusFailed},m7={work:"#10B981",review:"#F59E0B",test:"#6366F1",merge:"#EC4899"};function g7(e){return e===null?"":e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`}function v7(e){if(!e)return"";try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function ew(e){return!e||e==="unknown"?"":e.replace("claude-opus-4-6","Opus 4.6").replace("claude-sonnet-4-5-20250929","Sonnet 4.5").replace("claude-haiku-4-5-20251001","Haiku 4.5").replace("claude-","").replace("specialist","")}function x7(e){return e<.01?"<$0.01":`$${e.toFixed(2)}`}function y7(e){if(!e)return"(no output yet)";const t=e.split(`
661
- `).filter(r=>r.trim().length>0);if(t.length===0)return"(no output yet)";const n=t[t.length-1].trim();return n.length>120?n.slice(0,120)+"...":n}function _7({section:e,isUnread:t,onClick:n,cost:r,defaultExpanded:s=!1}){const i=v.useRef(null),[o,l]=v.useState(s),[c,u]=v.useState(null),h=v.useRef(!1),d=v.useRef(0),p=v.useRef(0);v.useEffect(()=>{e.status==="running"&&l(!0)},[e.status]),v.useEffect(()=>{i.current&&o&&e.status==="running"&&requestAnimationFrame(()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight)})},[e.transcript,e.status,o]);const f=v.useCallback(w=>{var C;w.preventDefault(),w.stopPropagation(),h.current=!0,d.current=w.clientY,p.current=((C=i.current)==null?void 0:C.offsetHeight)||300,document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[]);v.useEffect(()=>{const w=S=>{if(!h.current)return;const R=S.clientY-d.current,T=Math.max(80,Math.min(2e3,p.current+R));u(T)},C=()=>{h.current&&(h.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",w),document.addEventListener("mouseup",C),()=>{document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",C)}},[]);const m=v.useCallback(()=>{u(w=>w===null?400:null)},[]),g=w=>{if(w.button===1||w.ctrlKey){n();return}l(!o)},b=m7[e.type]||"var(--mc-border)",x=c!==null,y={};x&&o&&(y.maxHeight=`${c}px`);const _=x?`${U.sectionContent} ${U.sectionContentConstrained}`:U.sectionContent;return a.jsxs("div",{className:`${U.agentSection} ${o?U.agentSectionExpanded:""}`,style:{borderLeftColor:b},children:[a.jsxs("div",{className:U.sectionHeader,onClick:g,title:"Click to expand/collapse, Ctrl+click to isolate",children:[a.jsx("span",{className:U.sectionChevron,children:o?a.jsx(mh,{size:12,style:{color:"var(--mc-text-muted)"}}):a.jsx(Sc,{size:12,style:{color:"var(--mc-text-muted)"}})}),e.status==="running"?a.jsx(ye,{size:12,className:U.spinning,style:{color:"var(--mc-success)",flexShrink:0}}):a.jsx("div",{className:`${U.sectionStatus} ${p7[e.status]||U.statusCompleted}`}),a.jsx("span",{className:`${U.sectionType} ${f7[e.type]||""}`,children:e.type}),ew(e.model)&&a.jsx("span",{className:U.sectionModel,children:ew(e.model)}),a.jsxs("span",{className:U.sectionTime,children:[v7(e.startedAt),e.duration!==null&&` (${g7(e.duration)})`]}),r!==void 0&&r>0&&a.jsx("span",{className:U.sectionCost,children:x7(r)}),t&&a.jsx("div",{className:U.unreadDot})]}),!o&&a.jsx("div",{className:U.sectionPreview,children:y7(e.transcript)}),o&&a.jsxs(a.Fragment,{children:[a.jsx("div",{ref:i,className:_,style:y,children:e.transcript||"(no output yet)"}),a.jsx("div",{className:U.sectionResizeHandle,onMouseDown:f,onDoubleClick:m,title:x?"Drag to resize, double-click to unconstrain":"Drag to constrain height, double-click to set default",children:a.jsx(CR,{size:12,style:{color:"var(--mc-text-muted)",opacity:x?.8:.4}})})]})]})}const b7={work:U.typeWork,review:U.typeReview,test:U.typeTest,merge:U.typeMerge};function tw(e){return!e||e==="unknown"?"":e.replace("claude-opus-4-6","Opus 4.6").replace("claude-sonnet-4-5-20250929","Sonnet 4.5").replace("claude-haiku-4-5-20251001","Haiku 4.5").replace("claude-","").replace("specialist","")}function w7({section:e,onClose:t}){const n=v.useRef(null);return v.useEffect(()=>{e.status==="running"&&n.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.transcript,e.status]),v.useEffect(()=>{history.pushState({isolation:!0},"");const r=()=>{t()};return window.addEventListener("popstate",r),()=>{window.removeEventListener("popstate",r)}},[t]),a.jsxs("div",{className:U.isolationOverlay,children:[a.jsxs("div",{className:U.isolationHeader,children:[a.jsxs("button",{className:U.isolationClose,onClick:t,children:[a.jsx("kbd",{className:U.kbdHint,children:"Esc"})," Close"]}),a.jsx("span",{className:`${U.sectionType} ${b7[e.type]||""}`,children:e.type}),tw(e.model)&&a.jsx("span",{className:U.sectionModel,children:tw(e.model)}),a.jsx("span",{className:U.sectionTime,children:e.sessionId})]}),a.jsx("div",{ref:n,className:U.isolationContent,children:e.transcript||"(no output)"})]})}async function S7(e){const t=await fetch(`/api/mission-control/activity/${e}`);if(!t.ok)throw new Error("Failed to fetch activity");return t.json()}function k7(e){return e==="Done"||e==="Completed"||e==="Closed"?"var(--mc-success)":e==="In Progress"||e==="Started"||e==="Active"?"var(--mc-warning)":e==="In Review"||e==="Review"||e==="QA"||e==="Testing"?"#ec4899":"var(--mc-text-muted)"}function nw({feature:e,issues:t}){const n=t.filter(c=>c.source==="rally"&&c.parentRef===e.issueId),r=t.find(c=>c.source==="rally"&&c.identifier===e.issueId);if(n.length===0&&!r)return null;const s=e.completedCount||0,i=e.childCount||n.length,o=e.inProgressCount||0,l=i>0?Math.round(s/i*100):0;return a.jsxs("div",{style:{marginBottom:16},children:[a.jsxs("div",{style:{background:"var(--mc-bg-secondary)",border:"1px solid var(--mc-border)",borderLeft:"3px solid #6366f1",borderRadius:6,padding:"12px 16px",marginBottom:12},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[a.jsx("span",{style:{fontWeight:600,color:"var(--mc-text-primary)",fontSize:"var(--mc-font-size-sm)"},children:e.issueId}),(r==null?void 0:r.url)&&a.jsx("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--mc-text-muted)"},children:a.jsx(Qr,{size:12})}),e.rawTrackerState&&a.jsxs("span",{style:{fontSize:11,padding:"1px 6px",borderRadius:3,background:"rgba(107,114,128,0.15)",color:"var(--mc-text-muted)"},children:["Rally: ",e.rawTrackerState]}),e.stateLabel&&e.stateLabel!==e.rawTrackerState&&a.jsxs("span",{style:{fontSize:11,padding:"1px 6px",borderRadius:3,background:e.stateLabel==="In Progress"?"rgba(168,85,247,0.15)":"rgba(34,197,94,0.15)",color:e.stateLabel==="In Progress"?"#a855f7":"#22c55e"},children:["Derived: ",e.stateLabel]})]}),i>0&&a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("div",{style:{flex:1,height:6,background:"var(--mc-border)",borderRadius:3,overflow:"hidden"},children:a.jsx("div",{style:{width:`${l}%`,height:"100%",background:l===100?"var(--mc-success)":"#6366f1",borderRadius:3,transition:"width 0.3s ease"}})}),a.jsxs("span",{style:{fontSize:11,color:"var(--mc-text-muted)",whiteSpace:"nowrap"},children:[s,"/",i," done",o>0?`, ${o} active`:""]})]})]}),n.length>0&&a.jsxs("div",{style:{background:"var(--mc-bg-secondary)",border:"1px solid var(--mc-border)",borderRadius:6,overflow:"hidden"},children:[a.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--mc-border)",fontSize:"var(--mc-font-size-xs)",fontWeight:600,color:"var(--mc-text-muted)",textTransform:"uppercase",letterSpacing:"0.05em"},children:["User Stories (",n.length,")"]}),n.map(c=>{var u;return a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",borderBottom:"1px solid var(--mc-border)",fontSize:"var(--mc-font-size-sm)"},children:[a.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:k7(c.status),flexShrink:0}}),a.jsx("a",{href:c.url,target:"_blank",rel:"noopener noreferrer",style:{color:"#6366f1",textDecoration:"none",fontFamily:"monospace",fontSize:11,flexShrink:0},children:c.identifier}),a.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--mc-text-primary)"},children:c.title}),((u=c.assignee)==null?void 0:u.name)&&a.jsx("span",{style:{fontSize:11,color:"var(--mc-text-muted)",flexShrink:0},children:c.assignee.name}),c.rawTrackerState&&a.jsx("span",{style:{fontSize:10,padding:"1px 5px",borderRadius:3,background:"rgba(107,114,128,0.12)",color:"var(--mc-text-muted)",flexShrink:0},children:c.rawTrackerState})]},c.id)})]})]})}function C7({issueId:e,issues:t=[],featureData:n}){const[r,s]=v.useState(null),[i,o]=v.useState(new Set),l=v.useRef([]),c=v.useRef(null),{data:u,isLoading:h}=ue({queryKey:["mission-control-activity",e],queryFn:()=>S7(e),refetchInterval:5e3}),d=(u==null?void 0:u.sections)||[],p=(u==null?void 0:u.costByStage)||{},f=(u==null?void 0:u.totalCost)||0;v.useEffect(()=>{const _=d.map(C=>C.sessionId);_.filter(C=>!l.current.includes(C)).length>0&&l.current.length>0&&o(C=>new Set(C)),l.current=_},[d]);const m=_=>{s(_),o(w=>new Set([...w,_.sessionId]))},g=()=>{s(null)},b=v.useRef(null),x=v.useRef(!1);if(v.useEffect(()=>{b.current!==e&&(b.current=e,x.current=!1),d.length>0&&c.current&&!x.current&&(x.current=!0,requestAnimationFrame(()=>{requestAnimationFrame(()=>{c.current&&(c.current.scrollTop=c.current.scrollHeight)})}))},[e,d]),v.useEffect(()=>{const _=w=>{w.key==="Escape"&&r&&g()};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[r]),h&&d.length===0)return a.jsx("div",{className:U.activityContainer,children:a.jsx("div",{style:{color:"var(--mc-text-muted)",fontSize:"var(--mc-font-size-sm)"},children:"Loading activity..."})});if(d.length===0){const _=(n==null?void 0:n.isRally)===!0;return a.jsxs("div",{className:U.activityContainer,children:[_&&n&&a.jsx(nw,{feature:n,issues:t}),a.jsx("div",{style:{color:"var(--mc-text-muted)",fontSize:"var(--mc-font-size-sm)"},children:"No agent activity yet for this feature."})]})}const y=(n==null?void 0:n.isRally)===!0;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{ref:c,className:U.activityContainer,children:[y&&n&&a.jsx(nw,{feature:n,issues:t}),f>0&&a.jsxs("div",{className:U.costSummary,children:["Total: $",f<.01?"<0.01":f.toFixed(2)]}),d.map((_,w)=>{const R=({work:["implementation"],review:["review"],test:["test"],merge:["merge"]}[_.type]||[_.type]).reduce((P,I)=>{var A;return P+(((A=p[I])==null?void 0:A.cost)||0)},0)||void 0,T=w===d.length-1,F=_.status==="running"||T;return a.jsx(_7,{section:_,isUnread:!i.has(_.sessionId)&&l.current.length>0,onClick:()=>m(_),cost:R,defaultExpanded:F},_.sessionId)})]}),r&&a.jsx(w7,{section:r,onClose:g})]})}function rw(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function N7(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function j7(e,t,n){const s=Mh((n||{}).ignore||[]),i=E7(t);let o=-1;for(;++o<i.length;)N2(e,"text",l);function l(u,h){let d=-1,p;for(;++d<h.length;){const f=h[d],m=p?p.children:void 0;if(s(f,m?m.indexOf(f):void 0,p))return;p=f}if(p)return c(u,h)}function c(u,h){const d=h[h.length-1],p=i[o][0],f=i[o][1];let m=0;const b=d.children.indexOf(u);let x=!1,y=[];p.lastIndex=0;let _=p.exec(u.value);for(;_;){const w=_.index,C={index:_.index,input:_.input,stack:[...h,u]};let S=f(..._,C);if(typeof S=="string"&&(S=S.length>0?{type:"text",value:S}:void 0),S===!1?p.lastIndex=w+1:(m!==w&&y.push({type:"text",value:u.value.slice(m,w)}),Array.isArray(S)?y.push(...S):S&&y.push(S),m=w+_[0].length,x=!0),!p.global)break;_=p.exec(u.value)}return x?(m<u.value.length&&y.push({type:"text",value:u.value.slice(m)}),d.children.splice(b,1,...y)):y=[u],b+y.length}}function E7(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const s=n[r];t.push([R7(s[0]),T7(s[1])])}return t}function R7(e){return typeof e=="string"?new RegExp(N7(e),"g"):e}function T7(e){return typeof e=="function"?e:function(){return e}}const ap="phrasing",lp=["autolink","link","image","label"];function P7(){return{transforms:[B7],enter:{literalAutolink:M7,literalAutolinkEmail:cp,literalAutolinkHttp:cp,literalAutolinkWww:cp},exit:{literalAutolink:I7,literalAutolinkEmail:O7,literalAutolinkHttp:L7,literalAutolinkWww:A7}}}function D7(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:ap,notInConstruct:lp},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:ap,notInConstruct:lp},{character:":",before:"[ps]",after:"\\/",inConstruct:ap,notInConstruct:lp}]}}function M7(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function cp(e){this.config.enter.autolinkProtocol.call(this,e)}function L7(e){this.config.exit.autolinkProtocol.call(this,e)}function A7(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function O7(e){this.config.exit.autolinkEmail.call(this,e)}function I7(e){this.exit(e)}function B7(e){j7(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,F7],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),z7]],{ignore:["link","linkReference"]})}function F7(e,t,n,r,s){let i="";if(!mN(s)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!$7(n)))return!1;const o=H7(n+r);if(!o[0])return!1;const l={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function z7(e,t,n,r){return!mN(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function $7(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function H7(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=rw(e,"(");let i=rw(e,")");for(;r!==-1&&s>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function mN(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||uo(n)||Th(n))&&(!t||n!==47)}gN.peek=G7;function W7(){this.buffer()}function U7(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function q7(){this.buffer()}function K7(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function V7(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Cr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Y7(e){this.exit(e)}function Q7(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Cr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function X7(e){this.exit(e)}function G7(){return"["}function gN(e,t,n,r){const s=n.createTracker(r);let i=s.move("[^");const o=n.enter("footnoteReference"),l=n.enter("reference");return i+=s.move(n.safe(n.associationId(e),{after:"]",before:i})),l(),o(),i+=s.move("]"),i}function J7(){return{enter:{gfmFootnoteCallString:W7,gfmFootnoteCall:U7,gfmFootnoteDefinitionLabelString:q7,gfmFootnoteDefinition:K7},exit:{gfmFootnoteCallString:V7,gfmFootnoteCall:Y7,gfmFootnoteDefinitionLabelString:Q7,gfmFootnoteDefinition:X7}}}function Z7(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:gN},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,o){const l=i.createTracker(o);let c=l.move("[^");const u=i.enter("footnoteDefinition"),h=i.enter("label");return c+=l.move(i.safe(i.associationId(r),{before:c,after:"]"})),h(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((t?`
662
- `:" ")+i.indentLines(i.containerFlow(r,l.current()),t?vN:eH))),u(),c}}function eH(e,t,n){return t===0?e:vN(e,t,n)}function vN(e,t,n){return(n?"":" ")+e}const tH=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];xN.peek=oH;function nH(){return{canContainEols:["delete"],enter:{strikethrough:sH},exit:{strikethrough:iH}}}function rH(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:tH}],handlers:{delete:xN}}}function sH(e){this.enter({type:"delete",children:[]},e)}function iH(e){this.exit(e)}function xN(e,t,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let o=s.move("~~");return o+=n.containerPhrasing(e,{...s.current(),before:o,after:"~"}),o+=s.move("~~"),i(),o}function oH(){return"~"}function aH(e){return e.length}function lH(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||aH,i=[],o=[],l=[],c=[];let u=0,h=-1;for(;++h<e.length;){const g=[],b=[];let x=-1;for(e[h].length>u&&(u=e[h].length);++x<e[h].length;){const y=cH(e[h][x]);if(n.alignDelimiters!==!1){const _=s(y);b[x]=_,(c[x]===void 0||_>c[x])&&(c[x]=_)}g.push(y)}o[h]=g,l[h]=b}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<u;)i[d]=sw(r[d]);else{const g=sw(r);for(;++d<u;)i[d]=g}d=-1;const p=[],f=[];for(;++d<u;){const g=i[d];let b="",x="";g===99?(b=":",x=":"):g===108?b=":":g===114&&(x=":");let y=n.alignDelimiters===!1?1:Math.max(1,c[d]-b.length-x.length);const _=b+"-".repeat(y)+x;n.alignDelimiters!==!1&&(y=b.length+y+x.length,y>c[d]&&(c[d]=y),f[d]=y),p[d]=_}o.splice(1,0,p),l.splice(1,0,f),h=-1;const m=[];for(;++h<o.length;){const g=o[h],b=l[h];d=-1;const x=[];for(;++d<u;){const y=g[d]||"";let _="",w="";if(n.alignDelimiters!==!1){const C=c[d]-(b[d]||0),S=i[d];S===114?_=" ".repeat(C):S===99?C%2?(_=" ".repeat(C/2+.5),w=" ".repeat(C/2-.5)):(_=" ".repeat(C/2),w=_):w=" ".repeat(C)}n.delimiterStart!==!1&&!d&&x.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&y==="")&&(n.delimiterStart!==!1||d)&&x.push(" "),n.alignDelimiters!==!1&&x.push(_),x.push(y),n.alignDelimiters!==!1&&x.push(w),n.padding!==!1&&x.push(" "),(n.delimiterEnd!==!1||d!==u-1)&&x.push("|")}m.push(n.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return m.join(`
663
- `)}function cH(e){return e==null?"":String(e)}function sw(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function uH(e,t,n,r){const s=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),dH);return s(),o}function dH(e,t,n){return">"+(n?"":" ")+e}function hH(e,t){return iw(e,t.inConstruct,!0)&&!iw(e,t.notInConstruct,!1)}function iw(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function ow(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
664
- `&&hH(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
665
- `}function fH(e,t){const n=String(e);let r=n.indexOf(t),s=r,i=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++i>o&&(o=i):i=1,s=r+t.length,r=n.indexOf(t,s);return o}function pH(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function mH(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function gH(e,t,n,r){const s=mH(n),i=e.value||"",o=s==="`"?"GraveAccent":"Tilde";if(pH(e,n)){const d=n.enter("codeIndented"),p=n.indentLines(i,vH);return d(),p}const l=n.createTracker(r),c=s.repeat(Math.max(fH(i,s)+1,3)),u=n.enter("codeFenced");let h=l.move(c);if(e.lang){const d=n.enter(`codeFencedLang${o}`);h+=l.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...l.current()})),d()}if(e.lang&&e.meta){const d=n.enter(`codeFencedMeta${o}`);h+=l.move(" "),h+=l.move(n.safe(e.meta,{before:h,after:`
666
- `,encode:["`"],...l.current()})),d()}return h+=l.move(`
667
- `),i&&(h+=l.move(i+`
668
- `)),h+=l.move(c),u(),h}function vH(e,t,n){return(n?"":" ")+e}function Fx(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function xH(e,t,n,r){const s=Fx(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("definition");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":`
669
- `,...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=c.move(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),l()),o(),u}function yH(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function hc(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Gd(e,t,n){const r=ka(e),s=ka(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}yN.peek=_H;function yN(e,t,n,r){const s=yH(n),i=n.enter("emphasis"),o=n.createTracker(r),l=o.move(s);let c=o.move(n.containerPhrasing(e,{after:s,before:l,...o.current()}));const u=c.charCodeAt(0),h=Gd(r.before.charCodeAt(r.before.length-1),u,s);h.inside&&(c=hc(u)+c.slice(1));const d=c.charCodeAt(c.length-1),p=Gd(r.after.charCodeAt(0),d,s);p.inside&&(c=c.slice(0,-1)+hc(d));const f=o.move(s);return i(),n.attentionEncodeSurroundingInfo={after:p.outside,before:h.outside},l+c+f}function _H(e,t,n){return n.options.emphasis||"*"}function bH(e,t){let n=!1;return Px(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,wg}),!!((!e.depth||e.depth<3)&&kx(e)&&(t.options.setext||n))}function wH(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(bH(e,n)){const h=n.enter("headingSetext"),d=n.enter("phrasing"),p=n.containerPhrasing(e,{...i.current(),before:`
670
- `,after:`
671
- `});return d(),h(),p+`
672
- `+(s===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
673
- `))+1))}const o="#".repeat(s),l=n.enter("headingAtx"),c=n.enter("phrasing");i.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
674
- `,...i.current()});return/^[\t ]/.test(u)&&(u=hc(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),c(),l(),u}_N.peek=SH;function _N(e){return e.value||""}function SH(){return"<"}bN.peek=kH;function bN(e,t,n,r){const s=Fx(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("image");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=c.move(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),l()),u+=c.move(")"),o(),u}function kH(){return"!"}wN.peek=CH;function wN(e,t,n,r){const s=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const u=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const h=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=h,i(),s==="full"||!u||u!==d?c+=l.move(d+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function CH(){return"!"}SN.peek=NH;function SN(e,t,n){let r=e.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const o=n.unsafe[i],l=n.compilePattern(o);let c;if(o.atBreak)for(;c=l.exec(r);){let u=c.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(c.index+1)}}return s+r+s}function NH(){return"`"}function kN(e,t){const n=kx(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}CN.peek=jH;function CN(e,t,n,r){const s=Fx(n),i=s==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let l,c;if(kN(e,n)){const h=n.stack;n.stack=[],l=n.enter("autolink");let d=o.move("<");return d+=o.move(n.containerPhrasing(e,{before:d,after:">",...o.current()})),d+=o.move(">"),l(),n.stack=h,d}l=n.enter("link"),c=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(c=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),c(),e.title&&(c=n.enter(`title${i}`),u+=o.move(" "+s),u+=o.move(n.safe(e.title,{before:u,after:s,...o.current()})),u+=o.move(s),c()),u+=o.move(")"),l(),u}function jH(e,t,n){return kN(e,n)?"<":"["}NN.peek=EH;function NN(e,t,n,r){const s=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const h=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=h,i(),s==="full"||!u||u!==d?c+=l.move(d+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function EH(){return"["}function zx(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function RH(e){const t=zx(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function TH(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function jN(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function PH(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?TH(n):zx(n);const l=e.ordered?o==="."?")":".":RH(n);let c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),jN(n)===o&&h){let d=-1;for(;++d<e.children.length;){const p=e.children[d];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=l),n.bulletCurrent=o;const u=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=i,s(),u}function DH(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function MH(e,t,n,r){const s=DH(n);let i=n.bulletCurrent||zx(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let o=i.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=n.createTracker(r);l.move(i+" ".repeat(o-i.length)),l.shift(o);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.current()),h);return c(),u;function h(d,p,f){return p?(f?"":" ".repeat(o))+d:(f?i:i+" ".repeat(o-i.length))+d}}function LH(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,r);return i(),s(),o}const AH=Mh(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function OH(e,t,n,r){return(e.children.some(function(o){return AH(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function IH(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}EN.peek=BH;function EN(e,t,n,r){const s=IH(n),i=n.enter("strong"),o=n.createTracker(r),l=o.move(s+s);let c=o.move(n.containerPhrasing(e,{after:s,before:l,...o.current()}));const u=c.charCodeAt(0),h=Gd(r.before.charCodeAt(r.before.length-1),u,s);h.inside&&(c=hc(u)+c.slice(1));const d=c.charCodeAt(c.length-1),p=Gd(r.after.charCodeAt(0),d,s);p.inside&&(c=c.slice(0,-1)+hc(d));const f=o.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:p.outside,before:h.outside},l+c+f}function BH(e,t,n){return n.options.strong||"*"}function FH(e,t,n,r){return n.safe(e.value,r)}function zH(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function $H(e,t,n){const r=(jN(n)+(n.options.ruleSpaces?" ":"")).repeat(zH(n));return n.options.ruleSpaces?r.slice(0,-1):r}const RN={blockquote:uH,break:ow,code:gH,definition:xH,emphasis:yN,hardBreak:ow,heading:wH,html:_N,image:bN,imageReference:wN,inlineCode:SN,link:CN,linkReference:NN,list:PH,listItem:MH,paragraph:LH,root:OH,strong:EN,text:FH,thematicBreak:$H};function HH(){return{enter:{table:WH,tableData:aw,tableHeader:aw,tableRow:qH},exit:{codeText:KH,table:UH,tableData:up,tableHeader:up,tableRow:up}}}function WH(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function UH(e){this.exit(e),this.data.inTable=void 0}function qH(e){this.enter({type:"tableRow",children:[]},e)}function up(e){this.exit(e)}function aw(e){this.enter({type:"tableCell",children:[]},e)}function KH(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,VH));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function VH(e,t){return t==="|"?t:e}function YH(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
675
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:o,tableCell:c,tableRow:l}};function o(f,m,g,b){return u(h(f,g,b),f.align)}function l(f,m,g,b){const x=d(f,g,b),y=u([x]);return y.slice(0,y.indexOf(`
676
- `))}function c(f,m,g,b){const x=g.enter("tableCell"),y=g.enter("phrasing"),_=g.containerPhrasing(f,{...b,before:i,after:i});return y(),x(),_}function u(f,m){return lH(f,{align:m,alignDelimiters:r,padding:n,stringLength:s})}function h(f,m,g){const b=f.children;let x=-1;const y=[],_=m.enter("table");for(;++x<b.length;)y[x]=d(b[x],m,g);return _(),y}function d(f,m,g){const b=f.children;let x=-1;const y=[],_=m.enter("tableRow");for(;++x<b.length;)y[x]=c(b[x],f,m,g);return _(),y}function p(f,m,g){let b=RN.inlineCode(f,m,g);return g.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function QH(){return{exit:{taskListCheckValueChecked:lw,taskListCheckValueUnchecked:lw,paragraph:GH}}}function XH(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:JH}}}function lw(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function GH(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=t.children;let i=-1,o;for(;++i<s.length;){const l=s[i];if(l.type==="paragraph"){o=l;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function JH(e,t,n,r){const s=e.children[0],i=typeof e.checked=="boolean"&&s&&s.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=n.createTracker(r);i&&l.move(o);let c=RN.listItem(e,t,n,{...r,...l.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),c;function u(h){return h+o}}function ZH(){return[P7(),J7(),nH(),HH(),QH()]}function eW(e){return{extensions:[D7(),Z7(e),rH(),YH(e),XH()]}}const tW={tokenize:aW,partial:!0},TN={tokenize:lW,partial:!0},PN={tokenize:cW,partial:!0},DN={tokenize:uW,partial:!0},nW={tokenize:dW,partial:!0},MN={name:"wwwAutolink",tokenize:iW,previous:AN},LN={name:"protocolAutolink",tokenize:oW,previous:ON},js={name:"emailAutolink",tokenize:sW,previous:IN},es={};function rW(){return{text:es}}let ji=48;for(;ji<123;)es[ji]=js,ji++,ji===58?ji=65:ji===91&&(ji=97);es[43]=js;es[45]=js;es[46]=js;es[95]=js;es[72]=[js,LN];es[104]=[js,LN];es[87]=[js,MN];es[119]=[js,MN];function sW(e,t,n){const r=this;let s,i;return o;function o(d){return!Dg(d)||!IN.call(r,r.previous)||$x(r.events)?n(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(d))}function l(d){return Dg(d)?(e.consume(d),l):d===64?(e.consume(d),c):n(d)}function c(d){return d===46?e.check(nW,h,u)(d):d===45||d===95||en(d)?(i=!0,e.consume(d),c):h(d)}function u(d){return e.consume(d),s=!0,c}function h(d){return i&&s&&hn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d)):n(d)}}function iW(e,t,n){const r=this;return s;function s(o){return o!==87&&o!==119||!AN.call(r,r.previous)||$x(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(tW,e.attempt(TN,e.attempt(PN,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function oW(e,t,n){const r=this;let s="",i=!1;return o;function o(d){return(d===72||d===104)&&ON.call(r,r.previous)&&!$x(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(d),e.consume(d),l):n(d)}function l(d){if(hn(d)&&s.length<5)return s+=String.fromCodePoint(d),e.consume(d),l;if(d===58){const p=s.toLowerCase();if(p==="http"||p==="https")return e.consume(d),c}return n(d)}function c(d){return d===47?(e.consume(d),i?u:(i=!0,c)):n(d)}function u(d){return d===null||Kd(d)||Fe(d)||uo(d)||Th(d)?n(d):e.attempt(TN,e.attempt(PN,h),n)(d)}function h(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function aW(e,t,n){let r=0;return s;function s(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),s):o===46&&r===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):t(o)}}function lW(e,t,n){let r,s,i;return o;function o(u){return u===46||u===95?e.check(DN,c,l)(u):u===null||Fe(u)||uo(u)||u!==45&&Th(u)?c(u):(i=!0,e.consume(u),o)}function l(u){return u===95?r=!0:(s=r,r=void 0),e.consume(u),o}function c(u){return s||r||!i?n(u):t(u)}}function cW(e,t){let n=0,r=0;return s;function s(o){return o===40?(n++,e.consume(o),s):o===41&&r<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(DN,t,i)(o):o===null||Fe(o)||uo(o)?t(o):(e.consume(o),s)}function i(o){return o===41&&r++,e.consume(o),s}}function uW(e,t,n){return r;function r(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),r):l===38?(e.consume(l),i):l===93?(e.consume(l),s):l===60||l===null||Fe(l)||uo(l)?t(l):n(l)}function s(l){return l===null||l===40||l===91||Fe(l)||uo(l)?t(l):r(l)}function i(l){return hn(l)?o(l):n(l)}function o(l){return l===59?(e.consume(l),r):hn(l)?(e.consume(l),o):n(l)}}function dW(e,t,n){return r;function r(i){return e.consume(i),s}function s(i){return en(i)?n(i):t(i)}}function AN(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Fe(e)}function ON(e){return!hn(e)}function IN(e){return!(e===47||Dg(e))}function Dg(e){return e===43||e===45||e===46||e===95||en(e)}function $x(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const hW={tokenize:_W,partial:!0};function fW(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:vW,continuation:{tokenize:xW},exit:yW}},text:{91:{name:"gfmFootnoteCall",tokenize:gW},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:pW,resolveTo:mW}}}}function pW(e,t,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;s--;){const c=r.events[s][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!o||!o._balanced)return n(c);const u=Cr(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function mW(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function gW(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,o;return l;function l(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),c}function c(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(d){if(i>999||d===93&&!o||d===null||d===91||Fe(d))return n(d);if(d===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return s.includes(Cr(r.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return Fe(d)||(o=!0),i++,e.consume(d),d===92?h:u}function h(d){return d===91||d===92||d===93?(e.consume(d),i++,u):u(d)}}function vW(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,o=0,l;return c;function c(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):n(m)}function h(m){if(o>999||m===93&&!l||m===null||m===91||Fe(m))return n(m);if(m===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return i=Cr(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return Fe(m)||(l=!0),o++,e.consume(m),m===92?d:h}function d(m){return m===91||m===92||m===93?(e.consume(m),o++,h):h(m)}function p(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),s.includes(i)||s.push(i),Pe(e,f,"gfmFootnoteDefinitionWhitespace")):n(m)}function f(m){return t(m)}}function xW(e,t,n){return e.check(Ac,t,e.attempt(hW,t,n))}function yW(e){e.exit("gfmFootnoteDefinition")}function _W(e,t,n){const r=this;return Pe(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(i):n(i)}}function bW(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(o,l){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let u=c;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[c][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[c][1].end)},d={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[c][1].start)},p=[["enter",h,l],["enter",o[u][1],l],["exit",o[u][1],l],["enter",d,l]],f=l.parser.constructs.insideSpan.null;f&&qn(p,p.length,0,Ph(f,o.slice(u+1,c),l)),qn(p,p.length,0,[["exit",d,l],["enter",o[c][1],l],["exit",o[c][1],l],["exit",h,l]]),qn(o,u-1,c-u+3,p),c=u+p.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function i(o,l,c){const u=this.previous,h=this.events;let d=0;return p;function p(m){return u===126&&h[h.length-1][1].type!=="characterEscape"?c(m):(o.enter("strikethroughSequenceTemporary"),f(m))}function f(m){const g=ka(u);if(m===126)return d>1?c(m):(o.consume(m),d++,f);if(d<2&&!n)return c(m);const b=o.exit("strikethroughSequenceTemporary"),x=ka(m);return b._open=!x||x===2&&!!g,b._close=!g||g===2&&!!x,l(m)}}}class wW{constructor(){this.map=[]}add(t,n,r){SW(this,t,n,r)}consume(t){if(this.map.sort(function(i,o){return i[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const i of s)t.push(i);s=r.pop()}this.map.length=0}}function SW(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([t,n,r])}}function kW(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function CW(){return{flow:{null:{name:"table",tokenize:NW,resolveAll:jW}}}}function NW(e,t,n){const r=this;let s=0,i=0,o;return l;function l(P){let I=r.events.length-1;for(;I>-1;){const j=r.events[I][1].type;if(j==="lineEnding"||j==="linePrefix")I--;else break}const A=I>-1?r.events[I][1].type:null,M=A==="tableHead"||A==="tableRow"?S:c;return M===S&&r.parser.lazy[r.now().line]?n(P):M(P)}function c(P){return e.enter("tableHead"),e.enter("tableRow"),u(P)}function u(P){return P===124||(o=!0,i+=1),h(P)}function h(P){return P===null?n(P):me(P)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),f):n(P):Ne(P)?Pe(e,h,"whitespace")(P):(i+=1,o&&(o=!1,s+=1),P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),o=!0,h):(e.enter("data"),d(P)))}function d(P){return P===null||P===124||Fe(P)?(e.exit("data"),h(P)):(e.consume(P),P===92?p:d)}function p(P){return P===92||P===124?(e.consume(P),d):d(P)}function f(P){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(P):(e.enter("tableDelimiterRow"),o=!1,Ne(P)?Pe(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):m(P))}function m(P){return P===45||P===58?b(P):P===124?(o=!0,e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),g):C(P)}function g(P){return Ne(P)?Pe(e,b,"whitespace")(P):b(P)}function b(P){return P===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),x):P===45?(i+=1,x(P)):P===null||me(P)?w(P):C(P)}function x(P){return P===45?(e.enter("tableDelimiterFiller"),y(P)):C(P)}function y(P){return P===45?(e.consume(P),y):P===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),_):(e.exit("tableDelimiterFiller"),_(P))}function _(P){return Ne(P)?Pe(e,w,"whitespace")(P):w(P)}function w(P){return P===124?m(P):P===null||me(P)?!o||s!==i?C(P):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(P)):C(P)}function C(P){return n(P)}function S(P){return e.enter("tableRow"),R(P)}function R(P){return P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),R):P===null||me(P)?(e.exit("tableRow"),t(P)):Ne(P)?Pe(e,R,"whitespace")(P):(e.enter("data"),T(P))}function T(P){return P===null||P===124||Fe(P)?(e.exit("data"),R(P)):(e.consume(P),P===92?F:T)}function F(P){return P===92||P===124?(e.consume(P),T):T(P)}}function jW(e,t){let n=-1,r=!0,s=0,i=[0,0,0,0],o=[0,0,0,0],l=!1,c=0,u,h,d;const p=new wW;for(;++n<e.length;){const f=e[n],m=f[1];f[0]==="enter"?m.type==="tableHead"?(l=!1,c!==0&&(cw(p,t,c,u,h),h=void 0,c=0),u={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(n,0,[["enter",u,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,d=void 0,i=[0,0,0,0],o=[0,n+1,0,0],l&&(l=!1,h={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(n,0,[["enter",h,t]])),s=m.type==="tableDelimiterRow"?2:h?3:1):s&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],d=Ru(p,t,i,s,void 0,d),i=[0,0,0,0]),o[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(o[0]=o[1],d=Ru(p,t,i,s,void 0,d)),i=o,o=[i[1],n,0,0])):m.type==="tableHead"?(l=!0,c=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(c=n,i[1]!==0?(o[0]=o[1],d=Ru(p,t,i,s,n,d)):o[1]!==0&&(d=Ru(p,t,o,s,n,d)),s=0):s&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&cw(p,t,c,u,h),p.consume(t.events),n=-1;++n<t.events.length;){const f=t.events[n];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=kW(t.events,n))}return e}function Ru(e,t,n,r,s,i){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(i.end=Object.assign({},Do(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=Do(t.events,n[1]);if(i={type:o,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const u=Do(t.events,n[2]),h=Do(t.events,n[3]),d={type:l,start:Object.assign({},u),end:Object.assign({},h)};if(e.add(n[2],0,[["enter",d,t]]),r!==2){const p=t.events[n[2]],f=t.events[n[3]];if(p[1].end=Object.assign({},f[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,g=n[3]-n[2]-1;e.add(m,g,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return s!==void 0&&(i.end=Object.assign({},Do(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function cw(e,t,n,r,s){const i=[],o=Do(t.events,n);s&&(s.end=Object.assign({},o),i.push(["exit",s,t])),r.end=Object.assign({},o),i.push(["exit",r,t]),e.add(n+1,0,i)}function Do(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const EW={name:"tasklistCheck",tokenize:TW};function RW(){return{text:{91:EW}}}function TW(e,t,n){const r=this;return s;function s(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Fe(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return me(c)?t(c):Ne(c)?e.check({tokenize:PW},t,n)(c):n(c)}}function PW(e,t,n){return Pe(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function DW(e){return a2([rW(),fW(),bW(e),CW(),RW()])}const MW={};function LW(e){const t=this,n=e||MW,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(DW(n)),i.push(ZH()),o.push(eW(n))}function AW({title:e,content:t,onClose:n}){return v.useEffect(()=>{const r=s=>{s.key==="Escape"&&n()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[n]),a.jsx("div",{className:U.modalOverlay,onClick:n,children:a.jsxs("div",{className:U.modalContent,onClick:r=>r.stopPropagation(),children:[a.jsxs("div",{className:U.modalHeader,children:[a.jsx("h2",{className:U.modalTitle,children:e}),a.jsx("button",{className:U.modalClose,onClick:n,children:a.jsx(mt,{size:18})})]}),a.jsx("div",{className:U.modalBody,children:a.jsx("div",{className:U.markdownContent,children:a.jsx(Ng,{remarkPlugins:[LW],children:t})})})]})})}function OW({issueId:e,onClose:t}){const[n,r]=v.useState(!1),[s,i]=v.useState("transcript"),[o,l]=v.useState(!1),[c,u]=v.useState(null),h=v.useRef(null),d=v.useCallback(async b=>{if(!b.name.endsWith(".md")&&!b.name.endsWith(".txt")&&!b.name.endsWith(".vtt")){u("Only .md, .txt, and .vtt files are supported");return}l(!0),u(null);try{const x=await b.text(),y=await fetch(`/api/mission-control/planning/${e}/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:s,filename:b.name,content:x})});if(!y.ok){const _=await y.json();throw new Error(_.error||"Upload failed")}u(`Uploaded ${b.name} as ${s}`),setTimeout(()=>t(),1500)}catch(x){u(`Error: ${x.message}`)}finally{l(!1)}},[e,s,t]),p=v.useCallback(b=>{b.preventDefault(),r(!1);const x=b.dataTransfer.files[0];x&&d(x)},[d]),f=v.useCallback(b=>{b.preventDefault(),r(!0)},[]),m=v.useCallback(()=>{r(!1)},[]),g=v.useCallback(b=>{var y;const x=(y=b.target.files)==null?void 0:y[0];x&&d(x)},[d]);return a.jsx("div",{className:U.modalOverlay,onClick:t,children:a.jsxs("div",{className:U.modalContent,onClick:b=>b.stopPropagation(),style:{maxWidth:500},children:[a.jsxs("div",{className:U.modalHeader,children:[a.jsx("h2",{className:U.modalTitle,children:"Upload Artifact"}),a.jsx("button",{className:U.modalClose,onClick:t,children:a.jsx(mt,{size:18})})]}),a.jsxs("div",{className:U.modalBody,children:[a.jsxs("div",{style:{display:"flex",gap:"var(--mc-space-2)",marginBottom:"var(--mc-space-4)"},children:[a.jsx("button",{className:U.badge,style:s==="transcript"?{borderColor:"var(--mc-accent)",color:"var(--mc-accent)"}:{},onClick:()=>i("transcript"),children:"Transcript"}),a.jsx("button",{className:U.badge,style:s==="note"?{borderColor:"var(--mc-accent)",color:"var(--mc-accent)"}:{},onClick:()=>i("note"),children:"Note"})]}),a.jsxs("div",{className:`${U.uploadZone} ${n?U.uploadZoneActive:""}`,onDrop:p,onDragOver:f,onDragLeave:m,onClick:()=>{var b;return(b=h.current)==null?void 0:b.click()},children:[a.jsx("div",{className:U.uploadIcon,children:o?a.jsx(io,{size:32,className:U.spinning}):a.jsx(xk,{size:32})}),a.jsx("p",{className:U.uploadText,children:o?"Uploading...":"Drop a file here or click to browse"}),a.jsx("p",{className:U.uploadHint,children:"Accepts .md, .txt, and .vtt files"})]}),a.jsx("input",{ref:h,type:"file",accept:".md,.txt,.vtt",onChange:g,style:{display:"none"}}),c&&a.jsx("p",{style:{fontSize:"var(--mc-font-size-sm)",marginTop:"var(--mc-space-3)",color:c.startsWith("Error")?"var(--mc-error)":"var(--mc-success)"},children:c})]})]})})}async function IW(e){const t=await fetch(`/api/mission-control/planning/${e}`);if(!t.ok)throw new Error("Failed to fetch planning");return t.json()}function BW({issueId:e,source:t,onOpenBeads:n}){var b,x;const[r,s]=v.useState(null),[i,o]=v.useState(!1),[l,c]=v.useState(!1),[u,h]=v.useState(null),[d,p]=v.useState(!1),{data:f,refetch:m}=ue({queryKey:["mission-control-planning",e],queryFn:()=>IW(e),refetchInterval:3e4}),g=async()=>{c(!0),h(null);try{const y=t?[t]:["github","linear","rally"];let _=0,w=null;for(const C of y)try{const S=await fetch(`/api/mission-control/planning/${e}/sync-discussions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tracker:C})});if(S.ok){const R=await S.json();_+=R.synced||0}else t&&(w=(await S.json().catch(()=>({error:"Sync failed"}))).error||`HTTP ${S.status}`)}catch{t&&(w="Network error")}w&&_===0?h({message:w,isError:!0}):_>0?h({message:`Synced ${_} — generating status...`,isError:!1}):h({message:"No new discussions",isError:!1}),p(!0);try{const C=await fetch(`/api/mission-control/planning/${e}/status-review`,{method:"POST"});if(C.ok){const S=await C.json(),R=S.cached;R?h({message:_>0?`Synced ${_} (status unchanged)`:"No changes detected",isError:!1}):_>0?h({message:`Synced ${_} + status updated`,isError:!1}):h({message:"Status updated",isError:!1}),s({title:`Status Review${R?" (cached)":""} — ${new Date(S.reviewedAt).toLocaleString()}`,content:S.statusReview})}else{const S=await C.json().catch(()=>({error:"Status review failed"}));_>0&&h({message:`Synced ${_} (status: ${S.error})`,isError:!1})}}catch(C){console.error("Status review generation failed:",C)}finally{p(!1)}m()}catch(y){console.error("Sync failed:",y),h({message:"Sync failed",isError:!0})}finally{c(!1),setTimeout(()=>h(null),6e3)}};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:U.badgeBar,children:[a.jsxs("button",{className:U.badge,onClick:n,title:"View beads tasks",children:[a.jsx(fk,{size:12}),"Tasks"]}),a.jsxs("button",{className:`${U.badge} ${f!=null&&f.state?"":U.badgeDisabled}`,onClick:()=>(f==null?void 0:f.state)&&s({title:"STATE.md",content:f.state}),title:f!=null&&f.state?"View STATE.md":"No STATE.md available",children:[a.jsx(io,{size:12}),"STATE"]}),a.jsxs("button",{className:`${U.badge} ${f!=null&&f.prd?"":U.badgeDisabled}`,onClick:()=>(f==null?void 0:f.prd)&&s({title:"PRD",content:f.prd}),title:f!=null&&f.prd?"View PRD":"No PRD available",children:[a.jsx(io,{size:12}),"PRD"]}),a.jsxs("button",{className:`${U.badge} ${!(f!=null&&f.statusReview)&&!d?U.badgeDisabled:""}`,onClick:async()=>{if(f!=null&&f.statusReview)s({title:`Status Review${f.statusReviewedAt?` (${new Date(f.statusReviewedAt).toLocaleString()})`:""}`,content:f.statusReview});else{p(!0);try{const y=await fetch(`/api/mission-control/planning/${e}/status-review`,{method:"POST"});if(y.ok){const _=await y.json();s({title:"Status Review",content:_.statusReview}),m()}}catch(y){console.error("Failed to generate status review:",y)}finally{p(!1)}}},title:f!=null&&f.statusReview?"View status review (click to refresh)":"Generate status review",children:[a.jsx(wR,{size:12,className:d?U.spinning:""}),d?"Reviewing...":"Status"]}),(f==null?void 0:f.inference)&&a.jsxs("button",{className:U.badge,onClick:()=>s({title:"INFERENCE.md",content:`*The Inference Document is a Shadow Engineering artifact. It analyzes how AI would approach this work — identifying gaps in requirements, risks, and potential implementation strategies — without making any changes. Use it to evaluate readiness before transitioning to AI-driven development.*
677
-
678
- ---
679
-
680
- ${f.inference}`}),title:"View Inference Document (Shadow Engineering)",children:[a.jsx($v,{size:12}),"Inference"]}),(((b=f==null?void 0:f.discussions)==null?void 0:b.length)??0)>0&&a.jsxs("button",{className:U.badge,onClick:()=>{const y=f.discussions.map(_=>`## ${_.filename}
681
-
682
- ${_.content}`).join(`
683
-
684
- ---
685
-
686
- `);s({title:"Discussions",content:y})},children:["Discussions (",f.discussions.length,")"]}),(((x=f==null?void 0:f.transcripts)==null?void 0:x.length)??0)>0&&a.jsxs("button",{className:U.badge,onClick:()=>{const y=f.transcripts.map(_=>`## ${_.filename}
687
-
688
- ${_.content}`).join(`
689
-
690
- ---
691
-
692
- `);s({title:"Transcripts",content:y})},children:["Transcripts (",f.transcripts.length,")"]}),a.jsxs("button",{className:U.badge,onClick:()=>o(!0),title:"Upload transcript or note",children:[a.jsx(xk,{size:12}),"Upload"]}),a.jsxs("button",{className:`${U.syncButton} `,onClick:g,disabled:l||d,title:"Sync discussions and generate AI status review",children:[a.jsx(us,{size:12,className:l||d?U.spinning:""}),d?"Reviewing...":l?"Syncing...":"Sync"]}),u&&a.jsx("span",{className:U.badge,style:{color:u.isError?"var(--mc-error, #ef4444)":"var(--mc-success, #22c55e)",fontSize:"0.7rem",opacity:.9},children:u.message})]}),r&&a.jsx(AW,{title:r.title,content:r.content,onClose:()=>s(null)}),i&&a.jsx(OW,{issueId:e,onClose:()=>{o(!1),m()}})]})}async function FW(){const e=await fetch("/api/deacon/status");if(!e.ok)throw new Error("Failed to fetch deacon status");return e.json()}async function zW(){const e=await fetch("/api/deacon/logs?limit=50");if(!e.ok)throw new Error("Failed to fetch deacon logs");return e.json()}function $W(e){if(!e)return"never";const t=Date.now()-new Date(e).getTime();if(t<0)return"just now";const n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;const r=Math.floor(n/60);return r<60?`${r}m ago`:`${Math.floor(r/60)}h ago`}function HW(e){return e.consecutiveFailures>=3?"var(--mc-error)":e.consecutiveFailures>0||e.lastForceKillTime&&Date.now()-new Date(e.lastForceKillTime).getTime()<5*60*1e3?"var(--mc-warning)":"var(--mc-success)"}function WW(e){return e.replace("-agent","")}function UW(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return""}}const qW={info:"var(--mc-text-muted)",warn:"var(--mc-warning)",action:"var(--mc-accent)",error:"var(--mc-error)"},KW={info:"INF",warn:"WRN",action:"ACT",error:"ERR"};function VW(){var d;const[e,t]=v.useState(!1),[n,r]=v.useState(!1),s=v.useRef(null),{data:i}=ue({queryKey:["deacon-status"],queryFn:FW,refetchInterval:15e3}),{data:o}=ue({queryKey:["deacon-logs"],queryFn:zW,refetchInterval:n?5e3:!1,enabled:n});if(v.useEffect(()=>{n&&s.current&&s.current.scrollIntoView({behavior:"smooth"})},[o,n]),!i)return null;const l=Object.values(i.state.specialists||{}),c=((d=i.lastPatrol)==null?void 0:d.actions)||[],u=c.length>0,h=(o==null?void 0:o.logs)||[];return a.jsxs("div",{className:U.deaconPanel,children:[a.jsxs("div",{className:U.deaconHeader,onClick:()=>t(!e),children:[a.jsx(OR,{size:12,style:{color:i.isRunning?"var(--mc-success)":"var(--mc-text-muted)",flexShrink:0}}),a.jsx("span",{className:U.deaconTitle,children:"Deacon"}),a.jsx("span",{className:U.deaconMeta,children:i.isRunning?$W(i.state.lastPatrol):"stopped"}),u&&a.jsx("span",{className:U.deaconActionCount,children:c.length}),e?a.jsx(mh,{size:12,style:{color:"var(--mc-text-muted)",flexShrink:0}}):a.jsx(Sc,{size:12,style:{color:"var(--mc-text-muted)",flexShrink:0}})]}),a.jsx("div",{className:U.deaconSpecialists,children:l.map(p=>a.jsxs("div",{className:U.deaconSpecRow,children:[a.jsx("span",{className:U.deaconSpecDot,style:{background:HW(p)}}),a.jsx("span",{className:U.deaconSpecName,children:WW(p.specialistName)}),p.consecutiveFailures>0&&a.jsxs("span",{className:U.deaconSpecFailures,children:[p.consecutiveFailures,"x"]})]},p.specialistName))}),e&&a.jsxs(a.Fragment,{children:[u&&a.jsx("div",{className:U.deaconActions,children:c.map((p,f)=>a.jsx("div",{className:U.deaconAction,children:p},f))}),a.jsxs("div",{className:U.deaconLogToggle,onClick:p=>{p.stopPropagation(),r(!n)},children:[a.jsx(LR,{size:10,style:{color:"var(--mc-text-muted)",flexShrink:0}}),a.jsx("span",{children:n?"Hide logs":"Show logs"})]}),n&&a.jsxs("div",{className:U.deaconLogViewer,children:[h.length===0?a.jsx("div",{className:U.deaconLogEmpty,children:"No logs yet — waiting for patrol cycle..."}):h.map((p,f)=>a.jsxs("div",{className:U.deaconLogEntry,children:[a.jsx("span",{className:U.deaconLogTime,children:UW(p.timestamp)}),a.jsx("span",{className:U.deaconLogLevel,style:{color:qW[p.level]||"var(--mc-text-muted)"},children:KW[p.level]||p.level}),a.jsx("span",{className:U.deaconLogMessage,children:p.message})]},f)),a.jsx("div",{ref:s})]})]})]})}async function YW(){const e=await fetch("/api/mission-control/projects");if(!e.ok)throw new Error("Failed to fetch projects");return e.json()}async function QW(){const e=await fetch("/api/costs/by-issue");if(!e.ok)throw new Error("Failed to fetch costs");return e.json()}async function XW(){const e=await fetch("/api/version");if(!e.ok)throw new Error("Failed to fetch version");return e.json()}function GW({issues:e=[]}){var w;const[t,n]=v.useState(null),[r,s]=v.useState(!1),[i,o]=v.useState(340),l=v.useRef(!1),c=v.useRef(0),u=v.useRef(0),{data:h=[],isLoading:d}=ue({queryKey:["mission-control-projects"],queryFn:YW,refetchInterval:1e4}),{data:p}=ue({queryKey:["costs-by-issue"],queryFn:QW,refetchInterval:15e3}),{data:f}=ue({queryKey:["version"],queryFn:XW,staleTime:1/0}),m={},g={};for(const C of e)m[C.identifier.toLowerCase()]=C.title,m[C.identifier]=C.title;for(const C of(p==null?void 0:p.issues)||[])g[C.issueId]=C.totalCost,g[C.issueId.toLowerCase()]=C.totalCost;const b=v.useCallback(C=>{n(C)},[]),x=v.useCallback(C=>{l.current=!0,c.current=C.clientX,u.current=i,document.body.style.cursor="col-resize",document.body.style.userSelect="none",C.preventDefault()},[i]);v.useEffect(()=>{const C=R=>{if(!l.current)return;const T=R.clientX-c.current,F=Math.max(240,Math.min(600,u.current+T));o(F)},S=()=>{l.current=!1,document.body.style.cursor="",document.body.style.userSelect=""};return document.addEventListener("mousemove",C),document.addEventListener("mouseup",S),()=>{document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",S)}},[]);const y=t?h.flatMap(C=>C.features).find(C=>C.issueId===t):null,_=t?m[t.toLowerCase()]||m[t]||t:"";return a.jsxs("div",{className:U.missionControl,children:[a.jsxs("div",{className:U.layout,children:[a.jsxs("div",{className:U.sidebar,style:{width:i,minWidth:i},children:[a.jsxs("div",{className:U.sidebarHeader,children:[a.jsx("h2",{className:U.sidebarTitle,children:"Mission Control"}),a.jsx("p",{className:U.sidebarSubtitle,children:"Active features across projects"})]}),a.jsx("div",{className:U.projectTree,children:d&&h.length===0?a.jsx("div",{className:U.emptyProject,children:"Loading projects..."}):h.length===0?a.jsx("div",{className:U.emptyProject,children:"No projects configured"}):h.map(C=>a.jsx(h7,{name:C.name,features:C.features,selectedFeature:t,onSelectFeature:b,issueTitles:m,issueCosts:g},C.path))}),a.jsx(VW,{}),f&&a.jsx("div",{className:U.sidebarFooter,children:a.jsxs("span",{className:U.versionLabel,children:["v",f.version]})})]}),a.jsx("div",{className:U.resizeHandle,onMouseDown:x}),a.jsx("div",{className:U.content,children:t?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:U.featureHeader,children:[a.jsx("h1",{className:U.featureTitle,children:_}),a.jsx("span",{className:U.featureId,children:t}),(y==null?void 0:y.isShadow)&&a.jsx("span",{className:U.badge,style:{borderColor:"var(--mc-accent)",color:"var(--mc-accent)"},children:"Shadow"})]}),a.jsx(BW,{issueId:t,source:(w=e.find(C=>C.identifier===t))==null?void 0:w.source,onOpenBeads:()=>s(!0)}),a.jsx(C7,{issueId:t,issues:e,featureData:y})]}):a.jsx("div",{className:U.contentEmpty,children:a.jsxs("div",{style:{textAlign:"center"},children:[a.jsx(lk,{size:48,style:{marginBottom:"var(--mc-space-4)",opacity:.3}}),a.jsx("p",{children:"Select a feature to view activity"})]})})})]}),r&&t&&a.jsx(mx,{issueId:t,isOpen:r,onClose:()=>s(!1)})]})}const JW={},uw=e=>{let t;const n=new Set,r=(h,d)=>{const p=typeof h=="function"?h(t):h;if(!Object.is(p,t)){const f=t;t=d??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(m=>m(t,f))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>u,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(JW?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,s,c);return c},ZW=e=>e?uw(e):uw;var BN={exports:{}},FN={},zN={exports:{}},$N={};/**
693
- * @license React
694
- * use-sync-external-store-shim.production.js
695
- *
696
- * Copyright (c) Meta Platforms, Inc. and affiliates.
697
- *
698
- * This source code is licensed under the MIT license found in the
699
- * LICENSE file in the root directory of this source tree.
700
- */var Ca=v;function eU(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var tU=typeof Object.is=="function"?Object.is:eU,nU=Ca.useState,rU=Ca.useEffect,sU=Ca.useLayoutEffect,iU=Ca.useDebugValue;function oU(e,t){var n=t(),r=nU({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return sU(function(){s.value=n,s.getSnapshot=t,dp(s)&&i({inst:s})},[e,n,t]),rU(function(){return dp(s)&&i({inst:s}),e(function(){dp(s)&&i({inst:s})})},[e]),iU(n),n}function dp(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!tU(e,n)}catch{return!0}}function aU(e,t){return t()}var lU=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?aU:oU;$N.useSyncExternalStore=Ca.useSyncExternalStore!==void 0?Ca.useSyncExternalStore:lU;zN.exports=$N;var cU=zN.exports;/**
701
- * @license React
702
- * use-sync-external-store-shim/with-selector.production.js
703
- *
704
- * Copyright (c) Meta Platforms, Inc. and affiliates.
705
- *
706
- * This source code is licensed under the MIT license found in the
707
- * LICENSE file in the root directory of this source tree.
708
- */var Fh=v,uU=cU;function dU(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var hU=typeof Object.is=="function"?Object.is:dU,fU=uU.useSyncExternalStore,pU=Fh.useRef,mU=Fh.useEffect,gU=Fh.useMemo,vU=Fh.useDebugValue;FN.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=pU(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=gU(function(){function c(f){if(!u){if(u=!0,h=f,f=r(f),s!==void 0&&o.hasValue){var m=o.value;if(s(m,f))return d=m}return d=f}if(m=d,hU(h,f))return m;var g=r(f);return s!==void 0&&s(m,g)?(h=f,m):(h=f,d=g)}var u=!1,h,d,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,s]);var l=fU(e,i[0],i[1]);return mU(function(){o.hasValue=!0,o.value=l},[l]),vU(l),l};BN.exports=FN;var xU=BN.exports;const yU=Na(xU),HN={},{useDebugValue:_U}=Ke,{useSyncExternalStoreWithSelector:bU}=yU;let dw=!1;const wU=e=>e;function SU(e,t=wU,n){(HN?"production":void 0)!=="production"&&n&&!dw&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),dw=!0);const r=bU(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return _U(r),r}const hw=e=>{(HN?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?ZW(e):e,n=(r,s)=>SU(t,r,s);return Object.assign(n,t),n},kU=e=>e?hw(e):hw,CU=kU((e,t)=>({theme:"dark",toggleTheme:()=>{const n=t().theme==="dark"?"light":"dark";n==="light"?document.documentElement.classList.add("light"):document.documentElement.classList.remove("light"),localStorage.setItem("panopticon.ui.theme",n),e({theme:n})},initTheme:()=>{const n=localStorage.getItem("panopticon.ui.theme"),r=n==="light"||n==="dark"?n:null,s=r||"dark";r||localStorage.setItem("panopticon.ui.theme",s),s==="light"?document.documentElement.classList.add("light"):document.documentElement.classList.remove("light"),e({theme:s})}})),Gr=Object.create(null);Gr.open="0";Gr.close="1";Gr.ping="2";Gr.pong="3";Gr.message="4";Gr.upgrade="5";Gr.noop="6";const rd=Object.create(null);Object.keys(Gr).forEach(e=>{rd[Gr[e]]=e});const Mg={type:"error",data:"parser error"},WN=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",UN=typeof ArrayBuffer=="function",qN=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Hx=({type:e,data:t},n,r)=>WN&&t instanceof Blob?n?r(t):fw(t,r):UN&&(t instanceof ArrayBuffer||qN(t))?n?r(t):fw(new Blob([t]),r):r(Gr[e]+(t||"")),fw=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function pw(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let hp;function NU(e,t){if(WN&&e.data instanceof Blob)return e.data.arrayBuffer().then(pw).then(t);if(UN&&(e.data instanceof ArrayBuffer||qN(e.data)))return t(pw(e.data));Hx(e,!1,n=>{hp||(hp=new TextEncoder),t(hp.encode(n))})}const mw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xl=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<mw.length;e++)xl[mw.charCodeAt(e)]=e;const jU=e=>{let t=e.length*.75,n=e.length,r,s=0,i,o,l,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),h=new Uint8Array(u);for(r=0;r<n;r+=4)i=xl[e.charCodeAt(r)],o=xl[e.charCodeAt(r+1)],l=xl[e.charCodeAt(r+2)],c=xl[e.charCodeAt(r+3)],h[s++]=i<<2|o>>4,h[s++]=(o&15)<<4|l>>2,h[s++]=(l&3)<<6|c&63;return u},EU=typeof ArrayBuffer=="function",Wx=(e,t)=>{if(typeof e!="string")return{type:"message",data:KN(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:RU(e.substring(1),t)}:rd[n]?e.length>1?{type:rd[n],data:e.substring(1)}:{type:rd[n]}:Mg},RU=(e,t)=>{if(EU){const n=jU(e);return KN(n,t)}else return{base64:!0,data:e}},KN=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},VN="",TU=(e,t)=>{const n=e.length,r=new Array(n);let s=0;e.forEach((i,o)=>{Hx(i,!1,l=>{r[o]=l,++s===n&&t(r.join(VN))})})},PU=(e,t)=>{const n=e.split(VN),r=[];for(let s=0;s<n.length;s++){const i=Wx(n[s],t);if(r.push(i),i.type==="error")break}return r};function DU(){return new TransformStream({transform(e,t){NU(e,n=>{const r=n.length;let s;if(r<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,r);else if(r<65536){s=new Uint8Array(3);const i=new DataView(s.buffer);i.setUint8(0,126),i.setUint16(1,r)}else{s=new Uint8Array(9);const i=new DataView(s.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(s[0]|=128),t.enqueue(s),t.enqueue(n)})}})}let fp;function Tu(e){return e.reduce((t,n)=>t+n.length,0)}function Pu(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let s=0;s<t;s++)n[s]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function MU(e,t){fp||(fp=new TextDecoder);const n=[];let r=0,s=-1,i=!1;return new TransformStream({transform(o,l){for(n.push(o);;){if(r===0){if(Tu(n)<1)break;const c=Pu(n,1);i=(c[0]&128)===128,s=c[0]&127,s<126?r=3:s===126?r=1:r=2}else if(r===1){if(Tu(n)<2)break;const c=Pu(n,2);s=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(Tu(n)<8)break;const c=Pu(n,8),u=new DataView(c.buffer,c.byteOffset,c.length),h=u.getUint32(0);if(h>Math.pow(2,21)-1){l.enqueue(Mg);break}s=h*Math.pow(2,32)+u.getUint32(4),r=3}else{if(Tu(n)<s)break;const c=Pu(n,s);l.enqueue(Wx(i?c:fp.decode(c),t)),r=0}if(s===0||s>e){l.enqueue(Mg);break}}}})}const YN=4;function gt(e){if(e)return LU(e)}function LU(e){for(var t in gt.prototype)e[t]=gt.prototype[t];return e}gt.prototype.on=gt.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};gt.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};gt.prototype.off=gt.prototype.removeListener=gt.prototype.removeAllListeners=gt.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,s=0;s<n.length;s++)if(r=n[s],r===t||r.fn===t){n.splice(s,1);break}return n.length===0&&delete this._callbacks["$"+e],this};gt.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,s=n.length;r<s;++r)n[r].apply(this,t)}return this};gt.prototype.emitReserved=gt.prototype.emit;gt.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};gt.prototype.hasListeners=function(e){return!!this.listeners(e).length};const zh=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),ir=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),AU="arraybuffer";function QN(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const OU=ir.setTimeout,IU=ir.clearTimeout;function $h(e,t){t.useNativeTimers?(e.setTimeoutFn=OU.bind(ir),e.clearTimeoutFn=IU.bind(ir)):(e.setTimeoutFn=ir.setTimeout.bind(ir),e.clearTimeoutFn=ir.clearTimeout.bind(ir))}const BU=1.33;function FU(e){return typeof e=="string"?zU(e):Math.ceil((e.byteLength||e.size)*BU)}function zU(e){let t=0,n=0;for(let r=0,s=e.length;r<s;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function XN(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function $U(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function HU(e){let t={},n=e.split("&");for(let r=0,s=n.length;r<s;r++){let i=n[r].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}class WU extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class Ux extends gt{constructor(t){super(),this.writable=!1,$h(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,r){return super.emitReserved("error",new WU(t,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=Wx(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=$U(t);return n.length?"?"+n:""}}class UU extends Ux{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};PU(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,TU(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=XN()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let GN=!1;try{GN=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const qU=GN;function KU(){}class VU extends UU{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(s,i)=>{this.onError("xhr post error",s,i)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class Vr extends gt{constructor(t,n,r){super(),this.createRequest=t,$h(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;const n=QN(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let s in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(s)&&r.setRequestHeader(s,this._opts.extraHeaders[s])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var s;r.readyState===3&&((s=this._opts.cookieJar)===null||s===void 0||s.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(s){this.setTimeoutFn(()=>{this._onError(s)},0);return}typeof document<"u"&&(this._index=Vr.requestsCount++,Vr.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=KU,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Vr.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Vr.requestsCount=0;Vr.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",gw);else if(typeof addEventListener=="function"){const e="onpagehide"in ir?"pagehide":"unload";addEventListener(e,gw,!1)}}function gw(){for(let e in Vr.requests)Vr.requests.hasOwnProperty(e)&&Vr.requests[e].abort()}const YU=function(){const e=JN({xdomain:!1});return e&&e.responseType!==null}();class QU extends VU{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=YU&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Vr(JN,this.uri(),t)}}function JN(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||qU))return new XMLHttpRequest}catch{}if(!t)try{return new ir[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const ZN=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class XU extends Ux{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=ZN?{}:QN(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,r)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],s=n===t.length-1;Hx(r,this.supportsBinary,i=>{try{this.doWrite(r,i)}catch{}s&&zh(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=XN()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const pp=ir.WebSocket||ir.MozWebSocket;class GU extends XU{createSocket(t,n,r){return ZN?new pp(t,n,r):n?new pp(t,n):new pp(t)}doWrite(t,n){this.ws.send(n)}}class JU extends Ux{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=MU(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),s=DU();s.readable.pipeTo(t.writable),this._writer=s.writable.getWriter();const i=()=>{r.read().then(({done:l,value:c})=>{l||(this.onPacket(c),i())}).catch(l=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],s=n===t.length-1;this._writer.write(r).then(()=>{s&&zh(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const ZU={websocket:GU,webtransport:JU,polling:QU},eq=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,tq=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Lg(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let s=eq.exec(e||""),i={},o=14;for(;o--;)i[tq[o]]=s[o]||"";return n!=-1&&r!=-1&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=nq(i,i.path),i.queryKey=rq(i,i.query),i}function nq(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function rq(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,i){s&&(n[s]=i)}),n}const Ag=typeof addEventListener=="function"&&typeof removeEventListener=="function",sd=[];Ag&&addEventListener("offline",()=>{sd.forEach(e=>e())},!1);class gi extends gt{constructor(t,n){if(super(),this.binaryType=AU,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const r=Lg(t);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=Lg(n.host).host);$h(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const s=r.prototype.name;this.transports.push(s),this._transportsByName[s]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=HU(this.opts.query)),Ag&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},sd.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=YN,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&gi.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",gi.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const s=this.writeBuffer[r].data;if(s&&(n+=FU(s)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,zh(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,r){return this._sendPacket("message",t,n,r),this}send(t,n,r){return this._sendPacket("message",t,n,r),this}_sendPacket(t,n,r,s){if(typeof n=="function"&&(s=n,n=void 0),typeof r=="function"&&(s=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const i={type:t,data:n,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),s&&this.once("flush",s),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(gi.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Ag&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=sd.indexOf(this._offlineEventListener);r!==-1&&sd.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}gi.protocol=YN;class sq extends gi{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),r=!1;gi.priorWebsocketSuccess=!1;const s=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",d=>{if(!r)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;gi.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(h(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const p=new Error("probe error");p.transport=n.name,this.emitReserved("upgradeError",p)}}))};function i(){r||(r=!0,h(),n.close(),n=null)}const o=d=>{const p=new Error("probe error: "+d);p.transport=n.name,i(),this.emitReserved("upgradeError",p)};function l(){o("transport closed")}function c(){o("socket closed")}function u(d){n&&d.name!==n.name&&i()}const h=()=>{n.removeListener("open",s),n.removeListener("error",o),n.removeListener("close",l),this.off("close",c),this.off("upgrading",u)};n.once("open",s),n.once("error",o),n.once("close",l),this.once("close",c),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let r=0;r<t.length;r++)~this.transports.indexOf(t[r])&&n.push(t[r]);return n}}let iq=class extends sq{constructor(t,n={}){const r=typeof t=="object"?t:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(s=>ZU[s]).filter(s=>!!s)),super(t,r)}};function oq(e,t="",n){let r=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),r=Lg(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+t,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}const aq=typeof ArrayBuffer=="function",lq=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,ej=Object.prototype.toString,cq=typeof Blob=="function"||typeof Blob<"u"&&ej.call(Blob)==="[object BlobConstructor]",uq=typeof File=="function"||typeof File<"u"&&ej.call(File)==="[object FileConstructor]";function qx(e){return aq&&(e instanceof ArrayBuffer||lq(e))||cq&&e instanceof Blob||uq&&e instanceof File}function id(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(id(e[n]))return!0;return!1}if(qx(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return id(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&id(e[n]))return!0;return!1}function dq(e){const t=[],n=e.data,r=e;return r.data=Og(n,t),r.attachments=t.length,{packet:r,buffers:t}}function Og(e,t){if(!e)return e;if(qx(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=Og(e[r],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=Og(e[r],t));return n}return e}function hq(e,t){return e.data=Ig(e.data,t),delete e.attachments,e}function Ig(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Ig(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Ig(e[n],t));return e}const tj=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],fq=5;var we;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(we||(we={}));class pq{constructor(t){this.replacer=t}encode(t){return(t.type===we.EVENT||t.type===we.ACK)&&id(t)?this.encodeAsBinary({type:t.type===we.EVENT?we.BINARY_EVENT:we.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===we.BINARY_EVENT||t.type===we.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=dq(t),r=this.encodeAsString(n.packet),s=n.buffers;return s.unshift(r),s}}class Kx extends gt{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const r=n.type===we.BINARY_EVENT;r||n.type===we.BINARY_ACK?(n.type=r?we.EVENT:we.ACK,this.reconstructor=new mq(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(qx(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const r={type:Number(t.charAt(0))};if(we[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===we.BINARY_EVENT||r.type===we.BINARY_ACK){const i=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const o=t.substring(i,n);if(o!=Number(o)||t.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(o)}if(t.charAt(n+1)==="/"){const i=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););r.nsp=t.substring(i,n)}else r.nsp="/";const s=t.charAt(n+1);if(s!==""&&Number(s)==s){const i=n+1;for(;++n;){const o=t.charAt(n);if(o==null||Number(o)!=o){--n;break}if(n===t.length)break}r.id=Number(t.substring(i,n+1))}if(t.charAt(++n)){const i=this.tryParse(t.substr(n));if(Kx.isPayloadValid(r.type,i))r.data=i;else throw new Error("invalid payload")}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case we.CONNECT:return Jd(n);case we.DISCONNECT:return n===void 0;case we.CONNECT_ERROR:return typeof n=="string"||Jd(n);case we.EVENT:case we.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&tj.indexOf(n[0])===-1);case we.ACK:case we.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class mq{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=hq(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function gq(e){return typeof e=="string"}const vq=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};function xq(e){return e===void 0||vq(e)}function Jd(e){return Object.prototype.toString.call(e)==="[object Object]"}function yq(e,t){switch(e){case we.CONNECT:return t===void 0||Jd(t);case we.DISCONNECT:return t===void 0;case we.EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&tj.indexOf(t[0])===-1);case we.ACK:return Array.isArray(t);case we.CONNECT_ERROR:return typeof t=="string"||Jd(t);default:return!1}}function _q(e){return gq(e.nsp)&&xq(e.id)&&yq(e.type,e.data)}const bq=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Kx,Encoder:pq,get PacketType(){return we},isPacketValid:_q,protocol:fq},Symbol.toStringTag,{value:"Module"}));function br(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const wq=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class nj extends gt{constructor(t,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[br(t,"open",this.onopen.bind(this)),br(t,"packet",this.onpacket.bind(this)),br(t,"error",this.onerror.bind(this)),br(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var r,s,i;if(wq.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const o={type:we.EVENT,data:n};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const h=this.ids++,d=n.pop();this._registerAckCallback(h,d),o.id=h}const l=(s=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||s===void 0?void 0:s.writable,c=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!l||(c?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,n){var r;const s=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(s===void 0){this.acks[t]=n;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===t&&this.sendBuffer.splice(l,1);n.call(this,new Error("operation has timed out"))},s),o=(...l)=>{this.io.clearTimeoutFn(i),n.apply(this,l)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...n){return new Promise((r,s)=>{const i=(o,l)=>o?s(o):r(l);i.withError=!0,n.push(i),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((s,...i)=>(this._queue[0],s!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(s)):(this._queue.shift(),n&&n(null,...i)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:we.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){const r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case we.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case we.EVENT:case we.BINARY_EVENT:this.onevent(t);break;case we.ACK:case we.BINARY_ACK:this.onack(t);break;case we.DISCONNECT:this.ondisconnect();break;case we.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...s){r||(r=!0,n.packet({type:we.ACK,id:t,data:s}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:we.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,t.data)}}}function Ba(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Ba.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};Ba.prototype.reset=function(){this.attempts=0};Ba.prototype.setMin=function(e){this.ms=e};Ba.prototype.setMax=function(e){this.max=e};Ba.prototype.setJitter=function(e){this.jitter=e};class Bg extends gt{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,$h(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Ba({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const s=n.parser||bq;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new iq(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const s=br(n,"open",function(){r.onopen(),t&&t()}),i=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),t?t(l):this.maybeReconnectOnOpen()},o=br(n,"error",i);if(this._timeout!==!1){const l=this._timeout,c=this.setTimeoutFn(()=>{s(),i(new Error("timeout")),n.close()},l);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(s),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(br(t,"ping",this.onping.bind(this)),br(t,"data",this.ondata.bind(this)),br(t,"error",this.onerror.bind(this)),br(t,"close",this.onclose.bind(this)),br(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){zh(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new nj(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;r<n.length;r++)this.engine.write(n[r],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(s=>{s?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",s)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const al={};function od(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=oq(e,t.path||"/socket.io"),r=n.source,s=n.id,i=n.path,o=al[s]&&i in al[s].nsps,l=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let c;return l?c=new Bg(r,t):(al[s]||(al[s]=new Bg(r,t)),c=al[s]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(od,{Manager:Bg,Socket:nj,io:od,connect:od});function Sq(){const e=rn(),t=v.useRef(null);v.useEffect(()=>{const n=od({path:"/socket.io",transports:["websocket","polling"],reconnectionDelay:1e3,reconnectionDelayMax:1e4});t.current=n,n.on("connect",()=>{console.log("[socket.io] Connected for real-time issue updates")}),n.on("disconnect",i=>{console.log("[socket.io] Disconnected:",i)});const r=i=>{e.setQueriesData({queryKey:["issues"]},i)};n.on("issues:snapshot",r),n.on("issues:updated",r),n.on("agents:changed",()=>{e.invalidateQueries({queryKey:["agents"]})}),n.on("pipeline:status",i=>{i!=null&&i.issueId&&e.setQueryData(["review-status",i.issueId],i)});const s=()=>{document.visibilityState==="visible"&&n.connected&&n.emit("issues:request-snapshot")};return document.addEventListener("visibilitychange",s),()=>{document.removeEventListener("visibilitychange",s),n.disconnect(),t.current=null}},[e])}const rj={"mission-control":"/",kanban:"/kanban",agents:"/agents",convoys:"/convoys",handoffs:"/handoffs",activity:"/activity",metrics:"/metrics",costs:"/costs",skills:"/skills",health:"/health",settings:"/settings"},kq=Object.fromEntries(Object.entries(rj).map(([e,t])=>[t,e]));function vw(){const e=window.location.pathname;return kq[e]||"mission-control"}const Cq=400,Nq=1200,jq=700;async function Eq(){const e=await fetch("/api/agents");if(!e.ok)throw new Error("Failed to fetch agents");return e.json()}async function Rq(){const e=await fetch("/api/issues");if(!e.ok)throw new Error("Failed to fetch issues");return e.json()}async function Tq(){const e=await fetch("/api/tracker-status");if(!e.ok)throw new Error("Failed to fetch tracker status");return e.json()}async function Pq(){const e=await fetch("/api/confirmations");if(!e.ok)throw new Error("Failed to fetch confirmations");return e.json()}async function xw(e,t){if(!(await fetch(`/api/confirmations/${e}/respond`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirmed:t})})).ok)throw new Error("Failed to respond to confirmation")}function Dq(){const[e,t]=v.useState(vw),[n,r]=v.useState(null),[s,i]=v.useState(null),[o,l]=v.useState(jq),[c,u]=v.useState(!1),[h,d]=v.useState(!1),[p,f]=v.useState(null),[m,g]=v.useState(!1),[b,x]=v.useState(!1),y=v.useRef(null),{theme:_,toggleTheme:w,initTheme:C}=CU();Sq();const{data:S}=ue({queryKey:["tracker-status"],queryFn:Tq,refetchInterval:6e4,retry:!1}),R=(S==null?void 0:S.configured.filter(k=>!k.hasKey))||[];v.useEffect(()=>{C()},[C]);const T=v.useCallback(k=>{t(k);const W=rj[k];window.location.pathname!==W&&window.history.pushState({tab:k},"",W)},[]);v.useEffect(()=>{const k=()=>{t(vw())};return window.addEventListener("popstate",k),()=>window.removeEventListener("popstate",k)},[]);const{data:F=[]}=ue({queryKey:["agents"],queryFn:Eq,refetchInterval:5e3}),{data:P=[]}=ue({queryKey:["issues"],queryFn:Rq}),{data:I=[]}=ue({queryKey:["confirmations"],queryFn:Pq,refetchInterval:2e3});v.useEffect(()=>{I.length>0&&!p&&f(I[0])},[I,p]);const A=s?F.find(k=>{var W;return((W=k.issueId)==null?void 0:W.toLowerCase())===s.toLowerCase()}):null,M=s?P.find(k=>k.identifier.toLowerCase()===s.toLowerCase()):null,j=v.useCallback(k=>{k.preventDefault(),u(!0)},[]),E=v.useCallback(k=>{if(!c||!y.current)return;const Q=y.current.getBoundingClientRect().right-k.clientX;l(Math.min(Nq,Math.max(Cq,Q)))},[c]),$=v.useCallback(()=>{u(!1)},[]);v.useEffect(()=>(c&&(document.addEventListener("mousemove",E),document.addEventListener("mouseup",$),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",$),document.body.style.cursor="",document.body.style.userSelect=""}),[c,E,$]);const q=v.useCallback(()=>{d(k=>!k)},[]),D=v.useCallback(async()=>{if(p)try{await xw(p.id,!0),f(null)}catch(k){console.error("Failed to confirm:",k)}},[p]),H=v.useCallback(async()=>{if(p)try{await xw(p.id,!1),f(null)}catch(k){console.error("Failed to deny:",k)}},[p]),N=v.useCallback(()=>{f(null)},[]);v.useEffect(()=>{const k=W=>{W.key==="/"&&!["INPUT","TEXTAREA"].includes(W.target.tagName)&&(W.preventDefault(),g(!0))};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[]);const B=v.useCallback(k=>{i(k),T("kanban")},[]),O=h?"calc(100% - 300px)":`${o}px`;return a.jsxs("div",{className:"h-screen bg-surface flex flex-col overflow-hidden transition-colors duration-150",children:[a.jsx("header",{className:"bg-surface-raised border-b border-divider px-4 py-2 shrink-0",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("button",{onClick:()=>T("mission-control"),className:"flex items-center gap-2 shrink-0 hover:opacity-80 transition-opacity",title:"Go to Mission Control",children:[a.jsx(kc,{className:"w-5 h-5 text-blue-400"}),a.jsx("h1",{className:"text-lg font-bold text-content whitespace-nowrap",children:"Panopticon"})]}),a.jsx(yF,{}),a.jsx("nav",{className:"flex gap-0.5 overflow-x-auto min-w-0 scrollbar-hide",children:[{id:"mission-control",label:"Mission Control",icon:lk},{id:"kanban",label:"Board",icon:NR},{id:"agents",label:"Agents",icon:nc},{id:"convoys",label:"Convoys",icon:nc},{id:"handoffs",label:"Handoffs",icon:zv},{id:"activity",label:"Activity",icon:ao},{id:"metrics",label:"Metrics",icon:vR},{id:"costs",label:"Costs",icon:go},{id:"skills",label:"Skills",icon:ik},{id:"health",label:"Health",icon:ba},{id:"settings",label:"Settings",icon:mk}].map(({id:k,label:W,icon:Q})=>a.jsxs("button",{onClick:()=>T(k),className:`flex items-center gap-1 px-2.5 py-1.5 rounded-md text-xs whitespace-nowrap transition-colors ${e===k?"bg-blue-600 text-white":"text-content-subtle hover:text-content hover:bg-surface-overlay"}`,children:[a.jsx(Q,{className:"w-3.5 h-3.5"}),W]},k))}),a.jsx("button",{onClick:w,className:"ml-auto px-2.5 py-1.5 rounded-md text-xs whitespace-nowrap transition-colors text-content-subtle hover:text-content hover:bg-surface-overlay",title:`Switch to ${_==="dark"?"light":"dark"} mode`,children:_==="dark"?a.jsx(IR,{className:"w-3.5 h-3.5"}):a.jsx(TR,{className:"w-3.5 h-3.5"})})]})}),R.length>0&&!b&&a.jsxs("div",{className:"bg-amber-500/10 border-b border-amber-500/30 px-4 py-2 flex items-center gap-3 shrink-0",children:[a.jsx(tn,{className:"w-4 h-4 text-amber-400 shrink-0"}),a.jsxs("p",{className:"text-amber-400 text-sm flex-1",children:[a.jsxs("span",{className:"font-semibold",children:["Missing API key",R.length>1?"s":"",":"]})," ",R.map(k=>a.jsxs("span",{children:[k.name," (",a.jsx("code",{className:"font-mono text-xs bg-amber-500/20 px-1 rounded",children:k.envVar}),")"]},k.type)).reduce((k,W,Q)=>Q===0?[W]:[...k,", ",W],[]),"."," ",a.jsx("button",{onClick:()=>T("settings"),className:"underline hover:text-amber-300 font-semibold",children:"Configure in Settings"})]}),a.jsx("button",{onClick:()=>x(!0),className:"text-amber-400/60 hover:text-amber-400 shrink-0",title:"Dismiss",children:a.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]}),a.jsxs("main",{ref:y,className:"flex-1 flex overflow-hidden",children:[e==="mission-control"&&a.jsx("div",{className:"w-full h-full",children:a.jsx(GW,{issues:P})}),e==="kanban"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`flex-1 overflow-auto p-6 ${s?"":"w-full"}`,children:[a.jsx(MF,{}),a.jsx(nL,{selectedIssue:s,onSelectIssue:i})]}),s&&M&&a.jsxs(a.Fragment,{children:[a.jsx("div",{onMouseDown:j,className:`w-1 hover:w-1.5 bg-surface-overlay hover:bg-blue-500 cursor-col-resize transition-colors shrink-0 ${c?"bg-blue-500":""}`}),a.jsxs("div",{style:{width:O},className:"relative shrink-0 h-full flex flex-col",children:[a.jsx("button",{onClick:q,className:"absolute top-2 left-2 z-10 p-1.5 bg-surface-overlay hover:bg-surface-emphasis rounded text-content-subtle hover:text-content",title:h?"Collapse panel":"Expand panel",children:h?a.jsx(RR,{className:"w-4 h-4"}):a.jsx(jR,{className:"w-4 h-4"})}),a.jsx(ZB,{agent:A??void 0,issueId:s,issueUrl:M.url,issue:M,onClose:()=>i(null)})]})]})]}),e==="agents"&&a.jsx("div",{className:"p-6 w-full",children:a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsx(oA,{selectedAgent:n,onSelectAgent:r}),n&&a.jsx(cA,{agentId:n})]})}),e==="skills"&&a.jsx("div",{className:"p-6 w-full overflow-auto",children:a.jsx(fA,{})}),e==="health"&&a.jsx("div",{className:"p-6 w-full overflow-auto",children:a.jsx(hA,{})}),e==="activity"&&a.jsx("div",{className:"w-full h-full",children:a.jsx(rF,{onClose:()=>T("kanban")})}),e==="convoys"&&a.jsx("div",{className:"w-full h-full",children:a.jsx(hF,{onClose:()=>T("kanban")})}),e==="metrics"&&a.jsx("div",{className:"w-full overflow-auto",children:a.jsx(OF,{})}),e==="costs"&&a.jsx("div",{className:"w-full overflow-auto",children:a.jsx(BF,{})}),e==="handoffs"&&a.jsx("div",{className:"w-full overflow-auto",children:a.jsx(EF,{})}),e==="settings"&&a.jsx("div",{className:"p-6 w-full overflow-auto",children:a.jsx(YF,{})})]}),a.jsx(RF,{request:p,isOpen:!!p,onConfirm:D,onDeny:H,onClose:N}),a.jsx(S9,{isOpen:m,onClose:()=>g(!1),onSelectIssue:B,cycleFilter:"current",includeCompletedFilter:!1})]})}function yw(e){if(e instanceof TypeError){const t=e.message.toLowerCase();return t.includes("failed to fetch")||t.includes("networkerror")||t.includes("network request failed")}return!1}const Mq=new tR({defaultOptions:{queries:{refetchInterval:6e4,staleTime:3e4,refetchIntervalInBackground:!1,retry:(e,t)=>yw(t)&&e<3},mutations:{retry:(e,t)=>yw(t)&&e<3,retryDelay:e=>Math.min(1e3*2**e,8e3)}}});mp.createRoot(document.getElementById("root")).render(a.jsx(Ke.StrictMode,{children:a.jsx(nR,{client:Mq,children:a.jsx($R,{children:a.jsx(Dq,{})})})}));