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.
- package/README.md +96 -210
- package/dist/{agents-VLK4BMVA.js → agents-E43Y3HNU.js} +5 -5
- package/dist/{chunk-ASY7T35E.js → chunk-AAFQANKW.js} +231 -76
- package/dist/chunk-AAFQANKW.js.map +1 -0
- package/dist/{chunk-KJ2TRXNK.js → chunk-FTCPTHIJ.js} +47 -420
- package/dist/chunk-FTCPTHIJ.js.map +1 -0
- package/dist/{chunk-PI7Y3PSN.js → chunk-GR6ZZMCX.js} +25 -6
- package/dist/chunk-GR6ZZMCX.js.map +1 -0
- package/dist/chunk-HJSM6E6U.js +1038 -0
- package/dist/chunk-HJSM6E6U.js.map +1 -0
- package/dist/{chunk-BKCWRMUX.js → chunk-HZT2AOPN.js} +81 -9
- package/dist/chunk-HZT2AOPN.js.map +1 -0
- package/dist/{chunk-XFR2DLMR.js → chunk-NTO3EDB3.js} +3 -3
- package/dist/{chunk-XFR2DLMR.js.map → chunk-NTO3EDB3.js.map} +1 -1
- package/dist/{chunk-RBUO57TC.js → chunk-PPRFKTVC.js} +2 -2
- package/dist/chunk-PPRFKTVC.js.map +1 -0
- package/dist/{chunk-XKT5MHPT.js → chunk-WQG2TYCB.js} +2 -2
- package/dist/cli/index.js +1383 -880
- package/dist/cli/index.js.map +1 -1
- package/dist/dashboard/prompts/work-agent.md +2 -0
- package/dist/dashboard/public/assets/{index-UjZq6ykz.css → index-BxpjweAL.css} +1 -1
- package/dist/dashboard/public/assets/index-DQHkwvvJ.js +743 -0
- package/dist/dashboard/public/index.html +2 -2
- package/dist/dashboard/server.js +3593 -2052
- package/dist/index.d.ts +10 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/{specialist-context-T3NBMCIE.js → specialist-context-ZC6A4M3I.js} +4 -4
- package/dist/{specialist-logs-CVKD3YJ3.js → specialist-logs-KLGJCEUL.js} +4 -4
- package/dist/{specialists-TKAP6T6Z.js → specialists-O4HWDJL5.js} +4 -4
- package/dist/{traefik-QX4ZV4YG.js → traefik-QN7R5I6V.js} +2 -2
- package/dist/{workspace-manager-KLHUCIZV.js → workspace-manager-IE4JL2JP.js} +2 -2
- package/package.json +1 -1
- package/scripts/stop-hook +7 -0
- package/scripts/work-agent-stop-hook +137 -0
- package/skills/myn-standards/SKILL.md +351 -0
- package/skills/write-spec/SKILL.md +138 -0
- package/dist/chunk-7XNJJBH6.js +0 -538
- package/dist/chunk-7XNJJBH6.js.map +0 -1
- package/dist/chunk-ASY7T35E.js.map +0 -1
- package/dist/chunk-BKCWRMUX.js.map +0 -1
- package/dist/chunk-KJ2TRXNK.js.map +0 -1
- package/dist/chunk-PI7Y3PSN.js.map +0 -1
- package/dist/chunk-RBUO57TC.js.map +0 -1
- package/dist/dashboard/public/assets/index-kAJqtLDO.js +0 -708
- /package/dist/{agents-VLK4BMVA.js.map → agents-E43Y3HNU.js.map} +0 -0
- /package/dist/{chunk-XKT5MHPT.js.map → chunk-WQG2TYCB.js.map} +0 -0
- /package/dist/{specialist-context-T3NBMCIE.js.map → specialist-context-ZC6A4M3I.js.map} +0 -0
- /package/dist/{specialist-logs-CVKD3YJ3.js.map → specialist-logs-KLGJCEUL.js.map} +0 -0
- /package/dist/{specialists-TKAP6T6Z.js.map → specialists-O4HWDJL5.js.map} +0 -0
- /package/dist/{traefik-QX4ZV4YG.js.map → traefik-QN7R5I6V.js.map} +0 -0
- /package/dist/{workspace-manager-KLHUCIZV.js.map → workspace-manager-IE4JL2JP.js.map} +0 -0
|
@@ -0,0 +1,743 @@
|
|
|
1
|
+
var j4=Object.defineProperty;var b_=e=>{throw TypeError(e)};var E4=(e,t,n)=>t in e?j4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ae=(e,t,n)=>E4(e,typeof t!="symbol"?t+"":t,n),Mp=(e,t,n)=>t.has(e)||b_("Cannot "+n);var L=(e,t,n)=>(Mp(e,t,"read from private field"),n?n.call(e):t.get(e)),me=(e,t,n)=>t.has(e)?b_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),oe=(e,t,n,s)=>(Mp(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),Ne=(e,t,n)=>(Mp(e,t,"access private method"),n);var Qu=(e,t,n,s)=>({set _(r){oe(e,t,r,n)},get _(){return L(e,t,s)}});function P4(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const r in s)if(r!=="default"&&!(r in e)){const i=Object.getOwnPropertyDescriptor(s,r);i&&Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:()=>s[r]})}}}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 r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();var Oh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ml(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function T4(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function s(){return this instanceof s?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(s){var r=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(n,s,r.get?r:{enumerable:!0,get:function(){return e[s]}})}),n}var bC={exports:{}},Ff={},wC={exports:{}},Le={};/**
|
|
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 Eu=Symbol.for("react.element"),R4=Symbol.for("react.portal"),D4=Symbol.for("react.fragment"),M4=Symbol.for("react.strict_mode"),L4=Symbol.for("react.profiler"),A4=Symbol.for("react.provider"),O4=Symbol.for("react.context"),I4=Symbol.for("react.forward_ref"),F4=Symbol.for("react.suspense"),B4=Symbol.for("react.memo"),z4=Symbol.for("react.lazy"),w_=Symbol.iterator;function $4(e){return e===null||typeof e!="object"?null:(e=w_&&e[w_]||e["@@iterator"],typeof e=="function"?e:null)}var SC={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},kC=Object.assign,CC={};function gl(e,t,n){this.props=e,this.context=t,this.refs=CC,this.updater=n||SC}gl.prototype.isReactComponent={};gl.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")};gl.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function NC(){}NC.prototype=gl.prototype;function ty(e,t,n){this.props=e,this.context=t,this.refs=CC,this.updater=n||SC}var ny=ty.prototype=new NC;ny.constructor=ty;kC(ny,gl.prototype);ny.isPureReactComponent=!0;var S_=Array.isArray,jC=Object.prototype.hasOwnProperty,sy={current:null},EC={key:!0,ref:!0,__self:!0,__source:!0};function PC(e,t,n){var s,r={},i=null,o=null;if(t!=null)for(s in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)jC.call(t,s)&&!EC.hasOwnProperty(s)&&(r[s]=t[s]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var c=Array(a),u=0;u<a;u++)c[u]=arguments[u+2];r.children=c}if(e&&e.defaultProps)for(s in a=e.defaultProps,a)r[s]===void 0&&(r[s]=a[s]);return{$$typeof:Eu,type:e,key:i,ref:o,props:r,_owner:sy.current}}function H4(e,t){return{$$typeof:Eu,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function ry(e){return typeof e=="object"&&e!==null&&e.$$typeof===Eu}function W4(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var k_=/\/+/g;function Lp(e,t){return typeof e=="object"&&e!==null&&e.key!=null?W4(""+e.key):t.toString(36)}function rh(e,t,n,s,r){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 Eu:case R4:o=!0}}if(o)return o=e,r=r(o),e=s===""?"."+Lp(o,0):s,S_(r)?(n="",e!=null&&(n=e.replace(k_,"$&/")+"/"),rh(r,t,n,"",function(u){return u})):r!=null&&(ry(r)&&(r=H4(r,n+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(k_,"$&/")+"/")+e)),t.push(r)),1;if(o=0,s=s===""?".":s+":",S_(e))for(var a=0;a<e.length;a++){i=e[a];var c=s+Lp(i,a);o+=rh(i,t,n,c,r)}else if(c=$4(e),typeof c=="function")for(e=c.call(e),a=0;!(i=e.next()).done;)i=i.value,c=s+Lp(i,a++),o+=rh(i,t,n,c,r);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 Gu(e,t,n){if(e==null)return e;var s=[],r=0;return rh(e,s,"","",function(i){return t.call(n,i,r++)}),s}function U4(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 On={current:null},ih={transition:null},q4={ReactCurrentDispatcher:On,ReactCurrentBatchConfig:ih,ReactCurrentOwner:sy};function TC(){throw Error("act(...) is not supported in production builds of React.")}Le.Children={map:Gu,forEach:function(e,t,n){Gu(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Gu(e,function(){t++}),t},toArray:function(e){return Gu(e,function(t){return t})||[]},only:function(e){if(!ry(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Le.Component=gl;Le.Fragment=D4;Le.Profiler=L4;Le.PureComponent=ty;Le.StrictMode=M4;Le.Suspense=F4;Le.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=q4;Le.act=TC;Le.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var s=kC({},e.props),r=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=sy.current),t.key!==void 0&&(r=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(c in t)jC.call(t,c)&&!EC.hasOwnProperty(c)&&(s[c]=t[c]===void 0&&a!==void 0?a[c]:t[c])}var c=arguments.length-2;if(c===1)s.children=n;else if(1<c){a=Array(c);for(var u=0;u<c;u++)a[u]=arguments[u+2];s.children=a}return{$$typeof:Eu,type:e.type,key:r,ref:i,props:s,_owner:o}};Le.createContext=function(e){return e={$$typeof:O4,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:A4,_context:e},e.Consumer=e};Le.createElement=PC;Le.createFactory=function(e){var t=PC.bind(null,e);return t.type=e,t};Le.createRef=function(){return{current:null}};Le.forwardRef=function(e){return{$$typeof:I4,render:e}};Le.isValidElement=ry;Le.lazy=function(e){return{$$typeof:z4,_payload:{_status:-1,_result:e},_init:U4}};Le.memo=function(e,t){return{$$typeof:B4,type:e,compare:t===void 0?null:t}};Le.startTransition=function(e){var t=ih.transition;ih.transition={};try{e()}finally{ih.transition=t}};Le.unstable_act=TC;Le.useCallback=function(e,t){return On.current.useCallback(e,t)};Le.useContext=function(e){return On.current.useContext(e)};Le.useDebugValue=function(){};Le.useDeferredValue=function(e){return On.current.useDeferredValue(e)};Le.useEffect=function(e,t){return On.current.useEffect(e,t)};Le.useId=function(){return On.current.useId()};Le.useImperativeHandle=function(e,t,n){return On.current.useImperativeHandle(e,t,n)};Le.useInsertionEffect=function(e,t){return On.current.useInsertionEffect(e,t)};Le.useLayoutEffect=function(e,t){return On.current.useLayoutEffect(e,t)};Le.useMemo=function(e,t){return On.current.useMemo(e,t)};Le.useReducer=function(e,t,n){return On.current.useReducer(e,t,n)};Le.useRef=function(e){return On.current.useRef(e)};Le.useState=function(e){return On.current.useState(e)};Le.useSyncExternalStore=function(e,t,n){return On.current.useSyncExternalStore(e,t,n)};Le.useTransition=function(){return On.current.useTransition()};Le.version="18.3.1";wC.exports=Le;var y=wC.exports;const J=ml(y),iy=P4({__proto__:null,default:J},[y]);/**
|
|
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 K4=y,V4=Symbol.for("react.element"),Y4=Symbol.for("react.fragment"),X4=Object.prototype.hasOwnProperty,Q4=K4.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,G4={key:!0,ref:!0,__self:!0,__source:!0};function RC(e,t,n){var s,r={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(s in t)X4.call(t,s)&&!G4.hasOwnProperty(s)&&(r[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)r[s]===void 0&&(r[s]=t[s]);return{$$typeof:V4,type:e,key:i,ref:o,props:r,_owner:Q4.current}}Ff.Fragment=Y4;Ff.jsx=RC;Ff.jsxs=RC;bC.exports=Ff;var l=bC.exports,xg={},DC={exports:{}},fs={},MC={exports:{}},LC={};/**
|
|
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(O,H){var k=O.length;O.push(H);e:for(;0<k;){var I=k-1>>>1,M=O[I];if(0<r(M,H))O[I]=H,O[k]=M,k=I;else break e}}function n(O){return O.length===0?null:O[0]}function s(O){if(O.length===0)return null;var H=O[0],k=O.pop();if(k!==H){O[0]=k;e:for(var I=0,M=O.length,N=M>>>1;I<N;){var z=2*(I+1)-1,U=O[z],K=z+1,Q=O[K];if(0>r(U,k))K<M&&0>r(Q,U)?(O[I]=Q,O[K]=k,I=K):(O[I]=U,O[z]=k,I=z);else if(K<M&&0>r(Q,k))O[I]=Q,O[K]=k,I=K;else break e}}return H}function r(O,H){var k=O.sortIndex-H.sortIndex;return k!==0?k:O.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,a=o.now();e.unstable_now=function(){return o.now()-a}}var c=[],u=[],d=1,h=null,p=3,f=!1,m=!1,g=!1,v=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(O){for(var H=n(u);H!==null;){if(H.callback===null)s(u);else if(H.startTime<=O)s(u),H.sortIndex=H.expirationTime,t(c,H);else break;H=n(u)}}function S(O){if(g=!1,b(O),!m)if(n(c)!==null)m=!0,$(C);else{var H=n(u);H!==null&&W(S,H.startTime-O)}}function C(O,H){m=!1,g&&(g=!1,x(T),T=-1),f=!0;var k=p;try{for(b(H),h=n(c);h!==null&&(!(h.expirationTime>H)||O&&!B());){var I=h.callback;if(typeof I=="function"){h.callback=null,p=h.priorityLevel;var M=I(h.expirationTime<=H);H=e.unstable_now(),typeof M=="function"?h.callback=M:h===n(c)&&s(c),b(H)}else s(c);h=n(c)}if(h!==null)var N=!0;else{var z=n(u);z!==null&&W(S,z.startTime-H),N=!1}return N}finally{h=null,p=k,f=!1}}var w=!1,j=null,T=-1,F=5,R=-1;function B(){return!(e.unstable_now()-R<F)}function A(){if(j!==null){var O=e.unstable_now();R=O;var H=!0;try{H=j(!0,O)}finally{H?D():(w=!1,j=null)}}else w=!1}var D;if(typeof _=="function")D=function(){_(A)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,E=P.port2;P.port1.onmessage=A,D=function(){E.postMessage(null)}}else D=function(){v(A,0)};function $(O){j=O,w||(w=!0,D())}function W(O,H){T=v(function(){O(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(O){O.callback=null},e.unstable_continueExecution=function(){m||f||(m=!0,$(C))},e.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<O?Math.floor(1e3/O):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(O){switch(p){case 1:case 2:case 3:var H=3;break;default:H=p}var k=p;p=H;try{return O()}finally{p=k}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(O,H){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var k=p;p=O;try{return H()}finally{p=k}},e.unstable_scheduleCallback=function(O,H,k){var I=e.unstable_now();switch(typeof k=="object"&&k!==null?(k=k.delay,k=typeof k=="number"&&0<k?I+k:I):k=I,O){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=k+M,O={id:d++,callback:H,priorityLevel:O,startTime:k,expirationTime:M,sortIndex:-1},k>I?(O.sortIndex=k,t(u,O),n(c)===null&&O===n(u)&&(g?(x(T),T=-1):g=!0,W(S,k-I))):(O.sortIndex=M,t(c,O),m||f||(m=!0,$(C))),O},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(O){var H=p;return function(){var k=p;p=H;try{return O.apply(this,arguments)}finally{p=k}}}})(LC);MC.exports=LC;var J4=MC.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 Z4=y,ds=J4;function te(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 AC=new Set,Hc={};function ea(e,t){el(e,t),el(e+"Capture",t)}function el(e,t){for(Hc[e]=t,e=0;e<t.length;e++)AC.add(t[e])}var Hr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),vg=Object.prototype.hasOwnProperty,eT=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,C_={},N_={};function tT(e){return vg.call(N_,e)?!0:vg.call(C_,e)?!1:eT.test(e)?N_[e]=!0:(C_[e]=!0,!1)}function nT(e,t,n,s){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return s?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function sT(e,t,n,s){if(t===null||typeof t>"u"||nT(e,t,n,s))return!0;if(s)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 In(e,t,n,s,r,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=s,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var fn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){fn[e]=new In(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];fn[t]=new In(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){fn[e]=new In(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){fn[e]=new In(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){fn[e]=new In(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){fn[e]=new In(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){fn[e]=new In(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){fn[e]=new In(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){fn[e]=new In(e,5,!1,e.toLowerCase(),null,!1,!1)});var oy=/[\-:]([a-z])/g;function ay(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(oy,ay);fn[t]=new In(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(oy,ay);fn[t]=new In(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(oy,ay);fn[t]=new In(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){fn[e]=new In(e,1,!1,e.toLowerCase(),null,!1,!1)});fn.xlinkHref=new In("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){fn[e]=new In(e,1,!1,e.toLowerCase(),null,!0,!0)});function ly(e,t,n,s){var r=fn.hasOwnProperty(t)?fn[t]:null;(r!==null?r.type!==0:s||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(sT(t,n,r,s)&&(n=null),s||r===null?tT(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):r.mustUseProperty?e[r.propertyName]=n===null?r.type===3?!1:"":n:(t=r.attributeName,s=r.attributeNamespace,n===null?e.removeAttribute(t):(r=r.type,n=r===3||r===4&&n===!0?"":""+n,s?e.setAttributeNS(s,t,n):e.setAttribute(t,n))))}var Yr=Z4.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ju=Symbol.for("react.element"),ya=Symbol.for("react.portal"),_a=Symbol.for("react.fragment"),cy=Symbol.for("react.strict_mode"),yg=Symbol.for("react.profiler"),OC=Symbol.for("react.provider"),IC=Symbol.for("react.context"),uy=Symbol.for("react.forward_ref"),_g=Symbol.for("react.suspense"),bg=Symbol.for("react.suspense_list"),dy=Symbol.for("react.memo"),li=Symbol.for("react.lazy"),FC=Symbol.for("react.offscreen"),j_=Symbol.iterator;function Ll(e){return e===null||typeof e!="object"?null:(e=j_&&e[j_]||e["@@iterator"],typeof e=="function"?e:null)}var ht=Object.assign,Ap;function ic(e){if(Ap===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ap=t&&t[1]||""}return`
|
|
34
|
+
`+Ap+e}var Op=!1;function Ip(e,t){if(!e||Op)return"";Op=!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 s=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){s=u}e.call(t.prototype)}else{try{throw Error()}catch(u){s=u}e()}}catch(u){if(u&&s&&typeof u.stack=="string"){for(var r=u.stack.split(`
|
|
35
|
+
`),i=s.stack.split(`
|
|
36
|
+
`),o=r.length-1,a=i.length-1;1<=o&&0<=a&&r[o]!==i[a];)a--;for(;1<=o&&0<=a;o--,a--)if(r[o]!==i[a]){if(o!==1||a!==1)do if(o--,a--,0>a||r[o]!==i[a]){var c=`
|
|
37
|
+
`+r[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=a);break}}}finally{Op=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ic(e):""}function rT(e){switch(e.tag){case 5:return ic(e.type);case 16:return ic("Lazy");case 13:return ic("Suspense");case 19:return ic("SuspenseList");case 0:case 2:case 15:return e=Ip(e.type,!1),e;case 11:return e=Ip(e.type.render,!1),e;case 1:return e=Ip(e.type,!0),e;default:return""}}function wg(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 _a:return"Fragment";case ya:return"Portal";case yg:return"Profiler";case cy:return"StrictMode";case _g:return"Suspense";case bg:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case IC:return(e.displayName||"Context")+".Consumer";case OC:return(e._context.displayName||"Context")+".Provider";case uy:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case dy:return t=e.displayName||null,t!==null?t:wg(e.type)||"Memo";case li:t=e._payload,e=e._init;try{return wg(e(t))}catch{}}return null}function iT(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 wg(t);case 8:return t===cy?"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 qi(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function BC(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function oT(e){var t=BC(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var r=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(o){s=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return s},setValue:function(o){s=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Zu(e){e._valueTracker||(e._valueTracker=oT(e))}function zC(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=BC(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function Ih(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 Sg(e,t){var n=t.checked;return ht({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function E_(e,t){var n=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;n=qi(t.value!=null?t.value:n),e._wrapperState={initialChecked:s,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function $C(e,t){t=t.checked,t!=null&&ly(e,"checked",t,!1)}function kg(e,t){$C(e,t);var n=qi(t.value),s=t.type;if(n!=null)s==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Cg(e,t.type,n):t.hasOwnProperty("defaultValue")&&Cg(e,t.type,qi(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function P_(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!(s!=="submit"&&s!=="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 Cg(e,t,n){(t!=="number"||Ih(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var oc=Array.isArray;function Ma(e,t,n,s){if(e=e.options,t){t={};for(var r=0;r<n.length;r++)t["$"+n[r]]=!0;for(n=0;n<e.length;n++)r=t.hasOwnProperty("$"+e[n].value),e[n].selected!==r&&(e[n].selected=r),r&&s&&(e[n].defaultSelected=!0)}else{for(n=""+qi(n),t=null,r=0;r<e.length;r++){if(e[r].value===n){e[r].selected=!0,s&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function Ng(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(te(91));return ht({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function T_(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(te(92));if(oc(n)){if(1<n.length)throw Error(te(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:qi(n)}}function HC(e,t){var n=qi(t.value),s=qi(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),s!=null&&(e.defaultValue=""+s)}function R_(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function WC(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 jg(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?WC(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ed,UC=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,s,r){MSApp.execUnsafeLocalFunction(function(){return e(t,n,s,r)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(ed=ed||document.createElement("div"),ed.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ed.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Wc(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var yc={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},aT=["Webkit","ms","Moz","O"];Object.keys(yc).forEach(function(e){aT.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),yc[t]=yc[e]})});function qC(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||yc.hasOwnProperty(e)&&yc[e]?(""+t).trim():t+"px"}function KC(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var s=n.indexOf("--")===0,r=qC(n,t[n],s);n==="float"&&(n="cssFloat"),s?e.setProperty(n,r):e[n]=r}}var lT=ht({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 Eg(e,t){if(t){if(lT[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(te(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(te(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(te(61))}if(t.style!=null&&typeof t.style!="object")throw Error(te(62))}}function Pg(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 Tg=null;function hy(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Rg=null,La=null,Aa=null;function D_(e){if(e=Ru(e)){if(typeof Rg!="function")throw Error(te(280));var t=e.stateNode;t&&(t=Wf(t),Rg(e.stateNode,e.type,t))}}function VC(e){La?Aa?Aa.push(e):Aa=[e]:La=e}function YC(){if(La){var e=La,t=Aa;if(Aa=La=null,D_(e),t)for(e=0;e<t.length;e++)D_(t[e])}}function XC(e,t){return e(t)}function QC(){}var Fp=!1;function GC(e,t,n){if(Fp)return e(t,n);Fp=!0;try{return XC(e,t,n)}finally{Fp=!1,(La!==null||Aa!==null)&&(QC(),YC())}}function Uc(e,t){var n=e.stateNode;if(n===null)return null;var s=Wf(n);if(s===null)return null;n=s[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":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(te(231,t,typeof n));return n}var Dg=!1;if(Hr)try{var Al={};Object.defineProperty(Al,"passive",{get:function(){Dg=!0}}),window.addEventListener("test",Al,Al),window.removeEventListener("test",Al,Al)}catch{Dg=!1}function cT(e,t,n,s,r,i,o,a,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(d){this.onError(d)}}var _c=!1,Fh=null,Bh=!1,Mg=null,uT={onError:function(e){_c=!0,Fh=e}};function dT(e,t,n,s,r,i,o,a,c){_c=!1,Fh=null,cT.apply(uT,arguments)}function hT(e,t,n,s,r,i,o,a,c){if(dT.apply(this,arguments),_c){if(_c){var u=Fh;_c=!1,Fh=null}else throw Error(te(198));Bh||(Bh=!0,Mg=u)}}function ta(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 JC(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 M_(e){if(ta(e)!==e)throw Error(te(188))}function fT(e){var t=e.alternate;if(!t){if(t=ta(e),t===null)throw Error(te(188));return t!==e?null:e}for(var n=e,s=t;;){var r=n.return;if(r===null)break;var i=r.alternate;if(i===null){if(s=r.return,s!==null){n=s;continue}break}if(r.child===i.child){for(i=r.child;i;){if(i===n)return M_(r),e;if(i===s)return M_(r),t;i=i.sibling}throw Error(te(188))}if(n.return!==s.return)n=r,s=i;else{for(var o=!1,a=r.child;a;){if(a===n){o=!0,n=r,s=i;break}if(a===s){o=!0,s=r,n=i;break}a=a.sibling}if(!o){for(a=i.child;a;){if(a===n){o=!0,n=i,s=r;break}if(a===s){o=!0,s=i,n=r;break}a=a.sibling}if(!o)throw Error(te(189))}}if(n.alternate!==s)throw Error(te(190))}if(n.tag!==3)throw Error(te(188));return n.stateNode.current===n?e:t}function ZC(e){return e=fT(e),e!==null?e2(e):null}function e2(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=e2(e);if(t!==null)return t;e=e.sibling}return null}var t2=ds.unstable_scheduleCallback,L_=ds.unstable_cancelCallback,pT=ds.unstable_shouldYield,mT=ds.unstable_requestPaint,Ct=ds.unstable_now,gT=ds.unstable_getCurrentPriorityLevel,fy=ds.unstable_ImmediatePriority,n2=ds.unstable_UserBlockingPriority,zh=ds.unstable_NormalPriority,xT=ds.unstable_LowPriority,s2=ds.unstable_IdlePriority,Bf=null,ur=null;function vT(e){if(ur&&typeof ur.onCommitFiberRoot=="function")try{ur.onCommitFiberRoot(Bf,e,void 0,(e.current.flags&128)===128)}catch{}}var Hs=Math.clz32?Math.clz32:bT,yT=Math.log,_T=Math.LN2;function bT(e){return e>>>=0,e===0?32:31-(yT(e)/_T|0)|0}var td=64,nd=4194304;function ac(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 $h(e,t){var n=e.pendingLanes;if(n===0)return 0;var s=0,r=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~r;a!==0?s=ac(a):(i&=o,i!==0&&(s=ac(i)))}else o=n&~r,o!==0?s=ac(o):i!==0&&(s=ac(i));if(s===0)return 0;if(t!==0&&t!==s&&!(t&r)&&(r=s&-s,i=t&-t,r>=i||r===16&&(i&4194240)!==0))return t;if(s&4&&(s|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0<t;)n=31-Hs(t),r=1<<n,s|=e[n],t&=~r;return s}function wT(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 ST(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,r=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-Hs(i),a=1<<o,c=r[o];c===-1?(!(a&n)||a&s)&&(r[o]=wT(a,t)):c<=t&&(e.expiredLanes|=a),i&=~a}}function Lg(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function r2(){var e=td;return td<<=1,!(td&4194240)&&(td=64),e}function Bp(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Pu(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Hs(t),e[t]=n}function kT(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 s=e.eventTimes;for(e=e.expirationTimes;0<n;){var r=31-Hs(n),i=1<<r;t[r]=0,s[r]=-1,e[r]=-1,n&=~i}}function py(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Hs(n),r=1<<s;r&t|e[s]&t&&(e[s]|=t),n&=~r}}var Ke=0;function i2(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var o2,my,a2,l2,c2,Ag=!1,sd=[],Di=null,Mi=null,Li=null,qc=new Map,Kc=new Map,hi=[],CT="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 A_(e,t){switch(e){case"focusin":case"focusout":Di=null;break;case"dragenter":case"dragleave":Mi=null;break;case"mouseover":case"mouseout":Li=null;break;case"pointerover":case"pointerout":qc.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Kc.delete(t.pointerId)}}function Ol(e,t,n,s,r,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:i,targetContainers:[r]},t!==null&&(t=Ru(t),t!==null&&my(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function NT(e,t,n,s,r){switch(t){case"focusin":return Di=Ol(Di,e,t,n,s,r),!0;case"dragenter":return Mi=Ol(Mi,e,t,n,s,r),!0;case"mouseover":return Li=Ol(Li,e,t,n,s,r),!0;case"pointerover":var i=r.pointerId;return qc.set(i,Ol(qc.get(i)||null,e,t,n,s,r)),!0;case"gotpointercapture":return i=r.pointerId,Kc.set(i,Ol(Kc.get(i)||null,e,t,n,s,r)),!0}return!1}function u2(e){var t=go(e.target);if(t!==null){var n=ta(t);if(n!==null){if(t=n.tag,t===13){if(t=JC(n),t!==null){e.blockedOn=t,c2(e.priority,function(){a2(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 oh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Og(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);Tg=s,n.target.dispatchEvent(s),Tg=null}else return t=Ru(n),t!==null&&my(t),e.blockedOn=n,!1;t.shift()}return!0}function O_(e,t,n){oh(e)&&n.delete(t)}function jT(){Ag=!1,Di!==null&&oh(Di)&&(Di=null),Mi!==null&&oh(Mi)&&(Mi=null),Li!==null&&oh(Li)&&(Li=null),qc.forEach(O_),Kc.forEach(O_)}function Il(e,t){e.blockedOn===t&&(e.blockedOn=null,Ag||(Ag=!0,ds.unstable_scheduleCallback(ds.unstable_NormalPriority,jT)))}function Vc(e){function t(r){return Il(r,e)}if(0<sd.length){Il(sd[0],e);for(var n=1;n<sd.length;n++){var s=sd[n];s.blockedOn===e&&(s.blockedOn=null)}}for(Di!==null&&Il(Di,e),Mi!==null&&Il(Mi,e),Li!==null&&Il(Li,e),qc.forEach(t),Kc.forEach(t),n=0;n<hi.length;n++)s=hi[n],s.blockedOn===e&&(s.blockedOn=null);for(;0<hi.length&&(n=hi[0],n.blockedOn===null);)u2(n),n.blockedOn===null&&hi.shift()}var Oa=Yr.ReactCurrentBatchConfig,Hh=!0;function ET(e,t,n,s){var r=Ke,i=Oa.transition;Oa.transition=null;try{Ke=1,gy(e,t,n,s)}finally{Ke=r,Oa.transition=i}}function PT(e,t,n,s){var r=Ke,i=Oa.transition;Oa.transition=null;try{Ke=4,gy(e,t,n,s)}finally{Ke=r,Oa.transition=i}}function gy(e,t,n,s){if(Hh){var r=Og(e,t,n,s);if(r===null)Xp(e,t,s,Wh,n),A_(e,s);else if(NT(r,e,t,n,s))s.stopPropagation();else if(A_(e,s),t&4&&-1<CT.indexOf(e)){for(;r!==null;){var i=Ru(r);if(i!==null&&o2(i),i=Og(e,t,n,s),i===null&&Xp(e,t,s,Wh,n),i===r)break;r=i}r!==null&&s.stopPropagation()}else Xp(e,t,s,null,n)}}var Wh=null;function Og(e,t,n,s){if(Wh=null,e=hy(s),e=go(e),e!==null)if(t=ta(e),t===null)e=null;else if(n=t.tag,n===13){if(e=JC(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 Wh=e,null}function d2(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(gT()){case fy:return 1;case n2:return 4;case zh:case xT:return 16;case s2:return 536870912;default:return 16}default:return 16}}var ki=null,xy=null,ah=null;function h2(){if(ah)return ah;var e,t=xy,n=t.length,s,r="value"in ki?ki.value:ki.textContent,i=r.length;for(e=0;e<n&&t[e]===r[e];e++);var o=n-e;for(s=1;s<=o&&t[n-s]===r[i-s];s++);return ah=r.slice(e,1<s?1-s:void 0)}function lh(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 rd(){return!0}function I_(){return!1}function ps(e){function t(n,s,r,i,o){this._reactName=n,this._targetInst=r,this.type=s,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?rd:I_,this.isPropagationStopped=I_,this}return ht(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=rd)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=rd)},persist:function(){},isPersistent:rd}),t}var xl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vy=ps(xl),Tu=ht({},xl,{view:0,detail:0}),TT=ps(Tu),zp,$p,Fl,zf=ht({},Tu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:yy,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!==Fl&&(Fl&&e.type==="mousemove"?(zp=e.screenX-Fl.screenX,$p=e.screenY-Fl.screenY):$p=zp=0,Fl=e),zp)},movementY:function(e){return"movementY"in e?e.movementY:$p}}),F_=ps(zf),RT=ht({},zf,{dataTransfer:0}),DT=ps(RT),MT=ht({},Tu,{relatedTarget:0}),Hp=ps(MT),LT=ht({},xl,{animationName:0,elapsedTime:0,pseudoElement:0}),AT=ps(LT),OT=ht({},xl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),IT=ps(OT),FT=ht({},xl,{data:0}),B_=ps(FT),BT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},zT={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"},$T={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function HT(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=$T[e])?!!t[e]:!1}function yy(){return HT}var WT=ht({},Tu,{key:function(e){if(e.key){var t=BT[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=lh(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?zT[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:yy,charCode:function(e){return e.type==="keypress"?lh(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?lh(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),UT=ps(WT),qT=ht({},zf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),z_=ps(qT),KT=ht({},Tu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:yy}),VT=ps(KT),YT=ht({},xl,{propertyName:0,elapsedTime:0,pseudoElement:0}),XT=ps(YT),QT=ht({},zf,{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}),GT=ps(QT),JT=[9,13,27,32],_y=Hr&&"CompositionEvent"in window,bc=null;Hr&&"documentMode"in document&&(bc=document.documentMode);var ZT=Hr&&"TextEvent"in window&&!bc,f2=Hr&&(!_y||bc&&8<bc&&11>=bc),$_=" ",H_=!1;function p2(e,t){switch(e){case"keyup":return JT.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function m2(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ba=!1;function eR(e,t){switch(e){case"compositionend":return m2(t);case"keypress":return t.which!==32?null:(H_=!0,$_);case"textInput":return e=t.data,e===$_&&H_?null:e;default:return null}}function tR(e,t){if(ba)return e==="compositionend"||!_y&&p2(e,t)?(e=h2(),ah=xy=ki=null,ba=!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 f2&&t.locale!=="ko"?null:t.data;default:return null}}var nR={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 W_(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!nR[e.type]:t==="textarea"}function g2(e,t,n,s){VC(s),t=Uh(t,"onChange"),0<t.length&&(n=new vy("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var wc=null,Yc=null;function sR(e){j2(e,0)}function $f(e){var t=ka(e);if(zC(t))return e}function rR(e,t){if(e==="change")return t}var x2=!1;if(Hr){var Wp;if(Hr){var Up="oninput"in document;if(!Up){var U_=document.createElement("div");U_.setAttribute("oninput","return;"),Up=typeof U_.oninput=="function"}Wp=Up}else Wp=!1;x2=Wp&&(!document.documentMode||9<document.documentMode)}function q_(){wc&&(wc.detachEvent("onpropertychange",v2),Yc=wc=null)}function v2(e){if(e.propertyName==="value"&&$f(Yc)){var t=[];g2(t,Yc,e,hy(e)),GC(sR,t)}}function iR(e,t,n){e==="focusin"?(q_(),wc=t,Yc=n,wc.attachEvent("onpropertychange",v2)):e==="focusout"&&q_()}function oR(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return $f(Yc)}function aR(e,t){if(e==="click")return $f(t)}function lR(e,t){if(e==="input"||e==="change")return $f(t)}function cR(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var qs=typeof Object.is=="function"?Object.is:cR;function Xc(e,t){if(qs(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var r=n[s];if(!vg.call(t,r)||!qs(e[r],t[r]))return!1}return!0}function K_(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function V_(e,t){var n=K_(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=K_(n)}}function y2(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?y2(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function _2(){for(var e=window,t=Ih();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ih(e.document)}return t}function by(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 uR(e){var t=_2(),n=e.focusedElem,s=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&y2(n.ownerDocument.documentElement,n)){if(s!==null&&by(n)){if(t=s.start,e=s.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 r=n.textContent.length,i=Math.min(s.start,r);s=s.end===void 0?i:Math.min(s.end,r),!e.extend&&i>s&&(r=s,s=i,i=r),r=V_(n,i);var o=V_(n,s);r&&o&&(e.rangeCount!==1||e.anchorNode!==r.node||e.anchorOffset!==r.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(r.node,r.offset),e.removeAllRanges(),i>s?(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 dR=Hr&&"documentMode"in document&&11>=document.documentMode,wa=null,Ig=null,Sc=null,Fg=!1;function Y_(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Fg||wa==null||wa!==Ih(s)||(s=wa,"selectionStart"in s&&by(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Sc&&Xc(Sc,s)||(Sc=s,s=Uh(Ig,"onSelect"),0<s.length&&(t=new vy("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=wa)))}function id(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Sa={animationend:id("Animation","AnimationEnd"),animationiteration:id("Animation","AnimationIteration"),animationstart:id("Animation","AnimationStart"),transitionend:id("Transition","TransitionEnd")},qp={},b2={};Hr&&(b2=document.createElement("div").style,"AnimationEvent"in window||(delete Sa.animationend.animation,delete Sa.animationiteration.animation,delete Sa.animationstart.animation),"TransitionEvent"in window||delete Sa.transitionend.transition);function Hf(e){if(qp[e])return qp[e];if(!Sa[e])return e;var t=Sa[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in b2)return qp[e]=t[n];return e}var w2=Hf("animationend"),S2=Hf("animationiteration"),k2=Hf("animationstart"),C2=Hf("transitionend"),N2=new Map,X_="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 Qi(e,t){N2.set(e,t),ea(t,[e])}for(var Kp=0;Kp<X_.length;Kp++){var Vp=X_[Kp],hR=Vp.toLowerCase(),fR=Vp[0].toUpperCase()+Vp.slice(1);Qi(hR,"on"+fR)}Qi(w2,"onAnimationEnd");Qi(S2,"onAnimationIteration");Qi(k2,"onAnimationStart");Qi("dblclick","onDoubleClick");Qi("focusin","onFocus");Qi("focusout","onBlur");Qi(C2,"onTransitionEnd");el("onMouseEnter",["mouseout","mouseover"]);el("onMouseLeave",["mouseout","mouseover"]);el("onPointerEnter",["pointerout","pointerover"]);el("onPointerLeave",["pointerout","pointerover"]);ea("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ea("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ea("onBeforeInput",["compositionend","keypress","textInput","paste"]);ea("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ea("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ea("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var lc="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(" "),pR=new Set("cancel close invalid load scroll toggle".split(" ").concat(lc));function Q_(e,t,n){var s=e.type||"unknown-event";e.currentTarget=n,hT(s,t,void 0,e),e.currentTarget=null}function j2(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],r=s.event;s=s.listeners;e:{var i=void 0;if(t)for(var o=s.length-1;0<=o;o--){var a=s[o],c=a.instance,u=a.currentTarget;if(a=a.listener,c!==i&&r.isPropagationStopped())break e;Q_(r,a,u),i=c}else for(o=0;o<s.length;o++){if(a=s[o],c=a.instance,u=a.currentTarget,a=a.listener,c!==i&&r.isPropagationStopped())break e;Q_(r,a,u),i=c}}}if(Bh)throw e=Mg,Bh=!1,Mg=null,e}function nt(e,t){var n=t[Wg];n===void 0&&(n=t[Wg]=new Set);var s=e+"__bubble";n.has(s)||(E2(t,e,2,!1),n.add(s))}function Yp(e,t,n){var s=0;t&&(s|=4),E2(n,e,s,t)}var od="_reactListening"+Math.random().toString(36).slice(2);function Qc(e){if(!e[od]){e[od]=!0,AC.forEach(function(n){n!=="selectionchange"&&(pR.has(n)||Yp(n,!1,e),Yp(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[od]||(t[od]=!0,Yp("selectionchange",!1,t))}}function E2(e,t,n,s){switch(d2(t)){case 1:var r=ET;break;case 4:r=PT;break;default:r=gy}n=r.bind(null,t,n,e),r=void 0,!Dg||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),s?r!==void 0?e.addEventListener(t,n,{capture:!0,passive:r}):e.addEventListener(t,n,!0):r!==void 0?e.addEventListener(t,n,{passive:r}):e.addEventListener(t,n,!1)}function Xp(e,t,n,s,r){var i=s;if(!(t&1)&&!(t&2)&&s!==null)e:for(;;){if(s===null)return;var o=s.tag;if(o===3||o===4){var a=s.stateNode.containerInfo;if(a===r||a.nodeType===8&&a.parentNode===r)break;if(o===4)for(o=s.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===r||c.nodeType===8&&c.parentNode===r))return;o=o.return}for(;a!==null;){if(o=go(a),o===null)return;if(c=o.tag,c===5||c===6){s=i=o;continue e}a=a.parentNode}}s=s.return}GC(function(){var u=i,d=hy(n),h=[];e:{var p=N2.get(e);if(p!==void 0){var f=vy,m=e;switch(e){case"keypress":if(lh(n)===0)break e;case"keydown":case"keyup":f=UT;break;case"focusin":m="focus",f=Hp;break;case"focusout":m="blur",f=Hp;break;case"beforeblur":case"afterblur":f=Hp;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=F_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=DT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=VT;break;case w2:case S2:case k2:f=AT;break;case C2:f=XT;break;case"scroll":f=TT;break;case"wheel":f=GT;break;case"copy":case"cut":case"paste":f=IT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=z_}var g=(t&4)!==0,v=!g&&e==="scroll",x=g?p!==null?p+"Capture":null:p;g=[];for(var _=u,b;_!==null;){b=_;var S=b.stateNode;if(b.tag===5&&S!==null&&(b=S,x!==null&&(S=Uc(_,x),S!=null&&g.push(Gc(_,S,b)))),v)break;_=_.return}0<g.length&&(p=new f(p,m,null,n,d),h.push({event:p,listeners:g}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",f=e==="mouseout"||e==="pointerout",p&&n!==Tg&&(m=n.relatedTarget||n.fromElement)&&(go(m)||m[Wr]))break e;if((f||p)&&(p=d.window===d?d:(p=d.ownerDocument)?p.defaultView||p.parentWindow:window,f?(m=n.relatedTarget||n.toElement,f=u,m=m?go(m):null,m!==null&&(v=ta(m),m!==v||m.tag!==5&&m.tag!==6)&&(m=null)):(f=null,m=u),f!==m)){if(g=F_,S="onMouseLeave",x="onMouseEnter",_="mouse",(e==="pointerout"||e==="pointerover")&&(g=z_,S="onPointerLeave",x="onPointerEnter",_="pointer"),v=f==null?p:ka(f),b=m==null?p:ka(m),p=new g(S,_+"leave",f,n,d),p.target=v,p.relatedTarget=b,S=null,go(d)===u&&(g=new g(x,_+"enter",m,n,d),g.target=b,g.relatedTarget=v,S=g),v=S,f&&m)t:{for(g=f,x=m,_=0,b=g;b;b=aa(b))_++;for(b=0,S=x;S;S=aa(S))b++;for(;0<_-b;)g=aa(g),_--;for(;0<b-_;)x=aa(x),b--;for(;_--;){if(g===x||x!==null&&g===x.alternate)break t;g=aa(g),x=aa(x)}g=null}else g=null;f!==null&&G_(h,p,f,g,!1),m!==null&&v!==null&&G_(h,v,m,g,!0)}}e:{if(p=u?ka(u):window,f=p.nodeName&&p.nodeName.toLowerCase(),f==="select"||f==="input"&&p.type==="file")var C=rR;else if(W_(p))if(x2)C=lR;else{C=oR;var w=iR}else(f=p.nodeName)&&f.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(C=aR);if(C&&(C=C(e,u))){g2(h,C,n,d);break e}w&&w(e,p,u),e==="focusout"&&(w=p._wrapperState)&&w.controlled&&p.type==="number"&&Cg(p,"number",p.value)}switch(w=u?ka(u):window,e){case"focusin":(W_(w)||w.contentEditable==="true")&&(wa=w,Ig=u,Sc=null);break;case"focusout":Sc=Ig=wa=null;break;case"mousedown":Fg=!0;break;case"contextmenu":case"mouseup":case"dragend":Fg=!1,Y_(h,n,d);break;case"selectionchange":if(dR)break;case"keydown":case"keyup":Y_(h,n,d)}var j;if(_y)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 ba?p2(e,n)&&(T="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(T="onCompositionStart");T&&(f2&&n.locale!=="ko"&&(ba||T!=="onCompositionStart"?T==="onCompositionEnd"&&ba&&(j=h2()):(ki=d,xy="value"in ki?ki.value:ki.textContent,ba=!0)),w=Uh(u,T),0<w.length&&(T=new B_(T,e,null,n,d),h.push({event:T,listeners:w}),j?T.data=j:(j=m2(n),j!==null&&(T.data=j)))),(j=ZT?eR(e,n):tR(e,n))&&(u=Uh(u,"onBeforeInput"),0<u.length&&(d=new B_("onBeforeInput","beforeinput",null,n,d),h.push({event:d,listeners:u}),d.data=j))}j2(h,t)})}function Gc(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Uh(e,t){for(var n=t+"Capture",s=[];e!==null;){var r=e,i=r.stateNode;r.tag===5&&i!==null&&(r=i,i=Uc(e,n),i!=null&&s.unshift(Gc(e,i,r)),i=Uc(e,t),i!=null&&s.push(Gc(e,i,r))),e=e.return}return s}function aa(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function G_(e,t,n,s,r){for(var i=t._reactName,o=[];n!==null&&n!==s;){var a=n,c=a.alternate,u=a.stateNode;if(c!==null&&c===s)break;a.tag===5&&u!==null&&(a=u,r?(c=Uc(n,i),c!=null&&o.unshift(Gc(n,c,a))):r||(c=Uc(n,i),c!=null&&o.push(Gc(n,c,a)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var mR=/\r\n?/g,gR=/\u0000|\uFFFD/g;function J_(e){return(typeof e=="string"?e:""+e).replace(mR,`
|
|
38
|
+
`).replace(gR,"")}function ad(e,t,n){if(t=J_(t),J_(e)!==t&&n)throw Error(te(425))}function qh(){}var Bg=null,zg=null;function $g(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 Hg=typeof setTimeout=="function"?setTimeout:void 0,xR=typeof clearTimeout=="function"?clearTimeout:void 0,Z_=typeof Promise=="function"?Promise:void 0,vR=typeof queueMicrotask=="function"?queueMicrotask:typeof Z_<"u"?function(e){return Z_.resolve(null).then(e).catch(yR)}:Hg;function yR(e){setTimeout(function(){throw e})}function Qp(e,t){var n=t,s=0;do{var r=n.nextSibling;if(e.removeChild(n),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(s===0){e.removeChild(r),Vc(t);return}s--}else n!=="$"&&n!=="$?"&&n!=="$!"||s++;n=r}while(n);Vc(t)}function Ai(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 eb(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 vl=Math.random().toString(36).slice(2),ar="__reactFiber$"+vl,Jc="__reactProps$"+vl,Wr="__reactContainer$"+vl,Wg="__reactEvents$"+vl,_R="__reactListeners$"+vl,bR="__reactHandles$"+vl;function go(e){var t=e[ar];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Wr]||n[ar]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=eb(e);e!==null;){if(n=e[ar])return n;e=eb(e)}return t}e=n,n=e.parentNode}return null}function Ru(e){return e=e[ar]||e[Wr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ka(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(te(33))}function Wf(e){return e[Jc]||null}var Ug=[],Ca=-1;function Gi(e){return{current:e}}function rt(e){0>Ca||(e.current=Ug[Ca],Ug[Ca]=null,Ca--)}function et(e,t){Ca++,Ug[Ca]=e.current,e.current=t}var Ki={},Cn=Gi(Ki),Gn=Gi(!1),Io=Ki;function tl(e,t){var n=e.type.contextTypes;if(!n)return Ki;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var r={},i;for(i in n)r[i]=t[i];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=r),r}function Jn(e){return e=e.childContextTypes,e!=null}function Kh(){rt(Gn),rt(Cn)}function tb(e,t,n){if(Cn.current!==Ki)throw Error(te(168));et(Cn,t),et(Gn,n)}function P2(e,t,n){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return n;s=s.getChildContext();for(var r in s)if(!(r in t))throw Error(te(108,iT(e)||"Unknown",r));return ht({},n,s)}function Vh(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ki,Io=Cn.current,et(Cn,e),et(Gn,Gn.current),!0}function nb(e,t,n){var s=e.stateNode;if(!s)throw Error(te(169));n?(e=P2(e,t,Io),s.__reactInternalMemoizedMergedChildContext=e,rt(Gn),rt(Cn),et(Cn,e)):rt(Gn),et(Gn,n)}var Er=null,Uf=!1,Gp=!1;function T2(e){Er===null?Er=[e]:Er.push(e)}function wR(e){Uf=!0,T2(e)}function Ji(){if(!Gp&&Er!==null){Gp=!0;var e=0,t=Ke;try{var n=Er;for(Ke=1;e<n.length;e++){var s=n[e];do s=s(!0);while(s!==null)}Er=null,Uf=!1}catch(r){throw Er!==null&&(Er=Er.slice(e+1)),t2(fy,Ji),r}finally{Ke=t,Gp=!1}}return null}var Na=[],ja=0,Yh=null,Xh=0,ws=[],Ss=0,Fo=null,Or=1,Ir="";function ao(e,t){Na[ja++]=Xh,Na[ja++]=Yh,Yh=e,Xh=t}function R2(e,t,n){ws[Ss++]=Or,ws[Ss++]=Ir,ws[Ss++]=Fo,Fo=e;var s=Or;e=Ir;var r=32-Hs(s)-1;s&=~(1<<r),n+=1;var i=32-Hs(t)+r;if(30<i){var o=r-r%5;i=(s&(1<<o)-1).toString(32),s>>=o,r-=o,Or=1<<32-Hs(t)+r|n<<r|s,Ir=i+e}else Or=1<<i|n<<r|s,Ir=e}function wy(e){e.return!==null&&(ao(e,1),R2(e,1,0))}function Sy(e){for(;e===Yh;)Yh=Na[--ja],Na[ja]=null,Xh=Na[--ja],Na[ja]=null;for(;e===Fo;)Fo=ws[--Ss],ws[Ss]=null,Ir=ws[--Ss],ws[Ss]=null,Or=ws[--Ss],ws[Ss]=null}var ls=null,as=null,ot=!1,$s=null;function D2(e,t){var n=Ns(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 sb(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,ls=e,as=Ai(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,ls=e,as=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Fo!==null?{id:Or,overflow:Ir}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Ns(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,ls=e,as=null,!0):!1;default:return!1}}function qg(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Kg(e){if(ot){var t=as;if(t){var n=t;if(!sb(e,t)){if(qg(e))throw Error(te(418));t=Ai(n.nextSibling);var s=ls;t&&sb(e,t)?D2(s,n):(e.flags=e.flags&-4097|2,ot=!1,ls=e)}}else{if(qg(e))throw Error(te(418));e.flags=e.flags&-4097|2,ot=!1,ls=e}}}function rb(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ls=e}function ld(e){if(e!==ls)return!1;if(!ot)return rb(e),ot=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!$g(e.type,e.memoizedProps)),t&&(t=as)){if(qg(e))throw M2(),Error(te(418));for(;t;)D2(e,t),t=Ai(t.nextSibling)}if(rb(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(te(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){as=Ai(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}as=null}}else as=ls?Ai(e.stateNode.nextSibling):null;return!0}function M2(){for(var e=as;e;)e=Ai(e.nextSibling)}function nl(){as=ls=null,ot=!1}function ky(e){$s===null?$s=[e]:$s.push(e)}var SR=Yr.ReactCurrentBatchConfig;function Bl(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(te(309));var s=n.stateNode}if(!s)throw Error(te(147,e));var r=s,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(o){var a=r.refs;o===null?delete a[i]:a[i]=o},t._stringRef=i,t)}if(typeof e!="string")throw Error(te(284));if(!n._owner)throw Error(te(290,e))}return e}function cd(e,t){throw e=Object.prototype.toString.call(t),Error(te(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ib(e){var t=e._init;return t(e._payload)}function L2(e){function t(x,_){if(e){var b=x.deletions;b===null?(x.deletions=[_],x.flags|=16):b.push(_)}}function n(x,_){if(!e)return null;for(;_!==null;)t(x,_),_=_.sibling;return null}function s(x,_){for(x=new Map;_!==null;)_.key!==null?x.set(_.key,_):x.set(_.index,_),_=_.sibling;return x}function r(x,_){return x=Bi(x,_),x.index=0,x.sibling=null,x}function i(x,_,b){return x.index=b,e?(b=x.alternate,b!==null?(b=b.index,b<_?(x.flags|=2,_):b):(x.flags|=2,_)):(x.flags|=1048576,_)}function o(x){return e&&x.alternate===null&&(x.flags|=2),x}function a(x,_,b,S){return _===null||_.tag!==6?(_=rm(b,x.mode,S),_.return=x,_):(_=r(_,b),_.return=x,_)}function c(x,_,b,S){var C=b.type;return C===_a?d(x,_,b.props.children,S,b.key):_!==null&&(_.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===li&&ib(C)===_.type)?(S=r(_,b.props),S.ref=Bl(x,_,b),S.return=x,S):(S=mh(b.type,b.key,b.props,null,x.mode,S),S.ref=Bl(x,_,b),S.return=x,S)}function u(x,_,b,S){return _===null||_.tag!==4||_.stateNode.containerInfo!==b.containerInfo||_.stateNode.implementation!==b.implementation?(_=im(b,x.mode,S),_.return=x,_):(_=r(_,b.children||[]),_.return=x,_)}function d(x,_,b,S,C){return _===null||_.tag!==7?(_=Mo(b,x.mode,S,C),_.return=x,_):(_=r(_,b),_.return=x,_)}function h(x,_,b){if(typeof _=="string"&&_!==""||typeof _=="number")return _=rm(""+_,x.mode,b),_.return=x,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Ju:return b=mh(_.type,_.key,_.props,null,x.mode,b),b.ref=Bl(x,null,_),b.return=x,b;case ya:return _=im(_,x.mode,b),_.return=x,_;case li:var S=_._init;return h(x,S(_._payload),b)}if(oc(_)||Ll(_))return _=Mo(_,x.mode,b,null),_.return=x,_;cd(x,_)}return null}function p(x,_,b,S){var C=_!==null?_.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return C!==null?null:a(x,_,""+b,S);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Ju:return b.key===C?c(x,_,b,S):null;case ya:return b.key===C?u(x,_,b,S):null;case li:return C=b._init,p(x,_,C(b._payload),S)}if(oc(b)||Ll(b))return C!==null?null:d(x,_,b,S,null);cd(x,b)}return null}function f(x,_,b,S,C){if(typeof S=="string"&&S!==""||typeof S=="number")return x=x.get(b)||null,a(_,x,""+S,C);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Ju:return x=x.get(S.key===null?b:S.key)||null,c(_,x,S,C);case ya:return x=x.get(S.key===null?b:S.key)||null,u(_,x,S,C);case li:var w=S._init;return f(x,_,b,w(S._payload),C)}if(oc(S)||Ll(S))return x=x.get(b)||null,d(_,x,S,C,null);cd(_,S)}return null}function m(x,_,b,S){for(var C=null,w=null,j=_,T=_=0,F=null;j!==null&&T<b.length;T++){j.index>T?(F=j,j=null):F=j.sibling;var R=p(x,j,b[T],S);if(R===null){j===null&&(j=F);break}e&&j&&R.alternate===null&&t(x,j),_=i(R,_,T),w===null?C=R:w.sibling=R,w=R,j=F}if(T===b.length)return n(x,j),ot&&ao(x,T),C;if(j===null){for(;T<b.length;T++)j=h(x,b[T],S),j!==null&&(_=i(j,_,T),w===null?C=j:w.sibling=j,w=j);return ot&&ao(x,T),C}for(j=s(x,j);T<b.length;T++)F=f(j,x,T,b[T],S),F!==null&&(e&&F.alternate!==null&&j.delete(F.key===null?T:F.key),_=i(F,_,T),w===null?C=F:w.sibling=F,w=F);return e&&j.forEach(function(B){return t(x,B)}),ot&&ao(x,T),C}function g(x,_,b,S){var C=Ll(b);if(typeof C!="function")throw Error(te(150));if(b=C.call(b),b==null)throw Error(te(151));for(var w=C=null,j=_,T=_=0,F=null,R=b.next();j!==null&&!R.done;T++,R=b.next()){j.index>T?(F=j,j=null):F=j.sibling;var B=p(x,j,R.value,S);if(B===null){j===null&&(j=F);break}e&&j&&B.alternate===null&&t(x,j),_=i(B,_,T),w===null?C=B:w.sibling=B,w=B,j=F}if(R.done)return n(x,j),ot&&ao(x,T),C;if(j===null){for(;!R.done;T++,R=b.next())R=h(x,R.value,S),R!==null&&(_=i(R,_,T),w===null?C=R:w.sibling=R,w=R);return ot&&ao(x,T),C}for(j=s(x,j);!R.done;T++,R=b.next())R=f(j,x,T,R.value,S),R!==null&&(e&&R.alternate!==null&&j.delete(R.key===null?T:R.key),_=i(R,_,T),w===null?C=R:w.sibling=R,w=R);return e&&j.forEach(function(A){return t(x,A)}),ot&&ao(x,T),C}function v(x,_,b,S){if(typeof b=="object"&&b!==null&&b.type===_a&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Ju:e:{for(var C=b.key,w=_;w!==null;){if(w.key===C){if(C=b.type,C===_a){if(w.tag===7){n(x,w.sibling),_=r(w,b.props.children),_.return=x,x=_;break e}}else if(w.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===li&&ib(C)===w.type){n(x,w.sibling),_=r(w,b.props),_.ref=Bl(x,w,b),_.return=x,x=_;break e}n(x,w);break}else t(x,w);w=w.sibling}b.type===_a?(_=Mo(b.props.children,x.mode,S,b.key),_.return=x,x=_):(S=mh(b.type,b.key,b.props,null,x.mode,S),S.ref=Bl(x,_,b),S.return=x,x=S)}return o(x);case ya:e:{for(w=b.key;_!==null;){if(_.key===w)if(_.tag===4&&_.stateNode.containerInfo===b.containerInfo&&_.stateNode.implementation===b.implementation){n(x,_.sibling),_=r(_,b.children||[]),_.return=x,x=_;break e}else{n(x,_);break}else t(x,_);_=_.sibling}_=im(b,x.mode,S),_.return=x,x=_}return o(x);case li:return w=b._init,v(x,_,w(b._payload),S)}if(oc(b))return m(x,_,b,S);if(Ll(b))return g(x,_,b,S);cd(x,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,_!==null&&_.tag===6?(n(x,_.sibling),_=r(_,b),_.return=x,x=_):(n(x,_),_=rm(b,x.mode,S),_.return=x,x=_),o(x)):n(x,_)}return v}var sl=L2(!0),A2=L2(!1),Qh=Gi(null),Gh=null,Ea=null,Cy=null;function Ny(){Cy=Ea=Gh=null}function jy(e){var t=Qh.current;rt(Qh),e._currentValue=t}function Vg(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function Ia(e,t){Gh=e,Cy=Ea=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Xn=!0),e.firstContext=null)}function Ts(e){var t=e._currentValue;if(Cy!==e)if(e={context:e,memoizedValue:t,next:null},Ea===null){if(Gh===null)throw Error(te(308));Ea=e,Gh.dependencies={lanes:0,firstContext:e}}else Ea=Ea.next=e;return t}var xo=null;function Ey(e){xo===null?xo=[e]:xo.push(e)}function O2(e,t,n,s){var r=t.interleaved;return r===null?(n.next=n,Ey(t)):(n.next=r.next,r.next=n),t.interleaved=n,Ur(e,s)}function Ur(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 ci=!1;function Py(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function I2(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 Br(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Oi(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,ze&2){var r=s.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),s.pending=t,Ur(e,n)}return r=s.interleaved,r===null?(t.next=t,Ey(s)):(t.next=r.next,r.next=t),s.interleaved=t,Ur(e,n)}function ch(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,py(e,n)}}function ob(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var r=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?r=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?r=i=t:i=i.next=t}else r=i=t;n={baseState:s.baseState,firstBaseUpdate:r,lastBaseUpdate:i,shared:s.shared,effects:s.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Jh(e,t,n,s){var r=e.updateQueue;ci=!1;var i=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var c=a,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=c))}if(i!==null){var h=r.baseState;o=0,d=u=c=null,a=i;do{var p=a.lane,f=a.eventTime;if((s&p)===p){d!==null&&(d=d.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var m=e,g=a;switch(p=t,f=n,g.tag){case 1:if(m=g.payload,typeof m=="function"){h=m.call(f,h,p);break e}h=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,p=typeof m=="function"?m.call(f,h,p):m,p==null)break e;h=ht({},h,p);break e;case 2:ci=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,p=r.effects,p===null?r.effects=[a]:p.push(a))}else f={eventTime:f,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=f,c=h):d=d.next=f,o|=p;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;p=a,a=p.next,p.next=null,r.lastBaseUpdate=p,r.shared.pending=null}}while(!0);if(d===null&&(c=h),r.baseState=c,r.firstBaseUpdate=u,r.lastBaseUpdate=d,t=r.shared.interleaved,t!==null){r=t;do o|=r.lane,r=r.next;while(r!==t)}else i===null&&(r.shared.lanes=0);zo|=o,e.lanes=o,e.memoizedState=h}}function ab(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var s=e[t],r=s.callback;if(r!==null){if(s.callback=null,s=n,typeof r!="function")throw Error(te(191,r));r.call(s)}}}var Du={},dr=Gi(Du),Zc=Gi(Du),eu=Gi(Du);function vo(e){if(e===Du)throw Error(te(174));return e}function Ty(e,t){switch(et(eu,t),et(Zc,e),et(dr,Du),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:jg(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=jg(t,e)}rt(dr),et(dr,t)}function rl(){rt(dr),rt(Zc),rt(eu)}function F2(e){vo(eu.current);var t=vo(dr.current),n=jg(t,e.type);t!==n&&(et(Zc,e),et(dr,n))}function Ry(e){Zc.current===e&&(rt(dr),rt(Zc))}var ut=Gi(0);function Zh(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 Jp=[];function Dy(){for(var e=0;e<Jp.length;e++)Jp[e]._workInProgressVersionPrimary=null;Jp.length=0}var uh=Yr.ReactCurrentDispatcher,Zp=Yr.ReactCurrentBatchConfig,Bo=0,dt=null,Ft=null,Qt=null,ef=!1,kc=!1,tu=0,kR=0;function gn(){throw Error(te(321))}function My(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!qs(e[n],t[n]))return!1;return!0}function Ly(e,t,n,s,r,i){if(Bo=i,dt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,uh.current=e===null||e.memoizedState===null?ER:PR,e=n(s,r),kc){i=0;do{if(kc=!1,tu=0,25<=i)throw Error(te(301));i+=1,Qt=Ft=null,t.updateQueue=null,uh.current=TR,e=n(s,r)}while(kc)}if(uh.current=tf,t=Ft!==null&&Ft.next!==null,Bo=0,Qt=Ft=dt=null,ef=!1,t)throw Error(te(300));return e}function Ay(){var e=tu!==0;return tu=0,e}function Zs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qt===null?dt.memoizedState=Qt=e:Qt=Qt.next=e,Qt}function Rs(){if(Ft===null){var e=dt.alternate;e=e!==null?e.memoizedState:null}else e=Ft.next;var t=Qt===null?dt.memoizedState:Qt.next;if(t!==null)Qt=t,Ft=e;else{if(e===null)throw Error(te(310));Ft=e,e={memoizedState:Ft.memoizedState,baseState:Ft.baseState,baseQueue:Ft.baseQueue,queue:Ft.queue,next:null},Qt===null?dt.memoizedState=Qt=e:Qt=Qt.next=e}return Qt}function nu(e,t){return typeof t=="function"?t(e):t}function em(e){var t=Rs(),n=t.queue;if(n===null)throw Error(te(311));n.lastRenderedReducer=e;var s=Ft,r=s.baseQueue,i=n.pending;if(i!==null){if(r!==null){var o=r.next;r.next=i.next,i.next=o}s.baseQueue=r=i,n.pending=null}if(r!==null){i=r.next,s=s.baseState;var a=o=null,c=null,u=i;do{var d=u.lane;if((Bo&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),s=u.hasEagerState?u.eagerState:e(s,u.action);else{var h={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(a=c=h,o=s):c=c.next=h,dt.lanes|=d,zo|=d}u=u.next}while(u!==null&&u!==i);c===null?o=s:c.next=a,qs(s,t.memoizedState)||(Xn=!0),t.memoizedState=s,t.baseState=o,t.baseQueue=c,n.lastRenderedState=s}if(e=n.interleaved,e!==null){r=e;do i=r.lane,dt.lanes|=i,zo|=i,r=r.next;while(r!==e)}else r===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function tm(e){var t=Rs(),n=t.queue;if(n===null)throw Error(te(311));n.lastRenderedReducer=e;var s=n.dispatch,r=n.pending,i=t.memoizedState;if(r!==null){n.pending=null;var o=r=r.next;do i=e(i,o.action),o=o.next;while(o!==r);qs(i,t.memoizedState)||(Xn=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,s]}function B2(){}function z2(e,t){var n=dt,s=Rs(),r=t(),i=!qs(s.memoizedState,r);if(i&&(s.memoizedState=r,Xn=!0),s=s.queue,Oy(W2.bind(null,n,s,e),[e]),s.getSnapshot!==t||i||Qt!==null&&Qt.memoizedState.tag&1){if(n.flags|=2048,su(9,H2.bind(null,n,s,r,t),void 0,null),tn===null)throw Error(te(349));Bo&30||$2(n,t,r)}return r}function $2(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=dt.updateQueue,t===null?(t={lastEffect:null,stores:null},dt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function H2(e,t,n,s){t.value=n,t.getSnapshot=s,U2(t)&&q2(e)}function W2(e,t,n){return n(function(){U2(t)&&q2(e)})}function U2(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!qs(e,n)}catch{return!0}}function q2(e){var t=Ur(e,1);t!==null&&Ws(t,e,1,-1)}function lb(e){var t=Zs();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:nu,lastRenderedState:e},t.queue=e,e=e.dispatch=jR.bind(null,dt,e),[t.memoizedState,e]}function su(e,t,n,s){return e={tag:e,create:t,destroy:n,deps:s,next:null},t=dt.updateQueue,t===null?(t={lastEffect:null,stores:null},dt.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e)),e}function K2(){return Rs().memoizedState}function dh(e,t,n,s){var r=Zs();dt.flags|=e,r.memoizedState=su(1|t,n,void 0,s===void 0?null:s)}function qf(e,t,n,s){var r=Rs();s=s===void 0?null:s;var i=void 0;if(Ft!==null){var o=Ft.memoizedState;if(i=o.destroy,s!==null&&My(s,o.deps)){r.memoizedState=su(t,n,i,s);return}}dt.flags|=e,r.memoizedState=su(1|t,n,i,s)}function cb(e,t){return dh(8390656,8,e,t)}function Oy(e,t){return qf(2048,8,e,t)}function V2(e,t){return qf(4,2,e,t)}function Y2(e,t){return qf(4,4,e,t)}function X2(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 Q2(e,t,n){return n=n!=null?n.concat([e]):null,qf(4,4,X2.bind(null,t,e),n)}function Iy(){}function G2(e,t){var n=Rs();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&My(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function J2(e,t){var n=Rs();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&My(t,s[1])?s[0]:(e=e(),n.memoizedState=[e,t],e)}function Z2(e,t,n){return Bo&21?(qs(n,t)||(n=r2(),dt.lanes|=n,zo|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Xn=!0),e.memoizedState=n)}function CR(e,t){var n=Ke;Ke=n!==0&&4>n?n:4,e(!0);var s=Zp.transition;Zp.transition={};try{e(!1),t()}finally{Ke=n,Zp.transition=s}}function eN(){return Rs().memoizedState}function NR(e,t,n){var s=Fi(e);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},tN(e))nN(t,n);else if(n=O2(e,t,n,s),n!==null){var r=An();Ws(n,e,s,r),sN(n,t,s)}}function jR(e,t,n){var s=Fi(e),r={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(tN(e))nN(t,r);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(r.hasEagerState=!0,r.eagerState=a,qs(a,o)){var c=t.interleaved;c===null?(r.next=r,Ey(t)):(r.next=c.next,c.next=r),t.interleaved=r;return}}catch{}finally{}n=O2(e,t,r,s),n!==null&&(r=An(),Ws(n,e,s,r),sN(n,t,s))}}function tN(e){var t=e.alternate;return e===dt||t!==null&&t===dt}function nN(e,t){kc=ef=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function sN(e,t,n){if(n&4194240){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,py(e,n)}}var tf={readContext:Ts,useCallback:gn,useContext:gn,useEffect:gn,useImperativeHandle:gn,useInsertionEffect:gn,useLayoutEffect:gn,useMemo:gn,useReducer:gn,useRef:gn,useState:gn,useDebugValue:gn,useDeferredValue:gn,useTransition:gn,useMutableSource:gn,useSyncExternalStore:gn,useId:gn,unstable_isNewReconciler:!1},ER={readContext:Ts,useCallback:function(e,t){return Zs().memoizedState=[e,t===void 0?null:t],e},useContext:Ts,useEffect:cb,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,dh(4194308,4,X2.bind(null,t,e),n)},useLayoutEffect:function(e,t){return dh(4194308,4,e,t)},useInsertionEffect:function(e,t){return dh(4,2,e,t)},useMemo:function(e,t){var n=Zs();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var s=Zs();return t=n!==void 0?n(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=NR.bind(null,dt,e),[s.memoizedState,e]},useRef:function(e){var t=Zs();return e={current:e},t.memoizedState=e},useState:lb,useDebugValue:Iy,useDeferredValue:function(e){return Zs().memoizedState=e},useTransition:function(){var e=lb(!1),t=e[0];return e=CR.bind(null,e[1]),Zs().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var s=dt,r=Zs();if(ot){if(n===void 0)throw Error(te(407));n=n()}else{if(n=t(),tn===null)throw Error(te(349));Bo&30||$2(s,t,n)}r.memoizedState=n;var i={value:n,getSnapshot:t};return r.queue=i,cb(W2.bind(null,s,i,e),[e]),s.flags|=2048,su(9,H2.bind(null,s,i,n,t),void 0,null),n},useId:function(){var e=Zs(),t=tn.identifierPrefix;if(ot){var n=Ir,s=Or;n=(s&~(1<<32-Hs(s)-1)).toString(32)+n,t=":"+t+"R"+n,n=tu++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=kR++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},PR={readContext:Ts,useCallback:G2,useContext:Ts,useEffect:Oy,useImperativeHandle:Q2,useInsertionEffect:V2,useLayoutEffect:Y2,useMemo:J2,useReducer:em,useRef:K2,useState:function(){return em(nu)},useDebugValue:Iy,useDeferredValue:function(e){var t=Rs();return Z2(t,Ft.memoizedState,e)},useTransition:function(){var e=em(nu)[0],t=Rs().memoizedState;return[e,t]},useMutableSource:B2,useSyncExternalStore:z2,useId:eN,unstable_isNewReconciler:!1},TR={readContext:Ts,useCallback:G2,useContext:Ts,useEffect:Oy,useImperativeHandle:Q2,useInsertionEffect:V2,useLayoutEffect:Y2,useMemo:J2,useReducer:tm,useRef:K2,useState:function(){return tm(nu)},useDebugValue:Iy,useDeferredValue:function(e){var t=Rs();return Ft===null?t.memoizedState=e:Z2(t,Ft.memoizedState,e)},useTransition:function(){var e=tm(nu)[0],t=Rs().memoizedState;return[e,t]},useMutableSource:B2,useSyncExternalStore:z2,useId:eN,unstable_isNewReconciler:!1};function Os(e,t){if(e&&e.defaultProps){t=ht({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Yg(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:ht({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Kf={isMounted:function(e){return(e=e._reactInternals)?ta(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var s=An(),r=Fi(e),i=Br(s,r);i.payload=t,n!=null&&(i.callback=n),t=Oi(e,i,r),t!==null&&(Ws(t,e,r,s),ch(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=An(),r=Fi(e),i=Br(s,r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Oi(e,i,r),t!==null&&(Ws(t,e,r,s),ch(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=An(),s=Fi(e),r=Br(n,s);r.tag=2,t!=null&&(r.callback=t),t=Oi(e,r,s),t!==null&&(Ws(t,e,s,n),ch(t,e,s))}};function ub(e,t,n,s,r,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,i,o):t.prototype&&t.prototype.isPureReactComponent?!Xc(n,s)||!Xc(r,i):!0}function rN(e,t,n){var s=!1,r=Ki,i=t.contextType;return typeof i=="object"&&i!==null?i=Ts(i):(r=Jn(t)?Io:Cn.current,s=t.contextTypes,i=(s=s!=null)?tl(e,r):Ki),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Kf,e.stateNode=t,t._reactInternals=e,s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=r,e.__reactInternalMemoizedMaskedChildContext=i),t}function db(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&Kf.enqueueReplaceState(t,t.state,null)}function Xg(e,t,n,s){var r=e.stateNode;r.props=n,r.state=e.memoizedState,r.refs={},Py(e);var i=t.contextType;typeof i=="object"&&i!==null?r.context=Ts(i):(i=Jn(t)?Io:Cn.current,r.context=tl(e,i)),r.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Yg(e,t,i,n),r.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(t=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),t!==r.state&&Kf.enqueueReplaceState(r,r.state,null),Jh(e,n,r,s),r.state=e.memoizedState),typeof r.componentDidMount=="function"&&(e.flags|=4194308)}function il(e,t){try{var n="",s=t;do n+=rT(s),s=s.return;while(s);var r=n}catch(i){r=`
|
|
39
|
+
Error generating stack: `+i.message+`
|
|
40
|
+
`+i.stack}return{value:e,source:t,stack:r,digest:null}}function nm(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Qg(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var RR=typeof WeakMap=="function"?WeakMap:Map;function iN(e,t,n){n=Br(-1,n),n.tag=3,n.payload={element:null};var s=t.value;return n.callback=function(){sf||(sf=!0,ox=s),Qg(e,t)},n}function oN(e,t,n){n=Br(-1,n),n.tag=3;var s=e.type.getDerivedStateFromError;if(typeof s=="function"){var r=t.value;n.payload=function(){return s(r)},n.callback=function(){Qg(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Qg(e,t),typeof s!="function"&&(Ii===null?Ii=new Set([this]):Ii.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function hb(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new RR;var r=new Set;s.set(t,r)}else r=s.get(t),r===void 0&&(r=new Set,s.set(t,r));r.has(n)||(r.add(n),e=qR.bind(null,e,t,n),t.then(e,e))}function fb(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 pb(e,t,n,s,r){return e.mode&1?(e.flags|=65536,e.lanes=r,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=Br(-1,1),t.tag=2,Oi(n,t,1))),n.lanes|=1),e)}var DR=Yr.ReactCurrentOwner,Xn=!1;function Dn(e,t,n,s){t.child=e===null?A2(t,null,n,s):sl(t,e.child,n,s)}function mb(e,t,n,s,r){n=n.render;var i=t.ref;return Ia(t,r),s=Ly(e,t,n,s,i,r),n=Ay(),e!==null&&!Xn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,qr(e,t,r)):(ot&&n&&wy(t),t.flags|=1,Dn(e,t,s,r),t.child)}function gb(e,t,n,s,r){if(e===null){var i=n.type;return typeof i=="function"&&!qy(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,aN(e,t,i,s,r)):(e=mh(n.type,null,s,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&r)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:Xc,n(o,s)&&e.ref===t.ref)return qr(e,t,r)}return t.flags|=1,e=Bi(i,s),e.ref=t.ref,e.return=t,t.child=e}function aN(e,t,n,s,r){if(e!==null){var i=e.memoizedProps;if(Xc(i,s)&&e.ref===t.ref)if(Xn=!1,t.pendingProps=s=i,(e.lanes&r)!==0)e.flags&131072&&(Xn=!0);else return t.lanes=e.lanes,qr(e,t,r)}return Gg(e,t,n,s,r)}function lN(e,t,n){var s=t.pendingProps,r=s.children,i=e!==null?e.memoizedState:null;if(s.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},et(Ta,os),os|=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,et(Ta,os),os|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=i!==null?i.baseLanes:n,et(Ta,os),os|=s}else i!==null?(s=i.baseLanes|n,t.memoizedState=null):s=n,et(Ta,os),os|=s;return Dn(e,t,r,n),t.child}function cN(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Gg(e,t,n,s,r){var i=Jn(n)?Io:Cn.current;return i=tl(t,i),Ia(t,r),n=Ly(e,t,n,s,i,r),s=Ay(),e!==null&&!Xn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,qr(e,t,r)):(ot&&s&&wy(t),t.flags|=1,Dn(e,t,n,r),t.child)}function xb(e,t,n,s,r){if(Jn(n)){var i=!0;Vh(t)}else i=!1;if(Ia(t,r),t.stateNode===null)hh(e,t),rN(t,n,s),Xg(t,n,s,r),s=!0;else if(e===null){var o=t.stateNode,a=t.memoizedProps;o.props=a;var c=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=Ts(u):(u=Jn(n)?Io:Cn.current,u=tl(t,u));var d=n.getDerivedStateFromProps,h=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==s||c!==u)&&db(t,o,s,u),ci=!1;var p=t.memoizedState;o.state=p,Jh(t,s,o,r),c=t.memoizedState,a!==s||p!==c||Gn.current||ci?(typeof d=="function"&&(Yg(t,n,d,s),c=t.memoizedState),(a=ci||ub(t,n,a,s,p,c,u))?(h||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=s,t.memoizedState=c),o.props=s,o.state=c,o.context=u,s=a):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{o=t.stateNode,I2(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:Os(t.type,a),o.props=u,h=t.pendingProps,p=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=Ts(c):(c=Jn(n)?Io:Cn.current,c=tl(t,c));var f=n.getDerivedStateFromProps;(d=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==h||p!==c)&&db(t,o,s,c),ci=!1,p=t.memoizedState,o.state=p,Jh(t,s,o,r);var m=t.memoizedState;a!==h||p!==m||Gn.current||ci?(typeof f=="function"&&(Yg(t,n,f,s),m=t.memoizedState),(u=ci||ub(t,n,u,s,p,m,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(s,m,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(s,m,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=m),o.props=s,o.state=m,o.context=c,s=u):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),s=!1)}return Jg(e,t,n,s,i,r)}function Jg(e,t,n,s,r,i){cN(e,t);var o=(t.flags&128)!==0;if(!s&&!o)return r&&nb(t,n,!1),qr(e,t,i);s=t.stateNode,DR.current=t;var a=o&&typeof n.getDerivedStateFromError!="function"?null:s.render();return t.flags|=1,e!==null&&o?(t.child=sl(t,e.child,null,i),t.child=sl(t,null,a,i)):Dn(e,t,a,i),t.memoizedState=s.state,r&&nb(t,n,!0),t.child}function uN(e){var t=e.stateNode;t.pendingContext?tb(e,t.pendingContext,t.pendingContext!==t.context):t.context&&tb(e,t.context,!1),Ty(e,t.containerInfo)}function vb(e,t,n,s,r){return nl(),ky(r),t.flags|=256,Dn(e,t,n,s),t.child}var Zg={dehydrated:null,treeContext:null,retryLane:0};function ex(e){return{baseLanes:e,cachePool:null,transitions:null}}function dN(e,t,n){var s=t.pendingProps,r=ut.current,i=!1,o=(t.flags&128)!==0,a;if((a=o)||(a=e!==null&&e.memoizedState===null?!1:(r&2)!==0),a?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(r|=1),et(ut,r&1),e===null)return Kg(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=s.children,e=s.fallback,i?(s=t.mode,i=t.child,o={mode:"hidden",children:o},!(s&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=Xf(o,s,0,null),e=Mo(e,s,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=ex(n),t.memoizedState=Zg,e):Fy(t,o));if(r=e.memoizedState,r!==null&&(a=r.dehydrated,a!==null))return MR(e,t,o,s,a,r,n);if(i){i=s.fallback,o=t.mode,r=e.child,a=r.sibling;var c={mode:"hidden",children:s.children};return!(o&1)&&t.child!==r?(s=t.child,s.childLanes=0,s.pendingProps=c,t.deletions=null):(s=Bi(r,c),s.subtreeFlags=r.subtreeFlags&14680064),a!==null?i=Bi(a,i):(i=Mo(i,o,n,null),i.flags|=2),i.return=t,s.return=t,s.sibling=i,t.child=s,s=i,i=t.child,o=e.child.memoizedState,o=o===null?ex(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=Zg,s}return i=e.child,e=i.sibling,s=Bi(i,{mode:"visible",children:s.children}),!(t.mode&1)&&(s.lanes=n),s.return=t,s.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=s,t.memoizedState=null,s}function Fy(e,t){return t=Xf({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function ud(e,t,n,s){return s!==null&&ky(s),sl(t,e.child,null,n),e=Fy(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function MR(e,t,n,s,r,i,o){if(n)return t.flags&256?(t.flags&=-257,s=nm(Error(te(422))),ud(e,t,o,s)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=s.fallback,r=t.mode,s=Xf({mode:"visible",children:s.children},r,0,null),i=Mo(i,r,o,null),i.flags|=2,s.return=t,i.return=t,s.sibling=i,t.child=s,t.mode&1&&sl(t,e.child,null,o),t.child.memoizedState=ex(o),t.memoizedState=Zg,i);if(!(t.mode&1))return ud(e,t,o,null);if(r.data==="$!"){if(s=r.nextSibling&&r.nextSibling.dataset,s)var a=s.dgst;return s=a,i=Error(te(419)),s=nm(i,s,void 0),ud(e,t,o,s)}if(a=(o&e.childLanes)!==0,Xn||a){if(s=tn,s!==null){switch(o&-o){case 4:r=2;break;case 16:r=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:r=32;break;case 536870912:r=268435456;break;default:r=0}r=r&(s.suspendedLanes|o)?0:r,r!==0&&r!==i.retryLane&&(i.retryLane=r,Ur(e,r),Ws(s,e,r,-1))}return Uy(),s=nm(Error(te(421))),ud(e,t,o,s)}return r.data==="$?"?(t.flags|=128,t.child=e.child,t=KR.bind(null,e),r._reactRetry=t,null):(e=i.treeContext,as=Ai(r.nextSibling),ls=t,ot=!0,$s=null,e!==null&&(ws[Ss++]=Or,ws[Ss++]=Ir,ws[Ss++]=Fo,Or=e.id,Ir=e.overflow,Fo=t),t=Fy(t,s.children),t.flags|=4096,t)}function yb(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Vg(e.return,t,n)}function sm(e,t,n,s,r){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:r}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=s,i.tail=n,i.tailMode=r)}function hN(e,t,n){var s=t.pendingProps,r=s.revealOrder,i=s.tail;if(Dn(e,t,s.children,n),s=ut.current,s&2)s=s&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&&yb(e,n,t);else if(e.tag===19)yb(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}s&=1}if(et(ut,s),!(t.mode&1))t.memoizedState=null;else switch(r){case"forwards":for(n=t.child,r=null;n!==null;)e=n.alternate,e!==null&&Zh(e)===null&&(r=n),n=n.sibling;n=r,n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),sm(t,!1,r,n,i);break;case"backwards":for(n=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&Zh(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}sm(t,!0,n,null,i);break;case"together":sm(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function hh(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function qr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),zo|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(te(153));if(t.child!==null){for(e=t.child,n=Bi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Bi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function LR(e,t,n){switch(t.tag){case 3:uN(t),nl();break;case 5:F2(t);break;case 1:Jn(t.type)&&Vh(t);break;case 4:Ty(t,t.stateNode.containerInfo);break;case 10:var s=t.type._context,r=t.memoizedProps.value;et(Qh,s._currentValue),s._currentValue=r;break;case 13:if(s=t.memoizedState,s!==null)return s.dehydrated!==null?(et(ut,ut.current&1),t.flags|=128,null):n&t.child.childLanes?dN(e,t,n):(et(ut,ut.current&1),e=qr(e,t,n),e!==null?e.sibling:null);et(ut,ut.current&1);break;case 19:if(s=(n&t.childLanes)!==0,e.flags&128){if(s)return hN(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),et(ut,ut.current),s)break;return null;case 22:case 23:return t.lanes=0,lN(e,t,n)}return qr(e,t,n)}var fN,tx,pN,mN;fN=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}};tx=function(){};pN=function(e,t,n,s){var r=e.memoizedProps;if(r!==s){e=t.stateNode,vo(dr.current);var i=null;switch(n){case"input":r=Sg(e,r),s=Sg(e,s),i=[];break;case"select":r=ht({},r,{value:void 0}),s=ht({},s,{value:void 0}),i=[];break;case"textarea":r=Ng(e,r),s=Ng(e,s),i=[];break;default:typeof r.onClick!="function"&&typeof s.onClick=="function"&&(e.onclick=qh)}Eg(n,s);var o;n=null;for(u in r)if(!s.hasOwnProperty(u)&&r.hasOwnProperty(u)&&r[u]!=null)if(u==="style"){var a=r[u];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Hc.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in s){var c=s[u];if(a=r!=null?r[u]:void 0,s.hasOwnProperty(u)&&c!==a&&(c!=null||a!=null))if(u==="style")if(a){for(o in a)!a.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&a[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,a=a?a.__html:void 0,c!=null&&a!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Hc.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&nt("scroll",e),i||a===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};mN=function(e,t,n,s){n!==s&&(t.flags|=4)};function zl(e,t){if(!ot)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 s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function xn(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var r=e.child;r!==null;)n|=r.lanes|r.childLanes,s|=r.subtreeFlags&14680064,s|=r.flags&14680064,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)n|=r.lanes|r.childLanes,s|=r.subtreeFlags,s|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function AR(e,t,n){var s=t.pendingProps;switch(Sy(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return xn(t),null;case 1:return Jn(t.type)&&Kh(),xn(t),null;case 3:return s=t.stateNode,rl(),rt(Gn),rt(Cn),Dy(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(ld(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,$s!==null&&(cx($s),$s=null))),tx(e,t),xn(t),null;case 5:Ry(t);var r=vo(eu.current);if(n=t.type,e!==null&&t.stateNode!=null)pN(e,t,n,s,r),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!s){if(t.stateNode===null)throw Error(te(166));return xn(t),null}if(e=vo(dr.current),ld(t)){s=t.stateNode,n=t.type;var i=t.memoizedProps;switch(s[ar]=t,s[Jc]=i,e=(t.mode&1)!==0,n){case"dialog":nt("cancel",s),nt("close",s);break;case"iframe":case"object":case"embed":nt("load",s);break;case"video":case"audio":for(r=0;r<lc.length;r++)nt(lc[r],s);break;case"source":nt("error",s);break;case"img":case"image":case"link":nt("error",s),nt("load",s);break;case"details":nt("toggle",s);break;case"input":E_(s,i),nt("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!i.multiple},nt("invalid",s);break;case"textarea":T_(s,i),nt("invalid",s)}Eg(n,i),r=null;for(var o in i)if(i.hasOwnProperty(o)){var a=i[o];o==="children"?typeof a=="string"?s.textContent!==a&&(i.suppressHydrationWarning!==!0&&ad(s.textContent,a,e),r=["children",a]):typeof a=="number"&&s.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&ad(s.textContent,a,e),r=["children",""+a]):Hc.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&nt("scroll",s)}switch(n){case"input":Zu(s),P_(s,i,!0);break;case"textarea":Zu(s),R_(s);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(s.onclick=qh)}s=r,t.updateQueue=s,s!==null&&(t.flags|=4)}else{o=r.nodeType===9?r:r.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=WC(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=o.createElement(n,{is:s.is}):(e=o.createElement(n),n==="select"&&(o=e,s.multiple?o.multiple=!0:s.size&&(o.size=s.size))):e=o.createElementNS(e,n),e[ar]=t,e[Jc]=s,fN(e,t,!1,!1),t.stateNode=e;e:{switch(o=Pg(n,s),n){case"dialog":nt("cancel",e),nt("close",e),r=s;break;case"iframe":case"object":case"embed":nt("load",e),r=s;break;case"video":case"audio":for(r=0;r<lc.length;r++)nt(lc[r],e);r=s;break;case"source":nt("error",e),r=s;break;case"img":case"image":case"link":nt("error",e),nt("load",e),r=s;break;case"details":nt("toggle",e),r=s;break;case"input":E_(e,s),r=Sg(e,s),nt("invalid",e);break;case"option":r=s;break;case"select":e._wrapperState={wasMultiple:!!s.multiple},r=ht({},s,{value:void 0}),nt("invalid",e);break;case"textarea":T_(e,s),r=Ng(e,s),nt("invalid",e);break;default:r=s}Eg(n,r),a=r;for(i in a)if(a.hasOwnProperty(i)){var c=a[i];i==="style"?KC(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&UC(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Wc(e,c):typeof c=="number"&&Wc(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Hc.hasOwnProperty(i)?c!=null&&i==="onScroll"&&nt("scroll",e):c!=null&&ly(e,i,c,o))}switch(n){case"input":Zu(e),P_(e,s,!1);break;case"textarea":Zu(e),R_(e);break;case"option":s.value!=null&&e.setAttribute("value",""+qi(s.value));break;case"select":e.multiple=!!s.multiple,i=s.value,i!=null?Ma(e,!!s.multiple,i,!1):s.defaultValue!=null&&Ma(e,!!s.multiple,s.defaultValue,!0);break;default:typeof r.onClick=="function"&&(e.onclick=qh)}switch(n){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}}s&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return xn(t),null;case 6:if(e&&t.stateNode!=null)mN(e,t,e.memoizedProps,s);else{if(typeof s!="string"&&t.stateNode===null)throw Error(te(166));if(n=vo(eu.current),vo(dr.current),ld(t)){if(s=t.stateNode,n=t.memoizedProps,s[ar]=t,(i=s.nodeValue!==n)&&(e=ls,e!==null))switch(e.tag){case 3:ad(s.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&ad(s.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else s=(n.nodeType===9?n:n.ownerDocument).createTextNode(s),s[ar]=t,t.stateNode=s}return xn(t),null;case 13:if(rt(ut),s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ot&&as!==null&&t.mode&1&&!(t.flags&128))M2(),nl(),t.flags|=98560,i=!1;else if(i=ld(t),s!==null&&s.dehydrated!==null){if(e===null){if(!i)throw Error(te(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(te(317));i[ar]=t}else nl(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;xn(t),i=!1}else $s!==null&&(cx($s),$s=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(s=s!==null,s!==(e!==null&&e.memoizedState!==null)&&s&&(t.child.flags|=8192,t.mode&1&&(e===null||ut.current&1?Ht===0&&(Ht=3):Uy())),t.updateQueue!==null&&(t.flags|=4),xn(t),null);case 4:return rl(),tx(e,t),e===null&&Qc(t.stateNode.containerInfo),xn(t),null;case 10:return jy(t.type._context),xn(t),null;case 17:return Jn(t.type)&&Kh(),xn(t),null;case 19:if(rt(ut),i=t.memoizedState,i===null)return xn(t),null;if(s=(t.flags&128)!==0,o=i.rendering,o===null)if(s)zl(i,!1);else{if(Ht!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Zh(e),o!==null){for(t.flags|=128,zl(i,!1),s=o.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),t.subtreeFlags=0,s=n,n=t.child;n!==null;)i=n,e=s,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 et(ut,ut.current&1|2),t.child}e=e.sibling}i.tail!==null&&Ct()>ol&&(t.flags|=128,s=!0,zl(i,!1),t.lanes=4194304)}else{if(!s)if(e=Zh(o),e!==null){if(t.flags|=128,s=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),zl(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!ot)return xn(t),null}else 2*Ct()-i.renderingStartTime>ol&&n!==1073741824&&(t.flags|=128,s=!0,zl(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=ut.current,et(ut,s?n&1|2:n&1),t):(xn(t),null);case 22:case 23:return Wy(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&t.mode&1?os&1073741824&&(xn(t),t.subtreeFlags&6&&(t.flags|=8192)):xn(t),null;case 24:return null;case 25:return null}throw Error(te(156,t.tag))}function OR(e,t){switch(Sy(t),t.tag){case 1:return Jn(t.type)&&Kh(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return rl(),rt(Gn),rt(Cn),Dy(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ry(t),null;case 13:if(rt(ut),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(te(340));nl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return rt(ut),null;case 4:return rl(),null;case 10:return jy(t.type._context),null;case 22:case 23:return Wy(),null;case 24:return null;default:return null}}var dd=!1,wn=!1,IR=typeof WeakSet=="function"?WeakSet:Set,ce=null;function Pa(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){xt(e,t,s)}else n.current=null}function nx(e,t,n){try{n()}catch(s){xt(e,t,s)}}var _b=!1;function FR(e,t){if(Bg=Hh,e=_2(),by(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var r=s.anchorOffset,i=s.focusNode;s=s.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,c=-1,u=0,d=0,h=e,p=null;t:for(;;){for(var f;h!==n||r!==0&&h.nodeType!==3||(a=o+r),h!==i||s!==0&&h.nodeType!==3||(c=o+s),h.nodeType===3&&(o+=h.nodeValue.length),(f=h.firstChild)!==null;)p=h,h=f;for(;;){if(h===e)break t;if(p===n&&++u===r&&(a=o),p===i&&++d===s&&(c=o),(f=h.nextSibling)!==null)break;h=p,p=h.parentNode}h=f}n=a===-1||c===-1?null:{start:a,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(zg={focusedElem:e,selectionRange:n},Hh=!1,ce=t;ce!==null;)if(t=ce,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ce=e;else for(;ce!==null;){t=ce;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,v=m.memoizedState,x=t.stateNode,_=x.getSnapshotBeforeUpdate(t.elementType===t.type?g:Os(t.type,g),v);x.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(te(163))}}catch(S){xt(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,ce=e;break}ce=t.return}return m=_b,_b=!1,m}function Cc(e,t,n){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var r=s=s.next;do{if((r.tag&e)===e){var i=r.destroy;r.destroy=void 0,i!==void 0&&nx(t,n,i)}r=r.next}while(r!==s)}}function Vf(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 s=n.create;n.destroy=s()}n=n.next}while(n!==t)}}function sx(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 gN(e){var t=e.alternate;t!==null&&(e.alternate=null,gN(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ar],delete t[Jc],delete t[Wg],delete t[_R],delete t[bR])),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 xN(e){return e.tag===5||e.tag===3||e.tag===4}function bb(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||xN(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 rx(e,t,n){var s=e.tag;if(s===5||s===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=qh));else if(s!==4&&(e=e.child,e!==null))for(rx(e,t,n),e=e.sibling;e!==null;)rx(e,t,n),e=e.sibling}function ix(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(ix(e,t,n),e=e.sibling;e!==null;)ix(e,t,n),e=e.sibling}var ln=null,Bs=!1;function Zr(e,t,n){for(n=n.child;n!==null;)vN(e,t,n),n=n.sibling}function vN(e,t,n){if(ur&&typeof ur.onCommitFiberUnmount=="function")try{ur.onCommitFiberUnmount(Bf,n)}catch{}switch(n.tag){case 5:wn||Pa(n,t);case 6:var s=ln,r=Bs;ln=null,Zr(e,t,n),ln=s,Bs=r,ln!==null&&(Bs?(e=ln,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ln.removeChild(n.stateNode));break;case 18:ln!==null&&(Bs?(e=ln,n=n.stateNode,e.nodeType===8?Qp(e.parentNode,n):e.nodeType===1&&Qp(e,n),Vc(e)):Qp(ln,n.stateNode));break;case 4:s=ln,r=Bs,ln=n.stateNode.containerInfo,Bs=!0,Zr(e,t,n),ln=s,Bs=r;break;case 0:case 11:case 14:case 15:if(!wn&&(s=n.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){r=s=s.next;do{var i=r,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&nx(n,t,o),r=r.next}while(r!==s)}Zr(e,t,n);break;case 1:if(!wn&&(Pa(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(a){xt(n,t,a)}Zr(e,t,n);break;case 21:Zr(e,t,n);break;case 22:n.mode&1?(wn=(s=wn)||n.memoizedState!==null,Zr(e,t,n),wn=s):Zr(e,t,n);break;default:Zr(e,t,n)}}function wb(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new IR),t.forEach(function(s){var r=VR.bind(null,e,s);n.has(s)||(n.add(s),s.then(r,r))})}}function Ds(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var r=n[s];try{var i=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 5:ln=a.stateNode,Bs=!1;break e;case 3:ln=a.stateNode.containerInfo,Bs=!0;break e;case 4:ln=a.stateNode.containerInfo,Bs=!0;break e}a=a.return}if(ln===null)throw Error(te(160));vN(i,o,r),ln=null,Bs=!1;var c=r.alternate;c!==null&&(c.return=null),r.return=null}catch(u){xt(r,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)yN(t,e),t=t.sibling}function yN(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ds(t,e),Ys(e),s&4){try{Cc(3,e,e.return),Vf(3,e)}catch(g){xt(e,e.return,g)}try{Cc(5,e,e.return)}catch(g){xt(e,e.return,g)}}break;case 1:Ds(t,e),Ys(e),s&512&&n!==null&&Pa(n,n.return);break;case 5:if(Ds(t,e),Ys(e),s&512&&n!==null&&Pa(n,n.return),e.flags&32){var r=e.stateNode;try{Wc(r,"")}catch(g){xt(e,e.return,g)}}if(s&4&&(r=e.stateNode,r!=null)){var i=e.memoizedProps,o=n!==null?n.memoizedProps:i,a=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&$C(r,i),Pg(a,o);var u=Pg(a,i);for(o=0;o<c.length;o+=2){var d=c[o],h=c[o+1];d==="style"?KC(r,h):d==="dangerouslySetInnerHTML"?UC(r,h):d==="children"?Wc(r,h):ly(r,d,h,u)}switch(a){case"input":kg(r,i);break;case"textarea":HC(r,i);break;case"select":var p=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!i.multiple;var f=i.value;f!=null?Ma(r,!!i.multiple,f,!1):p!==!!i.multiple&&(i.defaultValue!=null?Ma(r,!!i.multiple,i.defaultValue,!0):Ma(r,!!i.multiple,i.multiple?[]:"",!1))}r[Jc]=i}catch(g){xt(e,e.return,g)}}break;case 6:if(Ds(t,e),Ys(e),s&4){if(e.stateNode===null)throw Error(te(162));r=e.stateNode,i=e.memoizedProps;try{r.nodeValue=i}catch(g){xt(e,e.return,g)}}break;case 3:if(Ds(t,e),Ys(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{Vc(t.containerInfo)}catch(g){xt(e,e.return,g)}break;case 4:Ds(t,e),Ys(e);break;case 13:Ds(t,e),Ys(e),r=e.child,r.flags&8192&&(i=r.memoizedState!==null,r.stateNode.isHidden=i,!i||r.alternate!==null&&r.alternate.memoizedState!==null||($y=Ct())),s&4&&wb(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(wn=(u=wn)||d,Ds(t,e),wn=u):Ds(t,e),Ys(e),s&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(ce=e,d=e.child;d!==null;){for(h=ce=d;ce!==null;){switch(p=ce,f=p.child,p.tag){case 0:case 11:case 14:case 15:Cc(4,p,p.return);break;case 1:Pa(p,p.return);var m=p.stateNode;if(typeof m.componentWillUnmount=="function"){s=p,n=p.return;try{t=s,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(g){xt(s,n,g)}}break;case 5:Pa(p,p.return);break;case 22:if(p.memoizedState!==null){kb(h);continue}}f!==null?(f.return=p,ce=f):kb(h)}d=d.sibling}e:for(d=null,h=e;;){if(h.tag===5){if(d===null){d=h;try{r=h.stateNode,u?(i=r.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=h.stateNode,c=h.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,a.style.display=qC("display",o))}catch(g){xt(e,e.return,g)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(g){xt(e,e.return,g)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===e)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===e)break e;for(;h.sibling===null;){if(h.return===null||h.return===e)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:Ds(t,e),Ys(e),s&4&&wb(e);break;case 21:break;default:Ds(t,e),Ys(e)}}function Ys(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(xN(n)){var s=n;break e}n=n.return}throw Error(te(160))}switch(s.tag){case 5:var r=s.stateNode;s.flags&32&&(Wc(r,""),s.flags&=-33);var i=bb(e);ix(e,i,r);break;case 3:case 4:var o=s.stateNode.containerInfo,a=bb(e);rx(e,a,o);break;default:throw Error(te(161))}}catch(c){xt(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function BR(e,t,n){ce=e,_N(e)}function _N(e,t,n){for(var s=(e.mode&1)!==0;ce!==null;){var r=ce,i=r.child;if(r.tag===22&&s){var o=r.memoizedState!==null||dd;if(!o){var a=r.alternate,c=a!==null&&a.memoizedState!==null||wn;a=dd;var u=wn;if(dd=o,(wn=c)&&!u)for(ce=r;ce!==null;)o=ce,c=o.child,o.tag===22&&o.memoizedState!==null?Cb(r):c!==null?(c.return=o,ce=c):Cb(r);for(;i!==null;)ce=i,_N(i),i=i.sibling;ce=r,dd=a,wn=u}Sb(e)}else r.subtreeFlags&8772&&i!==null?(i.return=r,ce=i):Sb(e)}}function Sb(e){for(;ce!==null;){var t=ce;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:wn||Vf(5,t);break;case 1:var s=t.stateNode;if(t.flags&4&&!wn)if(n===null)s.componentDidMount();else{var r=t.elementType===t.type?n.memoizedProps:Os(t.type,n.memoizedProps);s.componentDidUpdate(r,n.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&ab(t,i,s);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}ab(t,o,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;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 d=u.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&Vc(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(te(163))}wn||t.flags&512&&sx(t)}catch(p){xt(t,t.return,p)}}if(t===e){ce=null;break}if(n=t.sibling,n!==null){n.return=t.return,ce=n;break}ce=t.return}}function kb(e){for(;ce!==null;){var t=ce;if(t===e){ce=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ce=n;break}ce=t.return}}function Cb(e){for(;ce!==null;){var t=ce;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Vf(4,t)}catch(c){xt(t,n,c)}break;case 1:var s=t.stateNode;if(typeof s.componentDidMount=="function"){var r=t.return;try{s.componentDidMount()}catch(c){xt(t,r,c)}}var i=t.return;try{sx(t)}catch(c){xt(t,i,c)}break;case 5:var o=t.return;try{sx(t)}catch(c){xt(t,o,c)}}}catch(c){xt(t,t.return,c)}if(t===e){ce=null;break}var a=t.sibling;if(a!==null){a.return=t.return,ce=a;break}ce=t.return}}var zR=Math.ceil,nf=Yr.ReactCurrentDispatcher,By=Yr.ReactCurrentOwner,Es=Yr.ReactCurrentBatchConfig,ze=0,tn=null,Rt=null,hn=0,os=0,Ta=Gi(0),Ht=0,ru=null,zo=0,Yf=0,zy=0,Nc=null,Vn=null,$y=0,ol=1/0,jr=null,sf=!1,ox=null,Ii=null,hd=!1,Ci=null,rf=0,jc=0,ax=null,fh=-1,ph=0;function An(){return ze&6?Ct():fh!==-1?fh:fh=Ct()}function Fi(e){return e.mode&1?ze&2&&hn!==0?hn&-hn:SR.transition!==null?(ph===0&&(ph=r2()),ph):(e=Ke,e!==0||(e=window.event,e=e===void 0?16:d2(e.type)),e):1}function Ws(e,t,n,s){if(50<jc)throw jc=0,ax=null,Error(te(185));Pu(e,n,s),(!(ze&2)||e!==tn)&&(e===tn&&(!(ze&2)&&(Yf|=n),Ht===4&&fi(e,hn)),Zn(e,s),n===1&&ze===0&&!(t.mode&1)&&(ol=Ct()+500,Uf&&Ji()))}function Zn(e,t){var n=e.callbackNode;ST(e,t);var s=$h(e,e===tn?hn:0);if(s===0)n!==null&&L_(n),e.callbackNode=null,e.callbackPriority=0;else if(t=s&-s,e.callbackPriority!==t){if(n!=null&&L_(n),t===1)e.tag===0?wR(Nb.bind(null,e)):T2(Nb.bind(null,e)),vR(function(){!(ze&6)&&Ji()}),n=null;else{switch(i2(s)){case 1:n=fy;break;case 4:n=n2;break;case 16:n=zh;break;case 536870912:n=s2;break;default:n=zh}n=EN(n,bN.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function bN(e,t){if(fh=-1,ph=0,ze&6)throw Error(te(327));var n=e.callbackNode;if(Fa()&&e.callbackNode!==n)return null;var s=$h(e,e===tn?hn:0);if(s===0)return null;if(s&30||s&e.expiredLanes||t)t=of(e,s);else{t=s;var r=ze;ze|=2;var i=SN();(tn!==e||hn!==t)&&(jr=null,ol=Ct()+500,Do(e,t));do try{WR();break}catch(a){wN(e,a)}while(!0);Ny(),nf.current=i,ze=r,Rt!==null?t=0:(tn=null,hn=0,t=Ht)}if(t!==0){if(t===2&&(r=Lg(e),r!==0&&(s=r,t=lx(e,r))),t===1)throw n=ru,Do(e,0),fi(e,s),Zn(e,Ct()),n;if(t===6)fi(e,s);else{if(r=e.current.alternate,!(s&30)&&!$R(r)&&(t=of(e,s),t===2&&(i=Lg(e),i!==0&&(s=i,t=lx(e,i))),t===1))throw n=ru,Do(e,0),fi(e,s),Zn(e,Ct()),n;switch(e.finishedWork=r,e.finishedLanes=s,t){case 0:case 1:throw Error(te(345));case 2:lo(e,Vn,jr);break;case 3:if(fi(e,s),(s&130023424)===s&&(t=$y+500-Ct(),10<t)){if($h(e,0)!==0)break;if(r=e.suspendedLanes,(r&s)!==s){An(),e.pingedLanes|=e.suspendedLanes&r;break}e.timeoutHandle=Hg(lo.bind(null,e,Vn,jr),t);break}lo(e,Vn,jr);break;case 4:if(fi(e,s),(s&4194240)===s)break;for(t=e.eventTimes,r=-1;0<s;){var o=31-Hs(s);i=1<<o,o=t[o],o>r&&(r=o),s&=~i}if(s=r,s=Ct()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*zR(s/1960))-s,10<s){e.timeoutHandle=Hg(lo.bind(null,e,Vn,jr),s);break}lo(e,Vn,jr);break;case 5:lo(e,Vn,jr);break;default:throw Error(te(329))}}}return Zn(e,Ct()),e.callbackNode===n?bN.bind(null,e):null}function lx(e,t){var n=Nc;return e.current.memoizedState.isDehydrated&&(Do(e,t).flags|=256),e=of(e,t),e!==2&&(t=Vn,Vn=n,t!==null&&cx(t)),e}function cx(e){Vn===null?Vn=e:Vn.push.apply(Vn,e)}function $R(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var s=0;s<n.length;s++){var r=n[s],i=r.getSnapshot;r=r.value;try{if(!qs(i(),r))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 fi(e,t){for(t&=~zy,t&=~Yf,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Hs(t),s=1<<n;e[n]=-1,t&=~s}}function Nb(e){if(ze&6)throw Error(te(327));Fa();var t=$h(e,0);if(!(t&1))return Zn(e,Ct()),null;var n=of(e,t);if(e.tag!==0&&n===2){var s=Lg(e);s!==0&&(t=s,n=lx(e,s))}if(n===1)throw n=ru,Do(e,0),fi(e,t),Zn(e,Ct()),n;if(n===6)throw Error(te(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,lo(e,Vn,jr),Zn(e,Ct()),null}function Hy(e,t){var n=ze;ze|=1;try{return e(t)}finally{ze=n,ze===0&&(ol=Ct()+500,Uf&&Ji())}}function $o(e){Ci!==null&&Ci.tag===0&&!(ze&6)&&Fa();var t=ze;ze|=1;var n=Es.transition,s=Ke;try{if(Es.transition=null,Ke=1,e)return e()}finally{Ke=s,Es.transition=n,ze=t,!(ze&6)&&Ji()}}function Wy(){os=Ta.current,rt(Ta)}function Do(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,xR(n)),Rt!==null)for(n=Rt.return;n!==null;){var s=n;switch(Sy(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&Kh();break;case 3:rl(),rt(Gn),rt(Cn),Dy();break;case 5:Ry(s);break;case 4:rl();break;case 13:rt(ut);break;case 19:rt(ut);break;case 10:jy(s.type._context);break;case 22:case 23:Wy()}n=n.return}if(tn=e,Rt=e=Bi(e.current,null),hn=os=t,Ht=0,ru=null,zy=Yf=zo=0,Vn=Nc=null,xo!==null){for(t=0;t<xo.length;t++)if(n=xo[t],s=n.interleaved,s!==null){n.interleaved=null;var r=s.next,i=n.pending;if(i!==null){var o=i.next;i.next=r,s.next=o}n.pending=s}xo=null}return e}function wN(e,t){do{var n=Rt;try{if(Ny(),uh.current=tf,ef){for(var s=dt.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}ef=!1}if(Bo=0,Qt=Ft=dt=null,kc=!1,tu=0,By.current=null,n===null||n.return===null){Ht=1,ru=t,Rt=null;break}e:{var i=e,o=n.return,a=n,c=t;if(t=hn,a.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=a,h=d.tag;if(!(d.mode&1)&&(h===0||h===11||h===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var f=fb(o);if(f!==null){f.flags&=-257,pb(f,o,a,i,t),f.mode&1&&hb(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)){hb(i,u,t),Uy();break e}c=Error(te(426))}}else if(ot&&a.mode&1){var v=fb(o);if(v!==null){!(v.flags&65536)&&(v.flags|=256),pb(v,o,a,i,t),ky(il(c,a));break e}}i=c=il(c,a),Ht!==4&&(Ht=2),Nc===null?Nc=[i]:Nc.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var x=iN(i,c,t);ob(i,x);break e;case 1:a=c;var _=i.type,b=i.stateNode;if(!(i.flags&128)&&(typeof _.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(Ii===null||!Ii.has(b)))){i.flags|=65536,t&=-t,i.lanes|=t;var S=oN(i,a,t);ob(i,S);break e}}i=i.return}while(i!==null)}CN(n)}catch(C){t=C,Rt===n&&n!==null&&(Rt=n=n.return);continue}break}while(!0)}function SN(){var e=nf.current;return nf.current=tf,e===null?tf:e}function Uy(){(Ht===0||Ht===3||Ht===2)&&(Ht=4),tn===null||!(zo&268435455)&&!(Yf&268435455)||fi(tn,hn)}function of(e,t){var n=ze;ze|=2;var s=SN();(tn!==e||hn!==t)&&(jr=null,Do(e,t));do try{HR();break}catch(r){wN(e,r)}while(!0);if(Ny(),ze=n,nf.current=s,Rt!==null)throw Error(te(261));return tn=null,hn=0,Ht}function HR(){for(;Rt!==null;)kN(Rt)}function WR(){for(;Rt!==null&&!pT();)kN(Rt)}function kN(e){var t=jN(e.alternate,e,os);e.memoizedProps=e.pendingProps,t===null?CN(e):Rt=t,By.current=null}function CN(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=OR(n,t),n!==null){n.flags&=32767,Rt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ht=6,Rt=null;return}}else if(n=AR(n,t,os),n!==null){Rt=n;return}if(t=t.sibling,t!==null){Rt=t;return}Rt=t=e}while(t!==null);Ht===0&&(Ht=5)}function lo(e,t,n){var s=Ke,r=Es.transition;try{Es.transition=null,Ke=1,UR(e,t,n,s)}finally{Es.transition=r,Ke=s}return null}function UR(e,t,n,s){do Fa();while(Ci!==null);if(ze&6)throw Error(te(327));n=e.finishedWork;var r=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(te(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(kT(e,i),e===tn&&(Rt=tn=null,hn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||hd||(hd=!0,EN(zh,function(){return Fa(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Es.transition,Es.transition=null;var o=Ke;Ke=1;var a=ze;ze|=4,By.current=null,FR(e,n),yN(n,e),uR(zg),Hh=!!Bg,zg=Bg=null,e.current=n,BR(n),mT(),ze=a,Ke=o,Es.transition=i}else e.current=n;if(hd&&(hd=!1,Ci=e,rf=r),i=e.pendingLanes,i===0&&(Ii=null),vT(n.stateNode),Zn(e,Ct()),t!==null)for(s=e.onRecoverableError,n=0;n<t.length;n++)r=t[n],s(r.value,{componentStack:r.stack,digest:r.digest});if(sf)throw sf=!1,e=ox,ox=null,e;return rf&1&&e.tag!==0&&Fa(),i=e.pendingLanes,i&1?e===ax?jc++:(jc=0,ax=e):jc=0,Ji(),null}function Fa(){if(Ci!==null){var e=i2(rf),t=Es.transition,n=Ke;try{if(Es.transition=null,Ke=16>e?16:e,Ci===null)var s=!1;else{if(e=Ci,Ci=null,rf=0,ze&6)throw Error(te(331));var r=ze;for(ze|=4,ce=e.current;ce!==null;){var i=ce,o=i.child;if(ce.flags&16){var a=i.deletions;if(a!==null){for(var c=0;c<a.length;c++){var u=a[c];for(ce=u;ce!==null;){var d=ce;switch(d.tag){case 0:case 11:case 15:Cc(8,d,i)}var h=d.child;if(h!==null)h.return=d,ce=h;else for(;ce!==null;){d=ce;var p=d.sibling,f=d.return;if(gN(d),d===u){ce=null;break}if(p!==null){p.return=f,ce=p;break}ce=f}}}var m=i.alternate;if(m!==null){var g=m.child;if(g!==null){m.child=null;do{var v=g.sibling;g.sibling=null,g=v}while(g!==null)}}ce=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,ce=o;else e:for(;ce!==null;){if(i=ce,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Cc(9,i,i.return)}var x=i.sibling;if(x!==null){x.return=i.return,ce=x;break e}ce=i.return}}var _=e.current;for(ce=_;ce!==null;){o=ce;var b=o.child;if(o.subtreeFlags&2064&&b!==null)b.return=o,ce=b;else e:for(o=_;ce!==null;){if(a=ce,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Vf(9,a)}}catch(C){xt(a,a.return,C)}if(a===o){ce=null;break e}var S=a.sibling;if(S!==null){S.return=a.return,ce=S;break e}ce=a.return}}if(ze=r,Ji(),ur&&typeof ur.onPostCommitFiberRoot=="function")try{ur.onPostCommitFiberRoot(Bf,e)}catch{}s=!0}return s}finally{Ke=n,Es.transition=t}}return!1}function jb(e,t,n){t=il(n,t),t=iN(e,t,1),e=Oi(e,t,1),t=An(),e!==null&&(Pu(e,1,t),Zn(e,t))}function xt(e,t,n){if(e.tag===3)jb(e,e,n);else for(;t!==null;){if(t.tag===3){jb(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Ii===null||!Ii.has(s))){e=il(n,e),e=oN(t,e,1),t=Oi(t,e,1),e=An(),t!==null&&(Pu(t,1,e),Zn(t,e));break}}t=t.return}}function qR(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),t=An(),e.pingedLanes|=e.suspendedLanes&n,tn===e&&(hn&n)===n&&(Ht===4||Ht===3&&(hn&130023424)===hn&&500>Ct()-$y?Do(e,0):zy|=n),Zn(e,t)}function NN(e,t){t===0&&(e.mode&1?(t=nd,nd<<=1,!(nd&130023424)&&(nd=4194304)):t=1);var n=An();e=Ur(e,t),e!==null&&(Pu(e,t,n),Zn(e,n))}function KR(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),NN(e,n)}function VR(e,t){var n=0;switch(e.tag){case 13:var s=e.stateNode,r=e.memoizedState;r!==null&&(n=r.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(te(314))}s!==null&&s.delete(t),NN(e,n)}var jN;jN=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Gn.current)Xn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Xn=!1,LR(e,t,n);Xn=!!(e.flags&131072)}else Xn=!1,ot&&t.flags&1048576&&R2(t,Xh,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;hh(e,t),e=t.pendingProps;var r=tl(t,Cn.current);Ia(t,n),r=Ly(null,t,s,e,r,n);var i=Ay();return t.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Jn(s)?(i=!0,Vh(t)):i=!1,t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,Py(t),r.updater=Kf,t.stateNode=r,r._reactInternals=t,Xg(t,s,e,n),t=Jg(null,t,s,!0,i,n)):(t.tag=0,ot&&i&&wy(t),Dn(null,t,r,n),t=t.child),t;case 16:s=t.elementType;e:{switch(hh(e,t),e=t.pendingProps,r=s._init,s=r(s._payload),t.type=s,r=t.tag=XR(s),e=Os(s,e),r){case 0:t=Gg(null,t,s,e,n);break e;case 1:t=xb(null,t,s,e,n);break e;case 11:t=mb(null,t,s,e,n);break e;case 14:t=gb(null,t,s,Os(s.type,e),n);break e}throw Error(te(306,s,""))}return t;case 0:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:Os(s,r),Gg(e,t,s,r,n);case 1:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:Os(s,r),xb(e,t,s,r,n);case 3:e:{if(uN(t),e===null)throw Error(te(387));s=t.pendingProps,i=t.memoizedState,r=i.element,I2(e,t),Jh(t,s,null,n);var o=t.memoizedState;if(s=o.element,i.isDehydrated)if(i={element:s,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){r=il(Error(te(423)),t),t=vb(e,t,s,n,r);break e}else if(s!==r){r=il(Error(te(424)),t),t=vb(e,t,s,n,r);break e}else for(as=Ai(t.stateNode.containerInfo.firstChild),ls=t,ot=!0,$s=null,n=A2(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(nl(),s===r){t=qr(e,t,n);break e}Dn(e,t,s,n)}t=t.child}return t;case 5:return F2(t),e===null&&Kg(t),s=t.type,r=t.pendingProps,i=e!==null?e.memoizedProps:null,o=r.children,$g(s,r)?o=null:i!==null&&$g(s,i)&&(t.flags|=32),cN(e,t),Dn(e,t,o,n),t.child;case 6:return e===null&&Kg(t),null;case 13:return dN(e,t,n);case 4:return Ty(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=sl(t,null,s,n):Dn(e,t,s,n),t.child;case 11:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:Os(s,r),mb(e,t,s,r,n);case 7:return Dn(e,t,t.pendingProps,n),t.child;case 8:return Dn(e,t,t.pendingProps.children,n),t.child;case 12:return Dn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(s=t.type._context,r=t.pendingProps,i=t.memoizedProps,o=r.value,et(Qh,s._currentValue),s._currentValue=o,i!==null)if(qs(i.value,o)){if(i.children===r.children&&!Gn.current){t=qr(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var c=a.firstContext;c!==null;){if(c.context===s){if(i.tag===1){c=Br(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Vg(i.return,n,t),a.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(te(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Vg(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}Dn(e,t,r.children,n),t=t.child}return t;case 9:return r=t.type,s=t.pendingProps.children,Ia(t,n),r=Ts(r),s=s(r),t.flags|=1,Dn(e,t,s,n),t.child;case 14:return s=t.type,r=Os(s,t.pendingProps),r=Os(s.type,r),gb(e,t,s,r,n);case 15:return aN(e,t,t.type,t.pendingProps,n);case 17:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:Os(s,r),hh(e,t),t.tag=1,Jn(s)?(e=!0,Vh(t)):e=!1,Ia(t,n),rN(t,s,r),Xg(t,s,r,n),Jg(null,t,s,!0,e,n);case 19:return hN(e,t,n);case 22:return lN(e,t,n)}throw Error(te(156,t.tag))};function EN(e,t){return t2(e,t)}function YR(e,t,n,s){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=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ns(e,t,n,s){return new YR(e,t,n,s)}function qy(e){return e=e.prototype,!(!e||!e.isReactComponent)}function XR(e){if(typeof e=="function")return qy(e)?1:0;if(e!=null){if(e=e.$$typeof,e===uy)return 11;if(e===dy)return 14}return 2}function Bi(e,t){var n=e.alternate;return n===null?(n=Ns(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 mh(e,t,n,s,r,i){var o=2;if(s=e,typeof e=="function")qy(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case _a:return Mo(n.children,r,i,t);case cy:o=8,r|=8;break;case yg:return e=Ns(12,n,t,r|2),e.elementType=yg,e.lanes=i,e;case _g:return e=Ns(13,n,t,r),e.elementType=_g,e.lanes=i,e;case bg:return e=Ns(19,n,t,r),e.elementType=bg,e.lanes=i,e;case FC:return Xf(n,r,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case OC:o=10;break e;case IC:o=9;break e;case uy:o=11;break e;case dy:o=14;break e;case li:o=16,s=null;break e}throw Error(te(130,e==null?e:typeof e,""))}return t=Ns(o,n,t,r),t.elementType=e,t.type=s,t.lanes=i,t}function Mo(e,t,n,s){return e=Ns(7,e,s,t),e.lanes=n,e}function Xf(e,t,n,s){return e=Ns(22,e,s,t),e.elementType=FC,e.lanes=n,e.stateNode={isHidden:!1},e}function rm(e,t,n){return e=Ns(6,e,null,t),e.lanes=n,e}function im(e,t,n){return t=Ns(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function QR(e,t,n,s,r){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Bp(0),this.expirationTimes=Bp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bp(0),this.identifierPrefix=s,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Ky(e,t,n,s,r,i,o,a,c){return e=new QR(e,t,n,a,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ns(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Py(i),e}function GR(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ya,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}}function PN(e){if(!e)return Ki;e=e._reactInternals;e:{if(ta(e)!==e||e.tag!==1)throw Error(te(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Jn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(te(171))}if(e.tag===1){var n=e.type;if(Jn(n))return P2(e,n,t)}return t}function TN(e,t,n,s,r,i,o,a,c){return e=Ky(n,s,!0,e,r,i,o,a,c),e.context=PN(null),n=e.current,s=An(),r=Fi(n),i=Br(s,r),i.callback=t??null,Oi(n,i,r),e.current.lanes=r,Pu(e,r,s),Zn(e,s),e}function Qf(e,t,n,s){var r=t.current,i=An(),o=Fi(r);return n=PN(n),t.context===null?t.context=n:t.pendingContext=n,t=Br(i,o),t.payload={element:e},s=s===void 0?null:s,s!==null&&(t.callback=s),e=Oi(r,t,o),e!==null&&(Ws(e,r,o,i),ch(e,r,o)),o}function af(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 Eb(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Vy(e,t){Eb(e,t),(e=e.alternate)&&Eb(e,t)}function JR(){return null}var RN=typeof reportError=="function"?reportError:function(e){console.error(e)};function Yy(e){this._internalRoot=e}Gf.prototype.render=Yy.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(te(409));Qf(e,t,null,null)};Gf.prototype.unmount=Yy.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;$o(function(){Qf(null,e,null,null)}),t[Wr]=null}};function Gf(e){this._internalRoot=e}Gf.prototype.unstable_scheduleHydration=function(e){if(e){var t=l2();e={blockedOn:null,target:e,priority:t};for(var n=0;n<hi.length&&t!==0&&t<hi[n].priority;n++);hi.splice(n,0,e),n===0&&u2(e)}};function Xy(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Jf(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Pb(){}function ZR(e,t,n,s,r){if(r){if(typeof s=="function"){var i=s;s=function(){var u=af(o);i.call(u)}}var o=TN(t,s,e,0,null,!1,!1,"",Pb);return e._reactRootContainer=o,e[Wr]=o.current,Qc(e.nodeType===8?e.parentNode:e),$o(),o}for(;r=e.lastChild;)e.removeChild(r);if(typeof s=="function"){var a=s;s=function(){var u=af(c);a.call(u)}}var c=Ky(e,0,!1,null,null,!1,!1,"",Pb);return e._reactRootContainer=c,e[Wr]=c.current,Qc(e.nodeType===8?e.parentNode:e),$o(function(){Qf(t,c,n,s)}),c}function Zf(e,t,n,s,r){var i=n._reactRootContainer;if(i){var o=i;if(typeof r=="function"){var a=r;r=function(){var c=af(o);a.call(c)}}Qf(t,o,e,r)}else o=ZR(n,t,e,r,s);return af(o)}o2=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=ac(t.pendingLanes);n!==0&&(py(t,n|1),Zn(t,Ct()),!(ze&6)&&(ol=Ct()+500,Ji()))}break;case 13:$o(function(){var s=Ur(e,1);if(s!==null){var r=An();Ws(s,e,1,r)}}),Vy(e,1)}};my=function(e){if(e.tag===13){var t=Ur(e,134217728);if(t!==null){var n=An();Ws(t,e,134217728,n)}Vy(e,134217728)}};a2=function(e){if(e.tag===13){var t=Fi(e),n=Ur(e,t);if(n!==null){var s=An();Ws(n,e,t,s)}Vy(e,t)}};l2=function(){return Ke};c2=function(e,t){var n=Ke;try{return Ke=e,t()}finally{Ke=n}};Rg=function(e,t,n){switch(t){case"input":if(kg(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 s=n[t];if(s!==e&&s.form===e.form){var r=Wf(s);if(!r)throw Error(te(90));zC(s),kg(s,r)}}}break;case"textarea":HC(e,n);break;case"select":t=n.value,t!=null&&Ma(e,!!n.multiple,t,!1)}};XC=Hy;QC=$o;var eD={usingClientEntryPoint:!1,Events:[Ru,ka,Wf,VC,YC,Hy]},$l={findFiberByHostInstance:go,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},tD={bundleType:$l.bundleType,version:$l.version,rendererPackageName:$l.rendererPackageName,rendererConfig:$l.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Yr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ZC(e),e===null?null:e.stateNode},findFiberByHostInstance:$l.findFiberByHostInstance||JR,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 fd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fd.isDisabled&&fd.supportsFiber)try{Bf=fd.inject(tD),ur=fd}catch{}}fs.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=eD;fs.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Xy(t))throw Error(te(200));return GR(e,t,null,n)};fs.createRoot=function(e,t){if(!Xy(e))throw Error(te(299));var n=!1,s="",r=RN;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(r=t.onRecoverableError)),t=Ky(e,1,!1,null,null,n,!1,s,r),e[Wr]=t.current,Qc(e.nodeType===8?e.parentNode:e),new Yy(t)};fs.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(te(188)):(e=Object.keys(e).join(","),Error(te(268,e)));return e=ZC(t),e=e===null?null:e.stateNode,e};fs.flushSync=function(e){return $o(e)};fs.hydrate=function(e,t,n){if(!Jf(t))throw Error(te(200));return Zf(null,e,t,!0,n)};fs.hydrateRoot=function(e,t,n){if(!Xy(e))throw Error(te(405));var s=n!=null&&n.hydratedSources||null,r=!1,i="",o=RN;if(n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=TN(t,null,e,1,n??null,r,!1,i,o),e[Wr]=t.current,Qc(e),s)for(e=0;e<s.length;e++)n=s[e],r=n._getVersion,r=r(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,r]:t.mutableSourceEagerHydrationData.push(n,r);return new Gf(t)};fs.render=function(e,t,n){if(!Jf(t))throw Error(te(200));return Zf(null,e,t,!1,n)};fs.unmountComponentAtNode=function(e){if(!Jf(e))throw Error(te(40));return e._reactRootContainer?($o(function(){Zf(null,null,e,!1,function(){e._reactRootContainer=null,e[Wr]=null})}),!0):!1};fs.unstable_batchedUpdates=Hy;fs.unstable_renderSubtreeIntoContainer=function(e,t,n,s){if(!Jf(n))throw Error(te(200));if(e==null||e._reactInternals===void 0)throw Error(te(38));return Zf(e,t,n,!1,s)};fs.version="18.3.1-next-f1338f8080-20240426";function DN(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(DN)}catch(e){console.error(e)}}DN(),DC.exports=fs;var js=DC.exports;const MN=ml(js);var Tb=js;xg.createRoot=Tb.createRoot,xg.hydrateRoot=Tb.hydrateRoot;var yl=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(){}},nD={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},mi,ey,aC,sD=(aC=class{constructor(){me(this,mi,nD);me(this,ey,!1)}setTimeoutProvider(e){oe(this,mi,e)}setTimeout(e,t){return L(this,mi).setTimeout(e,t)}clearTimeout(e){L(this,mi).clearTimeout(e)}setInterval(e,t){return L(this,mi).setInterval(e,t)}clearInterval(e){L(this,mi).clearInterval(e)}},mi=new WeakMap,ey=new WeakMap,aC),yo=new sD;function rD(e){setTimeout(e,0)}var Ho=typeof window>"u"||"Deno"in globalThis;function Mn(){}function iD(e,t){return typeof e=="function"?e(t):e}function ux(e){return typeof e=="number"&&e>=0&&e!==1/0}function LN(e,t){return Math.max(e+(t||0)-Date.now(),0)}function zi(e,t){return typeof e=="function"?e(t):e}function ys(e,t){return typeof e=="function"?e(t):e}function Rb(e,t){const{type:n="all",exact:s,fetchStatus:r,predicate:i,queryKey:o,stale:a}=e;if(o){if(s){if(t.queryHash!==Qy(o,t.options))return!1}else if(!iu(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||r&&r!==t.state.fetchStatus||i&&!i(t))}function Db(e,t){const{exact:n,status:s,predicate:r,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Wo(t.options.mutationKey)!==Wo(i))return!1}else if(!iu(t.options.mutationKey,i))return!1}return!(s&&t.state.status!==s||r&&!r(t))}function Qy(e,t){return((t==null?void 0:t.queryKeyHashFn)||Wo)(e)}function Wo(e){return JSON.stringify(e,(t,n)=>dx(n)?Object.keys(n).sort().reduce((s,r)=>(s[r]=n[r],s),{}):n)}function iu(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>iu(e[n],t[n])):!1}var oD=Object.prototype.hasOwnProperty;function AN(e,t,n=0){if(e===t)return e;if(n>500)return t;const s=Mb(e)&&Mb(t);if(!s&&!(dx(e)&&dx(t)))return t;const i=(s?e:Object.keys(e)).length,o=s?t:Object.keys(t),a=o.length,c=s?new Array(a):{};let u=0;for(let d=0;d<a;d++){const h=s?d:o[d],p=e[h],f=t[h];if(p===f){c[h]=p,(s?d<i:oD.call(e,h))&&u++;continue}if(p===null||f===null||typeof p!="object"||typeof f!="object"){c[h]=f;continue}const m=AN(p,f,n+1);c[h]=m,m===p&&u++}return i===a&&u===i?e:c}function lf(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 Mb(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function dx(e){if(!Lb(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Lb(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Lb(e){return Object.prototype.toString.call(e)==="[object Object]"}function aD(e){return new Promise(t=>{yo.setTimeout(t,e)})}function hx(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?AN(e,t):t}function lD(e,t,n=0){const s=[...e,t];return n&&s.length>n?s.slice(1):s}function cD(e,t,n=0){const s=[t,...e];return n&&s.length>n?s.slice(0,-1):s}var Gy=Symbol();function ON(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Gy?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Jy(e,t){return typeof e=="function"?e(...t):!!e}function uD(e,t,n){let s=!1,r;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(r??(r=t()),s||(s=!0,r.aborted?n():r.addEventListener("abort",n,{once:!0})),r)}),e}var So,gi,Ha,lC,dD=(lC=class extends yl{constructor(){super();me(this,So);me(this,gi);me(this,Ha);oe(this,Ha,t=>{if(!Ho&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){L(this,gi)||this.setEventListener(L(this,Ha))}onUnsubscribe(){var t;this.hasListeners()||((t=L(this,gi))==null||t.call(this),oe(this,gi,void 0))}setEventListener(t){var n;oe(this,Ha,t),(n=L(this,gi))==null||n.call(this),oe(this,gi,t(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(t){L(this,So)!==t&&(oe(this,So,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof L(this,So)=="boolean"?L(this,So):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},So=new WeakMap,gi=new WeakMap,Ha=new WeakMap,lC),Zy=new dD;function fx(){let e,t;const n=new Promise((r,i)=>{e=r,t=i});n.status="pending",n.catch(()=>{});function s(r){Object.assign(n,r),delete n.resolve,delete n.reject}return n.resolve=r=>{s({status:"fulfilled",value:r}),e(r)},n.reject=r=>{s({status:"rejected",reason:r}),t(r)},n}var hD=rD;function fD(){let e=[],t=0,n=a=>{a()},s=a=>{a()},r=hD;const i=a=>{t?e.push(a):r(()=>{n(a)})},o=()=>{const a=e;e=[],a.length&&r(()=>{s(()=>{a.forEach(c=>{n(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||o()}return c},batchCalls:a=>(...c)=>{i(()=>{a(...c)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{s=a},setScheduler:a=>{r=a}}}var $t=fD(),Wa,xi,Ua,cC,pD=(cC=class extends yl{constructor(){super();me(this,Wa,!0);me(this,xi);me(this,Ua);oe(this,Ua,t=>{if(!Ho&&window.addEventListener){const n=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",s)}}})}onSubscribe(){L(this,xi)||this.setEventListener(L(this,Ua))}onUnsubscribe(){var t;this.hasListeners()||((t=L(this,xi))==null||t.call(this),oe(this,xi,void 0))}setEventListener(t){var n;oe(this,Ua,t),(n=L(this,xi))==null||n.call(this),oe(this,xi,t(this.setOnline.bind(this)))}setOnline(t){L(this,Wa)!==t&&(oe(this,Wa,t),this.listeners.forEach(s=>{s(t)}))}isOnline(){return L(this,Wa)}},Wa=new WeakMap,xi=new WeakMap,Ua=new WeakMap,cC),cf=new pD;function mD(e){return Math.min(1e3*2**e,3e4)}function IN(e){return(e??"online")==="online"?cf.isOnline():!0}var px=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function FN(e){let t=!1,n=0,s;const r=fx(),i=()=>r.status!=="pending",o=g=>{var v;if(!i()){const x=new px(g);p(x),(v=e.onCancel)==null||v.call(e,x)}},a=()=>{t=!0},c=()=>{t=!1},u=()=>Zy.isFocused()&&(e.networkMode==="always"||cf.isOnline())&&e.canRun(),d=()=>IN(e.networkMode)&&e.canRun(),h=g=>{i()||(s==null||s(),r.resolve(g))},p=g=>{i()||(s==null||s(),r.reject(g))},f=()=>new Promise(g=>{var v;s=x=>{(i()||u())&&g(x)},(v=e.onPause)==null||v.call(e)}).then(()=>{var g;s=void 0,i()||(g=e.onContinue)==null||g.call(e)}),m=()=>{if(i())return;let g;const v=n===0?e.initialPromise:void 0;try{g=v??e.fn()}catch(x){g=Promise.reject(x)}Promise.resolve(g).then(h).catch(x=>{var w;if(i())return;const _=e.retry??(Ho?0:3),b=e.retryDelay??mD,S=typeof b=="function"?b(n,x):b,C=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,x);if(t||!C){p(x);return}n++,(w=e.onFail)==null||w.call(e,n,x),aD(S).then(()=>u()?void 0:f()).then(()=>{t?p(x):m()})})};return{promise:r,status:()=>r.status,cancel:o,continue:()=>(s==null||s(),r),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?m():f().then(m),r)}}var ko,uC,BN=(uC=class{constructor(){me(this,ko)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ux(this.gcTime)&&oe(this,ko,yo.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ho?1/0:5*60*1e3))}clearGcTimeout(){L(this,ko)&&(yo.clearTimeout(L(this,ko)),oe(this,ko,void 0))}},ko=new WeakMap,uC),Co,qa,vs,No,Yt,Su,jo,Is,Cr,dC,gD=(dC=class extends BN{constructor(t){super();me(this,Is);me(this,Co);me(this,qa);me(this,vs);me(this,No);me(this,Yt);me(this,Su);me(this,jo);oe(this,jo,!1),oe(this,Su,t.defaultOptions),this.setOptions(t.options),this.observers=[],oe(this,No,t.client),oe(this,vs,L(this,No).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,oe(this,Co,Ob(this.options)),this.state=t.state??L(this,Co),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=L(this,Yt))==null?void 0:t.promise}setOptions(t){if(this.options={...L(this,Su),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Ob(this.options);n.data!==void 0&&(this.setState(Ab(n.data,n.dataUpdatedAt)),oe(this,Co,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&L(this,vs).remove(this)}setData(t,n){const s=hx(this.state.data,t,this.options);return Ne(this,Is,Cr).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(t,n){Ne(this,Is,Cr).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var s,r;const n=(s=L(this,Yt))==null?void 0:s.promise;return(r=L(this,Yt))==null||r.cancel(t),n?n.then(Mn).catch(Mn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(L(this,Co))}isActive(){return this.observers.some(t=>ys(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Gy||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>zi(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:!LN(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(s=>s.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=L(this,Yt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(s=>s.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=L(this,Yt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),L(this,vs).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,Yt)&&(L(this,jo)?L(this,Yt).cancel({revert:!0}):L(this,Yt).cancelRetry()),this.scheduleGc()),L(this,vs).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ne(this,Is,Cr).call(this,{type:"invalidate"})}async fetch(t,n){var c,u,d,h,p,f,m,g,v,x,_,b;if(this.state.fetchStatus!=="idle"&&((c=L(this,Yt))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(L(this,Yt))return L(this,Yt).continueRetry(),L(this,Yt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const S=this.observers.find(C=>C.options.queryFn);S&&this.setOptions(S.options)}const s=new AbortController,r=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(oe(this,jo,!0),s.signal)})},i=()=>{const S=ON(this.options,n),w=(()=>{const j={client:L(this,No),queryKey:this.queryKey,meta:this.meta};return r(j),j})();return oe(this,jo,!1),this.options.persister?this.options.persister(S,w,this):S(w)},a=(()=>{const S={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:L(this,No),state:this.state,fetchFn:i};return r(S),S})();(u=this.options.behavior)==null||u.onFetch(a,this),oe(this,qa,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&Ne(this,Is,Cr).call(this,{type:"fetch",meta:(h=a.fetchOptions)==null?void 0:h.meta}),oe(this,Yt,FN({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:S=>{S instanceof px&&S.revert&&this.setState({...L(this,qa),fetchStatus:"idle"}),s.abort()},onFail:(S,C)=>{Ne(this,Is,Cr).call(this,{type:"failed",failureCount:S,error:C})},onPause:()=>{Ne(this,Is,Cr).call(this,{type:"pause"})},onContinue:()=>{Ne(this,Is,Cr).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const S=await L(this,Yt).start();if(S===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(S),(f=(p=L(this,vs).config).onSuccess)==null||f.call(p,S,this),(g=(m=L(this,vs).config).onSettled)==null||g.call(m,S,this.state.error,this),S}catch(S){if(S instanceof px){if(S.silent)return L(this,Yt).promise;if(S.revert){if(this.state.data===void 0)throw S;return this.state.data}}throw Ne(this,Is,Cr).call(this,{type:"error",error:S}),(x=(v=L(this,vs).config).onError)==null||x.call(v,S,this),(b=(_=L(this,vs).config).onSettled)==null||b.call(_,this.state.data,S,this),S}finally{this.scheduleGc()}}},Co=new WeakMap,qa=new WeakMap,vs=new WeakMap,No=new WeakMap,Yt=new WeakMap,Su=new WeakMap,jo=new WeakMap,Is=new WeakSet,Cr=function(t){const n=s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...zN(s.data,this.options),fetchMeta:t.meta??null};case"success":const r={...s,...Ab(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return oe(this,qa,t.manual?r:void 0),r;case"error":const i=t.error;return{...s,error:i,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}};this.state=n(this.state),$t.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),L(this,vs).notify({query:this,type:"updated",action:t})})},dC);function zN(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:IN(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Ab(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Ob(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,s=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Un,Fe,ku,Rn,Eo,Ka,Rr,vi,Cu,Va,Ya,Po,To,yi,Xa,qe,cc,mx,gx,xx,vx,yx,_x,bx,$N,hC,xD=(hC=class extends yl{constructor(t,n){super();me(this,qe);me(this,Un);me(this,Fe);me(this,ku);me(this,Rn);me(this,Eo);me(this,Ka);me(this,Rr);me(this,vi);me(this,Cu);me(this,Va);me(this,Ya);me(this,Po);me(this,To);me(this,yi);me(this,Xa,new Set);this.options=n,oe(this,Un,t),oe(this,vi,null),oe(this,Rr,fx()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(L(this,Fe).addObserver(this),Ib(L(this,Fe),this.options)?Ne(this,qe,cc).call(this):this.updateResult(),Ne(this,qe,vx).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return wx(L(this,Fe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return wx(L(this,Fe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ne(this,qe,yx).call(this),Ne(this,qe,_x).call(this),L(this,Fe).removeObserver(this)}setOptions(t){const n=this.options,s=L(this,Fe);if(this.options=L(this,Un).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ys(this.options.enabled,L(this,Fe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ne(this,qe,bx).call(this),L(this,Fe).setOptions(this.options),n._defaulted&&!lf(this.options,n)&&L(this,Un).getQueryCache().notify({type:"observerOptionsUpdated",query:L(this,Fe),observer:this});const r=this.hasListeners();r&&Fb(L(this,Fe),s,this.options,n)&&Ne(this,qe,cc).call(this),this.updateResult(),r&&(L(this,Fe)!==s||ys(this.options.enabled,L(this,Fe))!==ys(n.enabled,L(this,Fe))||zi(this.options.staleTime,L(this,Fe))!==zi(n.staleTime,L(this,Fe)))&&Ne(this,qe,mx).call(this);const i=Ne(this,qe,gx).call(this);r&&(L(this,Fe)!==s||ys(this.options.enabled,L(this,Fe))!==ys(n.enabled,L(this,Fe))||i!==L(this,yi))&&Ne(this,qe,xx).call(this,i)}getOptimisticResult(t){const n=L(this,Un).getQueryCache().build(L(this,Un),t),s=this.createResult(n,t);return yD(this,s)&&(oe(this,Rn,s),oe(this,Ka,this.options),oe(this,Eo,L(this,Fe).state)),s}getCurrentResult(){return L(this,Rn)}trackResult(t,n){return new Proxy(t,{get:(s,r)=>(this.trackProp(r),n==null||n(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&L(this,Rr).status==="pending"&&L(this,Rr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r))})}trackProp(t){L(this,Xa).add(t)}getCurrentQuery(){return L(this,Fe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=L(this,Un).defaultQueryOptions(t),s=L(this,Un).getQueryCache().build(L(this,Un),n);return s.fetch().then(()=>this.createResult(s,n))}fetch(t){return Ne(this,qe,cc).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),L(this,Rn)))}createResult(t,n){var F;const s=L(this,Fe),r=this.options,i=L(this,Rn),o=L(this,Eo),a=L(this,Ka),u=t!==s?t.state:L(this,ku),{state:d}=t;let h={...d},p=!1,f;if(n._optimisticResults){const R=this.hasListeners(),B=!R&&Ib(t,n),A=R&&Fb(t,s,n,r);(B||A)&&(h={...h,...zN(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:m,errorUpdatedAt:g,status:v}=h;f=h.data;let x=!1;if(n.placeholderData!==void 0&&f===void 0&&v==="pending"){let R;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(R=i.data,x=!0):R=typeof n.placeholderData=="function"?n.placeholderData((F=L(this,Ya))==null?void 0:F.state.data,L(this,Ya)):n.placeholderData,R!==void 0&&(v="success",f=hx(i==null?void 0:i.data,R,n),p=!0)}if(n.select&&f!==void 0&&!x)if(i&&f===(o==null?void 0:o.data)&&n.select===L(this,Cu))f=L(this,Va);else try{oe(this,Cu,n.select),f=n.select(f),f=hx(i==null?void 0:i.data,f,n),oe(this,Va,f),oe(this,vi,null)}catch(R){oe(this,vi,R)}L(this,vi)&&(m=L(this,vi),f=L(this,Va),g=Date.now(),v="error");const _=h.fetchStatus==="fetching",b=v==="pending",S=v==="error",C=b&&_,w=f!==void 0,T={status:v,fetchStatus:h.fetchStatus,isPending:b,isSuccess:v==="success",isError:S,isInitialLoading:C,isLoading:C,data:f,dataUpdatedAt:h.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>u.dataUpdateCount||h.errorUpdateCount>u.errorUpdateCount,isFetching:_,isRefetching:_&&!b,isLoadingError:S&&!w,isPaused:h.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:S&&w,isStale:e0(t,n),refetch:this.refetch,promise:L(this,Rr),isEnabled:ys(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const R=T.data!==void 0,B=T.status==="error"&&!R,A=E=>{B?E.reject(T.error):R&&E.resolve(T.data)},D=()=>{const E=oe(this,Rr,T.promise=fx());A(E)},P=L(this,Rr);switch(P.status){case"pending":t.queryHash===s.queryHash&&A(P);break;case"fulfilled":(B||T.data!==P.value)&&D();break;case"rejected":(!B||T.error!==P.reason)&&D();break}}return T}updateResult(){const t=L(this,Rn),n=this.createResult(L(this,Fe),this.options);if(oe(this,Eo,L(this,Fe).state),oe(this,Ka,this.options),L(this,Eo).data!==void 0&&oe(this,Ya,L(this,Fe)),lf(n,t))return;oe(this,Rn,n);const s=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!L(this,Xa).size)return!0;const o=new Set(i??L(this,Xa));return this.options.throwOnError&&o.add("error"),Object.keys(L(this,Rn)).some(a=>{const c=a;return L(this,Rn)[c]!==t[c]&&o.has(c)})};Ne(this,qe,$N).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ne(this,qe,vx).call(this)}},Un=new WeakMap,Fe=new WeakMap,ku=new WeakMap,Rn=new WeakMap,Eo=new WeakMap,Ka=new WeakMap,Rr=new WeakMap,vi=new WeakMap,Cu=new WeakMap,Va=new WeakMap,Ya=new WeakMap,Po=new WeakMap,To=new WeakMap,yi=new WeakMap,Xa=new WeakMap,qe=new WeakSet,cc=function(t){Ne(this,qe,bx).call(this);let n=L(this,Fe).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Mn)),n},mx=function(){Ne(this,qe,yx).call(this);const t=zi(this.options.staleTime,L(this,Fe));if(Ho||L(this,Rn).isStale||!ux(t))return;const s=LN(L(this,Rn).dataUpdatedAt,t)+1;oe(this,Po,yo.setTimeout(()=>{L(this,Rn).isStale||this.updateResult()},s))},gx=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(L(this,Fe)):this.options.refetchInterval)??!1},xx=function(t){Ne(this,qe,_x).call(this),oe(this,yi,t),!(Ho||ys(this.options.enabled,L(this,Fe))===!1||!ux(L(this,yi))||L(this,yi)===0)&&oe(this,To,yo.setInterval(()=>{(this.options.refetchIntervalInBackground||Zy.isFocused())&&Ne(this,qe,cc).call(this)},L(this,yi)))},vx=function(){Ne(this,qe,mx).call(this),Ne(this,qe,xx).call(this,Ne(this,qe,gx).call(this))},yx=function(){L(this,Po)&&(yo.clearTimeout(L(this,Po)),oe(this,Po,void 0))},_x=function(){L(this,To)&&(yo.clearInterval(L(this,To)),oe(this,To,void 0))},bx=function(){const t=L(this,Un).getQueryCache().build(L(this,Un),this.options);if(t===L(this,Fe))return;const n=L(this,Fe);oe(this,Fe,t),oe(this,ku,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},$N=function(t){$t.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(L(this,Rn))}),L(this,Un).getQueryCache().notify({query:L(this,Fe),type:"observerResultsUpdated"})})},hC);function vD(e,t){return ys(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Ib(e,t){return vD(e,t)||e.state.data!==void 0&&wx(e,t,t.refetchOnMount)}function wx(e,t,n){if(ys(t.enabled,e)!==!1&&zi(t.staleTime,e)!=="static"){const s=typeof n=="function"?n(e):n;return s==="always"||s!==!1&&e0(e,t)}return!1}function Fb(e,t,n,s){return(e!==t||ys(s.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&e0(e,n)}function e0(e,t){return ys(t.enabled,e)!==!1&&e.isStaleByTime(zi(t.staleTime,e))}function yD(e,t){return!lf(e.getCurrentResult(),t)}function Bb(e){return{onFetch:(t,n)=>{var d,h,p,f,m;const s=t.options,r=(p=(h=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:h.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 a={pages:[],pageParams:[]},c=0;const u=async()=>{let g=!1;const v=b=>{uD(b,()=>t.signal,()=>g=!0)},x=ON(t.options,t.fetchOptions),_=async(b,S,C)=>{if(g)return Promise.reject();if(S==null&&b.pages.length)return Promise.resolve(b);const j=(()=>{const B={client:t.client,queryKey:t.queryKey,pageParam:S,direction:C?"backward":"forward",meta:t.options.meta};return v(B),B})(),T=await x(j),{maxPages:F}=t.options,R=C?cD:lD;return{pages:R(b.pages,T,F),pageParams:R(b.pageParams,S,F)}};if(r&&i.length){const b=r==="backward",S=b?_D:zb,C={pages:i,pageParams:o},w=S(s,C);a=await _(C,w,b)}else{const b=e??i.length;do{const S=c===0?o[0]??s.initialPageParam:zb(s,a);if(c>0&&S==null)break;a=await _(a,S),c++}while(c<b)}return a};t.options.persister?t.fetchFn=()=>{var g,v;return(v=(g=t.options).persister)==null?void 0:v.call(g,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function zb(e,{pages:t,pageParams:n}){const s=t.length-1;return t.length>0?e.getNextPageParam(t[s],t,n[s],n):void 0}function _D(e,{pages:t,pageParams:n}){var s;return t.length>0?(s=e.getPreviousPageParam)==null?void 0:s.call(e,t[0],t,n[0],n):void 0}var Nu,rr,_n,Ro,ir,oi,fC,bD=(fC=class extends BN{constructor(t){super();me(this,ir);me(this,Nu);me(this,rr);me(this,_n);me(this,Ro);oe(this,Nu,t.client),this.mutationId=t.mutationId,oe(this,_n,t.mutationCache),oe(this,rr,[]),this.state=t.state||HN(),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,rr).includes(t)||(L(this,rr).push(t),this.clearGcTimeout(),L(this,_n).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){oe(this,rr,L(this,rr).filter(n=>n!==t)),this.scheduleGc(),L(this,_n).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){L(this,rr).length||(this.state.status==="pending"?this.scheduleGc():L(this,_n).remove(this))}continue(){var t;return((t=L(this,Ro))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,u,d,h,p,f,m,g,v,x,_,b,S,C,w,j;const n=()=>{Ne(this,ir,oi).call(this,{type:"continue"})},s={client:L(this,Nu),meta:this.options.meta,mutationKey:this.options.mutationKey};oe(this,Ro,FN({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),onFail:(T,F)=>{Ne(this,ir,oi).call(this,{type:"failed",failureCount:T,error:F})},onPause:()=>{Ne(this,ir,oi).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>L(this,_n).canRun(this)}));const r=this.state.status==="pending",i=!L(this,Ro).canStart();try{if(r)n();else{Ne(this,ir,oi).call(this,{type:"pending",variables:t,isPaused:i}),L(this,_n).config.onMutate&&await L(this,_n).config.onMutate(t,this,s);const F=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,s));F!==this.state.context&&Ne(this,ir,oi).call(this,{type:"pending",context:F,variables:t,isPaused:i})}const T=await L(this,Ro).start();return await((u=(c=L(this,_n).config).onSuccess)==null?void 0:u.call(c,T,t,this.state.context,this,s)),await((h=(d=this.options).onSuccess)==null?void 0:h.call(d,T,t,this.state.context,s)),await((f=(p=L(this,_n).config).onSettled)==null?void 0:f.call(p,T,null,this.state.variables,this.state.context,this,s)),await((g=(m=this.options).onSettled)==null?void 0:g.call(m,T,null,t,this.state.context,s)),Ne(this,ir,oi).call(this,{type:"success",data:T}),T}catch(T){try{await((x=(v=L(this,_n).config).onError)==null?void 0:x.call(v,T,t,this.state.context,this,s))}catch(F){Promise.reject(F)}try{await((b=(_=this.options).onError)==null?void 0:b.call(_,T,t,this.state.context,s))}catch(F){Promise.reject(F)}try{await((C=(S=L(this,_n).config).onSettled)==null?void 0:C.call(S,void 0,T,this.state.variables,this.state.context,this,s))}catch(F){Promise.reject(F)}try{await((j=(w=this.options).onSettled)==null?void 0:j.call(w,void 0,T,t,this.state.context,s))}catch(F){Promise.reject(F)}throw Ne(this,ir,oi).call(this,{type:"error",error:T}),T}finally{L(this,_n).runNext(this)}}},Nu=new WeakMap,rr=new WeakMap,_n=new WeakMap,Ro=new WeakMap,ir=new WeakSet,oi=function(t){const n=s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,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{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),$t.batch(()=>{L(this,rr).forEach(s=>{s.onMutationUpdate(t)}),L(this,_n).notify({mutation:this,type:"updated",action:t})})},fC);function HN(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Dr,Fs,ju,pC,wD=(pC=class extends yl{constructor(t={}){super();me(this,Dr);me(this,Fs);me(this,ju);this.config=t,oe(this,Dr,new Set),oe(this,Fs,new Map),oe(this,ju,0)}build(t,n,s){const r=new bD({client:t,mutationCache:this,mutationId:++Qu(this,ju)._,options:t.defaultMutationOptions(n),state:s});return this.add(r),r}add(t){L(this,Dr).add(t);const n=pd(t);if(typeof n=="string"){const s=L(this,Fs).get(n);s?s.push(t):L(this,Fs).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(L(this,Dr).delete(t)){const n=pd(t);if(typeof n=="string"){const s=L(this,Fs).get(n);if(s)if(s.length>1){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}else s[0]===t&&L(this,Fs).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=pd(t);if(typeof n=="string"){const s=L(this,Fs).get(n),r=s==null?void 0:s.find(i=>i.state.status==="pending");return!r||r===t}else return!0}runNext(t){var s;const n=pd(t);if(typeof n=="string"){const r=(s=L(this,Fs).get(n))==null?void 0:s.find(i=>i!==t&&i.state.isPaused);return(r==null?void 0:r.continue())??Promise.resolve()}else return Promise.resolve()}clear(){$t.batch(()=>{L(this,Dr).forEach(t=>{this.notify({type:"removed",mutation:t})}),L(this,Dr).clear(),L(this,Fs).clear()})}getAll(){return Array.from(L(this,Dr))}find(t){const n={exact:!0,...t};return this.getAll().find(s=>Db(n,s))}findAll(t={}){return this.getAll().filter(n=>Db(t,n))}notify(t){$t.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return $t.batch(()=>Promise.all(t.map(n=>n.continue().catch(Mn))))}},Dr=new WeakMap,Fs=new WeakMap,ju=new WeakMap,pC);function pd(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Mr,_i,qn,Lr,$r,gh,Sx,mC,SD=(mC=class extends yl{constructor(n,s){super();me(this,$r);me(this,Mr);me(this,_i);me(this,qn);me(this,Lr);oe(this,Mr,n),this.setOptions(s),this.bindMethods(),Ne(this,$r,gh).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var r;const s=this.options;this.options=L(this,Mr).defaultMutationOptions(n),lf(this.options,s)||L(this,Mr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:L(this,qn),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&Wo(s.mutationKey)!==Wo(this.options.mutationKey)?this.reset():((r=L(this,qn))==null?void 0:r.state.status)==="pending"&&L(this,qn).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=L(this,qn))==null||n.removeObserver(this)}onMutationUpdate(n){Ne(this,$r,gh).call(this),Ne(this,$r,Sx).call(this,n)}getCurrentResult(){return L(this,_i)}reset(){var n;(n=L(this,qn))==null||n.removeObserver(this),oe(this,qn,void 0),Ne(this,$r,gh).call(this),Ne(this,$r,Sx).call(this)}mutate(n,s){var r;return oe(this,Lr,s),(r=L(this,qn))==null||r.removeObserver(this),oe(this,qn,L(this,Mr).getMutationCache().build(L(this,Mr),this.options)),L(this,qn).addObserver(this),L(this,qn).execute(n)}},Mr=new WeakMap,_i=new WeakMap,qn=new WeakMap,Lr=new WeakMap,$r=new WeakSet,gh=function(){var s;const n=((s=L(this,qn))==null?void 0:s.state)??HN();oe(this,_i,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Sx=function(n){$t.batch(()=>{var s,r,i,o,a,c,u,d;if(L(this,Lr)&&this.hasListeners()){const h=L(this,_i).variables,p=L(this,_i).context,f={client:L(this,Mr),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(r=(s=L(this,Lr)).onSuccess)==null||r.call(s,n.data,h,p,f)}catch(m){Promise.reject(m)}try{(o=(i=L(this,Lr)).onSettled)==null||o.call(i,n.data,null,h,p,f)}catch(m){Promise.reject(m)}}else if((n==null?void 0:n.type)==="error"){try{(c=(a=L(this,Lr)).onError)==null||c.call(a,n.error,h,p,f)}catch(m){Promise.reject(m)}try{(d=(u=L(this,Lr)).onSettled)==null||d.call(u,void 0,n.error,h,p,f)}catch(m){Promise.reject(m)}}}this.listeners.forEach(h=>{h(L(this,_i))})})},mC),or,gC,kD=(gC=class extends yl{constructor(t={}){super();me(this,or);this.config=t,oe(this,or,new Map)}build(t,n,s){const r=n.queryKey,i=n.queryHash??Qy(r,n);let o=this.get(i);return o||(o=new gD({client:t,queryKey:r,queryHash:i,options:t.defaultQueryOptions(n),state:s,defaultOptions:t.getQueryDefaults(r)}),this.add(o)),o}add(t){L(this,or).has(t.queryHash)||(L(this,or).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=L(this,or).get(t.queryHash);n&&(t.destroy(),n===t&&L(this,or).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){$t.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return L(this,or).get(t)}getAll(){return[...L(this,or).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(s=>Rb(n,s))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(s=>Rb(t,s)):n}notify(t){$t.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){$t.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){$t.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},or=new WeakMap,gC),mt,bi,wi,Qa,Ga,Si,Ja,Za,xC,CD=(xC=class{constructor(e={}){me(this,mt);me(this,bi);me(this,wi);me(this,Qa);me(this,Ga);me(this,Si);me(this,Ja);me(this,Za);oe(this,mt,e.queryCache||new kD),oe(this,bi,e.mutationCache||new wD),oe(this,wi,e.defaultOptions||{}),oe(this,Qa,new Map),oe(this,Ga,new Map),oe(this,Si,0)}mount(){Qu(this,Si)._++,L(this,Si)===1&&(oe(this,Ja,Zy.subscribe(async e=>{e&&(await this.resumePausedMutations(),L(this,mt).onFocus())})),oe(this,Za,cf.subscribe(async e=>{e&&(await this.resumePausedMutations(),L(this,mt).onOnline())})))}unmount(){var e,t;Qu(this,Si)._--,L(this,Si)===0&&((e=L(this,Ja))==null||e.call(this),oe(this,Ja,void 0),(t=L(this,Za))==null||t.call(this),oe(this,Za,void 0))}isFetching(e){return L(this,mt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return L(this,bi).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=L(this,mt).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=L(this,mt).build(this,t),s=n.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(zi(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(s))}getQueriesData(e){return L(this,mt).findAll(e).map(({queryKey:t,state:n})=>{const s=n.data;return[t,s]})}setQueryData(e,t,n){const s=this.defaultQueryOptions({queryKey:e}),r=L(this,mt).get(s.queryHash),i=r==null?void 0:r.state.data,o=iD(t,i);if(o!==void 0)return L(this,mt).build(this,s).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return $t.batch(()=>L(this,mt).findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=L(this,mt).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=L(this,mt);$t.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=L(this,mt);return $t.batch(()=>(n.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},s=$t.batch(()=>L(this,mt).findAll(e).map(r=>r.cancel(n)));return Promise.all(s).then(Mn).catch(Mn)}invalidateQueries(e,t={}){return $t.batch(()=>(L(this,mt).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},s=$t.batch(()=>L(this,mt).findAll(e).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let i=r.fetch(void 0,n);return n.throwOnError||(i=i.catch(Mn)),r.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(s).then(Mn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=L(this,mt).build(this,t);return n.isStaleByTime(zi(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Mn).catch(Mn)}fetchInfiniteQuery(e){return e.behavior=Bb(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Mn).catch(Mn)}ensureInfiniteQueryData(e){return e.behavior=Bb(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return cf.isOnline()?L(this,bi).resumePausedMutations():Promise.resolve()}getQueryCache(){return L(this,mt)}getMutationCache(){return L(this,bi)}getDefaultOptions(){return L(this,wi)}setDefaultOptions(e){oe(this,wi,e)}setQueryDefaults(e,t){L(this,Qa).set(Wo(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...L(this,Qa).values()],n={};return t.forEach(s=>{iu(e,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(e,t){L(this,Ga).set(Wo(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...L(this,Ga).values()],n={};return t.forEach(s=>{iu(e,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...L(this,wi).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Qy(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===Gy&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...L(this,wi).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){L(this,mt).clear(),L(this,bi).clear()}},mt=new WeakMap,bi=new WeakMap,wi=new WeakMap,Qa=new WeakMap,Ga=new WeakMap,Si=new WeakMap,Ja=new WeakMap,Za=new WeakMap,xC),WN=y.createContext(void 0),Lt=e=>{const t=y.useContext(WN);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},ND=({client:e,children:t})=>(y.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(WN.Provider,{value:e,children:t})),UN=y.createContext(!1),jD=()=>y.useContext(UN);UN.Provider;function ED(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var PD=y.createContext(ED()),TD=()=>y.useContext(PD),RD=(e,t,n)=>{const s=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Jy(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||s)&&(t.isReset()||(e.retryOnMount=!1))},DD=e=>{y.useEffect(()=>{e.clearReset()},[e])},MD=({result:e,errorResetBoundary:t,throwOnError:n,query:s,suspense:r})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(r&&e.data===void 0||Jy(n,[e.error,s])),LD=e=>{if(e.suspense){const n=r=>r==="static"?r:Math.max(r??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...r)=>n(s(...r)):n(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},AD=(e,t)=>e.isLoading&&e.isFetching&&!t,OD=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,$b=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ID(e,t,n){var p,f,m,g;const s=jD(),r=TD(),i=Lt(),o=i.defaultQueryOptions(e);(f=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||f.call(p,o);const a=i.getQueryCache().get(o.queryHash);o._optimisticResults=s?"isRestoring":"optimistic",LD(o),RD(o,r,a),DD(r);const c=!i.getQueryCache().get(o.queryHash),[u]=y.useState(()=>new t(i,o)),d=u.getOptimisticResult(o),h=!s&&e.subscribed!==!1;if(y.useSyncExternalStore(y.useCallback(v=>{const x=h?u.subscribe($t.batchCalls(v)):Mn;return u.updateResult(),x},[u,h]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),y.useEffect(()=>{u.setOptions(o)},[o,u]),OD(o,d))throw $b(o,u,r);if(MD({result:d,errorResetBoundary:r,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw d.error;if((g=(m=i.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||g.call(m,o,d),o.experimental_prefetchInRender&&!Ho&&AD(d,s)){const v=c?$b(o,u,r):a==null?void 0:a.promise;v==null||v.catch(Mn).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?d:u.trackResult(d)}function he(e,t){return ID(e,xD)}function we(e,t){const n=Lt(),[s]=y.useState(()=>new SD(n,e));y.useEffect(()=>{s.setOptions(e)},[s,e]);const r=y.useSyncExternalStore(y.useCallback(o=>s.subscribe($t.batchCalls(o)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),i=y.useCallback((o,a)=>{s.mutate(o,a).catch(Mn)},[s]);if(r.error&&Jy(s.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:i,mutateAsync:r.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 FD=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),qN=(...e)=>e.filter((t,n,s)=>!!t&&s.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 BD={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 zD=y.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:r="",children:i,iconNode:o,...a},c)=>y.createElement("svg",{ref:c,...BD,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:qN("lucide",r),...a},[...o.map(([u,d])=>y.createElement(u,d)),...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 ie=(e,t)=>{const n=y.forwardRef(({className:s,...r},i)=>y.createElement(zD,{ref:i,iconNode:t,className:qN(`lucide-${FD(e)}`,s),...r}));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 al=ie("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 t0=ie("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 kx=ie("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 $D=ie("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
|
|
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 HD=ie("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"}]]);/**
|
|
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 WD=ie("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"}]]);/**
|
|
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 KN=ie("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"}]]);/**
|
|
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 VN=ie("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"}]]);/**
|
|
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 Hb=ie("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"}]]);/**
|
|
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 ep=ie("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"}]]);/**
|
|
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 UD=ie("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"}]]);/**
|
|
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 YN=ie("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/**
|
|
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 Ec=ie("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
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 Mu=ie("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
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 _l=ie("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
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 Uo=ie("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"}]]);/**
|
|
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 mr=ie("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"}]]);/**
|
|
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 po=ie("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
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 qD=ie("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"}]]);/**
|
|
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 KD=ie("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{width:"6",height:"6",x:"9",y:"9",key:"1wrtvo"}]]);/**
|
|
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 Kr=ie("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"}]]);/**
|
|
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 XN=ie("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
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 VD=ie("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"}]]);/**
|
|
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 ll=ie("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
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 Cx=ie("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
|
|
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 QN=ie("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"}]]);/**
|
|
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 YD=ie("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"}]]);/**
|
|
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 GN=ie("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"}]]);/**
|
|
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 Nx=ie("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"}]]);/**
|
|
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 na=ie("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"}]]);/**
|
|
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 gr=ie("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"}]]);/**
|
|
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 Lo=ie("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"}]]);/**
|
|
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 qo=ie("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"}]]);/**
|
|
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 XD=ie("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
|
|
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 Wb=ie("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"}]]);/**
|
|
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 jx=ie("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"}]]);/**
|
|
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 JN=ie("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"}]]);/**
|
|
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 Ex=ie("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"}]]);/**
|
|
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 n0=ie("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"}]]);/**
|
|
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 Ub=ie("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"}]]);/**
|
|
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 QD=ie("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"}]]);/**
|
|
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 ZN=ie("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
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 ej=ie("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"}]]);/**
|
|
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 GD=ie("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"}]]);/**
|
|
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 tj=ie("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"}]]);/**
|
|
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 Ko=ie("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"}]]);/**
|
|
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 be=ie("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
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 JD=ie("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"}]]);/**
|
|
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 ZD=ie("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
|
|
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 eM=ie("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"}]]);/**
|
|
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 Px=ie("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"}]]);/**
|
|
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 tM=ie("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
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 nM=ie("MoveDown",[["path",{d:"M8 18L12 22L16 18",key:"cskvfv"}],["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 sM=ie("MoveUp",[["path",{d:"M8 6L12 2L16 6",key:"1yvkyx"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/**
|
|
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 Qn=ie("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
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 rM=ie("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
|
|
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 Ar=ie("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"}]]);/**
|
|
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 Lu=ie("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"}]]);/**
|
|
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 iM=ie("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"}]]);/**
|
|
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 oM=ie("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
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 nj=ie("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
|
|
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 aM=ie("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
|
|
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 sj=ie("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"}]]);/**
|
|
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 lM=ie("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"}]]);/**
|
|
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 Tx=ie("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"}]]);/**
|
|
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 ou=ie("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
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 cM=ie("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"}]]);/**
|
|
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 s0=ie("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"}]]);/**
|
|
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 Vo=ie("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
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 rj=ie("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"}]]);/**
|
|
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 r0=ie("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"}]]);/**
|
|
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 kn=ie("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"}]]);/**
|
|
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 ij=ie("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"}]]);/**
|
|
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 oj=ie("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"}]]);/**
|
|
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 i0=ie("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"}]]);/**
|
|
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 au=ie("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"}]]);/**
|
|
441
|
+
* @license lucide-react v0.400.0 - ISC
|
|
442
|
+
*
|
|
443
|
+
* This source code is licensed under the ISC license.
|
|
444
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
445
|
+
*/const yt=ie("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
|
|
446
|
+
* @license lucide-react v0.400.0 - ISC
|
|
447
|
+
*
|
|
448
|
+
* This source code is licensed under the ISC license.
|
|
449
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
450
|
+
*/const uM=ie("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"}]]),o0=y.createContext(null);function yr(){const e=y.useContext(o0);if(!e)throw new Error("useConfirm must be used within DialogProvider");return e.confirm}function bl(){const e=y.useContext(o0);if(!e)throw new Error("useAlert must be used within DialogProvider");return e.alert}function dM({options:e,onConfirm:t,onCancel:n}){const s=y.useRef(null),r=y.useRef(null),i=e.variant==="destructive";return y.useEffect(()=>{var o,a;i?(o=s.current)==null||o.focus():(a=r.current)==null||a.focus()},[i]),y.useEffect(()=>{const o=a=>{a.key==="Escape"&&n()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[n]),l.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[100]",onClick:n,children:l.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:[l.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-divider",children:[i?l.jsx(kn,{className:"w-5 h-5 text-red-400 shrink-0"}):l.jsx(ZN,{className:"w-5 h-5 text-blue-400 shrink-0"}),l.jsx("h3",{id:"dialog-title",className:"text-lg font-semibold text-content",children:e.title})]}),l.jsx("div",{className:"px-4 py-4",children:l.jsx("p",{id:"dialog-message",className:"text-sm text-content-body whitespace-pre-line",children:e.message})}),l.jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-divider",children:[l.jsx("button",{ref:s,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"}),l.jsx("button",{ref:r,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 hM({options:e,onClose:t}){const n=y.useRef(null);y.useEffect(()=>{var i;(i=n.current)==null||i.focus()},[]),y.useEffect(()=>{const i=o=>{(o.key==="Escape"||o.key==="Enter")&&t()};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[t]);const s={info:l.jsx(ZN,{className:"w-5 h-5 text-blue-400 shrink-0"}),error:l.jsx(Kr,{className:"w-5 h-5 text-red-400 shrink-0"}),success:l.jsx(mr,{className:"w-5 h-5 text-green-400 shrink-0"})},r=e.variant||"info";return l.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[100]",onClick:t,children:l.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:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-divider",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[s[r],l.jsx("h3",{id:"alert-title",className:"text-lg font-semibold text-content",children:e.title||(r==="error"?"Error":r==="success"?"Success":"Notice")})]}),l.jsx("button",{onClick:t,className:"text-content-subtle hover:text-content-body transition-colors",children:l.jsx(yt,{className:"w-5 h-5"})})]}),l.jsx("div",{className:"px-4 py-4",children:l.jsx("p",{id:"alert-message",className:"text-sm text-content-body whitespace-pre-line",children:e.message})}),l.jsx("div",{className:"flex items-center justify-end px-4 py-3 border-t border-divider",children:l.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 fM({children:e}){const[t,n]=y.useState(null),s=y.useRef(null),r=y.useCallback(()=>{s.current&&(s.current.resolve(!1),s.current=null)},[]),i=y.useCallback(d=>(r(),new Promise(h=>{const p={type:"confirm",options:d,resolve:h};s.current=p,n(p)})),[r]),o=y.useCallback(d=>(r(),new Promise(h=>{const p={type:"alert",options:d,resolve:()=>h()};s.current=p,n(p)})),[r]),a=y.useCallback(()=>{t==null||t.resolve(!0),s.current=null,n(null)},[t]),c=y.useCallback(()=>{t==null||t.resolve(!1),s.current=null,n(null)},[t]),u=y.useCallback(()=>{t==null||t.resolve(!1),s.current=null,n(null)},[t]);return l.jsxs(o0.Provider,{value:{confirm:i,alert:o},children:[e,(t==null?void 0:t.type)==="confirm"&&l.jsx(dM,{options:t.options,onConfirm:a,onCancel:c}),(t==null?void 0:t.type)==="alert"&&l.jsx(hM,{options:t.options,onClose:u})]})}var pM=e=>{switch(e){case"success":return xM;case"info":return yM;case"warning":return vM;case"error":return _M;default:return null}},mM=Array(12).fill(0),gM=({visible:e,className:t})=>J.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},J.createElement("div",{className:"sonner-spinner"},mM.map((n,s)=>J.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),xM=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},J.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),vM=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},J.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),yM=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},J.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),_M=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},J.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),bM=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},J.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),J.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),wM=()=>{let[e,t]=J.useState(document.hidden);return J.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},Rx=1,SM=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...s}=e,r=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:Rx++,i=this.toasts.find(a=>a.id===r),o=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(a=>a.id===r?(this.publish({...a,...e,id:r,title:n}),{...a,...e,id:r,dismissible:o,title:n}):a):this.addToast({title:n,...s,dismissible:o,id:r}),r},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let s=e instanceof Promise?e:e(),r=n!==void 0,i,o=s.then(async c=>{if(i=["resolve",c],J.isValidElement(c))r=!1,this.create({id:n,type:"default",message:c});else if(CM(c)&&!c.ok){r=!1;let u=typeof t.error=="function"?await t.error(`HTTP error! status: ${c.status}`):t.error,d=typeof t.description=="function"?await t.description(`HTTP error! status: ${c.status}`):t.description;this.create({id:n,type:"error",message:u,description:d})}else if(t.success!==void 0){r=!1;let u=typeof t.success=="function"?await t.success(c):t.success,d=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"success",message:u,description:d})}}).catch(async c=>{if(i=["reject",c],t.error!==void 0){r=!1;let u=typeof t.error=="function"?await t.error(c):t.error,d=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"error",message:u,description:d})}}).finally(()=>{var c;r&&(this.dismiss(n),n=void 0),(c=t.finally)==null||c.call(t)}),a=()=>new Promise((c,u)=>o.then(()=>i[0]==="reject"?u(i[1]):c(i[1])).catch(u));return typeof n!="string"&&typeof n!="number"?{unwrap:a}:Object.assign(n,{unwrap:a})},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||Rx++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Kn=new SM,kM=(e,t)=>{let n=(t==null?void 0:t.id)||Rx++;return Kn.addToast({title:e,...t,id:n}),n},CM=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",NM=kM,jM=()=>Kn.toasts,EM=()=>Kn.getActiveToasts(),uc=Object.assign(NM,{success:Kn.success,info:Kn.info,warning:Kn.warning,error:Kn.error,custom:Kn.custom,message:Kn.message,promise:Kn.promise,dismiss:Kn.dismiss,loading:Kn.loading},{getHistory:jM,getToasts:EM});function PM(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",t==="top"&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}PM(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
451
|
+
`);function md(e){return e.label!==void 0}var TM=3,RM="32px",DM="16px",qb=4e3,MM=356,LM=14,AM=20,OM=200;function Ms(...e){return e.filter(Boolean).join(" ")}function IM(e){let[t,n]=e.split("-"),s=[];return t&&s.push(t),n&&s.push(n),s}var FM=e=>{var t,n,s,r,i,o,a,c,u,d,h;let{invert:p,toast:f,unstyled:m,interacting:g,setHeights:v,visibleToasts:x,heights:_,index:b,toasts:S,expanded:C,removeToast:w,defaultRichColors:j,closeButton:T,style:F,cancelButtonStyle:R,actionButtonStyle:B,className:A="",descriptionClassName:D="",duration:P,position:E,gap:$,loadingIcon:W,expandByDefault:O,classNames:H,icons:k,closeButtonAriaLabel:I="Close toast",pauseWhenPageIsHidden:M}=e,[N,z]=J.useState(null),[U,K]=J.useState(null),[Q,Y]=J.useState(!1),[Z,ue]=J.useState(!1),[Oe,Re]=J.useState(!1),[fe,Ie]=J.useState(!1),[Ut,sn]=J.useState(!1),[se,de]=J.useState(0),[Ee,We]=J.useState(0),Ue=J.useRef(f.duration||P||qb),wt=J.useRef(null),ft=J.useRef(null),pn=b===0,Sr=b+1<=x,q=f.type,ee=f.dismissible!==!1,ge=f.className||"",ye=f.descriptionClassName||"",ke=J.useMemo(()=>_.findIndex(pe=>pe.toastId===f.id)||0,[_,f.id]),it=J.useMemo(()=>{var pe;return(pe=f.closeButton)!=null?pe:T},[f.closeButton,T]),rn=J.useMemo(()=>f.duration||P||qb,[f.duration,P]),qt=J.useRef(0),on=J.useRef(0),En=J.useRef(0),Ge=J.useRef(null),[ts,an]=E.split("-"),to=J.useMemo(()=>_.reduce((pe,_e,Se)=>Se>=ke?pe:pe+_e.height,0),[_,ke]),X=wM(),ae=f.invert||p,De=q==="loading";on.current=J.useMemo(()=>ke*$+to,[ke,to]),J.useEffect(()=>{Ue.current=rn},[rn]),J.useEffect(()=>{Y(!0)},[]),J.useEffect(()=>{let pe=ft.current;if(pe){let _e=pe.getBoundingClientRect().height;return We(_e),v(Se=>[{toastId:f.id,height:_e,position:f.position},...Se]),()=>v(Se=>Se.filter(tt=>tt.toastId!==f.id))}},[v,f.id]),J.useLayoutEffect(()=>{if(!Q)return;let pe=ft.current,_e=pe.style.height;pe.style.height="auto";let Se=pe.getBoundingClientRect().height;pe.style.height=_e,We(Se),v(tt=>tt.find(Kt=>Kt.toastId===f.id)?tt.map(Kt=>Kt.toastId===f.id?{...Kt,height:Se}:Kt):[{toastId:f.id,height:Se,position:f.position},...tt])},[Q,f.title,f.description,v,f.id]);let He=J.useCallback(()=>{ue(!0),de(on.current),v(pe=>pe.filter(_e=>_e.toastId!==f.id)),setTimeout(()=>{w(f)},OM)},[f,w,v,on]);J.useEffect(()=>{if(f.promise&&q==="loading"||f.duration===1/0||f.type==="loading")return;let pe;return C||g||M&&X?(()=>{if(En.current<qt.current){let _e=new Date().getTime()-qt.current;Ue.current=Ue.current-_e}En.current=new Date().getTime()})():Ue.current!==1/0&&(qt.current=new Date().getTime(),pe=setTimeout(()=>{var _e;(_e=f.onAutoClose)==null||_e.call(f,f),He()},Ue.current)),()=>clearTimeout(pe)},[C,g,f,q,M,X,He]),J.useEffect(()=>{f.delete&&He()},[He,f.delete]);function Nt(){var pe,_e,Se;return k!=null&&k.loading?J.createElement("div",{className:Ms(H==null?void 0:H.loader,(pe=f==null?void 0:f.classNames)==null?void 0:pe.loader,"sonner-loader"),"data-visible":q==="loading"},k.loading):W?J.createElement("div",{className:Ms(H==null?void 0:H.loader,(_e=f==null?void 0:f.classNames)==null?void 0:_e.loader,"sonner-loader"),"data-visible":q==="loading"},W):J.createElement(gM,{className:Ms(H==null?void 0:H.loader,(Se=f==null?void 0:f.classNames)==null?void 0:Se.loader),visible:q==="loading"})}return J.createElement("li",{tabIndex:0,ref:ft,className:Ms(A,ge,H==null?void 0:H.toast,(t=f==null?void 0:f.classNames)==null?void 0:t.toast,H==null?void 0:H.default,H==null?void 0:H[q],(n=f==null?void 0:f.classNames)==null?void 0:n[q]),"data-sonner-toast":"","data-rich-colors":(s=f.richColors)!=null?s:j,"data-styled":!(f.jsx||f.unstyled||m),"data-mounted":Q,"data-promise":!!f.promise,"data-swiped":Ut,"data-removed":Z,"data-visible":Sr,"data-y-position":ts,"data-x-position":an,"data-index":b,"data-front":pn,"data-swiping":Oe,"data-dismissible":ee,"data-type":q,"data-invert":ae,"data-swipe-out":fe,"data-swipe-direction":U,"data-expanded":!!(C||O&&Q),style:{"--index":b,"--toasts-before":b,"--z-index":S.length-b,"--offset":`${Z?se:on.current}px`,"--initial-height":O?"auto":`${Ee}px`,...F,...f.style},onDragEnd:()=>{Re(!1),z(null),Ge.current=null},onPointerDown:pe=>{De||!ee||(wt.current=new Date,de(on.current),pe.target.setPointerCapture(pe.pointerId),pe.target.tagName!=="BUTTON"&&(Re(!0),Ge.current={x:pe.clientX,y:pe.clientY}))},onPointerUp:()=>{var pe,_e,Se,tt;if(fe||!ee)return;Ge.current=null;let Kt=Number(((pe=ft.current)==null?void 0:pe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Je=Number(((_e=ft.current)==null?void 0:_e.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),mn=new Date().getTime()-((Se=wt.current)==null?void 0:Se.getTime()),pt=N==="x"?Kt:Je,Vt=Math.abs(pt)/mn;if(Math.abs(pt)>=AM||Vt>.11){de(on.current),(tt=f.onDismiss)==null||tt.call(f,f),K(N==="x"?Kt>0?"right":"left":Je>0?"down":"up"),He(),Ie(!0),sn(!1);return}Re(!1),z(null)},onPointerMove:pe=>{var _e,Se,tt,Kt;if(!Ge.current||!ee||((_e=window.getSelection())==null?void 0:_e.toString().length)>0)return;let Je=pe.clientY-Ge.current.y,mn=pe.clientX-Ge.current.x,pt=(Se=e.swipeDirections)!=null?Se:IM(E);!N&&(Math.abs(mn)>1||Math.abs(Je)>1)&&z(Math.abs(mn)>Math.abs(Je)?"x":"y");let Vt={x:0,y:0};N==="y"?(pt.includes("top")||pt.includes("bottom"))&&(pt.includes("top")&&Je<0||pt.includes("bottom")&&Je>0)&&(Vt.y=Je):N==="x"&&(pt.includes("left")||pt.includes("right"))&&(pt.includes("left")&&mn<0||pt.includes("right")&&mn>0)&&(Vt.x=mn),(Math.abs(Vt.x)>0||Math.abs(Vt.y)>0)&&sn(!0),(tt=ft.current)==null||tt.style.setProperty("--swipe-amount-x",`${Vt.x}px`),(Kt=ft.current)==null||Kt.style.setProperty("--swipe-amount-y",`${Vt.y}px`)}},it&&!f.jsx?J.createElement("button",{"aria-label":I,"data-disabled":De,"data-close-button":!0,onClick:De||!ee?()=>{}:()=>{var pe;He(),(pe=f.onDismiss)==null||pe.call(f,f)},className:Ms(H==null?void 0:H.closeButton,(r=f==null?void 0:f.classNames)==null?void 0:r.closeButton)},(i=k==null?void 0:k.close)!=null?i:bM):null,f.jsx||y.isValidElement(f.title)?f.jsx?f.jsx:typeof f.title=="function"?f.title():f.title:J.createElement(J.Fragment,null,q||f.icon||f.promise?J.createElement("div",{"data-icon":"",className:Ms(H==null?void 0:H.icon,(o=f==null?void 0:f.classNames)==null?void 0:o.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||Nt():null,f.type!=="loading"?f.icon||(k==null?void 0:k[q])||pM(q):null):null,J.createElement("div",{"data-content":"",className:Ms(H==null?void 0:H.content,(a=f==null?void 0:f.classNames)==null?void 0:a.content)},J.createElement("div",{"data-title":"",className:Ms(H==null?void 0:H.title,(c=f==null?void 0:f.classNames)==null?void 0:c.title)},typeof f.title=="function"?f.title():f.title),f.description?J.createElement("div",{"data-description":"",className:Ms(D,ye,H==null?void 0:H.description,(u=f==null?void 0:f.classNames)==null?void 0:u.description)},typeof f.description=="function"?f.description():f.description):null),y.isValidElement(f.cancel)?f.cancel:f.cancel&&md(f.cancel)?J.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||R,onClick:pe=>{var _e,Se;md(f.cancel)&&ee&&((Se=(_e=f.cancel).onClick)==null||Se.call(_e,pe),He())},className:Ms(H==null?void 0:H.cancelButton,(d=f==null?void 0:f.classNames)==null?void 0:d.cancelButton)},f.cancel.label):null,y.isValidElement(f.action)?f.action:f.action&&md(f.action)?J.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||B,onClick:pe=>{var _e,Se;md(f.action)&&((Se=(_e=f.action).onClick)==null||Se.call(_e,pe),!pe.defaultPrevented&&He())},className:Ms(H==null?void 0:H.actionButton,(h=f==null?void 0:f.classNames)==null?void 0:h.actionButton)},f.action.label):null))};function Kb(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function BM(e,t){let n={};return[e,t].forEach((s,r)=>{let i=r===1,o=i?"--mobile-offset":"--offset",a=i?DM:RM;function c(u){["top","right","bottom","left"].forEach(d=>{n[`${o}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof s=="number"||typeof s=="string"?c(s):typeof s=="object"?["top","right","bottom","left"].forEach(u=>{s[u]===void 0?n[`${o}-${u}`]=a:n[`${o}-${u}`]=typeof s[u]=="number"?`${s[u]}px`:s[u]}):c(a)}),n}var zM=y.forwardRef(function(e,t){let{invert:n,position:s="bottom-right",hotkey:r=["altKey","KeyT"],expand:i,closeButton:o,className:a,offset:c,mobileOffset:u,theme:d="light",richColors:h,duration:p,style:f,visibleToasts:m=TM,toastOptions:g,dir:v=Kb(),gap:x=LM,loadingIcon:_,icons:b,containerAriaLabel:S="Notifications",pauseWhenPageIsHidden:C}=e,[w,j]=J.useState([]),T=J.useMemo(()=>Array.from(new Set([s].concat(w.filter(M=>M.position).map(M=>M.position)))),[w,s]),[F,R]=J.useState([]),[B,A]=J.useState(!1),[D,P]=J.useState(!1),[E,$]=J.useState(d!=="system"?d:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),W=J.useRef(null),O=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),H=J.useRef(null),k=J.useRef(!1),I=J.useCallback(M=>{j(N=>{var z;return(z=N.find(U=>U.id===M.id))!=null&&z.delete||Kn.dismiss(M.id),N.filter(({id:U})=>U!==M.id)})},[]);return J.useEffect(()=>Kn.subscribe(M=>{if(M.dismiss){j(N=>N.map(z=>z.id===M.id?{...z,delete:!0}:z));return}setTimeout(()=>{MN.flushSync(()=>{j(N=>{let z=N.findIndex(U=>U.id===M.id);return z!==-1?[...N.slice(0,z),{...N[z],...M},...N.slice(z+1)]:[M,...N]})})})}),[]),J.useEffect(()=>{if(d!=="system"){$(d);return}if(d==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?$("dark"):$("light")),typeof window>"u")return;let M=window.matchMedia("(prefers-color-scheme: dark)");try{M.addEventListener("change",({matches:N})=>{$(N?"dark":"light")})}catch{M.addListener(({matches:z})=>{try{$(z?"dark":"light")}catch(U){console.error(U)}})}},[d]),J.useEffect(()=>{w.length<=1&&A(!1)},[w]),J.useEffect(()=>{let M=N=>{var z,U;r.every(K=>N[K]||N.code===K)&&(A(!0),(z=W.current)==null||z.focus()),N.code==="Escape"&&(document.activeElement===W.current||(U=W.current)!=null&&U.contains(document.activeElement))&&A(!1)};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[r]),J.useEffect(()=>{if(W.current)return()=>{H.current&&(H.current.focus({preventScroll:!0}),H.current=null,k.current=!1)}},[W.current]),J.createElement("section",{ref:t,"aria-label":`${S} ${O}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},T.map((M,N)=>{var z;let[U,K]=M.split("-");return w.length?J.createElement("ol",{key:M,dir:v==="auto"?Kb():v,tabIndex:-1,ref:W,className:a,"data-sonner-toaster":!0,"data-theme":E,"data-y-position":U,"data-lifted":B&&w.length>1&&!i,"data-x-position":K,style:{"--front-toast-height":`${((z=F[0])==null?void 0:z.height)||0}px`,"--width":`${MM}px`,"--gap":`${x}px`,...f,...BM(c,u)},onBlur:Q=>{k.current&&!Q.currentTarget.contains(Q.relatedTarget)&&(k.current=!1,H.current&&(H.current.focus({preventScroll:!0}),H.current=null))},onFocus:Q=>{Q.target instanceof HTMLElement&&Q.target.dataset.dismissible==="false"||k.current||(k.current=!0,H.current=Q.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{D||A(!1)},onDragEnd:()=>A(!1),onPointerDown:Q=>{Q.target instanceof HTMLElement&&Q.target.dataset.dismissible==="false"||P(!0)},onPointerUp:()=>P(!1)},w.filter(Q=>!Q.position&&N===0||Q.position===M).map((Q,Y)=>{var Z,ue;return J.createElement(FM,{key:Q.id,icons:b,index:Y,toast:Q,defaultRichColors:h,duration:(Z=g==null?void 0:g.duration)!=null?Z:p,className:g==null?void 0:g.className,descriptionClassName:g==null?void 0:g.descriptionClassName,invert:n,visibleToasts:m,closeButton:(ue=g==null?void 0:g.closeButton)!=null?ue:o,interacting:D,position:M,style:g==null?void 0:g.style,unstyled:g==null?void 0:g.unstyled,classNames:g==null?void 0:g.classNames,cancelButtonStyle:g==null?void 0:g.cancelButtonStyle,actionButtonStyle:g==null?void 0:g.actionButtonStyle,removeToast:I,toasts:w.filter(Oe=>Oe.position==Q.position),heights:F.filter(Oe=>Oe.position==Q.position),setHeights:R,expandByDefault:i,gap:x,loadingIcon:_,expanded:B,pauseWhenPageIsHidden:C,swipeDirections:e.swipeDirections})})):null}))});const tp=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function wl(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function a0(e){return"nodeType"in e}function Fn(e){var t,n;return e?wl(e)?e:a0(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function l0(e){const{Document:t}=Fn(e);return e instanceof t}function Au(e){return wl(e)?!1:e instanceof Fn(e).HTMLElement}function aj(e){return e instanceof Fn(e).SVGElement}function Sl(e){return e?wl(e)?e.document:a0(e)?l0(e)?e:Au(e)||aj(e)?e.ownerDocument:document:document:document}const Vr=tp?y.useLayoutEffect:y.useEffect;function np(e){const t=y.useRef(e);return Vr(()=>{t.current=e}),y.useCallback(function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];return t.current==null?void 0:t.current(...s)},[])}function $M(){const e=y.useRef(null),t=y.useCallback((s,r)=>{e.current=setInterval(s,r)},[]),n=y.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function lu(e,t){t===void 0&&(t=[e]);const n=y.useRef(e);return Vr(()=>{n.current!==e&&(n.current=e)},t),n}function Ou(e,t){const n=y.useRef();return y.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function uf(e){const t=np(e),n=y.useRef(null),s=y.useCallback(r=>{r!==n.current&&(t==null||t(r,n.current)),n.current=r},[]);return[n,s]}function df(e){const t=y.useRef();return y.useEffect(()=>{t.current=e},[e]),t.current}let om={};function sp(e,t){return y.useMemo(()=>{if(t)return t;const n=om[e]==null?0:om[e]+1;return om[e]=n,e+"-"+n},[e,t])}function lj(e){return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),r=1;r<n;r++)s[r-1]=arguments[r];return s.reduce((i,o)=>{const a=Object.entries(o);for(const[c,u]of a){const d=i[c];d!=null&&(i[c]=d+e*u)}return i},{...t})}}const Ba=lj(1),hf=lj(-1);function HM(e){return"clientX"in e&&"clientY"in e}function c0(e){if(!e)return!1;const{KeyboardEvent:t}=Fn(e.target);return t&&e instanceof t}function WM(e){if(!e)return!1;const{TouchEvent:t}=Fn(e.target);return t&&e instanceof t}function ff(e){if(WM(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 HM(e)?{x:e.clientX,y:e.clientY}:null}const cu=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[cu.Translate.toString(e),cu.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),Vb="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function UM(e){return e.matches(Vb)?e:e.querySelector(Vb)}const qM={display:"none"};function KM(e){let{id:t,value:n}=e;return J.createElement("div",{id:t,style:qM},n)}function VM(e){let{id:t,announcement:n,ariaLiveType:s="assertive"}=e;const r={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 J.createElement("div",{id:t,style:r,role:"status","aria-live":s,"aria-atomic":!0},n)}function YM(){const[e,t]=y.useState("");return{announce:y.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const cj=y.createContext(null);function XM(e){const t=y.useContext(cj);y.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function QM(){const[e]=y.useState(()=>new Set),t=y.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[y.useCallback(s=>{let{type:r,event:i}=s;e.forEach(o=>{var a;return(a=o[r])==null?void 0:a.call(o,i)})},[e]),t]}const GM={draggable:`
|
|
452
|
+
To pick up a draggable item, press the space bar.
|
|
453
|
+
While dragging, use the arrow keys to move the item.
|
|
454
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
455
|
+
`},JM={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 ZM(e){let{announcements:t=JM,container:n,hiddenTextDescribedById:s,screenReaderInstructions:r=GM}=e;const{announce:i,announcement:o}=YM(),a=sp("DndLiveRegion"),[c,u]=y.useState(!1);if(y.useEffect(()=>{u(!0)},[]),XM(y.useMemo(()=>({onDragStart(h){let{active:p}=h;i(t.onDragStart({active:p}))},onDragMove(h){let{active:p,over:f}=h;t.onDragMove&&i(t.onDragMove({active:p,over:f}))},onDragOver(h){let{active:p,over:f}=h;i(t.onDragOver({active:p,over:f}))},onDragEnd(h){let{active:p,over:f}=h;i(t.onDragEnd({active:p,over:f}))},onDragCancel(h){let{active:p,over:f}=h;i(t.onDragCancel({active:p,over:f}))}}),[i,t])),!c)return null;const d=J.createElement(J.Fragment,null,J.createElement(KM,{id:s,value:r.draggable}),J.createElement(VM,{id:a,announcement:o}));return n?js.createPortal(d,n):d}var zt;(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"})(zt||(zt={}));function pf(){}function Yb(e,t){return y.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function e3(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.useMemo(()=>[...t].filter(s=>s!=null),[...t])}const Ks=Object.freeze({x:0,y:0});function t3(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function n3(e,t){const n=ff(e);if(!n)return"0 0";const s={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return s.x+"% "+s.y+"%"}function s3(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return n-s}function r3(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function Xb(e){let{left:t,top:n,height:s,width:r}=e;return[{x:t,y:n},{x:t+r,y:n},{x:t,y:n+s},{x:t+r,y:n+s}]}function i3(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}const o3=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const r=Xb(t),i=[];for(const o of s){const{id:a}=o,c=n.get(a);if(c){const u=Xb(c),d=r.reduce((p,f,m)=>p+t3(u[m],f),0),h=Number((d/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:h}})}}return i.sort(s3)};function a3(e,t){const n=Math.max(t.top,e.top),s=Math.max(t.left,e.left),r=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=r-s,a=i-n;if(s<r&&n<i){const c=t.width*t.height,u=e.width*e.height,d=o*a,h=d/(c+u-d);return Number(h.toFixed(4))}return 0}const l3=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const r=[];for(const i of s){const{id:o}=i,a=n.get(o);if(a){const c=a3(a,t);c>0&&r.push({id:o,data:{droppableContainer:i,value:c}})}}return r.sort(r3)};function c3(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function uj(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ks}function u3(e){return function(n){for(var s=arguments.length,r=new Array(s>1?s-1:0),i=1;i<s;i++)r[i-1]=arguments[i];return r.reduce((o,a)=>({...o,top:o.top+e*a.y,bottom:o.bottom+e*a.y,left:o.left+e*a.x,right:o.right+e*a.x}),{...n})}}const d3=u3(1);function dj(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 h3(e,t,n){const s=dj(t);if(!s)return e;const{scaleX:r,scaleY:i,x:o,y:a}=s,c=e.left-o-(1-r)*parseFloat(n),u=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=r?e.width/r:e.width,h=i?e.height/i:e.height;return{width:d,height:h,top:u,right:c+d,bottom:u+h,left:c}}const f3={ignoreTransform:!1};function Iu(e,t){t===void 0&&(t=f3);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=Fn(e).getComputedStyle(e);u&&(n=h3(n,u,d))}const{top:s,left:r,width:i,height:o,bottom:a,right:c}=n;return{top:s,left:r,width:i,height:o,bottom:a,right:c}}function Qb(e){return Iu(e,{ignoreTransform:!0})}function p3(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function m3(e,t){return t===void 0&&(t=Fn(e).getComputedStyle(e)),t.position==="fixed"}function g3(e,t){t===void 0&&(t=Fn(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{const i=t[r];return typeof i=="string"?n.test(i):!1})}function u0(e,t){const n=[];function s(r){if(t!=null&&n.length>=t||!r)return n;if(l0(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!Au(r)||aj(r)||n.includes(r))return n;const i=Fn(e).getComputedStyle(r);return r!==e&&g3(r,i)&&n.push(r),m3(r,i)?n:s(r.parentNode)}return e?s(e):n}function hj(e){const[t]=u0(e,1);return t??null}function am(e){return!tp||!e?null:wl(e)?e:a0(e)?l0(e)||e===Sl(e).scrollingElement?window:Au(e)?e:null:null}function fj(e){return wl(e)?e.scrollX:e.scrollLeft}function pj(e){return wl(e)?e.scrollY:e.scrollTop}function Dx(e){return{x:fj(e),y:pj(e)}}var Gt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Gt||(Gt={}));function mj(e){return!tp||!e?!1:e===document.scrollingElement}function gj(e){const t={x:0,y:0},n=mj(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},r=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,o=e.scrollTop>=s.y,a=e.scrollLeft>=s.x;return{isTop:r,isLeft:i,isBottom:o,isRight:a,maxScroll:s,minScroll:t}}const x3={x:.2,y:.2};function v3(e,t,n,s,r){let{top:i,left:o,right:a,bottom:c}=n;s===void 0&&(s=10),r===void 0&&(r=x3);const{isTop:u,isBottom:d,isLeft:h,isRight:p}=gj(e),f={x:0,y:0},m={x:0,y:0},g={height:t.height*r.y,width:t.width*r.x};return!u&&i<=t.top+g.height?(f.y=Gt.Backward,m.y=s*Math.abs((t.top+g.height-i)/g.height)):!d&&c>=t.bottom-g.height&&(f.y=Gt.Forward,m.y=s*Math.abs((t.bottom-g.height-c)/g.height)),!p&&a>=t.right-g.width?(f.x=Gt.Forward,m.x=s*Math.abs((t.right-g.width-a)/g.width)):!h&&o<=t.left+g.width&&(f.x=Gt.Backward,m.x=s*Math.abs((t.left+g.width-o)/g.width)),{direction:f,speed:m}}function y3(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:s,bottom:r}=e.getBoundingClientRect();return{top:t,left:n,right:s,bottom:r,width:e.clientWidth,height:e.clientHeight}}function xj(e){return e.reduce((t,n)=>Ba(t,Dx(n)),Ks)}function _3(e){return e.reduce((t,n)=>t+fj(n),0)}function b3(e){return e.reduce((t,n)=>t+pj(n),0)}function vj(e,t){if(t===void 0&&(t=Iu),!e)return;const{top:n,left:s,bottom:r,right:i}=t(e);hj(e)&&(r<=0||i<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const w3=[["x",["left","right"],_3],["y",["top","bottom"],b3]];class d0{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 s=u0(n),r=xj(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,a]of w3)for(const c of o)Object.defineProperty(this,c,{get:()=>{const u=a(s),d=r[i]-u;return this.rect[c]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Pc{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})},this.target=t}add(t,n,s){var r;(r=this.target)==null||r.addEventListener(t,n,s),this.listeners.push([t,n,s])}}function S3(e){const{EventTarget:t}=Fn(e);return e instanceof t?e:Sl(e)}function lm(e,t){const n=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+s**2)>t:"x"in t&&"y"in t?n>t.x&&s>t.y:"x"in t?n>t.x:"y"in t?s>t.y:!1}var _s;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(_s||(_s={}));function Gb(e){e.preventDefault()}function k3(e){e.stopPropagation()}var Xe;(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"})(Xe||(Xe={}));const yj={start:[Xe.Space,Xe.Enter],cancel:[Xe.Esc],end:[Xe.Space,Xe.Enter,Xe.Tab]},C3=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Xe.Right:return{...n,x:n.x+25};case Xe.Left:return{...n,x:n.x-25};case Xe.Down:return{...n,y:n.y+25};case Xe.Up:return{...n,y:n.y-25}}};class h0{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 Pc(Sl(n)),this.windowListeners=new Pc(Fn(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(_s.Resize,this.handleCancel),this.windowListeners.add(_s.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(_s.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,s=t.node.current;s&&vj(s),n(Ks)}handleKeyDown(t){if(c0(t)){const{active:n,context:s,options:r}=this.props,{keyboardCodes:i=yj,coordinateGetter:o=C3,scrollBehavior:a="smooth"}=r,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=s.current,d=u?{x:u.left,y:u.top}:Ks;this.referenceCoordinates||(this.referenceCoordinates=d);const h=o(t,{active:n,context:s.current,currentCoordinates:d});if(h){const p=hf(h,d),f={x:0,y:0},{scrollableAncestors:m}=s.current;for(const g of m){const v=t.code,{isTop:x,isRight:_,isLeft:b,isBottom:S,maxScroll:C,minScroll:w}=gj(g),j=y3(g),T={x:Math.min(v===Xe.Right?j.right-j.width/2:j.right,Math.max(v===Xe.Right?j.left:j.left+j.width/2,h.x)),y:Math.min(v===Xe.Down?j.bottom-j.height/2:j.bottom,Math.max(v===Xe.Down?j.top:j.top+j.height/2,h.y))},F=v===Xe.Right&&!_||v===Xe.Left&&!b,R=v===Xe.Down&&!S||v===Xe.Up&&!x;if(F&&T.x!==h.x){const B=g.scrollLeft+p.x,A=v===Xe.Right&&B<=C.x||v===Xe.Left&&B>=w.x;if(A&&!p.y){g.scrollTo({left:B,behavior:a});return}A?f.x=g.scrollLeft-B:f.x=v===Xe.Right?g.scrollLeft-C.x:g.scrollLeft-w.x,f.x&&g.scrollBy({left:-f.x,behavior:a});break}else if(R&&T.y!==h.y){const B=g.scrollTop+p.y,A=v===Xe.Down&&B<=C.y||v===Xe.Up&&B>=w.y;if(A&&!p.x){g.scrollTo({top:B,behavior:a});return}A?f.y=g.scrollTop-B:f.y=v===Xe.Down?g.scrollTop-C.y:g.scrollTop-w.y,f.y&&g.scrollBy({top:-f.y,behavior:a});break}}this.handleMove(t,Ba(hf(h,this.referenceCoordinates),f))}}}handleMove(t,n){const{onMove:s}=this.props;t.preventDefault(),s(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()}}h0.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=yj,onActivation:r}=t,{active:i}=n;const{code:o}=e.nativeEvent;if(s.start.includes(o)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),r==null||r({event:e.nativeEvent}),!0)}return!1}}];function Jb(e){return!!(e&&"distance"in e)}function Zb(e){return!!(e&&"delay"in e)}class f0{constructor(t,n,s){var r;s===void 0&&(s=S3(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=Sl(o),this.documentListeners=new Pc(this.document),this.listeners=new Pc(s),this.windowListeners=new Pc(Fn(o)),this.initialCoordinates=(r=ff(i))!=null?r:Ks,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:s}}}=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(_s.Resize,this.handleCancel),this.windowListeners.add(_s.DragStart,Gb),this.windowListeners.add(_s.VisibilityChange,this.handleCancel),this.windowListeners.add(_s.ContextMenu,Gb),this.documentListeners.add(_s.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Zb(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Jb(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:s,onPending:r}=this.props;r(s,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(_s.Click,k3,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(_s.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:s,initialCoordinates:r,props:i}=this,{onMove:o,options:{activationConstraint:a}}=i;if(!r)return;const c=(n=ff(t))!=null?n:Ks,u=hf(r,c);if(!s&&a){if(Jb(a)){if(a.tolerance!=null&&lm(u,a.tolerance))return this.handleCancel();if(lm(u,a.distance))return this.handleStart()}if(Zb(a)&&lm(u,a.tolerance))return this.handleCancel();this.handlePending(a,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===Xe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const N3={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class p0 extends f0{constructor(t){const{event:n}=t,s=Sl(n.target);super(t,N3,s)}}p0.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return!n.isPrimary||n.button!==0?!1:(s==null||s({event:n}),!0)}}];const j3={move:{name:"mousemove"},end:{name:"mouseup"}};var Mx;(function(e){e[e.RightClick=2]="RightClick"})(Mx||(Mx={}));class E3 extends f0{constructor(t){super(t,j3,Sl(t.event.target))}}E3.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===Mx.RightClick?!1:(s==null||s({event:n}),!0)}}];const cm={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class P3 extends f0{constructor(t){super(t,cm)}static setup(){return window.addEventListener(cm.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(cm.move.name,t)};function t(){}}}P3.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;const{touches:r}=n;return r.length>1?!1:(s==null||s({event:n}),!0)}}];var Tc;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Tc||(Tc={}));var mf;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(mf||(mf={}));function T3(e){let{acceleration:t,activator:n=Tc.Pointer,canScroll:s,draggingRect:r,enabled:i,interval:o=5,order:a=mf.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:h,threshold:p}=e;const f=D3({delta:h,disabled:!i}),[m,g]=$M(),v=y.useRef({x:0,y:0}),x=y.useRef({x:0,y:0}),_=y.useMemo(()=>{switch(n){case Tc.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Tc.DraggableRect:return r}},[n,r,c]),b=y.useRef(null),S=y.useCallback(()=>{const w=b.current;if(!w)return;const j=v.current.x*x.current.x,T=v.current.y*x.current.y;w.scrollBy(j,T)},[]),C=y.useMemo(()=>a===mf.TreeOrder?[...u].reverse():u,[a,u]);y.useEffect(()=>{if(!i||!u.length||!_){g();return}for(const w of C){if((s==null?void 0:s(w))===!1)continue;const j=u.indexOf(w),T=d[j];if(!T)continue;const{direction:F,speed:R}=v3(w,T,_,t,p);for(const B of["x","y"])f[B][F[B]]||(R[B]=0,F[B]=0);if(R.x>0||R.y>0){g(),b.current=w,m(S,o),v.current=R,x.current=F;return}}v.current={x:0,y:0},x.current={x:0,y:0},g()},[t,S,s,g,i,o,JSON.stringify(_),JSON.stringify(f),m,u,C,d,JSON.stringify(p)])}const R3={x:{[Gt.Backward]:!1,[Gt.Forward]:!1},y:{[Gt.Backward]:!1,[Gt.Forward]:!1}};function D3(e){let{delta:t,disabled:n}=e;const s=df(t);return Ou(r=>{if(n||!s||!r)return R3;const i={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[Gt.Backward]:r.x[Gt.Backward]||i.x===-1,[Gt.Forward]:r.x[Gt.Forward]||i.x===1},y:{[Gt.Backward]:r.y[Gt.Backward]||i.y===-1,[Gt.Forward]:r.y[Gt.Forward]||i.y===1}}},[n,t,s])}function M3(e,t){const n=t!=null?e.get(t):void 0,s=n?n.node.current:null;return Ou(r=>{var i;return t==null?null:(i=s??r)!=null?i:null},[s,t])}function L3(e,t){return y.useMemo(()=>e.reduce((n,s)=>{const{sensor:r}=s,i=r.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,s)}));return[...n,...i]},[]),[e,t])}var uu;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(uu||(uu={}));var Lx;(function(e){e.Optimized="optimized"})(Lx||(Lx={}));const ew=new Map;function A3(e,t){let{dragging:n,dependencies:s,config:r}=t;const[i,o]=y.useState(null),{frequency:a,measure:c,strategy:u}=r,d=y.useRef(e),h=v(),p=lu(h),f=y.useCallback(function(x){x===void 0&&(x=[]),!p.current&&o(_=>_===null?x:_.concat(x.filter(b=>!_.includes(b))))},[p]),m=y.useRef(null),g=Ou(x=>{if(h&&!n)return ew;if(!x||x===ew||d.current!==e||i!=null){const _=new Map;for(let b of e){if(!b)continue;if(i&&i.length>0&&!i.includes(b.id)&&b.rect.current){_.set(b.id,b.rect.current);continue}const S=b.node.current,C=S?new d0(c(S),S):null;b.rect.current=C,C&&_.set(b.id,C)}return _}return x},[e,i,n,h,c]);return y.useEffect(()=>{d.current=e},[e]),y.useEffect(()=>{h||f()},[n,h]),y.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),y.useEffect(()=>{h||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{f(),m.current=null},a))},[a,h,f,...s]),{droppableRects:g,measureDroppableContainers:f,measuringScheduled:i!=null};function v(){switch(u){case uu.Always:return!1;case uu.BeforeDragging:return n;default:return!n}}}function m0(e,t){return Ou(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function O3(e,t){return m0(e,t)}function I3(e){let{callback:t,disabled:n}=e;const s=np(t),r=y.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(s)},[s,n]);return y.useEffect(()=>()=>r==null?void 0:r.disconnect(),[r]),r}function rp(e){let{callback:t,disabled:n}=e;const s=np(t),r=y.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(s)},[n]);return y.useEffect(()=>()=>r==null?void 0:r.disconnect(),[r]),r}function F3(e){return new d0(Iu(e),e)}function tw(e,t,n){t===void 0&&(t=F3);const[s,r]=y.useState(null);function i(){r(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??n)!=null?u:null}const d=t(e);return JSON.stringify(c)===JSON.stringify(d)?c:d})}const o=I3({callback(c){if(e)for(const u of c){const{type:d,target:h}=u;if(d==="childList"&&h instanceof HTMLElement&&h.contains(e)){i();break}}}}),a=rp({callback:i});return Vr(()=>{i(),e?(a==null||a.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[e]),s}function B3(e){const t=m0(e);return uj(e,t)}const nw=[];function z3(e){const t=y.useRef(e),n=Ou(s=>e?s&&s!==nw&&e&&t.current&&e.parentNode===t.current.parentNode?s:u0(e):nw,[e]);return y.useEffect(()=>{t.current=e},[e]),n}function $3(e){const[t,n]=y.useState(null),s=y.useRef(e),r=y.useCallback(i=>{const o=am(i.target);o&&n(a=>a?(a.set(o,Dx(o)),new Map(a)):null)},[]);return y.useEffect(()=>{const i=s.current;if(e!==i){o(i);const a=e.map(c=>{const u=am(c);return u?(u.addEventListener("scroll",r,{passive:!0}),[u,Dx(u)]):null}).filter(c=>c!=null);n(a.length?new Map(a):null),s.current=e}return()=>{o(e),o(i)};function o(a){a.forEach(c=>{const u=am(c);u==null||u.removeEventListener("scroll",r)})}},[r,e]),y.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>Ba(i,o),Ks):xj(e):Ks,[e,t])}function sw(e,t){t===void 0&&(t=[]);const n=y.useRef(null);return y.useEffect(()=>{n.current=null},t),y.useEffect(()=>{const s=e!==Ks;s&&!n.current&&(n.current=e),!s&&n.current&&(n.current=null)},[e]),n.current?hf(e,n.current):Ks}function H3(e){y.useEffect(()=>{if(!tp)return;const t=e.map(n=>{let{sensor:s}=n;return s.setup==null?void 0:s.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function W3(e,t){return y.useMemo(()=>e.reduce((n,s)=>{let{eventName:r,handler:i}=s;return n[r]=o=>{i(o,t)},n},{}),[e,t])}function _j(e){return y.useMemo(()=>e?p3(e):null,[e])}const rw=[];function U3(e,t){t===void 0&&(t=Iu);const[n]=e,s=_j(n?Fn(n):null),[r,i]=y.useState(rw);function o(){i(()=>e.length?e.map(c=>mj(c)?s:new d0(t(c),c)):rw)}const a=rp({callback:o});return Vr(()=>{a==null||a.disconnect(),o(),e.forEach(c=>a==null?void 0:a.observe(c))},[e]),r}function bj(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Au(t)?t:e}function q3(e){let{measure:t}=e;const[n,s]=y.useState(null),r=y.useCallback(u=>{for(const{target:d}of u)if(Au(d)){s(h=>{const p=t(d);return h?{...h,width:p.width,height:p.height}:p});break}},[t]),i=rp({callback:r}),o=y.useCallback(u=>{const d=bj(u);i==null||i.disconnect(),d&&(i==null||i.observe(d)),s(d?t(d):null)},[t,i]),[a,c]=uf(o);return y.useMemo(()=>({nodeRef:a,rect:n,setRef:c}),[n,a,c])}const K3=[{sensor:p0,options:{}},{sensor:h0,options:{}}],V3={current:{}},xh={draggable:{measure:Qb},droppable:{measure:Qb,strategy:uu.WhileDragging,frequency:Lx.Optimized},dragOverlay:{measure:Iu}};class Rc 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,s;return(n=(s=this.get(t))==null?void 0:s.node.current)!=null?n:void 0}}const Y3={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Rc,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:pf},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:xh,measureDroppableContainers:pf,windowRect:null,measuringScheduled:!1},wj={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:pf,draggableNodes:new Map,over:null,measureDroppableContainers:pf},Fu=y.createContext(wj),Sj=y.createContext(Y3);function X3(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Rc}}}function Q3(e,t){switch(t.type){case zt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case zt.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 zt.DragEnd:case zt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case zt.RegisterDroppable:{const{element:n}=t,{id:s}=n,r=new Rc(e.droppable.containers);return r.set(s,n),{...e,droppable:{...e.droppable,containers:r}}}case zt.SetDroppableDisabled:{const{id:n,key:s,disabled:r}=t,i=e.droppable.containers.get(n);if(!i||s!==i.key)return e;const o=new Rc(e.droppable.containers);return o.set(n,{...i,disabled:r}),{...e,droppable:{...e.droppable,containers:o}}}case zt.UnregisterDroppable:{const{id:n,key:s}=t,r=e.droppable.containers.get(n);if(!r||s!==r.key)return e;const i=new Rc(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function G3(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:r}=y.useContext(Fu),i=df(s),o=df(n==null?void 0:n.id);return y.useEffect(()=>{if(!t&&!s&&i&&o!=null){if(!c0(i)||document.activeElement===i.target)return;const a=r.get(o);if(!a)return;const{activatorNode:c,node:u}=a;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const d of[c.current,u.current]){if(!d)continue;const h=UM(d);if(h){h.focus();break}}})}},[s,t,r,o,i]),null}function kj(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((r,i)=>i({transform:r,...s}),n):n}function J3(e){return y.useMemo(()=>({draggable:{...xh.draggable,...e==null?void 0:e.draggable},droppable:{...xh.droppable,...e==null?void 0:e.droppable},dragOverlay:{...xh.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 Z3(e){let{activeNode:t,measure:n,initialRect:s,config:r=!0}=e;const i=y.useRef(!1),{x:o,y:a}=typeof r=="boolean"?{x:r,y:r}:r;Vr(()=>{if(!o&&!a||!t){i.current=!1;return}if(i.current||!s)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const d=n(u),h=uj(d,s);if(o||(h.x=0),a||(h.y=0),i.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const p=hj(u);p&&p.scrollBy({top:h.y,left:h.x})}},[t,o,a,s,n])}const ip=y.createContext({...Ks,scaleX:1,scaleY:1});var ui;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ui||(ui={}));const eL=y.memo(function(t){var n,s,r,i;let{id:o,accessibility:a,autoScroll:c=!0,children:u,sensors:d=K3,collisionDetection:h=l3,measuring:p,modifiers:f,...m}=t;const g=y.useReducer(Q3,void 0,X3),[v,x]=g,[_,b]=QM(),[S,C]=y.useState(ui.Uninitialized),w=S===ui.Initialized,{draggable:{active:j,nodes:T,translate:F},droppable:{containers:R}}=v,B=j!=null?T.get(j):null,A=y.useRef({initial:null,translated:null}),D=y.useMemo(()=>{var De;return j!=null?{id:j,data:(De=B==null?void 0:B.data)!=null?De:V3,rect:A}:null},[j,B]),P=y.useRef(null),[E,$]=y.useState(null),[W,O]=y.useState(null),H=lu(m,Object.values(m)),k=sp("DndDescribedBy",o),I=y.useMemo(()=>R.getEnabled(),[R]),M=J3(p),{droppableRects:N,measureDroppableContainers:z,measuringScheduled:U}=A3(I,{dragging:w,dependencies:[F.x,F.y],config:M.droppable}),K=M3(T,j),Q=y.useMemo(()=>W?ff(W):null,[W]),Y=ae(),Z=O3(K,M.draggable.measure);Z3({activeNode:j!=null?T.get(j):null,config:Y.layoutShiftCompensation,initialRect:Z,measure:M.draggable.measure});const ue=tw(K,M.draggable.measure,Z),Oe=tw(K?K.parentElement:null),Re=y.useRef({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:R,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),fe=R.getNodeFor((n=Re.current.over)==null?void 0:n.id),Ie=q3({measure:M.dragOverlay.measure}),Ut=(s=Ie.nodeRef.current)!=null?s:K,sn=w?(r=Ie.rect)!=null?r:ue:null,se=!!(Ie.nodeRef.current&&Ie.rect),de=B3(se?null:ue),Ee=_j(Ut?Fn(Ut):null),We=z3(w?fe??K:null),Ue=U3(We),wt=kj(f,{transform:{x:F.x-de.x,y:F.y-de.y,scaleX:1,scaleY:1},activatorEvent:W,active:D,activeNodeRect:ue,containerNodeRect:Oe,draggingNodeRect:sn,over:Re.current.over,overlayNodeRect:Ie.rect,scrollableAncestors:We,scrollableAncestorRects:Ue,windowRect:Ee}),ft=Q?Ba(Q,F):null,pn=$3(We),Sr=sw(pn),q=sw(pn,[ue]),ee=Ba(wt,Sr),ge=sn?d3(sn,wt):null,ye=D&&ge?h({active:D,collisionRect:ge,droppableRects:N,droppableContainers:I,pointerCoordinates:ft}):null,ke=i3(ye,"id"),[it,rn]=y.useState(null),qt=se?wt:Ba(wt,q),on=c3(qt,(i=it==null?void 0:it.rect)!=null?i:null,ue),En=y.useRef(null),Ge=y.useCallback((De,He)=>{let{sensor:Nt,options:pe}=He;if(P.current==null)return;const _e=T.get(P.current);if(!_e)return;const Se=De.nativeEvent,tt=new Nt({active:P.current,activeNode:_e,event:Se,options:pe,context:Re,onAbort(Je){if(!T.get(Je))return;const{onDragAbort:pt}=H.current,Vt={id:Je};pt==null||pt(Vt),_({type:"onDragAbort",event:Vt})},onPending(Je,mn,pt,Vt){if(!T.get(Je))return;const{onDragPending:Dl}=H.current,Jr={id:Je,constraint:mn,initialCoordinates:pt,offset:Vt};Dl==null||Dl(Jr),_({type:"onDragPending",event:Jr})},onStart(Je){const mn=P.current;if(mn==null)return;const pt=T.get(mn);if(!pt)return;const{onDragStart:Vt}=H.current,Rl={activatorEvent:Se,active:{id:mn,data:pt.data,rect:A}};js.unstable_batchedUpdates(()=>{Vt==null||Vt(Rl),C(ui.Initializing),x({type:zt.DragStart,initialCoordinates:Je,active:mn}),_({type:"onDragStart",event:Rl}),$(En.current),O(Se)})},onMove(Je){x({type:zt.DragMove,coordinates:Je})},onEnd:Kt(zt.DragEnd),onCancel:Kt(zt.DragCancel)});En.current=tt;function Kt(Je){return async function(){const{active:pt,collisions:Vt,over:Rl,scrollAdjustedTranslate:Dl}=Re.current;let Jr=null;if(pt&&Dl){const{cancelDrop:Ml}=H.current;Jr={activatorEvent:Se,active:pt,collisions:Vt,delta:Dl,over:Rl},Je===zt.DragEnd&&typeof Ml=="function"&&await Promise.resolve(Ml(Jr))&&(Je=zt.DragCancel)}P.current=null,js.unstable_batchedUpdates(()=>{x({type:Je}),C(ui.Uninitialized),rn(null),$(null),O(null),En.current=null;const Ml=Je===zt.DragEnd?"onDragEnd":"onDragCancel";if(Jr){const Dp=H.current[Ml];Dp==null||Dp(Jr),_({type:Ml,event:Jr})}})}}},[T]),ts=y.useCallback((De,He)=>(Nt,pe)=>{const _e=Nt.nativeEvent,Se=T.get(pe);if(P.current!==null||!Se||_e.dndKit||_e.defaultPrevented)return;const tt={active:Se};De(Nt,He.options,tt)===!0&&(_e.dndKit={capturedBy:He.sensor},P.current=pe,Ge(Nt,He))},[T,Ge]),an=L3(d,ts);H3(d),Vr(()=>{ue&&S===ui.Initializing&&C(ui.Initialized)},[ue,S]),y.useEffect(()=>{const{onDragMove:De}=H.current,{active:He,activatorEvent:Nt,collisions:pe,over:_e}=Re.current;if(!He||!Nt)return;const Se={active:He,activatorEvent:Nt,collisions:pe,delta:{x:ee.x,y:ee.y},over:_e};js.unstable_batchedUpdates(()=>{De==null||De(Se),_({type:"onDragMove",event:Se})})},[ee.x,ee.y]),y.useEffect(()=>{const{active:De,activatorEvent:He,collisions:Nt,droppableContainers:pe,scrollAdjustedTranslate:_e}=Re.current;if(!De||P.current==null||!He||!_e)return;const{onDragOver:Se}=H.current,tt=pe.get(ke),Kt=tt&&tt.rect.current?{id:tt.id,rect:tt.rect.current,data:tt.data,disabled:tt.disabled}:null,Je={active:De,activatorEvent:He,collisions:Nt,delta:{x:_e.x,y:_e.y},over:Kt};js.unstable_batchedUpdates(()=>{rn(Kt),Se==null||Se(Je),_({type:"onDragOver",event:Je})})},[ke]),Vr(()=>{Re.current={activatorEvent:W,active:D,activeNode:K,collisionRect:ge,collisions:ye,droppableRects:N,draggableNodes:T,draggingNode:Ut,draggingNodeRect:sn,droppableContainers:R,over:it,scrollableAncestors:We,scrollAdjustedTranslate:ee},A.current={initial:sn,translated:ge}},[D,K,ye,ge,T,Ut,sn,N,R,it,We,ee]),T3({...Y,delta:F,draggingRect:ge,pointerCoordinates:ft,scrollableAncestors:We,scrollableAncestorRects:Ue});const to=y.useMemo(()=>({active:D,activeNode:K,activeNodeRect:ue,activatorEvent:W,collisions:ye,containerNodeRect:Oe,dragOverlay:Ie,draggableNodes:T,droppableContainers:R,droppableRects:N,over:it,measureDroppableContainers:z,scrollableAncestors:We,scrollableAncestorRects:Ue,measuringConfiguration:M,measuringScheduled:U,windowRect:Ee}),[D,K,ue,W,ye,Oe,Ie,T,R,N,it,z,We,Ue,M,U,Ee]),X=y.useMemo(()=>({activatorEvent:W,activators:an,active:D,activeNodeRect:ue,ariaDescribedById:{draggable:k},dispatch:x,draggableNodes:T,over:it,measureDroppableContainers:z}),[W,an,D,ue,x,k,T,it,z]);return J.createElement(cj.Provider,{value:b},J.createElement(Fu.Provider,{value:X},J.createElement(Sj.Provider,{value:to},J.createElement(ip.Provider,{value:on},u)),J.createElement(G3,{disabled:(a==null?void 0:a.restoreFocus)===!1})),J.createElement(ZM,{...a,hiddenTextDescribedById:k}));function ae(){const De=(E==null?void 0:E.autoScrollEnabled)===!1,He=typeof c=="object"?c.enabled===!1:c===!1,Nt=w&&!De&&!He;return typeof c=="object"?{...c,enabled:Nt}:{enabled:Nt}}}),tL=y.createContext(null),iw="button",nL="Draggable";function sL(e){let{id:t,data:n,disabled:s=!1,attributes:r}=e;const i=sp(nL),{activators:o,activatorEvent:a,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:h,over:p}=y.useContext(Fu),{role:f=iw,roleDescription:m="draggable",tabIndex:g=0}=r??{},v=(c==null?void 0:c.id)===t,x=y.useContext(v?ip:tL),[_,b]=uf(),[S,C]=uf(),w=W3(o,t),j=lu(n);Vr(()=>(h.set(t,{id:t,key:i,node:_,activatorNode:S,data:j}),()=>{const F=h.get(t);F&&F.key===i&&h.delete(t)}),[h,t]);const T=y.useMemo(()=>({role:f,tabIndex:g,"aria-disabled":s,"aria-pressed":v&&f===iw?!0:void 0,"aria-roledescription":m,"aria-describedby":d.draggable}),[s,f,g,v,m,d.draggable]);return{active:c,activatorEvent:a,activeNodeRect:u,attributes:T,isDragging:v,listeners:s?void 0:w,node:_,over:p,setNodeRef:b,setActivatorNodeRef:C,transform:x}}function rL(){return y.useContext(Sj)}const iL="Droppable",oL={timeout:25};function aL(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:r}=e;const i=sp(iL),{active:o,dispatch:a,over:c,measureDroppableContainers:u}=y.useContext(Fu),d=y.useRef({disabled:n}),h=y.useRef(!1),p=y.useRef(null),f=y.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:v}={...oL,...r},x=lu(g??s),_=y.useCallback(()=>{if(!h.current){h.current=!0;return}f.current!=null&&clearTimeout(f.current),f.current=setTimeout(()=>{u(Array.isArray(x.current)?x.current:[x.current]),f.current=null},v)},[v]),b=rp({callback:_,disabled:m||!o}),S=y.useCallback((T,F)=>{b&&(F&&(b.unobserve(F),h.current=!1),T&&b.observe(T))},[b]),[C,w]=uf(S),j=lu(t);return y.useEffect(()=>{!b||!C.current||(b.disconnect(),h.current=!1,b.observe(C.current))},[C,b]),y.useEffect(()=>(a({type:zt.RegisterDroppable,element:{id:s,key:i,disabled:n,node:C,rect:p,data:j}}),()=>a({type:zt.UnregisterDroppable,key:i,id:s})),[s]),y.useEffect(()=>{n!==d.current.disabled&&(a({type:zt.SetDroppableDisabled,id:s,key:i,disabled:n}),d.current.disabled=n)},[s,i,n,a]),{active:o,rect:p,isOver:(c==null?void 0:c.id)===s,node:C,over:c,setNodeRef:w}}function lL(e){let{animation:t,children:n}=e;const[s,r]=y.useState(null),[i,o]=y.useState(null),a=df(n);return!n&&!s&&a&&r(a),Vr(()=>{if(!i)return;const c=s==null?void 0:s.key,u=s==null?void 0:s.props.id;if(c==null||u==null){r(null);return}Promise.resolve(t(u,i)).then(()=>{r(null)})},[t,s,i]),J.createElement(J.Fragment,null,n,s?y.cloneElement(s,{ref:o}):null)}const cL={x:0,y:0,scaleX:1,scaleY:1};function uL(e){let{children:t}=e;return J.createElement(Fu.Provider,{value:wj},J.createElement(ip.Provider,{value:cL},t))}const dL={position:"fixed",touchAction:"none"},hL=e=>c0(e)?"transform 250ms ease":void 0,fL=y.forwardRef((e,t)=>{let{as:n,activatorEvent:s,adjustScale:r,children:i,className:o,rect:a,style:c,transform:u,transition:d=hL}=e;if(!a)return null;const h=r?u:{...u,scaleX:1,scaleY:1},p={...dL,width:a.width,height:a.height,top:a.top,left:a.left,transform:cu.Transform.toString(h),transformOrigin:r&&s?n3(s,a):void 0,transition:typeof d=="function"?d(s):d,...c};return J.createElement(n,{className:o,style:p,ref:t},i)}),Cj=e=>t=>{let{active:n,dragOverlay:s}=t;const r={},{styles:i,className:o}=e;if(i!=null&&i.active)for(const[a,c]of Object.entries(i.active))c!==void 0&&(r[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,c));if(i!=null&&i.dragOverlay)for(const[a,c]of Object.entries(i.dragOverlay))c!==void 0&&s.node.style.setProperty(a,c);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&s.node.classList.add(o.dragOverlay),function(){for(const[c,u]of Object.entries(r))n.node.style.setProperty(c,u);o!=null&&o.active&&n.node.classList.remove(o.active)}},pL=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:cu.Transform.toString(t)},{transform:cu.Transform.toString(n)}]},mL={duration:250,easing:"ease",keyframes:pL,sideEffects:Cj({styles:{active:{opacity:"0"}}})};function gL(e){let{config:t,draggableNodes:n,droppableContainers:s,measuringConfiguration:r}=e;return np((i,o)=>{if(t===null)return;const a=n.get(i);if(!a)return;const c=a.node.current;if(!c)return;const u=bj(o);if(!u)return;const{transform:d}=Fn(o).getComputedStyle(o),h=dj(d);if(!h)return;const p=typeof t=="function"?t:xL(t);return vj(c,r.draggable.measure),p({active:{id:i,data:a.data,node:c,rect:r.draggable.measure(c)},draggableNodes:n,dragOverlay:{node:o,rect:r.dragOverlay.measure(u)},droppableContainers:s,measuringConfiguration:r,transform:h})})}function xL(e){const{duration:t,easing:n,sideEffects:s,keyframes:r}={...mL,...e};return i=>{let{active:o,dragOverlay:a,transform:c,...u}=i;if(!t)return;const d={x:a.rect.left-o.rect.left,y:a.rect.top-o.rect.top},h={scaleX:c.scaleX!==1?o.rect.width*c.scaleX/a.rect.width:1,scaleY:c.scaleY!==1?o.rect.height*c.scaleY/a.rect.height:1},p={x:c.x-d.x,y:c.y-d.y,...h},f=r({...u,active:o,dragOverlay:a,transform:{initial:c,final:p}}),[m]=f,g=f[f.length-1];if(JSON.stringify(m)===JSON.stringify(g))return;const v=s==null?void 0:s({active:o,dragOverlay:a,...u}),x=a.node.animate(f,{duration:t,easing:n,fill:"forwards"});return new Promise(_=>{x.onfinish=()=>{v==null||v(),_()}})}}let ow=0;function vL(e){return y.useMemo(()=>{if(e!=null)return ow++,ow},[e])}const yL=J.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:s,style:r,transition:i,modifiers:o,wrapperElement:a="div",className:c,zIndex:u=999}=e;const{activatorEvent:d,active:h,activeNodeRect:p,containerNodeRect:f,draggableNodes:m,droppableContainers:g,dragOverlay:v,over:x,measuringConfiguration:_,scrollableAncestors:b,scrollableAncestorRects:S,windowRect:C}=rL(),w=y.useContext(ip),j=vL(h==null?void 0:h.id),T=kj(o,{activatorEvent:d,active:h,activeNodeRect:p,containerNodeRect:f,draggingNodeRect:v.rect,over:x,overlayNodeRect:v.rect,scrollableAncestors:b,scrollableAncestorRects:S,transform:w,windowRect:C}),F=m0(p),R=gL({config:s,draggableNodes:m,droppableContainers:g,measuringConfiguration:_}),B=F?v.setRef:void 0;return J.createElement(uL,null,J.createElement(lL,{animation:R},h&&j?J.createElement(fL,{key:j,id:h.id,ref:B,as:a,activatorEvent:d,adjustScale:t,className:c,transition:i,rect:F,style:{zIndex:u,...r},transform:T},n):null))}),aw=["backlog","todo","in_progress","in_review","done"],Bt={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"};var op={exports:{}},Nj={},jj={exports:{}},_L="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",bL=_L,wL=bL;function Ej(){}function Pj(){}Pj.resetWarningCache=Ej;var SL=function(){function e(s,r,i,o,a,c){if(c!==wL){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:Pj,resetWarningCache:Ej};return n.PropTypes=n,n};jj.exports=SL();var Tj=jj.exports;function Rj(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Rj(e[t]))&&(s&&(s+=" "),s+=n);else for(t in e)e[t]&&(s&&(s+=" "),s+=t);return s}function lw(){for(var e,t,n=0,s="";n<arguments.length;)(e=arguments[n++])&&(t=Rj(e))&&(s&&(s+=" "),s+=t);return s}const kL=Object.freeze(Object.defineProperty({__proto__:null,clsx:lw,default:lw},Symbol.toStringTag,{value:"Module"})),CL=T4(kL);var _t={},_r={};Object.defineProperty(_r,"__esModule",{value:!0});_r.dontSetMe=TL;_r.findInArray=NL;_r.int=PL;_r.isFunction=jL;_r.isNum=EL;function NL(e,t){for(let n=0,s=e.length;n<s;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function jL(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function EL(e){return typeof e=="number"&&!isNaN(e)}function PL(e){return parseInt(e,10)}function TL(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 sa={};Object.defineProperty(sa,"__esModule",{value:!0});sa.browserPrefixToKey=Mj;sa.browserPrefixToStyle=RL;sa.default=void 0;sa.getPrefix=Dj;const um=["Moz","Webkit","O","ms"];function Dj(){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 s=0;s<um.length;s++)if(Mj(t,um[s])in n)return um[s];return""}function Mj(e,t){return t?"".concat(t).concat(DL(e)):e}function RL(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e}function DL(e){let t="",n=!0;for(let s=0;s<e.length;s++)n?(t+=e[s].toUpperCase(),n=!1):e[s]==="-"?n=!0:t+=e[s];return t}sa.default=Dj();Object.defineProperty(_t,"__esModule",{value:!0});_t.addClassName=Oj;_t.addEvent=AL;_t.addUserSelectStyles=KL;_t.createCSSTransform=HL;_t.createSVGTransform=WL;_t.getTouch=UL;_t.getTouchIdentifier=qL;_t.getTranslation=g0;_t.innerHeight=BL;_t.innerWidth=zL;_t.matchesSelector=Aj;_t.matchesSelectorAndParentsTo=LL;_t.offsetXYFromParent=$L;_t.outerHeight=IL;_t.outerWidth=FL;_t.removeClassName=Ij;_t.removeEvent=OL;_t.removeUserSelectStyles=VL;var cs=_r,cw=ML(sa);function Lj(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Lj=function(s){return s?n:t})(e)}function ML(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Lj(t);if(n&&n.has(e))return n.get(e);var s={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var o=r?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(s,i,o):s[i]=e[i]}return s.default=e,n&&n.set(e,s),s}let gd="";function Aj(e,t){return gd||(gd=(0,cs.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(n){return(0,cs.isFunction)(e[n])})),(0,cs.isFunction)(e[gd])?e[gd](t):!1}function LL(e,t,n){let s=e;do{if(Aj(s,t))return!0;if(s===n)return!1;s=s.parentNode}while(s);return!1}function AL(e,t,n,s){if(!e)return;const r={capture:!0,...s};e.addEventListener?e.addEventListener(t,n,r):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n}function OL(e,t,n,s){if(!e)return;const r={capture:!0,...s};e.removeEventListener?e.removeEventListener(t,n,r):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null}function IL(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,cs.int)(n.borderTopWidth),t+=(0,cs.int)(n.borderBottomWidth),t}function FL(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,cs.int)(n.borderLeftWidth),t+=(0,cs.int)(n.borderRightWidth),t}function BL(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,cs.int)(n.paddingTop),t-=(0,cs.int)(n.paddingBottom),t}function zL(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,cs.int)(n.paddingLeft),t-=(0,cs.int)(n.paddingRight),t}function $L(e,t,n){const r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),i=(e.clientX+t.scrollLeft-r.left)/n,o=(e.clientY+t.scrollTop-r.top)/n;return{x:i,y:o}}function HL(e,t){const n=g0(e,t,"px");return{[(0,cw.browserPrefixToKey)("transform",cw.default)]:n}}function WL(e,t){return g0(e,t,"")}function g0(e,t,n){let{x:s,y:r}=e,i="translate(".concat(s).concat(n,",").concat(r).concat(n,")");if(t){const o="".concat(typeof t.x=="string"?t.x:t.x+n),a="".concat(typeof t.y=="string"?t.y:t.y+n);i="translate(".concat(o,", ").concat(a,")")+i}return i}function UL(e,t){return e.targetTouches&&(0,cs.findInArray)(e.targetTouches,n=>t===n.identifier)||e.changedTouches&&(0,cs.findInArray)(e.changedTouches,n=>t===n.identifier)}function qL(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function KL(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;}
|
|
456
|
+
`,t.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
|
|
457
|
+
`,e.getElementsByTagName("head")[0].appendChild(t)),e.body&&Oj(e.body,"react-draggable-transparent-selection")}function VL(e){if(e)try{if(e.body&&Ij(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 Oj(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function Ij(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var br={};Object.defineProperty(br,"__esModule",{value:!0});br.canDragX=QL;br.canDragY=GL;br.createCoreData=ZL;br.createDraggableData=eA;br.getBoundPosition=YL;br.getControlPosition=JL;br.snapToGrid=XL;var rs=_r,Ra=_t;function YL(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:s}=e.props;s=typeof s=="string"?s:tA(s);const r=x0(e);if(typeof s=="string"){const{ownerDocument:i}=r,o=i.defaultView;let a;if(s==="parent"?a=r.parentNode:a=i.querySelector(s),!(a instanceof o.HTMLElement))throw new Error('Bounds selector "'+s+'" could not find an element.');const c=a,u=o.getComputedStyle(r),d=o.getComputedStyle(c);s={left:-r.offsetLeft+(0,rs.int)(d.paddingLeft)+(0,rs.int)(u.marginLeft),top:-r.offsetTop+(0,rs.int)(d.paddingTop)+(0,rs.int)(u.marginTop),right:(0,Ra.innerWidth)(c)-(0,Ra.outerWidth)(r)-r.offsetLeft+(0,rs.int)(d.paddingRight)-(0,rs.int)(u.marginRight),bottom:(0,Ra.innerHeight)(c)-(0,Ra.outerHeight)(r)-r.offsetTop+(0,rs.int)(d.paddingBottom)-(0,rs.int)(u.marginBottom)}}return(0,rs.isNum)(s.right)&&(t=Math.min(t,s.right)),(0,rs.isNum)(s.bottom)&&(n=Math.min(n,s.bottom)),(0,rs.isNum)(s.left)&&(t=Math.max(t,s.left)),(0,rs.isNum)(s.top)&&(n=Math.max(n,s.top)),[t,n]}function XL(e,t,n){const s=Math.round(t/e[0])*e[0],r=Math.round(n/e[1])*e[1];return[s,r]}function QL(e){return e.props.axis==="both"||e.props.axis==="x"}function GL(e){return e.props.axis==="both"||e.props.axis==="y"}function JL(e,t,n){const s=typeof t=="number"?(0,Ra.getTouch)(e,t):null;if(typeof t=="number"&&!s)return null;const r=x0(n),i=n.props.offsetParent||r.offsetParent||r.ownerDocument.body;return(0,Ra.offsetXYFromParent)(s||e,i,n.props.scale)}function ZL(e,t,n){const s=!(0,rs.isNum)(e.lastX),r=x0(e);return s?{node:r,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:r,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function eA(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 tA(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function x0(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var ap={},lp={};Object.defineProperty(lp,"__esModule",{value:!0});lp.default=nA;function nA(){}Object.defineProperty(ap,"__esModule",{value:!0});ap.default=void 0;var dm=rA(y),$n=v0(Tj),sA=v0(js),vn=_t,ei=br,hm=_r,Hl=v0(lp);function v0(e){return e&&e.__esModule?e:{default:e}}function Fj(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Fj=function(s){return s?n:t})(e)}function rA(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Fj(t);if(n&&n.has(e))return n.get(e);var s={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var o=r?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(s,i,o):s[i]=e[i]}return s.default=e,n&&n.set(e,s),s}function Tn(e,t,n){return t=iA(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iA(e){var t=oA(e,"string");return typeof t=="symbol"?t:String(t)}function oA(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Ls={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let ti=Ls.mouse,cp=class extends dm.Component{constructor(){super(...arguments),Tn(this,"dragging",!1),Tn(this,"lastX",NaN),Tn(this,"lastY",NaN),Tn(this,"touchIdentifier",null),Tn(this,"mounted",!1),Tn(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:s}=n;if(this.props.disabled||!(t.target instanceof s.defaultView.Node)||this.props.handle&&!(0,vn.matchesSelectorAndParentsTo)(t.target,this.props.handle,n)||this.props.cancel&&(0,vn.matchesSelectorAndParentsTo)(t.target,this.props.cancel,n))return;t.type==="touchstart"&&t.preventDefault();const r=(0,vn.getTouchIdentifier)(t);this.touchIdentifier=r;const i=(0,ei.getControlPosition)(t,r,this);if(i==null)return;const{x:o,y:a}=i,c=(0,ei.createCoreData)(this,o,a);(0,Hl.default)("DraggableCore: handleDragStart: %j",c),(0,Hl.default)("calling",this.props.onStart),!(this.props.onStart(t,c)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,vn.addUserSelectStyles)(s),this.dragging=!0,this.lastX=o,this.lastY=a,(0,vn.addEvent)(s,ti.move,this.handleDrag),(0,vn.addEvent)(s,ti.stop,this.handleDragStop))}),Tn(this,"handleDrag",t=>{const n=(0,ei.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:s,y:r}=n;if(Array.isArray(this.props.grid)){let a=s-this.lastX,c=r-this.lastY;if([a,c]=(0,ei.snapToGrid)(this.props.grid,a,c),!a&&!c)return;s=this.lastX+a,r=this.lastY+c}const i=(0,ei.createCoreData)(this,s,r);if((0,Hl.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=s,this.lastY=r}),Tn(this,"handleDragStop",t=>{if(!this.dragging)return;const n=(0,ei.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:s,y:r}=n;if(Array.isArray(this.props.grid)){let c=s-this.lastX||0,u=r-this.lastY||0;[c,u]=(0,ei.snapToGrid)(this.props.grid,c,u),s=this.lastX+c,r=this.lastY+u}const i=(0,ei.createCoreData)(this,s,r);if(this.props.onStop(t,i)===!1||this.mounted===!1)return!1;const a=this.findDOMNode();a&&this.props.enableUserSelectHack&&(0,vn.removeUserSelectStyles)(a.ownerDocument),(0,Hl.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&((0,Hl.default)("DraggableCore: Removing handlers"),(0,vn.removeEvent)(a.ownerDocument,ti.move,this.handleDrag),(0,vn.removeEvent)(a.ownerDocument,ti.stop,this.handleDragStop))}),Tn(this,"onMouseDown",t=>(ti=Ls.mouse,this.handleDragStart(t))),Tn(this,"onMouseUp",t=>(ti=Ls.mouse,this.handleDragStop(t))),Tn(this,"onTouchStart",t=>(ti=Ls.touch,this.handleDragStart(t))),Tn(this,"onTouchEnd",t=>(ti=Ls.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,vn.addEvent)(t,Ls.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:n}=t;(0,vn.removeEvent)(n,Ls.mouse.move,this.handleDrag),(0,vn.removeEvent)(n,Ls.touch.move,this.handleDrag),(0,vn.removeEvent)(n,Ls.mouse.stop,this.handleDragStop),(0,vn.removeEvent)(n,Ls.touch.stop,this.handleDragStop),(0,vn.removeEvent)(t,Ls.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,vn.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:sA.default.findDOMNode(this)}render(){return dm.cloneElement(dm.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};ap.default=cp;Tn(cp,"displayName","DraggableCore");Tn(cp,"propTypes",{allowAnyClick:$n.default.bool,children:$n.default.node.isRequired,disabled:$n.default.bool,enableUserSelectHack:$n.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:$n.default.arrayOf($n.default.number),handle:$n.default.string,cancel:$n.default.string,nodeRef:$n.default.object,onStart:$n.default.func,onDrag:$n.default.func,onStop:$n.default.func,onMouseDown:$n.default.func,scale:$n.default.number,className:hm.dontSetMe,style:hm.dontSetMe,transform:hm.dontSetMe});Tn(cp,"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(y),n=d(Tj),s=d(js),r=d(CL),i=_t,o=br,a=_r,c=d(ap),u=d(lp);function d(_){return _&&_.__esModule?_:{default:_}}function h(_){if(typeof WeakMap!="function")return null;var b=new WeakMap,S=new WeakMap;return(h=function(C){return C?S:b})(_)}function p(_,b){if(_&&_.__esModule)return _;if(_===null||typeof _!="object"&&typeof _!="function")return{default:_};var S=h(b);if(S&&S.has(_))return S.get(_);var C={},w=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var j in _)if(j!=="default"&&Object.prototype.hasOwnProperty.call(_,j)){var T=w?Object.getOwnPropertyDescriptor(_,j):null;T&&(T.get||T.set)?Object.defineProperty(C,j,T):C[j]=_[j]}return C.default=_,S&&S.set(_,C),C}function f(){return f=Object.assign?Object.assign.bind():function(_){for(var b=1;b<arguments.length;b++){var S=arguments[b];for(var C in S)Object.prototype.hasOwnProperty.call(S,C)&&(_[C]=S[C])}return _},f.apply(this,arguments)}function m(_,b,S){return b=g(b),b in _?Object.defineProperty(_,b,{value:S,enumerable:!0,configurable:!0,writable:!0}):_[b]=S,_}function g(_){var b=v(_,"string");return typeof b=="symbol"?b:String(b)}function v(_,b){if(typeof _!="object"||_===null)return _;var S=_[Symbol.toPrimitive];if(S!==void 0){var C=S.call(_,b);if(typeof C!="object")return C;throw new TypeError("@@toPrimitive must return a primitive value.")}return(b==="string"?String:Number)(_)}class x extends t.Component{static getDerivedStateFromProps(b,S){let{position:C}=b,{prevPropsPosition:w}=S;return C&&(!w||C.x!==w.x||C.y!==w.y)?((0,u.default)("Draggable: getDerivedStateFromProps %j",{position:C,prevPropsPosition:w}),{x:C.x,y:C.y,prevPropsPosition:{...C}}):null}constructor(b){super(b),m(this,"onDragStart",(S,C)=>{if((0,u.default)("Draggable: onDragStart: %j",C),this.props.onStart(S,(0,o.createDraggableData)(this,C))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),m(this,"onDrag",(S,C)=>{if(!this.state.dragging)return!1;(0,u.default)("Draggable: onDrag: %j",C);const w=(0,o.createDraggableData)(this,C),j={x:w.x,y:w.y,slackX:0,slackY:0};if(this.props.bounds){const{x:F,y:R}=j;j.x+=this.state.slackX,j.y+=this.state.slackY;const[B,A]=(0,o.getBoundPosition)(this,j.x,j.y);j.x=B,j.y=A,j.slackX=this.state.slackX+(F-j.x),j.slackY=this.state.slackY+(R-j.y),w.x=j.x,w.y=j.y,w.deltaX=j.x-this.state.x,w.deltaY=j.y-this.state.y}if(this.props.onDrag(S,w)===!1)return!1;this.setState(j)}),m(this,"onDragStop",(S,C)=>{if(!this.state.dragging||this.props.onStop(S,(0,o.createDraggableData)(this,C))===!1)return!1;(0,u.default)("Draggable: onDragStop: %j",C);const j={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:F,y:R}=this.props.position;j.x=F,j.y=R}this.setState(j)}),this.state={dragging:!1,dragged:!1,x:b.position?b.position.x:b.defaultPosition.x,y:b.position?b.position.y:b.defaultPosition.y,prevPropsPosition:{...b.position},slackX:0,slackY:0,isElementSVG:!1},b.position&&!(b.onDrag||b.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 b,S;return(b=(S=this.props)===null||S===void 0||(S=S.nodeRef)===null||S===void 0?void 0:S.current)!==null&&b!==void 0?b:s.default.findDOMNode(this)}render(){const{axis:b,bounds:S,children:C,defaultPosition:w,defaultClassName:j,defaultClassNameDragging:T,defaultClassNameDragged:F,position:R,positionOffset:B,scale:A,...D}=this.props;let P={},E=null;const W=!!!R||this.state.dragging,O=R||w,H={x:(0,o.canDragX)(this)&&W?this.state.x:O.x,y:(0,o.canDragY)(this)&&W?this.state.y:O.y};this.state.isElementSVG?E=(0,i.createSVGTransform)(H,B):P=(0,i.createCSSTransform)(H,B);const k=(0,r.default)(C.props.className||"",j,{[T]:this.state.dragging,[F]:this.state.dragged});return t.createElement(c.default,f({},D,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(C),{className:k,style:{...C.props.style,...P},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:a.dontSetMe,style:a.dontSetMe,transform:a.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})})(Nj);const{default:Bj,DraggableCore:aA}=Nj;op.exports=Bj;op.exports.default=Bj;op.exports.DraggableCore=aA;var lA=op.exports;const cA=ml(lA);var jt=function(){return jt=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},jt.apply(this,arguments)},uw={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},dw={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},xd={width:"20px",height:"20px",position:"absolute",zIndex:1},uA={top:jt(jt({},uw),{top:"-5px"}),right:jt(jt({},dw),{left:void 0,right:"-5px"}),bottom:jt(jt({},uw),{top:void 0,bottom:"-5px"}),left:jt(jt({},dw),{left:"-5px"}),topRight:jt(jt({},xd),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:jt(jt({},xd),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:jt(jt({},xd),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:jt(jt({},xd),{left:"-10px",top:"-10px",cursor:"nw-resize"})},dA=y.memo(function(e){var t=e.onResizeStart,n=e.direction,s=e.children,r=e.replaceStyles,i=e.className,o=y.useCallback(function(u){t(u,n)},[t,n]),a=y.useCallback(function(u){t(u,n)},[t,n]),c=y.useMemo(function(){return jt(jt({position:"absolute",userSelect:"none"},uA[n]),r??{})},[r,n]);return l.jsx("div",{className:i||void 0,style:c,onMouseDown:o,onTouchStart:a,children:s})}),hA=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,r){s.__proto__=r}||function(s,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(s[i]=r[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 s(){this.constructor=t}t.prototype=n===null?Object.create(n):(s.prototype=n.prototype,new s)}}(),er=function(){return er=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},er.apply(this,arguments)},fA={width:"auto",height:"auto"},vd=function(e,t,n){return Math.max(Math.min(e,n),t)},hw=function(e,t,n){var s=Math.round(e/t);return s*t+n*(s-1)},la=function(e,t){return new RegExp(e,"i").test(t)},yd=function(e){return!!(e.touches&&e.touches.length)},pA=function(e){return!!((e.clientX||e.clientX===0)&&(e.clientY||e.clientY===0))},fw=function(e,t,n){n===void 0&&(n=0);var s=t.reduce(function(i,o,a){return Math.abs(o-e)<Math.abs(t[i]-e)?a:i},0),r=Math.abs(t[s]-e);return n===0||r<n?t[s]:e},fm=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")},_d=function(e,t,n,s){if(e&&typeof e=="string"){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%")){var r=Number(e.replace("%",""))/100;return t*r}if(e.endsWith("vw")){var r=Number(e.replace("vw",""))/100;return n*r}if(e.endsWith("vh")){var r=Number(e.replace("vh",""))/100;return s*r}}return e},mA=function(e,t,n,s,r,i,o){return s=_d(s,e.width,t,n),r=_d(r,e.height,t,n),i=_d(i,e.width,t,n),o=_d(o,e.height,t,n),{maxWidth:typeof s>"u"?void 0:Number(s),maxHeight:typeof r>"u"?void 0:Number(r),minWidth:typeof i>"u"?void 0:Number(i),minHeight:typeof o>"u"?void 0:Number(o)}},gA=function(e){return Array.isArray(e)?e:[e,e]},xA=["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"],pw="__resizable_base__",vA=function(e){hA(t,e);function t(n){var s,r,i,o,a=e.call(this,n)||this;return a.ratio=1,a.resizable=null,a.parentLeft=0,a.parentTop=0,a.resizableLeft=0,a.resizableRight=0,a.resizableTop=0,a.resizableBottom=0,a.targetLeft=0,a.targetTop=0,a.delta={width:0,height:0},a.appendBase=function(){if(!a.resizable||!a.window)return null;var c=a.parentNode;if(!c)return null;var u=a.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(pw):u.className+=pw,c.appendChild(u),u},a.removeBase=function(c){var u=a.parentNode;u&&u.removeChild(c)},a.state={isResizing:!1,width:(r=(s=a.propsSize)===null||s===void 0?void 0:s.width)!==null&&r!==void 0?r:"auto",height:(o=(i=a.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},a.onResizeStart=a.onResizeStart.bind(a),a.onMouseMove=a.onMouseMove.bind(a),a.onMouseUp=a.onMouseUp.bind(a),a}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||fA},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,s=0;if(this.resizable&&this.window){var r=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:r,s=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:i,this.resizable.style.position=o}return{width:n,height:s}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,s=this.props.size,r=function(a){var c;if(typeof n.state[a]>"u"||n.state[a]==="auto")return"auto";if(n.propsSize&&n.propsSize[a]&&(!((c=n.propsSize[a])===null||c===void 0)&&c.toString().endsWith("%"))){if(n.state[a].toString().endsWith("%"))return n.state[a].toString();var u=n.getParentSize(),d=Number(n.state[a].toString().replace("px","")),h=d/u[a]*100;return"".concat(h,"%")}return fm(n.state[a])},i=s&&typeof s.width<"u"&&!this.state.isResizing?fm(s.width):r("width"),o=s&&typeof s.height<"u"&&!this.state.isResizing?fm(s.height):r("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 s=!1,r=this.parentNode.style.flexWrap;r!=="wrap"&&(s=!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 s&&(this.parentNode.style.flexWrap=r),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,s){var r=this.propsSize&&this.propsSize[s];return this.state[s]==="auto"&&this.state.original[s]===n&&(typeof r>"u"||r==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,s){var r=this.props.boundsByDirection,i=this.state.direction,o=r&&la("left",i),a=r&&la("top",i),c,u;if(this.props.bounds==="parent"){var d=this.parentNode;d&&(c=o?this.resizableRight-this.parentLeft:d.offsetWidth+(this.parentLeft-this.resizableLeft),u=a?this.resizableBottom-this.parentTop:d.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(c=o?this.resizableRight:this.window.innerWidth-this.resizableLeft,u=a?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=a?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)&&(s=s&&s<u?s:u),{maxWidth:n,maxHeight:s}},t.prototype.calculateNewSizeFromDirection=function(n,s){var r=this.props.scale||1,i=gA(this.props.resizeRatio||1),o=i[0],a=i[1],c=this.state,u=c.direction,d=c.original,h=this.props,p=h.lockAspectRatio,f=h.lockAspectRatioExtraHeight,m=h.lockAspectRatioExtraWidth,g=d.width,v=d.height,x=f||0,_=m||0;return la("right",u)&&(g=d.width+(n-d.x)*o/r,p&&(v=(g-_)/this.ratio+x)),la("left",u)&&(g=d.width-(n-d.x)*o/r,p&&(v=(g-_)/this.ratio+x)),la("bottom",u)&&(v=d.height+(s-d.y)*a/r,p&&(g=(v-x)*this.ratio+_)),la("top",u)&&(v=d.height-(s-d.y)*a/r,p&&(g=(v-x)*this.ratio+_)),{newWidth:g,newHeight:v}},t.prototype.calculateNewSizeFromAspectRatio=function(n,s,r,i){var o=this.props,a=o.lockAspectRatio,c=o.lockAspectRatioExtraHeight,u=o.lockAspectRatioExtraWidth,d=typeof i.width>"u"?10:i.width,h=typeof r.width>"u"||r.width<0?n:r.width,p=typeof i.height>"u"?10:i.height,f=typeof r.height>"u"||r.height<0?s:r.height,m=c||0,g=u||0;if(a){var v=(p-m)*this.ratio+g,x=(f-m)*this.ratio+g,_=(d-g)/this.ratio+m,b=(h-g)/this.ratio+m,S=Math.max(d,v),C=Math.min(h,x),w=Math.max(p,_),j=Math.min(f,b);n=vd(n,S,C),s=vd(s,w,j)}else n=vd(n,d,h),s=vd(s,p,f);return{newWidth:n,newHeight:s}},t.prototype.setBoundingClientRect=function(){var n=1/(this.props.scale||1);if(this.props.bounds==="parent"){var s=this.parentNode;if(s){var r=s.getBoundingClientRect();this.parentLeft=r.left*n,this.parentTop=r.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(),a=o.left,c=o.top,u=o.right,d=o.bottom;this.resizableLeft=a*n,this.resizableRight=u*n,this.resizableTop=c*n,this.resizableBottom=d*n}},t.prototype.onResizeStart=function(n,s){if(!(!this.resizable||!this.window)){var r=0,i=0;if(n.nativeEvent&&pA(n.nativeEvent)?(r=n.nativeEvent.clientX,i=n.nativeEvent.clientY):n.nativeEvent&&yd(n.nativeEvent)&&(r=n.nativeEvent.touches[0].clientX,i=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var o=this.props.onResizeStart(n,s,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 a,c=this.window.getComputedStyle(this.resizable);if(c.flexBasis!=="auto"){var u=this.parentNode;if(u){var d=this.window.getComputedStyle(u).flexDirection;this.flexDir=d.startsWith("row")?"row":"column",a=c.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var h={original:{x:r,y:i,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:er(er({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:s,flexBasis:a};this.setState(h)}},t.prototype.onMouseMove=function(n){var s=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&yd(n))try{n.preventDefault(),n.stopPropagation()}catch{}var r=this.props,i=r.maxWidth,o=r.maxHeight,a=r.minWidth,c=r.minHeight,u=yd(n)?n.touches[0].clientX:n.clientX,d=yd(n)?n.touches[0].clientY:n.clientY,h=this.state,p=h.direction,f=h.original,m=h.width,g=h.height,v=this.getParentSize(),x=mA(v,this.window.innerWidth,this.window.innerHeight,i,o,a,c);i=x.maxWidth,o=x.maxHeight,a=x.minWidth,c=x.minHeight;var _=this.calculateNewSizeFromDirection(u,d),b=_.newHeight,S=_.newWidth,C=this.calculateNewMaxFromBoundary(i,o);this.props.snap&&this.props.snap.x&&(S=fw(S,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(b=fw(b,this.props.snap.y,this.props.snapGap));var w=this.calculateNewSizeFromAspectRatio(S,b,{width:C.maxWidth,height:C.maxHeight},{width:a,height:c});if(S=w.newWidth,b=w.newHeight,this.props.grid){var j=hw(S,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),T=hw(b,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),F=this.props.snapGap||0,R=F===0||Math.abs(j-S)<=F?j:S,B=F===0||Math.abs(T-b)<=F?T:b;S=R,b=B}var A={width:S-f.width,height:b-f.height};if(this.delta=A,m&&typeof m=="string"){if(m.endsWith("%")){var D=S/v.width*100;S="".concat(D,"%")}else if(m.endsWith("vw")){var P=S/this.window.innerWidth*100;S="".concat(P,"vw")}else if(m.endsWith("vh")){var E=S/this.window.innerHeight*100;S="".concat(E,"vh")}}if(g&&typeof g=="string"){if(g.endsWith("%")){var D=b/v.height*100;b="".concat(D,"%")}else if(g.endsWith("vw")){var P=b/this.window.innerWidth*100;b="".concat(P,"vw")}else if(g.endsWith("vh")){var E=b/this.window.innerHeight*100;b="".concat(E,"vh")}}var $={width:this.createSizeForCssProperty(S,"width"),height:this.createSizeForCssProperty(b,"height")};this.flexDir==="row"?$.flexBasis=$.width:this.flexDir==="column"&&($.flexBasis=$.height);var W=this.state.width!==$.width,O=this.state.height!==$.height,H=this.state.flexBasis!==$.flexBasis,k=W||O||H;k&&js.flushSync(function(){s.setState($)}),this.props.onResize&&k&&this.props.onResize(n,p,this.resizable,A)}},t.prototype.onMouseUp=function(n){var s,r,i=this.state,o=i.isResizing,a=i.direction;i.original,!(!o||!this.resizable)&&(this.props.onResizeStop&&this.props.onResizeStop(n,a,this.resizable,this.delta),this.props.size&&this.setState({width:(s=this.props.size.width)!==null&&s!==void 0?s:"auto",height:(r=this.props.size.height)!==null&&r!==void 0?r:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:er(er({},this.state.backgroundStyle),{cursor:"auto"})}))},t.prototype.updateSize=function(n){var s,r;this.setState({width:(s=n.width)!==null&&s!==void 0?s:"auto",height:(r=n.height)!==null&&r!==void 0?r:"auto"})},t.prototype.renderResizer=function(){var n=this,s=this.props,r=s.enable,i=s.handleStyles,o=s.handleClasses,a=s.handleWrapperStyle,c=s.handleWrapperClass,u=s.handleComponent;if(!r)return null;var d=Object.keys(r).map(function(h){return r[h]!==!1?l.jsx(dA,{direction:h,onResizeStart:n.onResizeStart,replaceStyles:i&&i[h],className:o&&o[h],children:u&&u[h]?u[h]:null},h):null});return l.jsx("div",{className:c,style:a,children:d})},t.prototype.render=function(){var n=this,s=Object.keys(this.props).reduce(function(o,a){return xA.indexOf(a)!==-1||(o[a]=n.props[a]),o},{}),r=er(er(er({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&&(r.flexBasis=this.state.flexBasis);var i=this.props.as||"div";return l.jsxs(i,er({style:r,className:this.props.className},s,{ref:function(o){o&&(n.resizable=o)},children:[this.state.isResizing&&l.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}(y.PureComponent);/*! *****************************************************************************
|
|
458
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
459
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
460
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
461
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
462
|
+
|
|
463
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
464
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
465
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
466
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
467
|
+
|
|
468
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
469
|
+
and limitations under the License.
|
|
470
|
+
***************************************************************************** */var Ax=function(e,t){return Ax=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var r in s)s.hasOwnProperty(r)&&(n[r]=s[r])},Ax(e,t)};function yA(e,t){Ax(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var It=function(){return It=Object.assign||function(t){for(var n,s=1,r=arguments.length;s<r;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},It.apply(this,arguments)};function _A(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(n[s[r]]=e[s[r]]);return n}var bA={width:"auto",height:"auto",display:"inline-block",position:"absolute",top:0,left:0},wA=function(e){return{bottom:e,bottomLeft:e,bottomRight:e,left:e,right:e,top:e,topLeft:e,topRight:e}},SA=function(e){yA(t,e);function t(n){var s=e.call(this,n)||this;return s.resizingPosition={x:0,y:0},s.offsetFromParent={left:0,top:0},s.resizableElement={current:null},s.originalPosition={x:0,y:0},s.state={resizing:!1,bounds:{top:0,right:0,bottom:0,left:0},maxWidth:n.maxWidth,maxHeight:n.maxHeight},s.onResizeStart=s.onResizeStart.bind(s),s.onResize=s.onResize.bind(s),s.onResizeStop=s.onResizeStop.bind(s),s.onDragStart=s.onDragStart.bind(s),s.onDrag=s.onDrag.bind(s),s.onDragStop=s.onDragStop.bind(s),s.getMaxSizesFromProps=s.getMaxSizesFromProps.bind(s),s}return t.prototype.componentDidMount=function(){this.updateOffsetFromParent();var n=this.offsetFromParent,s=n.left,r=n.top,i=this.getDraggablePosition(),o=i.x,a=i.y;this.draggable.setState({x:o-s,y:a-r}),this.forceUpdate()},t.prototype.getDraggablePosition=function(){var n=this.draggable.state,s=n.x,r=n.y;return{x:s,y:r}},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,s=typeof this.props.maxHeight>"u"?Number.MAX_SAFE_INTEGER:this.props.maxHeight;return{maxWidth:n,maxHeight:s}},t.prototype.getSelfElement=function(){return this.resizable&&this.resizable.resizable},t.prototype.getOffsetHeight=function(n){var s=this.props.scale;switch(this.props.bounds){case"window":return window.innerHeight/s;case"body":return document.body.offsetHeight/s;default:return n.offsetHeight}},t.prototype.getOffsetWidth=function(n){var s=this.props.scale;switch(this.props.bounds){case"window":return window.innerWidth/s;case"body":return document.body.offsetWidth/s;default:return n.offsetWidth}},t.prototype.onDragStart=function(n,s){this.props.onDragStart&&this.props.onDragStart(n,s);var r=this.getDraggablePosition();if(this.originalPosition=r,!!this.props.bounds){var i=this.getParent(),o=this.props.scale,a;if(this.props.bounds==="parent")a=i;else if(this.props.bounds==="body"){var c=i.getBoundingClientRect(),u=c.left,d=c.top,h=document.body.getBoundingClientRect(),p=-(u-i.offsetLeft*o-h.left)/o,f=-(d-i.offsetTop*o-h.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 v=i.getBoundingClientRect(),x=v.left,_=v.top,b=-(x-i.offsetLeft*o)/o,S=-(_-i.offsetTop*o)/o,m=(window.innerWidth-this.resizable.size.width*o)/o+b,g=(window.innerHeight-this.resizable.size.height*o)/o+S;return this.setState({bounds:{top:S,right:m,bottom:g,left:b}})}else typeof this.props.bounds=="string"?a=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(a=this.props.bounds);if(!(!(a instanceof HTMLElement)||!(i instanceof HTMLElement))){var C=a.getBoundingClientRect(),w=C.left,j=C.top,T=i.getBoundingClientRect(),F=T.left,R=T.top,B=(w-F)/o,A=j-R;if(this.resizable){this.updateOffsetFromParent();var D=this.offsetFromParent;this.setState({bounds:{top:A-D.top,right:B+(a.offsetWidth-this.resizable.size.width)-D.left/o,bottom:A+(a.offsetHeight-this.resizable.size.height)-D.top,left:B-D.left/o}})}}}},t.prototype.onDrag=function(n,s){if(this.props.onDrag){var r=this.offsetFromParent,i=r.left,o=r.top;if(!this.props.dragAxis||this.props.dragAxis==="both")return this.props.onDrag(n,It(It({},s),{x:s.x+i,y:s.y+o}));if(this.props.dragAxis==="x")return this.props.onDrag(n,It(It({},s),{x:s.x+i,y:this.originalPosition.y+o,deltaY:0}));if(this.props.dragAxis==="y")return this.props.onDrag(n,It(It({},s),{x:this.originalPosition.x+i,y:s.y+o,deltaX:0}))}},t.prototype.onDragStop=function(n,s){if(this.props.onDragStop){var r=this.offsetFromParent,i=r.left,o=r.top;if(!this.props.dragAxis||this.props.dragAxis==="both")return this.props.onDragStop(n,It(It({},s),{x:s.x+i,y:s.y+o}));if(this.props.dragAxis==="x")return this.props.onDragStop(n,It(It({},s),{x:s.x+i,y:this.originalPosition.y+o,deltaY:0}));if(this.props.dragAxis==="y")return this.props.onDragStop(n,It(It({},s),{x:this.originalPosition.x+i,y:s.y+o,deltaX:0}))}},t.prototype.onResizeStart=function(n,s,r){n.stopPropagation(),this.setState({resizing:!0});var i=this.props.scale,o=this.offsetFromParent,a=this.getDraggablePosition();if(this.resizingPosition={x:a.x+o.left,y:a.y+o.top},this.originalPosition=a,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 d=this.getSelfElement();if(d instanceof Element&&(u instanceof HTMLElement||u===window)&&c instanceof HTMLElement){var h=this.getMaxSizesFromProps(),p=h.maxWidth,f=h.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 v=d.getBoundingClientRect(),x=v.left,_=v.top,b=this.props.bounds==="window"?{left:0,top:0}:u.getBoundingClientRect(),S=b.left,C=b.top,w=this.getOffsetWidth(u),j=this.getOffsetHeight(u),T=s.toLowerCase().endsWith("left"),F=s.toLowerCase().endsWith("right"),R=s.startsWith("top"),B=s.startsWith("bottom");if((T||R)&&this.resizable){var A=(x-S)/i+this.resizable.size.width;this.setState({maxWidth:A>Number(p)?p:A})}if(F||this.props.lockAspectRatio&&!T&&!R){var A=w+(S-x)/i;this.setState({maxWidth:A>Number(p)?p:A})}if((R||T)&&this.resizable){var A=(_-C)/i+this.resizable.size.height;this.setState({maxHeight:A>Number(f)?f:A})}if(B||this.props.lockAspectRatio&&!R&&!T){var A=j+(C-_)/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,s,r)},t.prototype.onResize=function(n,s,r,i){var o=this,a={x:this.originalPosition.x,y:this.originalPosition.y},c=-i.width,u=-i.height,d=["top","left","topLeft","bottomLeft","topRight"];d.includes(s)&&(s==="bottomLeft"?a.x+=c:(s==="topRight"||(a.x+=c),a.y+=u));var h=this.draggable.state;(a.x!==h.x||a.y!==h.y)&&js.flushSync(function(){o.draggable.setState(a)}),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,s,r,i,{x:f,y:m})},t.prototype.onResizeStop=function(n,s,r,i){this.setState({resizing:!1});var o=this.getMaxSizesFromProps(),a=o.maxWidth,c=o.maxHeight;this.setState({maxWidth:a,maxHeight:c}),this.props.onResizeStop&&this.props.onResizeStop(n,s,r,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,s=this.getParent(),r=this.getSelfElement();if(!s||r===null)return{top:0,left:0};var i=s.getBoundingClientRect(),o=i.left,a=i.top,c=r.getBoundingClientRect(),u=this.getDraggablePosition(),d=s.scrollLeft,h=s.scrollTop;this.offsetFromParent={left:c.left-o+d-u.x*n,top:c.top-a+h-u.y*n}},t.prototype.render=function(){var n=this,s=this.props,r=s.disableDragging,i=s.style,o=s.dragHandleClassName,a=s.position,c=s.onMouseDown,u=s.onMouseUp,d=s.dragAxis,h=s.dragGrid,p=s.bounds,f=s.enableUserSelectHack,m=s.cancel,g=s.children;s.onResizeStart,s.onResize,s.onResizeStop,s.onDragStart,s.onDrag,s.onDragStop;var v=s.resizeHandleStyles,x=s.resizeHandleClasses,_=s.resizeHandleComponent,b=s.enableResizing,S=s.resizeGrid,C=s.resizeHandleWrapperClass,w=s.resizeHandleWrapperStyle,j=s.scale,T=s.allowAnyClick,F=s.dragPositionOffset,R=_A(s,["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"]),B=this.props.default?It({},this.props.default):void 0;delete R.default;var A=r||o?{cursor:"auto"}:{cursor:"move"},D=It(It(It({},bA),A),i),P=this.offsetFromParent,E=P.left,$=P.top,W;a&&(W={x:a.x-E,y:a.y-$});var O=this.state.resizing?void 0:W,H=this.state.resizing?"both":d;return y.createElement(cA,{ref:function(k){k&&(n.draggable=k)},handle:o?".".concat(o):void 0,defaultPosition:B,onMouseDown:c,onMouseUp:u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,axis:H,disabled:r,grid:h,bounds:p?this.state.bounds:void 0,position:O,enableUserSelectHack:f,cancel:m,scale:j,allowAnyClick:T,nodeRef:this.resizableElement,positionOffset:F},y.createElement(vA,It({},R,{ref:function(k){k&&(n.resizable=k,n.resizableElement.current=k.resizable)},defaultSize:B,size:this.props.size,enable:typeof b=="boolean"?wA(b):b,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,style:D,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:S,handleWrapperClass:C,handleWrapperStyle:w,lockAspectRatio:this.props.lockAspectRatio,lockAspectRatioExtraWidth:this.props.lockAspectRatioExtraWidth,lockAspectRatioExtraHeight:this.props.lockAspectRatioExtraHeight,handleStyles:v,handleClasses:x,handleComponent:_,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}(y.PureComponent);/**
|
|
471
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
472
|
+
* @license MIT
|
|
473
|
+
*
|
|
474
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
475
|
+
* @license MIT
|
|
476
|
+
*
|
|
477
|
+
* Originally forked from (with the author's permission):
|
|
478
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
479
|
+
* http://bellard.org/jslinux/
|
|
480
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
481
|
+
*/var zj=Object.defineProperty,kA=Object.getOwnPropertyDescriptor,CA=(e,t)=>{for(var n in t)zj(e,n,{get:t[n],enumerable:!0})},bt=(e,t,n,s)=>{for(var r=s>1?void 0:s?kA(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(r=(s?o(t,n,r):o(r))||r);return s&&r&&zj(t,n,r),r},le=(e,t)=>(n,s)=>t(n,s,e),mw="Terminal input",Ox={get:()=>mw,set:e=>mw=e},gw="Too much output to announce, navigate to rows manually to read",Ix={get:()=>gw,set:e=>gw=e};function NA(e){return e.replace(/\r?\n/g,"\r")}function jA(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function EA(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function PA(e,t,n,s){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");$j(r,t,n,s)}}function $j(e,t,n,s){e=NA(e),e=jA(e,n.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function Hj(e,t,n){let s=n.getBoundingClientRect(),r=e.clientX-s.left-10,i=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${i}px`,t.style.zIndex="1000",t.focus()}function xw(e,t,n,s,r){Hj(e,t,n),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function di(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function up(e,t=0,n=e.length){let s="";for(let r=t;r<n;++r){let i=e[r];i>65535?(i-=65536,s+=String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):s+=String.fromCharCode(i)}return s}var TA=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let s=0,r=0;if(this._interim){let i=e.charCodeAt(r++);56320<=i&&i<=57343?t[s++]=(this._interim-55296)*1024+i-56320+65536:(t[s++]=this._interim,t[s++]=i),this._interim=0}for(let i=r;i<n;++i){let o=e.charCodeAt(i);if(55296<=o&&o<=56319){if(++i>=n)return this._interim=o,s;let a=e.charCodeAt(i);56320<=a&&a<=57343?t[s++]=(o-55296)*1024+a-56320+65536:(t[s++]=o,t[s++]=a);continue}o!==65279&&(t[s++]=o)}return s}},RA=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let s=0,r,i,o,a,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 v=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,x=v-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||(v===2?f<128?u--:t[s++]=f:v===3?f<2048||f>=55296&&f<=57343||f===65279||(t[s++]=f):f<65536||f>1114111||(t[s++]=f)),this.interim.fill(0)}let d=n-4,h=u;for(;h<n;){for(;h<d&&!((r=e[h])&128)&&!((i=e[h+1])&128)&&!((o=e[h+2])&128)&&!((a=e[h+3])&128);)t[s++]=r,t[s++]=i,t[s++]=o,t[s++]=a,h+=4;if(r=e[h++],r<128)t[s++]=r;else if((r&224)===192){if(h>=n)return this.interim[0]=r,s;if(i=e[h++],(i&192)!==128){h--;continue}if(c=(r&31)<<6|i&63,c<128){h--;continue}t[s++]=c}else if((r&240)===224){if(h>=n)return this.interim[0]=r,s;if(i=e[h++],(i&192)!==128){h--;continue}if(h>=n)return this.interim[0]=r,this.interim[1]=i,s;if(o=e[h++],(o&192)!==128){h--;continue}if(c=(r&15)<<12|(i&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((r&248)===240){if(h>=n)return this.interim[0]=r,s;if(i=e[h++],(i&192)!==128){h--;continue}if(h>=n)return this.interim[0]=r,this.interim[1]=i,s;if(o=e[h++],(o&192)!==128){h--;continue}if(h>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=o,s;if(a=e[h++],(a&192)!==128){h--;continue}if(c=(r&7)<<18|(i&63)<<12|(o&63)<<6|a&63,c<65536||c>1114111)continue;t[s++]=c}}return s}},Wj="",Ni=" ",Bu=class Uj{constructor(){this.fg=0,this.bg=0,this.extended=new gf}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 Uj;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}},gf=class qj{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 qj(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ps=class Kj extends Bu{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new gf,this.combinedData=""}static fromCharData(t){let n=new Kj;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?di(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 s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-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()]}},vw="di$target",Fx="di$dependencies",pm=new Map;function DA(e){return e[Fx]||[]}function nn(e){if(pm.has(e))return pm.get(e);let t=function(n,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");MA(t,n,r)};return t._id=e,pm.set(e,t),t}function MA(e,t,n){t[vw]===t?t[Fx].push({id:e,index:n}):(t[Fx]=[{id:e,index:n}],t[vw]=t)}var Bn=nn("BufferService"),Vj=nn("CoreMouseService"),ra=nn("CoreService"),LA=nn("CharsetService"),y0=nn("InstantiationService"),Yj=nn("LogService"),zn=nn("OptionsService"),Xj=nn("OscLinkService"),AA=nn("UnicodeService"),zu=nn("DecorationService"),Bx=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var d;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let s=[],r=this._optionsService.rawOptions.linkHandler,i=new Ps,o=n.getTrimmedLength(),a=-1,c=-1,u=!1;for(let h=0;h<o;h++)if(!(c===-1&&!n.hasContent(h))){if(n.loadCell(h,i),i.hasExtendedAttrs()&&i.extended.urlId)if(c===-1){c=h,a=i.extended.urlId;continue}else u=i.extended.urlId!==a;else c!==-1&&(u=!0);if(u||c!==-1&&h===o-1){let p=(d=this._oscLinkService.getLinkData(a))==null?void 0:d.uri;if(p){let f={start:{x:c+1,y:e},end:{x:h+(!u&&h===o-1?1:0),y:e}},m=!1;if(!(r!=null&&r.allowNonHttpProtocols))try{let g=new URL(p);["http:","https:"].includes(g.protocol)||(m=!0)}catch{m=!0}m||s.push({text:p,range:f,activate:(g,v)=>r?r.activate(g,v,f):OA(g,v),hover:(g,v)=>{var x;return(x=r==null?void 0:r.hover)==null?void 0:x.call(r,g,v,f)},leave:(g,v)=>{var x;return(x=r==null?void 0:r.leave)==null?void 0:x.call(r,g,v,f)}})}u=!1,i.hasExtendedAttrs()&&i.extended.urlId?(c=h,a=i.extended.urlId):(c=-1,a=-1)}}t(s)}};Bx=bt([le(0,Bn),le(1,zn),le(2,Xj)],Bx);function OA(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
482
|
+
|
|
483
|
+
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 dp=nn("CharSizeService"),Xr=nn("CoreBrowserService"),_0=nn("MouseService"),Qr=nn("RenderService"),IA=nn("SelectionService"),Qj=nn("CharacterJoinerService"),kl=nn("ThemeService"),Gj=nn("LinkProviderService"),FA=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?yw.isErrorNoTelemetry(e)?new yw(e.message+`
|
|
484
|
+
|
|
485
|
+
`+e.stack):new Error(e.message+`
|
|
486
|
+
|
|
487
|
+
`+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)}},BA=new FA;function vh(e){zA(e)||BA.onUnexpectedError(e)}var zx="Canceled";function zA(e){return e instanceof $A?!0:e instanceof Error&&e.name===zx&&e.message===zx}var $A=class extends Error{constructor(){super(zx),this.name=this.message}};function HA(e){return new Error(`Illegal argument: ${e}`)}var yw=class $x extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof $x)return t;let n=new $x;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Hx=class Jj extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Jj.prototype)}};function ns(e,t=0){return e[e.length-(1+t)]}var WA;(e=>{function t(i){return i<0}e.isLessThan=t;function n(i){return i<=0}e.isLessThanOrEqual=n;function s(i){return i>0}e.isGreaterThan=s;function r(i){return i===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(WA||(WA={}));function UA(e,t){let n=this,s=!1,r;return function(){return s||(s=!0,t||(r=e.apply(n,arguments))),r}}var Zj;(e=>{function t(S){return S&&typeof S=="object"&&typeof S[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function s(){return n}e.empty=s;function*r(S){yield S}e.single=r;function i(S){return t(S)?S:r(S)}e.wrap=i;function o(S){return S||n}e.from=o;function*a(S){for(let C=S.length-1;C>=0;C--)yield S[C]}e.reverse=a;function c(S){return!S||S[Symbol.iterator]().next().done===!0}e.isEmpty=c;function u(S){return S[Symbol.iterator]().next().value}e.first=u;function d(S,C){let w=0;for(let j of S)if(C(j,w++))return!0;return!1}e.some=d;function h(S,C){for(let w of S)if(C(w))return w}e.find=h;function*p(S,C){for(let w of S)C(w)&&(yield w)}e.filter=p;function*f(S,C){let w=0;for(let j of S)yield C(j,w++)}e.map=f;function*m(S,C){let w=0;for(let j of S)yield*C(j,w++)}e.flatMap=m;function*g(...S){for(let C of S)yield*C}e.concat=g;function v(S,C,w){let j=w;for(let T of S)j=C(j,T);return j}e.reduce=v;function*x(S,C,w=S.length){for(C<0&&(C+=S.length),w<0?w+=S.length:w>S.length&&(w=S.length);C<w;C++)yield S[C]}e.slice=x;function _(S,C=Number.POSITIVE_INFINITY){let w=[];if(C===0)return[w,S];let j=S[Symbol.iterator]();for(let T=0;T<C;T++){let F=j.next();if(F.done)return[w,e.empty()];w.push(F.value)}return[w,{[Symbol.iterator](){return j}}]}e.consume=_;async function b(S){let C=[];for await(let w of S)C.push(w);return Promise.resolve(C)}e.asyncToArray=b})(Zj||(Zj={}));function Yo(e){if(Zj.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(s){t.push(s)}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 qA(...e){return at(()=>Yo(e))}function at(e){return{dispose:UA(()=>{e()})}}var eE=class tE{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{Yo(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?tE.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)}};eE.DISABLE_DISPOSED_WARNING=!1;var $i=eE,Te=class{constructor(){this._store=new $i,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)}};Te.None=Object.freeze({dispose(){}});var cl=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}},Fr=typeof window=="object"?window:globalThis,Wx=class Ux{constructor(t){this.element=t,this.next=Ux.Undefined,this.prev=Ux.Undefined}};Wx.Undefined=new Wx(void 0);var lt=Wx,_w=class{constructor(){this._first=lt.Undefined,this._last=lt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===lt.Undefined}clear(){let e=this._first;for(;e!==lt.Undefined;){let t=e.next;e.prev=lt.Undefined,e.next=lt.Undefined,e=t}this._first=lt.Undefined,this._last=lt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new lt(e);if(this._first===lt.Undefined)this._first=n,this._last=n;else if(t){let r=this._last;this._last=n,n.prev=r,r.next=n}else{let r=this._first;this._first=n,n.next=r,r.prev=n}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(n))}}shift(){if(this._first!==lt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==lt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==lt.Undefined&&e.next!==lt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===lt.Undefined&&e.next===lt.Undefined?(this._first=lt.Undefined,this._last=lt.Undefined):e.next===lt.Undefined?(this._last=this._last.prev,this._last.next=lt.Undefined):e.prev===lt.Undefined&&(this._first=this._first.next,this._first.prev=lt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==lt.Undefined;)yield e.element,e=e.next}},KA=globalThis.performance&&typeof globalThis.performance.now=="function",VA=class nE{static create(t){return new nE(t)}constructor(t){this._now=KA&&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}},un;(e=>{e.None=()=>Te.None;function t(A,D){return h(A,()=>{},0,void 0,!0,void 0,D)}e.defer=t;function n(A){return(D,P=null,E)=>{let $=!1,W;return W=A(O=>{if(!$)return W?W.dispose():$=!0,D.call(P,O)},null,E),$&&W.dispose(),W}}e.once=n;function s(A,D,P){return u((E,$=null,W)=>A(O=>E.call($,D(O)),null,W),P)}e.map=s;function r(A,D,P){return u((E,$=null,W)=>A(O=>{D(O),E.call($,O)},null,W),P)}e.forEach=r;function i(A,D,P){return u((E,$=null,W)=>A(O=>D(O)&&E.call($,O),null,W),P)}e.filter=i;function o(A){return A}e.signal=o;function a(...A){return(D,P=null,E)=>{let $=qA(...A.map(W=>W(O=>D.call(P,O))));return d($,E)}}e.any=a;function c(A,D,P,E){let $=P;return s(A,W=>($=D($,W),$),E)}e.reduce=c;function u(A,D){let P,E={onWillAddFirstListener(){P=A($.fire,$)},onDidRemoveLastListener(){P==null||P.dispose()}},$=new re(E);return D==null||D.add($),$.event}function d(A,D){return D instanceof Array?D.push(A):D&&D.add(A),A}function h(A,D,P=100,E=!1,$=!1,W,O){let H,k,I,M=0,N,z={leakWarningThreshold:W,onWillAddFirstListener(){H=A(K=>{M++,k=D(k,K),E&&!I&&(U.fire(k),k=void 0),N=()=>{let Q=k;k=void 0,I=void 0,(!E||M>1)&&U.fire(Q),M=0},typeof P=="number"?(clearTimeout(I),I=setTimeout(N,P)):I===void 0&&(I=0,queueMicrotask(N))})},onWillRemoveListener(){$&&M>0&&(N==null||N())},onDidRemoveLastListener(){N=void 0,H.dispose()}},U=new re(z);return O==null||O.add(U),U.event}e.debounce=h;function p(A,D=0,P){return e.debounce(A,(E,$)=>E?(E.push($),E):[$],D,void 0,!0,void 0,P)}e.accumulate=p;function f(A,D=(E,$)=>E===$,P){let E=!0,$;return i(A,W=>{let O=E||!D(W,$);return E=!1,$=W,O},P)}e.latch=f;function m(A,D,P){return[e.filter(A,D,P),e.filter(A,E=>!D(E),P)]}e.split=m;function g(A,D=!1,P=[],E){let $=P.slice(),W=A(k=>{$?$.push(k):H.fire(k)});E&&E.add(W);let O=()=>{$==null||$.forEach(k=>H.fire(k)),$=null},H=new re({onWillAddFirstListener(){W||(W=A(k=>H.fire(k)),E&&E.add(W))},onDidAddFirstListener(){$&&(D?setTimeout(O):O())},onDidRemoveLastListener(){W&&W.dispose(),W=null}});return E&&E.add(H),H.event}e.buffer=g;function v(A,D){return(P,E,$)=>{let W=D(new _);return A(function(O){let H=W.evaluate(O);H!==x&&P.call(E,H)},void 0,$)}}e.chain=v;let x=Symbol("HaltChainable");class _{constructor(){this.steps=[]}map(D){return this.steps.push(D),this}forEach(D){return this.steps.push(P=>(D(P),P)),this}filter(D){return this.steps.push(P=>D(P)?P:x),this}reduce(D,P){let E=P;return this.steps.push($=>(E=D(E,$),E)),this}latch(D=(P,E)=>P===E){let P=!0,E;return this.steps.push($=>{let W=P||!D($,E);return P=!1,E=$,W?$:x}),this}evaluate(D){for(let P of this.steps)if(D=P(D),D===x)break;return D}}function b(A,D,P=E=>E){let E=(...H)=>O.fire(P(...H)),$=()=>A.on(D,E),W=()=>A.removeListener(D,E),O=new re({onWillAddFirstListener:$,onDidRemoveLastListener:W});return O.event}e.fromNodeEventEmitter=b;function S(A,D,P=E=>E){let E=(...H)=>O.fire(P(...H)),$=()=>A.addEventListener(D,E),W=()=>A.removeEventListener(D,E),O=new re({onWillAddFirstListener:$,onDidRemoveLastListener:W});return O.event}e.fromDOMEventEmitter=S;function C(A){return new Promise(D=>n(A)(D))}e.toPromise=C;function w(A){let D=new re;return A.then(P=>{D.fire(P)},()=>{D.fire(void 0)}).finally(()=>{D.dispose()}),D.event}e.fromPromise=w;function j(A,D){return A(P=>D.fire(P))}e.forward=j;function T(A,D,P){return D(P),A(E=>D(E))}e.runAndSubscribe=T;class F{constructor(D,P){this._observable=D,this._counter=0,this._hasChanged=!1;let E={onWillAddFirstListener:()=>{D.addObserver(this)},onDidRemoveLastListener:()=>{D.removeObserver(this)}};this.emitter=new re(E),P&&P.add(this.emitter)}beginUpdate(D){this._counter++}handlePossibleChange(D){}handleChange(D,P){this._hasChanged=!0}endUpdate(D){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function R(A,D){return new F(A,D).emitter.event}e.fromObservable=R;function B(A){return(D,P,E)=>{let $=0,W=!1,O={beginUpdate(){$++},endUpdate(){$--,$===0&&(A.reportChanges(),W&&(W=!1,D.call(P)))},handlePossibleChange(){},handleChange(){W=!0}};A.addObserver(O),A.reportChanges();let H={dispose(){A.removeObserver(O)}};return E instanceof $i?E.add(H):Array.isArray(E)&&E.push(H),H}}e.fromObservableLight=B})(un||(un={}));var qx=class Kx{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Kx._idPool++}`,Kx.all.add(this)}start(t){this._stopWatch=new VA,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}}};qx.all=new Set,qx._idPool=0;var YA=qx,XA=-1,sE=class rE{constructor(t,n,s=(rE._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=s,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let s=this.threshold;if(s<=0||n<s)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[i,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(i);let c=new JA(a,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[s,r]of this._stacks)(!t||n<r)&&(t=[s,r],n=r);return t}};sE._idPool=1;var QA=sE,GA=class iE{constructor(t){this.value=t}static create(){let t=new Error;return new iE(t.stack??"")}print(){console.warn(this.value.split(`
|
|
488
|
+
`).slice(2).join(`
|
|
489
|
+
`))}},JA=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},ZA=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},eO=0,mm=class{constructor(e){this.value=e,this.id=eO++}},tO=2,nO,re=class{constructor(e){var t,n,s,r;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new QA((e==null?void 0:e.onListenerError)??vh,((n=this._options)==null?void 0:n.leakWarningThreshold)??XA):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new YA(this._options._profName):void 0,this._deliveryQueue=(r=this._options)==null?void 0:r.deliveryQueue}dispose(){var e,t,n,s;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),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(e,t,n)=>{var o,a,c,u,d;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new ZA(`${h}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(((o=this._options)==null?void 0:o.onListenerError)||vh)(f),Te.None}if(this._disposed)return Te.None;t&&(e=e.bind(t));let s=new mm(e),r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=GA.create(),r=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof mm?(this._deliveryQueue??(this._deliveryQueue=new sO),this._listeners=[this._listeners,s]):this._listeners.push(s):((c=(a=this._options)==null?void 0:a.onWillAddFirstListener)==null||c.call(a,this),this._listeners=s,(d=(u=this._options)==null?void 0:u.onDidAddFirstListener)==null||d.call(u,this)),this._size++;let i=at(()=>{r==null||r(),this._removeListener(s)});return n instanceof $i?n.add(i):Array.isArray(n)&&n.push(i),i}),this._event}_removeListener(e){var r,i,o,a;if((i=(r=this._options)==null?void 0:r.onWillRemoveListener)==null||i.call(r,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(a=(o=this._options)==null?void 0:o.onDidRemoveLastListener)==null||a.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 s=this._deliveryQueue.current===this;if(this._size*tO<=t.length){let c=0;for(let u=0;u<t.length;u++)t[u]?t[c++]=t[u]:s&&(this._deliveryQueue.end--,c<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=c}}_deliver(e,t){var s;if(!e)return;let n=((s=this._options)==null?void 0:s.onListenerError)||vh;if(!n){e.value(t);return}try{e.value(t)}catch(r){n(r)}}_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,s,r;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof mm)this._deliver(this._listeners,e);else{let i=this._deliveryQueue;i.enqueue(this,e,this._listeners.length),this._deliverQueue(i)}(r=this._perfMon)==null||r.stop()}hasListeners(){return this._size>0}},sO=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}},Vx=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new re,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new re,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 s=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}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 s=this.getWindowId(n);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Vx.INSTANCE=new Vx;var b0=Vx;function rO(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}b0.INSTANCE.onDidChangeZoomLevel;function iO(e){return b0.INSTANCE.getZoomFactor(e)}b0.INSTANCE.onDidChangeFullscreen;var Cl=typeof navigator=="object"?navigator.userAgent:"",Yx=Cl.indexOf("Firefox")>=0,oO=Cl.indexOf("AppleWebKit")>=0,w0=Cl.indexOf("Chrome")>=0,aO=!w0&&Cl.indexOf("Safari")>=0;Cl.indexOf("Electron/")>=0;Cl.indexOf("Android")>=0;var gm=!1;if(typeof Fr.matchMedia=="function"){let e=Fr.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Fr.matchMedia("(display-mode: fullscreen)");gm=e.matches,rO(Fr,e,({matches:n})=>{gm&&t.matches||(gm=n)})}var Da="en",Xx=!1,Qx=!1,yh=!1,oE=!1,bd,_h=Da,bw=Da,lO,As,Ao=globalThis,cn,vC;typeof Ao.vscode<"u"&&typeof Ao.vscode.process<"u"?cn=Ao.vscode.process:typeof process<"u"&&typeof((vC=process==null?void 0:process.versions)==null?void 0:vC.node)=="string"&&(cn=process);var yC,cO=typeof((yC=cn==null?void 0:cn.versions)==null?void 0:yC.electron)=="string",uO=cO&&(cn==null?void 0:cn.type)==="renderer",_C;if(typeof cn=="object"){Xx=cn.platform==="win32",Qx=cn.platform==="darwin",yh=cn.platform==="linux",yh&&cn.env.SNAP&&cn.env.SNAP_REVISION,cn.env.CI||cn.env.BUILD_ARTIFACTSTAGINGDIRECTORY,bd=Da,_h=Da;let e=cn.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);bd=t.userLocale,bw=t.osLocale,_h=t.resolvedLanguage||Da,lO=(_C=t.languagePack)==null?void 0:_C.translationsConfigFile}catch{}oE=!0}else typeof navigator=="object"&&!uO?(As=navigator.userAgent,Xx=As.indexOf("Windows")>=0,Qx=As.indexOf("Macintosh")>=0,(As.indexOf("Macintosh")>=0||As.indexOf("iPad")>=0||As.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,yh=As.indexOf("Linux")>=0,(As==null?void 0:As.indexOf("Mobi"))>=0,_h=globalThis._VSCODE_NLS_LANGUAGE||Da,bd=navigator.language.toLowerCase(),bw=bd):console.error("Unable to resolve platform.");var aE=Xx,hr=Qx,dO=yh,ww=oE,xr=As,ni=_h,hO;(e=>{function t(){return ni}e.value=t;function n(){return ni.length===2?ni==="en":ni.length>=3?ni[0]==="e"&&ni[1]==="n"&&ni[2]==="-":!1}e.isDefaultVariant=n;function s(){return ni==="en"}e.isDefault=s})(hO||(hO={}));var fO=typeof Ao.postMessage=="function"&&!Ao.importScripts;(()=>{if(fO){let e=[];Ao.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.id===n.data.vscodeScheduleAsyncWork){e.splice(s,1),i.callback();return}}});let t=0;return n=>{let s=++t;e.push({id:s,callback:n}),Ao.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var pO=!!(xr&&xr.indexOf("Chrome")>=0);xr&&xr.indexOf("Firefox")>=0;!pO&&xr&&xr.indexOf("Safari")>=0;xr&&xr.indexOf("Edg/")>=0;xr&&xr.indexOf("Android")>=0;var ca=typeof navigator=="object"?navigator:{};ww||document.queryCommandSupported&&document.queryCommandSupported("copy")||ca&&ca.clipboard&&ca.clipboard.writeText,ww||ca&&ca.clipboard&&ca.clipboard.readText;var S0=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}},xm=new S0,Sw=new S0,kw=new S0,mO=new Array(230),lE;(e=>{function t(a){return xm.keyCodeToStr(a)}e.toString=t;function n(a){return xm.strToKeyCode(a)}e.fromString=n;function s(a){return Sw.keyCodeToStr(a)}e.toUserSettingsUS=s;function r(a){return kw.keyCodeToStr(a)}e.toUserSettingsGeneral=r;function i(a){return Sw.strToKeyCode(a)||kw.strToKeyCode(a)}e.fromUserSettings=i;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return xm.keyCodeToStr(a)}e.toElectronAccelerator=o})(lE||(lE={}));var gO=class cE{constructor(t,n,s,r,i){this.ctrlKey=t,this.shiftKey=n,this.altKey=s,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof cE&&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",s=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${t}${n}${s}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new xO([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},xO=class{constructor(e){if(e.length===0)throw HA("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 vO(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return lE.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(Yx)switch(t){case 59:return 85;case 60:if(dO)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(hr)return 57;break}else if(oO&&(hr&&t===93||!hr&&t===92))return 57;return mO[t]||0}var yO=hr?256:2048,_O=512,bO=1024,wO=hr?2048:256,Cw=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=vO(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|=yO),this.altKey&&(t|=_O),this.shiftKey&&(t|=bO),this.metaKey&&(t|=wO),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new gO(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Nw=new WeakMap;function SO(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 kO=class{static getSameOriginWindowChain(e){let t=Nw.get(e);if(!t){t=[],Nw.set(e,t);let n=e,s;do s=SO(n),s?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=s;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,s=0,r=this.getSameOriginWindowChain(e);for(let i of r){let o=i.window.deref();if(n+=(o==null?void 0:o.scrollY)??0,s+=(o==null?void 0:o.scrollX)??0,o===t||!i.iframeElement)break;let a=i.iframeElement.getBoundingClientRect();n+=a.top,s+=a.left}return{top:n,left:s}}},wd=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=kO.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},jw=class{constructor(e,t=0,n=0){var r;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let s=!1;if(w0){let i=navigator.userAgent.match(/Chrome\/(\d+)/);s=(i?parseInt(i[1]):123)<=122}if(e){let i=e,o=e,a=((r=e.view)==null?void 0:r.devicePixelRatio)||1;if(typeof i.wheelDeltaY<"u")s?this.deltaY=i.wheelDeltaY/(120*a):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?Yx&&!hr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof i.wheelDeltaX<"u")aO&&aE?this.deltaX=-(i.wheelDeltaX/120):s?this.deltaX=i.wheelDeltaX/(120*a):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?Yx&&!hr?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*a):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},uE=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),CO;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof NO?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:un.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:uE})})(CO||(CO={}));var NO=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?uE:(this._emitter||(this._emitter=new re),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},k0=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 Hx("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Hx("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},jO=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 Hx("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=n.setInterval(()=>{e()},t);this.disposable=at(()=>{n.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},EO;(e=>{async function t(s){let r,i=await Promise.all(s.map(o=>o.then(a=>a,a=>{r||(r=a)})));if(typeof r<"u")throw r;return i}e.settled=t;function n(s){return new Promise(async(r,i)=>{try{await s(r,i)}catch(o){i(o)}})}e.withAsyncBody=n})(EO||(EO={}));var Ew=class xs{static fromArray(t){return new xs(n=>{n.emitMany(t)})}static fromPromise(t){return new xs(async n=>{n.emitMany(await t)})}static fromPromises(t){return new xs(async n=>{await Promise.all(t.map(async s=>n.emitOne(await s)))})}static merge(t){return new xs(async n=>{await Promise.all(t.map(async s=>{for await(let r of s)n.emitOne(r)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new re,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.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 un.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 xs(async s=>{for await(let r of t)s.emitOne(n(r))})}map(t){return xs.map(this,t)}static filter(t,n){return new xs(async s=>{for await(let r of t)n(r)&&s.emitOne(r)})}filter(t){return xs.filter(this,t)}static coalesce(t){return xs.filter(t,n=>!!n)}coalesce(){return xs.coalesce(this)}static async toPromise(t){let n=[];for await(let s of t)n.push(s);return n}toPromise(){return xs.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())}};Ew.EMPTY=Ew.fromArray([]);var{getWindow:cr,getWindowId:PO,onDidRegisterWindow:TO}=function(){let e=new Map,t={window:Fr,disposables:new $i};e.set(Fr.vscodeWindowId,t);let n=new re,s=new re,r=new re;function i(o,a){return(typeof o=="number"?e.get(o):void 0)??(a?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(e.has(o.vscodeWindowId))return Te.None;let a=new $i,c={window:o,disposables:a.add(new $i)};return e.set(o.vscodeWindowId,c),a.add(at(()=>{e.delete(o.vscodeWindowId),s.fire(o)})),a.add(ve(o,Xt.BEFORE_UNLOAD,()=>{r.fire(o)})),n.fire(c),a},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 a=o;if((u=a==null?void 0:a.ownerDocument)!=null&&u.defaultView)return a.ownerDocument.defaultView.window;let c=o;return c!=null&&c.view?c.view.window:Fr},getDocument(o){return cr(o).document}}}(),RO=class{constructor(e,t,n,s){this._node=e,this._type=t,this._handler=n,this._options=s||!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 ve(e,t,n,s){return new RO(e,t,n,s)}var Pw=function(e,t,n,s){return ve(e,t,n,s)},C0,DO=class extends jO{constructor(e){super(),this.defaultTarget=e&&cr(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},Tw=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){vh(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,s=new Map,r=i=>{n.set(i,!1);let o=e.get(i)??[];for(t.set(i,o),e.set(i,[]),s.set(i,!0);o.length>0;)o.sort(Tw.sort),o.shift().execute();s.set(i,!1)};C0=(i,o,a=0)=>{let c=PO(i),u=new Tw(o,a),d=e.get(c);return d||(d=[],e.set(c,d)),d.push(u),n.get(c)||(n.set(c,!0),i.requestAnimationFrame(()=>r(c))),u}})();function MO(e){let t=e.getBoundingClientRect(),n=cr(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Xt={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"},LO=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=Hn(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Hn(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Hn(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Hn(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Hn(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Hn(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Hn(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Hn(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Hn(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Hn(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Hn(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=Hn(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=Hn(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Hn(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 Hn(e){return typeof e=="number"?`${e}px`:e}function Dc(e){return new LO(e)}var dE=class{constructor(){this._hooks=new $i,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,s,r){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=r;let i=e;try{e.setPointerCapture(t),this._hooks.add(at(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{i=cr(e)}this._hooks.add(ve(i,Xt.POINTER_MOVE,o=>{if(o.buttons!==n){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(ve(i,Xt.POINTER_UP,o=>this.stopMonitoring(!0)))}};function AO(e,t,n){let s=null,r=null;if(typeof n.value=="function"?(s="value",r=n.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(s="get",r=n.get),!r)throw new Error("not supported");let i=`$memoize$${t}`;n[s]=function(...o){return this.hasOwnProperty(i)||Object.defineProperty(this,i,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,o)}),this[i]}}var Js;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Js||(Js={}));var dc=class yn extends Te{constructor(){super(),this.dispatched=!1,this.targets=new _w,this.ignoreTargets=new _w,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(un.runAndSubscribe(TO,({window:t,disposables:n})=>{n.add(ve(t.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),n.add(ve(t.document,"touchend",s=>this.onTouchEnd(t,s))),n.add(ve(t.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:Fr,disposables:this._store}))}static addTarget(t){if(!yn.isTouchDevice())return Te.None;yn.INSTANCE||(yn.INSTANCE=new yn);let n=yn.INSTANCE.targets.push(t);return at(n)}static ignoreTarget(t){if(!yn.isTouchDevice())return Te.None;yn.INSTANCE||(yn.INSTANCE=new yn);let n=yn.INSTANCE.ignoreTargets.push(t);return at(n)}static isTouchDevice(){return"ontouchstart"in Fr||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 s=0,r=t.targetTouches.length;s<r;s++){let i=t.targetTouches.item(s);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(Js.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 s=Date.now(),r=Object.keys(this.activeTouches).length;for(let i=0,o=n.changedTouches.length;i<o;i++){let a=n.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let c=this.activeTouches[a.identifier],u=Date.now()-c.initialTimeStamp;if(u<yn.HOLD_DELAY&&Math.abs(c.initialPageX-ns(c.rollingPageX))<30&&Math.abs(c.initialPageY-ns(c.rollingPageY))<30){let d=this.newGestureEvent(Js.Tap,c.initialTarget);d.pageX=ns(c.rollingPageX),d.pageY=ns(c.rollingPageY),this.dispatchEvent(d)}else if(u>=yn.HOLD_DELAY&&Math.abs(c.initialPageX-ns(c.rollingPageX))<30&&Math.abs(c.initialPageY-ns(c.rollingPageY))<30){let d=this.newGestureEvent(Js.Contextmenu,c.initialTarget);d.pageX=ns(c.rollingPageX),d.pageY=ns(c.rollingPageY),this.dispatchEvent(d)}else if(r===1){let d=ns(c.rollingPageX),h=ns(c.rollingPageY),p=ns(c.rollingTimestamps)-c.rollingTimestamps[0],f=d-c.rollingPageX[0],m=h-c.rollingPageY[0],g=[...this.targets].filter(v=>c.initialTarget instanceof Node&&v.contains(c.initialTarget));this.inertia(t,g,s,Math.abs(f)/p,f>0?1:-1,d,Math.abs(m)/p,m>0?1:-1,h)}this.dispatchEvent(this.newGestureEvent(Js.End,c.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let s=document.createEvent("CustomEvent");return s.initEvent(t,!1,!0),s.initialTarget=n,s.tapCount=0,s}dispatchEvent(t){if(t.type===Js.Tap){let n=new Date().getTime(),s=0;n-this._lastSetTapCountTime>yn.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=n,t.tapCount=s}else(t.type===Js.Change||t.type===Js.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(t.initialTarget))return;let n=[];for(let s of this.targets)if(s.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==s;)r++,i=i.parentElement;n.push([r,s])}n.sort((s,r)=>s[0]-r[0]);for(let[s,r]of n)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,s,r,i,o,a,c,u){this.handle=C0(t,()=>{let d=Date.now(),h=d-s,p=0,f=0,m=!0;r+=yn.SCROLL_FRICTION*h,a+=yn.SCROLL_FRICTION*h,r>0&&(m=!1,p=i*r*h),a>0&&(m=!1,f=c*a*h);let g=this.newGestureEvent(Js.Change);g.translationX=p,g.translationY=f,n.forEach(v=>v.dispatchEvent(g)),m||this.inertia(t,n,d,r,i,o+p,a,c,u+f)})}onTouchMove(t){let n=Date.now();for(let s=0,r=t.changedTouches.length;s<r;s++){let i=t.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(i.identifier))){console.warn("end of an UNKNOWN touch",i);continue}let o=this.activeTouches[i.identifier],a=this.newGestureEvent(Js.Change,o.initialTarget);a.translationX=i.pageX-ns(o.rollingPageX),a.translationY=i.pageY-ns(o.rollingPageY),a.pageX=i.pageX,a.pageY=i.pageY,this.dispatchEvent(a),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)}};dc.SCROLL_FRICTION=-.005,dc.HOLD_DELAY=700,dc.CLEAR_TAP_COUNT_TIME=400,bt([AO],dc,"isTouchDevice",1);var OO=dc,N0=class extends Te{onclick(e,t){this._register(ve(e,Xt.CLICK,n=>t(new wd(cr(e),n))))}onmousedown(e,t){this._register(ve(e,Xt.MOUSE_DOWN,n=>t(new wd(cr(e),n))))}onmouseover(e,t){this._register(ve(e,Xt.MOUSE_OVER,n=>t(new wd(cr(e),n))))}onmouseleave(e,t){this._register(ve(e,Xt.MOUSE_LEAVE,n=>t(new wd(cr(e),n))))}onkeydown(e,t){this._register(ve(e,Xt.KEY_DOWN,n=>t(new Cw(n))))}onkeyup(e,t){this._register(ve(e,Xt.KEY_UP,n=>t(new Cw(n))))}oninput(e,t){this._register(ve(e,Xt.INPUT,t))}onblur(e,t){this._register(ve(e,Xt.BLUR,t))}onfocus(e,t){this._register(ve(e,Xt.FOCUS,t))}onchange(e,t){this._register(ve(e,Xt.CHANGE,t))}ignoreGesture(e){return OO.ignoreTarget(e)}},Rw=11,IO=class extends N0{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=Rw+"px",this.domNode.style.height=Rw+"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 dE),this._register(Pw(this.bgDomNode,Xt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Pw(this.domNode,Xt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new DO),this._pointerdownScheduleRepeatTimer=this._register(new k0)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,cr(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()}},FO=class Gx{constructor(t,n,s,r,i,o,a){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,s=s|0,r=r|0,i=i|0,o=o|0,a=a|0),this.rawScrollLeft=r,this.rawScrollTop=a,n<0&&(n=0),r+n>s&&(r=s-n),r<0&&(r=0),i<0&&(i=0),a+i>o&&(a=o-i),a<0&&(a=0),this.width=n,this.scrollWidth=s,this.scrollLeft=r,this.height=i,this.scrollHeight=o,this.scrollTop=a}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 Gx(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 Gx(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 s=this.width!==t.width,r=this.scrollWidth!==t.scrollWidth,i=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,a=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:s,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:c}}},BO=class extends Te{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new re),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new FO(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 s;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(s=this._smoothScrolling)==null||s.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 s;t?s=new Mw(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=Mw.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)))}},Dw=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function vm(e,t){let n=t-e;return function(s){return e+n*HO(s)}}function zO(e,t,n){return function(s){return s<n?e(s/n):t((s-n)/(1-n))}}var Mw=class Jx{constructor(t,n,s,r){this.from=t,this.to=n,this.duration=r,this.startTime=s,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,s){if(Math.abs(t-n)>2.5*s){let r,i;return t<n?(r=t+.75*s,i=n-.75*s):(r=t-.75*s,i=n+.75*s),zO(vm(t,r),vm(i,n),.33)}return vm(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 s=this.scrollLeft(n),r=this.scrollTop(n);return new Dw(s,r,!1)}return new Dw(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,s){return Jx.start(t,n,s)}static start(t,n,s){s=s+10;let r=Date.now()-10;return new Jx(t,n,r,s)}};function $O(e){return Math.pow(e,3)}function HO(e){return 1-$O(1-e)}var WO=class extends Te{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 k0)}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":"")))}},UO=140,hE=class extends N0{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 WO(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new dE),this._shouldRender=!0,this.domNode=Dc(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(ve(this.domNode.domNode,Xt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new IO(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,s){this.slider=Dc(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 s=="number"&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(ve(this.slider.domNode,Xt.POINTER_DOWN,r=>{r.button===0&&(r.preventDefault(),this._sliderPointerDown(r))})),this.onclick(this.slider.domNode,r=>{r.leftButton&&r.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(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);n<=r&&r<=s?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 r=MO(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let s=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),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),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{let i=this._sliderOrthogonalPointerPosition(r),o=Math.abs(i-n);if(aE&&o>UO){this._setDesiredScrollPositionNow(s.getScrollPosition());return}let a=this._sliderPointerPosition(r)-t;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(a))},()=>{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()}},fE=class Zx{constructor(t,n,s,r,i,o){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(t),this._visibleSize=r,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 Zx(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,s,r,i){let o=Math.max(0,s-t),a=Math.max(0,o-2*n),c=r>0&&r>s;if(!c)return{computedAvailableSize:Math.round(o),computedIsNeeded:c,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let u=Math.round(Math.max(20,Math.floor(s*a/r))),d=(a-u)/(r-s),h=i*d;return{computedAvailableSize:Math.round(o),computedIsNeeded:c,computedSliderSize:Math.round(u),computedSliderRatio:d,computedSliderPosition:Math.round(h)}}_refreshComputedValues(){let t=Zx._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,s=this._scrollPosition;return n<this._computedSliderPosition?s-=this._visibleSize:s+=this._visibleSize,s}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},qO=class extends hE{constructor(e,t,n){let s=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new fE(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,s.width,s.scrollWidth,r.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}},KO=class extends hE{constructor(e,t,n){let s=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new fE(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,s.height,s.scrollHeight,r.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}},VO=500,Lw=50,YO=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},ev=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,s=1,r=this._rear;do{let i=r===this._front?t:Math.pow(2,-s);if(t-=i,n+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,s++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(w0){let n=cr(t.browserEvent),s=iO(n);this.accept(Date.now(),t.deltaX*s,t.deltaY*s)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,s){let r=null,i=new YO(t,n,s);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=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,r)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(s+=.25),n){let r=Math.abs(t.deltaX),i=Math.abs(t.deltaY),o=Math.abs(n.deltaX),a=Math.abs(n.deltaY),c=Math.max(Math.min(r,o),1),u=Math.max(Math.min(i,a),1),d=Math.max(r,o),h=Math.max(i,a);d%c===0&&h%u===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};ev.INSTANCE=new ev;var XO=ev,QO=class extends N0{constructor(e,t,n){super(),this._onScroll=this._register(new re),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new re),this.onWillScroll=this._onWillScroll.event,this._options=JO(t),this._scrollable=n,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let s={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new KO(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new qO(this._scrollable,this._options,s)),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=Dc(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Dc(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Dc(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,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new k0),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Yo(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,hr&&(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 jw(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Yo(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new jw(n))};this._mouseWheelToDispose.push(ve(this._listenOnDomNode,Xt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var r;if((r=e.browserEvent)!=null&&r.defaultPrevented)return;let t=XO.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 a=!hr&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!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 d=Lw*i,h=c.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(u,h)}if(o){let d=Lw*o,h=c.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(u,h)}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 s=n;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(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,s=n?" left":"",r=t?" top":"",i=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${i}${r}${s}`)}}_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(),VO)}},GO=class extends QO{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 JO(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,hr&&(t.className+=" mac"),t}var tv=class extends Te{constructor(e,t,n,s,r,i,o,a){super(),this._bufferService=n,this._optionsService=o,this._renderService=a,this._onRequestScrollLines=this._register(new re),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new BO({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:u=>C0(s.window,u)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new GO(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(r.onProtocolChange(u=>{this._scrollableElement.updateOptions({handleMouseWheel:!(u&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(un.runAndSubscribe(i.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=i.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(at(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(at(()=>this._styleElement.remove())),this._register(un.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(`
|
|
490
|
+
`)})),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}};tv=bt([le(2,Bn),le(3,Xr),le(4,Vj),le(5,kl),le(6,zn),le(7,Qr)],tv);var nv=class extends Te{constructor(e,t,n,s,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=s,this._renderService=r,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(at(()=>{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 s;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((s=e==null?void 0:e.options)==null?void 0:s.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()}};nv=bt([le(1,Bn),le(2,Xr),le(3,zu),le(4,Qr)],nv);var ZO=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)}},Xs={full:0,left:0,center:0,right:0},si={full:0,left:0,center:0,right:0},Wl={full:0,left:0,center:0,right:0},xf=class extends Te{constructor(e,t,n,s,r,i,o,a){var u;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=s,this._renderService=r,this._optionsService=i,this._themeService=o,this._coreBrowserService=a,this._colorZoneStore=new ZO,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(at(()=>{var d;return(d=this._canvas)==null?void 0:d.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);si.full=this._canvas.width,si.left=e,si.center=t,si.right=e,this._refreshDrawHeightConstants(),Wl.full=1,Wl.left=1,Wl.center=1+si.left,Wl.right=1+si.left+si.center}_refreshDrawHeightConstants(){Xs.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);Xs.left=t,Xs.center=t,Xs.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Xs.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Xs.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Xs.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Xs.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(Wl[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Xs[e.position||"full"]/2),si[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Xs[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}))}};xf=bt([le(2,Bn),le(3,zu),le(4,Qr),le(5,zn),le(6,kl),le(7,Xr)],xf);var G;(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=`
|
|
491
|
+
`,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=""))(G||(G={}));var bh;(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=""))(bh||(bh={}));var pE;(e=>e.ST=`${G.ESC}\\`)(pE||(pE={}));var sv=class{constructor(e,t,n,s,r,i){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=s,this._coreService=r,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(`${G.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,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=s+"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=r+"px",this._textarea.style.top=s+"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)}}};sv=bt([le(2,Bn),le(3,zn),le(4,ra),le(5,Qr)],sv);var Jt=0,Zt=0,en=0,gt=0,Aw={css:"#00000000",rgba:0},Tt;(e=>{function t(r,i,o,a){return a!==void 0?`#${no(r)}${no(i)}${no(o)}${no(a)}`:`#${no(r)}${no(i)}${no(o)}`}e.toCss=t;function n(r,i,o,a=255){return(r<<24|i<<16|o<<8|a)>>>0}e.toRgba=n;function s(r,i,o,a){return{css:e.toCss(r,i,o,a),rgba:e.toRgba(r,i,o,a)}}e.toColor=s})(Tt||(Tt={}));var st;(e=>{function t(c,u){if(gt=(u.rgba&255)/255,gt===1)return{css:u.css,rgba:u.rgba};let d=u.rgba>>24&255,h=u.rgba>>16&255,p=u.rgba>>8&255,f=c.rgba>>24&255,m=c.rgba>>16&255,g=c.rgba>>8&255;Jt=f+Math.round((d-f)*gt),Zt=m+Math.round((h-m)*gt),en=g+Math.round((p-g)*gt);let v=Tt.toCss(Jt,Zt,en),x=Tt.toRgba(Jt,Zt,en);return{css:v,rgba:x}}e.blend=t;function n(c){return(c.rgba&255)===255}e.isOpaque=n;function s(c,u,d){let h=wh.ensureContrastRatio(c.rgba,u.rgba,d);if(h)return Tt.toColor(h>>24&255,h>>16&255,h>>8&255)}e.ensureContrastRatio=s;function r(c){let u=(c.rgba|255)>>>0;return[Jt,Zt,en]=wh.toChannels(u),{css:Tt.toCss(Jt,Zt,en),rgba:u}}e.opaque=r;function i(c,u){return gt=Math.round(u*255),[Jt,Zt,en]=wh.toChannels(c.rgba),{css:Tt.toCss(Jt,Zt,en,gt),rgba:Tt.toRgba(Jt,Zt,en,gt)}}e.opacity=i;function o(c,u){return gt=c.rgba&255,i(c,gt*u/255)}e.multiplyOpacity=o;function a(c){return[c.rgba>>24&255,c.rgba>>16&255,c.rgba>>8&255]}e.toColorRGB=a})(st||(st={}));var ct;(e=>{let t,n;try{let r=document.createElement("canvas");r.width=1,r.height=1;let i=r.getContext("2d",{willReadFrequently:!0});i&&(t=i,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Jt=parseInt(r.slice(1,2).repeat(2),16),Zt=parseInt(r.slice(2,3).repeat(2),16),en=parseInt(r.slice(3,4).repeat(2),16),Tt.toColor(Jt,Zt,en);case 5:return Jt=parseInt(r.slice(1,2).repeat(2),16),Zt=parseInt(r.slice(2,3).repeat(2),16),en=parseInt(r.slice(3,4).repeat(2),16),gt=parseInt(r.slice(4,5).repeat(2),16),Tt.toColor(Jt,Zt,en,gt);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let i=r.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 Jt=parseInt(i[1]),Zt=parseInt(i[2]),en=parseInt(i[3]),gt=Math.round((i[5]===void 0?1:parseFloat(i[5]))*255),Tt.toColor(Jt,Zt,en,gt);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Jt,Zt,en,gt]=t.getImageData(0,0,1,1).data,gt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Tt.toRgba(Jt,Zt,en,gt),css:r}}e.toColor=s})(ct||(ct={}));var Pn;(e=>{function t(s){return n(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function n(s,r,i){let o=s/255,a=r/255,c=i/255,u=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),d=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),h=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4);return u*.2126+d*.7152+h*.0722}e.relativeLuminance2=n})(Pn||(Pn={}));var wh;(e=>{function t(o,a){if(gt=(a&255)/255,gt===1)return a;let c=a>>24&255,u=a>>16&255,d=a>>8&255,h=o>>24&255,p=o>>16&255,f=o>>8&255;return Jt=h+Math.round((c-h)*gt),Zt=p+Math.round((u-p)*gt),en=f+Math.round((d-f)*gt),Tt.toRgba(Jt,Zt,en)}e.blend=t;function n(o,a,c){let u=Pn.relativeLuminance(o>>8),d=Pn.relativeLuminance(a>>8);if(kr(u,d)<c){if(d<u){let f=s(o,a,c),m=kr(u,Pn.relativeLuminance(f>>8));if(m<c){let g=r(o,a,c),v=kr(u,Pn.relativeLuminance(g>>8));return m>v?f:g}return f}let h=r(o,a,c),p=kr(u,Pn.relativeLuminance(h>>8));if(p<c){let f=s(o,a,c),m=kr(u,Pn.relativeLuminance(f>>8));return p>m?h:f}return h}}e.ensureContrastRatio=n;function s(o,a,c){let u=o>>24&255,d=o>>16&255,h=o>>8&255,p=a>>24&255,f=a>>16&255,m=a>>8&255,g=kr(Pn.relativeLuminance2(p,f,m),Pn.relativeLuminance2(u,d,h));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=kr(Pn.relativeLuminance2(p,f,m),Pn.relativeLuminance2(u,d,h));return(p<<24|f<<16|m<<8|255)>>>0}e.reduceLuminance=s;function r(o,a,c){let u=o>>24&255,d=o>>16&255,h=o>>8&255,p=a>>24&255,f=a>>16&255,m=a>>8&255,g=kr(Pn.relativeLuminance2(p,f,m),Pn.relativeLuminance2(u,d,h));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=kr(Pn.relativeLuminance2(p,f,m),Pn.relativeLuminance2(u,d,h));return(p<<24|f<<16|m<<8|255)>>>0}e.increaseLuminance=r;function i(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=i})(wh||(wh={}));function no(e){let t=e.toString(16);return t.length<2?"0"+t:t}function kr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var eI=class extends Bu{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()]}},vf=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Ps}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=[],s=t.translateToString(!0),r=0,i=0,o=0,a=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!==a||this._workCell.bg!==c){if(u-r>1){let d=this._getJoinedRanges(s,o,i,t,r);for(let h=0;h<d.length;h++)n.push(d[h])}r=u,o=i,a=this._workCell.fg,c=this._workCell.bg}i+=this._workCell.getChars().length||Ni.length}if(this._bufferService.cols-r>1){let u=this._getJoinedRanges(s,o,i,t,r);for(let d=0;d<u.length;d++)n.push(u[d])}return n}_getJoinedRanges(e,t,n,s,r){let i=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(i)}catch(a){console.error(a)}for(let a=1;a<this._characterJoiners.length;a++)try{let c=this._characterJoiners[a].handler(i);for(let u=0;u<c.length;u++)vf._mergeRanges(o,c[u])}catch(c){console.error(c)}return this._stringRangesToCellRanges(o,s,r),o}_stringRangesToCellRanges(e,t,n){let s=0,r=!1,i=0,o=e[s];if(o){for(let a=n;a<this._bufferService.cols;a++){let c=t.getWidth(a),u=t.getString(a).length||Ni.length;if(c!==0){if(!r&&o[0]<=i&&(o[0]=a,r=!0),o[1]<=i){if(o[1]=a,o=e[++s],!o)break;o[0]<=i?(o[0]=a,r=!0):r=!1}i+=u}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let s=0;s<e.length;s++){let r=e[s];if(n){if(t[1]<=r[0])return e[s-1][1]=t[1],e;if(t[1]<=r[1])return e[s-1][1]=Math.max(t[1],r[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=r[0])return e.splice(s,0,t),e;if(t[1]<=r[1])return r[0]=Math.min(t[0],r[0]),e;t[0]<r[1]&&(r[0]=Math.min(t[0],r[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};vf=bt([le(0,Bn)],vf);function tI(e){return 57508<=e&&e<=57558}function nI(e){return 9472<=e&&e<=9631}function sI(e){return tI(e)||nI(e)}function rI(){return{css:{canvas:Sd(),cell:Sd()},device:{canvas:Sd(),cell:Sd(),char:{width:0,height:0,left:0,top:0}}}}function Sd(){return{width:0,height:0}}var rv=class{constructor(e,t,n,s,r,i,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=s,this._coreService=r,this._decorationService=i,this._themeService=o,this._workCell=new Ps,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,s,r,i,o,a,c,u,d){let h=[],p=this._characterJoinerService.getJoinedCharacters(t),f=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<i+1&&(m=i+1);let g,v=0,x="",_=0,b=0,S=0,C=0,w=!1,j=0,T=!1,F=0,R=0,B=[],A=u!==-1&&d!==-1;for(let D=0;D<m;D++){e.loadCell(D,this._workCell);let P=this._workCell.getWidth();if(P===0)continue;let E=!1,$=D>=R,W=D,O=this._workCell;if(p.length>0&&D===p[0][0]&&$){let fe=p.shift(),Ie=this._isCellInSelection(fe[0],t);for(_=fe[0]+1;_<fe[1];_++)$&&($=Ie===this._isCellInSelection(_,t));$&&($=!n||i<fe[0]||i>=fe[1]),$?(E=!0,O=new eI(this._workCell,e.translateToString(!0,fe[0],fe[1]),fe[1]-fe[0]),W=fe[1]-1,P=O.getWidth()):R=fe[1]}let H=this._isCellInSelection(D,t),k=n&&D===i,I=A&&D>=u&&D<=d,M=!1;this._decorationService.forEachDecorationAtCell(D,t,void 0,fe=>{M=!0});let N=O.getChars()||Ni;if(N===" "&&(O.isUnderline()||O.isOverline())&&(N=" "),F=P*a-c.get(N,O.isBold(),O.isItalic()),!g)g=this._document.createElement("span");else if(v&&(H&&T||!H&&!T&&O.bg===b)&&(H&&T&&f.selectionForeground||O.fg===S)&&O.extended.ext===C&&I===w&&F===j&&!k&&!E&&!M&&$){O.isInvisible()?x+=Ni:x+=N,v++;continue}else v&&(g.textContent=x),g=this._document.createElement("span"),v=0,x="";if(b=O.bg,S=O.fg,C=O.extended.ext,w=I,j=F,T=H,E&&i>=D&&i<=W&&(i=D),!this._coreService.isCursorHidden&&k&&this._coreService.isCursorInitialized){if(B.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&B.push("xterm-cursor-blink"),B.push(s==="bar"?"xterm-cursor-bar":s==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":B.push("xterm-cursor-outline");break;case"block":B.push("xterm-cursor-block");break;case"bar":B.push("xterm-cursor-bar");break;case"underline":B.push("xterm-cursor-underline");break}}if(O.isBold()&&B.push("xterm-bold"),O.isItalic()&&B.push("xterm-italic"),O.isDim()&&B.push("xterm-dim"),O.isInvisible()?x=Ni:x=O.getChars()||Ni,O.isUnderline()&&(B.push(`xterm-underline-${O.extended.underlineStyle}`),x===" "&&(x=" "),!O.isUnderlineColorDefault()))if(O.isUnderlineColorRGB())g.style.textDecorationColor=`rgb(${Bu.toColorRGB(O.getUnderlineColor()).join(",")})`;else{let fe=O.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&O.isBold()&&fe<8&&(fe+=8),g.style.textDecorationColor=f.ansi[fe].css}O.isOverline()&&(B.push("xterm-overline"),x===" "&&(x=" ")),O.isStrikethrough()&&B.push("xterm-strikethrough"),I&&(g.style.textDecoration="underline");let z=O.getFgColor(),U=O.getFgColorMode(),K=O.getBgColor(),Q=O.getBgColorMode(),Y=!!O.isInverse();if(Y){let fe=z;z=K,K=fe;let Ie=U;U=Q,Q=Ie}let Z,ue,Oe=!1;this._decorationService.forEachDecorationAtCell(D,t,void 0,fe=>{fe.options.layer!=="top"&&Oe||(fe.backgroundColorRGB&&(Q=50331648,K=fe.backgroundColorRGB.rgba>>8&16777215,Z=fe.backgroundColorRGB),fe.foregroundColorRGB&&(U=50331648,z=fe.foregroundColorRGB.rgba>>8&16777215,ue=fe.foregroundColorRGB),Oe=fe.options.layer==="top")}),!Oe&&H&&(Z=this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque,K=Z.rgba>>8&16777215,Q=50331648,Oe=!0,f.selectionForeground&&(U=50331648,z=f.selectionForeground.rgba>>8&16777215,ue=f.selectionForeground)),Oe&&B.push("xterm-decoration-top");let Re;switch(Q){case 16777216:case 33554432:Re=f.ansi[K],B.push(`xterm-bg-${K}`);break;case 50331648:Re=Tt.toColor(K>>16,K>>8&255,K&255),this._addStyle(g,`background-color:#${Ow((K>>>0).toString(16),"0",6)}`);break;case 0:default:Y?(Re=f.foreground,B.push("xterm-bg-257")):Re=f.background}switch(Z||O.isDim()&&(Z=st.multiplyOpacity(Re,.5)),U){case 16777216:case 33554432:O.isBold()&&z<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(z+=8),this._applyMinimumContrast(g,Re,f.ansi[z],O,Z,void 0)||B.push(`xterm-fg-${z}`);break;case 50331648:let fe=Tt.toColor(z>>16&255,z>>8&255,z&255);this._applyMinimumContrast(g,Re,fe,O,Z,ue)||this._addStyle(g,`color:#${Ow(z.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(g,Re,f.foreground,O,Z,ue)||Y&&B.push("xterm-fg-257")}B.length&&(g.className=B.join(" "),B.length=0),!k&&!E&&!M&&$?v++:g.textContent=x,F!==this.defaultSpacing&&(g.style.letterSpacing=`${F}px`),h.push(g),D=W}return g&&v&&(g.textContent=x),h}_applyMinimumContrast(e,t,n,s,r,i){if(this._optionsService.rawOptions.minimumContrastRatio===1||sI(s.getCode()))return!1;let o=this._getContrastCache(s),a;if(!r&&!i&&(a=o.getColor(t.rgba,n.rgba)),a===void 0){let c=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);a=st.ensureContrastRatio(r||t,i||n,c),o.setColor((r||t).rgba,(i||n).rgba,a??null)}return a?(this._addStyle(e,`color:${a.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,s=this._selectionEnd;return!n||!s?!1:this._columnSelectMode?n[0]<=s[0]?e>=n[0]&&t>=n[1]&&e<s[0]&&t<=s[1]:e<n[0]&&t>=n[1]&&e>=s[0]&&t<=s[1]:t>n[1]&&t<s[1]||n[1]===s[1]&&t===n[1]&&e>=n[0]&&e<s[0]||n[1]<s[1]&&t===s[1]&&e<s[0]||n[1]<s[1]&&t===n[1]&&e>=n[0]}};rv=bt([le(1,Qj),le(2,zn),le(3,Xr),le(4,ra),le(5,zu),le(6,kl)],rv);function Ow(e,t,n){for(;e.length<n;)e=t+e;return e}var iI=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 s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.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,s,r,i],this._container.appendChild(n),this._container.appendChild(s),this._container.appendChild(r),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,s){e===this._font&&t===this._fontSize&&n===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,t,n){let s=0;if(!t&&!n&&e.length===1&&(s=e.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];let o=this._measure(e,0);return o>0&&(this._flat[s]=o),o}let r=e;t&&(r+="B"),n&&(r+="I");let i=this._holey.get(r);if(i===void 0){let o=0;t&&(o|=1),n&&(o|=2),i=this._measure(e,o),i>0&&this._holey.set(r,i)}return i}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},oI=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,s=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let r=e.buffers.active.ydisp,i=t[1]-r,o=n[1]-r,a=Math.max(i,0),c=Math.min(o,e.rows-1);if(a>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=i,this.viewportEndRow=o,this.viewportCappedStartRow=a,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 aI(){return new oI}var ym="xterm-dom-renderer-owner-",ms="xterm-rows",kd="xterm-fg-",Iw="xterm-bg-",Ul="xterm-focus",Cd="xterm-selection",lI=1,iv=class extends Te{constructor(e,t,n,s,r,i,o,a,c,u,d,h,p,f){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=s,this._viewportElement=r,this._helperContainer=i,this._linkifier2=o,this._charSizeService=c,this._optionsService=u,this._bufferService=d,this._coreService=h,this._coreBrowserService=p,this._themeService=f,this._terminalClass=lI++,this._rowElements=[],this._selectionRenderModel=aI(),this.onRequestRedraw=this._register(new re).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ms),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(Cd),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=rI(),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=a.createInstance(rv,document),this._element.classList.add(ym+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(at(()=>{this._element.classList.remove(ym+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new iI(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} .${ms} 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} .${ms} { 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} .${ms} .xterm-dim { color: ${st.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}`,s=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${ms}.${Ul} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${ms}.${Ul} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${ms}.${Ul} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${ms} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ms} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ms} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ms} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ms} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Cd} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Cd} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Cd} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[i,o]of e.ansi.entries())t+=`${this._terminalSelector} .${kd}${i} { color: ${o.css}; }${this._terminalSelector} .${kd}${i}.xterm-dim { color: ${st.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${Iw}${i} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${kd}257 { color: ${st.opaque(e.background).css}; }${this._terminalSelector} .${kd}257.xterm-dim { color: ${st.multiplyOpacity(st.opaque(e.background),.5).css}; }${this._terminalSelector} .${Iw}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 s=this._document.createElement("div");this._rowContainer.appendChild(s),this._rowElements.push(s)}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(Ul),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ul),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 s=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,i=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,a=this._document.createDocumentFragment();if(n){let c=e[0]>t[0];a.appendChild(this._createSelectionElement(i,c?t[0]:e[0],c?e[0]:t[0],o-i+1))}else{let c=s===i?e[0]:0,u=i===r?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(i,c,u));let d=o-i-1;if(a.appendChild(this._createSelectionElement(i+1,0,this._bufferService.cols,d)),i!==o){let h=r===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,h))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,n,s=1){let r=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),r.style.height=`${s*this.dimensions.css.cell.height}px`,r.style.top=`${e*this.dimensions.css.cell.height}px`,r.style.left=`${i}px`,r.style.width=`${o}px`,r}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,s=n.ybase+n.y,r=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,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let u=c+n.ydisp,d=this._rowElements[c],h=n.lines.get(u);if(!d||!h)break;d.replaceChildren(...this._rowFactory.createRow(h,u,u===s,o,a,r,i,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${ym}${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,s,r,i){n<0&&(e=0),s<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),s=Math.max(Math.min(s,o),0),r=Math.min(r,this._bufferService.cols);let a=this._bufferService.buffer,c=a.ybase+a.y,u=Math.min(a.x,r-1),d=this._optionsService.rawOptions.cursorBlink,h=this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=n;f<=s;++f){let m=f+a.ydisp,g=this._rowElements[f],v=a.lines.get(m);if(!g||!v)break;g.replaceChildren(...this._rowFactory.createRow(v,m,m===c,h,p,u,d,this.dimensions.css.cell.width,this._widthCache,i?f===n?e:0:-1,i?(f===s?t:r)-1:-1))}}};iv=bt([le(7,y0),le(8,dp),le(9,zn),le(10,Bn),le(11,ra),le(12,Xr),le(13,kl)],iv);var ov=class extends Te{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new re),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new uI(this._optionsService))}catch{this._measureStrategy=this._register(new cI(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())}};ov=bt([le(2,zn)],ov);var mE=class extends Te{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)}},cI=class extends mE{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}},uI=class extends mE{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}},dI=class extends Te{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 hI(this._window)),this._onDprChange=this._register(new re),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new re),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this._register(un.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(ve(this._textarea,"focus",()=>this._isFocused=!0)),this._register(ve(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}},hI=class extends Te{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new cl),this._onDprChange=this._register(new re),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(at(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=ve(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)}},fI=class extends Te{constructor(){super(),this.linkProviders=[],this._register(at(()=>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 j0(e,t,n){let s=n.getBoundingClientRect(),r=e.getComputedStyle(n),i=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-s.left-i,t.clientY-s.top-o]}function pI(e,t,n,s,r,i,o,a,c){if(!i)return;let u=j0(e,t,n);if(u)return u[0]=Math.ceil((u[0]+(c?o/2:0))/o),u[1]=Math.ceil(u[1]/a),u[0]=Math.min(Math.max(u[0],1),s+(c?1:0)),u[1]=Math.min(Math.max(u[1],1),r),u}var av=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,s,r){return pI(window,e,t,n,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){let n=j0(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])}}};av=bt([le(0,Qr),le(1,dp)],av);var mI=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=[]}},gE={};CA(gE,{getSafariVersion:()=>xI,isChromeOS:()=>_E,isFirefox:()=>xE,isIpad:()=>vI,isIphone:()=>yI,isLegacyEdge:()=>gI,isLinux:()=>E0,isMac:()=>yf,isNode:()=>hp,isSafari:()=>vE,isWindows:()=>yE});var hp=typeof process<"u"&&"title"in process,$u=hp?"node":navigator.userAgent,Hu=hp?"node":navigator.platform,xE=$u.includes("Firefox"),gI=$u.includes("Edge"),vE=/^((?!chrome|android).)*safari/i.test($u);function xI(){if(!vE)return 0;let e=$u.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var yf=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Hu),vI=Hu==="iPad",yI=Hu==="iPhone",yE=["Windows","Win16","Win32","WinCE"].includes(Hu),E0=Hu.indexOf("Linux")>=0,_E=/\bCrOS\b/.test($u),bE=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,s=e.timeRemaining(),r=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),r=e.timeRemaining(),n*1.5>r){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=r}this.clear()}},_I=class extends bE{_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())}}},bI=class extends bE{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},_f=!hp&&"requestIdleCallback"in window?bI:_I,wI=class{constructor(){this._queue=new _f}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},lv=class extends Te{constructor(e,t,n,s,r,i,o,a,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=s,this._coreService=r,this._coreBrowserService=a,this._renderer=this._register(new cl),this._pausedResizeTask=new wI,this._observerDisposable=this._register(new cl),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 re),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new re),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new re),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new re),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new mI((u,d)=>this._renderRows(u,d),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new SI(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(at(()=>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(s=>this._handleIntersectionChange(s[s.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=at(()=>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 s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),t=Math.max(t,s.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 s;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(s=this._renderer.value)==null||s.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};lv=bt([le(2,zn),le(3,dp),le(4,ra),le(5,zu),le(6,Bn),le(7,Xr),le(8,kl)],lv);var SI=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 kI(e,t,n,s){let r=n.buffer.x,i=n.buffer.y;if(!n.buffer.hasScrollback)return jI(r,i,e,t,n,s)+fp(i,t,n,s)+EI(r,i,e,t,n,s);let o;if(i===t)return o=r>e?"D":"C",hu(Math.abs(r-e),du(o,s));o=i>t?"D":"C";let a=Math.abs(i-t),c=NI(i>t?e:r,n)+(a-1)*n.cols+1+CI(i>t?r:e);return hu(c,du(o,s))}function CI(e,t){return e-1}function NI(e,t){return t.cols-e}function jI(e,t,n,s,r,i){return fp(t,s,r,i).length===0?"":hu(SE(e,t,e,t-Xo(t,r),!1,r).length,du("D",i))}function fp(e,t,n,s){let r=e-Xo(e,n),i=t-Xo(t,n),o=Math.abs(r-i)-PI(e,t,n);return hu(o,du(wE(e,t),s))}function EI(e,t,n,s,r,i){let o;fp(t,s,r,i).length>0?o=s-Xo(s,r):o=t;let a=s,c=TI(e,t,n,s,r,i);return hu(SE(e,o,n,a,c==="C",r).length,du(c,i))}function PI(e,t,n){var o;let s=0,r=e-Xo(e,n),i=t-Xo(t,n);for(let a=0;a<Math.abs(r-i);a++){let c=wE(e,t)==="A"?-1:1;(o=n.buffer.lines.get(r+c*a))!=null&&o.isWrapped&&s++}return s}function Xo(e,t){let n=0,s=t.buffer.lines.get(e),r=s==null?void 0:s.isWrapped;for(;r&&e>=0&&e<t.rows;)n++,s=t.buffer.lines.get(--e),r=s==null?void 0:s.isWrapped;return n}function TI(e,t,n,s,r,i){let o;return fp(n,s,r,i).length>0?o=s-Xo(s,r):o=t,e<n&&o<=s||e>=n&&o<s?"C":"D"}function wE(e,t){return e>t?"A":"B"}function SE(e,t,n,s,r,i){let o=e,a=t,c="";for(;(o!==n||a!==s)&&a>=0&&a<i.buffer.lines.length;)o+=r?1:-1,r&&o>i.cols-1?(c+=i.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!r&&o<0&&(c+=i.buffer.translateBufferLineToString(a,!1,0,e+1),o=i.cols-1,e=o,a--);return c+i.buffer.translateBufferLineToString(a,!1,e,o)}function du(e,t){let n=t?"O":"[";return G.ESC+n+e}function hu(e,t){e=Math.floor(e);let n="";for(let s=0;s<e;s++)n+=t;return n}var RI=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 Fw(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 _m=50,DI=15,MI=50,LI=500,AI=" ",OI=new RegExp(AI,"g"),cv=class extends Te{constructor(e,t,n,s,r,i,o,a,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=s,this._coreService=r,this._mouseService=i,this._optionsService=o,this._renderService=a,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Ps,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new re),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new re),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new re),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new re),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 RI(this._bufferService),this._activeSelectionMode=0,this._register(at(()=>{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,s=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let r=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 a=n.translateBufferLineToString(o,!0,r,i);s.push(a)}}else{let r=e[1]===t[1]?t[0]:void 0;s.push(n.translateBufferLineToString(e[1],!0,e[0],r));for(let i=e[1]+1;i<=t[1]-1;i++){let o=n.lines.get(i),a=n.translateBufferLineToString(i,!0);o!=null&&o.isWrapped?s[s.length-1]+=a:s.push(a)}if(e[1]!==t[1]){let i=n.lines.get(t[1]),o=n.translateBufferLineToString(t[1],!0,0,t[0]);i&&i.isWrapped?s[s.length-1]+=o:s.push(o)}}return s.map(r=>r.replace(OI," ")).join(yE?`\r
|
|
492
|
+
`:`
|
|
493
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),E0&&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,s=this._model.finalSelectionEnd;return!n||!s||!t?!1:this._areCoordsInSelection(t,n,s)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!n||!s?!1:this._areCoordsInSelection([e,t],n,s)}_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 r,i;let n=(i=(r=this._linkifier.currentLink)==null?void 0:r.link)==null?void 0:i.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=Fw(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,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=j0(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,-_m),_m),t/=_m,t/Math.abs(t)+Math.round(t*(DI-1)))}shouldForceSelection(e){return yf?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(),MI)}_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&&!(yf&&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 s=n.lines.get(this._model.selectionEnd[1]);s&&s.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<LI&&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 s=kI(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!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 s=0;t>=s;s++){let r=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:r>1&&t!==s&&(n+=r-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,s=!0){if(e[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,i=r.lines.get(e[1]);if(!i)return;let o=r.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(i,e[0]),c=a,u=e[0]-a,d=0,h=0,p=0,f=0;if(o.charAt(a)===" "){for(;a>0&&o.charAt(a-1)===" ";)a--;for(;c<o.length&&o.charAt(c+1)===" ";)c++}else{let v=e[0],x=e[0];i.getWidth(v)===0&&(d++,v--),i.getWidth(x)===2&&(h++,x++);let _=i.getString(x).length;for(_>1&&(f+=_-1,c+=_-1);v>0&&a>0&&!this._isCharWordSeparator(i.loadCell(v-1,this._workCell));){i.loadCell(v-1,this._workCell);let b=this._workCell.getChars().length;this._workCell.getWidth()===0?(d++,v--):b>1&&(p+=b-1,a-=b-1),a--,v--}for(;x<i.length&&c+1<o.length&&!this._isCharWordSeparator(i.loadCell(x+1,this._workCell));){i.loadCell(x+1,this._workCell);let b=this._workCell.getChars().length;this._workCell.getWidth()===2?(h++,x++):b>1&&(f+=b-1,c+=b-1),c++,x++}}c++;let m=a+u-d+p,g=Math.min(this._bufferService.cols,c-a+d+h-p-f);if(!(!t&&o.slice(a,c).trim()==="")){if(n&&m===0&&i.getCodePoint(0)!==32){let v=r.lines.get(e[1]-1);if(v&&i.isWrapped&&v.getCodePoint(this._bufferService.cols-1)!==32){let x=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(x){let _=this._bufferService.cols-x.start;m-=_,g+=_}}}if(s&&m+g===this._bufferService.cols&&i.getCodePoint(this._bufferService.cols-1)!==32){let v=r.lines.get(e[1]+1);if(v!=null&&v.isWrapped&&v.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=Fw(n,this._bufferService.cols)}};cv=bt([le(3,Bn),le(4,ra),le(5,_0),le(6,zn),le(7,Qr),le(8,Xr)],cv);var Bw=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={}}},zw=class{constructor(){this._color=new Bw,this._css=new Bw}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()}},At=Object.freeze((()=>{let e=[ct.toColor("#2e3436"),ct.toColor("#cc0000"),ct.toColor("#4e9a06"),ct.toColor("#c4a000"),ct.toColor("#3465a4"),ct.toColor("#75507b"),ct.toColor("#06989a"),ct.toColor("#d3d7cf"),ct.toColor("#555753"),ct.toColor("#ef2929"),ct.toColor("#8ae234"),ct.toColor("#fce94f"),ct.toColor("#729fcf"),ct.toColor("#ad7fa8"),ct.toColor("#34e2e2"),ct.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let s=t[n/36%6|0],r=t[n/6%6|0],i=t[n%6];e.push({css:Tt.toCss(s,r,i),rgba:Tt.toRgba(s,r,i)})}for(let n=0;n<24;n++){let s=8+n*10;e.push({css:Tt.toCss(s,s,s),rgba:Tt.toRgba(s,s,s)})}return e})()),co=ct.toColor("#ffffff"),hc=ct.toColor("#000000"),$w=ct.toColor("#ffffff"),Hw=hc,ql={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},II=co,uv=class extends Te{constructor(e){super(),this._optionsService=e,this._contrastCache=new zw,this._halfContrastCache=new zw,this._onChangeColors=this._register(new re),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:co,background:hc,cursor:$w,cursorAccent:Hw,selectionForeground:void 0,selectionBackgroundTransparent:ql,selectionBackgroundOpaque:st.blend(hc,ql),selectionInactiveBackgroundTransparent:ql,selectionInactiveBackgroundOpaque:st.blend(hc,ql),scrollbarSliderBackground:st.opacity(co,.2),scrollbarSliderHoverBackground:st.opacity(co,.4),scrollbarSliderActiveBackground:st.opacity(co,.5),overviewRulerBorder:co,ansi:At.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=Ve(e.foreground,co),t.background=Ve(e.background,hc),t.cursor=st.blend(t.background,Ve(e.cursor,$w)),t.cursorAccent=st.blend(t.background,Ve(e.cursorAccent,Hw)),t.selectionBackgroundTransparent=Ve(e.selectionBackground,ql),t.selectionBackgroundOpaque=st.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Ve(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=st.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Ve(e.selectionForeground,Aw):void 0,t.selectionForeground===Aw&&(t.selectionForeground=void 0),st.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=st.opacity(t.selectionBackgroundTransparent,.3)),st.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=st.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Ve(e.scrollbarSliderBackground,st.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Ve(e.scrollbarSliderHoverBackground,st.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Ve(e.scrollbarSliderActiveBackground,st.opacity(t.foreground,.5)),t.overviewRulerBorder=Ve(e.overviewRulerBorder,II),t.ansi=At.slice(),t.ansi[0]=Ve(e.black,At[0]),t.ansi[1]=Ve(e.red,At[1]),t.ansi[2]=Ve(e.green,At[2]),t.ansi[3]=Ve(e.yellow,At[3]),t.ansi[4]=Ve(e.blue,At[4]),t.ansi[5]=Ve(e.magenta,At[5]),t.ansi[6]=Ve(e.cyan,At[6]),t.ansi[7]=Ve(e.white,At[7]),t.ansi[8]=Ve(e.brightBlack,At[8]),t.ansi[9]=Ve(e.brightRed,At[9]),t.ansi[10]=Ve(e.brightGreen,At[10]),t.ansi[11]=Ve(e.brightYellow,At[11]),t.ansi[12]=Ve(e.brightBlue,At[12]),t.ansi[13]=Ve(e.brightMagenta,At[13]),t.ansi[14]=Ve(e.brightCyan,At[14]),t.ansi[15]=Ve(e.brightWhite,At[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<n;s++)t.ansi[s+16]=Ve(e.extendedAnsi[s],At[s+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()}}};uv=bt([le(0,zn)],uv);function Ve(e,t){if(e!==void 0)try{return ct.toColor(e)}catch{}return t}var FI=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)}},BI=class{constructor(){this._services=new FI,this._services.set(y0,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=DA(e).sort((i,o)=>i.index-o.index),s=[];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}.`);s.push(o)}let r=n.length>0?n[0].index:t.length;if(t.length!==r)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);return new e(...t,...s)}},zI={trace:0,debug:1,info:2,warn:3,error:4,off:5},$I="xterm.js: ",dv=class extends Te{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=zI[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?"":$I)+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)}};dv=bt([le(0,zn)],dv);var Ww=class extends Te{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new re),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new re),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new re),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 s=e;s<this._length-t;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+n.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<n.length;s++)this._array[this._getCyclicIndex(e+s)]=n[s];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let s=this._length+n.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}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 r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let s=e+t+n-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<t;s++)this.set(e+s+n,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Pe=3,Pt=Object.freeze(new Bu),Nd=0,bm=2,fc=class kE{constructor(t,n,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Pe);let r=n||Ps.fromCharData([0,Wj,1,0]);for(let i=0;i<t;++i)this.setCell(i,r);this.length=t}get(t){let n=this._data[t*Pe+0],s=n&2097151;return[this._data[t*Pe+1],n&2097152?this._combined[t]:s?di(s):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s]}set(t,n){this._data[t*Pe+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*Pe+0]=t|2097152|n[2]<<22):this._data[t*Pe+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*Pe+0]>>22}hasWidth(t){return this._data[t*Pe+0]&12582912}getFg(t){return this._data[t*Pe+1]}getBg(t){return this._data[t*Pe+2]}hasContent(t){return this._data[t*Pe+0]&4194303}getCodePoint(t){let n=this._data[t*Pe+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*Pe+0]&2097152}getString(t){let n=this._data[t*Pe+0];return n&2097152?this._combined[t]:n&2097151?di(n&2097151):""}isProtected(t){return this._data[t*Pe+2]&536870912}loadCell(t,n){return Nd=t*Pe,n.content=this._data[Nd+0],n.fg=this._data[Nd+1],n.bg=this._data[Nd+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*Pe+0]=n.content,this._data[t*Pe+1]=n.fg,this._data[t*Pe+2]=n.bg}setCellFromCodepoint(t,n,s,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*Pe+0]=n|s<<22,this._data[t*Pe+1]=r.fg,this._data[t*Pe+2]=r.bg}addCodepointToCell(t,n,s){let r=this._data[t*Pe+0];r&2097152?this._combined[t]+=di(n):r&2097151?(this._combined[t]=di(r&2097151)+di(n),r&=-2097152,r|=2097152):r=n|1<<22,s&&(r&=-12582913,r|=s<<22),this._data[t*Pe+0]=r}insertCells(t,n,s){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),n<this.length-t){let r=new Ps;for(let i=this.length-t-n-1;i>=0;--i)this.setCell(t+n+i,this.loadCell(t+i,r));for(let i=0;i<n;++i)this.setCell(t+i,s)}else for(let r=t;r<this.length;++r)this.setCell(r,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(t,n,s){if(t%=this.length,n<this.length-t){let r=new Ps;for(let i=0;i<this.length-t-n;++i)this.setCell(t+i,this.loadCell(t+n+i,r));for(let i=this.length-n;i<this.length;++i)this.setCell(i,s)}else for(let r=t;r<this.length;++r)this.setCell(r,s);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,s)}replaceCells(t,n,s,r=!1){if(r){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,s),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,s);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,s),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,s);t<n&&t<this.length;)this.setCell(t++,s)}resize(t,n){if(t===this.length)return this._data.length*4*bm<this._data.buffer.byteLength;let s=t*Pe;if(t>this.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let r=new Uint32Array(s);r.set(this._data),this._data=r}for(let r=this.length;r<t;++r)this.setCell(r,n)}else{this._data=this._data.subarray(0,s);let r=Object.keys(this._combined);for(let o=0;o<r.length;o++){let a=parseInt(r[o],10);a>=t&&delete this._combined[a]}let i=Object.keys(this._extendedAttrs);for(let o=0;o<i.length;o++){let a=parseInt(i[o],10);a>=t&&delete this._extendedAttrs[a]}}return this.length=t,s*4*bm<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*bm<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 s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,t);return}this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,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 kE(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*Pe+0]&4194303)return t+(this._data[t*Pe+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Pe+0]&4194303||this._data[t*Pe+2]&50331648)return t+(this._data[t*Pe+0]>>22);return 0}copyCellsFrom(t,n,s,r,i){let o=t._data;if(i)for(let c=r-1;c>=0;c--){for(let u=0;u<Pe;u++)this._data[(s+c)*Pe+u]=o[(n+c)*Pe+u];o[(n+c)*Pe+2]&268435456&&(this._extendedAttrs[s+c]=t._extendedAttrs[n+c])}else for(let c=0;c<r;c++){for(let u=0;u<Pe;u++)this._data[(s+c)*Pe+u]=o[(n+c)*Pe+u];o[(n+c)*Pe+2]&268435456&&(this._extendedAttrs[s+c]=t._extendedAttrs[n+c])}let a=Object.keys(t._combined);for(let c=0;c<a.length;c++){let u=parseInt(a[c],10);u>=n&&(this._combined[u-n+s]=t._combined[u])}}translateToString(t,n,s,r){n=n??0,s=s??this.length,t&&(s=Math.min(s,this.getTrimmedLength())),r&&(r.length=0);let i="";for(;n<s;){let o=this._data[n*Pe+0],a=o&2097151,c=o&2097152?this._combined[n]:a?di(a):Ni;if(i+=c,r)for(let u=0;u<c.length;++u)r.push(n);n+=o>>22||1}return r&&r.push(n),i}};function HI(e,t,n,s,r,i){let o=[];for(let a=0;a<e.length-1;a++){let c=a,u=e.get(++c);if(!u.isWrapped)continue;let d=[e.get(a)];for(;c<e.length&&u.isWrapped;)d.push(u),u=e.get(++c);if(!i&&s>=a&&s<c){a+=d.length-1;continue}let h=0,p=fu(d,h,t),f=1,m=0;for(;f<d.length;){let v=fu(d,f,t),x=v-m,_=n-p,b=Math.min(x,_);d[h].copyCellsFrom(d[f],m,p,b,!1),p+=b,p===n&&(h++,p=0),m+=b,m===v&&(f++,m=0),p===0&&h!==0&&d[h-1].getWidth(n-1)===2&&(d[h].copyCellsFrom(d[h-1],n-1,p++,1,!1),d[h-1].setCell(n-1,r))}d[h].replaceCells(p,n,r);let g=0;for(let v=d.length-1;v>0&&(v>h||d[v].getTrimmedLength()===0);v--)g++;g>0&&(o.push(a+d.length-g),o.push(g)),a+=d.length-1}return o}function WI(e,t){let n=[],s=0,r=t[s],i=0;for(let o=0;o<e.length;o++)if(r===o){let a=t[++s];e.onDeleteEmitter.fire({index:o-i,amount:a}),o+=a-1,i+=a,r=t[++s]}else n.push(o);return{layout:n,countRemoved:i}}function UI(e,t){let n=[];for(let s=0;s<t.length;s++)n.push(e.get(t[s]));for(let s=0;s<n.length;s++)e.set(s,n[s]);e.length=t.length}function qI(e,t,n){let s=[],r=e.map((c,u)=>fu(e,u,t)).reduce((c,u)=>c+u),i=0,o=0,a=0;for(;a<r;){if(r-a<n){s.push(r-a);break}i+=n;let c=fu(e,o,t);i>c&&(i-=c,o++);let u=e[o].getWidth(i-1)===2;u&&i--;let d=u?n-1:n;s.push(d),a+=d}return s}function fu(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let s=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,r=e[t+1].getWidth(0)===2;return s&&r?n-1:n}var CE=class NE{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=NE._nextId++,this._onDispose=this.register(new re),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Yo(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};CE._nextId=1;var KI=CE,Wt={},uo=Wt.B;Wt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Wt.A={"#":"£"};Wt.B=void 0;Wt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Wt.C=Wt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Wt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Wt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Wt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Wt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Wt.E=Wt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Wt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Wt.H=Wt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Wt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Uw=4294967295,qw=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=Pt.clone(),this.savedCharset=uo,this.markers=[],this._nullCell=Ps.fromCharData([0,Wj,1,0]),this._whitespaceCell=Ps.fromCharData([0,Ni,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new _f,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Ww(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 gf),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 gf),this._whitespaceCell}getBlankLine(e,t){return new fc(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>Uw?Uw:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Pt);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 Ww(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Pt),s=0,r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)s+=+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 fc(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 fc(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(r<this.lines.maxLength){let o=this.lines.length-r;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=r}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++)s+=+this.lines.get(i).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),s>.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,s=HI(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Pt),n);if(s.length>0){let r=WI(this.lines,s);UI(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let s=this.getNullCell(Pt),r=n;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new fc(e,s))):(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,s=this.getNullCell(Pt),r=[],i=0;for(let o=this.lines.length-1;o>=0;o--){let a=this.lines.get(o);if(!a||!a.isWrapped&&a.getTrimmedLength()<=e)continue;let c=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),c.unshift(a);if(!n){let b=this.ybase+this.y;if(b>=o&&b<o+c.length)continue}let u=c[c.length-1].getTrimmedLength(),d=qI(c,this._cols,e),h=d.length-c.length,p;this.ybase===0&&this.y!==this.lines.length-1?p=Math.max(0,this.y-this.lines.maxLength+h):p=Math.max(0,this.lines.length-this.lines.maxLength+h);let f=[];for(let b=0;b<h;b++){let S=this.getBlankLine(Pt,!0);f.push(S)}f.length>0&&(r.push({start:o+c.length+i,newLines:f}),i+=f.length),c.push(...f);let m=d.length-1,g=d[m];g===0&&(m--,g=d[m]);let v=c.length-h-1,x=u;for(;v>=0;){let b=Math.min(x,g);if(c[m]===void 0)break;if(c[m].copyCellsFrom(c[v],x-b,g-b,b,!0),g-=b,g===0&&(m--,g=d[m]),x-=b,x===0){v--;let S=Math.max(v,0);x=fu(c,S,this._cols)}}for(let b=0;b<c.length;b++)d[b]<e&&c[b].setCell(d[b],s);let _=h-p;for(;_-- >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+h,this.ybase+t-1)}if(r.length>0){let o=[],a=[];for(let g=0;g<this.lines.length;g++)a.push(this.lines.get(g));let c=this.lines.length,u=c-1,d=0,h=r[d];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(h&&h.start>u+p){for(let v=h.newLines.length-1;v>=0;v--)this.lines.set(g--,h.newLines[v]);g++,o.push({index:u+1,amount:h.newLines.length}),p+=h.newLines.length,h=r[++d]}else this.lines.set(g,a[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,s){let r=this.lines.get(e);return r?r.translateToString(t,n,s):""}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 KI(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)}},VI=class extends Te{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new re),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 qw(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new qw(!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)}},jE=2,EE=1,hv=class extends Te{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new re),this.onResize=this._onResize.event,this._onScroll=this._register(new re),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,jE),this.rows=Math.max(e.rawOptions.rows||0,EE),this.buffers=this._register(new VI(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,s=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==e.fg||s.getBg(0)!==e.bg)&&(s=n.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;let r=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(s):n.lines.push(s.clone()):n.lines.splice(i+1,0,s.clone()),o?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let o=i-r+1;n.lines.shiftElements(r+1,o-1,-1),n.lines.set(i,s.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 s=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),s!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};hv=bt([le(0,zn)],hv);var ua={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:yf,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},YI=["normal","bold","100","200","300","400","500","600","700","800","900"],XI=class extends Te{constructor(e){super(),this._onOptionChange=this._register(new re),this.onOptionChange=this._onOptionChange.event;let t={...ua};for(let n in e)if(n in t)try{let s=e[n];t[n]=this._sanitizeAndValidateOption(n,s)}catch(s){console.error(s)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(at(()=>{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 ua))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,s)=>{if(!(n in ua))throw new Error(`No option with key "${n}"`);s=this._sanitizeAndValidateOption(n,s),this.rawOptions[n]!==s&&(this.rawOptions[n]=s,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let s={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,s)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=ua[e]),!QI(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=ua[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=YI.includes(t)?t:ua[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 QI(e){return e==="block"||e==="underline"||e==="bar"}function pc(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let s in e)n[s]=t<=1?e[s]:e[s]&&pc(e[s],t-1);return n}var Kw=Object.freeze({insertMode:!1}),Vw=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),fv=class extends Te{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 re),this.onData=this._onData.event,this._onUserInput=this._register(new re),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new re),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new re),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=pc(Kw),this.decPrivateModes=pc(Vw)}reset(){this.modes=pc(Kw),this.decPrivateModes=pc(Vw)}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(s=>s.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))}};fv=bt([le(0,Bn),le(1,Yj),le(2,zn)],fv);var Yw={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 wm(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 Sm=String.fromCharCode,Xw={DEFAULT:e=>{let t=[wm(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Sm(t[0])}${Sm(t[1])}${Sm(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${wm(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${wm(e,!0)};${e.x};${e.y}${t}`}},pv=class extends Te{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 re),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(Yw))this.addProtocol(s,Yw[s]);for(let s of Object.keys(Xw))this.addEncoding(s,Xw[s]);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 s=t/n,r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=s+0,Math.abs(e.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_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)}};pv=bt([le(0,Bn),le(1,ra),le(2,zn)],pv);var km=[[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]],GI=[[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]],Ot;function JI(e,t){let n=0,s=t.length-1,r;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=n;)if(r=n+s>>1,e>t[r][1])n=r+1;else if(e<t[r][0])s=r-1;else return!0;return!1}var ZI=class{constructor(){if(this.version="6",!Ot){Ot=new Uint8Array(65536),Ot.fill(1),Ot[0]=0,Ot.fill(0,1,32),Ot.fill(0,127,160),Ot.fill(2,4352,4448),Ot[9001]=2,Ot[9002]=2,Ot.fill(2,11904,42192),Ot[12351]=1,Ot.fill(2,44032,55204),Ot.fill(2,63744,64256),Ot.fill(2,65040,65050),Ot.fill(2,65072,65136),Ot.fill(2,65280,65377),Ot.fill(2,65504,65511);for(let e=0;e<km.length;++e)Ot.fill(0,km[e][0],km[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Ot[e]:JI(e,GI)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),s=n===0&&t!==0;if(s){let r=_o.extractWidth(t);r===0?s=!1:r>n&&(n=r)}return _o.createPropertyValue(0,n,s)}},_o=class Sh{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new re,this.onChange=this._onChange.event;let t=new ZI;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,s=!1){return(t&16777215)<<3|(n&3)<<1|(s?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,s=0,r=t.length;for(let i=0;i<r;++i){let o=t.charCodeAt(i);if(55296<=o&&o<=56319){if(++i>=r)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 a=this.charProperties(o,s),c=Sh.extractWidth(a);Sh.extractShouldJoin(a)&&(c-=Sh.extractWidth(s)),n+=c,s=a}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},eF=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 Qw(e){var s;let t=(s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:s.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 Kl=2147483647,tF=256,PE=class mv{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>tF)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 mv;if(!t.length)return n;for(let s=Array.isArray(t[0])?1:0;s<t.length;++s){let r=t[s];if(Array.isArray(r))for(let i=0;i<r.length;++i)n.addSubParam(r[i]);else n.addParam(r)}return n}clone(){let t=new mv(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 s=this._subParamsIdx[n]>>8,r=this._subParamsIdx[n]&255;r-s>0&&t.push(Array.prototype.slice.call(this._subParams,s,r))}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>Kl?Kl: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>Kl?Kl: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,s=this._subParamsIdx[t]&255;return s-n>0?this._subParams.subarray(n,s):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let s=this._subParamsIdx[n]>>8,r=this._subParamsIdx[n]&255;r-s>0&&(t[n]=this._subParams.slice(s,r))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,r=s[n-1];s[n-1]=~r?Math.min(r*10+t,Kl):t}},Vl=[],nF=class{constructor(){this._state=0,this._active=Vl,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 s=n.indexOf(t);s!==-1&&n.splice(s,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=Vl}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=Vl,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Vl,!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",up(e,t,n));else for(let s=this._active.length-1;s>=0;s--)this._active[s].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 s=e[t++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-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,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,n=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&n===!1){for(;s>=0&&(n=this._active[s].end(e),n!==!0);s--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,n;s--}for(;s>=0;s--)if(n=this._active[s].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,n}this._active=Vl,this._id=-1,this._state=0}}},ss=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,n,s){this._hitLimit||(this._data+=up(t,n,s),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(s=>(this._data="",this._hitLimit=!1,s));return this._data="",this._hitLimit=!1,n}},Yl=[],sF=class{constructor(){this._handlers=Object.create(null),this._active=Yl,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Yl}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let s=n.indexOf(t);s!==-1&&n.splice(s,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=Yl,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Yl,!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",up(e,t,n));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,n=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&n===!1){for(;s>=0&&(n=this._active[s].unhook(e),n!==!0);s--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,n;s--}for(;s>=0;s--)if(n=this._active[s].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,n}this._active=Yl,this._ident=0}},mc=new PE;mc.addParam(0);var Gw=class{constructor(e){this._handler=e,this._data="",this._params=mc,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():mc,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=up(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=mc,this._data="",this._hitLimit=!1,n));return this._params=mc,this._data="",this._hitLimit=!1,t}},rF=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,s){this.table[t<<8|e]=n<<4|s}addMany(e,t,n,s){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=n<<4|s}},bs=160,iF=function(){let e=new rF(4095),t=Array.apply(null,Array(256)).map((a,c)=>c),n=(a,c)=>t.slice(a,c),s=n(32,127),r=n(0,24);r.push(25),r.push.apply(r,n(28,32));let i=n(0,14),o;e.setDefault(1,0),e.addMany(s,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(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,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(s,7,0,7),e.addMany(r,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(r,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(r,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(r,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(r,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(r,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(bs,0,2,0),e.add(bs,8,5,8),e.add(bs,6,0,6),e.add(bs,11,0,11),e.add(bs,13,13,13),e}(),oF=class extends Te{constructor(e=iF){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 PE,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,s)=>{},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(at(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new nF),this._dcsParser=this._register(new sF),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 r=0;r<e.intermediates.length;++r){let i=e.intermediates.charCodeAt(r);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 s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=s,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 s=this._escHandlers[n];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,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 s=this._csiHandlers[n];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,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,s,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=s,this._parseStack.chunkPos=r}parse(e,t,n){let s=0,r=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 a=this._parseStack.handlers,c=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&c>-1){for(;c>=0&&(o=a[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=a[c](),o!==!0);c--)if(o instanceof Promise)return this._parseStack.handlerPos=c,o}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(s!==24&&s!==26,n),o)return o;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],o=this._oscParser.end(s!==24&&s!==26,n),o)return o;s===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 a=i;a<t;++a){switch(s=e[a],r=this._transitions.table[this.currentState<<8|(s<160?s:bs)],r>>4){case 2:for(let p=a+1;;++p){if(p>=t||(s=e[p])<32||s>126&&s<bs){this._printHandler(e,a,p),a=p-1;break}if(++p>=t||(s=e[p])<32||s>126&&s<bs){this._printHandler(e,a,p),a=p-1;break}if(++p>=t||(s=e[p])<32||s>126&&s<bs){this._printHandler(e,a,p),a=p-1;break}if(++p>=t||(s=e[p])<32||s>126&&s<bs){this._printHandler(e,a,p),a=p-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let c=this._csiHandlers[this._collect<<8|s],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,r,a),o;u<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++a<t&&(s=e[a])>47&&s<60);a--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let d=this._escHandlers[this._collect<<8|s],h=d?d.length-1:-1;for(;h>=0&&(o=d[h](),o!==!0);h--)if(o instanceof Promise)return this._preserveStack(4,d,h,r,a),o;h<0&&this._escHandlerFb(this._collect<<8|s),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|s,this._params);break;case 13:for(let p=a+1;;++p)if(p>=t||(s=e[p])===24||s===26||s===27||s>127&&s<bs){this._dcsParser.put(e,a,p),a=p-1;break}break;case 14:if(o=this._dcsParser.unhook(s!==24&&s!==26),o)return this._preserveStack(6,[],0,r,a),o;s===27&&(r|=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=a+1;;p++)if(p>=t||(s=e[p])<32||s>127&&s<bs){this._oscParser.put(e,a,p),a=p-1;break}break;case 6:if(o=this._oscParser.end(s!==24&&s!==26),o)return this._preserveStack(5,[],0,r,a),o;s===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=r&15}}},aF=/^([\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})$/,lF=/^[\da-f]+$/;function Jw(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=aF.exec(t);if(n){let s=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/s*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/s*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/s*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),lF.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,s=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(n*r,n*r+n),16);s[r]=n===1?i<<4:n===2?i:n===3?i>>4:i>>8}return s}}function Cm(e,t){let n=e.toString(16),s=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function cF(e,t=16){let[n,s,r]=e;return`rgb:${Cm(n,t)}/${Cm(s,t)}/${Cm(r,t)}`}var uF={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ri=131072,Zw=10;function e1(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 t1=5e3,n1=0,dF=class extends Te{constructor(e,t,n,s,r,i,o,a,c=new oF){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=s,this._optionsService=r,this._oscLinkService=i,this._coreMouseService=o,this._unicodeService=a,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new TA,this._utf8Decoder=new RA,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Pt.clone(),this._eraseAttrDataInternal=Pt.clone(),this._onRequestBell=this._register(new re),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new re),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new re),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new re),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new re),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new re),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new re),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new re),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new re),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new re),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new re),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new re),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new re),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 gv(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(u=>this._activeBuffer=u.activeBuffer)),this._parser.setCsiHandlerFallback((u,d)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(u),params:d.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,d,h)=>{this._logService.debug("Unknown OSC code: ",{identifier:u,action:d,data:h})}),this._parser.setDcsHandlerFallback((u,d,h)=>{d==="HOOK"&&(h=h.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(u),action:d,payload:h})}),this._parser.setPrintHandler((u,d,h)=>this.print(u,d,h)),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(G.BEL,()=>this.bell()),this._parser.setExecuteHandler(G.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(G.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(G.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(G.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(G.BS,()=>this.backspace()),this._parser.setExecuteHandler(G.HT,()=>this.tab()),this._parser.setExecuteHandler(G.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(G.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(bh.IND,()=>this.index()),this._parser.setExecuteHandler(bh.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(bh.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new ss(u=>(this.setTitle(u),this.setIconName(u),!0))),this._parser.registerOscHandler(1,new ss(u=>this.setIconName(u))),this._parser.registerOscHandler(2,new ss(u=>this.setTitle(u))),this._parser.registerOscHandler(4,new ss(u=>this.setOrReportIndexedColor(u))),this._parser.registerOscHandler(8,new ss(u=>this.setHyperlink(u))),this._parser.registerOscHandler(10,new ss(u=>this.setOrReportFgColor(u))),this._parser.registerOscHandler(11,new ss(u=>this.setOrReportBgColor(u))),this._parser.registerOscHandler(12,new ss(u=>this.setOrReportCursorColor(u))),this._parser.registerOscHandler(104,new ss(u=>this.restoreIndexedColor(u))),this._parser.registerOscHandler(110,new ss(u=>this.restoreFgColor(u))),this._parser.registerOscHandler(111,new ss(u=>this.restoreBgColor(u))),this._parser.registerOscHandler(112,new ss(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 Wt)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 Gw((u,d)=>this.requestStatusString(u,d)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),t1))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${t1} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,s=this._activeBuffer.x,r=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;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>ri&&(i=this._parseStack.position+ri)}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<ri&&(this._parseBuffer=new Uint32Array(Math.min(e.length,ri))),o||this._dirtyRowTracker.clearRange(),e.length>ri)for(let u=i;u<e.length;u+=ri){let d=u+ri<e.length?u+ri:e.length,h=typeof e=="string"?this._stringDecoder.decode(e.substring(u,d),this._parseBuffer):this._utf8Decoder.decode(e.subarray(u,d),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,h))return this._preserveStack(s,r,h,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(s,r,u,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==s||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let a=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(a,this._bufferService.rows-1)})}print(e,t,n){let s,r,i=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,u=this._coreService.modes.insertMode,d=this._curAttrData,h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&h.getWidth(this._activeBuffer.x-1)===2&&h.setCellFromCodepoint(this._activeBuffer.x-1,0,1,d);let p=this._parser.precedingJoinState;for(let f=t;f<n;++f){if(s=e[f],s<127&&i){let x=i[String.fromCharCode(s)];x&&(s=x.charCodeAt(0))}let m=this._unicodeService.charProperties(s,p);r=_o.extractWidth(m);let g=_o.extractShouldJoin(m),v=g?_o.extractWidth(p):0;if(p=m,o&&this._onA11yChar.fire(di(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-v>a){if(c){let x=h,_=this._activeBuffer.x-v;for(this._activeBuffer.x=v,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),h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),v>0&&h instanceof fc&&h.copyCellsFrom(x,_,0,v,!1);_<a;)x.setCellFromCodepoint(_++,0,1,d)}else if(this._activeBuffer.x=a-1,r===2)continue}if(g&&this._activeBuffer.x){let x=h.getWidth(this._activeBuffer.x-1)?1:2;h.addCodepointToCell(this._activeBuffer.x-x,s,r);for(let _=r-v;--_>=0;)h.setCellFromCodepoint(this._activeBuffer.x++,0,0,d);continue}if(u&&(h.insertCells(this._activeBuffer.x,r-v,this._activeBuffer.getNullCell(d)),h.getWidth(a-1)===2&&h.setCellFromCodepoint(a-1,0,1,d)),h.setCellFromCodepoint(this._activeBuffer.x++,s,r,d),r>0)for(;--r;)h.setCellFromCodepoint(this._activeBuffer.x++,0,0,d)}this._parser.precedingJoinState=p,this._activeBuffer.x<a&&n-t>0&&h.getWidth(this._activeBuffer.x)===0&&!h.hasContent(this._activeBuffer.x)&&h.setCellFromCodepoint(this._activeBuffer.x,0,1,d),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>e1(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Gw(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new ss(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,s=!1,r=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(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 s;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--&&!((s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&s.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 r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,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,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(r-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,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(s,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(Pt));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 s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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,s=_o.extractWidth(t),r=this._activeBuffer.x-s,i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),o=new Uint32Array(i.length*n),a=0;for(let u=0;u<i.length;){let d=i.codePointAt(u)||0;o[a++]=d,u+=d>65535?2:1}let c=a;for(let u=1;u<n;++u)o.copyWithin(c,0,a),c+=a;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(G.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(G.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(G.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(G.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(G.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,uo),this._charsetService.setgCharset(1,uo),this._charsetService.setgCharset(2,uo),this._charsetService.setgCharset(3,uo);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 s=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:i}=this._coreMouseService,o=this._coreService,{buffers:a,cols:c}=this._bufferService,{active:u,alt:d}=a,h=this._optionsService.rawOptions,p=(g,v)=>(o.triggerDataEvent(`${G.ESC}[${t?"":"?"}${g};${v}$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(h.convertEol)):p(m,0):m===1?p(m,f(s.applicationCursorKeys)):m===3?p(m,h.windowOptions.setWinLines?c===80?2:c===132?1:0:0):m===6?p(m,f(s.origin)):m===7?p(m,f(s.wraparound)):m===8?p(m,3):m===9?p(m,f(r==="X10")):m===12?p(m,f(h.cursorBlink)):m===25?p(m,f(!o.isCursorHidden)):m===45?p(m,f(s.reverseWraparound)):m===66?p(m,f(s.applicationKeypad)):m===67?p(m,4):m===1e3?p(m,f(r==="VT200")):m===1002?p(m,f(r==="DRAG")):m===1003?p(m,f(r==="ANY")):m===1004?p(m,f(s.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===d)):m===2004?p(m,f(s.bracketedPasteMode)):m===2026?p(m,f(s.synchronizedOutput)):p(m,0)}_updateAttrColor(e,t,n,s,r){return t===2?(e|=50331648,e&=-16777216,e|=Bu.fromColorRGB([n,s,r])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let s=[0,0,-1,0,0,0],r=0,i=0;do{if(s[i+r]=e.params[t+i],e.hasSubParams(t+i)){let o=e.getSubParams(t+i),a=0;do s[1]===5&&(r=1),s[i+a+1+r]=o[a];while(++a<o.length&&a+i+1+r<s.length);break}if(s[1]===5&&i+r>=2||s[1]===2&&i+r>=5)break;s[1]&&(r=1)}while(++i+t<e.length&&i+r<s.length);for(let o=2;o<s.length;++o)s[o]===-1&&(s[o]=0);switch(s[0]){case 38:n.fg=this._updateAttrColor(n.fg,s[1],s[3],s[4],s[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,s[1],s[3],s[4],s[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,s[1],s[3],s[4],s[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=Pt.fg,e.bg=Pt.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,s=this._curAttrData;for(let r=0;r<t;r++)n=e.params[r],n>=30&&n<=37?(s.fg&=-50331904,s.fg|=16777216|n-30):n>=40&&n<=47?(s.bg&=-50331904,s.bg|=16777216|n-40):n>=90&&n<=97?(s.fg&=-50331904,s.fg|=16777216|n-90|8):n>=100&&n<=107?(s.bg&=-50331904,s.bg|=16777216|n-100|8):n===0?this._processSGR0(s):n===1?s.fg|=134217728:n===3?s.bg|=67108864:n===4?(s.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,s)):n===5?s.fg|=536870912:n===7?s.fg|=67108864:n===8?s.fg|=1073741824:n===9?s.fg|=2147483648:n===2?s.bg|=134217728:n===21?this._processUnderline(2,s):n===22?(s.fg&=-134217729,s.bg&=-134217729):n===23?s.bg&=-67108865:n===24?(s.fg&=-268435457,this._processUnderline(0,s)):n===25?s.fg&=-536870913:n===27?s.fg&=-67108865:n===28?s.fg&=-1073741825:n===29?s.fg&=2147483647:n===39?(s.fg&=-67108864,s.fg|=Pt.fg&16777215):n===49?(s.bg&=-67108864,s.bg|=Pt.bg&16777215):n===38||n===48||n===58?r+=this._extractColor(e,r,s):n===53?s.bg|=1073741824:n===55?s.bg&=-1073741825:n===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):n===100?(s.fg&=-67108864,s.fg|=Pt.fg&16777215,s.bg&=-67108864,s.bg|=Pt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${G.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${G.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(`${G.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=Pt.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(!e1(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(`${G.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Zw&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Zw&&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 s=n.shift(),r=n.shift();if(/^\d+$/.exec(s)){let i=parseInt(s);if(s1(i))if(r==="?")t.push({type:0,index:i});else{let o=Jw(r);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(),s=e.slice(t+1);return s?this._createHyperlink(n,s):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),s,r=n.findIndex(i=>i.startsWith("id="));return r!==-1&&(s=n[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,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 s=0;s<n.length&&!(t>=this._specialColors.length);++s,++t)if(n[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=Jw(n[s]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}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 s=0;s<n.length;++s)if(/^\d+$/.exec(n[s])){let r=parseInt(n[s]);s1(r)&&t.push({type:2,index:r})}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,uo),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(uF[e[0]],Wt[e[1]]||uo),!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=Pt.clone(),this._eraseAttrDataInternal=Pt.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 Ps;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,s=this._activeBuffer.lines.get(n);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=o=>(this._coreService.triggerDataEvent(`${G.ESC}${o}${G.ESC}\\`),!0),s=this._bufferService.buffer,r=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${s.scrollTop+1};${s.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},gv=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&&(n1=e,e=t,t=n1),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};gv=bt([le(0,Bn)],gv);function s1(e){return 0<=e&&e<256}var hF=5e7,r1=12,fF=50,pF=class extends Te{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 re),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 s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>hF)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 s=this._writeBuffer[this._bufferOffset],r=this._action(s,t);if(r){let o=a=>performance.now()-n>=r1?setTimeout(()=>this._innerWrite(0,a)):this._innerWrite(n,a);r.catch(a=>(queueMicrotask(()=>{throw a}),Promise.resolve(!1))).then(o);return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-n>=r1)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>fF&&(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()}},xv=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 a=t.addMarker(t.ybase+t.y),c={data:e,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(c,a)),this._dataByLinkId.set(c.id,c),c.id}let n=e,s=this._getEntryIdKey(n),r=this._entriesWithId.get(s);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.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(s=>s.line!==t)){let s=this._bufferService.buffer.addMarker(t);n.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(n,s))}}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)))}};xv=bt([le(0,Bn)],xv);var i1=!1,mF=class extends Te{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new cl),this._onBinary=this._register(new re),this.onBinary=this._onBinary.event,this._onData=this._register(new re),this.onData=this._onData.event,this._onLineFeed=this._register(new re),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new re),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new re),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new re),this._instantiationService=new BI,this.optionsService=this._register(new XI(e)),this._instantiationService.setService(zn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(hv)),this._instantiationService.setService(Bn,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(dv)),this._instantiationService.setService(Yj,this._logService),this.coreService=this._register(this._instantiationService.createInstance(fv)),this._instantiationService.setService(ra,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(pv)),this._instantiationService.setService(Vj,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(_o)),this._instantiationService.setService(AA,this.unicodeService),this._charsetService=this._instantiationService.createInstance(eF),this._instantiationService.setService(LA,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(xv),this._instantiationService.setService(Xj,this._oscLinkService),this._inputHandler=this._register(new dF(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(un.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(un.forward(this._bufferService.onResize,this._onResize)),this._register(un.forward(this.coreService.onData,this._onData)),this._register(un.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 pF((t,n)=>this._inputHandler.parse(t,n))),this._register(un.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new re),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&&!i1&&(this._logService.warn("writeSync is unreliable and will be removed soon."),i1=!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,jE),t=Math.max(t,EE),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(Qw.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Qw(this._bufferService),!1))),this._windowsWrappingHeuristics.value=at(()=>{for(let t of e)t.dispose()})}}},gF={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 xF(e,t,n,s){var o;let r={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?r.key=G.ESC+"OA":r.key=G.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?r.key=G.ESC+"OD":r.key=G.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?r.key=G.ESC+"OC":r.key=G.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?r.key=G.ESC+"OB":r.key=G.ESC+"[B");break;case 8:r.key=e.ctrlKey?"\b":G.DEL,e.altKey&&(r.key=G.ESC+r.key);break;case 9:if(e.shiftKey){r.key=G.ESC+"[Z";break}r.key=G.HT,r.cancel=!0;break;case 13:r.key=e.altKey?G.ESC+G.CR:G.CR,r.cancel=!0;break;case 27:r.key=G.ESC,e.altKey&&(r.key=G.ESC+G.ESC),r.cancel=!0;break;case 37:if(e.metaKey)break;i?r.key=G.ESC+"[1;"+(i+1)+"D":t?r.key=G.ESC+"OD":r.key=G.ESC+"[D";break;case 39:if(e.metaKey)break;i?r.key=G.ESC+"[1;"+(i+1)+"C":t?r.key=G.ESC+"OC":r.key=G.ESC+"[C";break;case 38:if(e.metaKey)break;i?r.key=G.ESC+"[1;"+(i+1)+"A":t?r.key=G.ESC+"OA":r.key=G.ESC+"[A";break;case 40:if(e.metaKey)break;i?r.key=G.ESC+"[1;"+(i+1)+"B":t?r.key=G.ESC+"OB":r.key=G.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key=G.ESC+"[2~");break;case 46:i?r.key=G.ESC+"[3;"+(i+1)+"~":r.key=G.ESC+"[3~";break;case 36:i?r.key=G.ESC+"[1;"+(i+1)+"H":t?r.key=G.ESC+"OH":r.key=G.ESC+"[H";break;case 35:i?r.key=G.ESC+"[1;"+(i+1)+"F":t?r.key=G.ESC+"OF":r.key=G.ESC+"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key=G.ESC+"[5;"+(i+1)+"~":r.key=G.ESC+"[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key=G.ESC+"[6;"+(i+1)+"~":r.key=G.ESC+"[6~";break;case 112:i?r.key=G.ESC+"[1;"+(i+1)+"P":r.key=G.ESC+"OP";break;case 113:i?r.key=G.ESC+"[1;"+(i+1)+"Q":r.key=G.ESC+"OQ";break;case 114:i?r.key=G.ESC+"[1;"+(i+1)+"R":r.key=G.ESC+"OR";break;case 115:i?r.key=G.ESC+"[1;"+(i+1)+"S":r.key=G.ESC+"OS";break;case 116:i?r.key=G.ESC+"[15;"+(i+1)+"~":r.key=G.ESC+"[15~";break;case 117:i?r.key=G.ESC+"[17;"+(i+1)+"~":r.key=G.ESC+"[17~";break;case 118:i?r.key=G.ESC+"[18;"+(i+1)+"~":r.key=G.ESC+"[18~";break;case 119:i?r.key=G.ESC+"[19;"+(i+1)+"~":r.key=G.ESC+"[19~";break;case 120:i?r.key=G.ESC+"[20;"+(i+1)+"~":r.key=G.ESC+"[20~";break;case 121:i?r.key=G.ESC+"[21;"+(i+1)+"~":r.key=G.ESC+"[21~";break;case 122:i?r.key=G.ESC+"[23;"+(i+1)+"~":r.key=G.ESC+"[23~";break;case 123:i?r.key=G.ESC+"[24;"+(i+1)+"~":r.key=G.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?r.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?r.key=G.NUL:e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?r.key=G.DEL:e.keyCode===219?r.key=G.ESC:e.keyCode===220?r.key=G.FS:e.keyCode===221&&(r.key=G.GS);else if((!n||s)&&e.altKey&&!e.metaKey){let a=(o=gF[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(a)r.key=G.ESC+a;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()),r.key=G.ESC+u}else if(e.keyCode===32)r.key=G.ESC+(e.ctrlKey?G.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let c=e.code.slice(3,4);e.shiftKey||(c=c.toLowerCase()),r.key=G.ESC+c,r.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(r.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?r.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(r.key=G.US),e.key==="@"&&(r.key=G.NUL));break}return r}var St=0,vF=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new _f,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new _f,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((r,i)=>this._getKey(r)-this._getKey(i)),t=0,n=0,s=new Array(this._array.length+this._insertedValues.length);for(let r=0;r<s.length;r++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(s[r]=e[t],t++):s[r]=this._array[n++];this._array=s,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||(St=this._search(t),St===-1)||this._getKey(this._array[St])!==t)return!1;do if(this._array[St]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(St),!0;while(++St<this._array.length&&this._getKey(this._array[St])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((r,i)=>r-i),t=0,n=new Array(this._array.length-e.length),s=0;for(let r=0;r<this._array.length;r++)e[t]===r?t++:n[s++]=this._array[r];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&&(St=this._search(e),!(St<0||St>=this._array.length)&&this._getKey(this._array[St])===e))do yield this._array[St];while(++St<this._array.length&&this._getKey(this._array[St])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(St=this._search(e),!(St<0||St>=this._array.length)&&this._getKey(this._array[St])===e))do t(this._array[St]);while(++St<this._array.length&&this._getKey(this._array[St])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let s=t+n>>1,r=this._getKey(this._array[s]);if(r>e)n=s-1;else if(r<e)t=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return t}},Nm=0,o1=0,yF=class extends Te{constructor(){super(),this._decorations=new vF(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new re),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new re),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(at(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new _F(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),s=t.onDispose(()=>{s.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 s=0,r=0;for(let i of this._decorations.getKeyIterator(t))s=i.options.x??0,r=s+(i.options.width??1),e>=s&&e<r&&(!n||(i.options.layer??"bottom")===n)&&(yield i)}forEachDecorationAtCell(e,t,n,s){this._decorations.forEachByKey(t,r=>{Nm=r.options.x??0,o1=Nm+(r.options.width??1),e>=Nm&&e<o1&&(!n||(r.options.layer??"bottom")===n)&&s(r)})}},_F=class extends $i{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new re),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new re),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=ct.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=ct.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},bF=1e3,wF=class{constructor(e,t=bF){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 s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=s-this._lastRefreshMs,i=this._debounceThresholdMS-r;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)}},a1=20,bf=class extends Te{constructor(e,t,n,s){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.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=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new wF(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(`
|
|
494
|
+
`))),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(ve(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(at(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<a1+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
495
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===a1+1&&(this._liveRegion.textContent+=Ix.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,s=n.lines.length.toString();for(let r=e;r<=t;r++){let i=n.lines.get(n.ydisp+r),o=[],a=(i==null?void 0:i.translateToString(!0,void 0,void 0,o))||"",c=(n.ydisp+r+1).toString(),u=this._rowElements[r];u&&(a.length===0?(u.textContent=" ",this._rowColumns.set(u,[0,1])):(u.textContent=a,this._rowColumns.set(u,o)),u.setAttribute("aria-posinset",c),u.setAttribute("aria-setsize",s),this._alignRowWidth(u))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,s=this._rowElements[t===0?1:this._rowElements.length-2],r=n.getAttribute("aria-posinset"),i=t===0?"1":`${this._terminal.buffer.lines.length}`;if(r===i||e.relatedTarget!==s)return;let o,a;if(t===0?(o=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(o=this._rowElements.shift(),a=n,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),a.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 a;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 s=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:s,offset:((a=s.textContent)==null?void 0:a.length)??0}),!this._rowContainer.contains(n.node))return;let r=({node:c,offset:u})=>{let d=c instanceof Text?c.parentNode:c,h=parseInt(d==null?void 0:d.getAttribute("aria-posinset"),10)-1;if(isNaN(h))return console.warn("row is invalid. Race condition?"),null;let p=this._rowColumns.get(d);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&&(++h,f=0),{row:h,column:f}},i=r(t),o=r(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 r,i;e.style.transform="";let t=e.getBoundingClientRect().width,n=(i=(r=this._rowColumns.get(e))==null?void 0:r.slice(-1))==null?void 0:i[0];if(!n)return;let s=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${s/t})`}};bf=bt([le(1,y0),le(2,Xr),le(3,Qr)],bf);var vv=class extends Te{constructor(e,t,n,s,r){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=s,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new re),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new re),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(at(()=>{var i;Yo(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(ve(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(ve(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(ve(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(ve(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 s=0;s<n.length;s++){let r=n[s];if(r.classList.contains("xterm"))break;if(r.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 s,r;(!this._activeProviderReplies||!t)&&((s=this._activeProviderReplies)==null||s.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?(r=this._activeProviderReplies)!=null&&r.get(i)&&(n=this._checkLinkProviderResult(i,e,n)):o.provideLinks(e.y,a=>{var u,d;if(this._isMouseOut)return;let c=a==null?void 0:a.map(h=>({link:h}));(u=this._activeProviderReplies)==null||u.set(i,c),n=this._checkLinkProviderResult(i,e,n),((d=this._activeProviderReplies)==null?void 0:d.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let s=0;s<t.size;s++){let r=t.get(s);if(r)for(let i=0;i<r.length;i++){let o=r[i],a=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=a;u<=c;u++){if(n.has(u)){r.splice(i--,1);break}n.add(u)}}}}_checkLinkProviderResult(e,t,n){var i;if(!this._activeProviderReplies)return n;let s=this._activeProviderReplies.get(e),r=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(r=!0);if(!r&&s){let o=s.find(a=>this._linkAtPosition(a.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 a=(i=this._activeProviderReplies.get(o))==null?void 0:i.find(c=>this._linkAtPosition(c.link,t));if(a){n=!0,this._handleNewLink(a);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&&SF(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,Yo(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,s;return(s=(n=this._currentLink)==null?void 0:n.state)==null?void 0:s.decorations.pointerCursor},set:n=>{var s;(s=this._currentLink)!=null&&s.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,s;return(s=(n=this._currentLink)==null?void 0:n.state)==null?void 0:s.decorations.underline},set:n=>{var s,r,i;(s=this._currentLink)!=null&&s.state&&((i=(r=this._currentLink)==null?void 0:r.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 s=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(s,r),this._lastMouseEvent)){let i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._askForLink(i,!1)}})))}_linkHover(e,t,n){var s;(s=this._currentLink)!=null&&s.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,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-s-1,n.end.x,n.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,n){var s;(s=this._currentLink)!=null&&s.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,s=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return n<=r&&r<=s}_positionFromMouseEvent(e,t,n){let s=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,s,r){return{x1:e,y1:t,x2:n,y2:s,cols:this._bufferService.cols,fg:r}}};vv=bt([le(1,_0),le(2,Qr),le(3,Bn),le(4,Gj)],vv);function SF(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 kF=class extends mF{constructor(e={}){super(e),this._linkifier=this._register(new cl),this.browser=gE,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new cl),this._onCursorMove=this._register(new re),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new re),this.onKey=this._onKey.event,this._onRender=this._register(new re),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new re),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new re),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new re),this.onBell=this._onBell.event,this._onFocus=this._register(new re),this._onBlur=this._register(new re),this._onA11yCharEmitter=this._register(new re),this._onA11yTabEmitter=this._register(new re),this._onWillOpen=this._register(new re),this._setup(),this._decorationService=this._instantiationService.createInstance(yF),this._instantiationService.setService(zu,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(fI),this._instantiationService.setService(Gj,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Bx)),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(un.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(un.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(un.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(un.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(at(()=>{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,s="";switch(t.index){case 256:n="foreground",s="10";break;case 257:n="background",s="11";break;case 258:n="cursor",s="12";break;default:n="ansi",s="4;"+t.index}switch(t.type){case 0:let r=st.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${G.ESC}]${s};${cF(r)}${pE.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(i=>i.ansi[t.index]=Tt.toColor(...t.color));else{let i=n;this._themeService.modifyColors(o=>o[i]=Tt.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(bf,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.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(G.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),s=this._renderService.dimensions.css.cell.height,r=t.getWidth(n),i=this._renderService.dimensions.css.cell.width*r,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=i+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(ve(this.element,"copy",t=>{this.hasSelection()&&EA(t,this._selectionService)}));let e=t=>PA(t,this.textarea,this.coreService,this.optionsService);this._register(ve(this.textarea,"paste",e)),this._register(ve(this.element,"paste",e)),xE?this._register(ve(this.element,"mousedown",t=>{t.button===2&&xw(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(ve(this.element,"contextmenu",t=>{xw(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),E0&&this._register(ve(this.element,"auxclick",t=>{t.button===1&&Hj(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(ve(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(ve(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(ve(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(ve(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(ve(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(ve(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(ve(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var r;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"),((r=this.element)==null?void 0:r.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(ve(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",Ox.get()),_E||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(dI,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Xr,this._coreBrowserService),this._register(ve(this.textarea,"focus",i=>this._handleTextAreaFocus(i))),this._register(ve(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(ov,this._document,this._helperContainer),this._instantiationService.setService(dp,this._charSizeService),this._themeService=this._instantiationService.createInstance(uv),this._instantiationService.setService(kl,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(vf),this._instantiationService.setService(Qj,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(lv,this.rows,this.screenElement)),this._instantiationService.setService(Qr,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(sv,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(av),this._instantiationService.setService(_0,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(vv,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(tv,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(cv,this.element,this.screenElement,s)),this._instantiationService.setService(IA,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(un.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var i;this._selectionService.refresh(),(i=this._viewport)==null||i.queueSync()})),this._register(this._instantiationService.createInstance(nv,this.screenElement)),this._register(ve(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(bf,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",i=>this._handleScreenReaderModeOptionChange(i))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(xf,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",i=>{!this._overviewRulerRenderer&&i&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(xf,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(iv,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,d,h,p,f;let o=e._mouseService.getMouseReportCoords(i,e.screenElement);if(!o)return!1;let a,c;switch(i.overrideType||i.type){case"mousemove":c=32,i.buttons===void 0?(a=3,i.button!==void 0&&(a=i.button<3?i.button:3)):a=i.buttons&1?0:i.buttons&4?1:i.buttons&2?2:3;break;case"mouseup":c=0,a=i.button<3?i.button:3;break;case"mousedown":c=1,a=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=(h=(d=(u=e._renderService)==null?void 0:u.dimensions)==null?void 0:d.device)==null?void 0:h.cell)==null?void 0:p.height,(f=e._coreBrowserService)==null?void 0:f.dpr)===0)return!1;c=m<0?0:1,a=4;break;default:return!1}return c===void 0||a===void 0||a>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:a,action:c,ctrl:i.ctrlKey,alt:i.altKey,shift:i.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:i=>(n(i),i.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.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?s.mousemove||(t.addEventListener("mousemove",r.mousemove),s.mousemove=r.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),i&16?s.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),s.wheel=r.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),i&2?s.mouseup||(s.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),i&4?s.mousedrag||(s.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(ve(t,"mousedown",i=>{if(i.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(i)))return n(i),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(i)})),this._register(ve(t,"wheel",i=>{var o,a,c,u,d;if(!s.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=(a=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:a.device)==null?void 0:c.cell)==null?void 0:u.height,(d=e._coreBrowserService)==null?void 0:d.dpr)===0)return this.cancel(i,!0);let h=G.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(i.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(h,!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){$j(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=xF(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let s=this.rows-1;return this.scrollLines(n.type===2?-s:s),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===G.ETX||n.key===G.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)&&(CF(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(Pt));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(G.ESC+"[I"):this.coreService.triggerDataEvent(G.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(`${G.ESC}[4;${n};${t}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${G.ESC}[6;${r};${s}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function CF(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var NF=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)}},jF=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 Ps)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},l1=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 jF(t)}getNullCell(){return new Ps}},EF=class extends Te{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new re),this.onBufferChange=this._onBufferChange.event,this._normal=new l1(this._core.buffers.normal,"normal"),this._alternate=new l1(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)}},PF=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,s)=>t(n,s.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)}},TF=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}},RF=["cols","rows"],Qs=0,DF=class extends Te{constructor(e){super(),this._core=this._register(new kF(e)),this._addonManager=this._register(new NF),this._publicOptions={...this._core.options};let t=s=>this._core.options[s],n=(s,r)=>{this._checkReadonlyOptions(s),this._core.options[s]=r};for(let s in this._core.options){let r={get:t.bind(this,s),set:n.bind(this,s)};Object.defineProperty(this._publicOptions,s,r)}}_checkReadonlyOptions(e){if(RF.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 PF(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new TF(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 EF(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
|
|
496
|
+
`,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 Ox.get()},set promptLabel(e){Ox.set(e)},get tooMuchOutput(){return Ix.get()},set tooMuchOutput(e){Ix.set(e)}}}_verifyIntegers(...e){for(Qs of e)if(Qs===1/0||isNaN(Qs)||Qs%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Qs of e)if(Qs&&(Qs===1/0||isNaN(Qs)||Qs%1!==0||Qs<0))throw new Error("This API only accepts positive integers")}};/**
|
|
497
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
498
|
+
* @license MIT
|
|
499
|
+
*
|
|
500
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
501
|
+
* @license MIT
|
|
502
|
+
*
|
|
503
|
+
* Originally forked from (with the author's permission):
|
|
504
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
505
|
+
* http://bellard.org/jslinux/
|
|
506
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
507
|
+
*/var MF=2,LF=1,AF=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 h;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:((h=this._terminal.options.overviewRuler)==null?void 0:h.width)||14,n=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(n.getPropertyValue("height")),r=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"))},a=o.top+o.bottom,c=o.right+o.left,u=s-a,d=r-c-t;return{cols:Math.max(MF,Math.floor(d/e.css.cell.width)),rows:Math.max(LF,Math.floor(u/e.css.cell.height))}}};function c1(e,t){let n;return(...s)=>{n&&clearTimeout(n),n=setTimeout(()=>e(...s),t)}}const u1="panopticon.terminal.autoCopyOnSelect",jm=navigator.platform.toLowerCase().includes("mac");function d1({sessionName:e,onDisconnect:t,autoCopyOnSelect:n}){const s=y.useRef(null),r=y.useRef(null),i=y.useRef(null),o=y.useRef(null),a=y.useRef(0),c=y.useRef(null),u=5,[d,h]=y.useState(!0),[p,f]=y.useState(()=>{if(n!==void 0)return n;const D=localStorage.getItem(u1);return D===null?!0:D==="true"}),[m,g]=y.useState({visible:!1,x:0,y:0,canCopy:!1}),[v,x]=y.useState(!1),_=y.useRef(t);_.current=t,y.useEffect(()=>{try{localStorage.setItem(u1,String(p))}catch(D){console.error("Failed to save auto-copy setting:",D)}},[p]);const b=D=>Math.min(1e3*Math.pow(2,D),3e4),S=y.useCallback(async()=>{const D=r.current;if(!D||!D.hasSelection())return;const P=D.getSelection();try{await navigator.clipboard.writeText(P)}catch(E){console.error("Failed to copy to clipboard:",E);const $=document.createElement("textarea");$.value=P,$.style.position="fixed",$.style.opacity="0",document.body.appendChild($),$.select();try{document.execCommand("copy")}catch(W){console.error("Fallback copy failed:",W)}document.body.removeChild($)}},[]),C=y.useCallback(async()=>{var P;if(r.current)try{const E=await navigator.clipboard.readText();((P=o.current)==null?void 0:P.readyState)===WebSocket.OPEN&&o.current.send(E)}catch(E){console.error("Failed to read from clipboard:",E)}},[]),w=y.useCallback(D=>{const P=r.current;if(!P)return;const E=jm?D.metaKey:D.ctrlKey;E&&D.key.toLowerCase()==="c"&&P.hasSelection()&&(D.preventDefault(),S()),E&&D.key.toLowerCase()==="v"&&(D.preventDefault(),C())},[S,C]),j=y.useCallback(D=>{D.preventDefault();const P=r.current;P&&g({visible:!0,x:D.clientX,y:D.clientY,canCopy:P.hasSelection()})},[]),T=y.useCallback(()=>{g(D=>({...D,visible:!1}))},[]),F=y.useCallback(()=>{S(),T()},[S,T]),R=y.useCallback(()=>{C(),T()},[C,T]);y.useEffect(()=>{if(!m.visible)return;const D=()=>{T()};return document.addEventListener("click",D),()=>document.removeEventListener("click",D)},[m.visible,T]);const B=y.useCallback(()=>{if(!s.current||!e)return;c.current&&(clearTimeout(c.current),c.current=null);const D=s.current;if(D.clientWidth===0||D.clientHeight===0){console.warn("XTerminal: Container has no size, retrying in 100ms"),setTimeout(()=>B(),100);return}console.log("XTerminal: Creating terminal, container size:",D.clientWidth,"x",D.clientHeight);let P=r.current,E=i.current;if(!P){P=new DF({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 AF,P.loadAddon(E),P.open(s.current),E.fit(),r.current=P,i.current=E;let Q=null;P.onSelectionChange(()=>{!p||!P||(Q&&clearTimeout(Q),Q=setTimeout(()=>{if(P&&P.hasSelection()){const Z=P.getSelection();Z&&navigator.clipboard.writeText(Z).catch(ue=>{console.error("Auto-copy failed:",ue)})}},300))}),s.current.addEventListener("keydown",w),s.current.addEventListener("contextmenu",j);const Y=Z=>{Z.preventDefault(),Z.stopPropagation();const ue=Math.round(Z.deltaY/20);P.scrollLines(ue)};s.current.addEventListener("wheel",Y,{passive:!1})}const W=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal?session=${encodeURIComponent(e)}`,O=new WebSocket(W);O.binaryType="arraybuffer",o.current=O,O.onopen=()=>{console.log("XTerminal: WebSocket opened"),a.current=0,P.clear(),E==null||E.fit(),console.log("XTerminal: Sending initial dimensions:",P.cols,"x",P.rows),O.send(JSON.stringify({type:"resize",cols:P.cols,rows:P.rows}))};const H=localStorage.getItem("DEBUG_TERMINAL")==="1";let k=0;const I=[],M=Q=>Q.replace(/[\x00-\x1f\x7f-\xff]/g,Y=>{const Z=Y.charCodeAt(0);return Z===27?"\\e":Z===10?"\\n":Z===13?"\\r":`\\x${Z.toString(16).padStart(2,"0")}`});H&&(console.log("XTerminal: Debug logging enabled. Messages will be logged to console and window.terminalDebugLog"),window.terminalDebugLog=I,window.showTerminalDebug=()=>{I.forEach(Q=>console.log(Q))});const N=[];let z=!1;const U=()=>{if(z||N.length===0||!P)return;z=!0;const Q=N.shift();H&&console.log(`XTerminal-debug: WRITE len=${Q.length}`),P.write(Q,()=>{const Y=P.buffer.active;Y.viewportY>=Y.length-P.rows&&P.scrollToBottom(),z=!1,N.length>0&&setTimeout(U,0)})};O.onmessage=Q=>{let Y="";if(Q.data instanceof ArrayBuffer?Y=new TextDecoder().decode(new Uint8Array(Q.data)):typeof Q.data=="string"&&(Y=Q.data),H){k++;const Z=`[${new Date().toISOString()}] RECV #${k} len=${Y.length}
|
|
508
|
+
DATA: ${M(Y).slice(0,500)}${Y.length>500?"...":""}`;I.push(Z),(k<=20||k%100===0)&&console.log(`XTerminal-debug: RECV #${k} len=${Y.length}`)}N.push(Y),U()},O.onclose=Q=>{var Y,Z;if(console.log("XTerminal: WebSocket closed",Q.code,Q.reason),!d){P.writeln(`\r
|
|
509
|
+
\x1B[33m● Session disconnected\x1B[0m`),(Y=_.current)==null||Y.call(_);return}if(a.current<u){const ue=b(a.current);a.current+=1,P.writeln(`\r
|
|
510
|
+
\x1B[33m● Connection lost. Reconnecting in ${ue/1e3}s (attempt ${a.current}/${u})...\x1B[0m`),c.current=setTimeout(()=>{B()},ue)}else P.writeln(`\r
|
|
511
|
+
\x1B[31m● Connection lost after multiple attempts.\x1B[0m`),(Z=_.current)==null||Z.call(_)},O.onerror=Q=>{console.error("WebSocket error:",Q)},P.onData(Q=>{O.readyState===WebSocket.OPEN&&O.send(Q)}),P.onResize(({cols:Q,rows:Y})=>{O.readyState===WebSocket.OPEN&&O.send(JSON.stringify({type:"resize",cols:Q,rows:Y}))});const K=c1(()=>{O.readyState===WebSocket.OPEN&&(E==null||E.fit())},200);return window.addEventListener("resize",K),()=>{window.removeEventListener("resize",K),h(!1),c.current&&clearTimeout(c.current),O.close(),P==null||P.dispose(),r.current=null,i.current=null}},[e,d,p,w,j]);y.useEffect(()=>{let D=!1,P;const E=setTimeout(()=>{D||(P=B())},50);return()=>{D=!0,clearTimeout(E),P==null||P()}},[B]),y.useEffect(()=>{const D=c1(()=>{var E,$;((E=o.current)==null?void 0:E.readyState)===WebSocket.OPEN&&(($=i.current)==null||$.fit())},200),P=new ResizeObserver(D);return s.current&&P.observe(s.current),()=>{P.disconnect()}},[]);const A=()=>{var D;(D=r.current)==null||D.focus()};return l.jsxs("div",{className:"relative w-full h-full",children:[l.jsx("div",{className:"absolute top-2 right-2 z-10 flex gap-2",children:l.jsx("button",{onClick:()=>x(!v),className:"p-1.5 rounded bg-slate-700/80 hover:bg-slate-600/80 text-slate-300 transition-colors",title:"Terminal settings",children:l.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[l.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"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})})}),v&&l.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:[l.jsx("h3",{className:"text-sm font-semibold text-slate-200 mb-3",children:"Terminal Settings"}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:p,onChange:D=>f(D.target.checked),className:"w-4 h-4 rounded border-slate-600 bg-slate-700 text-blue-500 focus:ring-blue-500"}),l.jsx("span",{className:"text-sm text-slate-300",children:"Auto-copy on selection"})]}),l.jsx("p",{className:"text-xs text-slate-500 mt-2",children:"Automatically copy selected text to clipboard"})]}),l.jsx("div",{ref:s,className:"absolute inset-0",onClick:A,tabIndex:0,style:{padding:"8px",backgroundColor:"#1a1a2e",overflow:"hidden",outline:"none"}}),m.visible&&l.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:D=>D.stopPropagation(),children:[m.canCopy&&l.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:[l.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.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",l.jsx("span",{className:"ml-auto text-xs text-slate-500",children:jm?"⌘C":"Ctrl+C"})]}),l.jsxs("button",{onClick:R,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:[l.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.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",l.jsx("span",{className:"ml-auto text-xs text-slate-500",children:jm?"⌘V":"Ctrl+V"})]})]})]})}function P0({issueId:e,isOpen:t,onClose:n}){var u,d,h,p,f;const{data:s,isLoading:r,isFetching:i,error:o}=he({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 a=((u=s==null?void 0:s.tasks)==null?void 0:u.filter(m=>m.status!=="closed"))||[],c=((d=s==null?void 0:s.tasks)==null?void 0:d.filter(m=>m.status==="closed"))||[];return l.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:n}),l.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:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-divider",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ko,{className:"w-5 h-5 text-green-400"}),l.jsxs("h2",{className:"font-semibold text-content",children:["Tasks: ",e]})]}),l.jsx("button",{onClick:n,className:"p-1 text-content-subtle hover:text-content hover:bg-surface-overlay rounded transition-colors",children:l.jsx(yt,{className:"w-5 h-5"})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[(r||i)&&!((h=s==null?void 0:s.tasks)!=null&&h.length)&&l.jsxs("div",{className:"space-y-2",children:[[1,2,3].map(m=>l.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border border-divider bg-surface-overlay/30 animate-pulse",children:[l.jsx("div",{className:"w-4 h-4 bg-surface-emphasis rounded-full mt-0.5"}),l.jsxs("div",{className:"flex-1 space-y-2",children:[l.jsx("div",{className:"h-4 bg-surface-emphasis rounded w-3/4"}),l.jsx("div",{className:"h-3 bg-surface-overlay rounded w-1/4"})]})]},m)),l.jsxs("div",{className:"flex items-center justify-center py-2 text-content-muted text-sm",children:[l.jsx(be,{className:"w-4 h-4 animate-spin mr-2"}),"Loading tasks from workspace..."]})]}),o&&l.jsx("div",{className:"text-red-400 text-center py-8",children:"Failed to load tasks"}),s&&((p=s.tasks)==null?void 0:p.length)===0&&!i&&l.jsxs("div",{className:"text-content-muted text-center py-8",children:[l.jsx(Ko,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),l.jsx("p",{children:"No tasks created yet"}),l.jsx("p",{className:"text-xs mt-2",children:"Tasks will appear here once created using beads."})]}),s&&((f=s.tasks)==null?void 0:f.length)>0&&l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-4 text-xs text-content-subtle mb-3 pb-3 border-b border-divider",children:[l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("div",{className:"w-2 h-2 bg-blue-400 rounded-full"}),a.length," open"]}),l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx(mr,{className:"w-3 h-3 text-green-400"}),c.length," closed"]})]}),a.map(m=>l.jsx(h1,{task:m},m.id)),c.length>0&&a.length>0&&l.jsx("div",{className:"text-xs text-content-muted mt-4 mb-2",children:"Completed"}),c.map(m=>l.jsx(h1,{task:m},m.id))]})]}),l.jsxs("div",{className:"px-4 py-3 border-t border-divider text-xs text-content-muted flex items-center justify-between",children:[l.jsxs("span",{children:[(s==null?void 0:s.count)||0," task",(s==null?void 0:s.count)!==1?"s":""]}),l.jsx("span",{className:"text-gray-600",children:"Beads"})]})]})]})}function h1({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:l.jsx("div",{className:"w-4 h-4 border-2 border-gray-400 rounded-full"}),in_progress:l.jsx(be,{className:"w-4 h-4 text-blue-400 animate-spin"}),closed:l.jsx(mr,{className:"w-4 h-4 text-green-400"})};return l.jsxs("div",{className:`flex items-start gap-3 p-3 rounded-lg border ${t[e.status]}`,children:[l.jsx("div",{className:"mt-0.5",children:n[e.status]}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-sm text-content",children:e.title}),l.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[l.jsx("span",{className:"text-xs text-content-muted",children:e.id}),e.blockedBy.length>0&&l.jsxs("span",{className:"flex items-center gap-1 text-xs text-orange-400",children:[l.jsx(ll,{className:"w-3 h-3"}),"Blocked"]}),e.labels.filter(s=>s.startsWith("difficulty:")).map(s=>l.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${s.includes("simple")||s.includes("trivial")?"bg-green-900/50 text-green-400":s.includes("medium")?"bg-yellow-900/50 text-yellow-400":s.includes("complex")||s.includes("hard")?"bg-red-900/50 text-red-400":"bg-surface-overlay text-content-body"}`,children:s.replace("difficulty:","")},s))]})]})]})}const OF=()=>{const e=localStorage.getItem("panopticon.planning.startDocker");return e!==null?e==="true":!1},IF=()=>localStorage.getItem("panopticon.planning.workspaceLocation")==="remote"?"remote":"local";function FF({issue:e,isOpen:t,onClose:n,onComplete:s}){var U,K,Q;const[r,i]=y.useState("checking"),[o,a]=y.useState(null),[c,u]=y.useState(null),[d,h]=y.useState(!1),[p,f]=y.useState({x:-1,y:-1}),[m,g]=y.useState({width:900,height:600}),[v,x]=y.useState(OF),[_,b]=y.useState(IF),[S,C]=y.useState(!1),[w,j]=y.useState(!1),[T,F]=y.useState(!1),R=y.useRef(!1),B=Lt(),A=we({mutationFn:async()=>{const Y=await fetch(`/api/issues/${e.identifier}/start-planning`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({startDocker:v,workspaceLocation:_,shadowMode:S})});if(!Y.ok){const Z=await Y.json();throw new Error(Z.error||"Failed to start planning")}return Y.json()},onSuccess:Y=>{a(Y),Y.planningAgent.started?w?(R.current=!0,B.invalidateQueries({queryKey:["planningStatus",e.identifier]}),i("planning")):n():Y.planningAgent.error&&(u(Y.planningAgent.error),i("error"))},onError:Y=>{u(Y.message),i("error")}}),D=he({queryKey:["planningStatus",e.identifier],queryFn:async()=>{const Y=await fetch(`/api/planning/${e.identifier}/status`);if(!Y.ok)throw new Error("Failed to get status");return Y.json()},enabled:r==="planning",refetchInterval:r==="planning"?2e3:!1}),P=we({mutationFn:async()=>{const Y=await fetch(`/api/planning/${e.identifier}`,{method:"DELETE"});if(!Y.ok)throw new Error("Failed to stop planning");const Z=await Y.json();return(await fetch(`/api/issues/${e.identifier}/complete-planning`,{method:"POST"})).ok||console.warn("Failed to mark planning complete, continuing anyway"),Z},onSuccess:()=>{B.invalidateQueries({queryKey:["issues"]}),i("complete")},onError:Y=>{console.error("Stop planning failed:",Y),u(Y.message),i("error")}}),E=we({mutationFn:async()=>{const Y=await fetch(`/api/issues/${e.identifier}/abort-planning`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deleteWorkspace:!1})});if(!Y.ok){const Z=await Y.json();throw new Error(Z.error||"Failed to abort planning")}return Y.json()},onSuccess:()=>{s(),n()},onError:Y=>{u(Y.message)}}),$=we({mutationFn:async()=>{const Y=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:e.identifier,phase:"implementation"})});if(!Y.ok){const Z=await Y.json();throw new Error(Z.error||"Failed to start agent")}return Y.json()},onSuccess:()=>{B.invalidateQueries({queryKey:["agents"]}),B.invalidateQueries({queryKey:["issues"]}),s(),n()},onError:Y=>{u(`Failed to start agent: ${Y.message}`)}}),W=y.useRef(null);y.useEffect(()=>{const Y=W.current!==null&&W.current!==e.identifier;W.current=e.identifier,t?Y?(i("checking"),a(null),u(null),h(!1),R.current=!1,B.invalidateQueries({queryKey:["planningStatus",e.identifier]})):(B.invalidateQueries({queryKey:["planningStatus",e.identifier]}),R.current=!1):(i("checking"),a(null),u(null),h(!1),R.current=!1)},[t,e.identifier,B]),y.useEffect(()=>{t&&r==="checking"&&fetch(`/api/planning/${e.identifier}/status`).then(Y=>Y.json()).then(Y=>{Y.active?(R.current=!0,i("planning")):Y.planningCompleted?i("complete"):i("ready")}).catch(()=>{i("ready")})},[t,e.identifier,r]);const O=()=>{i("starting"),A.mutate()},H=()=>{P.mutate()},k=()=>{confirm(`Abort planning and return to Todo?
|
|
512
|
+
|
|
513
|
+
This will:
|
|
514
|
+
• Stop the planning agent
|
|
515
|
+
• Move the issue back to "Todo"
|
|
516
|
+
• Keep the workspace (can be deleted separately)
|
|
517
|
+
|
|
518
|
+
Any planning artifacts in the workspace will be preserved.`)&&E.mutate()},I=()=>{$.mutate()};if(!t)return null;const M=p.x===-1?(window.innerWidth-m.width)/2:p.x,N=p.y===-1?(window.innerHeight-m.height)/2:p.y,z=()=>{var Z,ue;const Y=((Z=o==null?void 0:o.workspace)==null?void 0:Z.path)||((ue=D.data)==null?void 0:ue.workspacePath);return Y?`${Y}/docs/${e.identifier}-plan.md`:null};return d?l.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(r==="complete")try{(await(await fetch(`/api/planning/${e.identifier}/status`)).json()).active&&(R.current=!0,i("planning"))}catch{}h(!1)},children:[l.jsx("div",{className:"w-6 h-6 rounded bg-gradient-to-br from-purple-500 to-blue-500 flex items-center justify-center",children:l.jsx(Tx,{className:"w-3 h-3 text-content"})}),l.jsxs("span",{className:"text-sm text-content font-medium",children:["Plan: ",e.identifier]}),r==="planning"&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-2 h-2 bg-purple-400 rounded-full animate-pulse"}),(U=D.data)!=null&&U.isRemote?l.jsx("span",{className:"px-1.5 py-0.5 bg-blue-500/30 text-blue-300 text-xs rounded",children:"Remote"}):l.jsx("span",{className:"px-1.5 py-0.5 bg-gray-500/30 text-content-subtle text-xs rounded",children:"Local"})]}),r==="complete"&&l.jsx("span",{className:"px-1.5 py-0.5 bg-green-500/30 text-green-300 text-xs rounded",children:"Done"})]}):l.jsxs("div",{className:"fixed inset-0 z-50",children:[l.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:()=>h(!0)}),l.jsx(SA,{position:{x:M,y:N},size:m,onDragStop:(Y,Z)=>f({x:Z.x,y:Z.y}),onResizeStop:(Y,Z,ue,Oe,Re)=>{g({width:ue.offsetWidth,height:ue.offsetHeight}),f({x:Re.x,y:Re.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:l.jsxs("div",{className:"w-full h-full bg-surface-raised rounded-xl shadow-2xl border border-divider overflow-hidden flex flex-col",children:[l.jsxs("div",{className:"drag-handle flex items-center justify-between px-6 py-4 border-b border-divider cursor-move",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.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:l.jsx(Tx,{className:"w-5 h-5 text-content"})}),l.jsxs("div",{children:[l.jsxs("h2",{className:"text-lg font-semibold text-content",children:["Plan: ",e.identifier]}),l.jsx("p",{className:"text-sm text-content-subtle line-clamp-1",children:e.title})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[r==="planning"&&l.jsxs(l.Fragment,{children:[l.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:[l.jsx("span",{className:"w-2 h-2 bg-purple-400 rounded-full animate-pulse"}),"Planning Active"]}),(K=D.data)!=null&&K.isRemote?l.jsx("span",{className:"px-2 py-1 bg-blue-500/20 text-blue-400 text-xs rounded-full",title:D.data.vmName?`VM: ${D.data.vmName}`:void 0,children:"Remote"}):l.jsx("span",{className:"px-2 py-1 bg-gray-500/20 text-content-subtle text-xs rounded-full",children:"Local"}),l.jsxs("button",{onClick:H,disabled:P.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:[l.jsx(ou,{className:"w-4 h-4"}),"Stop"]})]}),l.jsx("button",{onClick:()=>h(!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:l.jsx(yt,{className:"w-5 h-5"})})]})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col",children:[r==="checking"&&l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[l.jsx(be,{className:"w-12 h-12 text-purple-400 animate-spin mb-4"}),l.jsx("p",{className:"text-content-body",children:"Checking session status..."})]}),r==="ready"&&l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8 overflow-y-auto",children:[l.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:l.jsx(Vo,{className:"w-10 h-10 text-purple-400"})}),["In Planning","Planning","Planned","Discovery"].includes(e.status)?l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"text-xl font-semibold text-content mb-2",children:"Resume Planning Session"}),l.jsxs("p",{className:"text-content-subtle text-center max-w-md mb-6",children:["This issue is in ",l.jsx("span",{className:"text-purple-400 font-medium",children:'"In Planning"'})," state. You can resume planning or abort to return to Todo."]}),l.jsxs("div",{className:"bg-surface-overlay/50 rounded-lg p-4 mb-6 max-w-md w-full",children:[l.jsx("h4",{className:"text-sm font-medium text-content-body mb-2",children:"Options:"}),l.jsxs("ul",{className:"space-y-2 text-sm text-content-subtle",children:[l.jsxs("li",{className:"flex items-center gap-2",children:[l.jsx(Qn,{className:"w-4 h-4 text-purple-400"}),l.jsxs("span",{children:[l.jsx("strong",{className:"text-purple-400",children:"Resume"})," - Start a new planning agent session"]})]}),l.jsxs("li",{className:"flex items-center gap-2",children:[l.jsx(yt,{className:"w-4 h-4 text-orange-400"}),l.jsxs("span",{children:[l.jsx("strong",{className:"text-orange-400",children:"Abort"})," - Return issue to Todo (keeps workspace)"]})]})]})]}),l.jsxs("label",{className:"flex items-center gap-3 mb-4 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:w,onChange:Y=>j(Y.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"}),l.jsxs("span",{className:"text-sm text-content-body",children:["Stay and watch planning",l.jsx("span",{className:"text-content-muted ml-1",children:"(keep dialog open; you'll see INPUT when agent needs you)"})]})]}),l.jsxs("div",{className:"flex gap-3",children:[l.jsxs("button",{onClick:k,disabled:E.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:[l.jsx(yt,{className:"w-5 h-5"}),E.isPending?"Aborting...":"Abort Planning"]}),l.jsxs("button",{onClick:O,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:[l.jsx(Qn,{className:"w-5 h-5"}),"Resume Planning"]})]})]}):l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"text-xl font-semibold text-content mb-2",children:"Start Planning Session"}),l.jsxs("p",{className:"text-content-subtle text-center max-w-md mb-6",children:["This will move the issue to ",l.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."]}),l.jsxs("div",{className:"bg-surface-overlay/50 rounded-lg p-4 mb-6 max-w-md w-full",children:[l.jsx("h4",{className:"text-sm font-medium text-content-body mb-2",children:"What happens:"}),l.jsxs("ul",{className:"space-y-2 text-sm text-content-subtle",children:[l.jsxs("li",{className:"flex items-center gap-2",children:[l.jsx(po,{className:"w-4 h-4 text-green-400"}),'Issue moves to "In Planning" in ',e.source==="github"?"GitHub":"Linear"]}),l.jsxs("li",{className:"flex items-center gap-2",children:[l.jsx(po,{className:"w-4 h-4 text-green-400"}),"Git worktree created for feature branch"]}),l.jsxs("li",{className:"flex items-center gap-2",children:[l.jsx(po,{className:"w-4 h-4 text-green-400"}),"Planning agent starts discovery conversation"]})]})]}),l.jsxs("div",{className:"mb-4 w-full max-w-md",children:[l.jsx("label",{className:"text-sm font-medium text-content-body mb-2 block",children:"Workspace Location"}),l.jsxs("div",{className:"flex gap-4",children:[l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"radio",name:"workspaceLocation",value:"local",checked:_==="local",onChange:()=>{b("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"}),l.jsx("span",{className:"text-sm text-content-body",children:"Local"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"radio",name:"workspaceLocation",value:"remote",checked:_==="remote",onChange:()=>{b("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"}),l.jsx("span",{className:"text-sm text-content-body",children:"Remote (exe.dev)"})]})]})]}),l.jsxs("label",{className:"flex items-center gap-3 mb-4 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:S,onChange:Y=>C(Y.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"}),l.jsxs("span",{className:"text-sm text-content-body",children:["Shadow Engineering",l.jsx("span",{className:"text-content-muted ml-1",children:"(AI observes your workflow, doesn't modify code)"})]})]}),l.jsxs("label",{className:"flex items-center gap-3 mb-4 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:v,onChange:Y=>{x(Y.target.checked),localStorage.setItem("panopticon.planning.startDocker",String(Y.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"}),l.jsxs("span",{className:"text-sm text-content-body",children:["Start Docker containers",l.jsx("span",{className:"text-content-muted ml-1",children:"(dev environment ready for testing)"})]})]}),l.jsxs("label",{className:"flex items-center gap-3 mb-6 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:w,onChange:Y=>j(Y.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"}),l.jsxs("span",{className:"text-sm text-content-body",children:["Stay and watch planning",l.jsx("span",{className:"text-content-muted ml-1",children:"(keep dialog open; you'll see INPUT when agent needs you)"})]})]}),l.jsxs("button",{onClick:O,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:[l.jsx(Qn,{className:"w-5 h-5"}),"Start Planning"]})]})]}),r==="starting"&&l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[l.jsx(be,{className:"w-12 h-12 text-purple-400 animate-spin mb-4"}),l.jsx("p",{className:"text-content-body",children:"Starting planning session..."}),l.jsx("p",{className:"text-sm text-content-muted mt-2",children:"Moving to In Planning, creating workspace, spawning agent"})]}),r==="planning"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"flex-1 bg-black relative overflow-hidden",style:{minHeight:"400px"},children:o!=null&&o.planningAgent.sessionName?l.jsx(d1,{sessionName:o.planningAgent.sessionName,onDisconnect:()=>{D.refetch()}}):(Q=D.data)!=null&&Q.sessionName?l.jsx(d1,{sessionName:D.data.sessionName,onDisconnect:()=>{D.refetch()}}):l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsxs("div",{className:"flex items-center gap-2 text-content-muted",children:[l.jsx(be,{className:"w-4 h-4 animate-spin"}),"Connecting to terminal..."]})})}),l.jsxs("div",{className:"border-t border-divider px-4 py-2 flex items-center justify-between bg-surface-raised",children:[l.jsxs("div",{className:"flex items-center gap-2 text-sm text-content-subtle",children:[l.jsx(Vo,{className:"w-4 h-4"}),"Interactive planning session"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("button",{onClick:()=>F(!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:[l.jsx(Ko,{className:"w-4 h-4"}),"Tasks"]}),l.jsxs("button",{onClick:k,disabled:E.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:[l.jsx(yt,{className:"w-4 h-4"}),"Abort"]}),l.jsxs("button",{onClick:()=>{P.mutate(),D.refetch()},disabled:P.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:[l.jsx(po,{className:"w-4 h-4"}),"Done"]})]})]})]}),r==="complete"&&l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[l.jsx("div",{className:"w-16 h-16 rounded-full bg-green-500/20 flex items-center justify-center mb-4",children:l.jsx(po,{className:"w-10 h-10 text-green-400"})}),l.jsx("h3",{className:"text-xl font-semibold text-content mb-2",children:"Planning Complete"}),l.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."}),z()&&l.jsx("div",{className:"bg-purple-500/10 border border-purple-500/30 rounded-lg p-4 mb-6 max-w-md w-full",children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(qo,{className:"w-8 h-8 text-purple-400"}),l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-sm text-content-body font-medium",children:"Feature Plan"}),l.jsx("p",{className:"text-xs text-content-muted font-mono truncate",children:z()})]}),l.jsxs("a",{href:`vscode://file${z()}`,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:[l.jsx(gr,{className:"w-4 h-4"}),"Open"]})]})}),l.jsxs("button",{onClick:()=>F(!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:[l.jsx(Ko,{className:"w-5 h-5"}),"View Tasks",l.jsx("span",{className:"text-xs text-green-600",children:"(beads created during planning)"})]}),o&&l.jsxs("div",{className:"bg-surface-overlay/50 rounded-lg p-4 mb-6 max-w-md w-full",children:[l.jsx("p",{className:"text-sm text-content-subtle mb-2",children:"Summary:"}),l.jsxs("ul",{className:"space-y-1 text-sm",children:[l.jsxs("li",{className:"text-content-body",children:[l.jsx("span",{className:"text-content-muted",children:"Issue:"})," ",o.issue.identifier]}),l.jsxs("li",{className:"text-content-body",children:[l.jsx("span",{className:"text-content-muted",children:"State:"})," ",l.jsx("span",{className:"text-purple-400",children:o.issue.newState})]}),o.workspace.created&&l.jsxs("li",{className:"text-content-body",children:[l.jsx("span",{className:"text-content-muted",children:"Workspace:"})," ",l.jsx("span",{className:"text-blue-400 font-mono text-xs",children:o.workspace.path})]})]})]}),l.jsxs("div",{className:"flex gap-3",children:[l.jsx("button",{onClick:n,disabled:$.isPending,className:"px-4 py-2 bg-surface-overlay hover:bg-surface-emphasis text-content rounded-lg transition-colors disabled:opacity-50",children:"Close"}),l.jsxs("button",{onClick:I,disabled:$.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:[$.isPending?l.jsx(be,{className:"w-5 h-5 animate-spin"}):l.jsx(Qn,{className:"w-5 h-5"}),$.isPending?"Starting Agent...":"Start Agent"]})]})]}),r==="error"&&l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8",children:[l.jsx("div",{className:"w-16 h-16 rounded-full bg-red-500/20 flex items-center justify-center mb-4",children:l.jsx(Uo,{className:"w-10 h-10 text-red-400"})}),l.jsx("h3",{className:"text-xl font-semibold text-content mb-2",children:"Planning Failed"}),l.jsx("p",{className:"text-red-400 text-center max-w-md mb-6",children:c}),l.jsxs("div",{className:"flex gap-3",children:[l.jsx("button",{onClick:n,className:"px-4 py-2 bg-surface-overlay hover:bg-surface-emphasis text-content rounded-lg transition-colors",children:"Close"}),l.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"})]})]})]})]})}),l.jsx(P0,{issueId:e.identifier,isOpen:T,onClose:()=>F(!1)})]})}function TE(e){const t=e.find(r=>r.startsWith("difficulty:"));if(!t)return null;const n=t.split(":")[1];return["trivial","simple","medium","complex","expert"].includes(n)?n:null}function BF(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 zF={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 RE({level:e}){const t=zF[e];return l.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs font-medium ${t}`,children:e})}const $F={work:"🤖",review:"👁️",test:"🧪",merge:"🔀"};function HF({type:e,name:t,isConflict:n}){const s=$F[e],r=n?"animate-[pulse_2s_ease-in-out_infinite]":"";return l.jsxs("span",{className:`inline-flex items-center gap-1 text-xs text-blue-400 ${r}`,children:[l.jsx("span",{children:s}),l.jsx("span",{children:t})]})}async function WF(){try{const e=await fetch("/api/costs/by-issue");if(!e.ok)return{};const t=await e.json(),n={};for(const s of t.issues||[])n[s.issueId.toLowerCase()]=s;return n}catch{return{}}}function DE(e){return e>=100?`$${e.toFixed(0)}`:e>=10?`$${e.toFixed(1)}`:e>=1?`$${e.toFixed(2)}`:e>0?`$${e.toFixed(2)}`:""}function ME(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 UF(e="current",t=!1){const n=new URLSearchParams;n.set("cycle",e),t&&n.set("includeCompleted","true");const s=await fetch(`/api/issues?${n}`);if(!s.ok)throw new Error("Failed to fetch issues");return s.json()}async function qF(){const e=await fetch("/api/agents");if(!e.ok)throw new Error("Failed to fetch agents");return e.json()}async function KF(){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 VF(e,t=!1){var s;const n={backlog:[],todo:[],in_progress:[],in_review:[],done:[],canceled:[]};for(const r of e){if(!t&&((s=r.labels)!=null&&s.some(o=>o.toLowerCase()==="closed-out")))continue;let i;r.targetCanonicalState?i=r.targetCanonicalState:r.shadowStatus?i=r.shadowStatus==="closed"?"done":r.shadowStatus==="in_progress"?Bt[r.status]||"in_progress":Bt[r.status]||"backlog":r.derivedStatus?i=r.derivedStatus==="closed"?"done":r.derivedStatus==="in_progress"?"in_progress":Bt[r.status]||"backlog":i=Bt[r.status]||"backlog",i!=="canceled"&&(n[i]?n[i].push(r):n.backlog.push(r))}return n}function YF(e){const t={},n=[];for(const r of e){const i=r.labels||[];if(i.length===0)n.push(r);else for(const o of i)t[o]||(t[o]=[]),t[o].push(r)}n.length>0&&(t.Uncategorized=n);const s={};return Object.keys(t).sort((r,i)=>r.localeCompare(i)).forEach(r=>{s[r]=t[r]}),s}function XF(e){const t=new Map,n=[];for(const r of e)if(r.project){const i=t.get(r.project.id);i?i.issues.push(r):t.set(r.project.id,{name:r.project.name,color:r.project.color,issues:[r]})}else n.push(r);const s=Array.from(t.values()).sort((r,i)=>r.name.localeCompare(i.name));return n.length>0&&s.push({name:"No Project",issues:n}),s}function QF(e){var s;const t={Canceled:[],Duplicate:[],"Won't Do":[],Other:[]};for(const r of e){const i=((s=r.status)==null?void 0:s.toLowerCase())||"";i==="canceled"||i==="cancelled"?t.Canceled.push(r):i==="duplicate"?t.Duplicate.push(r):i==="won't do"||i==="wontfix"?t["Won't Do"].push(r):t.Other.push(r)}const n=[];return t.Canceled.length>0&&n.push({name:"Canceled",issues:t.Canceled}),t.Duplicate.length>0&&n.push({name:"Duplicate",issues:t.Duplicate}),t["Won't Do"].length>0&&n.push({name:"Won't Do",issues:t["Won't Do"]}),t.Other.length>0&&n.push({name:"Other",issues:t.Other}),n}function GF(e){var a;const t=[],n=[];for(const c of e)(a=c.artifactType)!=null&&a.includes("PortfolioItem")?t.push(c):n.push(c);if(t.length===0)return e.map(c=>({type:"orphan",children:[c]}));const s=new Map;for(const c of t)s.set(c.identifier,c);const r=new Map,i=[];for(const c of n)if(c.parentRef&&s.has(c.parentRef)){const u=r.get(c.parentRef)||[];u.push(c),r.set(c.parentRef,u)}else i.push(c);const o=[];for(const c of t){const u=r.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 T0({issue:e,compact:t=!1}){const n=e.rawTrackerState||e.shadowTrackerStatus,s=e.shadowStatus||e.targetCanonicalState;if(!n||!s)return null;const r=s==="in_progress"?"In Progress":s==="closed"||s==="done"?"Done":s==="in_review"?"In Review":s,i=n.toLowerCase().replace(/[-_\s]/g,""),o=r.toLowerCase().replace(/[-_\s]/g,"");return i===o?null:t?l.jsx("span",{className:"w-2 h-2 rounded-full bg-purple-500 shrink-0",title:`Rally: ${n} → Pan: ${r}`}):l.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[l.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:[l.jsx(gr,{className:"w-2.5 h-2.5"}),n]}),l.jsx("span",{className:"text-content-muted",children:"→"}),l.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:[l.jsx(Lo,{className:"w-2.5 h-2.5"}),r]})]})}function JF({feature:e,childCount:t,isExpanded:n,onToggle:s}){const r=e.completedChildCount??0,i=e.inProgressChildCount??0,o=e.totalChildCount??t,a=o>0?Math.round(r/o*100):0,c=e.derivedStatus&&e.rawTrackerState&&(e.derivedStatus==="in_progress"&&e.rawTrackerState!=="Developing"||e.derivedStatus==="closed"&&e.rawTrackerState!=="Done");return l.jsx("div",{className:"bg-surface-overlay rounded-lg border-l-4 border-l-indigo-500 overflow-hidden",children:l.jsxs("div",{onClick:s,className:"flex items-start gap-2 px-3 py-2.5 cursor-pointer hover:bg-indigo-900/20 transition-colors",children:[n?l.jsx(Mu,{className:"w-4 h-4 text-indigo-400 shrink-0 mt-0.5"}):l.jsx(_l,{className:"w-4 h-4 text-indigo-400 shrink-0 mt-0.5"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.project&&l.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:e.project.color||"#6b7280"}}),l.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:[l.jsx("span",{children:e.identifier}),l.jsx(gr,{className:"w-2.5 h-2.5 opacity-50"})]}),c&&l.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs font-medium bg-amber-900/50 text-amber-400",children:"derived"}),l.jsx(T0,{issue:e})]}),l.jsx("p",{className:"text-sm text-content-body mt-1 line-clamp-1",children:e.title}),o>0&&l.jsxs("div",{className:"mt-2",children:[l.jsx("div",{className:"w-full h-1.5 bg-gray-700 rounded-full overflow-hidden",children:l.jsx("div",{className:"h-full bg-green-500 rounded-full transition-all",style:{width:`${a}%`}})}),l.jsxs("div",{className:"flex items-center justify-between mt-1",children:[l.jsxs("span",{className:"text-xs text-content-muted",children:[r,"/",o," done",i>0?`, ${i} active`:""]}),l.jsxs("span",{className:"text-xs text-indigo-400",children:[t," in column"]})]})]})]})]})})}function ZF({issue:e,agents:t}){const n=Bt[e.status]||"backlog",s=n==="done"?"bg-green-400":n==="in_progress"?"bg-yellow-400":n==="in_review"?"bg-pink-400":"bg-gray-500",r=e.identifier.toLowerCase(),i=t.some(o=>{var a;return((a=o.issueId)==null?void 0:a.toLowerCase())===r&&o.status!=="dead"});return l.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-surface-overlay/50 transition-colors group",children:[l.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${s}`}),l.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}),l.jsx("span",{className:"text-xs text-content-body truncate flex-1",children:e.title}),l.jsx(T0,{issue:e,compact:!0}),i&&l.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-400 animate-pulse shrink-0",title:"Agent running"})]})}function Em({issue:e,agents:t,specialists:n,issueCosts:s,selectedIssue:r,onSelectIssue:i,onPlan:o}){const a=r===e.id,c=Bt[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",d=s[e.identifier.toLowerCase()],h=e.identifier.toLowerCase(),f=!!t.find(v=>{var x;return((x=v.issueId)==null?void 0:x.toLowerCase())===h&&v.status!=="dead"}),m=n.filter(v=>{var x;return((x=v.currentIssue)==null?void 0:x.toLowerCase())===h}),g=TE(e.labels||[]);return l.jsxs("div",{onClick:()=>i(a?null:e.id),className:`flex items-center gap-3 px-4 py-3 hover:bg-surface-overlay/50 transition-colors cursor-pointer ${a?"bg-surface-overlay":""}`,children:[l.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${u}`,title:c}),l.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onClick:v=>v.stopPropagation(),className:"text-xs text-content-subtle hover:text-blue-400 shrink-0 font-mono",children:e.identifier}),l.jsx("span",{className:`text-sm truncate flex-1 min-w-0 ${c==="canceled"?"text-content-muted line-through":"text-content-body"}`,children:e.title}),e.priority===1&&l.jsx("span",{className:"text-xs text-red-400 font-medium shrink-0",children:"Urgent"}),e.priority===2&&l.jsx("span",{className:"text-xs text-orange-400 font-medium shrink-0",children:"High"}),g&&l.jsx(RE,{level:g}),d&&d.totalCost>0&&l.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${ME(d.totalCost)}`,children:DE(d.totalCost)}),e.assignee&&l.jsxs("span",{className:"text-xs text-content-subtle flex items-center gap-1 shrink-0",children:[l.jsx(i0,{className:"w-3 h-3"}),e.assignee.name.split(" ")[0]]}),f&&l.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-400 animate-pulse shrink-0",title:"Agent running"}),m.map(v=>l.jsx("span",{className:"text-xs text-blue-400 shrink-0",title:`${v.displayName} specialist`,children:v.name==="review-agent"?"👁️":v.name==="test-agent"?"🧪":v.name==="merge-agent"?"🔀":"🤖"},v.name)),l.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[!f&&(c==="backlog"||c==="todo")&&l.jsx("button",{onClick:v=>{v.stopPropagation(),o(e)},className:"p-1 text-content-subtle hover:text-blue-400 transition-colors",title:"Plan issue",children:l.jsx(Qn,{className:"w-3.5 h-3.5"})}),l.jsx("button",{onClick:v=>{v.stopPropagation(),i(e.id)},className:"p-1 text-content-subtle hover:text-content transition-colors",title:"View details",children:l.jsx(Lo,{className:"w-3.5 h-3.5"})}),l.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onClick:v=>v.stopPropagation(),className:"p-1 text-content-subtle hover:text-content transition-colors",title:"Open in tracker",children:l.jsx(gr,{className:"w-3.5 h-3.5"})})]})]})}const f1={backlog:"border-divider-strong",todo:"border-blue-600",in_progress:"border-yellow-500",in_review:"border-pink-500",done:"border-green-500"},eB={backlog:"Backlog",todo:"To Do",in_progress:"In Progress",in_review:"In Review",done:"Done"};function tB({selectedIssue:e,onSelectIssue:t}){const n=Lt(),[s,r]=y.useState(null),[i,o]=y.useState(new Set),[a,c]=y.useState(null),[u,d]=y.useState(null),[h,p]=y.useState("current"),[f,m]=y.useState(!1),[g,v]=y.useState(null),[x,_]=y.useState(null),[b,S]=y.useState([]),[C,w]=y.useState(!1),[j,T]=y.useState(null),[F,R]=y.useState({open:!1,issue:null,targetStatus:null}),[B,A]=y.useState({open:!1,issue:null}),D=e!==void 0?e:s,P=t||r,{data:E,isLoading:$,error:W}=he({queryKey:["issues",h,f],queryFn:()=>UF(h,f)}),{data:O=[]}=he({queryKey:["agents"],queryFn:qF,refetchInterval:5e3}),{data:H=[]}=he({queryKey:["specialists"],queryFn:KF,refetchInterval:5e3}),k=e3(Yb(p0,{activationConstraint:{distance:8}}),Yb(h0)),I=we({mutationFn:async({issueId:se,targetStatus:de,syncToTracker:Ee})=>{const We=await fetch(`/api/issues/${se}/move-status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetStatus:de,syncToTracker:Ee})});if(!We.ok){const Ue=await We.json();throw new Error(Ue.error||"Failed to move issue")}return We.json()},onSuccess:()=>{n.invalidateQueries({queryKey:["issues"]})}}),M=y.useCallback(()=>{if(b.length===0)return;const se=b[b.length-1];I.mutate({issueId:se.issueId,targetStatus:se.fromStatus}),S(de=>de.slice(0,-1)),w(!1),j&&(clearTimeout(j),T(null))},[b,I,j]);y.useEffect(()=>{const se=de=>{(de.metaKey||de.ctrlKey)&&de.key==="z"&&(de.preventDefault(),M())};return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[M]);const N=y.useCallback((se,de,Ee)=>{S(Ue=>[...Ue,{issueId:se,fromStatus:de,toStatus:Ee,timestamp:Date.now()}]),w(!0),j&&clearTimeout(j);const We=setTimeout(()=>{w(!1)},8e3);T(We)},[j]),z=y.useCallback(se=>{const{active:de}=se,Ee=de.id,We=E==null?void 0:E.find(Ue=>Ue.id===Ee);We&&(v(We),_(Bt[We.status]))},[E]),U=y.useCallback(se=>{const{active:de,over:Ee}=se;if(v(null),_(null),!Ee)return;const We=de.id,Ue=Ee.id,wt=E==null?void 0:E.find(q=>q.id===We);if(!wt)return;const ft=Bt[wt.status];if(ft===Ue)return;const pn=wt.identifier.toLowerCase();if(O.some(q=>{var ee;return((ee=q.issueId)==null?void 0:ee.toLowerCase())===pn&&q.status!=="dead"})){R({open:!0,issue:wt,targetStatus:Ue});return}if(Ue==="done"){A({open:!0,issue:wt});return}N(wt.identifier,ft,Ue),I.mutate({issueId:wt.identifier,targetStatus:Ue})},[E,O,I,N]),K=y.useCallback(()=>{const{issue:se,targetStatus:de}=F;if(!se||!de)return;R({open:!1,issue:null,targetStatus:null});const Ee=Bt[se.status];if(de==="done"){A({open:!0,issue:se});return}N(se.identifier,Ee,de),I.mutate({issueId:se.identifier,targetStatus:de})},[F,I,N]),Q=y.useCallback(async(se,de)=>{const{issue:Ee}=B;if(!Ee)return;A({open:!1,issue:null});const We=Bt[Ee.status];if(de!=null&&de.stopAgents){const Ue=Ee.identifier.toLowerCase(),wt=O.filter(ft=>{var pn;return((pn=ft.issueId)==null?void 0:pn.toLowerCase())===Ue});for(const ft of wt)try{await fetch(`/api/agents/${ft.id}`,{method:"DELETE"})}catch(pn){console.error(`Failed to stop agent ${ft.id}:`,pn)}}if(de!=null&&de.cleanupWorkspace)try{await fetch(`/api/issues/${Ee.identifier}/cleanup-workspace`,{method:"POST"})}catch(Ue){console.error(`Failed to cleanup workspace for ${Ee.identifier}:`,Ue)}N(Ee.identifier,We,"done"),I.mutate({issueId:Ee.identifier,targetStatus:"done",syncToTracker:se}),de!=null&&de.stopAgents&&n.invalidateQueries({queryKey:["agents"]})},[B,I,N,O,n]),Y={sideEffects:Cj({styles:{active:{opacity:"0.5"}}})},{data:Z={}}=he({queryKey:["issueCosts"],queryFn:WF,refetchInterval:3e4,staleTime:1e4}),ue=y.useMemo(()=>{if(!E)return[];const se=new Map;for(const de of E)de.project&&!se.has(de.project.id)&&se.set(de.project.id,de.project);return Array.from(se.values()).sort((de,Ee)=>de.name.localeCompare(Ee.name))},[E]),Oe=y.useMemo(()=>E?i.size===0?E:E.filter(se=>se.project&&i.has(se.project.id)):[],[E,i]),Re=y.useMemo(()=>YF(Oe),[Oe]),fe=y.useMemo(()=>XF(Oe),[Oe]),Ie=y.useMemo(()=>QF(Oe),[Oe]),Ut=se=>{o(de=>{const Ee=new Set(de);return Ee.has(se)?Ee.delete(se):Ee.add(se),Ee})};if($)return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-2 animate-pulse",children:[l.jsx("div",{className:"w-4 h-4 bg-surface-overlay rounded"}),l.jsx("div",{className:"w-16 h-4 bg-surface-overlay rounded"}),l.jsx("div",{className:"w-24 h-6 bg-surface-overlay rounded"}),l.jsx("div",{className:"w-20 h-6 bg-surface-overlay rounded"}),l.jsx("div",{className:"w-28 h-6 bg-surface-overlay rounded"})]}),l.jsx("div",{className:"flex gap-4 overflow-x-auto pb-4",children:aw.filter(se=>se!=="backlog").map(se=>l.jsx("div",{className:"flex-shrink-0 w-80",children:l.jsxs("div",{className:`border-t-4 ${f1[se]} bg-surface-raised rounded-lg`,children:[l.jsx("div",{className:"px-4 py-3 border-b border-divider",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("div",{className:"h-5 bg-surface-overlay rounded w-24 animate-pulse"}),l.jsx("div",{className:"h-4 bg-surface-overlay rounded w-6 animate-pulse"})]})}),l.jsx("div",{className:"p-2 space-y-2",children:[1,2,3].map(de=>l.jsxs("div",{className:"bg-surface-overlay rounded-lg p-3 border-l-4 border-l-divider-strong animate-pulse",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("div",{className:"w-2 h-2 bg-surface-emphasis rounded-full"}),l.jsx("div",{className:"h-4 bg-surface-emphasis rounded w-16"})]}),l.jsx("div",{className:"h-4 bg-surface-emphasis rounded w-full mb-1"}),l.jsx("div",{className:"h-4 bg-surface-emphasis rounded w-3/4"}),l.jsxs("div",{className:"flex gap-2 mt-3",children:[l.jsx("div",{className:"h-5 bg-surface-emphasis rounded w-16"}),l.jsx("div",{className:"h-5 bg-surface-emphasis rounded w-12"})]})]},de))})]})},se))})]});if(W)return l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsxs("div",{className:"text-red-400",children:["Error loading issues: ",W.message]})});const sn=VF(Oe,f);return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(XD,{className:"w-4 h-4 text-content-subtle"}),l.jsx("span",{className:"text-sm text-content-subtle",children:"Cycle:"}),l.jsx("div",{className:"flex rounded-lg overflow-hidden border border-divider-strong",children:["current","all","backlog","canceled"].map(se=>l.jsx("button",{onClick:()=>p(se),className:`px-3 py-1 text-xs transition-colors ${h===se?"bg-blue-600 text-content":"bg-surface-raised text-content-subtle hover:text-content hover:bg-surface-overlay"}`,children:se==="current"?"Current":se==="all"?"All":se==="backlog"?"Backlog":"Canceled"},se))})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:f,onChange:se=>m(se.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"}),l.jsx("span",{className:"text-sm text-content-subtle",children:"Include closed-out"})]}),l.jsx("button",{onClick:async()=>{try{await fetch("/api/trackers/refresh",{method:"POST"}),n.invalidateQueries({queryKey:["issues"]})}catch(se){console.error("Refresh failed:",se)}},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:l.jsx(Lu,{className:"w-3.5 h-3.5"})}),l.jsxs("span",{className:"text-sm text-content-muted",children:[(E==null?void 0:E.length)||0," issues"]}),ue.length>1&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"w-px h-6 bg-surface-overlay"}),l.jsx("span",{className:"text-sm text-content-subtle",children:"Projects:"}),ue.map(se=>l.jsxs("button",{onClick:()=>Ut(se.id),className:`flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors ${i.size===0||i.has(se.id)?"bg-surface-overlay text-content":"bg-surface-raised text-content-muted hover:text-content-body"}`,children:[l.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:se.color||"#6b7280"}}),se.name]},se.id)),i.size>0&&l.jsx("button",{onClick:()=>o(new Set),className:"text-xs text-content-subtle hover:text-content",children:"Clear"})]})]}),h==="all"?l.jsx("div",{className:"space-y-6 overflow-y-auto pb-4",children:Object.entries(Re).map(([se,de])=>l.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[l.jsx("div",{className:"px-4 py-3 border-b border-divider",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(s0,{className:"w-4 h-4 text-blue-400"}),l.jsx("h3",{className:"font-semibold text-content",children:se}),l.jsxs("span",{className:"text-sm text-content-subtle",children:["(",de.length,")"]})]})}),l.jsx("div",{className:"divide-y divide-divider",children:de.map(Ee=>l.jsx(Em,{issue:Ee,agents:O,specialists:H,issueCosts:Z,selectedIssue:D,onSelectIssue:P,onPlan:c},Ee.id))})]},se))}):h==="backlog"?l.jsxs("div",{className:"space-y-6 overflow-y-auto pb-4",children:[fe.map(se=>l.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[l.jsx("div",{className:"px-4 py-3 border-b border-divider",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"w-3 h-3 rounded-full shrink-0",style:{backgroundColor:se.color||"#6b7280"}}),l.jsx("h3",{className:"font-semibold text-content",children:se.name}),l.jsxs("span",{className:"text-sm text-content-subtle",children:["(",se.issues.length,")"]})]})}),l.jsx("div",{className:"divide-y divide-divider",children:se.issues.map(de=>l.jsx(Em,{issue:de,agents:O,specialists:H,issueCosts:Z,selectedIssue:D,onSelectIssue:P,onPlan:c},de.id))})]},se.name)),fe.length===0&&l.jsx("div",{className:"text-center py-12 text-content-subtle",children:"No backlog items"})]}):h==="canceled"?l.jsxs("div",{className:"space-y-6 overflow-y-auto pb-4",children:[Ie.map(se=>l.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[l.jsx("div",{className:"px-4 py-3 border-b border-divider",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(yt,{className:"w-4 h-4 text-red-400"}),l.jsx("h3",{className:"font-semibold text-content",children:se.name}),l.jsxs("span",{className:"text-sm text-content-subtle",children:["(",se.issues.length,")"]})]})}),l.jsx("div",{className:"divide-y divide-divider",children:se.issues.map(de=>l.jsx(Em,{issue:de,agents:O,specialists:H,issueCosts:Z,selectedIssue:D,onSelectIssue:P,onPlan:c},de.id))})]},se.name)),Ie.length===0&&l.jsx("div",{className:"text-center py-12 text-content-subtle",children:"No canceled issues"})]}):l.jsxs(eL,{sensors:k,collisionDetection:o3,onDragStart:z,onDragEnd:U,children:[l.jsx("div",{className:"flex gap-4 overflow-x-auto pb-4",children:aw.filter(se=>se!=="backlog").map(se=>l.jsx(sB,{status:se,children:l.jsxs("div",{className:`border-t-4 ${f1[se]} bg-surface-raised rounded-lg transition-colors ${x&&x!==se?"bg-surface-raised/80":""}`,children:[l.jsx("div",{className:"px-4 py-3 border-b border-divider",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h3",{className:"font-semibold text-content",children:eB[se]}),l.jsx("span",{className:"text-sm text-content-subtle",children:sn[se].length})]})}),l.jsx(nB,{issues:sn[se],agents:O,specialists:H,issueCosts:Z,selectedIssue:D,onSelectIssue:P,onPlan:c,onViewBeads:d})]})},se))}),l.jsx(yL,{dropAnimation:Y,children:g?l.jsx(iB,{issue:g}):null})]}),l.jsx(lB,{isVisible:C,onUndo:M,onClose:()=>w(!1)}),l.jsx(oB,{isOpen:F.open,onClose:()=>R({open:!1,issue:null,targetStatus:null}),onConfirm:K,issue:F.issue}),l.jsx(aB,{isOpen:B.open,onClose:()=>A({open:!1,issue:null}),onSync:Q,issue:B.issue}),a&&l.jsx(FF,{issue:a,isOpen:!0,onClose:()=>c(null),onComplete:()=>{c(null),n.invalidateQueries({queryKey:["issues"]})}}),u&&l.jsx(cB,{issue:u,onClose:()=>d(null)})]})}function nB({issues:e,agents:t,specialists:n,issueCosts:s,selectedIssue:r,onSelectIssue:i,onPlan:o,onViewBeads:a}){const[c,u]=y.useState(new Set),d=y.useCallback(m=>{u(g=>{const v=new Set(g);return v.has(m)?v.delete(m):v.add(m),v})},[]),p=e.some(m=>{var g;return(g=m.artifactType)==null?void 0:g.includes("PortfolioItem")})?GF(e):null,f=m=>{const g=m.identifier.toLowerCase(),v=t.find(b=>{var S;return((S=b.issueId)==null?void 0:S.toLowerCase())===g&&b.type==="agent"&&b.agentPhase!=="planning"}),x=t.find(b=>{var S;return((S=b.issueId)==null?void 0:S.toLowerCase())===g&&b.agentPhase==="planning"&&b.status!=="stopped"}),_=n.filter(b=>{var S;return((S=b.currentIssue)==null?void 0:S.toLowerCase())===g});return l.jsx(rB,{issue:m,children:l.jsx(uB,{issue:m,workAgent:v,planningAgent:x,specialists:_,cost:s[m.identifier.toLowerCase()],isSelected:r===m.identifier,onSelect:()=>i(r===m.identifier?null:m.identifier),onPlan:()=>o(m),onViewBeads:b=>a(b)})},m.id)};return e.length===0?l.jsx("div",{className:"p-2 space-y-2 max-h-[calc(100vh-220px)] overflow-y-auto",children:l.jsx("div",{className:"text-center text-content-muted py-8 text-sm",children:"No issues"})}):p?l.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,v=!c.has(g.identifier);return l.jsxs("div",{className:"space-y-1",children:[l.jsx(JF,{feature:g,childCount:m.children.length,isExpanded:v,onToggle:()=>d(g.identifier)}),v&&l.jsxs("div",{className:"ml-3 border-l-2 border-indigo-700/30 pl-1",children:[m.children.map(x=>l.jsx(ZF,{issue:x,agents:t},x.id)),m.children.length===0&&l.jsx("div",{className:"text-xs text-content-muted py-2 pl-2",children:"No stories in this column"})]})]},`feature-${g.id}`)})}):l.jsx("div",{className:"p-2 space-y-2 max-h-[calc(100vh-220px)] overflow-y-auto",children:e.map(f)})}function sB({status:e,children:t}){const{isOver:n,setNodeRef:s}=aL({id:e});return l.jsx("div",{ref:s,className:`flex-shrink-0 w-80 transition-all ${n?"scale-[1.02]":""}`,children:t})}function rB({issue:e,children:t}){const{attributes:n,listeners:s,setNodeRef:r,transform:i,isDragging:o}=sL({id:e.id,data:{issue:e}}),a=i?{transform:`translate3d(${i.x}px, ${i.y}px, 0)`}:void 0;return l.jsx("div",{ref:r,style:a,...s,...n,className:`${o?"opacity-30":"opacity-100"} cursor-grab active:cursor-grabbing`,children:t})}function iB({issue:e}){return l.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:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"text-content-subtle text-sm",children:e.identifier})}),l.jsx("p",{className:"text-sm text-content mt-1 line-clamp-2",children:e.title})]})}function oB({isOpen:e,onClose:t,onConfirm:n,issue:s}){return!e||!s?null:l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:t}),l.jsx("div",{className:"relative bg-surface-raised rounded-xl shadow-2xl w-full max-w-md mx-4 p-6",children:l.jsxs("div",{className:"flex items-start gap-4",children:[l.jsx("div",{className:"p-2 bg-amber-900/50 rounded-lg",children:l.jsx(kn,{className:"w-6 h-6 text-amber-400"})}),l.jsxs("div",{className:"flex-1",children:[l.jsx("h3",{className:"text-lg font-semibold text-content mb-2",children:"Active Agent Warning"}),l.jsxs("p",{className:"text-content-body text-sm mb-4",children:[l.jsx("strong",{children:s.identifier})," has an active agent working on it. Moving this issue may disrupt the agent's work."]}),l.jsx("p",{className:"text-content-subtle text-xs mb-6",children:"Are you sure you want to proceed?"}),l.jsxs("div",{className:"flex gap-3 justify-end",children:[l.jsx("button",{onClick:t,className:"px-4 py-2 text-content-subtle hover:text-content transition-colors text-sm",children:"Cancel"}),l.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 aB({isOpen:e,onClose:t,onSync:n,issue:s}){const[r,i]=y.useState(!1),[o,a]=y.useState(!1);if(!e||!s)return null;const c=s.source==="github"?"GitHub":"Linear";return l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:t}),l.jsx("div",{className:"relative bg-surface-raised rounded-xl shadow-2xl w-full max-w-md mx-4 p-6",children:l.jsxs("div",{className:"flex items-start gap-4",children:[l.jsx("div",{className:"p-2 bg-green-900/50 rounded-lg",children:l.jsx(Ec,{className:"w-6 h-6 text-green-400"})}),l.jsxs("div",{className:"flex-1",children:[l.jsx("h3",{className:"text-lg font-semibold text-content mb-2",children:"Move to Done"}),l.jsxs("p",{className:"text-content-body text-sm mb-4",children:["You're moving ",l.jsx("strong",{children:s.identifier})," to Done."]}),l.jsxs("div",{className:"space-y-2 mb-4 p-3 bg-surface-overlay/50 rounded-lg",children:[l.jsxs("label",{className:"flex items-center gap-2 text-sm text-content-body cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:r,onChange:u=>i(u.target.checked),className:"rounded border-divider-strong bg-surface-overlay text-green-500 focus:ring-green-500"}),"Clean up workspace"]}),l.jsxs("label",{className:"flex items-center gap-2 text-sm text-content-body cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:o,onChange:u=>a(u.target.checked),className:"rounded border-divider-strong bg-surface-overlay text-green-500 focus:ring-green-500"}),"Stop running agents"]})]}),l.jsxs("p",{className:"text-content-subtle text-xs mb-4",children:["Sync status change to ",c,"?"]}),l.jsxs("div",{className:"flex gap-3 justify-end",children:[l.jsx("button",{onClick:()=>n(!1,{cleanupWorkspace:r,stopAgents:o}),className:"px-4 py-2 text-content-subtle hover:text-content transition-colors text-sm",children:"Shadow Only"}),l.jsxs("button",{onClick:()=>n(!0,{cleanupWorkspace:r,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 lB({isVisible:e,onUndo:t,onClose:n}){return e?l.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50",children:l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg shadow-xl px-4 py-3 flex items-center gap-4",children:[l.jsx("span",{className:"text-sm text-content-body",children:"Issue moved"}),l.jsxs("button",{onClick:t,className:"flex items-center gap-1 text-sm text-blue-400 hover:text-blue-300 transition-colors",children:[l.jsx(ij,{className:"w-4 h-4"}),"Undo"]}),l.jsx("button",{onClick:n,className:"text-content-muted hover:text-content-subtle",children:l.jsx(yt,{className:"w-4 h-4"})})]})}):null}function cB({issue:e,onClose:t}){var i,o;const{data:n,isLoading:s,error:r}=he({queryKey:["beads",e.identifier],queryFn:async()=>{const a=await fetch(`/api/issues/${e.identifier}/beads`);if(!a.ok)throw new Error("Failed to fetch tasks");return a.json()}});return l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:t}),l.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:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-divider",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ko,{className:"w-5 h-5 text-green-400"}),l.jsxs("h2",{className:"font-semibold text-content",children:["Tasks: ",e.identifier]})]}),l.jsx("button",{onClick:t,className:"p-1 text-content-subtle hover:text-content hover:bg-surface-overlay rounded transition-colors",children:l.jsx(yt,{className:"w-5 h-5"})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[s&&l.jsxs("div",{className:"flex items-center justify-center py-8 text-content-subtle",children:[l.jsx(be,{className:"w-5 h-5 animate-spin mr-2"}),"Loading tasks..."]}),r&&l.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&&l.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&&l.jsx("div",{className:"space-y-2",children:n.tasks.map(a=>l.jsxs("div",{className:`flex items-start gap-3 p-3 rounded-lg ${a.status==="closed"?"bg-green-900/20":a.status==="in_progress"?"bg-blue-900/20":"bg-surface-overlay/50"}`,children:[l.jsx("div",{className:`mt-0.5 ${a.status==="closed"?"text-green-400":a.status==="in_progress"?"text-blue-400":"text-content-subtle"}`,children:a.status==="closed"?l.jsx(mr,{className:"w-4 h-4"}):a.status==="in_progress"?l.jsx(be,{className:"w-4 h-4 animate-spin"}):l.jsx("div",{className:"w-4 h-4 border-2 border-current rounded-full"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-sm text-content",children:a.title}),l.jsxs("div",{className:"text-xs text-content-muted mt-1",children:[a.id," · ",a.status]})]})]},a.id))})]}),l.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 uB({issue:e,workAgent:t,planningAgent:n,specialists:s=[],cost:r,isSelected:i,onSelect:o,onPlan:a,onViewBeads:c}){var O,H;const u=Lt(),d=yr(),h=bl(),p=t,f=p&&p.status!=="dead"&&p.status!=="stopped",m=n&&n.status!=="stopped",g=p,v=Bt[e.status]||"backlog",x=v==="done"||v==="canceled",_=!x&&(((O=e.labels)==null?void 0:O.some(k=>typeof k=="string"&&k.toLowerCase()==="review ready"))??!1),b={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"},S=we({mutationFn:async k=>{const I=await fetch(`/api/agents/${k}`,{method:"DELETE"});if(!I.ok)throw new Error("Failed to kill agent");return I.json()},onSuccess:()=>{u.invalidateQueries({queryKey:["agents"]})}}),[C,w]=y.useState(""),[j,T]=y.useState(!1),F=we({mutationFn:async({agentId:k,message:I})=>{const M=await fetch(`/api/agents/${k}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:I})});if(!M.ok)throw new Error("Failed to send message");return M.json()},onSuccess:()=>{w(""),T(!1)}}),R=async k=>{k.stopPropagation(),g&&await d({title:"Kill Agent",message:`Kill agent ${g.id}?`,variant:"destructive",confirmLabel:"Kill"})&&S.mutate(g.id)},B=k=>{k.stopPropagation(),o()},A=k=>{k.stopPropagation(),T(!j)},D=k=>{k.preventDefault(),k.stopPropagation(),g&&C.trim()&&F.mutate({agentId:g.id,message:C.trim()})},P=we({mutationFn:async()=>{const k=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:e.identifier})});if(!k.ok){const I=await k.json();throw new Error(I.error||"Failed to start agent")}return k.json()},onSuccess:()=>{u.invalidateQueries({queryKey:["agents"]}),u.invalidateQueries({queryKey:["issues"]})},onError:k=>{h({message:`Failed to start agent: ${k.message}`,variant:"error"})}}),E=async k=>{k.stopPropagation(),await d({title:"Start Agent",message:`Start agent for ${e.identifier}?`,confirmLabel:"Start"})&&P.mutate()},$=k=>{k.stopPropagation(),a()},W=we({mutationFn:async k=>{const I=await fetch(`/api/issues/${e.identifier}/deep-wipe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deleteWorkspace:k.deleteWorkspace})});if(!I.ok){const M=await I.json();throw new Error(M.error||"Deep wipe failed")}return I.json()},onSuccess:k=>{u.invalidateQueries({queryKey:["issues"]}),u.invalidateQueries({queryKey:["agents"]}),console.log("Deep wipe completed:",k.cleanupLog)}});return l.jsxs("div",{onClick:o,className:`bg-surface-overlay rounded-lg p-3 border-l-4 cursor-pointer transition-all ${b[e.priority]||"border-l-gray-500"} ${i?"ring-2 ring-blue-500 bg-gray-650":"hover:bg-gray-650"} ${f?"bg-blue-900/20":""}`,children:[l.jsx("div",{className:"flex items-start justify-between gap-2",children:l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.project&&l.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:e.project.color||"#6b7280"},title:e.project.name}),f&&l.jsxs("div",{className:"flex gap-0.5",children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"0ms"}}),l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"150ms"}}),l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"300ms"}})]}),l.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onClick:k=>k.stopPropagation(),className:"text-sm font-medium text-content hover:text-blue-400 flex items-center gap-1",children:[e.source==="github"&&l.jsx("span",{title:"GitHub Issue",children:l.jsx(n0,{className:"w-3 h-3 text-content-subtle"})}),l.jsx("span",{className:"text-content-subtle",children:e.identifier}),l.jsx(gr,{className:"w-3 h-3 opacity-50"})]}),(()=>{const k=[],I=!!t&&s.length>0||s.length>1;t&&k.push({type:"work",name:"work"});for(const M of s){const N=M.name.replace("-agent","");k.push({type:N,name:N})}return k.map((M,N)=>l.jsx(HF,{type:M.type,name:M.name,isConflict:I},N))})(),n&&n.status!=="stopped"&&l.jsxs("button",{onClick:k=>{k.stopPropagation(),a()},className:"flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium bg-purple-900/50 text-purple-300 animate-pulse hover:bg-purple-800/60 transition-colors cursor-pointer",title:"Click to watch planning session",children:[l.jsx(Tx,{className:"w-3 h-3"}),"Planning"]}),p&&p.model&&l.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs font-medium bg-surface-emphasis text-content-body",title:`Model: ${p.model}`,children:BF(p.model)}),p&&p.workspaceLocation&&l.jsxs("span",{className:`flex items-center gap-0.5 px-1.5 py-0.5 rounded text-xs font-medium ${p.workspaceLocation==="remote"?"bg-cyan-900/50 text-cyan-400":"bg-surface-emphasis text-content-body"}`,title:p.workspaceLocation==="remote"?"Running on remote VM (exe.dev)":"Running locally",children:[p.workspaceLocation==="remote"?l.jsx(Cx,{className:"w-3 h-3"}):l.jsx(Px,{className:"w-3 h-3"}),p.workspaceLocation]}),_&&l.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:[l.jsx(YN,{className:"w-3 h-3"}),"Ready"]}),!x&&(g==null?void 0:g.hasPendingQuestion)&&l.jsxs("span",{onClick:k=>{k.stopPropagation(),a()},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 (${g.pendingQuestionCount||1} question${(g.pendingQuestionCount||1)>1?"s":""})`,children:[l.jsx(qD,{className:"w-3 h-3"}),"Input"]}),e.source==="rally"&&l.jsx(T0,{issue:e}),(()=>{const k=TE(e.labels);return k?l.jsx(RE,{level:k}):null})(),e.mergeStatus==="merged"&&l.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:[l.jsx(Ex,{className:"w-3 h-3"}),"Merged"]}),((H=e.labels)==null?void 0:H.some(k=>k.toLowerCase()==="needs-close-out"))&&l.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:[l.jsx(kn,{className:"w-3 h-3"}),"Needs Review"]}),r&&r.totalCost>0&&l.jsxs("span",{className:`ml-auto px-1.5 py-0.5 rounded text-xs font-medium ${ME(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:[l.jsx(na,{className:"w-3 h-3 inline -mt-0.5"}),DE(r.totalCost).slice(1)]})]}),l.jsx("p",{className:"text-sm text-content-body mt-1 line-clamp-2",children:e.title})]})}),l.jsxs("div",{className:"flex items-center gap-2 mt-2 flex-wrap",children:[e.assignee&&l.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-content-subtle",children:[l.jsx(i0,{className:"w-3 h-3"}),e.assignee.name.split(" ")[0]]}),(e.labels||[]).filter(k=>typeof k=="string"&&k.toLowerCase()!=="review ready"&&k.toLowerCase()!=="needs-close-out").slice(0,2).map(k=>l.jsxs("span",{className:"inline-flex items-center gap-1 text-xs bg-surface-emphasis text-content-body px-2 py-0.5 rounded",children:[l.jsx(s0,{className:"w-3 h-3"}),k]},k))]}),f&&l.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-divider-strong",children:[l.jsxs("button",{onClick:B,className:`flex items-center gap-1 text-xs transition-colors ${i?"text-blue-400":"text-content-subtle hover:text-content"}`,children:[l.jsx(Lo,{className:"w-3.5 h-3.5"}),"Watch"]}),l.jsxs("button",{onClick:()=>c&&c(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:[l.jsx(Ko,{className:"w-3.5 h-3.5"}),"Tasks"]}),l.jsxs("button",{onClick:A,className:`flex items-center gap-1 text-xs transition-colors ${j?"text-blue-400":"text-content-subtle hover:text-content"}`,children:[l.jsx(ZD,{className:"w-3.5 h-3.5"}),"Tell"]}),l.jsxs("button",{onClick:R,disabled:S.isPending,className:"flex items-center gap-1 text-xs text-red-400 hover:text-red-300 transition-colors ml-auto",children:[S.isPending?l.jsx(be,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(yt,{className:"w-3.5 h-3.5"}),"Kill"]})]}),j&&g&&l.jsx("form",{onSubmit:D,className:"mt-2",onClick:k=>k.stopPropagation(),children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:"text",value:C,onChange:k=>w(k.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}),l.jsx("button",{type:"submit",disabled:!C.trim()||F.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:F.isPending?"...":"Send"})]})}),!f&&(Bt[e.status]==="backlog"||Bt[e.status]==="todo")&&l.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-divider-strong flex-wrap",children:[m?l.jsxs("button",{onClick:$,className:"flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 transition-colors animate-pulse",children:[l.jsx(Lo,{className:"w-3.5 h-3.5"}),"Watch Planning"]}):l.jsxs("button",{onClick:$,className:"flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 transition-colors",children:[l.jsx(qo,{className:"w-3.5 h-3.5"}),"Plan"]}),l.jsxs("button",{onClick:E,disabled:P.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:[P.isPending?l.jsx(be,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(Qn,{className:"w-3.5 h-3.5"}),P.isPending?"Starting...":"Start Agent"]}),Bt[e.status]==="todo"&&l.jsx(dB,{issue:e}),Bt[e.status]==="backlog"&&l.jsx(hB,{issue:e}),l.jsx(Pm,{issue:e}),l.jsx(jd,{issue:e,deepWipeMutation:W})]}),!f&&Bt[e.status]==="in_progress"&&l.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-divider-strong flex-wrap",children:[m?l.jsxs("button",{onClick:$,className:"flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 transition-colors animate-pulse",children:[l.jsx(Lo,{className:"w-3.5 h-3.5"}),"Watch Planning"]}):l.jsxs("button",{onClick:$,className:"flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 transition-colors",children:[l.jsx(qo,{className:"w-3.5 h-3.5"}),"Re-plan"]}),l.jsxs("button",{onClick:()=>c&&c(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:[l.jsx(Ko,{className:"w-3.5 h-3.5"}),"Tasks"]}),l.jsxs("button",{onClick:E,className:"flex items-center gap-1 text-xs text-blue-400 hover:text-blue-300 transition-colors",children:[l.jsx(Qn,{className:"w-3.5 h-3.5"}),"Resume Agent"]}),l.jsxs("button",{onClick:async k=>{k.stopPropagation(),await d({title:"Reset Issue",message:`Reset ${e.identifier}?
|
|
519
|
+
|
|
520
|
+
This will:
|
|
521
|
+
• Kill any running agents (local and remote)
|
|
522
|
+
• Move the issue back to To Do in Linear
|
|
523
|
+
• 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 u.refetchQueries({queryKey:["issues"]}),await u.refetchQueries({queryKey:["agents"]})}).catch(I=>console.error("Reset failed:",I))},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:[l.jsx(ij,{className:"w-3.5 h-3.5"}),"Reset"]}),l.jsx(Pm,{issue:e}),l.jsx(jd,{issue:e,deepWipeMutation:W})]}),!f&&Bt[e.status]==="in_review"&&l.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-divider-strong flex-wrap",children:[l.jsx(p1,{issue:e,inline:!0}),l.jsx(Pm,{issue:e}),l.jsx(jd,{issue:e,deepWipeMutation:W})]}),!f&&Bt[e.status]==="done"&&l.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-green-600/30 flex-wrap",children:[l.jsx(p1,{issue:e,inline:!0}),l.jsx(fB,{issue:e}),l.jsx(jd,{issue:e,deepWipeMutation:W})]})]})}function jd({issue:e,deepWipeMutation:t}){const n=yr();return l.jsxs("button",{onClick:async s=>{s.stopPropagation(),await n({title:"Deep Wipe",message:`Deep wipe ${e.identifier}? This will clean up ALL state:
|
|
524
|
+
|
|
525
|
+
• Kill agents
|
|
526
|
+
• Delete agent state
|
|
527
|
+
• Delete workspace & branches
|
|
528
|
+
• Reset issue to Todo/Open
|
|
529
|
+
|
|
530
|
+
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?l.jsx(be,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(rj,{className:"w-3.5 h-3.5"}),t.isPending?"Wiping...":"Wipe"]})}function Pm({issue:e}){const t=Lt(),n=yr(),[s,r]=y.useState(!1);return l.jsxs("button",{onClick:async i=>{if(i.stopPropagation(),!await n({title:"Cancel Issue",message:`Cancel ${e.identifier}?
|
|
531
|
+
|
|
532
|
+
This will:
|
|
533
|
+
• Stop any running agents
|
|
534
|
+
• Clean up agent & review state
|
|
535
|
+
• Move issue to Canceled on tracker`,variant:"destructive",confirmLabel:"Cancel Issue"}))return;const o=await n({title:"Delete Workspace?",message:`Also delete the workspace and branches for ${e.identifier}?
|
|
536
|
+
|
|
537
|
+
This removes the git worktree, local & remote feature branches, and all workspace files.
|
|
538
|
+
|
|
539
|
+
Choose "Keep" to preserve the code for reference.`,confirmLabel:"Delete Workspace",cancelLabel:"Keep Workspace",variant:"destructive"});r(!0);try{if(!(await fetch(`/api/issues/${e.identifier}/cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({wipeWorkspace:o})})).ok)throw new Error("Cancel failed");await t.refetchQueries({queryKey:["issues"]}),await t.refetchQueries({queryKey:["agents"]})}catch(a){console.error("Cancel failed:",a)}finally{r(!1)}},disabled:s,className:"flex items-center gap-1 text-xs text-orange-400/70 hover:text-orange-400 transition-colors disabled:opacity-50",title:"Cancel issue — stop agents, move to Canceled on tracker",children:[s?l.jsx(be,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx($D,{className:"w-3.5 h-3.5"}),s?"Canceling...":"Cancel"]})}function dB({issue:e}){const t=Lt(),[n,s]=y.useState(!1);return l.jsxs("button",{onClick:async r=>{r.stopPropagation(),s(!0);try{await fetch(`/api/issues/${e.identifier}/move-status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"backlog"})}),await t.refetchQueries({queryKey:["issues"]})}catch(i){console.error("Move to backlog failed:",i)}finally{s(!1)}},disabled:n,className:"flex items-center gap-1 text-xs text-content-muted hover:text-content-subtle transition-colors disabled:opacity-50",title:"Move to Backlog",children:[n?l.jsx(be,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(Mu,{className:"w-3.5 h-3.5"}),"Backlog"]})}function hB({issue:e}){const t=Lt(),[n,s]=y.useState(!1);return l.jsxs("button",{onClick:async r=>{r.stopPropagation(),s(!0);try{await fetch(`/api/issues/${e.identifier}/move-status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"todo"})}),await t.refetchQueries({queryKey:["issues"]})}catch(i){console.error("Move to todo failed:",i)}finally{s(!1)}},disabled:n,className:"flex items-center gap-1 text-xs text-content-muted hover:text-content-subtle transition-colors disabled:opacity-50",title:"Move to Todo",children:[n?l.jsx(be,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(_l,{className:"w-3.5 h-3.5"}),"Todo"]})}function p1({issue:e,inline:t}){const n=Lt(),s=yr(),r=we({mutationFn:async()=>{const a=await fetch(`/api/issues/${e.identifier}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!a.ok){const c=await a.json();throw new Error(c.error||"Failed to reopen issue")}return a.json()},onSuccess:async()=>{await n.refetchQueries({queryKey:["issues"]})}}),i=async a=>{a.stopPropagation(),await s({title:"Reopen Issue",message:`Reopen ${e.identifier} for re-work?
|
|
540
|
+
|
|
541
|
+
This will move it back to In Progress.`,confirmLabel:"Reopen"})&&r.mutate()},o=l.jsxs(l.Fragment,{children:[l.jsxs("button",{onClick:i,disabled:r.isPending,className:"flex items-center gap-1 text-xs text-orange-400 hover:text-orange-300 transition-colors disabled:opacity-50",children:[r.isPending?l.jsx(be,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(Lu,{className:"w-3.5 h-3.5"}),r.isPending?"Reopening...":"Reopen"]}),r.isError&&l.jsx("span",{className:"text-xs text-red-400",children:r.error.message})]});return t?o:l.jsx("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-green-600/30",children:o})}function fB({issue:e}){const t=Lt(),n=yr(),s=we({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"]})}}),r=async i=>{i.stopPropagation(),await n({title:"Close Out Issue",message:`Close out ${e.identifier}?
|
|
542
|
+
|
|
543
|
+
This will:
|
|
544
|
+
• Verify branch is merged
|
|
545
|
+
• Archive workspace artifacts
|
|
546
|
+
• Clean up agent state
|
|
547
|
+
• Close issue on tracker
|
|
548
|
+
• Apply closed-out label`,variant:"destructive",confirmLabel:"Close Out"})&&s.mutate()};return l.jsxs(l.Fragment,{children:[l.jsxs("button",{onClick:r,disabled:s.isPending,className:"flex items-center gap-1 text-xs text-blue-400 hover:text-blue-300 transition-colors disabled:opacity-50",children:[s.isPending?l.jsx(be,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(YN,{className:"w-3.5 h-3.5"}),s.isPending?"Closing out...":"Close Out"]}),s.isError&&l.jsx("span",{className:"text-xs text-red-400",children:s.error.message})]})}const pB={sleeping:"😴",active:"🟢",uninitialized:"⚪",suspended:"⏸️"},mB={sleeping:"Sleeping",active:"Active",uninitialized:"Not Initialized",suspended:"Suspended"},gB={sleeping:"text-blue-400",active:"text-green-400",uninitialized:"text-content-muted",suspended:"text-yellow-400"};async function xB(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 vB(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 yB(e){if(!(await fetch(`/api/agents/${e}`,{method:"DELETE"})).ok)throw new Error("Failed to kill specialist")}async function _B(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 s=await n.json();throw new Error(s.error||"Failed to resume agent")}}async function bB(e){const t=await fetch(`/api/agents/${e}/activity?limit=20`);return t.ok?(await t.json()).activity||[]:[]}async function wB(e){const t=await fetch(`/api/specialists/${e}/cost`);return t.ok?t.json():{cost:0,inputTokens:0,outputTokens:0}}function SB(e,t){return he({queryKey:["specialist-cost",e],queryFn:()=>wB(e),enabled:t,refetchInterval:1e4})}async function kB(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 CB(e,t){const n=await fetch(`/api/specialists/${e}/queue/${t}`,{method:"DELETE"});if(!n.ok){const s=await n.json();throw new Error(s.error||"Failed to remove queue item")}}async function NB(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 s=await n.json();throw new Error(s.error||"Failed to reorder queue")}}function jB(e){return he({queryKey:["specialist-queue",e],queryFn:()=>kB(e),refetchInterval:5e3})}function EB(e,t){return he({queryKey:["activity",e],queryFn:()=>bB(e),enabled:t,refetchInterval:1e4})}function PB(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function TB(e){if(!e)return"Never";const t=new Date(e),s=new Date().getTime()-t.getTime(),r=Math.floor(s/6e4),i=Math.floor(r/60),o=Math.floor(i/24);return o>0?`${o}d ago`:i>0?`${i}h ago`:r>0?`${r}m ago`:"Just now"}function RB({specialist:e,issueInfo:t,onSelect:n,isSelected:s}){const r=Lt(),i=yr(),o=bl(),{data:a}=SB(e.name,e.state!=="uninitialized"),{data:c}=jB(e.name),{data:u}=EB(e.tmuxSession,e.state!=="uninitialized"),[d,h]=y.useState(!1),[p,f]=y.useState(!1),m=we({mutationFn:()=>xB(e.name),onSuccess:()=>{r.invalidateQueries({queryKey:["specialists"]}),r.invalidateQueries({queryKey:["agents"]})},onError:P=>{o({message:`Failed to wake ${e.displayName}: ${P.message}`,variant:"error"})}}),g=we({mutationFn:()=>vB(e.name),onSuccess:()=>{r.invalidateQueries({queryKey:["specialists"]})},onError:P=>{o({message:`Failed to reset ${e.displayName}: ${P.message}`,variant:"error"})}}),v=we({mutationFn:()=>yB(e.tmuxSession),onSuccess:()=>{r.invalidateQueries({queryKey:["specialists"]}),r.invalidateQueries({queryKey:["agents"]})}}),x=we({mutationFn:P=>_B(e.tmuxSession,P),onSuccess:()=>{r.invalidateQueries({queryKey:["specialists"]}),r.invalidateQueries({queryKey:["agents"]})},onError:P=>{o({message:`Failed to resume ${e.displayName}: ${P.message}`,variant:"error"})}}),_=we({mutationFn:P=>CB(e.name,P),onSuccess:()=>{r.invalidateQueries({queryKey:["specialist-queue",e.name]})},onError:P=>{o({message:`Failed to remove queue item: ${P.message}`,variant:"error"})}}),b=we({mutationFn:P=>NB(e.name,P),onSuccess:()=>{r.invalidateQueries({queryKey:["specialist-queue",e.name]})},onError:P=>{o({message:`Failed to reorder queue: ${P.message}`,variant:"error"})}}),S=P=>{P.stopPropagation(),m.mutate()},C=async P=>{P.stopPropagation(),await i({title:"Reset Specialist",message:`Reset ${e.displayName}? This will clear the session file and context.`,variant:"destructive",confirmLabel:"Reset"})&&g.mutate()},w=async P=>{P.stopPropagation(),await i({title:"Kill Specialist",message:`Kill ${e.displayName}?`,variant:"destructive",confirmLabel:"Kill"})&&v.mutate()},j=(P,E)=>{P.stopPropagation(),_.mutate(E)},T=(P,E)=>{if(P.stopPropagation(),!c||E===0)return;const $=[...c.items];[$[E-1],$[E]]=[$[E],$[E-1]],b.mutate($.map(W=>W.id))},F=(P,E)=>{if(P.stopPropagation(),!c||E===c.items.length-1)return;const $=[...c.items];[$[E],$[E+1]]=[$[E+1],$[E]],b.mutate($.map(W=>W.id))},R=P=>{P.stopPropagation(),h(!d)},B=P=>{P.stopPropagation(),f(!p)},A=P=>{P.stopPropagation(),x.mutate(void 0)},D={urgent:"text-red-400",high:"text-orange-400",normal:"text-blue-400",low:"text-content-subtle"};return l.jsxs("div",{onClick:n,className:`p-4 cursor-pointer transition-colors ${s?"bg-surface-overlay":"hover:bg-gray-750"}`,children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(ep,{className:"w-5 h-5 text-purple-400"}),l.jsxs("div",{children:[l.jsxs("div",{className:"font-medium text-content flex items-center gap-2",children:[e.displayName,e.state==="active"?l.jsx(be,{className:"w-4 h-4 text-green-400 animate-spin"}):l.jsx("span",{className:`text-xs ${gB[e.state]}`,children:pB[e.state]}),c&&c.totalCount>0&&l.jsxs("button",{onClick:R,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,")",d?l.jsx(Mu,{className:"w-3 h-3"}):l.jsx(_l,{className:"w-3 h-3"})]})]}),l.jsx("div",{className:"text-sm text-content-subtle",children:e.description}),e.currentIssue&&l.jsxs("div",{className:"text-xs text-cyan-400 mt-1 flex items-center gap-1",children:[l.jsx("span",{className:"text-content-muted",children:"Working on:"}),l.jsx("span",{className:"font-mono",children:e.currentIssue}),t&&l.jsxs("span",{className:"text-content-subtle truncate max-w-[200px]",title:t.title,children:["- ",t.title]})]}),e.sessionId&&!e.currentIssue&&l.jsxs("div",{className:"text-xs text-content-muted font-mono mt-1",children:["Session: ",e.sessionId.slice(0,8),"..."]})]})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("div",{className:"text-right",children:[l.jsx("div",{className:"text-sm text-content-subtle",children:mB[e.state]}),a&&a.cost>0&&l.jsxs("div",{className:"text-xs text-green-400 font-medium",title:"Total cost",children:["$",a.cost.toFixed(4)]}),e.contextTokens&&l.jsxs("div",{className:"text-xs text-content-muted",children:[PB(e.contextTokens)," tokens"]}),e.lastWake&&l.jsxs("div",{className:"text-xs text-content-muted",children:["Last wake: ",TB(e.lastWake)]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[e.state!=="uninitialized"&&u&&u.length>0&&l.jsx("button",{onClick:B,className:"p-2 text-content-subtle hover:text-blue-400 hover:bg-surface-emphasis rounded",title:`Show activity history (${u.length} entries)`,children:l.jsx(al,{className:"w-4 h-4"})}),e.state==="suspended"&&l.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:l.jsx(Qn,{className:"w-4 h-4"})}),(e.state==="sleeping"||e.state==="uninitialized")&&l.jsx("button",{onClick:S,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:l.jsx(rM,{className:"w-4 h-4"})}),e.state==="active"&&l.jsx("button",{onClick:w,disabled:v.isPending,className:"p-2 text-content-subtle hover:text-red-400 hover:bg-surface-emphasis rounded",title:"Kill specialist",children:l.jsx(Kr,{className:"w-4 h-4"})}),(e.state==="sleeping"||e.state==="uninitialized")&&l.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:l.jsx(Lu,{className:"w-4 h-4"})})]})]})]}),d&&c&&c.totalCount>0&&l.jsxs("div",{className:"mt-3 pl-8 border-l-2 border-divider-strong",children:[l.jsxs("div",{className:"text-xs text-content-subtle font-medium mb-2",children:["Queued Tasks (",c.totalCount,")"]}),l.jsx("div",{className:"space-y-2",children:c.items.map((P,E)=>l.jsxs("div",{className:"flex items-center justify-between bg-gray-750 px-3 py-2 rounded text-xs",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[l.jsxs("span",{className:"text-content-muted",children:[E+1,"."]}),l.jsx("span",{className:"text-content font-mono",children:P.payload.issueId||P.payload.message||P.id.substring(0,8)}),l.jsxs("span",{className:`${D[P.priority]} font-medium`,children:["[",P.priority,"]"]}),l.jsx("span",{className:"text-content-muted text-xs",children:P.source})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:$=>T($,E),disabled:E===0||b.isPending,className:"p-1 text-content-subtle hover:text-blue-400 disabled:opacity-30 disabled:cursor-not-allowed",title:"Move up",children:l.jsx(sM,{className:"w-3 h-3"})}),l.jsx("button",{onClick:$=>F($,E),disabled:E===c.items.length-1||b.isPending,className:"p-1 text-content-subtle hover:text-blue-400 disabled:opacity-30 disabled:cursor-not-allowed",title:"Move down",children:l.jsx(nM,{className:"w-3 h-3"})}),l.jsx("button",{onClick:$=>j($,P.id),disabled:_.isPending,className:"p-1 text-content-subtle hover:text-red-400 disabled:opacity-50",title:"Remove from queue",children:l.jsx(rj,{className:"w-3 h-3"})})]})]},P.id))})]}),p&&u&&u.length>0&&l.jsxs("div",{className:"mt-3 pl-8 border-l-2 border-divider-strong",children:[l.jsxs("div",{className:"text-xs text-content-subtle font-medium mb-2",children:["Recent Activity (",u.length,")"]}),l.jsx("div",{className:"space-y-1",children:u.slice().reverse().map((P,E)=>l.jsxs("div",{className:"flex items-center gap-2 bg-gray-750 px-3 py-1.5 rounded text-xs",children:[l.jsx("span",{className:"text-content-muted",children:new Date(P.ts).toLocaleTimeString()}),l.jsx("span",{className:"text-blue-400 font-mono",children:P.tool}),P.action&&l.jsx("span",{className:"text-content-subtle truncate",children:P.action.substring(0,50)})]},E))})]})]})}async function DB(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 MB(e){const t=await fetch(`/api/agents/${e}/cost`);if(!t.ok)throw new Error("Failed to fetch agent cost");return t.json()}function LB(e){return he({queryKey:["handoff-suggestion",e],queryFn:()=>DB(e),refetchInterval:3e4})}function AB(e){return he({queryKey:["agent-cost",e],queryFn:()=>MB(e),refetchInterval:6e4})}async function OB(e,t,n){const s=await fetch(`/api/agents/${e}/handoff`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({toModel:t,reason:n})});if(!s.ok){const r=await s.json();throw new Error(r.error||"Failed to execute handoff")}}const IB={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 FB({agentId:e}){const{data:t,isLoading:n}=LB(e),s=Lt(),r=yr(),i=bl(),o=we({mutationFn:({toModel:u,reason:d})=>OB(e,u,d),onSuccess:()=>{s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["handoff-suggestion",e]}),i({message:"Handoff completed successfully",variant:"success"})},onError:u=>{i({message:`Handoff failed: ${u.message}`,variant:"error"})}}),a=async u=>{await r({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 r({title:"Confirm Handoff",message:`${t.reason}
|
|
549
|
+
|
|
550
|
+
Proceed with handoff to ${t.suggestedModel}?`,confirmLabel:"Hand Off"})&&o.mutate({toModel:t.suggestedModel,reason:t.reason})};return n?l.jsx("div",{className:"p-3 bg-surface-raised rounded border border-divider",children:l.jsx("div",{className:"text-sm text-content-subtle",children:"Loading handoff data..."})}):t?l.jsxs("div",{className:"p-3 bg-surface-raised rounded border border-divider space-y-3",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs text-content-subtle",children:"Current Model:"}),l.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded border ${IB[t.currentModel]||"text-content-subtle bg-surface-overlay border-divider-strong"}`,children:t.currentModel})]}),t.suggested&&t.suggestedModel&&l.jsxs("div",{className:"flex items-start gap-2 p-2 bg-orange-900/20 border border-orange-500/30 rounded",children:[l.jsx(Uo,{className:"w-4 h-4 text-orange-400 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-sm font-medium text-orange-400 mb-1",children:"Handoff Suggested"}),l.jsx("div",{className:"text-xs text-content-body mb-2",children:t.reason}),l.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:[l.jsx(kx,{className:"w-3 h-3"}),"Hand off to ",t.suggestedModel]})]})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-content-subtle mb-2",children:"Manual Handoff:"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>a("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"}),l.jsx("button",{onClick:()=>a("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"}),l.jsx("button",{onClick:()=>a("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 BB={healthy:"bg-status-healthy",warning:"bg-status-warning",stuck:"bg-status-stuck",dead:"bg-status-dead",stopped:"bg-gray-500"},zB={active:"🟢",stale:"🟡",warning:"🟠",stuck:"🔴",suspended:"⏸️"},$B={active:"Active",stale:"Stale",warning:"Warning",stuck:"Stuck",suspended:"Suspended"},HB={active:"text-green-400",stale:"text-yellow-400",warning:"text-orange-400",stuck:"text-red-400",suspended:"text-blue-400"};async function WB(e){if(!(await fetch(`/api/agents/${e}`,{method:"DELETE"})).ok)throw new Error("Failed to kill agent")}async function UB(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 qB(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 s=await n.json();throw new Error(s.error||"Failed to resume agent")}}async function KB(e){const t=await fetch(`/api/agents/${e}/activity?limit=20`);return t.ok?(await t.json()).activity||[]:[]}function VB(e,t){return he({queryKey:["activity",e],queryFn:()=>KB(e),enabled:t,refetchInterval:1e4})}function YB(e){const t=new Date(e),s=new Date().getTime()-t.getTime(),r=Math.floor(s/6e4),i=Math.floor(r/60);return i>0?`${i}h ${r%60}m`:`${r}m`}function XB(e){if(e===null)return"unknown";const t=Math.floor(e/1e3),n=Math.floor(t/60),s=Math.floor(n/60);return s>0?`${s}h ago`:n>0?`${n}m ago`:`${t}s ago`}function QB({agent:e,health:t,onSelect:n,isSelected:s}){const r=Lt(),i=yr(),o=bl(),[a,c]=y.useState(!1),[u,d]=y.useState(!1),{data:h}=AB(e.id),{data:p}=VB(e.id,(t==null?void 0:t.isRunning)||(t==null?void 0:t.state)==="suspended"),f=we({mutationFn:()=>WB(e.id),onSuccess:()=>{r.invalidateQueries({queryKey:["agents"]})}}),m=we({mutationFn:()=>UB(e.id),onSuccess:()=>{o({message:`Poked ${e.id} successfully`,variant:"success"})},onError:w=>{o({message:`Failed to poke ${e.id}: ${w.message}`,variant:"error"})}}),g=we({mutationFn:w=>qB(e.id,w),onSuccess:()=>{r.invalidateQueries({queryKey:["agents"]})},onError:w=>{o({message:`Failed to resume ${e.id}: ${w.message}`,variant:"error"})}}),v=async w=>{w.stopPropagation(),await i({title:"Kill Agent",message:`Kill agent ${e.id}?`,variant:"destructive",confirmLabel:"Kill"})&&f.mutate()},x=w=>{w.stopPropagation(),m.mutate()},_=w=>{w.stopPropagation(),g.mutate(void 0)},b=w=>{w.stopPropagation(),d(!u)},S=(t==null?void 0:t.state)==="warning"||(t==null?void 0:t.state)==="stuck",C=w=>{w.stopPropagation(),c(!a)};return l.jsxs("div",{onClick:n,className:`p-4 cursor-pointer transition-colors ${s?"bg-surface-overlay":"hover:bg-gray-750"}`,children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:`w-3 h-3 rounded-full ${BB[e.status]}`}),l.jsxs("div",{children:[l.jsxs("div",{className:"font-medium text-content flex items-center gap-2",children:[e.id,t&&l.jsx("span",{className:`text-xs ${HB[t.state]}`,title:`Cloister: ${$B[t.state]}`,children:zB[t.state]})]}),l.jsxs("div",{className:"text-sm text-content-subtle flex items-center gap-2",children:[e.runtime," / ",e.model,h&&h.cost>0&&l.jsxs("span",{className:"flex items-center gap-1 text-xs text-emerald-400",title:"Agent cost so far",children:[l.jsx(na,{className:"w-3 h-3"}),"$",h.cost.toFixed(4)]}),e.contextPercent!=null&&l.jsxs("span",{className:"flex items-center gap-1.5 text-xs",title:`Context: ${e.contextPercent}%${e.initialContextPercent?` (init: ${e.initialContextPercent}%)`:""}`,children:[l.jsx("span",{className:"w-14 h-1.5 bg-gray-700 rounded-full overflow-hidden inline-block",children:l.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)}%`}})}),l.jsxs("span",{className:e.contextPercent>80?"text-red-400":e.contextPercent>50?"text-yellow-400":"text-content-muted",children:[e.contextPercent,"%"]})]})]})]})]}),l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("div",{className:"text-right",children:[l.jsxs("div",{className:"flex items-center gap-1 text-sm text-content-subtle",children:[l.jsx(ll,{className:"w-4 h-4"}),YB(e.startedAt)]}),t&&t.timeSinceActivity!==null&&l.jsxs("div",{className:"flex items-center gap-1 text-xs text-content-muted",children:[l.jsx(al,{className:"w-3 h-3"}),XB(t.timeSinceActivity)]}),e.consecutiveFailures>0&&l.jsxs("div",{className:"flex items-center gap-1 text-sm text-orange-400",children:[l.jsx(kn,{className:"w-4 h-4"}),e.consecutiveFailures," failures"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[t&&(t.isRunning||t.state==="suspended")&&p&&p.length>0&&l.jsx("button",{onClick:b,className:"p-2 text-content-subtle hover:text-blue-400 hover:bg-surface-emphasis rounded",title:`Show activity history (${p.length} entries)`,children:l.jsx(al,{className:"w-4 h-4"})}),e.status!=="stopped"&&l.jsx("button",{onClick:C,className:`p-2 hover:bg-surface-emphasis rounded ${a?"text-blue-400":"text-content-subtle hover:text-blue-400"}`,title:"Model handoff controls",children:l.jsx(t0,{className:"w-4 h-4"})}),(t==null?void 0:t.state)==="suspended"&&l.jsx("button",{onClick:_,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:l.jsx(Qn,{className:"w-4 h-4"})}),S&&l.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:l.jsx(KN,{className:"w-4 h-4"})}),(t==null?void 0:t.state)!=="suspended"&&e.status!=="stopped"&&l.jsx("button",{onClick:v,disabled:f.isPending,className:"p-2 text-content-subtle hover:text-red-400 hover:bg-surface-emphasis rounded",title:"Kill agent",children:l.jsx(ou,{className:"w-4 h-4"})})]})]})]}),a&&l.jsx("div",{className:"mt-3 pt-3 border-t border-divider",children:l.jsx(FB,{agentId:e.id})}),u&&p&&p.length>0&&l.jsxs("div",{className:"mt-3 pl-8 border-l-2 border-divider-strong",children:[l.jsxs("div",{className:"text-xs text-content-subtle font-medium mb-2",children:["Recent Activity (",p.length,")"]}),l.jsx("div",{className:"space-y-1",children:p.slice().reverse().map((w,j)=>l.jsxs("div",{className:"flex items-center gap-2 bg-gray-750 px-3 py-1.5 rounded text-xs",children:[l.jsx("span",{className:"text-content-muted",children:new Date(w.ts).toLocaleTimeString()}),l.jsx("span",{className:"text-blue-400 font-mono",children:w.tool}),w.action&&l.jsx("span",{className:"text-content-subtle truncate",children:w.action.substring(0,50)})]},j))})]})]})}async function GB(){const e=await fetch("/api/agents");if(!e.ok)throw new Error("Failed to fetch agents");return e.json()}async function JB(){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 ZB(){const e=await fetch("/api/cloister/agents/health");if(!e.ok)throw new Error("Failed to fetch Cloister health");return e.json()}async function e6(){const e=await fetch("/api/cloister/status");if(!e.ok)throw new Error("Failed to fetch Cloister status");return e.json()}async function t6(){const e=await fetch("/api/activity");return e.ok?e.json():[]}async function n6(){const e=await fetch("/api/issues");return e.ok?(await e.json()).issues||[]:[]}async function s6(){if(!(await fetch("/api/cloister/start",{method:"POST"})).ok)throw new Error("Failed to start Cloister")}async function r6(){if(!(await fetch("/api/cloister/stop",{method:"POST"})).ok)throw new Error("Failed to stop Cloister")}function i6(e){if(!e)return"Never";const t=new Date(e),s=new Date().getTime()-t.getTime(),r=Math.floor(s/1e3),i=Math.floor(r/60);return r<60?`${r}s ago`:i<60?`${i}m ago`:`${Math.floor(i/60)}h ago`}async function o6(){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 a6({selectedAgent:e,onSelectAgent:t}){const n=Lt(),s=yr(),r=bl(),{data:i,isLoading:o,error:a}=he({queryKey:["agents"],queryFn:GB,refetchInterval:3e3}),{data:c,isLoading:u}=he({queryKey:["specialists"],queryFn:JB,refetchInterval:5e3}),{data:d}=he({queryKey:["cloister-health"],queryFn:ZB,refetchInterval:5e3}),{data:h}=he({queryKey:["cloister-status"],queryFn:e6,refetchInterval:5e3}),{data:p}=he({queryKey:["activity"],queryFn:t6,refetchInterval:5e3}),{data:f}=he({queryKey:["issues"],queryFn:n6,refetchInterval:3e4}),m=we({mutationFn:s6,onSuccess:()=>{n.invalidateQueries({queryKey:["cloister-status"]})}}),g=we({mutationFn:r6,onSuccess:()=>{n.invalidateQueries({queryKey:["cloister-status"]})}}),v=we({mutationFn:o6,onSuccess:()=>{n.invalidateQueries({queryKey:["specialists"]}),n.invalidateQueries({queryKey:["agents"]})},onError:T=>{r({message:`Failed to reset specialists: ${T.message}`,variant:"error"})}}),x=async()=>{await s({title:"Reset Specialists",message:`Reset ALL specialist agents?
|
|
551
|
+
|
|
552
|
+
This will kill any running specialists and clear their session files.`,variant:"destructive",confirmLabel:"Reset All"})&&v.mutate()},_=T=>{if(!T||!f)return;const F=f.find(R=>R.identifier.toLowerCase()===T.toLowerCase());if(F)return{id:F.id,identifier:F.identifier,title:F.title}},b=(c==null?void 0:c.some(T=>T.isRunning))||!1,S=(h==null?void 0:h.running)||!1,C=(p||[]).slice(-5).reverse();if(o||u)return l.jsx("div",{className:"bg-surface-raised rounded-lg p-6",children:l.jsx("div",{className:"text-content-subtle",children:"Loading agents..."})});if(a)return l.jsx("div",{className:"bg-surface-raised rounded-lg p-6",children:l.jsxs("div",{className:"text-red-400",children:["Error: ",a.message]})});const w=(i==null?void 0:i.filter(T=>T.status!=="dead"))||[],j=(c==null?void 0:c.filter(T=>T.enabled))||[];return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-divider flex items-center justify-between",children:[l.jsxs("h2",{className:"font-semibold text-content flex items-center gap-2",children:[l.jsx(ll,{className:"w-5 h-5 text-blue-400"}),"Cloister Deacon"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`text-xs px-2 py-1 rounded ${b?"bg-green-900/50 text-green-400":"bg-surface-overlay text-content-subtle"}`,children:b?"● Specialists Active":"○ Specialists Idle"}),S?l.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:[l.jsx(ou,{className:"w-3 h-3"}),"Stop Patrol"]}):l.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:[l.jsx(Qn,{className:"w-3 h-3"}),"Start Patrol"]})]})]}),l.jsx("div",{className:"p-4",children:l.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-content-subtle",children:"Patrol Status:"})," ",l.jsx("span",{className:S?"text-green-400":"text-content-muted",children:S?"● Running":"○ Stopped"})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-content-subtle",children:"Last Check:"})," ",l.jsx("span",{className:"text-content-body",children:i6((h==null?void 0:h.lastCheck)||null)})]}),(h==null?void 0:h.summary)&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(po,{className:"w-4 h-4 text-green-400"}),l.jsxs("span",{className:"text-content-body",children:[h.summary.active," active"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[h.summary.stuck>0?l.jsx(Uo,{className:"w-4 h-4 text-red-400"}):l.jsx(Uo,{className:"w-4 h-4 text-content-muted"}),l.jsxs("span",{className:h.summary.stuck>0?"text-red-400":"text-content-subtle",children:[h.summary.stuck," stuck"]})]})]})]})})]}),C.length>0&&l.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[l.jsx("div",{className:"px-4 py-3 border-b border-divider",children:l.jsxs("h2",{className:"font-semibold text-content flex items-center gap-2",children:[l.jsx(al,{className:"w-5 h-5 text-cyan-400"}),"Recent Activity"]})}),l.jsx("div",{className:"divide-y divide-gray-700",children:C.map(T=>l.jsxs("div",{className:"px-4 py-2 flex items-center gap-3 text-sm",children:[l.jsx("span",{className:"text-content-muted text-xs w-16",children:new Date(T.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}),l.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}),l.jsxs("span",{className:"text-content-body truncate flex-1",children:[T.type==="deacon"?T.command:T.source,T.issueId&&T.type!=="deacon"&&l.jsxs("span",{className:"text-cyan-400 ml-1",children:["(",T.issueId,")"]})]})]},T.id))})]}),l.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-divider flex items-center justify-between",children:[l.jsxs("h2",{className:"font-semibold text-content flex items-center gap-2",children:[l.jsx(ep,{className:"w-5 h-5 text-purple-400"}),"Specialist Agents (",j.length,")"]}),l.jsxs("button",{onClick:x,disabled:v.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:[v.isPending?l.jsx(be,{className:"w-3.5 h-3.5 animate-spin"}):l.jsx(Lu,{className:"w-3.5 h-3.5"}),"Reset All"]})]}),l.jsx("div",{className:"divide-y divide-gray-700",children:j.length===0?l.jsx("div",{className:"p-8 text-center text-content-muted",children:"No specialist agents configured."}):j.map(T=>l.jsx(RB,{specialist:T,issueInfo:_(T.currentIssue),onSelect:()=>t(T.tmuxSession===e?null:T.tmuxSession),isSelected:T.tmuxSession===e},T.name))})]}),l.jsxs("div",{className:"bg-surface-raised rounded-lg",children:[l.jsx("div",{className:"px-4 py-3 border-b border-divider",children:l.jsxs("h2",{className:"font-semibold text-content flex items-center gap-2",children:[l.jsx(GN,{className:"w-5 h-5"}),"Issue Agents (",w.length,")"]})}),l.jsx("div",{className:"divide-y divide-gray-700",children:w.length===0?l.jsxs("div",{className:"p-8 text-center text-content-muted",children:["No agents running. Use"," ",l.jsx("code",{className:"bg-surface-overlay px-2 py-1 rounded",children:"/work-issue"})," to spawn one."]}):w.map(T=>{const F=d==null?void 0:d.agents.find(R=>R.agentId===T.id);return l.jsx(QB,{agent:T,health:F,onSelect:()=>t(T.id===e?null:T.id),isSelected:T.id===e},T.id)})})]})]})}async function l6(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 c6(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 u6({agentId:e}){const[t,n]=y.useState(""),s=y.useRef(null),{data:r,isLoading:i,refetch:o}=he({queryKey:["agent-output",e],queryFn:()=>l6(e),refetchInterval:2e3}),a=we({mutationFn:u=>c6(e,u),onSuccess:()=>{n(""),setTimeout(()=>o(),500)}});y.useEffect(()=>{s.current&&(s.current.scrollTop=s.current.scrollHeight)},[r]);const c=u=>{u.preventDefault(),t.trim()&&a.mutate(t.trim())};return l.jsxs("div",{className:"bg-gray-800 rounded-lg flex flex-col h-[600px]",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-gray-700 flex items-center justify-between",children:[l.jsxs("h2",{className:"font-semibold text-white flex items-center gap-2",children:[l.jsx(Vo,{className:"w-5 h-5"}),e]}),l.jsx("button",{onClick:()=>o(),className:"p-2 text-gray-400 hover:text-white hover:bg-gray-700 rounded",title:"Refresh",children:l.jsx(Ar,{className:"w-4 h-4"})})]}),l.jsx("pre",{ref:s,className:"flex-1 overflow-auto p-4 terminal-output text-gray-300 bg-gray-900",children:i?l.jsx("span",{className:"text-gray-500",children:"Loading..."}):r||l.jsx("span",{className:"text-gray-500",children:"No output yet"})}),l.jsx("form",{onSubmit:c,className:"p-3 border-t border-gray-700",children:l.jsxs("div",{className:"flex gap-2",children:[l.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"}),l.jsxs("button",{type:"submit",disabled:!t.trim()||a.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:[l.jsx(nj,{className:"w-4 h-4"}),"Send"]})]})})]})}async function d6(){const e=await fetch("/api/services/tldr/status");if(!e.ok)throw new Error("Failed to fetch TLDR status");return e.json()}function LE(){const{data:e,isLoading:t,error:n}=he({queryKey:["tldr-status"],queryFn:d6,refetchInterval:1e4});if(t)return l.jsx("div",{className:"bg-surface-raised rounded-lg p-4 border border-divider",children:l.jsxs("div",{className:"flex items-center gap-2 text-content-subtle",children:[l.jsx(be,{className:"w-4 h-4 animate-spin"}),l.jsx("span",{className:"text-sm",children:"Loading TLDR status..."})]})});if(n)return l.jsx("div",{className:"bg-surface-raised rounded-lg p-4 border border-divider",children:l.jsxs("div",{className:"flex items-center gap-2 text-red-400",children:[l.jsx(Kr,{className:"w-4 h-4"}),l.jsx("span",{className:"text-sm",children:"TLDR status unavailable"})]})});if(!e||e.daemons.length===0)return l.jsx("div",{className:"bg-surface-raised rounded-lg p-4 border border-divider",children:l.jsxs("div",{className:"flex items-center gap-2 text-content-subtle",children:[l.jsx(Kr,{className:"w-4 h-4"}),l.jsx("span",{className:"text-sm",children:"TLDR not configured"}),l.jsx("span",{className:"text-xs text-content-muted ml-auto",children:"Run pan setup to enable"})]})});const s=e.daemons.find(i=>i.workspace==="main"),r=e.daemons.filter(i=>i.workspace!=="main");return l.jsxs("div",{className:"space-y-3",children:[s&&l.jsx(m1,{daemon:s,label:"Main Index"}),r.length>0&&l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:r.map(i=>l.jsx(m1,{daemon:i,label:i.workspace},i.workspace))})]})}function m1({daemon:e,label:t}){const n=e.running&&e.healthy;return l.jsx("div",{className:`rounded-lg p-4 border ${n?"bg-green-900/30 border-green-800/30":"bg-surface-raised border-divider"}`,children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[n?l.jsx(mr,{className:"w-5 h-5 text-green-400"}):l.jsx(Kr,{className:"w-5 h-5 text-gray-400"}),l.jsxs("div",{children:[l.jsx("div",{className:"font-medium text-content",children:t}),l.jsxs("div",{className:"text-sm text-content-subtle",children:[e.running?"Running":"Stopped",e.running&&e.pid&&` (PID ${e.pid})`]})]})]}),l.jsxs("div",{className:"text-right",children:[e.fileCount!=null&&l.jsxs("div",{className:"flex items-center gap-1 text-sm text-content",children:[l.jsx(Nx,{className:"w-3.5 h-3.5 text-content-subtle"}),l.jsxs("span",{children:[e.fileCount.toLocaleString()," files",e.edgeCount!=null&&`, ${e.edgeCount.toLocaleString()} edges`]})]}),e.indexAge&&l.jsxs("div",{className:"text-xs text-content-muted",children:["Updated ",e.indexAge]})]})]})})}async function h6(){const e=await fetch("/api/health/agents");if(!e.ok)throw new Error("Failed to fetch health");return e.json()}const g1={healthy:{icon:mr,color:"text-green-400",bg:"bg-green-900/30"},warning:{icon:kn,color:"text-yellow-400",bg:"bg-yellow-900/30"},stuck:{icon:ll,color:"text-orange-400",bg:"bg-orange-900/30"},dead:{icon:Kr,color:"text-red-400",bg:"bg-red-900/30"}};function f6(){const{data:e,isLoading:t,error:n}=he({queryKey:["health"],queryFn:h6,refetchInterval:5e3});if(t)return l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx("div",{className:"text-content-subtle",children:"Loading health data..."})});if(n)return l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsxs("div",{className:"text-red-400",children:["Error: ",n.message]})});if(!e||e.length===0)return l.jsxs("div",{className:"bg-surface-raised rounded-lg p-8 text-center",children:[l.jsx(al,{className:"w-12 h-12 text-gray-600 mx-auto mb-4"}),l.jsx("h3",{className:"text-lg font-medium text-content-subtle",children:"No agents to monitor"}),l.jsx("p",{className:"text-sm text-content-muted mt-2",children:"Health data will appear here when agents are running"})]});const s=e.reduce((r,i)=>(r[i.status]=(r[i.status]||0)+1,r),{});return l.jsxs("div",{className:"space-y-6",children:[l.jsx(LE,{}),l.jsx("div",{className:"grid grid-cols-4 gap-4",children:["healthy","warning","stuck","dead"].map(r=>{const i=g1[r],o=i.icon;return l.jsx("div",{className:`${i.bg} rounded-lg p-4 border border-divider`,children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(o,{className:`w-8 h-8 ${i.color}`}),l.jsxs("div",{children:[l.jsx("div",{className:"text-2xl font-bold text-content",children:s[r]||0}),l.jsx("div",{className:"text-sm text-content-subtle capitalize",children:r})]})]})},r)})}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:e.map(r=>{const i=g1[r.status],o=i.icon;return l.jsxs("div",{className:`${i.bg} rounded-lg p-4 border border-divider`,children:[l.jsx("div",{className:"flex items-start justify-between",children:l.jsxs("div",{children:[l.jsx("div",{className:"font-medium text-content",children:r.agentId}),l.jsxs("div",{className:`flex items-center gap-1 text-sm ${i.color} mt-1`,children:[l.jsx(o,{className:"w-4 h-4"}),l.jsx("span",{className:"capitalize",children:r.status})]})]})}),r.reason&&l.jsx("div",{className:"mt-2 text-sm text-content-subtle italic",children:r.reason}),l.jsxs("div",{className:"mt-4 space-y-2 text-sm",children:[r.lastPing&&l.jsxs("div",{className:"flex justify-between text-content-subtle",children:[l.jsx("span",{children:"Last ping:"}),l.jsx("span",{children:new Date(r.lastPing).toLocaleTimeString()})]}),l.jsxs("div",{className:"flex justify-between text-content-subtle",children:[l.jsx("span",{children:"Failures:"}),l.jsx("span",{className:r.consecutiveFailures>0?"text-orange-400":"",children:r.consecutiveFailures})]}),l.jsxs("div",{className:"flex justify-between text-content-subtle",children:[l.jsx("span",{children:"Kill count:"}),l.jsx("span",{className:r.killCount>0?"text-red-400":"",children:r.killCount})]}),r.contextPercent!=null&&l.jsxs("div",{className:"flex justify-between text-content-subtle",children:[l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx(ep,{className:"w-3.5 h-3.5"}),"Context:"]}),l.jsxs("span",{className:r.contextPercent>=80?"text-red-400":r.contextPercent>=60?"text-yellow-400":"text-green-400",children:[r.contextPercent,"%"]})]})]})]},r.agentId)})})]})}function p6(){const[e,t]=y.useState([]),[n,s]=y.useState(!0),[r,i]=y.useState(null),o=async()=>{try{s(!0);const u=await fetch("/api/skills");if(!u.ok)throw new Error("Failed to fetch skills");const d=await u.json();t(d),i(null)}catch(u){i(u instanceof Error?u.message:"Unknown error")}finally{s(!1)}};if(y.useEffect(()=>{o()},[]),n)return l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx(Ar,{className:"w-6 h-6 text-content-subtle animate-spin"})});if(r)return l.jsxs("div",{className:"bg-red-900/20 border border-red-800 rounded-lg p-4 text-red-400",children:[l.jsx(Uo,{className:"w-5 h-5 inline mr-2"}),r]});const a=e.filter(u=>u.source==="panopticon"),c=e.filter(u=>u.source==="claude");return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h2",{className:"text-lg font-semibold text-content",children:"Skills"}),l.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:[l.jsx(Ar,{className:"w-4 h-4"}),"Refresh"]})]}),e.length===0?l.jsxs("div",{className:"bg-surface-raised rounded-lg p-8 text-center text-content-subtle",children:[l.jsx(jx,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),l.jsx("p",{children:"No skills found"}),l.jsx("p",{className:"text-sm mt-2",children:"Add skills to ~/.panopticon/skills/ or ~/.claude/skills/"})]}):l.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[l.jsxs("div",{className:"bg-surface-raised rounded-lg p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[l.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500"}),l.jsxs("h3",{className:"font-medium text-content",children:["Panopticon (",a.length,")"]})]}),l.jsxs("div",{className:"space-y-2",children:[a.map(u=>l.jsx(x1,{skill:u},u.path)),a.length===0&&l.jsx("p",{className:"text-content-muted text-sm",children:"No Panopticon skills"})]})]}),l.jsxs("div",{className:"bg-surface-raised rounded-lg p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[l.jsx("div",{className:"w-2 h-2 rounded-full bg-purple-500"}),l.jsxs("h3",{className:"font-medium text-content",children:["Claude (",c.length,")"]})]}),l.jsxs("div",{className:"space-y-2",children:[c.map(u=>l.jsx(x1,{skill:u},u.path)),c.length===0&&l.jsx("p",{className:"text-content-muted text-sm",children:"No Claude skills"})]})]})]}),l.jsxs("div",{className:"bg-surface-raised rounded-lg p-4",children:[l.jsx("h3",{className:"font-medium text-content mb-2",children:"Skill Locations"}),l.jsxs("div",{className:"text-sm text-content-subtle space-y-1",children:[l.jsxs("p",{children:[l.jsx("span",{className:"text-blue-400",children:"Panopticon:"})," ","~/.panopticon/skills/"]}),l.jsxs("p",{children:[l.jsx("span",{className:"text-purple-400",children:"Claude:"})," ~/.claude/skills/"]})]})]})]})}function x1({skill:e}){return l.jsxs("div",{className:"bg-surface-overlay/50 rounded-lg p-3 hover:bg-surface-overlay transition-colors",children:[l.jsxs("div",{className:"flex items-start justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(VN,{className:"w-4 h-4 text-content-subtle"}),l.jsx("span",{className:"font-medium text-content",children:e.name})]}),e.hasSkillMd?l.jsxs("span",{className:"flex items-center gap-1 text-xs text-green-400",children:[l.jsx(Ec,{className:"w-3 h-3"}),"SKILL.md"]}):l.jsxs("span",{className:"flex items-center gap-1 text-xs text-yellow-400",children:[l.jsx(Uo,{className:"w-3 h-3"}),"No SKILL.md"]})]}),e.description&&l.jsx("p",{className:"mt-2 text-sm text-content-subtle line-clamp-2",children:e.description}),l.jsx("p",{className:"mt-2 text-xs text-content-muted truncate",children:e.path})]})}function m6(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const g6=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,x6=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,v6={};function v1(e,t){return(v6.jsx?x6:g6).test(e)}const y6=/[ \t\n\f\r]/g;function _6(e){return typeof e=="object"?e.type==="text"?y1(e.value):!1:y1(e)}function y1(e){return e.replace(y6,"")===""}class Wu{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Wu.prototype.normal={};Wu.prototype.property={};Wu.prototype.space=void 0;function AE(e,t){const n={},s={};for(const r of e)Object.assign(n,r.property),Object.assign(s,r.normal);return new Wu(n,s,t)}function yv(e){return e.toLowerCase()}class es{constructor(t,n){this.attribute=n,this.property=t}}es.prototype.attribute="";es.prototype.booleanish=!1;es.prototype.boolean=!1;es.prototype.commaOrSpaceSeparated=!1;es.prototype.commaSeparated=!1;es.prototype.defined=!1;es.prototype.mustUseProperty=!1;es.prototype.number=!1;es.prototype.overloadedBoolean=!1;es.prototype.property="";es.prototype.spaceSeparated=!1;es.prototype.space=void 0;let b6=0;const Ce=ia(),Et=ia(),_v=ia(),ne=ia(),Ze=ia(),za=ia(),is=ia();function ia(){return 2**++b6}const bv=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ce,booleanish:Et,commaOrSpaceSeparated:is,commaSeparated:za,number:ne,overloadedBoolean:_v,spaceSeparated:Ze},Symbol.toStringTag,{value:"Module"})),Tm=Object.keys(bv);class R0 extends es{constructor(t,n,s,r){let i=-1;if(super(t,n),_1(this,"space",r),typeof s=="number")for(;++i<Tm.length;){const o=Tm[i];_1(this,Tm[i],(s&bv[o])===bv[o])}}}R0.prototype.defined=!0;function _1(e,t,n){n&&(e[t]=n)}function Nl(e){const t={},n={};for(const[s,r]of Object.entries(e.properties)){const i=new R0(s,e.transform(e.attributes||{},s),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),t[s]=i,n[yv(s)]=s,n[yv(i.attribute)]=s}return new Wu(t,n,e.space)}const OE=Nl({properties:{ariaActiveDescendant:null,ariaAtomic:Et,ariaAutoComplete:null,ariaBusy:Et,ariaChecked:Et,ariaColCount:ne,ariaColIndex:ne,ariaColSpan:ne,ariaControls:Ze,ariaCurrent:null,ariaDescribedBy:Ze,ariaDetails:null,ariaDisabled:Et,ariaDropEffect:Ze,ariaErrorMessage:null,ariaExpanded:Et,ariaFlowTo:Ze,ariaGrabbed:Et,ariaHasPopup:null,ariaHidden:Et,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ze,ariaLevel:ne,ariaLive:null,ariaModal:Et,ariaMultiLine:Et,ariaMultiSelectable:Et,ariaOrientation:null,ariaOwns:Ze,ariaPlaceholder:null,ariaPosInSet:ne,ariaPressed:Et,ariaReadOnly:Et,ariaRelevant:null,ariaRequired:Et,ariaRoleDescription:Ze,ariaRowCount:ne,ariaRowIndex:ne,ariaRowSpan:ne,ariaSelected:Et,ariaSetSize:ne,ariaSort:null,ariaValueMax:ne,ariaValueMin:ne,ariaValueNow:ne,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function IE(e,t){return t in e?e[t]:t}function FE(e,t){return IE(e,t.toLowerCase())}const w6=Nl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:za,acceptCharset:Ze,accessKey:Ze,action:null,allow:null,allowFullScreen:Ce,allowPaymentRequest:Ce,allowUserMedia:Ce,alt:null,as:null,async:Ce,autoCapitalize:null,autoComplete:Ze,autoFocus:Ce,autoPlay:Ce,blocking:Ze,capture:null,charSet:null,checked:Ce,cite:null,className:Ze,cols:ne,colSpan:null,content:null,contentEditable:Et,controls:Ce,controlsList:Ze,coords:ne|za,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ce,defer:Ce,dir:null,dirName:null,disabled:Ce,download:_v,draggable:Et,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ce,formTarget:null,headers:Ze,height:ne,hidden:_v,high:ne,href:null,hrefLang:null,htmlFor:Ze,httpEquiv:Ze,id:null,imageSizes:null,imageSrcSet:null,inert:Ce,inputMode:null,integrity:null,is:null,isMap:Ce,itemId:null,itemProp:Ze,itemRef:Ze,itemScope:Ce,itemType:Ze,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ce,low:ne,manifest:null,max:null,maxLength:ne,media:null,method:null,min:null,minLength:ne,multiple:Ce,muted:Ce,name:null,nonce:null,noModule:Ce,noValidate:Ce,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:Ce,optimum:ne,pattern:null,ping:Ze,placeholder:null,playsInline:Ce,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ce,referrerPolicy:null,rel:Ze,required:Ce,reversed:Ce,rows:ne,rowSpan:ne,sandbox:Ze,scope:null,scoped:Ce,seamless:Ce,selected:Ce,shadowRootClonable:Ce,shadowRootDelegatesFocus:Ce,shadowRootMode:null,shape:null,size:ne,sizes:null,slot:null,span:ne,spellCheck:Et,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ne,step:null,style:null,tabIndex:ne,target:null,title:null,translate:null,type:null,typeMustMatch:Ce,useMap:null,value:Et,width:ne,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ze,axis:null,background:null,bgColor:null,border:ne,borderColor:null,bottomMargin:ne,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ce,declare:Ce,event:null,face:null,frame:null,frameBorder:null,hSpace:ne,leftMargin:ne,link:null,longDesc:null,lowSrc:null,marginHeight:ne,marginWidth:ne,noResize:Ce,noHref:Ce,noShade:Ce,noWrap:Ce,object:null,profile:null,prompt:null,rev:null,rightMargin:ne,rules:null,scheme:null,scrolling:Et,standby:null,summary:null,text:null,topMargin:ne,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ne,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ce,disableRemotePlayback:Ce,prefix:null,property:null,results:ne,security:null,unselectable:null},space:"html",transform:FE}),S6=Nl({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:is,accentHeight:ne,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ne,amplitude:ne,arabicForm:null,ascent:ne,attributeName:null,attributeType:null,azimuth:ne,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ne,by:null,calcMode:null,capHeight:ne,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:ne,diffuseConstant:ne,direction:null,display:null,dur:null,divisor:ne,dominantBaseline:null,download:Ce,dx:null,dy:null,edgeMode:null,editable:null,elevation:ne,enableBackground:null,end:null,event:null,exponent:ne,externalResourcesRequired:null,fill:null,fillOpacity:ne,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:za,g2:za,glyphName:za,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ne,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ne,horizOriginX:ne,horizOriginY:ne,id:null,ideographic:ne,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ne,k:ne,k1:ne,k2:ne,k3:ne,k4:ne,kernelMatrix:is,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ne,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:ne,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:ne,overlineThickness:ne,paintOrder:null,panose1:null,path:null,pathLength:ne,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ze,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ne,pointsAtY:ne,pointsAtZ:ne,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:is,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:is,rev:is,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:is,requiredFeatures:is,requiredFonts:is,requiredFormats:is,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:ne,specularExponent:ne,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ne,strikethroughThickness:ne,string:null,stroke:null,strokeDashArray:is,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ne,strokeOpacity:ne,strokeWidth:null,style:null,surfaceScale:ne,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:is,tabIndex:ne,tableValues:null,target:null,targetX:ne,targetY:ne,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:is,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ne,underlineThickness:ne,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ne,values:null,vAlphabetic:ne,vMathematical:ne,vectorEffect:null,vHanging:ne,vIdeographic:ne,version:null,vertAdvY:ne,vertOriginX:ne,vertOriginY:ne,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ne,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:IE}),BE=Nl({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()}}),zE=Nl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:FE}),$E=Nl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),k6={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"},C6=/[A-Z]/g,b1=/-[a-z]/g,N6=/^data[-\w.:]+$/i;function j6(e,t){const n=yv(t);let s=t,r=es;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&N6.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(b1,P6);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!b1.test(i)){let o=i.replace(C6,E6);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}r=R0}return new r(s,t)}function E6(e){return"-"+e.toLowerCase()}function P6(e){return e.charAt(1).toUpperCase()}const T6=AE([OE,w6,BE,zE,$E],"html"),D0=AE([OE,S6,BE,zE,$E],"svg");function R6(e){return e.join(" ").trim()}var M0={},w1=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,D6=/\n/g,M6=/^\s*/,L6=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,A6=/^:\s*/,O6=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,I6=/^[;\s]*/,F6=/^\s+|\s+$/g,B6=`
|
|
553
|
+
`,S1="/",k1="*",mo="",z6="comment",$6="declaration";function H6(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,s=1;function r(m){var g=m.match(D6);g&&(n+=g.length);var v=m.lastIndexOf(B6);s=~v?m.length-v:s+m.length}function i(){var m={line:n,column:s};return function(g){return g.position=new o(m),u(),g}}function o(m){this.start=m,this.end={line:n,column:s},this.source=t.source}o.prototype.content=e;function a(m){var g=new Error(t.source+":"+n+":"+s+": "+m);if(g.reason=m,g.filename=t.source,g.line=n,g.column=s,g.source=e,!t.silent)throw g}function c(m){var g=m.exec(e);if(g){var v=g[0];return r(v),e=e.slice(v.length),g}}function u(){c(M6)}function d(m){var g;for(m=m||[];g=h();)g!==!1&&m.push(g);return m}function h(){var m=i();if(!(S1!=e.charAt(0)||k1!=e.charAt(1))){for(var g=2;mo!=e.charAt(g)&&(k1!=e.charAt(g)||S1!=e.charAt(g+1));)++g;if(g+=2,mo===e.charAt(g-1))return a("End of comment missing");var v=e.slice(2,g-2);return s+=2,r(v),e=e.slice(g),s+=2,m({type:z6,comment:v})}}function p(){var m=i(),g=c(L6);if(g){if(h(),!c(A6))return a("property missing ':'");var v=c(O6),x=m({type:$6,property:C1(g[0].replace(w1,mo)),value:v?C1(v[0].replace(w1,mo)):mo});return c(I6),x}}function f(){var m=[];d(m);for(var g;g=p();)g!==!1&&(m.push(g),d(m));return m}return u(),f()}function C1(e){return e?e.replace(F6,mo):mo}var W6=H6,U6=Oh&&Oh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(M0,"__esModule",{value:!0});M0.default=K6;const q6=U6(W6);function K6(e,t){let n=null;if(!e||typeof e!="string")return n;const s=(0,q6.default)(e),r=typeof t=="function";return s.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:a}=i;r?t(o,a,i):a&&(n=n||{},n[o]=a)}),n}var pp={};Object.defineProperty(pp,"__esModule",{value:!0});pp.camelCase=void 0;var V6=/^--[a-zA-Z0-9_-]+$/,Y6=/-([a-z])/g,X6=/^[^-]+$/,Q6=/^-(webkit|moz|ms|o|khtml)-/,G6=/^-(ms)-/,J6=function(e){return!e||X6.test(e)||V6.test(e)},Z6=function(e,t){return t.toUpperCase()},N1=function(e,t){return"".concat(t,"-")},ez=function(e,t){return t===void 0&&(t={}),J6(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(G6,N1):e=e.replace(Q6,N1),e.replace(Y6,Z6))};pp.camelCase=ez;var tz=Oh&&Oh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},nz=tz(M0),sz=pp;function wv(e,t){var n={};return!e||typeof e!="string"||(0,nz.default)(e,function(s,r){s&&r&&(n[(0,sz.camelCase)(s,t)]=r)}),n}wv.default=wv;var rz=wv;const iz=ml(rz),HE=WE("end"),L0=WE("start");function WE(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function oz(e){const t=L0(e),n=HE(e);if(t&&n)return{start:t,end:n}}function Mc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?j1(e.position):"start"in e||"end"in e?j1(e):"line"in e||"column"in e?Sv(e):""}function Sv(e){return E1(e&&e.line)+":"+E1(e&&e.column)}function j1(e){return Sv(e&&e.start)+"-"+Sv(e&&e.end)}function E1(e){return e&&typeof e=="number"?e:1}class jn extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let r="",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"?r=t:!i.cause&&t&&(o=!0,r=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof s=="string"){const c=s.indexOf(":");c===-1?i.ruleId=s:(i.source=s.slice(0,c),i.ruleId=s.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const a=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=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=a?a.line:void 0,this.name=Mc(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}}jn.prototype.file="";jn.prototype.name="";jn.prototype.reason="";jn.prototype.message="";jn.prototype.stack="";jn.prototype.column=void 0;jn.prototype.line=void 0;jn.prototype.ancestors=void 0;jn.prototype.cause=void 0;jn.prototype.fatal=void 0;jn.prototype.place=void 0;jn.prototype.ruleId=void 0;jn.prototype.source=void 0;const A0={}.hasOwnProperty,az=new Map,lz=/[A-Z]/g,cz=new Set(["table","tbody","thead","tfoot","tr"]),uz=new Set(["td","th"]),UE="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function dz(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=yz(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");s=vz(n,t.jsx,t.jsxs)}const r={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,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"?D0:T6,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=qE(r,e,void 0);return i&&typeof i!="string"?i:r.create(e,r.Fragment,{children:i||void 0},void 0)}function qE(e,t,n){if(t.type==="element")return hz(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return fz(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return mz(e,t,n);if(t.type==="mdxjsEsm")return pz(e,t);if(t.type==="root")return gz(e,t,n);if(t.type==="text")return xz(e,t)}function hz(e,t,n){const s=e.schema;let r=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(r=D0,e.schema=r),e.ancestors.push(t);const i=VE(e,t.tagName,!1),o=_z(e,t);let a=I0(e,t);return cz.has(t.tagName)&&(a=a.filter(function(c){return typeof c=="string"?!_6(c):!0})),KE(e,o,i,t),O0(o,a),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function fz(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}pu(e,t.position)}function pz(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);pu(e,t.position)}function mz(e,t,n){const s=e.schema;let r=s;t.name==="svg"&&s.space==="html"&&(r=D0,e.schema=r),e.ancestors.push(t);const i=t.name===null?e.Fragment:VE(e,t.name,!0),o=bz(e,t),a=I0(e,t);return KE(e,o,i,t),O0(o,a),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function gz(e,t,n){const s={};return O0(s,I0(e,t)),e.create(t,e.Fragment,s,n)}function xz(e,t){return t.value}function KE(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function O0(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function vz(e,t,n){return s;function s(r,i,o,a){const u=Array.isArray(o.children)?n:t;return a?u(i,o,a):u(i,o)}}function yz(e,t){return n;function n(s,r,i,o){const a=Array.isArray(i.children),c=L0(s);return t(r,i,o,a,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function _z(e,t){const n={};let s,r;for(r in t.properties)if(r!=="children"&&A0.call(t.properties,r)){const i=wz(e,r,t.properties[r]);if(i){const[o,a]=i;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&uz.has(t.tagName)?s=a:n[o]=a}}if(s){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function bz(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const i=s.data.estree.body[0];i.type;const o=i.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else pu(e,t.position);else{const r=s.name;let i;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const a=s.value.data.estree.body[0];a.type,i=e.evaluater.evaluateExpression(a.expression)}else pu(e,t.position);else i=s.value===null?!0:s.value;n[r]=i}return n}function I0(e,t){const n=[];let s=-1;const r=e.passKeys?new Map:az;for(;++s<t.children.length;){const i=t.children[s];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=r.get(c)||0;o=c+"-"+u,r.set(c,u+1)}}const a=qE(e,i,o);a!==void 0&&n.push(a)}return n}function wz(e,t,n){const s=j6(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?m6(n):R6(n)),s.property==="style"){let r=typeof n=="object"?n:Sz(e,String(n));return e.stylePropertyNameCase==="css"&&(r=kz(r)),["style",r]}return[e.elementAttributeNameCase==="react"&&s.space?k6[s.property]||s.property:s.attribute,n]}}function Sz(e,t){try{return iz(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,r=new jn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=UE+"#cannot-parse-style-attribute",r}}function VE(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const r=t.split(".");let i=-1,o;for(;++i<r.length;){const a=v1(r[i])?{type:"Identifier",name:r[i]}:{type:"Literal",value:r[i]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}s=o}else s=v1(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const r=s.value;return A0.call(e.components,r)?e.components[r]:r}if(e.evaluater)return e.evaluater.evaluateExpression(s);pu(e)}function pu(e,t){const n=new jn("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=UE+"#cannot-handle-mdx-estrees-without-createevaluater",n}function kz(e){const t={};let n;for(n in e)A0.call(e,n)&&(t[Cz(n)]=e[n]);return t}function Cz(e){let t=e.replace(lz,Nz);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Nz(e){return"-"+e.toLowerCase()}const Rm={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"]},jz={};function F0(e,t){const n=jz,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,r=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return YE(e,s,r)}function YE(e,t,n){if(Ez(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 P1(e.children,t,n)}return Array.isArray(e)?P1(e,t,n):""}function P1(e,t,n){const s=[];let r=-1;for(;++r<e.length;)s[r]=YE(e[r],t,n);return s.join("")}function Ez(e){return!!(e&&typeof e=="object")}const T1=document.createElement("i");function B0(e){const t="&"+e+";";T1.innerHTML=t;const n=T1.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function us(e,t,n,s){const r=e.length;let i=0,o;if(t<0?t=-t>r?0:r+t:t=t>r?r:t,n=n>0?n:0,s.length<1e4)o=Array.from(s),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<s.length;)o=s.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function ks(e,t){return e.length>0?(us(e,e.length,0,t),e):t}const R1={}.hasOwnProperty;function XE(e){const t={};let n=-1;for(;++n<e.length;)Pz(t,e[n]);return t}function Pz(e,t){let n;for(n in t){const r=(R1.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){R1.call(r,o)||(r[o]=[]);const a=i[o];Tz(r[o],Array.isArray(a)?a:a?[a]:[])}}}function Tz(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);us(e,0,0,s)}function QE(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 Us(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ln=Zi(/[A-Za-z]/),Sn=Zi(/[\dA-Za-z]/),Rz=Zi(/[#-'*+\--9=?A-Z^-~]/);function wf(e){return e!==null&&(e<32||e===127)}const kv=Zi(/\d/),Dz=Zi(/[\dA-Fa-f]/),Mz=Zi(/[!-/:-@[-`{-~]/);function xe(e){return e!==null&&e<-2}function Qe(e){return e!==null&&(e<0||e===32)}function Me(e){return e===-2||e===-1||e===32}const mp=Zi(new RegExp("\\p{P}|\\p{S}","u")),Qo=Zi(/\s/);function Zi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function jl(e){const t=[];let n=-1,s=0,r=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&Sn(e.charCodeAt(n+1))&&Sn(e.charCodeAt(n+2)))r=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const a=e.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(o=String.fromCharCode(i,a),r=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(s,n),encodeURIComponent(o)),s=n+r+1,o=""),r&&(n+=r,r=0)}return t.join("")+e.slice(s)}function Be(e,t,n,s){const r=s?s-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return Me(c)?(e.enter(n),a(c)):t(c)}function a(c){return Me(c)&&i++<r?(e.consume(c),a):(e.exit(n),t(c))}}const Lz={tokenize:Az};function Az(e){const t=e.attempt(this.parser.constructs.contentInitial,s,r);let n;return t;function s(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Be(e,t,"linePrefix")}function r(a){return e.enter("paragraph"),i(a)}function i(a){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return xe(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),o)}}const Oz={tokenize:Iz},D1={tokenize:Fz};function Iz(e){const t=this,n=[];let s=0,r,i,o;return a;function a(b){if(s<n.length){const S=n[s];return t.containerState=S[1],e.attempt(S[0].continuation,c,u)(b)}return u(b)}function c(b){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&_();const S=t.events.length;let C=S,w;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){w=t.events[C][1].end;break}x(s);let j=S;for(;j<t.events.length;)t.events[j][1].end={...w},j++;return us(t.events,C+1,0,t.events.slice(S)),t.events.length=j,u(b)}return a(b)}function u(b){if(s===n.length){if(!r)return p(b);if(r.currentConstruct&&r.currentConstruct.concrete)return m(b);t.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(D1,d,h)(b)}function d(b){return r&&_(),x(s),p(b)}function h(b){return t.parser.lazy[t.now().line]=s!==n.length,o=t.now().offset,m(b)}function p(b){return t.containerState={},e.attempt(D1,f,m)(b)}function f(b){return s++,n.push([t.currentConstruct,t.containerState]),p(b)}function m(b){if(b===null){r&&_(),x(0),e.consume(b);return}return r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:i}),g(b)}function g(b){if(b===null){v(e.exit("chunkFlow"),!0),x(0),e.consume(b);return}return xe(b)?(e.consume(b),v(e.exit("chunkFlow")),s=0,t.interrupt=void 0,a):(e.consume(b),g)}function v(b,S){const C=t.sliceStream(b);if(S&&C.push(null),b.previous=i,i&&(i.next=b),i=b,r.defineSkip(b.start),r.write(C),t.parser.lazy[b.start.line]){let w=r.events.length;for(;w--;)if(r.events[w][1].start.offset<o&&(!r.events[w][1].end||r.events[w][1].end.offset>o))return;const j=t.events.length;let T=j,F,R;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(F){R=t.events[T][1].end;break}F=!0}for(x(s),w=j;w<t.events.length;)t.events[w][1].end={...R},w++;us(t.events,T+1,0,t.events.slice(j)),t.events.length=w}}function x(b){let S=n.length;for(;S-- >b;){const C=n[S];t.containerState=C[1],C[0].exit.call(t,e)}n.length=b}function _(){r.write([null]),i=void 0,r=void 0,t.containerState._closeFlow=void 0}}function Fz(e,t,n){return Be(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ul(e){if(e===null||Qe(e)||Qo(e))return 1;if(mp(e))return 2}function gp(e,t,n){const s=[];let r=-1;for(;++r<e.length;){const i=e[r].resolveAll;i&&!s.includes(i)&&(t=i(t,n),s.push(i))}return t}const Cv={name:"attention",resolveAll:Bz,tokenize:zz};function Bz(e,t){let n=-1,s,r,i,o,a,c,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[s][1].end},p={...e[n][1].start};M1(h,-c),M1(p,c),o={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...e[s][1].end}},a={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},i={type:c>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},r={type:c>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[s][1].end={...o.start},e[n][1].start={...a.end},u=[],e[s][1].end.offset-e[s][1].start.offset&&(u=ks(u,[["enter",e[s][1],t],["exit",e[s][1],t]])),u=ks(u,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=ks(u,gp(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),u=ks(u,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",r,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=ks(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,us(e,s-1,n-s+3,u),n=s+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function zz(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,r=ul(s);let i;return o;function o(c){return i=c,e.enter("attentionSequence"),a(c)}function a(c){if(c===i)return e.consume(c),a;const u=e.exit("attentionSequence"),d=ul(c),h=!d||d===2&&r||n.includes(c),p=!r||r===2&&d||n.includes(s);return u._open=!!(i===42?h:h&&(r||!p)),u._close=!!(i===42?p:p&&(d||!h)),t(c)}}function M1(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const $z={name:"autolink",tokenize:Hz};function Hz(e,t,n){let s=0;return r;function r(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(f){return Ln(f)?(e.consume(f),o):f===64?n(f):u(f)}function o(f){return f===43||f===45||f===46||Sn(f)?(s=1,a(f)):u(f)}function a(f){return f===58?(e.consume(f),s=0,c):(f===43||f===45||f===46||Sn(f))&&s++<32?(e.consume(f),a):(s=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||wf(f)?n(f):(e.consume(f),c)}function u(f){return f===64?(e.consume(f),d):Rz(f)?(e.consume(f),u):n(f)}function d(f){return Sn(f)?h(f):n(f)}function h(f){return f===46?(e.consume(f),s=0,d):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||Sn(f))&&s++<63){const m=f===45?p:h;return e.consume(f),m}return n(f)}}const Uu={partial:!0,tokenize:Wz};function Wz(e,t,n){return s;function s(i){return Me(i)?Be(e,r,"linePrefix")(i):r(i)}function r(i){return i===null||xe(i)?t(i):n(i)}}const GE={continuation:{tokenize:qz},exit:Kz,name:"blockQuote",tokenize:Uz};function Uz(e,t,n){const s=this;return r;function r(o){if(o===62){const a=s.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return Me(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function qz(e,t,n){const s=this;return r;function r(o){return Me(o)?Be(e,i,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(GE,t,n)(o)}}function Kz(e){e.exit("blockQuote")}const JE={name:"characterEscape",tokenize:Vz};function Vz(e,t,n){return s;function s(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),r}function r(i){return Mz(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const ZE={name:"characterReference",tokenize:Yz};function Yz(e,t,n){const s=this;let r=0,i,o;return a;function a(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),c}function c(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=Sn,d(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=Dz,d):(e.enter("characterReferenceValue"),i=7,o=kv,d(h))}function d(h){if(h===59&&r){const p=e.exit("characterReferenceValue");return o===Sn&&!B0(s.sliceSerialize(p))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(h)&&r++<i?(e.consume(h),d):n(h)}}const L1={partial:!0,tokenize:Qz},A1={concrete:!0,name:"codeFenced",tokenize:Xz};function Xz(e,t,n){const s=this,r={partial:!0,tokenize:C};let i=0,o=0,a;return c;function c(w){return u(w)}function u(w){const j=s.events[s.events.length-1];return i=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,a=w,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(w)}function d(w){return w===a?(o++,e.consume(w),d):o<3?n(w):(e.exit("codeFencedFenceSequence"),Me(w)?Be(e,h,"whitespace")(w):h(w))}function h(w){return w===null||xe(w)?(e.exit("codeFencedFence"),s.interrupt?t(w):e.check(L1,g,S)(w)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===null||xe(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(w)):Me(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Be(e,f,"whitespace")(w)):w===96&&w===a?n(w):(e.consume(w),p)}function f(w){return w===null||xe(w)?h(w):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(w))}function m(w){return w===null||xe(w)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(w)):w===96&&w===a?n(w):(e.consume(w),m)}function g(w){return e.attempt(r,S,v)(w)}function v(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),x}function x(w){return i>0&&Me(w)?Be(e,_,"linePrefix",i+1)(w):_(w)}function _(w){return w===null||xe(w)?e.check(L1,g,S)(w):(e.enter("codeFlowValue"),b(w))}function b(w){return w===null||xe(w)?(e.exit("codeFlowValue"),_(w)):(e.consume(w),b)}function S(w){return e.exit("codeFenced"),t(w)}function C(w,j,T){let F=0;return R;function R(E){return w.enter("lineEnding"),w.consume(E),w.exit("lineEnding"),B}function B(E){return w.enter("codeFencedFence"),Me(E)?Be(w,A,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):A(E)}function A(E){return E===a?(w.enter("codeFencedFenceSequence"),D(E)):T(E)}function D(E){return E===a?(F++,w.consume(E),D):F>=o?(w.exit("codeFencedFenceSequence"),Me(E)?Be(w,P,"whitespace")(E):P(E)):T(E)}function P(E){return E===null||xe(E)?(w.exit("codeFencedFence"),j(E)):T(E)}}}function Qz(e,t,n){const s=this;return r;function r(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return s.parser.lazy[s.now().line]?n(o):t(o)}}const Dm={name:"codeIndented",tokenize:Jz},Gz={partial:!0,tokenize:Zz};function Jz(e,t,n){const s=this;return r;function r(u){return e.enter("codeIndented"),Be(e,i,"linePrefix",5)(u)}function i(u){const d=s.events[s.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?c(u):xe(u)?e.attempt(Gz,o,c)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||xe(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),a)}function c(u){return e.exit("codeIndented"),t(u)}}function Zz(e,t,n){const s=this;return r;function r(o){return s.parser.lazy[s.now().line]?n(o):xe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r):Be(e,i,"linePrefix",5)(o)}function i(o){const a=s.events[s.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):xe(o)?r(o):n(o)}}const e$={name:"codeText",previous:n$,resolve:t$,tokenize:s$};function t$(e){let t=e.length-4,n=3,s,r;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)r===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(r=s):(s===t||e[s][1].type==="lineEnding")&&(e[r][1].type="codeTextData",s!==r+2&&(e[r][1].end=e[s-1][1].end,e.splice(r+2,s-r-2),t-=s-r-2,s=r+2),r=void 0);return e}function n$(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function s$(e,t,n){let s=0,r,i;return o;function o(h){return e.enter("codeText"),e.enter("codeTextSequence"),a(h)}function a(h){return h===96?(e.consume(h),s++,a):(e.exit("codeTextSequence"),c(h))}function c(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),c):h===96?(i=e.enter("codeTextSequence"),r=0,d(h)):xe(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||xe(h)?(e.exit("codeTextData"),c(h)):(e.consume(h),u)}function d(h){return h===96?(e.consume(h),r++,d):r===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",u(h))}}class r${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 s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const r=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return s&&Xl(this.left,s),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),Xl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Xl(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);Xl(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Xl(this.left,n.reverse())}}}function Xl(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 e5(e){const t={};let n=-1,s,r,i,o,a,c,u;const d=new r$(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(s=d.get(n),n&&s[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=s[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(s[0]==="enter")s[1].contentType&&(Object.assign(t,i$(d,n)),n=t[n],u=!0);else if(s[1]._container){for(i=n,r=void 0;i--;)if(o=d.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(r&&(d.get(r)[1].type="lineEndingBlank"),o[1].type="lineEnding",r=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;r&&(s[1].end={...d.get(r)[1].start},a=d.slice(r,n),a.unshift(s),d.splice(r,n-r+1,a))}}return us(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function i$(e,t){const n=e.get(t)[1],s=e.get(t)[2];let r=t-1;const i=[];let o=n._tokenizer;o||(o=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,c=[],u={};let d,h,p=-1,f=n,m=0,g=0;const v=[g];for(;f;){for(;e.get(++r)[1]!==f;);i.push(r),f._tokenizer||(d=s.sliceStream(f),f.next||d.push(null),h&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=f,f=f.next}for(f=n;++p<a.length;)a[p][0]==="exit"&&a[p-1][0]==="enter"&&a[p][1].type===a[p-1][1].type&&a[p][1].start.line!==a[p][1].end.line&&(g=p+1,v.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):v.pop(),p=v.length;p--;){const x=a.slice(v[p],v[p+1]),_=i.pop();c.push([_,_+x.length-1]),e.splice(_,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 o$={resolve:l$,tokenize:c$},a$={partial:!0,tokenize:u$};function l$(e){return e5(e),e}function c$(e,t){let n;return s;function s(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(a)}function r(a){return a===null?i(a):xe(a)?e.check(a$,o,i)(a):(e.consume(a),r)}function i(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}function u$(e,t,n){const s=this;return r;function r(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Be(e,i,"linePrefix")}function i(o){if(o===null||xe(o))return n(o);const a=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(s.parser.constructs.flow,n,t)(o)}}function t5(e,t,n,s,r,i,o,a,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return h;function h(x){return x===60?(e.enter(s),e.enter(r),e.enter(i),e.consume(x),e.exit(i),p):x===null||x===32||x===41||wf(x)?n(x):(e.enter(s),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),g(x))}function p(x){return x===62?(e.enter(i),e.consume(x),e.exit(i),e.exit(r),e.exit(s),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),f(x))}function f(x){return x===62?(e.exit("chunkString"),e.exit(a),p(x)):x===null||x===60||xe(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!d&&(x===null||x===41||Qe(x))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(s),t(x)):d<u&&x===40?(e.consume(x),d++,g):x===41?(e.consume(x),d--,g):x===null||x===32||x===40||wf(x)?n(x):(e.consume(x),x===92?v:g)}function v(x){return x===40||x===41||x===92?(e.consume(x),g):g(x)}}function n5(e,t,n,s,r,i){const o=this;let a=0,c;return u;function u(f){return e.enter(s),e.enter(r),e.consume(f),e.exit(r),e.enter(i),d}function d(f){return a>999||f===null||f===91||f===93&&!c||f===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(f):f===93?(e.exit(i),e.enter(r),e.consume(f),e.exit(r),e.exit(s),t):xe(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(f))}function h(f){return f===null||f===91||f===93||xe(f)||a++>999?(e.exit("chunkString"),d(f)):(e.consume(f),c||(c=!Me(f)),f===92?p:h)}function p(f){return f===91||f===92||f===93?(e.consume(f),a++,h):h(f)}}function s5(e,t,n,s,r,i){let o;return a;function a(p){return p===34||p===39||p===40?(e.enter(s),e.enter(r),e.consume(p),e.exit(r),o=p===40?41:p,c):n(p)}function c(p){return p===o?(e.enter(r),e.consume(p),e.exit(r),e.exit(s),t):(e.enter(i),u(p))}function u(p){return p===o?(e.exit(i),c(o)):p===null?n(p):xe(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Be(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===o||p===null||xe(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?h:d)}function h(p){return p===o||p===92?(e.consume(p),d):d(p)}}function Lc(e,t){let n;return s;function s(r){return xe(r)?(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),n=!0,s):Me(r)?Be(e,s,n?"linePrefix":"lineSuffix")(r):t(r)}}const d$={name:"definition",tokenize:f$},h$={partial:!0,tokenize:p$};function f$(e,t,n){const s=this;let r;return i;function i(f){return e.enter("definition"),o(f)}function o(f){return n5.call(s,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return r=Us(s.sliceSerialize(s.events[s.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 Qe(f)?Lc(e,u)(f):u(f)}function u(f){return t5(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function d(f){return e.attempt(h$,h,h)(f)}function h(f){return Me(f)?Be(e,p,"whitespace")(f):p(f)}function p(f){return f===null||xe(f)?(e.exit("definition"),s.parser.defined.push(r),t(f)):n(f)}}function p$(e,t,n){return s;function s(a){return Qe(a)?Lc(e,r)(a):n(a)}function r(a){return s5(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return Me(a)?Be(e,o,"whitespace")(a):o(a)}function o(a){return a===null||xe(a)?t(a):n(a)}}const m$={name:"hardBreakEscape",tokenize:g$};function g$(e,t,n){return s;function s(i){return e.enter("hardBreakEscape"),e.consume(i),r}function r(i){return xe(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const x$={name:"headingAtx",resolve:v$,tokenize:y$};function v$(e,t){let n=e.length-2,s=3,r,i;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(r={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},i={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},us(e,s,n-s+1,[["enter",r,t],["enter",i,t],["exit",i,t],["exit",r,t]])),e}function y$(e,t,n){let s=0;return r;function r(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&s++<6?(e.consume(d),o):d===null||Qe(d)?(e.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||xe(d)?(e.exit("atxHeading"),t(d)):Me(d)?Be(e,a,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),a(d))}function u(d){return d===null||d===35||Qe(d)?(e.exit("atxHeadingText"),a(d)):(e.consume(d),u)}}const _$=["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"],O1=["pre","script","style","textarea"],b$={concrete:!0,name:"htmlFlow",resolveTo:k$,tokenize:C$},w$={partial:!0,tokenize:j$},S$={partial:!0,tokenize:N$};function k$(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 C$(e,t,n){const s=this;let r,i,o,a,c;return u;function u(N){return d(N)}function d(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),h}function h(N){return N===33?(e.consume(N),p):N===47?(e.consume(N),i=!0,g):N===63?(e.consume(N),r=3,s.interrupt?t:k):Ln(N)?(e.consume(N),o=String.fromCharCode(N),v):n(N)}function p(N){return N===45?(e.consume(N),r=2,f):N===91?(e.consume(N),r=5,a=0,m):Ln(N)?(e.consume(N),r=4,s.interrupt?t:k):n(N)}function f(N){return N===45?(e.consume(N),s.interrupt?t:k):n(N)}function m(N){const z="CDATA[";return N===z.charCodeAt(a++)?(e.consume(N),a===z.length?s.interrupt?t:A:m):n(N)}function g(N){return Ln(N)?(e.consume(N),o=String.fromCharCode(N),v):n(N)}function v(N){if(N===null||N===47||N===62||Qe(N)){const z=N===47,U=o.toLowerCase();return!z&&!i&&O1.includes(U)?(r=1,s.interrupt?t(N):A(N)):_$.includes(o.toLowerCase())?(r=6,z?(e.consume(N),x):s.interrupt?t(N):A(N)):(r=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(N):i?_(N):b(N))}return N===45||Sn(N)?(e.consume(N),o+=String.fromCharCode(N),v):n(N)}function x(N){return N===62?(e.consume(N),s.interrupt?t:A):n(N)}function _(N){return Me(N)?(e.consume(N),_):R(N)}function b(N){return N===47?(e.consume(N),R):N===58||N===95||Ln(N)?(e.consume(N),S):Me(N)?(e.consume(N),b):R(N)}function S(N){return N===45||N===46||N===58||N===95||Sn(N)?(e.consume(N),S):C(N)}function C(N){return N===61?(e.consume(N),w):Me(N)?(e.consume(N),C):b(N)}function w(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),c=N,j):Me(N)?(e.consume(N),w):T(N)}function j(N){return N===c?(e.consume(N),c=null,F):N===null||xe(N)?n(N):(e.consume(N),j)}function T(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||Qe(N)?C(N):(e.consume(N),T)}function F(N){return N===47||N===62||Me(N)?b(N):n(N)}function R(N){return N===62?(e.consume(N),B):n(N)}function B(N){return N===null||xe(N)?A(N):Me(N)?(e.consume(N),B):n(N)}function A(N){return N===45&&r===2?(e.consume(N),$):N===60&&r===1?(e.consume(N),W):N===62&&r===4?(e.consume(N),I):N===63&&r===3?(e.consume(N),k):N===93&&r===5?(e.consume(N),H):xe(N)&&(r===6||r===7)?(e.exit("htmlFlowData"),e.check(w$,M,D)(N)):N===null||xe(N)?(e.exit("htmlFlowData"),D(N)):(e.consume(N),A)}function D(N){return e.check(S$,P,M)(N)}function P(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),E}function E(N){return N===null||xe(N)?D(N):(e.enter("htmlFlowData"),A(N))}function $(N){return N===45?(e.consume(N),k):A(N)}function W(N){return N===47?(e.consume(N),o="",O):A(N)}function O(N){if(N===62){const z=o.toLowerCase();return O1.includes(z)?(e.consume(N),I):A(N)}return Ln(N)&&o.length<8?(e.consume(N),o+=String.fromCharCode(N),O):A(N)}function H(N){return N===93?(e.consume(N),k):A(N)}function k(N){return N===62?(e.consume(N),I):N===45&&r===2?(e.consume(N),k):A(N)}function I(N){return N===null||xe(N)?(e.exit("htmlFlowData"),M(N)):(e.consume(N),I)}function M(N){return e.exit("htmlFlow"),t(N)}}function N$(e,t,n){const s=this;return r;function r(o){return xe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return s.parser.lazy[s.now().line]?n(o):t(o)}}function j$(e,t,n){return s;function s(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(Uu,t,n)}}const E$={name:"htmlText",tokenize:P$};function P$(e,t,n){const s=this;let r,i,o;return a;function a(k){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(k),c}function c(k){return k===33?(e.consume(k),u):k===47?(e.consume(k),C):k===63?(e.consume(k),b):Ln(k)?(e.consume(k),T):n(k)}function u(k){return k===45?(e.consume(k),d):k===91?(e.consume(k),i=0,m):Ln(k)?(e.consume(k),_):n(k)}function d(k){return k===45?(e.consume(k),f):n(k)}function h(k){return k===null?n(k):k===45?(e.consume(k),p):xe(k)?(o=h,W(k)):(e.consume(k),h)}function p(k){return k===45?(e.consume(k),f):h(k)}function f(k){return k===62?$(k):k===45?p(k):h(k)}function m(k){const I="CDATA[";return k===I.charCodeAt(i++)?(e.consume(k),i===I.length?g:m):n(k)}function g(k){return k===null?n(k):k===93?(e.consume(k),v):xe(k)?(o=g,W(k)):(e.consume(k),g)}function v(k){return k===93?(e.consume(k),x):g(k)}function x(k){return k===62?$(k):k===93?(e.consume(k),x):g(k)}function _(k){return k===null||k===62?$(k):xe(k)?(o=_,W(k)):(e.consume(k),_)}function b(k){return k===null?n(k):k===63?(e.consume(k),S):xe(k)?(o=b,W(k)):(e.consume(k),b)}function S(k){return k===62?$(k):b(k)}function C(k){return Ln(k)?(e.consume(k),w):n(k)}function w(k){return k===45||Sn(k)?(e.consume(k),w):j(k)}function j(k){return xe(k)?(o=j,W(k)):Me(k)?(e.consume(k),j):$(k)}function T(k){return k===45||Sn(k)?(e.consume(k),T):k===47||k===62||Qe(k)?F(k):n(k)}function F(k){return k===47?(e.consume(k),$):k===58||k===95||Ln(k)?(e.consume(k),R):xe(k)?(o=F,W(k)):Me(k)?(e.consume(k),F):$(k)}function R(k){return k===45||k===46||k===58||k===95||Sn(k)?(e.consume(k),R):B(k)}function B(k){return k===61?(e.consume(k),A):xe(k)?(o=B,W(k)):Me(k)?(e.consume(k),B):F(k)}function A(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),r=k,D):xe(k)?(o=A,W(k)):Me(k)?(e.consume(k),A):(e.consume(k),P)}function D(k){return k===r?(e.consume(k),r=void 0,E):k===null?n(k):xe(k)?(o=D,W(k)):(e.consume(k),D)}function P(k){return k===null||k===34||k===39||k===60||k===61||k===96?n(k):k===47||k===62||Qe(k)?F(k):(e.consume(k),P)}function E(k){return k===47||k===62||Qe(k)?F(k):n(k)}function $(k){return k===62?(e.consume(k),e.exit("htmlTextData"),e.exit("htmlText"),t):n(k)}function W(k){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),O}function O(k){return Me(k)?Be(e,H,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):H(k)}function H(k){return e.enter("htmlTextData"),o(k)}}const z0={name:"labelEnd",resolveAll:M$,resolveTo:L$,tokenize:A$},T$={tokenize:O$},R$={tokenize:I$},D$={tokenize:F$};function M$(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const r=s.type==="labelImage"?4:2;s.type="data",t+=r}}return e.length!==n.length&&us(e,0,e.length,n),e}function L$(e,t){let n=e.length,s=0,r,i,o,a;for(;n--;)if(r=e[n][1],i){if(r.type==="link"||r.type==="labelLink"&&r._inactive)break;e[n][0]==="enter"&&r.type==="labelLink"&&(r._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(r.type==="labelImage"||r.type==="labelLink")&&!r._balanced&&(i=n,r.type!=="labelLink")){s=2;break}}else r.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}},d={type:"labelText",start:{...e[i+s+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",c,t],["enter",u,t]],a=ks(a,e.slice(i+1,i+s+3)),a=ks(a,[["enter",d,t]]),a=ks(a,gp(t.parser.constructs.insideSpan.null,e.slice(i+s+4,o-3),t)),a=ks(a,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),a=ks(a,e.slice(o+1)),a=ks(a,[["exit",c,t]]),us(e,i,e.length,a),e}function A$(e,t,n){const s=this;let r=s.events.length,i,o;for(;r--;)if((s.events[r][1].type==="labelImage"||s.events[r][1].type==="labelLink")&&!s.events[r][1]._balanced){i=s.events[r][1];break}return a;function a(p){return i?i._inactive?h(p):(o=s.parser.defined.includes(Us(s.sliceSerialize({start:i.end,end:s.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(T$,d,o?d:h)(p):p===91?e.attempt(R$,d,o?u:h)(p):o?d(p):h(p)}function u(p){return e.attempt(D$,d,h)(p)}function d(p){return t(p)}function h(p){return i._balanced=!0,n(p)}}function O$(e,t,n){return s;function s(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),r}function r(h){return Qe(h)?Lc(e,i)(h):i(h)}function i(h){return h===41?d(h):t5(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return Qe(h)?Lc(e,c)(h):d(h)}function a(h){return n(h)}function c(h){return h===34||h===39||h===40?s5(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return Qe(h)?Lc(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function I$(e,t,n){const s=this;return r;function r(a){return n5.call(s,e,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return s.parser.defined.includes(Us(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function F$(e,t,n){return s;function s(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),r}function r(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const B$={name:"labelStartImage",resolveAll:z0.resolveAll,tokenize:z$};function z$(e,t,n){const s=this;return r;function r(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),i}function i(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(a):t(a)}}const $$={name:"labelStartLink",resolveAll:z0.resolveAll,tokenize:H$};function H$(e,t,n){const s=this;return r;function r(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 s.parser.constructs?n(o):t(o)}}const Mm={name:"lineEnding",tokenize:W$};function W$(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Be(e,t,"linePrefix")}}const kh={name:"thematicBreak",tokenize:U$};function U$(e,t,n){let s=0,r;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return r=u,a(u)}function a(u){return u===r?(e.enter("thematicBreakSequence"),c(u)):s>=3&&(u===null||xe(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===r?(e.consume(u),s++,c):(e.exit("thematicBreakSequence"),Me(u)?Be(e,a,"whitespace")(u):a(u))}}const Wn={continuation:{tokenize:Y$},exit:Q$,name:"list",tokenize:V$},q$={partial:!0,tokenize:G$},K$={partial:!0,tokenize:X$};function V$(e,t,n){const s=this,r=s.events[s.events.length-1];let i=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,o=0;return a;function a(f){const m=s.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!s.containerState.marker||f===s.containerState.marker:kv(f)){if(s.containerState.type||(s.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(kh,n,u)(f):u(f);if(!s.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(f)}return n(f)}function c(f){return kv(f)&&++o<10?(e.consume(f),c):(!s.interrupt||o<2)&&(s.containerState.marker?f===s.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"),s.containerState.marker=s.containerState.marker||f,e.check(Uu,s.interrupt?n:d,e.attempt(q$,p,h))}function d(f){return s.containerState.initialBlankLine=!0,i++,p(f)}function h(f){return Me(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),p):n(f)}function p(f){return s.containerState.size=i+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function Y$(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(Uu,r,i);function r(a){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Be(e,t,"listItemIndent",s.containerState.size+1)(a)}function i(a){return s.containerState.furtherBlankLines||!Me(a)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,o(a)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(K$,t,o)(a))}function o(a){return s.containerState._closeFlow=!0,s.interrupt=void 0,Be(e,e.attempt(Wn,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function X$(e,t,n){const s=this;return Be(e,r,"listItemIndent",s.containerState.size+1);function r(i){const o=s.events[s.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===s.containerState.size?t(i):n(i)}}function Q$(e){e.exit(this.containerState.type)}function G$(e,t,n){const s=this;return Be(e,r,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function r(i){const o=s.events[s.events.length-1];return!Me(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const I1={name:"setextUnderline",resolveTo:J$,tokenize:Z$};function J$(e,t){let n=e.length,s,r,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(r=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[s][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",o,t]),e.splice(i+1,0,["exit",e[s][1],t]),e[s][1].end={...e[i][1].end}):e[s][1]=o,e.push(["exit",o,t]),e}function Z$(e,t,n){const s=this;let r;return i;function i(u){let d=s.events.length,h;for(;d--;)if(s.events[d][1].type!=="lineEnding"&&s.events[d][1].type!=="linePrefix"&&s.events[d][1].type!=="content"){h=s.events[d][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||h)?(e.enter("setextHeadingLine"),r=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===r?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),Me(u)?Be(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||xe(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const e8={tokenize:t8};function t8(e){const t=this,n=e.attempt(Uu,s,e.attempt(this.parser.constructs.flowInitial,r,Be(e,e.attempt(this.parser.constructs.flow,r,e.attempt(o$,r)),"linePrefix")));return n;function s(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function r(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const n8={resolveAll:i5()},s8=r5("string"),r8=r5("text");function r5(e){return{resolveAll:i5(e==="text"?i8:void 0),tokenize:t};function t(n){const s=this,r=this.parser.constructs[e],i=n.attempt(r,o,a);return o;function o(d){return u(d)?i(d):a(d)}function a(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const h=r[d];let p=-1;if(h)for(;++p<h.length;){const f=h[p];if(!f.previous||f.previous.call(s,s.previous))return!0}return!1}}}function i5(e){return t;function t(n,s){let r=-1,i;for(;++r<=n.length;)i===void 0?n[r]&&n[r][1].type==="data"&&(i=r,r++):(!n[r]||n[r][1].type!=="data")&&(r!==i+2&&(n[i][1].end=n[r-1][1].end,n.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(n,s):n}}function i8(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 s=e[n-1][1],r=t.sliceStream(s);let i=r.length,o=-1,a=0,c;for(;i--;){const u=r[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(u===-2)c=!0,a++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const u={type:n===e.length||c||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:s.start._bufferIndex+o,_index:s.start._index+i,line:s.end.line,column:s.end.column-a,offset:s.end.offset-a},end:{...s.end}};s.end={...u.start},s.start.offset===s.end.offset?Object.assign(s,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const o8={42:Wn,43:Wn,45:Wn,48:Wn,49:Wn,50:Wn,51:Wn,52:Wn,53:Wn,54:Wn,55:Wn,56:Wn,57:Wn,62:GE},a8={91:d$},l8={[-2]:Dm,[-1]:Dm,32:Dm},c8={35:x$,42:kh,45:[I1,kh],60:b$,61:I1,95:kh,96:A1,126:A1},u8={38:ZE,92:JE},d8={[-5]:Mm,[-4]:Mm,[-3]:Mm,33:B$,38:ZE,42:Cv,60:[$z,E$],91:$$,92:[m$,JE],93:z0,95:Cv,96:e$},h8={null:[Cv,n8]},f8={null:[42,95]},p8={null:[]},m8=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:f8,contentInitial:a8,disable:p8,document:o8,flow:c8,flowInitial:l8,insideSpan:h8,string:u8,text:d8},Symbol.toStringTag,{value:"Module"}));function g8(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const r={},i=[];let o=[],a=[];const c={attempt:j(C),check:j(w),consume:_,enter:b,exit:S,interrupt:j(w,{interrupt:!0})},u={code:null,containerState:{},defineSkip:g,events:[],now:m,parser:e,previous:null,sliceSerialize:p,sliceStream:f,write:h};let d=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function h(B){return o=ks(o,B),v(),o[o.length-1]!==null?[]:(T(t,0),u.events=gp(i,u.events,u),u.events)}function p(B,A){return v8(f(B),A)}function f(B){return x8(o,B)}function m(){const{_bufferIndex:B,_index:A,line:D,column:P,offset:E}=s;return{_bufferIndex:B,_index:A,line:D,column:P,offset:E}}function g(B){r[B.line]=B.column,R()}function v(){let B;for(;s._index<o.length;){const A=o[s._index];if(typeof A=="string")for(B=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===B&&s._bufferIndex<A.length;)x(A.charCodeAt(s._bufferIndex));else x(A)}}function x(B){d=d(B)}function _(B){xe(B)?(s.line++,s.column=1,s.offset+=B===-3?2:1,R()):B!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===o[s._index].length&&(s._bufferIndex=-1,s._index++)),u.previous=B}function b(B,A){const D=A||{};return D.type=B,D.start=m(),u.events.push(["enter",D,u]),a.push(D),D}function S(B){const A=a.pop();return A.end=m(),u.events.push(["exit",A,u]),A}function C(B,A){T(B,A.from)}function w(B,A){A.restore()}function j(B,A){return D;function D(P,E,$){let W,O,H,k;return Array.isArray(P)?M(P):"tokenize"in P?M([P]):I(P);function I(K){return Q;function Q(Y){const Z=Y!==null&&K[Y],ue=Y!==null&&K.null,Oe=[...Array.isArray(Z)?Z:Z?[Z]:[],...Array.isArray(ue)?ue:ue?[ue]:[]];return M(Oe)(Y)}}function M(K){return W=K,O=0,K.length===0?$:N(K[O])}function N(K){return Q;function Q(Y){return k=F(),H=K,K.partial||(u.currentConstruct=K),K.name&&u.parser.constructs.disable.null.includes(K.name)?U():K.tokenize.call(A?Object.assign(Object.create(u),A):u,c,z,U)(Y)}}function z(K){return B(H,k),E}function U(K){return k.restore(),++O<W.length?N(W[O]):$}}}function T(B,A){B.resolveAll&&!i.includes(B)&&i.push(B),B.resolve&&us(u.events,A,u.events.length-A,B.resolve(u.events.slice(A),u)),B.resolveTo&&(u.events=B.resolveTo(u.events,u))}function F(){const B=m(),A=u.previous,D=u.currentConstruct,P=u.events.length,E=Array.from(a);return{from:P,restore:$};function $(){s=B,u.previous=A,u.currentConstruct=D,u.events.length=P,a=E,R()}}function R(){s.line in r&&s.column<2&&(s.column=r[s.line],s.offset+=r[s.line]-1)}}function x8(e,t){const n=t.start._index,s=t.start._bufferIndex,r=t.end._index,i=t.end._bufferIndex;let o;if(n===r)o=[e[n].slice(s,i)];else{if(o=e.slice(n,r),s>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(s):o.shift()}i>0&&o.push(e[r].slice(0,i))}return o}function v8(e,t){let n=-1;const s=[];let r;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=`
|
|
554
|
+
`;break}case-3:{o=`\r
|
|
555
|
+
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&r)continue;o=" ";break}default:o=String.fromCharCode(i)}r=i===-2,s.push(o)}return s.join("")}function y8(e){const s={constructs:XE([m8,...(e||{}).extensions||[]]),content:r(Lz),defined:[],document:r(Oz),flow:r(e8),lazy:{},string:r(s8),text:r(r8)};return s;function r(i){return o;function o(a){return g8(s,i,a)}}}function _8(e){for(;!e5(e););return e}const F1=/[\0\t\n\r]/g;function b8(){let e=1,t="",n=!0,s;return r;function r(i,o,a){const c=[];let u,d,h,p,f;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(F1.lastIndex=h,u=F1.exec(i),p=u&&u.index!==void 0?u.index:i.length,f=i.charCodeAt(p),!u){t=i.slice(h);break}if(f===10&&h===p&&s)c.push(-3),s=void 0;else switch(s&&(c.push(-5),s=void 0),h<p&&(c.push(i.slice(h,p)),e+=p-h),f){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:s=!0,e=1}h=p+1}return a&&(s&&c.push(-5),t&&c.push(t),c.push(null)),c}}const w8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function S8(e){return e.replace(w8,k8)}function k8(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const r=n.charCodeAt(1),i=r===120||r===88;return QE(n.slice(i?2:1),i?16:10)}return B0(n)||e}const o5={}.hasOwnProperty;function C8(e,t,n){return typeof t!="string"&&(n=t,t=void 0),N8(n)(_8(y8(n).document().write(b8()(e,t,!0))))}function N8(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ee),autolinkProtocol:F,autolinkEmail:F,atxHeading:i(Ut),blockQuote:i(ue),characterEscape:F,characterReference:F,codeFenced:i(Oe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(Oe,o),codeText:i(Re,o),codeTextData:F,data:F,codeFlowValue:F,definition:i(fe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(Ie),hardBreakEscape:i(sn),hardBreakTrailing:i(sn),htmlFlow:i(se,o),htmlFlowData:F,htmlText:i(se,o),htmlTextData:F,image:i(de),label:o,link:i(Ee),listItem:i(Ue),listItemValue:p,listOrdered:i(We,h),listUnordered:i(We),paragraph:i(wt),reference:N,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(Ut),strong:i(ft),thematicBreak:i(Sr)},exit:{atxHeading:c(),atxHeadingSequence:C,autolink:c(),autolinkEmail:Z,autolinkProtocol:Y,blockQuote:c(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:U,characterReferenceMarkerNumeric:U,characterReferenceValue:K,characterReference:Q,codeFenced:c(v),codeFencedFence:g,codeFencedFenceInfo:f,codeFencedFenceMeta:m,codeFlowValue:R,codeIndented:c(x),codeText:c(E),codeTextData:R,data:R,definition:c(),definitionDestinationString:S,definitionLabelString:_,definitionTitleString:b,emphasis:c(),hardBreakEscape:c(A),hardBreakTrailing:c(A),htmlFlow:c(D),htmlFlowData:R,htmlText:c(P),htmlTextData:R,image:c(W),label:H,labelText:O,lineEnding:B,link:c($),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:z,resourceDestinationString:k,resourceTitleString:I,resource:M,setextHeading:c(T),setextHeadingLineSequence:j,setextHeadingText:w,strong:c(),thematicBreak:c()}};a5(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(q){let ee={type:"root",children:[]};const ge={stack:[ee],tokenStack:[],config:t,enter:a,exit:u,buffer:o,resume:d,data:n},ye=[];let ke=-1;for(;++ke<q.length;)if(q[ke][1].type==="listOrdered"||q[ke][1].type==="listUnordered")if(q[ke][0]==="enter")ye.push(ke);else{const it=ye.pop();ke=r(q,it,ke)}for(ke=-1;++ke<q.length;){const it=t[q[ke][0]];o5.call(it,q[ke][1].type)&&it[q[ke][1].type].call(Object.assign({sliceSerialize:q[ke][2].sliceSerialize},ge),q[ke][1])}if(ge.tokenStack.length>0){const it=ge.tokenStack[ge.tokenStack.length-1];(it[1]||B1).call(ge,void 0,it[0])}for(ee.position={start:ii(q.length>0?q[0][1].start:{line:1,column:1,offset:0}),end:ii(q.length>0?q[q.length-2][1].end:{line:1,column:1,offset:0})},ke=-1;++ke<t.transforms.length;)ee=t.transforms[ke](ee)||ee;return ee}function r(q,ee,ge){let ye=ee-1,ke=-1,it=!1,rn,qt,on,En;for(;++ye<=ge;){const Ge=q[ye];switch(Ge[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ge[0]==="enter"?ke++:ke--,En=void 0;break}case"lineEndingBlank":{Ge[0]==="enter"&&(rn&&!En&&!ke&&!on&&(on=ye),En=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:En=void 0}if(!ke&&Ge[0]==="enter"&&Ge[1].type==="listItemPrefix"||ke===-1&&Ge[0]==="exit"&&(Ge[1].type==="listUnordered"||Ge[1].type==="listOrdered")){if(rn){let ts=ye;for(qt=void 0;ts--;){const an=q[ts];if(an[1].type==="lineEnding"||an[1].type==="lineEndingBlank"){if(an[0]==="exit")continue;qt&&(q[qt][1].type="lineEndingBlank",it=!0),an[1].type="lineEnding",qt=ts}else if(!(an[1].type==="linePrefix"||an[1].type==="blockQuotePrefix"||an[1].type==="blockQuotePrefixWhitespace"||an[1].type==="blockQuoteMarker"||an[1].type==="listItemIndent"))break}on&&(!qt||on<qt)&&(rn._spread=!0),rn.end=Object.assign({},qt?q[qt][1].start:Ge[1].end),q.splice(qt||ye,0,["exit",rn,Ge[2]]),ye++,ge++}if(Ge[1].type==="listItemPrefix"){const ts={type:"listItem",_spread:!1,start:Object.assign({},Ge[1].start),end:void 0};rn=ts,q.splice(ye,0,["enter",ts,Ge[2]]),ye++,ge++,on=void 0,En=!0}}}return q[ee][1]._spread=it,ge}function i(q,ee){return ge;function ge(ye){a.call(this,q(ye),ye),ee&&ee.call(this,ye)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(q,ee,ge){this.stack[this.stack.length-1].children.push(q),this.stack.push(q),this.tokenStack.push([ee,ge||void 0]),q.position={start:ii(ee.start),end:void 0}}function c(q){return ee;function ee(ge){q&&q.call(this,ge),u.call(this,ge)}}function u(q,ee){const ge=this.stack.pop(),ye=this.tokenStack.pop();if(ye)ye[0].type!==q.type&&(ee?ee.call(this,q,ye[0]):(ye[1]||B1).call(this,q,ye[0]));else throw new Error("Cannot close `"+q.type+"` ("+Mc({start:q.start,end:q.end})+"): it’s not open");ge.position.end=ii(q.end)}function d(){return F0(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function p(q){if(this.data.expectingFirstListItemValue){const ee=this.stack[this.stack.length-2];ee.start=Number.parseInt(this.sliceSerialize(q),10),this.data.expectingFirstListItemValue=void 0}}function f(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.lang=q}function m(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.meta=q}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.value=q.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.value=q.replace(/(\r?\n|\r)$/g,"")}function _(q){const ee=this.resume(),ge=this.stack[this.stack.length-1];ge.label=ee,ge.identifier=Us(this.sliceSerialize(q)).toLowerCase()}function b(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.title=q}function S(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.url=q}function C(q){const ee=this.stack[this.stack.length-1];if(!ee.depth){const ge=this.sliceSerialize(q).length;ee.depth=ge}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function j(q){const ee=this.stack[this.stack.length-1];ee.depth=this.sliceSerialize(q).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function F(q){const ge=this.stack[this.stack.length-1].children;let ye=ge[ge.length-1];(!ye||ye.type!=="text")&&(ye=pn(),ye.position={start:ii(q.start),end:void 0},ge.push(ye)),this.stack.push(ye)}function R(q){const ee=this.stack.pop();ee.value+=this.sliceSerialize(q),ee.position.end=ii(q.end)}function B(q){const ee=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ge=ee.children[ee.children.length-1];ge.position.end=ii(q.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ee.type)&&(F.call(this,q),R.call(this,q))}function A(){this.data.atHardBreak=!0}function D(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.value=q}function P(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.value=q}function E(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.value=q}function $(){const q=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";q.type+="Reference",q.referenceType=ee,delete q.url,delete q.title}else delete q.identifier,delete q.label;this.data.referenceType=void 0}function W(){const q=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";q.type+="Reference",q.referenceType=ee,delete q.url,delete q.title}else delete q.identifier,delete q.label;this.data.referenceType=void 0}function O(q){const ee=this.sliceSerialize(q),ge=this.stack[this.stack.length-2];ge.label=S8(ee),ge.identifier=Us(ee).toLowerCase()}function H(){const q=this.stack[this.stack.length-1],ee=this.resume(),ge=this.stack[this.stack.length-1];if(this.data.inReference=!0,ge.type==="link"){const ye=q.children;ge.children=ye}else ge.alt=ee}function k(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.url=q}function I(){const q=this.resume(),ee=this.stack[this.stack.length-1];ee.title=q}function M(){this.data.inReference=void 0}function N(){this.data.referenceType="collapsed"}function z(q){const ee=this.resume(),ge=this.stack[this.stack.length-1];ge.label=ee,ge.identifier=Us(this.sliceSerialize(q)).toLowerCase(),this.data.referenceType="full"}function U(q){this.data.characterReferenceType=q.type}function K(q){const ee=this.sliceSerialize(q),ge=this.data.characterReferenceType;let ye;ge?(ye=QE(ee,ge==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ye=B0(ee);const ke=this.stack[this.stack.length-1];ke.value+=ye}function Q(q){const ee=this.stack.pop();ee.position.end=ii(q.end)}function Y(q){R.call(this,q);const ee=this.stack[this.stack.length-1];ee.url=this.sliceSerialize(q)}function Z(q){R.call(this,q);const ee=this.stack[this.stack.length-1];ee.url="mailto:"+this.sliceSerialize(q)}function ue(){return{type:"blockquote",children:[]}}function Oe(){return{type:"code",lang:null,meta:null,value:""}}function Re(){return{type:"inlineCode",value:""}}function fe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ie(){return{type:"emphasis",children:[]}}function Ut(){return{type:"heading",depth:0,children:[]}}function sn(){return{type:"break"}}function se(){return{type:"html",value:""}}function de(){return{type:"image",title:null,url:"",alt:null}}function Ee(){return{type:"link",title:null,url:"",children:[]}}function We(q){return{type:"list",ordered:q.type==="listOrdered",start:null,spread:q._spread,children:[]}}function Ue(q){return{type:"listItem",spread:q._spread,checked:null,children:[]}}function wt(){return{type:"paragraph",children:[]}}function ft(){return{type:"strong",children:[]}}function pn(){return{type:"text",value:""}}function Sr(){return{type:"thematicBreak"}}}function ii(e){return{line:e.line,column:e.column,offset:e.offset}}function a5(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?a5(e,s):j8(e,s)}}function j8(e,t){let n;for(n in t)if(o5.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function B1(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Mc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Mc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Mc({start:t.start,end:t.end})+") is still open")}function E8(e){const t=this;t.parser=n;function n(s){return C8(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function P8(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 T8(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
556
|
+
`}]}function R8(e,t){const n=t.value?t.value+`
|
|
557
|
+
`:"",s={},r=t.lang?t.lang.split(/\s+/):[];r.length>0&&(s.className=["language-"+r[0]]);let i={type:"element",tagName:"code",properties:s,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 D8(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function M8(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function L8(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),r=jl(s.toLowerCase()),i=e.footnoteOrder.indexOf(s);let o,a=e.footnoteCounts.get(s);a===void 0?(a=0,e.footnoteOrder.push(s),o=e.footnoteOrder.length):o=i+1,a+=1,e.footnoteCounts.set(s,a);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+r,id:n+"fnref-"+r+(a>1?"-"+a:""),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 A8(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 O8(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function l5(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const r=e.all(t),i=r[0];i&&i.type==="text"?i.value="["+i.value:r.unshift({type:"text",value:"["});const o=r[r.length-1];return o&&o.type==="text"?o.value+=s:r.push({type:"text",value:s}),r}function I8(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return l5(e,t);const r={src:jl(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(r.title=s.title);const i={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,i),e.applyData(t,i)}function F8(e,t){const n={src:jl(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 s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function B8(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function z8(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return l5(e,t);const r={href:jl(s.url||"")};s.title!==null&&s.title!==void 0&&(r.title=s.title);const i={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function $8(e,t){const n={href:jl(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function H8(e,t,n){const s=e.all(t),r=n?W8(n):c5(t),i={},o=[];if(typeof t.checked=="boolean"){const d=s[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},s.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let a=-1;for(;++a<s.length;){const d=s[a];(r||a!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
|
|
558
|
+
`}),d.type==="element"&&d.tagName==="p"&&!r?o.push(...d.children):o.push(d)}const c=s[s.length-1];c&&(r||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
|
|
559
|
+
`});const u={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,u),e.applyData(t,u)}function W8(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s<n.length;)t=c5(n[s])}return t}function c5(e){const t=e.spread;return t??e.children.length>1}function U8(e,t){const n={},s=e.all(t);let r=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++r<s.length;){const o=s[r];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(s,!0)};return e.patch(t,i),e.applyData(t,i)}function q8(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function K8(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function V8(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Y8(e,t){const n=e.all(t),s=n.shift(),r=[];if(s){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],o),r.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=L0(t.children[1]),c=HE(t.children[t.children.length-1]);a&&c&&(o.position={start:a,end:c}),r.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function X8(e,t,n){const s=n?n.children:void 0,i=(s?s.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:t.children.length;let c=-1;const u=[];for(;++c<a;){const h=t.children[c],p={},f=o?o[c]:void 0;f&&(p.align=f);let m={type:"element",tagName:i,properties:p,children:[]};h&&(m.children=e.all(h),e.patch(h,m),m=e.applyData(h,m)),u.push(m)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function Q8(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const z1=9,$1=32;function G8(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),r=0;const i=[];for(;s;)i.push(H1(t.slice(r,s.index),r>0,!0),s[0]),r=s.index+s[0].length,s=n.exec(t);return i.push(H1(t.slice(r),r>0,!1)),i.join("")}function H1(e,t,n){let s=0,r=e.length;if(t){let i=e.codePointAt(s);for(;i===z1||i===$1;)s++,i=e.codePointAt(s)}if(n){let i=e.codePointAt(r-1);for(;i===z1||i===$1;)r--,i=e.codePointAt(r-1)}return r>s?e.slice(s,r):""}function J8(e,t){const n={type:"text",value:G8(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Z8(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const e9={blockquote:P8,break:T8,code:R8,delete:D8,emphasis:M8,footnoteReference:L8,heading:A8,html:O8,imageReference:I8,image:F8,inlineCode:B8,linkReference:z8,link:$8,listItem:H8,list:U8,paragraph:q8,root:K8,strong:V8,table:Y8,tableCell:Q8,tableRow:X8,text:J8,thematicBreak:Z8,toml:Ed,yaml:Ed,definition:Ed,footnoteDefinition:Ed};function Ed(){}const u5=-1,xp=0,Ac=1,Sf=2,$0=3,H0=4,W0=5,U0=6,d5=7,h5=8,W1=typeof self=="object"?self:globalThis,t9=(e,t)=>{const n=(r,i)=>(e.set(i,r),r),s=r=>{if(e.has(r))return e.get(r);const[i,o]=t[r];switch(i){case xp:case u5:return n(o,r);case Ac:{const a=n([],r);for(const c of o)a.push(s(c));return a}case Sf:{const a=n({},r);for(const[c,u]of o)a[s(c)]=s(u);return a}case $0:return n(new Date(o),r);case H0:{const{source:a,flags:c}=o;return n(new RegExp(a,c),r)}case W0:{const a=n(new Map,r);for(const[c,u]of o)a.set(s(c),s(u));return a}case U0:{const a=n(new Set,r);for(const c of o)a.add(s(c));return a}case d5:{const{name:a,message:c}=o;return n(new W1[a](c),r)}case h5:return n(BigInt(o),r);case"BigInt":return n(Object(BigInt(o)),r);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new W1[i](o),r)};return s},U1=e=>t9(new Map,e)(0),da="",{toString:n9}={},{keys:s9}=Object,Ql=e=>{const t=typeof e;if(t!=="object"||!e)return[xp,t];const n=n9.call(e).slice(8,-1);switch(n){case"Array":return[Ac,da];case"Object":return[Sf,da];case"Date":return[$0,da];case"RegExp":return[H0,da];case"Map":return[W0,da];case"Set":return[U0,da];case"DataView":return[Ac,n]}return n.includes("Array")?[Ac,n]:n.includes("Error")?[d5,n]:[Sf,n]},Pd=([e,t])=>e===xp&&(t==="function"||t==="symbol"),r9=(e,t,n,s)=>{const r=(o,a)=>{const c=s.push(o)-1;return n.set(a,c),c},i=o=>{if(n.has(o))return n.get(o);let[a,c]=Ql(o);switch(a){case xp:{let d=o;switch(c){case"bigint":a=h5,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return r([u5],o)}return r([a,d],o)}case Ac:{if(c){let p=o;return c==="DataView"?p=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(o)),r([c,[...p]],o)}const d=[],h=r([a,d],o);for(const p of o)d.push(i(p));return h}case Sf:{if(c)switch(c){case"BigInt":return r([c,o.toString()],o);case"Boolean":case"Number":case"String":return r([c,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const d=[],h=r([a,d],o);for(const p of s9(o))(e||!Pd(Ql(o[p])))&&d.push([i(p),i(o[p])]);return h}case $0:return r([a,o.toISOString()],o);case H0:{const{source:d,flags:h}=o;return r([a,{source:d,flags:h}],o)}case W0:{const d=[],h=r([a,d],o);for(const[p,f]of o)(e||!(Pd(Ql(p))||Pd(Ql(f))))&&d.push([i(p),i(f)]);return h}case U0:{const d=[],h=r([a,d],o);for(const p of o)(e||!Pd(Ql(p)))&&d.push(i(p));return h}}const{message:u}=o;return r([a,{name:c,message:u}],o)};return i},q1=(e,{json:t,lossy:n}={})=>{const s=[];return r9(!(t||n),!!t,new Map,s)(e),s},kf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?U1(q1(e,t)):structuredClone(e):(e,t)=>U1(q1(e,t));function i9(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 o9(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function a9(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||i9,s=e.options.footnoteBackLabel||o9,r=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),h=String(u.identifier).toUpperCase(),p=jl(h.toLowerCase());let f=0;const m=[],g=e.footnoteCounts.get(h);for(;g!==void 0&&++f<=g;){m.length>0&&m.push({type:"text",value:" "});let _=typeof n=="string"?n:n(c,f);typeof _=="string"&&(_={type:"text",value:_}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(c,f),className:["data-footnote-backref"]},children:Array.isArray(_)?_:[_]})}const v=d[d.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const _=v.children[v.children.length-1];_&&_.type==="text"?_.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...m)}else d.push(...m);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(d,!0)};e.patch(u,x),a.push(x)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...kf(o),id:"footnote-label"},children:[{type:"text",value:r}]},{type:"text",value:`
|
|
560
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
|
|
561
|
+
`}]}}const vp=function(e){if(e==null)return d9;if(typeof e=="function")return yp(e);if(typeof e=="object")return Array.isArray(e)?l9(e):c9(e);if(typeof e=="string")return u9(e);throw new Error("Expected function, string, or object as test")};function l9(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=vp(e[n]);return yp(s);function s(...r){let i=-1;for(;++i<t.length;)if(t[i].apply(this,r))return!0;return!1}}function c9(e){const t=e;return yp(n);function n(s){const r=s;let i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function u9(e){return yp(t);function t(n){return n&&n.type===e}}function yp(e){return t;function t(n,s,r){return!!(h9(n)&&e.call(this,n,typeof s=="number"?s:void 0,r||void 0))}}function d9(){return!0}function h9(e){return e!==null&&typeof e=="object"&&"type"in e}const f5=[],f9=!0,Nv=!1,p9="skip";function p5(e,t,n,s){let r;typeof t=="function"&&typeof n!="function"?(s=n,n=t):r=t;const i=vp(r),o=s?-1:1;a(e,void 0,[])();function a(c,u,d){const h=c&&typeof c=="object"?c:{};if(typeof h.type=="string"){const f=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=f5,m,g,v;if((!t||i(c,u,d[d.length-1]||void 0))&&(f=m9(n(c,d)),f[0]===Nv))return f;if("children"in c&&c.children){const x=c;if(x.children&&f[0]!==p9)for(g=(s?x.children.length:-1)+o,v=d.concat(x);g>-1&&g<x.children.length;){const _=x.children[g];if(m=a(_,g,v)(),m[0]===Nv)return m;g=typeof m[1]=="number"?m[1]:g+o}}return f}}}function m9(e){return Array.isArray(e)?e:typeof e=="number"?[f9,e]:e==null?f5:[e]}function q0(e,t,n,s){let r,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,r=n):(i=t,o=n,r=s),p5(e,i,a,r);function a(c,u){const d=u[u.length-1],h=d?d.children.indexOf(c):void 0;return o(c,h,d)}}const jv={}.hasOwnProperty,g9={};function x9(e,t){const n=t||g9,s=new Map,r=new Map,i=new Map,o={...e9,...n.handlers},a={all:u,applyData:y9,definitionById:s,footnoteById:r,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:n,patch:v9,wrap:b9};return q0(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?s:r,p=String(d.identifier).toUpperCase();h.has(p)||h.set(p,d)}}),a;function c(d,h){const p=d.type,f=a.handlers[p];if(jv.call(a.handlers,p)&&f)return f(a,d,h);if(a.options.passThrough&&a.options.passThrough.includes(p)){if("children"in d){const{children:g,...v}=d,x=kf(v);return x.children=a.all(d),x}return kf(d)}return(a.options.unknownHandler||_9)(a,d,h)}function u(d){const h=[];if("children"in d){const p=d.children;let f=-1;for(;++f<p.length;){const m=a.one(p[f],d);if(m){if(f&&p[f-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=K1(m.value)),!Array.isArray(m)&&m.type==="element")){const g=m.children[0];g&&g.type==="text"&&(g.value=K1(g.value))}Array.isArray(m)?h.push(...m):h.push(m)}}}return h}}function v9(e,t){e.position&&(t.position=oz(e))}function y9(e,t){let n=t;if(e&&e.data){const s=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const o="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,kf(i)),"children"in n&&n.children&&r!==null&&r!==void 0&&(n.children=r)}return n}function _9(e,t){const n=t.data||{},s="value"in t&&!(jv.call(n,"hProperties")||jv.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function b9(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
|
|
562
|
+
`});++s<e.length;)s&&n.push({type:"text",value:`
|
|
563
|
+
`}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
564
|
+
`}),n}function K1(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function V1(e,t){const n=x9(e,t),s=n.one(e,void 0),r=a9(n),i=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return r&&i.children.push({type:"text",value:`
|
|
565
|
+
`},r),i}function w9(e,t){return e&&"run"in e?async function(n,s){const r=V1(n,{file:s,...t});await e.run(r,s)}:function(n,s){return V1(n,{file:s,...e||t})}}function Y1(e){if(e)throw e}var Ch=Object.prototype.hasOwnProperty,m5=Object.prototype.toString,X1=Object.defineProperty,Q1=Object.getOwnPropertyDescriptor,G1=function(t){return typeof Array.isArray=="function"?Array.isArray(t):m5.call(t)==="[object Array]"},J1=function(t){if(!t||m5.call(t)!=="[object Object]")return!1;var n=Ch.call(t,"constructor"),s=t.constructor&&t.constructor.prototype&&Ch.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!s)return!1;var r;for(r in t);return typeof r>"u"||Ch.call(t,r)},Z1=function(t,n){X1&&n.name==="__proto__"?X1(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},eS=function(t,n){if(n==="__proto__")if(Ch.call(t,n)){if(Q1)return Q1(t,n).value}else return;return t[n]},S9=function e(){var t,n,s,r,i,o,a=arguments[0],c=1,u=arguments.length,d=!1;for(typeof a=="boolean"&&(d=a,a=arguments[1]||{},c=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)s=eS(a,n),r=eS(t,n),a!==r&&(d&&r&&(J1(r)||(i=G1(r)))?(i?(i=!1,o=s&&G1(s)?s:[]):o=s&&J1(s)?s:{},Z1(a,{name:n,newValue:e(d,o,r)})):typeof r<"u"&&Z1(a,{name:n,newValue:r}));return a};const Lm=ml(S9);function Ev(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 k9(){const e=[],t={run:n,use:s};return t;function n(...r){let i=-1;const o=r.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...r);function a(c,...u){const d=e[++i];let h=-1;if(c){o(c);return}for(;++h<r.length;)(u[h]===null||u[h]===void 0)&&(u[h]=r[h]);r=u,d?C9(d,a)(...u):o(null,...u)}}function s(r){if(typeof r!="function")throw new TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),t}}function C9(e,t){let n;return s;function s(...o){const a=e.length>o.length;let c;a&&o.push(r);try{c=e.apply(this,o)}catch(u){const d=u;if(a&&n)throw d;return r(d)}a||(c&&c.then&&typeof c.then=="function"?c.then(i,r):c instanceof Error?r(c):i(c))}function r(o,...a){n||(n=!0,t(o,...a))}function i(o){r(null,o)}}const tr={basename:N9,dirname:j9,extname:E9,join:P9,sep:"/"};function N9(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');qu(e);let n=0,s=-1,r=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;r--;)if(e.codePointAt(r)===47){if(i){n=r+1;break}}else s<0&&(i=!0,s=r+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let o=-1,a=t.length-1;for(;r--;)if(e.codePointAt(r)===47){if(i){n=r+1;break}}else o<0&&(i=!0,o=r+1),a>-1&&(e.codePointAt(r)===t.codePointAt(a--)?a<0&&(s=r):(a=-1,s=o));return n===s?s=o:s<0&&(s=e.length),e.slice(n,s)}function j9(e){if(qu(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function E9(e){qu(e);let t=e.length,n=-1,s=0,r=-1,i=0,o;for(;t--;){const a=e.codePointAt(t);if(a===47){if(o){s=t+1;break}continue}n<0&&(o=!0,n=t+1),a===46?r<0?r=t:i!==1&&(i=1):r>-1&&(i=-1)}return r<0||n<0||i===0||i===1&&r===n-1&&r===s+1?"":e.slice(r,n)}function P9(...e){let t=-1,n;for(;++t<e.length;)qu(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":T9(n)}function T9(e){qu(e);const t=e.codePointAt(0)===47;let n=R9(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function R9(e,t){let n="",s=0,r=-1,i=0,o=-1,a,c;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(r===o-1||i===1))if(r!==o-1&&i===2){if(n.length<2||s!==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="",s=0):(n=n.slice(0,c),s=n.length-1-n.lastIndexOf("/")),r=o,i=0;continue}}else if(n.length>0){n="",s=0,r=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(r+1,o):n=e.slice(r+1,o),s=o-r-1;r=o,i=0}else a===46&&i>-1?i++:i=-1}return n}function qu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const D9={cwd:M9};function M9(){return"/"}function Pv(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function L9(e){if(typeof e=="string")e=new URL(e);else if(!Pv(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 A9(e)}function A9(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const r=new TypeError("File URL path must not include encoded / characters");throw r.code="ERR_INVALID_FILE_URL_PATH",r}}return decodeURIComponent(t)}const Am=["history","path","basename","stem","extname","dirname"];class g5{constructor(t){let n;t?Pv(t)?n={path:t}:typeof t=="string"||O9(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":D9.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Am.length;){const i=Am[s];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let r;for(r in n)Am.includes(r)||(this[r]=n[r])}get basename(){return typeof this.path=="string"?tr.basename(this.path):void 0}set basename(t){Im(t,"basename"),Om(t,"basename"),this.path=tr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?tr.dirname(this.path):void 0}set dirname(t){tS(this.basename,"dirname"),this.path=tr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?tr.extname(this.path):void 0}set extname(t){if(Om(t,"extname"),tS(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=tr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Pv(t)&&(t=L9(t)),Im(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?tr.basename(this.path,this.extname):void 0}set stem(t){Im(t,"stem"),Om(t,"stem"),this.path=tr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const r=this.message(t,n,s);throw r.fatal=!0,r}info(t,n,s){const r=this.message(t,n,s);return r.fatal=void 0,r}message(t,n,s){const r=new jn(t,n,s);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Om(e,t){if(e&&e.includes(tr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+tr.sep+"`")}function Im(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function tS(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function O9(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const I9=function(e){const s=this.constructor.prototype,r=s[e],i=function(){return r.apply(i,arguments)};return Object.setPrototypeOf(i,s),i},F9={}.hasOwnProperty;class K0 extends I9{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=k9()}copy(){const t=new K0;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(Lm(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(zm("data",this.frozen),this.namespace[t]=n,this):F9.call(this.namespace,t)&&this.namespace[t]||void 0:t?(zm("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,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const r=n.call(t,...s);typeof r=="function"&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Td(t),s=this.parser||this.Parser;return Fm("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),Fm("process",this.parser||this.Parser),Bm("process",this.compiler||this.Compiler),n?r(void 0,n):new Promise(r);function r(i,o){const a=Td(t),c=s.parse(a);s.run(c,a,function(d,h,p){if(d||!h||!p)return u(d);const f=h,m=s.stringify(f,p);$9(m)?p.value=m:p.result=m,u(d,p)});function u(d,h){d||!h?o(d):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,s;return this.freeze(),Fm("processSync",this.parser||this.Parser),Bm("processSync",this.compiler||this.Compiler),this.process(t,r),sS("processSync","process",n),s;function r(i,o){n=!0,Y1(i),s=o}}run(t,n,s){nS(t),this.freeze();const r=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?i(void 0,s):new Promise(i);function i(o,a){const c=Td(n);r.run(t,c,u);function u(d,h,p){const f=h||t;d?a(d):o?o(f):s(void 0,f,p)}}}runSync(t,n){let s=!1,r;return this.run(t,n,i),sS("runSync","run",s),r;function i(o,a){Y1(o),r=a,s=!0}}stringify(t,n){this.freeze();const s=Td(n),r=this.compiler||this.Compiler;return Bm("stringify",r),nS(t),r(t,s)}use(t,...n){const s=this.attachers,r=this.namespace;if(zm("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?a(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[d,...h]=u;c(d,h)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(u.plugins),u.settings&&(r.settings=Lm(!0,r.settings,u.settings))}function a(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];i(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let h=-1,p=-1;for(;++h<s.length;)if(s[h][0]===u){p=h;break}if(p===-1)s.push([u,...d]);else if(d.length>0){let[f,...m]=d;const g=s[p][1];Ev(g)&&Ev(f)&&(f=Lm(!0,g,f)),s[p]=[u,f,...m]}}}}const B9=new K0().freeze();function Fm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Bm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function zm(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 nS(e){if(!Ev(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function sS(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Td(e){return z9(e)?e:new g5(e)}function z9(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function $9(e){return typeof e=="string"||H9(e)}function H9(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const W9="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",rS=[],iS={allowDangerousHtml:!0},U9=/^(https?|ircs?|mailto|xmpp)$/i,q9=[{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 Tv(e){const t=K9(e),n=V9(e);return Y9(t.runSync(t.parse(n),n),e)}function K9(e){const t=e.rehypePlugins||rS,n=e.remarkPlugins||rS,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...iS}:iS;return B9().use(E8).use(n).use(w9,s).use(t)}function V9(e){const t=e.children||"",n=new g5;return typeof t=="string"&&(n.value=t),n}function Y9(e,t){const n=t.allowedElements,s=t.allowElement,r=t.components,i=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,c=t.urlTransform||X9;for(const d of q9)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+W9+d.id,void 0);return q0(e,u),dz(e,{Fragment:l.Fragment,components:r,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function u(d,h,p){if(d.type==="raw"&&p&&typeof h=="number")return o?p.children.splice(h,1):p.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let f;for(f in Rm)if(Object.hasOwn(Rm,f)&&Object.hasOwn(d.properties,f)){const m=d.properties[f],g=Rm[f];(g===null||g.includes(d.tagName))&&(d.properties[f]=c(String(m||""),f,d))}}if(d.type==="element"){let f=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!f&&s&&typeof h=="number"&&(f=!s(d,h,p)),f&&p&&typeof h=="number")return a&&d.children?p.children.splice(h,1,...d.children):p.children.splice(h,1),h}}}function X9(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),r=e.indexOf("/");return t===-1||r!==-1&&t>r||n!==-1&&t>n||s!==-1&&t>s||U9.test(e.slice(0,t))?e:""}function Nh(e){const t=Date.now(),n=new Date(e).getTime(),s=t-n;if(s<0)return"just now";const r=Math.floor(s/1e3);if(r<60)return"just now";const i=Math.floor(r/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 Rd(e,t=30){return Date.now()-new Date(e).getTime()>t*60*1e3}function Q9(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 Gl(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 Dd(e){return e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function Md(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 G9(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 J9(e){try{const t=await fetch(`/api/mission-control/planning/${e}`);return t.ok&&(await t.json()).prd||null}catch{return null}}function Z9({history:e}){const[t,n]=y.useState(!1),s=[...e].reverse();return l.jsxs("div",{className:"mt-2 border-t border-border/30 pt-1.5",children:[l.jsxs("button",{onClick:()=>n(!t),className:"flex items-center gap-1 text-[10px] text-content-muted hover:text-content-subtle",children:[l.jsx("span",{children:t?"▾":"▸"}),l.jsxs("span",{children:["History (",e.length,")"]})]}),t&&l.jsx("div",{className:"mt-1 space-y-0.5",children:s.map((r,i)=>l.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[l.jsx("span",{className:"text-content-muted w-12 shrink-0",children:Nh(r.timestamp)}),l.jsx("span",{className:r.type==="review"?"text-blue-400":r.type==="test"?"text-purple-400":"text-green-400",children:r.type}),l.jsx("span",{className:r.status==="passed"?"text-green-400":r.status==="failed"||r.status==="blocked"?"text-red-400":["reviewing","testing","merging"].includes(r.status)?"text-yellow-400":"text-content-muted",children:r.status}),r.notes&&l.jsxs("span",{className:"text-content-muted truncate",title:r.notes,children:["— ",r.notes.slice(0,60),r.notes.length>60?"...":""]})]},i))})]})}function eH({agent:e,issueId:t,issueUrl:n,issue:s,onClose:r}){var En,Ge,ts,an,to;const i=Lt(),o=yr(),[a,c]=y.useState(""),[u,d]=y.useState(!1),[h,p]=y.useState("logs"),f=y.useRef(null),m=y.useRef(null),[g,v]=y.useState(!0),x=e?`tmux attach -t ${e.id}`:"",[_,b]=y.useState(!1),[S,C]=y.useState(!1),{data:w,refetch:j}=he({queryKey:["agent-output",e==null?void 0:e.id],queryFn:()=>G9(e.id),refetchInterval:(e==null?void 0:e.status)==="stopped"?!1:1e3,enabled:!!e}),[T,F]=y.useState(!1),[R,B]=y.useState(!1),[A,D]=y.useState(0),{data:P}=he({queryKey:["workspace",t],queryFn:async()=>{const X=await fetch(`/api/workspaces/${t}`);if(!X.ok)throw new Error("Failed to fetch workspace info");const ae=await X.json();if(ae.exists&&T&&F(!1),R&&ae.containers){const De=Object.values(ae.containers),He=De.every(Se=>Se.running),pe=Date.now()-A>2e4,_e=De.some(Se=>{var tt;return(tt=Se.status)==null?void 0:tt.startsWith("exited")});(He||pe&&_e)&&B(!1)}return ae},refetchInterval:T||R?2e3:5e3}),{data:E}=he({queryKey:["review-status",t],queryFn:async()=>{const X=await fetch(`/api/workspaces/${t}/review-status`);if(!X.ok)throw new Error("Failed to fetch review status");return X.json()},refetchInterval:3e4}),{data:$}=he({queryKey:["prd",t],queryFn:()=>J9(t),staleTime:6e4}),{data:W}=he({queryKey:["issueCosts",t],queryFn:async()=>{const X=await fetch(`/api/issues/${t}/costs`);if(!X.ok)throw new Error("Failed to fetch costs");return X.json()},refetchInterval:3e4,staleTime:1e4}),O=we({mutationFn:async()=>{var ae;const X=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:t,projectId:(ae=s==null?void 0:s.project)==null?void 0:ae.id})});if(!X.ok)throw new Error("Failed to start agent");return X.json()},onSuccess:()=>{setTimeout(()=>{i.invalidateQueries({queryKey:["agents"]})},2e3)}}),H=we({mutationFn:async()=>{var ae;const X=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issueId:t,projectId:(ae=s==null?void 0:s.project)==null?void 0:ae.id})});if(!X.ok)throw new Error("Failed to create workspace");return X.json()},onSuccess:()=>{F(!0),i.invalidateQueries({queryKey:["workspace",t]})}}),k=we({mutationFn:async()=>{const X=await fetch(`/api/workspaces/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!X.ok){const ae=await X.json();throw new Error(ae.error||"Failed to start containers")}return X.json()},onSuccess:()=>{B(!0),D(Date.now()),setTimeout(()=>{i.invalidateQueries({queryKey:["workspace",t]})},5e3),setTimeout(()=>B(!1),9e4)}}),[I,M]=y.useState(null);y.useEffect(()=>{const X=()=>M(null);if(I)return document.addEventListener("click",X),()=>document.removeEventListener("click",X)},[I]);const N=we({mutationFn:async({containerName:X,action:ae})=>{const De=await fetch(`/api/workspaces/${t}/containers/${X}/${ae}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!De.ok){const He=await De.json();throw new Error(He.error||`Failed to ${ae} container`)}return De.json()},onSuccess:()=>{M(null),setTimeout(()=>{i.invalidateQueries({queryKey:["workspace",t]})},2e3)}}),z=(X,ae,De)=>{X.preventDefault(),M({x:X.clientX,y:X.clientY,containerName:ae,isRunning:De})},U=we({mutationFn:async()=>{const X=await fetch(`/api/workspaces/${t}/containerize`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!X.ok){const ae=await X.json();throw new Error(ae.error||"Failed to containerize workspace")}return X.json()},onSuccess:()=>{setTimeout(()=>{i.invalidateQueries({queryKey:["workspace",t]})},3e3)}}),K=we({mutationFn:async()=>{const X=await fetch(`/api/workspaces/${t}/review`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!X.ok){const ae=await X.json();throw new Error(ae.error||"Failed to start review")}return X.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["review-status",t]})}}),Q=we({mutationFn:async()=>{const X=await fetch(`/api/workspaces/${t}/merge`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!X.ok){const ae=await X.json();throw new Error(ae.error||"Failed to merge")}return X.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["agents"]}),i.invalidateQueries({queryKey:["issues"]}),i.invalidateQueries({queryKey:["review-status",t]}),r()}}),Y=we({mutationFn:async()=>{const X=await fetch(`/api/issues/${t}/close`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Closed manually"})});if(!X.ok){const ae=await X.json();throw new Error(ae.error||"Failed to close issue")}return X.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["agents"]}),i.invalidateQueries({queryKey:["issues"]}),r()}}),Z=we({mutationFn:async X=>{const ae=await fetch(`/api/issues/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:X})});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"]})}}),ue=we({mutationFn:async()=>{const X=await fetch(`/api/workspaces/${t}/reset-review`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!X.ok){const ae=await X.json();throw new Error(ae.error||"Failed to reset review cycles")}return X.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["review-status",t]}),i.invalidateQueries({queryKey:["issues"]})}}),Oe=we({mutationFn:async()=>{const X=await fetch(`/api/workspaces/${t}/pending`,{method:"DELETE"});if(!X.ok)throw new Error("Failed to dismiss");return X.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]})}}),Re=we({mutationFn:async()=>{const X=await fetch(`/api/workspaces/${t}/clean`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!X.ok){const ae=await X.json();throw new Error(ae.error||"Failed to clean workspace")}return X.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["agents"]})}}),fe=we({mutationFn:async()=>{const X=await fetch(`/api/workspaces/${t}/sync-main`,{method:"POST",headers:{"Content-Type":"application/json"}}),ae=await X.json();if(!X.ok)throw new Error(ae.error||"Sync failed");return ae},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]}),i.invalidateQueries({queryKey:["agents"]})}}),Ie=async()=>{await o({title:"Sync Main",message:`Sync main into ${t}?
|
|
566
|
+
|
|
567
|
+
This will:
|
|
568
|
+
- Auto-commit any uncommitted changes
|
|
569
|
+
- Fetch and merge the latest main into the feature branch
|
|
570
|
+
- Use the merge agent to resolve any conflicts`,confirmLabel:"Sync"})&&fe.mutate()},Ut=we({mutationFn:async()=>{const X=await fetch(`/api/workspaces/${t}/refresh-db`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!X.ok){const ae=await X.json();throw new Error(ae.error||"Failed to refresh database")}return X.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["workspace",t]})}}),sn=async()=>{await o({title:"Clean Workspace",message:`Clean and recreate corrupted workspace for ${t}?
|
|
571
|
+
|
|
572
|
+
This will:
|
|
573
|
+
- Remove the corrupted workspace directory
|
|
574
|
+
- Create a fresh workspace`,variant:"destructive",confirmLabel:"Clean & Recreate"})&&Re.mutate()},se=()=>{k.mutate()},de=()=>{U.mutate()},Ee=async()=>{const X=(E==null?void 0:E.readyForMerge)||(E==null?void 0:E.reviewStatus)==="passed"||(E==null?void 0:E.testStatus)==="passed",ae=X?`Re-run review & test pipeline for ${t}?
|
|
575
|
+
|
|
576
|
+
This will reset the current status and:
|
|
577
|
+
- Run strict code review (review-agent)
|
|
578
|
+
- Run tests (test-agent)
|
|
579
|
+
|
|
580
|
+
MERGE button will appear when both pass.`:`Start review & test pipeline for ${t}?
|
|
581
|
+
|
|
582
|
+
This will:
|
|
583
|
+
- Run strict code review (review-agent)
|
|
584
|
+
- Run tests (test-agent)
|
|
585
|
+
|
|
586
|
+
MERGE button will appear when both pass.`;await o({title:X?"Re-run Review":"Start Review",message:ae,confirmLabel:X?"Re-run":"Start Review"})&&K.mutate()},We=async()=>{await o({title:"Merge to Main",message:`Merge ${t} to main?
|
|
587
|
+
|
|
588
|
+
Review and tests have passed. This will:
|
|
589
|
+
- Merge the feature branch to main
|
|
590
|
+
- Run final verification tests
|
|
591
|
+
- Clean up workspace`,confirmLabel:"Merge"})&&Q.mutate()},Ue=async()=>{await o({title:"Close Without Merging",message:`Close ${t} without merging? This will:
|
|
592
|
+
- Close the issue (no merge)
|
|
593
|
+
- Stop any running agent
|
|
594
|
+
- Remove the workspace
|
|
595
|
+
(Feature branch is preserved for history)`,variant:"destructive",confirmLabel:"Close"})&&Y.mutate()},wt=()=>{const X=prompt(`Reopen ${t} for re-work?
|
|
596
|
+
|
|
597
|
+
This will:
|
|
598
|
+
- Move the issue to "In Progress"
|
|
599
|
+
- Reset review/test/merge status to pending
|
|
600
|
+
- Remove any queued specialist tasks
|
|
601
|
+
- Append a "Reopened" section to STATE.md
|
|
602
|
+
|
|
603
|
+
Optional: enter a reason (or leave blank):`,"");X!==null&&Z.mutate(X||void 0)},ft=async()=>{await o({title:"Reset Review Cycles",message:`Reset all review/test/merge cycles for ${t}?
|
|
604
|
+
|
|
605
|
+
This will:
|
|
606
|
+
- Clear review, test, and merge status
|
|
607
|
+
- Reset the circuit breaker counter
|
|
608
|
+
- Remove queued specialist tasks
|
|
609
|
+
|
|
610
|
+
The agent can then request review when ready.
|
|
611
|
+
Tracker status will NOT change.`,confirmLabel:"Reset Cycles"})&&ue.mutate()},pn=we({mutationFn:async X=>{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:X})})).ok)throw new Error("Failed to send")},onSuccess:()=>{c(""),setTimeout(()=>j(),500)}}),Sr=we({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"]}),r()}}),q=y.useCallback(()=>{Q9(x),d(!0),setTimeout(()=>d(!1),2e3)},[x]);y.useEffect(()=>{g&&m.current&&m.current.scrollIntoView({behavior:"auto"})},[w,g]);const ee=y.useCallback(()=>{if(f.current){const{scrollTop:X,scrollHeight:ae,clientHeight:De}=f.current,He=ae-X-De<50;v(He)}},[]),ge=()=>{a.trim()&&pn.mutate(a.trim())},ye=async()=>{e&&await o({title:"Kill Agent",message:`Kill agent ${e.id}?`,variant:"destructive",confirmLabel:"Kill"})&&Sr.mutate()},ke=e?new Date(e.startedAt):null,it=ke?Date.now()-ke.getTime():0,rn=Math.floor(it/6e4),qt=Math.floor(rn/60),on=qt>0?`${qt}h ${rn%60}m`:`${rn}m`;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex h-full bg-surface-raised border-l border-divider","data-testid":"workspace-panel",children:[l.jsxs("div",{className:"w-64 border-r border-divider flex flex-col overflow-y-auto","data-testid":"workspace-sidebar",children:[l.jsxs("div",{className:"px-3 py-2 border-b border-divider",children:[e?l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("div",{className:"flex gap-0.5",children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"0ms"}}),l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"150ms"}}),l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse",style:{animationDelay:"300ms"}})]}),l.jsx("span",{className:"text-xs text-content-subtle",children:e.status==="stopped"?"Agent Stopped":"Agent Running"})]}):l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-content-muted"}),l.jsx("span",{className:"text-xs text-content-subtle",children:"No Agent"})]}),l.jsx("h2",{className:"font-mono text-sm text-content font-medium mt-1",children:t.toUpperCase()}),s&&l.jsx("p",{className:"text-xs text-content-subtle mt-1 line-clamp-2",title:s.title,children:s.title})]}),s&&l.jsx("div",{className:"px-3 py-2 border-b border-divider text-xs",children:l.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[l.jsx("span",{className:"px-1.5 py-0.5 bg-surface-overlay text-content rounded text-[10px]",children:s.status}),s.priority>0&&l.jsx("span",{className:`text-[10px] ${s.priority===1?"text-red-400":s.priority===2?"text-orange-400":s.priority===3?"text-yellow-400":"text-blue-400"}`,children:s.priority===1?"Urgent":s.priority===2?"High":s.priority===3?"Medium":"Low"}),s.labels.slice(0,3).map(X=>l.jsx("span",{className:"px-1.5 py-0.5 bg-surface-overlay text-content-muted rounded text-[10px]",children:X},X))]})}),e&&l.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[l.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Agent"}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-content-subtle",children:"Model"}),l.jsx("span",{className:"text-content",children:Md(e.model)})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-content-subtle",children:"Runtime"}),l.jsx("span",{className:"text-content",children:e.runtime})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-content-subtle",children:"Uptime"}),l.jsx("span",{className:"text-content",children:on})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-content-subtle",children:"Session"}),l.jsx("span",{className:"text-content font-mono text-[10px]",children:e.id})]})]})]}),(e==null?void 0:e.git)&&l.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs","data-testid":"git-status",children:[l.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Git Status"}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 text-content",children:[l.jsx(JN,{className:"w-3 h-3"}),l.jsx("span",{className:"font-mono flex-1",children:e.git.branch}),l.jsxs("button",{onClick:Ie,disabled:fe.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:[fe.isPending?l.jsx(be,{className:"w-2.5 h-2.5 animate-spin"}):l.jsx(Ex,{className:"w-2.5 h-2.5"}),"Sync"]})]}),e.git.uncommittedFiles>0&&l.jsxs("div",{className:"text-yellow-400 text-[10px] ml-4",children:[e.git.uncommittedFiles," uncommitted files"]}),l.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)&&l.jsx("div",{className:"px-3 py-2 border-b border-divider text-xs",children:l.jsxs("div",{className:"flex items-center gap-1.5 text-content-subtle",children:[l.jsx(jx,{className:"w-3 h-3"}),l.jsx("span",{className:"font-mono truncate text-[10px]",title:e.workspace,children:e.workspace})]})}),!e&&(P==null?void 0:P.exists)&&P.path&&l.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[l.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Workspace"}),l.jsxs("div",{className:"flex items-center gap-1.5 text-content-subtle",children:[l.jsx(jx,{className:"w-3 h-3"}),l.jsx("span",{className:"font-mono truncate text-[10px]",title:P.path,children:P.path})]}),P.location&&l.jsxs("span",{className:`mt-1.5 inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${P.location==="remote"?"bg-cyan-900/50 text-cyan-400":"bg-surface-overlay text-content-subtle"}`,children:[P.location==="remote"?l.jsx(Cx,{className:"w-3 h-3"}):l.jsx(Px,{className:"w-3 h-3"}),P.location]})]}),l.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[l.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Links"}),l.jsxs("div",{className:"space-y-1.5",children:[n&&l.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[l.jsx(gr,{className:"w-3 h-3"}),l.jsx("span",{children:t.toUpperCase().startsWith("PAN-")?"GitHub Issue":"Linear Issue"})]}),$&&l.jsxs("button",{onClick:()=>b(!0),className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[l.jsx(qo,{className:"w-3 h-3"}),l.jsx("span",{children:"PRD"})]}),l.jsxs("button",{onClick:()=>C(!0),className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[l.jsx(tj,{className:"w-3 h-3"}),l.jsx("span",{children:"Beads Tasks"})]})]})]}),W&&(W.totalCost>0||(((En=W.sessions)==null?void 0:En.length)??0)>0)&&l.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[l.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Cost"}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-content-subtle",children:"Total"}),l.jsx("span",{className:"text-green-400 font-medium",children:Gl(W.totalCost)})]}),W.totalTokens>0&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-content-subtle",children:"Tokens"}),l.jsx("span",{className:"text-content",children:Dd(W.totalTokens)})]}),Object.keys(W.byModel).length>0&&l.jsx("div",{className:"border-t border-divider pt-1.5 mt-1.5",children:Object.entries(W.byModel).sort(([,X],[,ae])=>ae.cost-X.cost).map(([X,ae])=>l.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[l.jsx("span",{className:"text-content-subtle truncate",title:X,children:Md(X)}),l.jsx("span",{className:"text-content-body",children:Gl(ae.cost)})]},X))})]})]}),(P==null?void 0:P.corrupted)&&l.jsxs("div",{className:"px-3 py-2 border-b border-divider",children:[l.jsxs("div",{className:"flex items-center gap-2 text-yellow-500 mb-2",children:[l.jsx(kn,{className:"w-4 h-4"}),l.jsx("span",{className:"text-xs font-medium",children:"Workspace Corrupted"}),P.location&&l.jsxs("span",{className:`flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${P.location==="remote"?"bg-cyan-900/50 text-cyan-400":"bg-surface-overlay text-content-subtle"}`,title:P.location==="remote"?"Running on remote VM (exe.dev)":"Running locally",children:[P.location==="remote"?l.jsx(Cx,{className:"w-3 h-3"}):l.jsx(Px,{className:"w-3 h-3"}),P.location]})]}),l.jsx("p",{className:"text-xs text-content-subtle mb-2",children:P.message||"The workspace exists but is not a valid git worktree."}),l.jsx("button",{onClick:sn,disabled:Re.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:Re.isPending?l.jsxs(l.Fragment,{children:[l.jsx(be,{className:"w-3 h-3 animate-spin"}),"Cleaning..."]}):l.jsxs(l.Fragment,{children:[l.jsx(Ar,{className:"w-3 h-3"}),"Clean & Recreate"]})}),Re.isError&&l.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 clean workspace"}),Re.isSuccess&&l.jsx("div",{className:"text-xs text-green-400 bg-green-900/20 px-2 py-1 rounded mt-2",children:"Workspace cleaned! Recreating..."})]}),(P==null?void 0:P.hasDocker)&&((P==null?void 0:P.frontendUrl)||(P==null?void 0:P.apiUrl))&&l.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[l.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Services"}),l.jsxs("div",{className:"space-y-1.5",children:[P.frontendUrl&&l.jsxs("a",{href:P.frontendUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[l.jsx(Ub,{className:"w-3 h-3"}),l.jsx("span",{children:"Frontend"})]}),P.apiUrl&&l.jsxs("a",{href:P.apiUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-blue-400 hover:text-blue-300",children:[l.jsx(Ub,{className:"w-3 h-3"}),l.jsx("span",{children:"API"})]})]})]}),(P==null?void 0:P.hasDocker)&&P.containers&&Object.values(P.containers).some(X=>!X.running)&&l.jsxs("div",{className:"px-3 py-2 border-b border-divider",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs text-yellow-500",children:R?"Starting containers...":"Some containers stopped"}),l.jsx("button",{onClick:se,disabled:k.isPending||R,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:k.isPending||R?l.jsxs(l.Fragment,{children:[l.jsx(be,{className:"w-3 h-3 animate-spin"}),"Starting..."]}):l.jsxs(l.Fragment,{children:[l.jsx(Qn,{className:"w-3 h-3"}),"Start Containers"]})})]}),k.isError&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:k.error instanceof Error?k.error.message:"Failed to start containers"})]}),(P==null?void 0:P.exists)&&!P.hasDocker&&l.jsxs("div",{className:"px-3 py-2 border-b border-divider",children:[l.jsx("div",{className:"text-content-muted uppercase tracking-wider text-xs mb-2",children:"Containers"}),P.canContainerize?l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs text-content-muted",children:"Git-only workspace"}),l.jsx("button",{onClick:de,disabled:U.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:U.isPending?l.jsxs(l.Fragment,{children:[l.jsx(be,{className:"w-3 h-3 animate-spin"}),"Setting up..."]}):l.jsxs(l.Fragment,{children:[l.jsx(Hb,{className:"w-3 h-3"}),"Containerize"]})})]}),U.isError&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded",children:U.error instanceof Error?U.error.message:"Failed to containerize workspace"})]}):l.jsxs("div",{className:"text-xs text-content-subtle bg-surface-raised px-2 py-2 rounded",children:[l.jsx("span",{className:"text-content-muted",children:"No Docker support."})," This workspace doesn't have container infrastructure set up yet."]})]}),(P==null?void 0:P.containers)&&Object.keys(P.containers).length>0&&l.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[l.jsxs("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:["Containers",l.jsx("span",{className:"text-gray-600 font-normal ml-2",children:"(right-click for options)"})]}),l.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(P.containers).map(([X,ae])=>{var pe;const De=(k.isPending||R)&&!ae.running,He=N.isPending&&(I==null?void 0:I.containerName)===X,Nt=((pe=ae.status)==null?void 0:pe.startsWith("exited"))&&!ae.running;return l.jsxs("span",{onContextMenu:_e=>z(_e,X,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":Nt?"bg-red-900/30 text-red-400 hover:bg-red-900/50":De||He?"bg-yellow-900/30 text-yellow-400 animate-pulse":"bg-surface-overlay text-content-muted hover:bg-surface-emphasis"}`,title:Nt?`Container ${ae.status} — right-click for options`:"Right-click for start/stop/restart options",children:[De||He?l.jsx(be,{className:"w-2.5 h-2.5 animate-spin"}):X==="postgres"||X==="redis"?l.jsx(Nx,{className:"w-2.5 h-2.5"}):l.jsx(Hb,{className:"w-2.5 h-2.5"}),X,ae.running&&ae.uptime&&l.jsx("span",{className:"text-content-subtle ml-1",children:ae.uptime}),Nt&&l.jsx("span",{className:"text-red-500 ml-1",children:ae.status}),(De||He)&&l.jsx("span",{className:"text-yellow-500 ml-1",children:"..."})]},X)})})]}),e&&l.jsxs("div",{className:"px-3 py-2 border-b border-divider text-xs",children:[l.jsx("div",{className:"text-content-muted uppercase tracking-wider mb-2",children:"Attach Command"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.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:[l.jsx(Vo,{className:"w-3 h-3 shrink-0 text-blue-400"}),l.jsx("span",{className:"truncate",children:x})]}),l.jsx("button",{onClick:q,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?l.jsx(Ec,{className:"w-3.5 h-3.5"}):l.jsx(YD,{className:"w-3.5 h-3.5"})})]})]}),l.jsxs("div",{className:"px-3 py-2 border-b border-divider","data-testid":"workspace-actions",children:[l.jsx("div",{className:"text-xs text-content-muted uppercase tracking-wider mb-2",children:"Actions"}),((Ge=P==null?void 0:P.pendingOperation)==null?void 0:Ge.type)==="approve"&&P.pendingOperation.status==="running"&&l.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:[l.jsx(be,{className:"w-3 h-3 animate-spin"}),l.jsx("span",{children:"Merging in progress... (survives tab switches)"})]}),((ts=P==null?void 0:P.pendingOperation)==null?void 0:ts.status)==="failed"&&l.jsxs("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1.5 rounded mb-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"font-medium",children:"Operation failed"}),l.jsx("button",{onClick:()=>Oe.mutate(),className:"text-content-subtle hover:text-content",title:"Dismiss",children:l.jsx(yt,{className:"w-3 h-3"})})]}),l.jsx("div",{className:"mt-1 text-content-subtle whitespace-pre-wrap",children:P.pendingOperation.error})]}),E&&(E.reviewStatus!=="pending"||E.testStatus!=="pending")&&l.jsxs("div",{className:`mb-2 p-2 rounded text-xs ${E.updatedAt&&Rd(E.updatedAt)?"bg-amber-900/20 border border-amber-700/30":"bg-surface/50"}`,children:[E.updatedAt&&Rd(E.updatedAt)&&l.jsxs("div",{className:"flex items-center gap-1 mb-1.5 text-amber-400 text-[10px]",children:[l.jsx(kn,{className:"w-3 h-3"}),l.jsxs("span",{children:["Status may be stale (",Nh(E.updatedAt),")"]})]}),l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx("span",{className:"text-content-subtle",children:"Review:"}),l.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"&&!Rd(E.updatedAt)&&l.jsx("span",{className:"text-content-muted text-[10px]",children:Nh(E.updatedAt)})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-content-subtle",children:"Tests:"}),l.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"&&!Rd(E.updatedAt)&&l.jsx("span",{className:"text-content-muted text-[10px]",children:Nh(E.updatedAt)})]}),(E.autoRequeueCount??0)>0&&l.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[l.jsx("span",{className:"text-content-subtle",children:"Review cycles:"}),l.jsxs("span",{className:(E.autoRequeueCount??0)>=7?"text-red-400 font-medium":"text-content-body",children:[E.autoRequeueCount,"/7"]}),(E.autoRequeueCount??0)>=7&&l.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:[l.jsx(kn,{className:"w-2.5 h-2.5"}),"Human intervention needed"]})]}),E.reviewNotes&&l.jsx("div",{className:"mt-1 text-content-subtle text-xs",children:E.reviewNotes}),E.testNotes&&l.jsx("div",{className:"mt-1 text-content-subtle text-xs",children:E.testNotes}),E.history&&E.history.length>0&&l.jsx(Z9,{history:E.history})]}),l.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[(E==null?void 0:E.readyForMerge)&&(E==null?void 0:E.mergeStatus)!=="merged"&&l.jsxs("button",{"data-testid":"merge-btn",onClick:We,disabled:Q.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:[Q.isPending||(E==null?void 0:E.mergeStatus)==="merging"?l.jsx(be,{className:"w-3 h-3 animate-spin"}):l.jsx(mr,{className:"w-3 h-3"}),(E==null?void 0:E.mergeStatus)==="merging"?"MERGING...":"MERGE"]}),(E==null?void 0:E.mergeStatus)==="merged"&&l.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:[l.jsx(mr,{className:"w-3 h-3"}),"MERGED"]}),l.jsxs("button",{"data-testid":"sync-with-main-btn",onClick:Ie,disabled:fe.isPending,title:(((an=e==null?void 0:e.git)==null?void 0:an.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:[fe.isPending?l.jsx(be,{className:"w-3 h-3 animate-spin"}):l.jsx(Ex,{className:"w-3 h-3"}),fe.isPending?"Syncing...":"Sync with Main"]}),l.jsxs("button",{"data-testid":"review-test-btn",onClick:Ee,disabled:K.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:[K.isPending||(E==null?void 0:E.reviewStatus)==="reviewing"||(E==null?void 0:E.testStatus)==="testing"?l.jsx(be,{className:"w-3 h-3 animate-spin"}):l.jsx(Ar,{className:"w-3 h-3"}),E!=null&&E.readyForMerge?"Re-Review":"Review & Test"]}),e&&e.status!=="stopped"&&l.jsxs("button",{onClick:ye,disabled:Sr.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:[l.jsx(ou,{className:"w-3 h-3"}),"Stop Agent"]}),l.jsxs("button",{onClick:Ue,disabled:Y.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:[Y.isPending?l.jsx(be,{className:"w-3 h-3 animate-spin"}):l.jsx(Kr,{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")&&l.jsxs("button",{"data-testid":"reopen-btn",onClick:wt,disabled:Z.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:[Z.isPending?l.jsx(be,{className:"w-3 h-3 animate-spin"}):l.jsx(Ar,{className:"w-3 h-3"}),Z.isPending?"Reopening...":"Reopen"]}),E&&(E.reviewStatus!=="pending"||E.testStatus!=="pending")&&l.jsxs("button",{onClick:ft,disabled:ue.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:[ue.isPending?l.jsx(be,{className:"w-3 h-3 animate-spin"}):l.jsx(Lu,{className:"w-3 h-3"}),ue.isPending?"Resetting...":"Reset Reviews"]}),(!e||e.status==="stopped")&&l.jsxs(l.Fragment,{children:[l.jsxs("button",{onClick:()=>O.mutate(),disabled:O.isPending||O.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:[O.isPending?l.jsx(be,{className:"w-3 h-3 animate-spin"}):O.isSuccess?l.jsx(Ec,{className:"w-3 h-3"}):l.jsx(Qn,{className:"w-3 h-3"}),O.isPending?"Starting...":O.isSuccess?"Started!":"Start Agent"]}),!(P!=null&&P.exists)&&l.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?l.jsx(be,{className:"w-3 h-3 animate-spin"}):l.jsx(Wb,{className:"w-3 h-3"}),H.isPending?"Creating...":H.isSuccess?"Setting up...":"Create Workspace"]})]})]}),K.isError&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:K.error instanceof Error?K.error.message:"Failed to start review"}),Q.isError&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:Q.error instanceof Error?Q.error.message:"Failed to merge"}),Y.isError&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:Y.error instanceof Error?Y.error.message:"Failed to close"}),fe.isError&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 px-2 py-1 rounded mt-2",children:fe.error instanceof Error?fe.error.message:"Sync with main failed"}),fe.isSuccess&&fe.data&&l.jsx("div",{className:"text-xs text-green-400 bg-green-900/20 px-2 py-1 rounded mt-2",children:fe.data.alreadyUpToDate?"Already up to date with main":`Synced ${fe.data.commitCount??0} commit(s) from main`})]}),l.jsx("div",{className:"flex-1"})]}),l.jsx("div",{className:"flex-1 flex flex-col min-w-0 min-h-0 overflow-hidden",children:e?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-divider",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:()=>p("logs"),className:`px-2 py-1 text-xs rounded transition-colors ${h==="logs"?"bg-surface-overlay text-content":"text-content-subtle hover:text-content"}`,children:"Logs"}),l.jsx("button",{onClick:()=>p("status"),className:`px-2 py-1 text-xs rounded transition-colors ${h==="status"?"bg-surface-overlay text-content":"text-content-subtle hover:text-content"}`,children:"Status"})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:()=>j(),className:"p-1 text-content-subtle hover:text-content",title:"Refresh",children:l.jsx(Ar,{className:"w-3.5 h-3.5"})}),l.jsx("button",{onClick:r,className:"p-1 text-content-subtle hover:text-content",children:l.jsx(yt,{className:"w-3.5 h-3.5"})})]})]}),h==="logs"?l.jsxs(l.Fragment,{children:[l.jsxs("pre",{ref:f,onScroll:ee,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:[w||(e.status==="stopped"?"No saved output available.":"Connecting to agent..."),l.jsx("div",{ref:m})]}),e.status!=="stopped"&&l.jsx("div",{className:"p-2 border-t border-divider bg-surface-raised",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:a,onChange:X=>c(X.target.value),onKeyDown:X=>X.key==="Enter"&&ge(),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"}),l.jsxs("button",{onClick:ge,disabled:!a.trim()||pn.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:[l.jsx(nj,{className:"w-4 h-4"}),"Send"]})]})})]}):l.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 bg-surface",children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-medium text-content mb-2",children:"Agent Summary"}),l.jsxs("div",{className:"text-xs text-content-body space-y-1",children:[l.jsxs("p",{children:[l.jsx("strong",{children:"Issue:"})," ",e.issueId]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Session:"})," ",l.jsx("span",{className:"font-mono text-[10px]",children:e.id})]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Model:"})," ",Md(e.model)]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Runtime:"})," ",e.runtime]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Started:"})," ",ke==null?void 0:ke.toLocaleString()]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Uptime:"})," ",on]})]})]}),e.workspace&&l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-medium text-content mb-2",children:"Workspace"}),l.jsx("div",{className:"text-xs text-content-body space-y-1",children:l.jsx("p",{className:"font-mono text-[10px] break-all",children:e.workspace})})]}),e.git&&l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-medium text-content mb-2",children:"Git Status"}),l.jsxs("div",{className:"text-xs text-content-body space-y-1",children:[l.jsxs("p",{children:[l.jsx("strong",{children:"Branch:"})," ",l.jsx("span",{className:"font-mono",children:e.git.branch})]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Uncommitted:"})," ",e.git.uncommittedFiles," files"]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Latest:"})," ",e.git.latestCommit]})]})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-medium text-content mb-2",children:"Health"}),l.jsxs("div",{className:"text-xs text-content-body space-y-1",children:[l.jsxs("p",{children:[l.jsx("strong",{children:"Status:"})," ",l.jsx("span",{className:"text-green-400",children:e.status})]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Consecutive Failures:"})," ",e.consecutiveFailures]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Total Restarts:"})," ",e.killCount]})]})]})]})})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-divider",children:[l.jsx("span",{className:"text-xs text-content-subtle",children:"Issue Details"}),l.jsx("button",{onClick:r,className:"p-1 text-content-subtle hover:text-content",children:l.jsx(yt,{className:"w-3.5 h-3.5"})})]}),l.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 bg-surface",children:[s&&l.jsx("h2",{className:"text-lg font-medium text-content mb-4",children:s.title}),s&&l.jsxs("div",{className:"space-y-3 mb-6",children:[s.assignee&&l.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[l.jsx(i0,{className:"w-4 h-4 text-content-subtle"}),l.jsx("span",{className:"text-content-body",children:s.assignee.name}),s.assignee.email&&l.jsx("span",{className:"text-content-muted text-xs",children:s.assignee.email})]}),s.labels.length>0&&l.jsxs("div",{className:"flex items-center gap-2 text-sm flex-wrap",children:[l.jsx(s0,{className:"w-4 h-4 text-content-subtle shrink-0"}),s.labels.map(X=>l.jsx("span",{className:"px-2 py-0.5 bg-surface-overlay text-content-body text-xs rounded",children:X},X))]}),l.jsxs("div",{className:"flex items-center gap-2 text-sm text-content-subtle",children:[l.jsx(UD,{className:"w-4 h-4"}),l.jsxs("span",{children:["Updated ",new Date(s.updatedAt).toLocaleDateString()]})]})]}),(s==null?void 0:s.description)&&l.jsxs("div",{className:"mb-6",children:[l.jsx("h3",{className:"text-sm font-medium text-content-subtle mb-2",children:"Description"}),l.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:l.jsx(Tv,{children:s.description})})]}),W&&(W.totalCost>0||(((to=W.sessions)==null?void 0:to.length)??0)>0)&&l.jsxs("div",{className:"mb-6",children:[l.jsxs("h3",{className:"text-sm font-medium text-content-subtle mb-2 flex items-center gap-2",children:[l.jsx(na,{className:"w-4 h-4"}),"Cost Summary"]}),l.jsxs("div",{className:"bg-surface-raised rounded p-3 space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-content-subtle",children:"Total Cost"}),l.jsx("span",{className:"text-xl font-semibold text-green-400",children:Gl(W.totalCost)})]}),W.totalTokens>0&&l.jsxs("div",{className:"flex items-center justify-between text-sm",children:[l.jsxs("span",{className:"text-content-muted flex items-center gap-1",children:[l.jsx(GN,{className:"w-3 h-3"}),"Total Tokens"]}),l.jsx("span",{className:"text-content-body",children:Dd(W.totalTokens)})]}),Object.keys(W.byModel).length>0&&l.jsxs("div",{className:"border-t border-divider pt-2",children:[l.jsx("p",{className:"text-xs text-content-muted uppercase tracking-wider mb-2",children:"By Model"}),l.jsx("div",{className:"space-y-1",children:Object.entries(W.byModel).sort(([,X],[,ae])=>ae.cost-X.cost).map(([X,ae])=>l.jsxs("div",{className:"flex items-center justify-between text-sm",children:[l.jsx("span",{className:"text-content-subtle truncate",title:X,children:Md(X)}),l.jsxs("div",{className:"text-right",children:[l.jsx("span",{className:"text-content-body",children:Gl(ae.cost)}),l.jsxs("span",{className:"text-content-muted text-xs ml-1",children:["(",Dd(ae.tokens),")"]})]})]},X))})]}),W.byStage&&Object.keys(W.byStage).length>0&&l.jsxs("div",{className:"border-t border-divider pt-2",children:[l.jsx("p",{className:"text-xs text-content-muted uppercase tracking-wider mb-2",children:"By Stage"}),l.jsx("div",{className:"space-y-1",children:Object.entries(W.byStage).sort(([,X],[,ae])=>ae.cost-X.cost).map(([X,ae])=>l.jsxs("div",{className:"flex items-center justify-between text-sm",children:[l.jsx("span",{className:"text-content-subtle truncate",title:X,children:X.charAt(0).toUpperCase()+X.slice(1)}),l.jsxs("div",{className:"text-right",children:[l.jsx("span",{className:"text-content-body",children:Gl(ae.cost)}),l.jsxs("span",{className:"text-content-muted text-xs ml-1",children:["(",Dd(ae.tokens),")"]})]})]},X))})]})]})]}),l.jsxs("div",{className:"space-y-3 mt-6",children:[l.jsx("button",{onClick:()=>O.mutate(),disabled:O.isPending||O.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:O.isPending?l.jsxs(l.Fragment,{children:[l.jsx(be,{className:"w-5 h-5 animate-spin"}),l.jsx("span",{className:"font-medium",children:"Starting..."})]}):O.isSuccess?l.jsxs(l.Fragment,{children:[l.jsx(Ec,{className:"w-5 h-5"}),l.jsx("span",{className:"font-medium",children:"Agent Started!"})]}):l.jsxs(l.Fragment,{children:[l.jsx(Qn,{className:"w-5 h-5"}),l.jsx("span",{className:"font-medium",children:P!=null&&P.exists?"Start Agent in Workspace":"Start Agent"})]})}),!(P!=null&&P.exists)&&l.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?l.jsxs(l.Fragment,{children:[l.jsx(be,{className:"w-5 h-5 animate-spin"}),l.jsx("span",{className:"font-medium",children:H.isPending?"Creating workspace...":"Setting up git worktree & skills..."})]}):l.jsxs(l.Fragment,{children:[l.jsx(Wb,{className:"w-5 h-5"}),l.jsx("span",{className:"font-medium",children:"Create Workspace Only"})]})}),O.isError&&l.jsx("p",{className:"text-red-400 text-xs",children:"Failed to start agent. Check server logs."}),H.isError&&l.jsx("p",{className:"text-red-400 text-xs",children:"Failed to create workspace. Check server logs."})]}),l.jsxs("div",{className:"text-xs text-content-muted mt-3 space-y-1",children:[l.jsxs("p",{children:[l.jsx("strong",{children:"Start Agent:"})," ",P!=null&&P.exists?"Starts autonomous agent in existing workspace":"Creates workspace + starts autonomous agent"]}),!(P!=null&&P.exists)&&l.jsxs("p",{children:[l.jsx("strong",{children:"Create Workspace:"})," Creates git worktree for manual work"]})]})]})]})})]}),I&&l.jsxs("div",{className:"fixed z-50 bg-surface-raised border border-divider-strong rounded shadow-lg py-1 min-w-[140px]",style:{left:I.x,top:I.y},onClick:X=>X.stopPropagation(),children:[l.jsx("div",{className:"px-3 py-1 text-xs text-content-subtle border-b border-divider mb-1",children:I.containerName}),I.isRunning?l.jsxs(l.Fragment,{children:[l.jsxs("button",{onClick:()=>N.mutate({containerName:I.containerName,action:"restart"}),disabled:N.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:[l.jsx(Ar,{className:"w-3 h-3"}),"Restart"]}),l.jsxs("button",{onClick:()=>N.mutate({containerName:I.containerName,action:"stop"}),disabled:N.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:[l.jsx(ou,{className:"w-3 h-3"}),"Stop"]}),I.containerName==="postgres"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"border-t border-divider my-1"}),l.jsxs("button",{onClick:async()=>{await o({title:"Refresh Database",message:`Drop and reload database from seed file?
|
|
612
|
+
|
|
613
|
+
This will:
|
|
614
|
+
- Stop the API container
|
|
615
|
+
- Drop the existing database
|
|
616
|
+
- Reload from seed-cleaned.sql
|
|
617
|
+
- Restart the API
|
|
618
|
+
|
|
619
|
+
All workspace data will be replaced.`,variant:"destructive",confirmLabel:"Refresh DB"})&&(Ut.mutate(),M(null))},disabled:Ut.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:[l.jsx(Nx,{className:"w-3 h-3"}),Ut.isPending?"Refreshing DB...":"Refresh DB"]})]})]}):l.jsxs("button",{onClick:()=>N.mutate({containerName:I.containerName,action:"start"}),disabled:N.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:[l.jsx(Qn,{className:"w-3 h-3"}),"Start"]}),N.isError&&l.jsx("div",{className:"px-3 py-1 text-xs text-red-400 border-t border-divider mt-1",children:N.error instanceof Error?N.error.message:"Action failed"})]}),S&&l.jsx(P0,{issueId:t,isOpen:S,onClose:()=>C(!1)}),_&&$&&l.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50",onClick:()=>b(!1),children:l.jsxs("div",{className:"border border-divider rounded-lg shadow-xl w-[700px] max-h-[80vh] flex flex-col",style:{backgroundColor:"#1a1d23"},onClick:X=>X.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-divider",children:[l.jsxs("h2",{className:"text-sm font-medium text-content",children:["PRD — ",t.toUpperCase()]}),l.jsx("button",{onClick:()=>b(!1),className:"text-content-muted hover:text-content",children:l.jsx(yt,{size:18})})]}),l.jsx("div",{className:"overflow-y-auto px-4 py-3 text-xs prose prose-invert prose-sm max-w-none",children:l.jsx(Tv,{children:$})})]})})]})}async function tH(){const e=await fetch("/api/activity");if(!e.ok)throw new Error("Failed to fetch activity");return e.json()}function nH({status:e}){switch(e){case"running":return l.jsx(be,{className:"w-4 h-4 text-blue-400 animate-spin"});case"completed":return l.jsx(mr,{className:"w-4 h-4 text-green-400"});case"failed":return l.jsx(Kr,{className:"w-4 h-4 text-red-400"})}}function sH(e){return new Date(e).toLocaleTimeString()}function rH({onClose:e}){const{data:t,isLoading:n}=he({queryKey:["activity"],queryFn:tH,refetchInterval:2e3});return l.jsxs("div",{className:"flex flex-col h-full bg-surface-raised border-l border-divider",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-divider flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Vo,{className:"w-5 h-5 text-blue-400"}),l.jsx("h2",{className:"font-medium text-content",children:"Activity Log"})]}),l.jsx("button",{onClick:e,className:"text-content-subtle hover:text-content p-1",children:l.jsx(yt,{className:"w-4 h-4"})})]}),l.jsx("div",{className:"flex-1 overflow-y-auto",children:n?l.jsx("div",{className:"flex items-center justify-center h-32 text-content-subtle",children:l.jsx(be,{className:"w-6 h-6 animate-spin"})}):!t||t.length===0?l.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-content-muted",children:[l.jsx(Vo,{className:"w-8 h-8 mb-2 opacity-50"}),l.jsx("p",{className:"text-sm",children:"No activity yet"}),l.jsx("p",{className:"text-xs mt-1",children:"Start an agent or create a workspace to see output here"})]}):l.jsx("div",{className:"divide-y divide-gray-700",children:t.map(s=>l.jsxs("div",{className:"p-3",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx(nH,{status:s.status}),l.jsx("code",{className:"text-sm text-content font-mono flex-1 truncate",children:s.command}),l.jsx("span",{className:"text-xs text-content-muted",children:sH(s.timestamp)})]}),l.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:s.output.length>0?s.output.join(`
|
|
620
|
+
`):s.status==="running"?"Waiting for output...":"No output"}),l.jsx("div",{className:"mt-2 flex items-center gap-2",children:l.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${s.status==="running"?"bg-blue-900/50 text-blue-400":s.status==="completed"?"bg-green-900/50 text-green-400":"bg-red-900/50 text-red-400"}`,children:s.status})})]},s.id))})})]})}async function iH(){const e=await fetch("/api/convoys");if(!e.ok)throw new Error("Failed to fetch convoys");return(await e.json()).convoys}async function oH(e){const t=await fetch(`/api/convoys/${e}`);if(!t.ok)throw new Error("Failed to fetch convoy status");return t.json()}async function aH(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 lH(){return he({queryKey:["convoys"],queryFn:iH,refetchInterval:5e3})}function cH(e){return he({queryKey:["convoy",e],queryFn:()=>oH(e),enabled:!!e,refetchInterval:2e3})}function uH(e){return he({queryKey:["convoy-output",e],queryFn:()=>aH(e),enabled:!!e,refetchInterval:5e3})}function x5({status:e}){switch(e){case"running":return l.jsx(be,{className:"w-4 h-4 text-blue-400 animate-spin"});case"completed":return l.jsx(mr,{className:"w-4 h-4 text-green-400"});case"failed":return l.jsx(Kr,{className:"w-4 h-4 text-red-400"});case"partial":return l.jsx(Uo,{className:"w-4 h-4 text-yellow-400"})}}function dH({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 l.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${t[e]||t.pending}`,children:e})}function Rv(e){return new Date(e).toLocaleString()}function v5(e,t){const n=new Date(e).getTime(),s=t?new Date(t).getTime():Date.now(),r=Math.floor((s-n)/1e3),i=Math.floor(r/3600),o=Math.floor(r%3600/60),a=r%60;return i>0?`${i}h ${o}m ${a}s`:o>0?`${o}m ${a}s`:`${a}s`}function hH({convoy:e}){const{data:t}=uH(e.id);return l.jsxs("div",{className:"border-t border-divider p-4 bg-surface/50",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4 text-sm",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-content-muted",children:"Template:"}),l.jsx("span",{className:"ml-2 text-content",children:e.template})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-content-muted",children:"Duration:"}),l.jsx("span",{className:"ml-2 text-content",children:v5(e.startedAt,e.completedAt)})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-content-muted",children:"Output:"}),l.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,l.jsx(gr,{className:"w-3 h-3"})]})]}),e.context.prUrl&&l.jsxs("div",{children:[l.jsx("span",{className:"text-content-muted",children:"PR:"}),l.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",l.jsx(gr,{className:"w-3 h-3"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"text-sm font-medium text-content mb-2",children:"Agents"}),e.agents.map(n=>l.jsxs("div",{className:"bg-surface-raised rounded p-3",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(x5,{status:n.status}),l.jsx("span",{className:"font-medium text-content",children:n.role}),l.jsxs("span",{className:"text-xs text-content-muted",children:["(",n.subagent,")"]})]}),l.jsx(dH,{status:n.status})]}),n.startedAt&&l.jsxs("div",{className:"text-xs text-content-muted mb-1",children:["Started: ",Rv(n.startedAt),n.completedAt&&` • Completed: ${Rv(n.completedAt)}`]}),n.status==="running"&&l.jsxs("div",{className:"text-xs text-content-muted",children:["Tmux: ",l.jsx("code",{className:"text-content-subtle",children:n.tmuxSession})]}),n.status==="completed"&&t&&t[n.role]&&l.jsx("div",{className:"mt-2",children:l.jsxs("details",{className:"text-xs",children:[l.jsx("summary",{className:"cursor-pointer text-blue-400 hover:text-blue-300",children:"View output"}),l.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&&`
|
|
621
|
+
... (truncated)`]})]})})]},n.role))]})]})}function fH({onClose:e}){const{data:t,isLoading:n}=lH(),[s,r]=y.useState(null),{data:i}=cH(s||void 0),o=i||s&&(t==null?void 0:t.find(a=>a.id===s));return l.jsxs("div",{className:"flex flex-col h-full bg-surface-raised border-l border-divider",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-divider flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(au,{className:"w-5 h-5 text-purple-400"}),l.jsx("h2",{className:"font-medium text-content",children:"Convoys"}),t&&t.length>0&&l.jsxs("span",{className:"text-xs text-content-muted",children:["(",t.length,")"]})]}),l.jsx("button",{onClick:e,className:"text-content-subtle hover:text-content p-1",children:l.jsx(yt,{className:"w-4 h-4"})})]}),l.jsx("div",{className:"flex-1 overflow-y-auto",children:n?l.jsx("div",{className:"flex items-center justify-center h-32 text-content-subtle",children:l.jsx(be,{className:"w-6 h-6 animate-spin"})}):!t||t.length===0?l.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-content-muted",children:[l.jsx(au,{className:"w-8 h-8 mb-2 opacity-50"}),l.jsx("p",{className:"text-sm",children:"No convoys yet"}),l.jsx("p",{className:"text-xs mt-1",children:"Start a convoy to see it here"})]}):l.jsx("div",{className:"divide-y divide-gray-700",children:t.map(a=>l.jsxs("div",{className:"p-3",children:[l.jsxs("button",{onClick:()=>r(s===a.id?null:a.id),className:"w-full text-left",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx(x5,{status:a.status}),l.jsx("code",{className:"text-sm text-content font-mono flex-1 truncate",children:a.id}),l.jsx("span",{className:"text-xs text-content-muted",children:v5(a.startedAt,a.completedAt)})]}),l.jsxs("div",{className:"flex items-center gap-3 text-xs text-content-subtle mb-2",children:[l.jsx("span",{className:"text-purple-400",children:a.template}),l.jsx("span",{children:"•"}),l.jsxs("span",{children:[a.agents.filter(c=>c.status==="completed").length,"/",a.agents.length," agents"]}),l.jsx("span",{children:"•"}),l.jsx("span",{children:Rv(a.startedAt)})]}),l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${a.status==="running"?"bg-blue-900/50 text-blue-400":a.status==="completed"?"bg-green-900/50 text-green-400":a.status==="failed"?"bg-red-900/50 text-red-400":"bg-yellow-900/50 text-yellow-400"}`,children:a.status})})]}),s===a.id&&o&&l.jsx(hH,{convoy:o})]},a.id))})})]})}async function pH(){const e=await fetch("/api/cloister/status");if(!e.ok)throw new Error("Failed to fetch Cloister status");return e.json()}async function mH(){const e=await fetch("/api/cloister/config");if(!e.ok)throw new Error("Failed to fetch Cloister config");return e.json()}async function gH(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 xH(){if(!(await fetch("/api/cloister/start",{method:"POST"})).ok)throw new Error("Failed to start Cloister")}async function vH(){if(!(await fetch("/api/cloister/stop",{method:"POST"})).ok)throw new Error("Failed to stop Cloister")}async function yH(){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 _H(){const[e,t]=y.useState(!1),[n,s]=y.useState(!1),[r,i]=y.useState(!1),o=Lt(),{data:a,refetch:c}=he({queryKey:["cloister-status"],queryFn:pH,refetchInterval:1e4}),{data:u}=he({queryKey:["cloister-config"],queryFn:mH}),d=we({mutationFn:gH,onSuccess:()=>{o.invalidateQueries({queryKey:["cloister-config"]})}}),h=async()=>{i(!0);try{a!=null&&a.running?await vH():await xH(),await c()}finally{i(!1)}},p=async()=>{await yH(),t(!1),c()},f=()=>{u&&d.mutate({startup:{auto_start:!u.startup.auto_start}})};if(!a)return null;const m=a.summary.warning>0||a.summary.stuck>0,g=a.agentsNeedingAttention.length;return l.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[l.jsx("div",{className:"flex items-center gap-1",title:a.running?"Cloister: Running":"Cloister: Stopped",children:a.running?l.jsx(KN,{className:"w-3.5 h-3.5 text-green-400"}):l.jsx(WD,{className:"w-3.5 h-3.5 text-content-muted"})}),a.running&&a.summary.total>0&&l.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[a.summary.active>0&&l.jsx("span",{className:"text-green-400",children:a.summary.active}),a.summary.warning>0&&l.jsx("span",{className:"text-orange-400",children:a.summary.warning}),a.summary.stuck>0&&l.jsx("span",{className:"text-red-400",children:a.summary.stuck})]}),m&&l.jsx("span",{title:`${g} agent${g!==1?"s":""} need attention`,children:l.jsx(kn,{className:"w-3.5 h-3.5 text-orange-400"})}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:h,disabled:r,className:`px-2 py-0.5 rounded text-xs transition-colors ${r?"bg-surface-emphasis text-content-subtle cursor-wait":a.running?"bg-surface-overlay text-content-body hover:bg-surface-emphasis":"bg-blue-600 text-content hover:bg-blue-700"}`,children:r?(a.running,"..."):a.running?"Pause":"Start"}),e?l.jsxs("div",{className:"flex items-center gap-1 px-2 py-0.5 bg-red-600/20 rounded border border-red-600/30",children:[l.jsx("span",{className:"text-xs text-red-300",children:"Kill all?"}),l.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"}),l.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"})]}):l.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:l.jsx(KD,{className:"w-3.5 h-3.5"})}),l.jsxs("div",{className:"relative",children:[l.jsx("button",{onClick:()=>s(!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:l.jsx(sj,{className:"w-3.5 h-3.5"})}),n&&l.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:l.jsxs("div",{className:"p-3",children:[l.jsx("div",{className:"text-xs text-content-subtle font-medium mb-2",children:"Settings"}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer hover:bg-surface-overlay/50 rounded px-2 py-1.5 -mx-2",children:[l.jsx("input",{type:"checkbox",checked:(u==null?void 0:u.startup.auto_start)??!0,onChange:f,disabled:d.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"}),l.jsx("span",{className:"text-sm text-content-body",children:"Auto-start on dashboard launch"})]})]})})]})]})]})}function oS(e){const t=new Date(e),n=t.toLocaleString("default",{month:"short"}),s=t.getDate(),r=t.getHours().toString().padStart(2,"0"),i=t.getMinutes().toString().padStart(2,"0"),o=t.getSeconds().toString().padStart(2,"0");return`${n} ${s}, ${r}:${i}:${o}`}async function bH(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 wH(){const e=await fetch("/api/handoffs/stats");if(!e.ok)throw new Error("Failed to fetch handoff stats");return e.json()}async function SH(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 kH(){const e=await fetch("/api/specialist-handoffs/stats");if(!e.ok)throw new Error("Failed to fetch specialist handoff stats");return e.json()}const aS={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"},CH={stuck_escalation:"Stuck Escalation",test_failure:"Test Failure",task_complete:"Task Complete",manual:"Manual"},NH={stuck_escalation:"text-red-400",test_failure:"text-orange-400",task_complete:"text-blue-400",manual:"text-content-subtle"},lS={"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"},jH={queued:"text-yellow-400",processing:"text-blue-400",completed:"text-green-400",failed:"text-red-400"},EH={urgent:"text-red-400",high:"text-orange-400",normal:"text-blue-400",low:"text-content-subtle"};function PH(){var c,u,d,h,p;const{data:e,isLoading:t}=he({queryKey:["handoffs"],queryFn:()=>bH(50),refetchInterval:1e4}),{data:n,isLoading:s}=he({queryKey:["handoff-stats"],queryFn:wH,refetchInterval:3e4}),{data:r,isLoading:i}=he({queryKey:["specialist-handoffs"],queryFn:()=>SH(50),refetchInterval:1e4}),{data:o,isLoading:a}=he({queryKey:["specialist-handoff-stats"],queryFn:kH,refetchInterval:3e4});return t||s||i||a?l.jsx("div",{className:"p-6",children:l.jsx("div",{className:"text-content-subtle",children:"Loading handoff data..."})}):l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"text-2xl font-bold text-content mb-2",children:"Model Handoffs"}),l.jsx("p",{className:"text-content-subtle",children:"History of automatic and manual model handoffs across agents"})]}),n&&l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[l.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[l.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Total Handoffs"}),l.jsx("div",{className:"text-2xl font-bold text-content",children:n.totalHandoffs})]}),l.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[l.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Success Rate"}),l.jsxs("div",{className:"text-2xl font-bold text-green-400",children:[(n.successRate*100).toFixed(0),"%"]})]}),l.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[l.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Most Common Trigger"}),l.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"}),l.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"]})]}),l.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[l.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Most Popular Target"}),l.jsx("div",{className:"text-sm font-medium text-content",children:((d=Object.entries(n.byModel.to).sort((f,m)=>m[1]-f[1])[0])==null?void 0:d[0])||"N/A"}),l.jsxs("div",{className:"text-xs text-content-muted",children:[((h=Object.entries(n.byModel.to).sort((f,m)=>m[1]-f[1])[0])==null?void 0:h[1])||0," handoffs"]})]})]}),l.jsxs("div",{className:"bg-surface-raised rounded-lg border border-divider overflow-hidden",children:[l.jsx("div",{className:"p-4 border-b border-divider",children:l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Recent Handoffs"})}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"bg-gray-750 text-left text-sm text-content-subtle",children:[l.jsx("th",{className:"px-4 py-3",children:"Timestamp"}),l.jsx("th",{className:"px-4 py-3",children:"Agent"}),l.jsx("th",{className:"px-4 py-3",children:"Transition"}),l.jsx("th",{className:"px-4 py-3",children:"Trigger"}),l.jsx("th",{className:"px-4 py-3",children:"Reason"}),l.jsx("th",{className:"px-4 py-3",children:"Cost"}),l.jsx("th",{className:"px-4 py-3",children:"Status"})]})}),l.jsx("tbody",{className:"text-sm",children:e&&e.handoffs.length>0?e.handoffs.map((f,m)=>l.jsxs("tr",{className:"border-t border-divider hover:bg-gray-750",children:[l.jsx("td",{className:"px-4 py-3 text-content-subtle",children:l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(ll,{className:"w-3 h-3"}),oS(f.timestamp)]})}),l.jsxs("td",{className:"px-4 py-3",children:[l.jsx("div",{className:"font-medium text-content",children:f.agentId}),l.jsx("div",{className:"text-xs text-content-muted",children:f.issueId})]}),l.jsx("td",{className:"px-4 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`px-2 py-0.5 text-xs rounded border ${aS[f.from.model]||"text-content-subtle bg-surface-overlay"}`,children:f.from.model}),l.jsx(kx,{className:"w-3 h-3 text-content-muted"}),l.jsx("span",{className:`px-2 py-0.5 text-xs rounded border ${aS[f.to.model]||"text-content-subtle bg-surface-overlay"}`,children:f.to.model})]})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("span",{className:`text-xs ${NH[f.trigger]||"text-content-subtle"}`,children:CH[f.trigger]||f.trigger})}),l.jsx("td",{className:"px-4 py-3 text-content-body max-w-xs truncate",children:f.reason}),l.jsx("td",{className:"px-4 py-3 text-emerald-400",children:f.context.costAtHandoff!==void 0?`$${f.context.costAtHandoff.toFixed(4)}`:"-"}),l.jsx("td",{className:"px-4 py-3",children:f.success?l.jsx("span",{className:"text-green-400 text-xs",children:"✓ Success"}):l.jsx("span",{className:"text-red-400 text-xs",title:f.errorMessage,children:"✗ Failed"})})]},`${f.timestamp}-${m}`)):l.jsx("tr",{children:l.jsx("td",{colSpan:7,className:"px-4 py-8 text-center text-content-muted",children:"No handoffs recorded yet"})})})]})})]}),l.jsxs("div",{className:"mt-12",children:[l.jsxs("div",{className:"mb-6",children:[l.jsx("h2",{className:"text-2xl font-bold text-content mb-2",children:"Specialist Handoffs"}),l.jsx("p",{className:"text-content-subtle",children:"Queue-based work handoffs between specialist agents (review, test, merge)"})]}),o&&l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[l.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[l.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Today's Handoffs"}),l.jsx("div",{className:"text-2xl font-bold text-content",children:o.todayCount})]}),l.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[l.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Queue Depth"}),l.jsx("div",{className:"text-2xl font-bold text-orange-400",children:o.queueDepth})]}),l.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[l.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Success Rate"}),l.jsxs("div",{className:"text-2xl font-bold text-green-400",children:[(o.successRate*100).toFixed(0),"%"]})]}),l.jsxs("div",{className:"p-4 bg-surface-raised rounded-lg border border-divider",children:[l.jsx("div",{className:"text-sm text-content-subtle mb-1",children:"Most Active"}),l.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"})]})]}),l.jsxs("div",{className:"bg-surface-raised rounded-lg border border-divider overflow-hidden mt-6",children:[l.jsx("div",{className:"p-4 border-b border-divider",children:l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Recent Specialist Handoffs"})}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"bg-gray-750 text-left text-sm text-content-subtle",children:[l.jsx("th",{className:"px-4 py-3",children:"Timestamp"}),l.jsx("th",{className:"px-4 py-3",children:"Issue"}),l.jsx("th",{className:"px-4 py-3",children:"Transition"}),l.jsx("th",{className:"px-4 py-3",children:"Priority"}),l.jsx("th",{className:"px-4 py-3",children:"Status"}),l.jsx("th",{className:"px-4 py-3",children:"Workspace"})]})}),l.jsx("tbody",{className:"text-sm",children:r&&r.handoffs.length>0?r.handoffs.map(f=>{var m,g;return l.jsxs("tr",{className:"border-t border-divider hover:bg-gray-750",children:[l.jsx("td",{className:"px-4 py-3 text-content-subtle",children:l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(ll,{className:"w-3 h-3"}),oS(f.timestamp)]})}),l.jsxs("td",{className:"px-4 py-3",children:[l.jsx("div",{className:"font-medium text-content",children:f.issueId}),((m=f.context)==null?void 0:m.branch)&&l.jsx("div",{className:"text-xs text-content-muted",children:f.context.branch})]}),l.jsx("td",{className:"px-4 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`px-2 py-0.5 text-xs rounded border ${lS[f.fromSpecialist]||"text-content-subtle bg-surface-overlay"}`,children:f.fromSpecialist}),l.jsx(kx,{className:"w-3 h-3 text-content-muted"}),l.jsx("span",{className:`px-2 py-0.5 text-xs rounded border ${lS[f.toSpecialist]||"text-content-subtle bg-surface-overlay"}`,children:f.toSpecialist})]})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("span",{className:`text-xs ${EH[f.priority]}`,children:f.priority})}),l.jsxs("td",{className:"px-4 py-3",children:[l.jsx("span",{className:`text-xs ${jH[f.status]}`,children:f.status}),f.result&&l.jsxs("span",{className:"ml-2 text-xs text-content-muted",children:["(",f.result,")"]})]}),l.jsx("td",{className:"px-4 py-3 text-content-subtle text-xs",children:((g=f.context)==null?void 0:g.workspace)||"-"})]},f.id)}):l.jsx("tr",{children:l.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-content-muted",children:"No specialist handoffs recorded yet"})})})]})})]})]})]})}function TH({request:e,isOpen:t,onConfirm:n,onDeny:s,onClose:r}){return!t||!e?null:l.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg shadow-2xl w-full max-w-md mx-4",children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-divider",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(kn,{className:"w-5 h-5 text-orange-400"}),l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Confirmation Required"})]}),l.jsx("button",{onClick:r,className:"text-content-subtle hover:text-content-body transition-colors",children:l.jsx(yt,{className:"w-5 h-5"})})]}),l.jsxs("div",{className:"p-4 space-y-3",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-sm text-content-subtle mb-1",children:"Agent:"}),l.jsx("p",{className:"text-base text-content font-medium",children:e.agentId})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm text-content-subtle mb-1",children:"Action:"}),l.jsx("p",{className:"text-base text-content font-medium",children:e.action})]}),e.details&&l.jsxs("div",{children:[l.jsx("p",{className:"text-sm text-content-subtle mb-1",children:"Details:"}),l.jsx("p",{className:"text-sm text-content-body bg-surface/50 p-2 rounded border border-divider",children:e.details})]}),l.jsx("div",{className:"mt-4 p-3 bg-orange-500/10 border border-orange-500/30 rounded",children:l.jsx("p",{className:"text-sm text-orange-200",children:"⚠️ This action cannot be undone. Please confirm that you want to proceed."})})]}),l.jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-divider bg-surface/30",children:[l.jsx("button",{onClick:s,className:"px-4 py-2 rounded text-sm bg-surface-overlay text-content-body hover:bg-surface-emphasis transition-colors",children:"Deny"}),l.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 RH(){const e=await fetch("/api/metrics/summary");if(!e.ok)throw new Error("Failed to fetch metrics summary");return e.json()}async function DH(){const e=await fetch("/api/handoffs/stats");if(!e.ok)throw new Error("Failed to fetch handoff stats");return e.json()}async function MH(){const e=await fetch("/api/specialist-handoffs/stats");if(!e.ok)throw new Error("Failed to fetch specialist handoff stats");return e.json()}function LH(){const{data:e}=he({queryKey:["metrics-summary"],queryFn:RH,refetchInterval:3e4}),{data:t}=he({queryKey:["handoff-stats"],queryFn:DH,refetchInterval:3e4}),{data:n}=he({queryKey:["specialist-handoff-stats"],queryFn:MH,refetchInterval:3e4});if(!e)return null;const s=t?Object.values(t.byTrigger).reduce((r,i)=>r+i,0):0;return l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-6",children:[l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-4",children:[l.jsx("div",{className:"flex items-center justify-between mb-2",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(na,{className:"w-5 h-5 text-green-400"}),l.jsx("span",{className:"text-sm text-content-subtle",children:"Cost Today (UTC)"})]})}),l.jsxs("div",{className:"text-2xl font-bold text-content",children:["$",e.today.totalCost.toFixed(2)]}),e.topSpenders.agents.length>0&&l.jsxs("div",{className:"mt-2 text-xs text-content-muted",children:["Top: ",e.topSpenders.agents[0].agentId," ($",e.topSpenders.agents[0].cost.toFixed(2),")"]})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-4",children:[l.jsx("div",{className:"flex items-center justify-between mb-2",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(au,{className:"w-5 h-5 text-blue-400"}),l.jsx("span",{className:"text-sm text-content-subtle",children:"Agents"})]})}),l.jsxs("div",{className:"text-2xl font-bold text-content",children:[e.today.activeCount," / ",e.today.agentCount]}),l.jsxs("div",{className:"mt-2 text-xs text-content-muted",children:[e.today.activeCount," active, ",e.today.agentCount-e.today.activeCount," ","idle"]})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-4",children:[l.jsx("div",{className:"flex items-center justify-between mb-2",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(kn,{className:"w-5 h-5 text-red-400"}),l.jsx("span",{className:"text-sm text-content-subtle",children:"Stuck Agents"})]})}),l.jsx("div",{className:"text-2xl font-bold text-content",children:e.today.stuckCount}),l.jsxs("div",{className:"mt-2 text-xs text-content-muted",children:[e.today.warningCount," warnings"]})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-4",children:[l.jsx("div",{className:"flex items-center justify-between mb-2",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(JN,{className:"w-5 h-5 text-cyan-400"}),l.jsx("span",{className:"text-sm text-content-subtle",children:"Specialist Handoffs"})]})}),l.jsx("div",{className:"text-2xl font-bold text-content",children:(n==null?void 0:n.todayCount)??0}),l.jsx("div",{className:"mt-2 text-xs text-content-muted",children:n?`${(n.successRate*100).toFixed(0)}% success rate`:"No data"})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-4",children:[l.jsx("div",{className:"flex items-center justify-between mb-2",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(r0,{className:"w-5 h-5 text-purple-400"}),l.jsx("span",{className:"text-sm text-content-subtle",children:"Cost Escalations"})]})}),l.jsx("div",{className:"text-2xl font-bold text-content",children:s}),l.jsx("div",{className:"mt-2 text-xs text-content-muted",children:t?`${(t.successRate*100).toFixed(0)}% success rate`:"No data"})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-4",children:[l.jsx("div",{className:"flex items-center justify-between mb-2",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ej,{className:"w-5 h-5 text-orange-400"}),l.jsx("span",{className:"text-sm text-content-subtle",children:"Queue Depth"})]})}),l.jsx("div",{className:"text-2xl font-bold text-content",children:(n==null?void 0:n.queueDepth)??0}),l.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 AH(){const e=await fetch("/api/metrics/summary");if(!e.ok)throw new Error("Failed to fetch metrics summary");return e.json()}async function OH(){const e=await fetch("/api/metrics/costs");if(!e.ok)throw new Error("Failed to fetch cost metrics");return e.json()}function IH(){const{data:e}=he({queryKey:["metrics-summary"],queryFn:AH,refetchInterval:3e4}),{data:t}=he({queryKey:["metrics-costs"],queryFn:OH,refetchInterval:3e4});return l.jsxs("div",{className:"p-6 overflow-auto h-full",children:[l.jsx("h1",{className:"text-3xl font-bold text-content mb-6",children:"Metrics Dashboard"}),e&&l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[l.jsx(na,{className:"w-6 h-6 text-green-400"}),l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Cost Today (UTC)"})]}),l.jsxs("div",{className:"text-3xl font-bold text-content mb-2",children:["$",e.today.totalCost.toFixed(2)]}),l.jsx("div",{className:"text-sm text-content-subtle",children:"Daily total"})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[l.jsx(r0,{className:"w-6 h-6 text-blue-400"}),l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Active Agents"})]}),l.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:e.today.activeCount}),l.jsxs("div",{className:"text-sm text-content-subtle",children:["of ",e.today.agentCount," total"]})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[l.jsx(kn,{className:"w-6 h-6 text-red-400"}),l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Stuck Agents"})]}),l.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:e.today.stuckCount}),l.jsxs("div",{className:"text-sm text-content-subtle",children:[e.today.warningCount," warnings"]})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[l.jsx(t0,{className:"w-6 h-6 text-purple-400"}),l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Handoffs Today"})]}),l.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:"-"}),l.jsx("div",{className:"text-sm text-content-subtle",children:"Coming soon"})]})]}),t&&l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 mb-8",children:[l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsx("h3",{className:"text-xl font-semibold text-content mb-4",children:"Top Agents by Cost"}),l.jsxs("div",{className:"space-y-3",children:[t.topAgents.slice(0,10).map((n,s)=>l.jsxs("div",{className:"flex items-center justify-between p-3 bg-surface/50 rounded",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("span",{className:"text-lg font-bold text-content-muted",children:["#",s+1]}),l.jsx("span",{className:"text-content font-mono text-sm",children:n.agentId})]}),l.jsxs("span",{className:"text-green-400 font-semibold",children:["$",n.cost.toFixed(2)]})]},n.agentId)),t.topAgents.length===0&&l.jsx("div",{className:"text-center text-content-muted py-8",children:"No cost data yet"})]})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsx("h3",{className:"text-xl font-semibold text-content mb-4",children:"Top Issues by Cost"}),l.jsxs("div",{className:"space-y-3",children:[t.topIssues.slice(0,10).map((n,s)=>l.jsxs("div",{className:"flex items-center justify-between p-3 bg-surface/50 rounded",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("span",{className:"text-lg font-bold text-content-muted",children:["#",s+1]}),l.jsx("span",{className:"text-content font-mono text-sm",children:n.issueId})]}),l.jsxs("span",{className:"text-green-400 font-semibold",children:["$",n.cost.toFixed(2)]})]},n.issueId)),t.topIssues.length===0&&l.jsx("div",{className:"text-center text-content-muted py-8",children:"No cost data yet"})]})]})]}),l.jsxs("div",{className:"mb-8",children:[l.jsx("h2",{className:"text-xl font-semibold text-content mb-4",children:"Services"}),l.jsx(LE,{})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsx("h3",{className:"text-xl font-semibold text-content mb-4",children:"Historical Trends"}),l.jsxs("div",{className:"text-center text-content-muted py-16",children:[l.jsx("p",{className:"mb-2",children:"Charts coming soon"}),l.jsx("p",{className:"text-sm",children:"Cost over time, handoff success rates, and more"})]})]})]})}async function FH(){const e=await fetch("/api/costs/by-issue");if(!e.ok)throw new Error("Failed to fetch costs");return e.json()}function BH(){const[e,t]=y.useState(null),{data:n,isLoading:s}=he({queryKey:["costs-by-issue"],queryFn:FH,refetchInterval:1e4});if(s)return l.jsx("div",{className:"p-6 h-full flex items-center justify-center",children:l.jsx("div",{className:"text-content-subtle",children:"Loading costs..."})});if(!n)return l.jsx("div",{className:"p-6 h-full flex items-center justify-center",children:l.jsx("div",{className:"text-red-400",children:"Failed to load costs"})});const r=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)),a=e?n.issues.find(c=>c.issueId===e):null;return l.jsxs("div",{className:"p-6 overflow-auto h-full",children:[l.jsxs("div",{className:"flex items-center justify-between mb-6",children:[l.jsx("h1",{className:"text-3xl font-bold text-content",children:"Cost Tracking"}),l.jsx("div",{className:"flex items-center gap-3",children:l.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"})})]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[l.jsx(na,{className:"w-6 h-6 text-green-400"}),l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Total Cost"})]}),l.jsxs("div",{className:"text-3xl font-bold text-content mb-2",children:["$",r.toFixed(2)]}),l.jsxs("div",{className:"text-sm text-content-subtle",children:[n.issues.length," issues tracked"]})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[l.jsx(r0,{className:"w-6 h-6 text-blue-400"}),l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Event Count"})]}),l.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:n.eventCount.toLocaleString()}),l.jsx("div",{className:"text-sm text-content-subtle",children:"Total events logged"})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[l.jsx(kn,{className:"w-6 h-6 text-yellow-400"}),l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Budget Warnings"})]}),l.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:n.issues.filter(c=>c.budgetWarning).length}),l.jsxs("div",{className:"text-sm text-content-subtle",children:[i.length," with budgets"]})]}),l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[l.jsx(uM,{className:"w-6 h-6 text-purple-400"}),l.jsx("h3",{className:"text-lg font-semibold text-content",children:"Over Budget"})]}),l.jsx("div",{className:"text-3xl font-bold text-content mb-2",children:o.length}),l.jsx("div",{className:"text-sm text-content-subtle",children:"Exceeded limit"})]})]}),l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:[l.jsx("h3",{className:"text-xl font-semibold text-content mb-4",children:"Costs by Issue"}),l.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 l.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:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-content font-mono font-semibold",children:c.issueId}),c.budgetWarning&&l.jsx(kn,{className:"w-4 h-4 text-yellow-400"})]}),l.jsxs("span",{className:"text-green-400 font-bold",children:["$",c.totalCost.toFixed(2)]})]}),c.budget&&l.jsxs("div",{className:"mb-2",children:[l.jsxs("div",{className:"flex items-center justify-between text-xs text-content-subtle mb-1",children:[l.jsxs("span",{children:["Budget: $",c.budget.toFixed(2)]}),l.jsxs("span",{children:[u.toFixed(0),"%"]})]}),l.jsx("div",{className:"w-full bg-surface-overlay rounded-full h-2",children:l.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)}%`}})})]}),l.jsxs("div",{className:"flex items-center gap-4 text-xs text-content-subtle",children:[l.jsxs("span",{children:[c.tokenCount.toLocaleString()," tokens"]}),l.jsxs("span",{children:[Object.keys(c.models).length," models"]})]})]},c.issueId)})})]}),l.jsx("div",{className:"bg-surface-raised border border-divider rounded-lg p-6",children:a?l.jsxs(l.Fragment,{children:[l.jsxs("h3",{className:"text-xl font-semibold text-content mb-4",children:[a.issueId," Details"]}),l.jsxs("div",{className:"mb-6",children:[l.jsx("h4",{className:"text-sm font-semibold text-content-subtle mb-3",children:"Token Usage"}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{className:"bg-surface/50 rounded p-3",children:[l.jsx("div",{className:"text-xs text-content-subtle",children:"Input"}),l.jsx("div",{className:"text-lg font-semibold text-content",children:a.inputTokens.toLocaleString()})]}),l.jsxs("div",{className:"bg-surface/50 rounded p-3",children:[l.jsx("div",{className:"text-xs text-content-subtle",children:"Output"}),l.jsx("div",{className:"text-lg font-semibold text-content",children:a.outputTokens.toLocaleString()})]}),l.jsxs("div",{className:"bg-surface/50 rounded p-3",children:[l.jsx("div",{className:"text-xs text-content-subtle",children:"Cache Read"}),l.jsx("div",{className:"text-lg font-semibold text-content",children:a.cacheReadTokens.toLocaleString()})]}),l.jsxs("div",{className:"bg-surface/50 rounded p-3",children:[l.jsx("div",{className:"text-xs text-content-subtle",children:"Cache Write"}),l.jsx("div",{className:"text-lg font-semibold text-content",children:a.cacheWriteTokens.toLocaleString()})]})]})]}),l.jsxs("div",{className:"mb-6",children:[l.jsx("h4",{className:"text-sm font-semibold text-content-subtle mb-3",children:"By Model"}),l.jsx("div",{className:"space-y-2",children:Object.entries(a.models).map(([c,u])=>l.jsxs("div",{className:"bg-surface/50 rounded p-3",children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsx("span",{className:"text-sm text-content font-mono",children:c}),l.jsxs("span",{className:"text-sm text-green-400 font-semibold",children:["$",u.cost.toFixed(4)]})]}),l.jsxs("div",{className:"flex items-center gap-4 text-xs text-content-subtle",children:[l.jsxs("span",{children:[u.calls," calls"]}),l.jsxs("span",{children:[u.tokens.toLocaleString()," tokens"]})]})]},c))})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"text-sm font-semibold text-content-subtle mb-3",children:"By Provider"}),l.jsx("div",{className:"space-y-2",children:Object.entries(a.providers).filter(([c,u])=>u>0).map(([c,u])=>l.jsx("div",{className:"bg-surface/50 rounded p-3",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-sm text-content capitalize",children:c}),l.jsxs("span",{className:"text-sm text-green-400 font-semibold",children:["$",u.toFixed(4)]})]})},c))})]})]}):l.jsx("div",{className:"h-full flex items-center justify-center text-content-muted",children:"Select an issue to view details"})})]})]})}const V0={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-6",name:"Claude Sonnet 4.6",icon:"auto_awesome",tier:"balanced",capabilities:["reasoning","code","vision","agentic"],description:"Latest Sonnet — fast, capable, great for implementation"},{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5",icon:"auto_awesome",tier:"balanced",capabilities:["reasoning","code","vision","agentic"],description:"Previous gen Sonnet, strong coding performance"},{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-5.2-codex",name:"GPT-5.2 Codex",icon:"code",tier:"premium",capabilities:["reasoning","code","complex-math"],description:"80% SWE-bench, premium coding"},{id:"o3-deep-research",name:"O3 Deep Research",icon:"psychology",tier:"premium",capabilities:["reasoning","complex-math"],description:"Deep reasoning model for debugging"},{id:"gpt-4o",name:"GPT-4o",icon:"science",tier:"balanced",capabilities:["reasoning","code","vision"],description:"Versatile multimodal model"},{id:"gpt-4o-mini",name:"GPT-4o Mini",icon:"bolt",tier:"fast",capabilities:["fast","cost-efficient"],description:"Budget option for simple tasks"}]},google:{name:"Google",models:[{id:"gemini-3-pro-preview",name:"Gemini 3 Pro",icon:"model_training",tier:"premium",capabilities:["reasoning","large-context","code"],description:"1M context, first >1500 Elo on LMArena"},{id:"gemini-3-flash-preview",name:"Gemini 3 Flash",icon:"bolt",tier:"fast",capabilities:["fast","cost-efficient","large-context"],description:"Extremely fast with 1M context"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",icon:"model_training",tier:"balanced",capabilities:["reasoning","large-context","code"],description:"Advanced reasoning, 1M context"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash",icon:"bolt",tier:"fast",capabilities:["fast","cost-efficient","large-context"],description:"Fast and efficient with large context"}]},kimi:{name:"Kimi (Moonshot)",models:[{id:"kimi-k2.5",name:"Kimi K2.5",icon:"model_training",tier:"premium",capabilities:["reasoning","code","agentic","large-context"],description:"Best open-source coding, 256K context, 76.8% SWE-bench"},{id:"kimi-k2",name:"Kimi K2",icon:"token",tier:"balanced",capabilities:["reasoning","code","agentic","large-context"],description:"Strong value, 65.8% SWE-bench, 128K context"}]},zai:{name:"Zhipu (GLM)",models:[{id:"glm-4.7",name:"GLM 4.7",icon:"hub",tier:"premium",capabilities:["reasoning","code","agentic","large-context"],description:"Top open-source for agentic coding, 73.8% SWE-bench, 200K context"},{id:"glm-4.7-flash",name:"GLM 4.7 Flash",icon:"bolt",tier:"fast",capabilities:["fast","cost-efficient","code"],description:"Fast and affordable, good for quick iterations"}]}},Y0={"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"]},zH={"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"},pi={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 $H(){return Object.values(V0).flatMap(e=>e.models)}function y5(e){const t=$H(),n=t.find(r=>r.id===e);if(n)return n;const s=e.toLowerCase();if(s.includes("opus")&&s.includes("4"))return t.find(r=>r.id==="claude-opus-4-6");if(s.includes("sonnet")&&s.includes("4"))return t.find(r=>r.id==="claude-sonnet-4-5");if(s.includes("haiku"))return t.find(r=>r.id==="claude-haiku-4-5");if(s.includes("claude")&&!s.includes("opus")&&!s.includes("haiku"))return t.find(r=>r.id==="claude-sonnet-4-5");if(s.includes("gpt-4o")||s==="gpt4o")return t.find(r=>r.id==="gpt-4o");if(s.includes("o1")&&!s.includes("o3"))return t.find(r=>r.id==="o1");if(s.includes("o3"))return t.find(r=>r.id==="o3-mini");if(s.includes("gemini")&&s.includes("flash"))return t.find(r=>r.id==="gemini-2.5-flash");if(s.includes("gemini"))return t.find(r=>r.id==="gemini-2.5-pro");if(s.includes("kimi")||s.includes("moonshot"))return s.includes("k2.5")||s.includes("2.5")?t.find(r=>r.id==="kimi-k2.5"):t.find(r=>r.id==="kimi-k2");if(s.includes("glm")||s.includes("zhipu")||s.includes("chatglm"))return s.includes("flash")?t.find(r=>r.id==="glm-4-flash"):s.includes("air")?t.find(r=>r.id==="glm-4-air"):s.includes("long")||s.includes("1m")?t.find(r=>r.id==="glm-4-long"):t.find(r=>r.id==="glm-4-plus")}function HH(e,t){const n=y5(e),s=Y0[t]||["reasoning"];if(!n)return{score:0,matched:[],missing:s};const r=s.filter(o=>n.capabilities.includes(o)),i=s.filter(o=>!n.capabilities.includes(o));return{score:s.length>0?r.length/s.length:0,matched:r,missing:i}}function WH({workType:e,currentModel:t,isOverride:n,enabledProviders:s,onApply:r,onRemove:i,onClose:o}){const[a,c]=y.useState(t),u=zH[e]||e,d=Y0[e]||["reasoning"],h=y.useMemo(()=>Object.entries(V0).filter(([g])=>g==="anthropic"||s.includes(g)),[s]),p=y.useMemo(()=>{let g=null;for(const[v,x]of h)for(const _ of x.models){const S=_.capabilities.filter(j=>d.includes(j)).length/d.length,C=_.tier==="balanced"?.1:0,w=S+C;(!g||w>g.score)&&(g={id:_.id,score:w})}return g==null?void 0:g.id},[h,d]),f=()=>{r(a),o()},m=a!==t;return l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 backdrop-blur-sm p-4",children:[l.jsxs("div",{className:"w-full max-w-[680px] bg-surface border border-divider rounded-xl shadow-2xl flex flex-col overflow-hidden",children:[l.jsx("div",{className:"p-6 border-b border-divider",children:l.jsxs("div",{className:"flex justify-between items-start gap-3",children:[l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsx("h1",{className:"text-content tracking-tight text-2xl font-bold",children:"Select Model"}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:"text-content-muted text-sm",children:"Task:"}),l.jsx("span",{className:"text-blue-400 font-medium",children:u})]}),l.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[l.jsx("span",{className:"text-content-muted text-xs",children:"Needs:"}),d.map(g=>l.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded bg-blue-500/20 text-blue-300 font-medium",children:pi[g].name},g))]})]}),l.jsx("button",{onClick:o,className:"text-content-muted hover:text-content transition-colors p-1",children:l.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})}),l.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar max-h-[450px]",children:h.map(([g,v],x)=>l.jsxs("div",{className:"flex flex-col",children:[x>0&&l.jsx("div",{className:"h-px bg-divider mx-6 my-2"}),l.jsx("h3",{className:"text-content-muted text-xs font-bold uppercase tracking-widest px-6 pb-2 pt-5",children:v.name}),v.models.map(_=>{const b=a===_.id,S=_.id===p,C=_.capabilities.filter(j=>d.includes(j)),w=C.length/d.length;return l.jsxs("div",{onClick:()=>c(_.id),title:_.description,className:`group flex items-center gap-4 px-6 py-3.5 cursor-pointer transition-all border-l-2 ${b?"bg-blue-500/10 border-blue-400 shadow-[0_0_15px_rgba(59,130,246,0.1)]":S?"bg-blue-500/5 border-blue-400/50 hover:bg-blue-500/10":"border-transparent hover:bg-surface-overlay"}`,children:[l.jsx("div",{className:`flex items-center justify-center rounded-lg shrink-0 size-10 transition-colors ${b||S?"bg-blue-500/20":"bg-surface-emphasis group-hover:bg-divider"}`,children:l.jsx("span",{className:`material-symbols-outlined text-xl ${b||S?"text-blue-400":"text-content-muted"}`,children:_.icon})}),l.jsxs("div",{className:"flex flex-1 flex-col justify-center min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("p",{className:`text-content text-sm ${b?"font-bold":"font-medium"} truncate`,children:_.name}),S&&l.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"}),_.tier==="premium"&&!S&&l.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"}),_.tier==="fast"&&l.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"})]}),l.jsx("div",{className:"flex gap-1.5 mt-1.5 flex-wrap",children:_.capabilities.map(j=>{const T=C.includes(j);return l.jsx("span",{title:pi[j].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:pi[j].name},j)})})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[w===1?l.jsx("span",{className:"text-emerald-400 text-xs font-bold",children:"100%"}):w>=.5?l.jsxs("span",{className:"text-amber-400 text-xs font-bold",children:[Math.round(w*100),"%"]}):l.jsxs("span",{className:"text-content-muted text-xs font-bold",children:[Math.round(w*100),"%"]}),b&&l.jsx("span",{className:"material-symbols-outlined text-blue-400",children:"check_circle"})]})]},_.id)})]},g))}),l.jsxs("div",{className:"p-5 border-t border-divider bg-surface flex justify-between items-center",children:[l.jsx("div",{children:n&&l.jsx("button",{onClick:()=>{i(),o()},className:"text-rose-400 hover:text-rose-300 text-sm font-medium transition-colors",children:"Remove Override"})}),l.jsxs("div",{className:"flex gap-3",children:[l.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"}),l.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"})]})]})]}),l.jsx("style",{children:`
|
|
622
|
+
.custom-scrollbar::-webkit-scrollbar {
|
|
623
|
+
width: 4px;
|
|
624
|
+
}
|
|
625
|
+
.custom-scrollbar::-webkit-scrollbar-track {
|
|
626
|
+
background: transparent;
|
|
627
|
+
}
|
|
628
|
+
.custom-scrollbar::-webkit-scrollbar-thumb {
|
|
629
|
+
background: var(--color-overlay);
|
|
630
|
+
border-radius: 10px;
|
|
631
|
+
}
|
|
632
|
+
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
|
|
633
|
+
background: #3b82f6;
|
|
634
|
+
}
|
|
635
|
+
`})]})}async function UH(){const e=await fetch("/api/settings");if(!e.ok)throw new Error("Failed to fetch settings");return e.json()}async function qH(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")}return t.json()}async function KH(){const e=await fetch("/api/settings/optimal-defaults");if(!e.ok)throw new Error("Failed to fetch optimal defaults");return e.json()}async function cS(e,t,n){const s=await fetch("/api/settings/test-api-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,apiKey:t,model:n})});if(!s.ok)throw new Error("Failed to test API key");return s.json()}const $m=[{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-..."}],uS=[{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..."}],VH=[{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"}]}],dS="claude-sonnet-4-5";function YH(e){const t=y5(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 XH(){var H,k;const e=Lt(),t=bl(),{data:n,isLoading:s,error:r}=he({queryKey:["settings"],queryFn:UH}),[i,o]=y.useState(null),[a,c]=y.useState({}),[u,d]=y.useState({}),[h,p]=y.useState(null),[f,m]=y.useState(null),[g,v]=y.useState({}),[x,_]=y.useState(null),[b,S]=y.useState(null),[C,w]=y.useState({});y.useEffect(()=>{if(n&&!i&&(o(n),n.deprecation_warnings&&n.deprecation_warnings.length>0)){const I=n.deprecation_warnings.length;uc.warning(`${I} deprecated model${I>1?"s":""} detected. Click "Save" to migrate automatically.`,{duration:1e4})}},[n,i]);const j=we({mutationFn:qH,onSuccess:I=>{e.invalidateQueries({queryKey:["settings"]}),e.invalidateQueries({queryKey:["tracker-status"]}),uc.success("Settings saved successfully"),I.warnings&&I.warnings.length>0&&I.warnings.forEach(M=>{uc.warning(M,{duration:8e3})})},onError:I=>{uc.error(`Failed to save settings: ${I.message}`)}});if(s)return l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx(be,{className:"w-8 h-8 text-blue-400 animate-spin"})});if(r||!i)return l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsxs("div",{className:"text-red-400",children:["Error: ",(r==null?void 0:r.message)||"Failed to load settings"]})});const T=JSON.stringify(i)!==JSON.stringify(n),F=I=>{I!=="anthropic"&&o({...i,models:{...i.models,providers:{...i.models.providers,[I]:!i.models.providers[I]}}})},R=(I,M)=>{I!=="anthropic"&&o({...i,api_keys:{...i.api_keys,[I]:M||void 0}})},B=(I,M)=>{o({...i,tracker_keys:{...i.tracker_keys,[I]:M||void 0}})},A=(I,M)=>{o({...i,models:{...i.models,overrides:{...i.models.overrides,[I]:M}}})},D=I=>{const{[I]:M,...N}=i.models.overrides;o({...i,models:{...i.models,overrides:N}})},P=()=>j.mutate(i),E=()=>o(n||null),$=async()=>{try{const I=await KH(),M={models:{providers:{...(i==null?void 0:i.models.providers)||I.models.providers},overrides:{...I.models.overrides},gemini_thinking_level:I.models.gemini_thinking_level},api_keys:{...(i==null?void 0:i.api_keys)||{}},tracker_keys:{...(i==null?void 0:i.tracker_keys)||{}}};o(M)}catch(I){console.error("Failed to fetch optimal defaults:",I),t({message:"Failed to load optimal defaults: "+I.message,variant:"error"})}},W=async I=>{const M=i==null?void 0:i.api_keys[I];if(M){m(I),v({...g,[I]:null});try{const N=await cS(I,M);v({...g,[I]:N})}catch{v({...g,[I]:{success:!1,error:"Test failed",response:null,latencyMs:0}})}finally{m(null)}}},O=async(I,M)=>{const N=i==null?void 0:i.api_keys[I];if(!N)return;const z=`${I}:${M}`;S(z),w({...C,[z]:null});try{const U=await cS(I,N,M);w({...C,[z]:U})}catch{w({...C,[z]:{success:!1,error:"Test failed",response:null,latencyMs:0}})}finally{S(null)}};return l.jsxs("div",{className:"max-w-[1200px] mx-auto px-6 md:px-10 py-8 pb-32",children:[l.jsx("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center gap-4 mb-8",children:l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx("span",{className:"material-symbols-outlined text-blue-400 text-2xl",children:"settings"}),l.jsx("h1",{className:"text-content text-4xl font-black tracking-tight",children:"Settings"})]}),l.jsx("p",{className:"text-content-muted text-base",children:"Configure AI model orchestration and agent permissions."})]})}),i.deprecation_warnings&&i.deprecation_warnings.length>0&&l.jsx("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-xl px-4 py-3 mb-6",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("span",{className:"material-symbols-outlined text-amber-400 text-xl shrink-0 mt-0.5",children:"warning"}),l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-amber-400 font-semibold mb-2",children:"Deprecated Model IDs Detected"}),l.jsx("div",{className:"space-y-1",children:i.deprecation_warnings.map((I,M)=>l.jsxs("p",{className:"text-amber-400/90 text-sm",children:[l.jsx("span",{className:"font-mono text-xs bg-amber-500/20 px-1.5 py-0.5 rounded",children:I.workType}),": ",l.jsx("span",{className:"font-mono text-xs bg-amber-500/20 px-1.5 py-0.5 rounded line-through",children:I.from})," → ",l.jsx("span",{className:"font-mono text-xs bg-amber-500/20 px-1.5 py-0.5 rounded",children:I.to})]},M))}),l.jsxs("p",{className:"text-amber-400/80 text-xs mt-3",children:["Click ",l.jsx("span",{className:"font-semibold",children:"Save"})," to automatically migrate to current model IDs. A backup will be created before migration."]})]})]})}),l.jsx("section",{className:"mb-10",children:l.jsx("div",{className:"bg-surface-raised border border-divider rounded-xl overflow-hidden",children:l.jsxs("div",{className:"flex flex-col lg:flex-row",children:[l.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:[l.jsx("div",{className:"absolute inset-0 opacity-10 pointer-events-none bg-[radial-gradient(circle_at_50%_50%,#3b82f6_0%,transparent_70%)]"}),l.jsxs("div",{className:"relative z-10 flex flex-col items-center gap-6 w-full max-w-xs",children:[l.jsxs("div",{className:"flex items-center justify-between w-full",children:[l.jsx("div",{className:"size-12 rounded-lg bg-surface-emphasis border border-divider-strong flex items-center justify-center shadow-sm",children:l.jsx("span",{className:"material-symbols-outlined text-content-subtle",children:"terminal"})}),l.jsx("div",{className:"flex-1 h-px bg-gradient-to-r from-divider-strong via-blue-500 to-divider-strong mx-2"}),l.jsx("div",{className:"size-12 rounded-lg bg-surface-emphasis border border-divider-strong flex items-center justify-center shadow-sm",children:l.jsx("span",{className:"material-symbols-outlined text-blue-400",children:"account_tree"})}),l.jsx("div",{className:"flex-1 h-px bg-gradient-to-r from-divider via-blue-500 to-divider mx-2"}),l.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:l.jsx("span",{className:"material-symbols-outlined text-content",children:"bolt"})})]}),l.jsxs("div",{className:"flex justify-between w-full px-2 text-[10px] uppercase tracking-widest font-bold text-content-muted",children:[l.jsx("span",{children:"Task"}),l.jsx("span",{children:"Capability"}),l.jsx("span",{children:"Model"})]})]})]}),l.jsxs("div",{className:"lg:w-3/5 p-8",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[l.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"}),l.jsx("h3",{className:"text-content text-xl font-bold",children:"Smart Model Selection"})]}),l.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."}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("span",{className:"material-symbols-outlined text-blue-400 text-sm mt-1",children:"check_circle"}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-semibold text-content",children:"Capability Matching"}),l.jsx("p",{className:"text-xs text-content-muted",children:"Best model for each task type"})]})]}),l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("span",{className:"material-symbols-outlined text-blue-400 text-sm mt-1",children:"check_circle"}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-semibold text-content",children:"Cost Optimization"}),l.jsx("p",{className:"text-xs text-content-muted",children:"Balance performance vs spend"})]})]})]})]})]})})}),l.jsxs("section",{className:"mb-12",children:[l.jsxs("h2",{className:"text-content text-2xl font-bold mb-6 flex items-center gap-3",children:["Provider Configuration",l.jsx("div",{className:"h-px flex-1 bg-divider-strong"})]}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:$m.map(I=>{var U,K,Q,Y,Z;const M=I.id==="anthropic",N=M||i.models.providers[I.id],z=i.api_keys[I.id]||"";return l.jsxs("div",{className:`bg-surface-raised border rounded-xl p-5 relative transition-colors shadow-sm ${M?"border-blue-500/50 shadow-lg shadow-blue-500/5":"border-divider hover:border-divider-strong"}`,children:[M&&l.jsx("div",{className:"absolute -top-3 right-4",children:l.jsx("span",{className:"bg-blue-500 text-content text-[10px] font-black px-2 py-0.5 rounded uppercase tracking-tighter",children:"Default"})}),l.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[l.jsx("div",{className:"size-10 rounded-lg bg-surface-emphasis border border-divider flex items-center justify-center",children:l.jsx("span",{className:"material-symbols-outlined text-content-subtle",children:I.icon})}),l.jsx("span",{className:"font-bold text-content",children:I.name}),l.jsx("div",{className:"ml-auto",children:l.jsx("button",{onClick:()=>F(I.id),disabled:M,className:`w-10 h-5 rounded-full relative transition-colors ${N?"bg-blue-500":"bg-surface-emphasis"} ${M?"cursor-not-allowed":"cursor-pointer"}`,children:l.jsx("div",{className:`absolute top-0.5 size-4 bg-white rounded-full transition-all ${N?"right-0.5":"left-0.5"}`})})})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"relative",children:[l.jsx("label",{className:"text-[10px] uppercase font-bold text-content-muted mb-1 block",children:"API Key"}),z.startsWith("$")?l.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-lg px-3 py-2",children:[l.jsxs("div",{className:"flex items-center gap-2 text-amber-400 text-xs",children:[l.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"info"}),l.jsxs("span",{children:["Configured via ",l.jsx("code",{className:"font-mono bg-surface-overlay px-1 rounded",children:z})]})]}),l.jsx("p",{className:"text-[10px] text-amber-400/70 mt-1",children:"Set this environment variable or enter the key directly below"}),l.jsx("input",{type:"text",placeholder:I.placeholder,onChange:ue=>R(I.id,ue.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"})]}):l.jsxs("div",{className:"relative",children:[l.jsx("input",{type:a[I.id]?"text":"password",value:z,onChange:ue=>R(I.id,ue.target.value),disabled:M,placeholder:I.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 ${M?"cursor-not-allowed text-content-muted":"text-content-body"}`}),!M&&l.jsx("button",{onClick:()=>c({...a,[I.id]:!a[I.id]}),className:"absolute right-8 top-1/2 -translate-y-1/2 text-content-muted hover:text-content-body",children:l.jsx("span",{className:"material-symbols-outlined text-[16px]",children:a[I.id]?"visibility_off":"visibility"})})]})]}),!M&&l.jsxs("div",{className:"flex flex-col gap-2",children:[z&&!z.startsWith("$")&&l.jsxs("button",{onClick:()=>_(I.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:[l.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"view_list"}),"View Models"]}),z&&!z.startsWith("$")&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("button",{onClick:()=>W(I.id),disabled:f===I.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===I.id?l.jsx(be,{className:"w-3 h-3 animate-spin"}):l.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"quiz"}),"Test 2+3"]}),g[I.id]&&l.jsxs("div",{className:`flex items-center gap-1 text-xs ${(U=g[I.id])!=null&&U.success?"text-green-400":"text-red-400"}`,children:[l.jsx("span",{className:"material-symbols-outlined text-[14px]",children:(K=g[I.id])!=null&&K.success?"check_circle":"error"}),(Q=g[I.id])!=null&&Q.success?`${(Y=g[I.id])==null?void 0:Y.latencyMs}ms`:(Z=g[I.id])==null?void 0:Z.error]})]})]})]})]},I.id)})})]}),l.jsxs("section",{className:"mb-12",children:[l.jsxs("h2",{className:"text-content text-2xl font-bold mb-6 flex items-center gap-3",children:["Tracker API Keys",l.jsx("div",{className:"h-px flex-1 bg-divider-strong"})]}),l.jsxs("p",{className:"text-content-muted text-sm mb-6",children:["Configure API keys for your issue trackers. These override environment variables (",uS.map(I=>I.envVar).join(", "),")."]}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:uS.map(I=>{var N;const M=((N=i.tracker_keys)==null?void 0:N[I.id])||"";return l.jsxs("div",{className:"bg-surface-raised border border-divider rounded-xl p-5 relative transition-colors shadow-sm hover:border-divider-strong",children:[l.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[l.jsx("div",{className:"size-10 rounded-lg bg-surface-emphasis border border-divider flex items-center justify-center",children:l.jsx("span",{className:"material-symbols-outlined text-content-subtle",children:I.icon})}),l.jsxs("div",{children:[l.jsx("span",{className:"font-bold text-content",children:I.name}),l.jsx("p",{className:"text-[10px] text-content-muted font-mono",children:I.envVar})]})]}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{className:"relative",children:[l.jsx("label",{className:"text-[10px] uppercase font-bold text-content-muted mb-1 block",children:"API Key / Token"}),M.startsWith("$")?l.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-lg px-3 py-2",children:[l.jsxs("div",{className:"flex items-center gap-2 text-amber-400 text-xs",children:[l.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"info"}),l.jsxs("span",{children:["Configured via ",l.jsx("code",{className:"font-mono bg-surface-overlay px-1 rounded",children:M})]})]}),l.jsx("input",{type:"text",placeholder:I.placeholder,onChange:z=>B(I.id,z.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"})]}):l.jsxs("div",{className:"relative",children:[l.jsx("input",{type:u[I.id]?"text":"password",value:M,onChange:z=>B(I.id,z.target.value),placeholder:I.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"}),l.jsx("button",{onClick:()=>d({...u,[I.id]:!u[I.id]}),className:"absolute right-2 top-1/2 -translate-y-1/2 text-content-muted hover:text-content-body",children:l.jsx("span",{className:"material-symbols-outlined text-[16px]",children:u[I.id]?"visibility_off":"visibility"})})]})]})})]},I.id)})})]}),l.jsxs("section",{className:"mb-12",children:[l.jsxs("h2",{className:"text-content text-2xl font-bold mb-6 flex items-center gap-3",children:["Model Assignments",l.jsx("div",{className:"h-px flex-1 bg-divider-strong"})]}),l.jsx("div",{className:"space-y-8",children:VH.map(I=>l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[l.jsx("span",{className:"material-symbols-outlined text-content-muted text-lg",children:I.icon}),l.jsx("h3",{className:"text-content-body font-semibold text-sm uppercase tracking-wider",children:I.name}),l.jsx("div",{className:"h-px flex-1 bg-divider"})]}),l.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:I.agents.map(M=>{var fe;const N=i.models.overrides[M.id]||dS,z=YH(N),{score:U,matched:K,missing:Q}=HH(N,M.id),Y=Y0[M.id]||[],Z=(fe=i.deprecation_warnings)==null?void 0:fe.some(Ie=>Ie.workType===M.id&&Ie.from===N),ue=U>=1&&!Z,Oe=U>=.5&&U<1&&!Z,Re=[`${M.name}: ${M.description}`,`Model: ${z}`,Z?"⚠️ DEPRECATED: Click to update to current model":"",`Needs: ${Y.map(Ie=>pi[Ie].name).join(", ")}`,K.length>0?`✓ Has: ${K.map(Ie=>pi[Ie].name).join(", ")}`:"",Q.length>0?`✗ Missing: ${Q.map(Ie=>pi[Ie].name).join(", ")}`:""].filter(Boolean).join(`
|
|
636
|
+
`);return l.jsxs("div",{onClick:()=>p(M.id),title:Re,className:`p-3 border rounded-lg cursor-pointer transition-all group relative ${Z?"bg-amber-500/10 border-amber-500/50 hover:border-amber-500/70 hover:bg-amber-500/15":ue?"bg-emerald-500/5 border-emerald-500/30 hover:border-emerald-500/50 hover:bg-emerald-500/10":Oe?"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:[Z&&l.jsx("div",{className:"absolute top-1 right-1",children:l.jsx("span",{className:"bg-amber-500 text-content text-[8px] font-black px-1 py-0.5 rounded uppercase tracking-tighter",children:"DEPRECATED"})}),l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("span",{className:`material-symbols-outlined text-sm ${Z?"text-amber-400":ue?"text-emerald-400":Oe?"text-amber-400":"text-rose-400"}`,children:M.icon}),l.jsxs("span",{className:`text-[9px] font-bold ${Z?"text-amber-400":ue?"text-emerald-400":Oe?"text-amber-400":"text-rose-400"}`,children:[Math.round(U*100),"%"]})]}),l.jsx("p",{className:"text-xs font-semibold text-content truncate",children:M.name}),l.jsx("p",{className:"text-[10px] text-content-muted truncate mb-2",children:z}),l.jsx("div",{className:"flex gap-1 flex-wrap",children:Y.slice(0,3).map(Ie=>{const Ut=K.includes(Ie);return l.jsx("span",{title:`${pi[Ie].name}: ${Ut?"Model has this":"Model missing this"}`,className:`text-[8px] px-1 py-0.5 rounded ${Ut?"bg-emerald-500/20 text-emerald-400":"bg-rose-500/20 text-rose-400"}`,children:pi[Ie].name},Ie)})})]},M.id)})})]},I.name))})]}),l.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:l.jsxs("div",{className:"max-w-[1200px] mx-auto flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2 text-content-muted text-sm",children:[j.isSuccess&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"material-symbols-outlined text-green-400",children:"check_circle"}),l.jsx("span",{className:"text-green-400",children:"Settings saved!"})]}),j.isError&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"material-symbols-outlined text-red-400",children:"error"}),l.jsx("span",{className:"text-red-400",children:"Error saving settings"})]})]}),l.jsxs("div",{className:"flex gap-4",children:[l.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:[l.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"auto_fix_high"}),"Optimal Defaults"]}),l.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"}),l.jsxs("button",{onClick:P,disabled:!T||j.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:[j.isPending&&l.jsx(be,{className:"w-4 h-4 animate-spin"}),"Save Changes"]})]})]})}),h&&l.jsx(WH,{workType:h,currentModel:i.models.overrides[h]||dS,isOverride:!!i.models.overrides[h],enabledProviders:Object.entries(i.models.providers).filter(([I,M])=>M).map(([I])=>I),onApply:I=>A(h,I),onRemove:()=>D(h),onClose:()=>p(null)}),x&&l.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:l.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:[l.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-divider",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:"material-symbols-outlined text-blue-400",children:(H=$m.find(I=>I.id===x))==null?void 0:H.icon}),l.jsxs("h3",{className:"text-content text-lg font-bold",children:[(k=$m.find(I=>I.id===x))==null?void 0:k.name," Models"]})]}),l.jsx("button",{onClick:()=>_(null),className:"text-content-muted hover:text-content transition-colors",children:l.jsx(yt,{className:"w-5 h-5"})})]}),l.jsx("div",{className:"p-4 overflow-y-auto max-h-[60vh]",children:(()=>{var N;const I=(i==null?void 0:i.api_keys[x])||"",M=I.startsWith("$");return I?M?l.jsxs("div",{className:"text-center py-8",children:[l.jsx("span",{className:"material-symbols-outlined text-4xl text-amber-500 mb-2",children:"warning"}),l.jsx("p",{className:"text-amber-400",children:"API key configured via environment variable"}),l.jsxs("p",{className:"text-content-muted text-sm mt-1",children:[l.jsx("code",{className:"font-mono bg-surface-overlay px-1 rounded",children:I})," is not set"]}),l.jsx("p",{className:"text-content-muted text-xs mt-2",children:"Set the environment variable or enter the key directly in Settings"})]}):l.jsx("div",{className:"space-y-3",children:(((N=V0[x])==null?void 0:N.models)||[]).map(z=>{var Y;const U=`${x}:${z.id}`,K=C[U],Q=b===U;return l.jsx("div",{className:"bg-surface border border-divider rounded-lg p-4 hover:border-divider-strong transition-colors",children:l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx("span",{className:"material-symbols-outlined text-content-muted text-sm",children:z.icon}),l.jsx("h4",{className:"text-content font-semibold",children:z.name}),z.tier&&l.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${z.tier==="premium"?"bg-purple-500/20 text-purple-400":z.tier==="balanced"?"bg-blue-500/20 text-blue-400":"bg-emerald-500/20 text-emerald-400"}`,children:z.tier})]}),z.description&&l.jsx("p",{className:"text-xs text-content-muted mb-2",children:z.description}),l.jsx("div",{className:"flex flex-wrap gap-1",children:z.capabilities.map(Z=>l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 bg-surface-emphasis text-content-subtle rounded border border-divider",children:Z},Z))})]}),l.jsxs("div",{className:"flex flex-col items-end gap-2",children:[l.jsxs("button",{onClick:()=>O(x,z.id),disabled:Q,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:[Q?l.jsx(be,{className:"w-3 h-3 animate-spin"}):l.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"play_arrow"}),"Test 2+3"]}),K&&l.jsxs("div",{className:`flex items-center gap-1 text-xs ${K.success?"text-green-400":"text-red-400"}`,children:[l.jsx("span",{className:"material-symbols-outlined text-[12px]",children:K.success?"check_circle":"error"}),K.success?`${K.latencyMs}ms`:((Y=K.error)==null?void 0:Y.slice(0,30))||"Failed"]})]})]})},z.id)})}):l.jsxs("div",{className:"text-center py-8",children:[l.jsx("span",{className:"material-symbols-outlined text-4xl text-content-muted mb-2",children:"key_off"}),l.jsx("p",{className:"text-content-muted",children:"Enter an API key to test models"})]})})()}),l.jsx("div",{className:"p-4 border-t border-divider bg-surface",children:l.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 hS=1,QH=.9,GH=.8,JH=.17,Hm=.1,Wm=.999,ZH=.9999,e7=.99,t7=/[\\\/_+.#"@\[\(\{&]/,n7=/[\\\/_+.#"@\[\(\{&]/g,s7=/[\s-]/,_5=/[\s-]/g;function Dv(e,t,n,s,r,i,o){if(i===t.length)return r===e.length?hS:e7;var a=`${r},${i}`;if(o[a]!==void 0)return o[a];for(var c=s.charAt(i),u=n.indexOf(c,r),d=0,h,p,f,m;u>=0;)h=Dv(e,t,n,s,u+1,i+1,o),h>d&&(u===r?h*=hS:t7.test(e.charAt(u-1))?(h*=GH,f=e.slice(r,u-1).match(n7),f&&r>0&&(h*=Math.pow(Wm,f.length))):s7.test(e.charAt(u-1))?(h*=QH,m=e.slice(r,u-1).match(_5),m&&r>0&&(h*=Math.pow(Wm,m.length))):(h*=JH,r>0&&(h*=Math.pow(Wm,u-r))),e.charAt(u)!==t.charAt(i)&&(h*=ZH)),(h<Hm&&n.charAt(u-1)===s.charAt(i+1)||s.charAt(i+1)===s.charAt(i)&&n.charAt(u-1)!==s.charAt(i))&&(p=Dv(e,t,n,s,u+1,i+2,o),p*Hm>h&&(h=p*Hm)),h>d&&(d=h),u=n.indexOf(c,u+1);return o[a]=d,d}function fS(e){return e.toLowerCase().replace(_5," ")}function r7(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Dv(e,t,fS(e),fS(t),0,0,{})}function Hi(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function pS(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Vi(...e){return t=>{let n=!1;const s=e.map(r=>{const i=pS(r,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let r=0;r<s.length;r++){const i=s[r];typeof i=="function"?i():pS(e[r],null)}}}}function oa(...e){return y.useCallback(Vi(...e),e)}function i7(e,t){const n=y.createContext(t),s=i=>{const{children:o,...a}=i,c=y.useMemo(()=>a,Object.values(a));return l.jsx(n.Provider,{value:c,children:o})};s.displayName=e+"Provider";function r(i){const o=y.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[s,r]}function o7(e,t=[]){let n=[];function s(i,o){const a=y.createContext(o),c=n.length;n=[...n,o];const u=h=>{var x;const{scope:p,children:f,...m}=h,g=((x=p==null?void 0:p[e])==null?void 0:x[c])||a,v=y.useMemo(()=>m,Object.values(m));return l.jsx(g.Provider,{value:v,children:f})};u.displayName=i+"Provider";function d(h,p){var g;const f=((g=p==null?void 0:p[e])==null?void 0:g[c])||a,m=y.useContext(f);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${i}\``)}return[u,d]}const r=()=>{const i=n.map(o=>y.createContext(o));return function(a){const c=(a==null?void 0:a[e])||i;return y.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return r.scopeName=e,[s,a7(r,...t)]}function a7(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(i){const o=s.reduce((a,{useScope:c,scopeName:u})=>{const h=c(i)[`__scope${u}`];return{...a,...h}},{});return y.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var mu=globalThis!=null&&globalThis.document?y.useLayoutEffect:()=>{},l7=iy[" useId ".trim().toString()]||(()=>{}),c7=0;function zr(e){const[t,n]=y.useState(l7());return mu(()=>{n(s=>s??String(c7++))},[e]),t?`radix-${t}`:""}var u7=iy[" useInsertionEffect ".trim().toString()]||mu;function d7({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[r,i,o]=h7({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:r;{const d=y.useRef(e!==void 0);y.useEffect(()=>{const h=d.current;h!==a&&console.warn(`${s} is changing from ${h?"controlled":"uncontrolled"} to ${a?"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.`),d.current=a},[a,s])}const u=y.useCallback(d=>{var h;if(a){const p=f7(d)?d(e):d;p!==e&&((h=o.current)==null||h.call(o,p))}else i(d)},[a,e,i,o]);return[c,u]}function h7({defaultProp:e,onChange:t}){const[n,s]=y.useState(e),r=y.useRef(n),i=y.useRef(t);return u7(()=>{i.current=t},[t]),y.useEffect(()=>{var o;r.current!==n&&((o=i.current)==null||o.call(i,n),r.current=n)},[n,r]),[n,s,i]}function f7(e){return typeof e=="function"}function Ku(e){const t=p7(e),n=y.forwardRef((s,r)=>{const{children:i,...o}=s,a=y.Children.toArray(i),c=a.find(g7);if(c){const u=c.props.children,d=a.map(h=>h===c?y.Children.count(u)>1?y.Children.only(null):y.isValidElement(u)?u.props.children:null:h);return l.jsx(t,{...o,ref:r,children:y.isValidElement(u)?y.cloneElement(u,void 0,d):null})}return l.jsx(t,{...o,ref:r,children:i})});return n.displayName=`${e}.Slot`,n}function p7(e){const t=y.forwardRef((n,s)=>{const{children:r,...i}=n;if(y.isValidElement(r)){const o=v7(r),a=x7(i,r.props);return r.type!==y.Fragment&&(a.ref=s?Vi(s,o):o),y.cloneElement(r,a)}return y.Children.count(r)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var m7=Symbol("radix.slottable");function g7(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===m7}function x7(e,t){const n={...t};for(const s in t){const r=e[s],i=t[s];/^on[A-Z]/.test(s)?r&&i?n[s]=(...a)=>{const c=i(...a);return r(...a),c}:r&&(n[s]=r):s==="style"?n[s]={...r,...i}:s==="className"&&(n[s]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function v7(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var y7=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],b5=y7.reduce((e,t)=>{const n=Ku(`Primitive.${t}`),s=y.forwardRef((r,i)=>{const{asChild:o,...a}=r,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function _7(e,t){e&&js.flushSync(()=>e.dispatchEvent(t))}function gu(e){const t=y.useRef(e);return y.useEffect(()=>{t.current=e}),y.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function b7(e,t=globalThis==null?void 0:globalThis.document){const n=gu(e);y.useEffect(()=>{const s=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var w7="DismissableLayer",Mv="dismissableLayer.update",S7="dismissableLayer.pointerDownOutside",k7="dismissableLayer.focusOutside",mS,w5=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),S5=y.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:r,onFocusOutside:i,onInteractOutside:o,onDismiss:a,...c}=e,u=y.useContext(w5),[d,h]=y.useState(null),p=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=y.useState({}),m=oa(t,j=>h(j)),g=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=g.indexOf(v),_=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,S=_>=x,C=j7(j=>{const T=j.target,F=[...u.branches].some(R=>R.contains(T));!S||F||(r==null||r(j),o==null||o(j),j.defaultPrevented||a==null||a())},p),w=E7(j=>{const T=j.target;[...u.branches].some(R=>R.contains(T))||(i==null||i(j),o==null||o(j),j.defaultPrevented||a==null||a())},p);return b7(j=>{_===u.layers.size-1&&(s==null||s(j),!j.defaultPrevented&&a&&(j.preventDefault(),a()))},p),y.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(mS=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),gS(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=mS)}},[d,p,n,u]),y.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),gS())},[d,u]),y.useEffect(()=>{const j=()=>f({});return document.addEventListener(Mv,j),()=>document.removeEventListener(Mv,j)},[]),l.jsx(b5.div,{...c,ref:m,style:{pointerEvents:b?S?"auto":"none":void 0,...e.style},onFocusCapture:Hi(e.onFocusCapture,w.onFocusCapture),onBlurCapture:Hi(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:Hi(e.onPointerDownCapture,C.onPointerDownCapture)})});S5.displayName=w7;var C7="DismissableLayerBranch",N7=y.forwardRef((e,t)=>{const n=y.useContext(w5),s=y.useRef(null),r=oa(t,s);return y.useEffect(()=>{const i=s.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),l.jsx(b5.div,{...e,ref:r})});N7.displayName=C7;function j7(e,t=globalThis==null?void 0:globalThis.document){const n=gu(e),s=y.useRef(!1),r=y.useRef(()=>{});return y.useEffect(()=>{const i=a=>{if(a.target&&!s.current){let c=function(){k5(S7,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=c,t.addEventListener("click",r.current,{once:!0})):c()}else t.removeEventListener("click",r.current);s.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",i),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function E7(e,t=globalThis==null?void 0:globalThis.document){const n=gu(e),s=y.useRef(!1);return y.useEffect(()=>{const r=i=>{i.target&&!s.current&&k5(k7,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function gS(){const e=new CustomEvent(Mv);document.dispatchEvent(e)}function k5(e,t,n,{discrete:s}){const r=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),s?_7(r,i):r.dispatchEvent(i)}var P7=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],T7=P7.reduce((e,t)=>{const n=Ku(`Primitive.${t}`),s=y.forwardRef((r,i)=>{const{asChild:o,...a}=r,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),Um="focusScope.autoFocusOnMount",qm="focusScope.autoFocusOnUnmount",xS={bubbles:!1,cancelable:!0},R7="FocusScope",C5=y.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:r,onUnmountAutoFocus:i,...o}=e,[a,c]=y.useState(null),u=gu(r),d=gu(i),h=y.useRef(null),p=oa(t,g=>c(g)),f=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(s){let g=function(b){if(f.paused||!a)return;const S=b.target;a.contains(S)?h.current=S:ai(h.current,{select:!0})},v=function(b){if(f.paused||!a)return;const S=b.relatedTarget;S!==null&&(a.contains(S)||ai(h.current,{select:!0}))},x=function(b){if(document.activeElement===document.body)for(const C of b)C.removedNodes.length>0&&ai(a)};document.addEventListener("focusin",g),document.addEventListener("focusout",v);const _=new MutationObserver(x);return a&&_.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",v),_.disconnect()}}},[s,a,f.paused]),y.useEffect(()=>{if(a){yS.add(f);const g=document.activeElement;if(!a.contains(g)){const x=new CustomEvent(Um,xS);a.addEventListener(Um,u),a.dispatchEvent(x),x.defaultPrevented||(D7(I7(N5(a)),{select:!0}),document.activeElement===g&&ai(a))}return()=>{a.removeEventListener(Um,u),setTimeout(()=>{const x=new CustomEvent(qm,xS);a.addEventListener(qm,d),a.dispatchEvent(x),x.defaultPrevented||ai(g??document.body,{select:!0}),a.removeEventListener(qm,d),yS.remove(f)},0)}}},[a,u,d,f]);const m=y.useCallback(g=>{if(!n&&!s||f.paused)return;const v=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,x=document.activeElement;if(v&&x){const _=g.currentTarget,[b,S]=M7(_);b&&S?!g.shiftKey&&x===S?(g.preventDefault(),n&&ai(b,{select:!0})):g.shiftKey&&x===b&&(g.preventDefault(),n&&ai(S,{select:!0})):x===_&&g.preventDefault()}},[n,s,f.paused]);return l.jsx(T7.div,{tabIndex:-1,...o,ref:p,onKeyDown:m})});C5.displayName=R7;function D7(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(ai(s,{select:t}),document.activeElement!==n)return}function M7(e){const t=N5(e),n=vS(t,e),s=vS(t.reverse(),e);return[n,s]}function N5(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const r=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||r?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function vS(e,t){for(const n of e)if(!L7(n,{upTo:t}))return n}function L7(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 A7(e){return e instanceof HTMLInputElement&&"select"in e}function ai(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&A7(e)&&t&&e.select()}}var yS=O7();function O7(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=_S(e,t),e.unshift(t)},remove(t){var n;e=_S(e,t),(n=e[0])==null||n.resume()}}}function _S(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function I7(e){return e.filter(t=>t.tagName!=="A")}var F7=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],B7=F7.reduce((e,t)=>{const n=Ku(`Primitive.${t}`),s=y.forwardRef((r,i)=>{const{asChild:o,...a}=r,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),z7="Portal",j5=y.forwardRef((e,t)=>{var a;const{container:n,...s}=e,[r,i]=y.useState(!1);mu(()=>i(!0),[]);const o=n||r&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?MN.createPortal(l.jsx(B7.div,{...s,ref:t}),o):null});j5.displayName=z7;function $7(e,t){return y.useReducer((n,s)=>t[n][s]??n,e)}var _p=e=>{const{present:t,children:n}=e,s=H7(t),r=typeof n=="function"?n({present:s.isPresent}):y.Children.only(n),i=oa(s.ref,W7(r));return typeof n=="function"||s.isPresent?y.cloneElement(r,{ref:i}):null};_p.displayName="Presence";function H7(e){const[t,n]=y.useState(),s=y.useRef(null),r=y.useRef(e),i=y.useRef("none"),o=e?"mounted":"unmounted",[a,c]=$7(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const u=Ld(s.current);i.current=a==="mounted"?u:"none"},[a]),mu(()=>{const u=s.current,d=r.current;if(d!==e){const p=i.current,f=Ld(u);e?c("MOUNT"):f==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&p!==f?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,c]),mu(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,h=f=>{const g=Ld(s.current).includes(CSS.escape(f.animationName));if(f.target===t&&g&&(c("ANIMATION_END"),!r.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},p=f=>{f.target===t&&(i.current=Ld(s.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:y.useCallback(u=>{s.current=u?getComputedStyle(u):null,n(u)},[])}}function Ld(e){return(e==null?void 0:e.animationName)||"none"}function W7(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var U7=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Vu=U7.reduce((e,t)=>{const n=Ku(`Primitive.${t}`),s=y.forwardRef((r,i)=>{const{asChild:o,...a}=r,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),Km=0;function q7(){y.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??bS()),document.body.insertAdjacentElement("beforeend",e[1]??bS()),Km++,()=>{Km===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Km--}},[])}function bS(){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 lr=function(){return lr=Object.assign||function(t){for(var n,s=1,r=arguments.length;s<r;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},lr.apply(this,arguments)};function E5(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(n[s[r]]=e[s[r]]);return n}function K7(e,t,n){if(n||arguments.length===2)for(var s=0,r=t.length,i;s<r;s++)(i||!(s in t))&&(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))}var jh="right-scroll-bar-position",Eh="width-before-scroll-bar",V7="with-scroll-bars-hidden",Y7="--removed-body-scroll-bar-size";function Vm(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function X7(e,t){var n=y.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var r=n.value;r!==s&&(n.value=s,n.callback(s,r))}}}})[0];return n.callback=t,n.facade}var Q7=typeof window<"u"?y.useLayoutEffect:y.useEffect,wS=new WeakMap;function G7(e,t){var n=X7(null,function(s){return e.forEach(function(r){return Vm(r,s)})});return Q7(function(){var s=wS.get(n);if(s){var r=new Set(s),i=new Set(e),o=n.current;r.forEach(function(a){i.has(a)||Vm(a,null)}),i.forEach(function(a){r.has(a)||Vm(a,o)})}wS.set(n,e)},[e]),n}function J7(e){return e}function Z7(e,t){t===void 0&&(t=J7);var n=[],s=!1,r={read:function(){if(s)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,s);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(i){for(s=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){s=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(i),o=n}var c=function(){var d=o;o=[],d.forEach(i)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){o.push(d),u()},filter:function(d){return o=o.filter(d),n}}}};return r}function eW(e){e===void 0&&(e={});var t=Z7(null);return t.options=lr({async:!0,ssr:!1},e),t}var P5=function(e){var t=e.sideCar,n=E5(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return y.createElement(s,lr({},n))};P5.isSideCarExport=!0;function tW(e,t){return e.useMedium(t),P5}var T5=eW(),Ym=function(){},bp=y.forwardRef(function(e,t){var n=y.useRef(null),s=y.useState({onScrollCapture:Ym,onWheelCapture:Ym,onTouchMoveCapture:Ym}),r=s[0],i=s[1],o=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,h=e.shards,p=e.sideCar,f=e.noRelative,m=e.noIsolation,g=e.inert,v=e.allowPinchZoom,x=e.as,_=x===void 0?"div":x,b=e.gapMode,S=E5(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=p,w=G7([n,t]),j=lr(lr({},S),r);return y.createElement(y.Fragment,null,d&&y.createElement(C,{sideCar:T5,removeScrollBar:u,shards:h,noRelative:f,noIsolation:m,inert:g,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:b}),o?y.cloneElement(y.Children.only(a),lr(lr({},j),{ref:w})):y.createElement(_,lr({},j,{className:c,ref:w}),a))});bp.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};bp.classNames={fullWidth:Eh,zeroRight:jh};var nW=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function sW(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=nW();return t&&e.setAttribute("nonce",t),e}function rW(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function iW(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var oW=function(){var e=0,t=null;return{add:function(n){e==0&&(t=sW())&&(rW(t,n),iW(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},aW=function(){var e=oW();return function(t,n){y.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},R5=function(){var e=aW(),t=function(n){var s=n.styles,r=n.dynamic;return e(s,r),null};return t},lW={left:0,top:0,right:0,gap:0},Xm=function(e){return parseInt(e||"",10)||0},cW=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],r=t[e==="padding"?"paddingRight":"marginRight"];return[Xm(n),Xm(s),Xm(r)]},uW=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return lW;var t=cW(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},dW=R5(),$a="data-scroll-locked",hW=function(e,t,n,s){var r=e.left,i=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
637
|
+
.`.concat(V7,` {
|
|
638
|
+
overflow: hidden `).concat(s,`;
|
|
639
|
+
padding-right: `).concat(a,"px ").concat(s,`;
|
|
640
|
+
}
|
|
641
|
+
body[`).concat($a,`] {
|
|
642
|
+
overflow: hidden `).concat(s,`;
|
|
643
|
+
overscroll-behavior: contain;
|
|
644
|
+
`).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
|
|
645
|
+
padding-left: `.concat(r,`px;
|
|
646
|
+
padding-top: `).concat(i,`px;
|
|
647
|
+
padding-right: `).concat(o,`px;
|
|
648
|
+
margin-left:0;
|
|
649
|
+
margin-top:0;
|
|
650
|
+
margin-right: `).concat(a,"px ").concat(s,`;
|
|
651
|
+
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(s,";")].filter(Boolean).join(""),`
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
.`).concat(jh,` {
|
|
655
|
+
right: `).concat(a,"px ").concat(s,`;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
.`).concat(Eh,` {
|
|
659
|
+
margin-right: `).concat(a,"px ").concat(s,`;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
.`).concat(jh," .").concat(jh,` {
|
|
663
|
+
right: 0 `).concat(s,`;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
.`).concat(Eh," .").concat(Eh,` {
|
|
667
|
+
margin-right: 0 `).concat(s,`;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
body[`).concat($a,`] {
|
|
671
|
+
`).concat(Y7,": ").concat(a,`px;
|
|
672
|
+
}
|
|
673
|
+
`)},SS=function(){var e=parseInt(document.body.getAttribute($a)||"0",10);return isFinite(e)?e:0},fW=function(){y.useEffect(function(){return document.body.setAttribute($a,(SS()+1).toString()),function(){var e=SS()-1;e<=0?document.body.removeAttribute($a):document.body.setAttribute($a,e.toString())}},[])},pW=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,r=s===void 0?"margin":s;fW();var i=y.useMemo(function(){return uW(r)},[r]);return y.createElement(dW,{styles:hW(i,!t,r,n?"":"!important")})},Lv=!1;if(typeof window<"u")try{var Ad=Object.defineProperty({},"passive",{get:function(){return Lv=!0,!0}});window.addEventListener("test",Ad,Ad),window.removeEventListener("test",Ad,Ad)}catch{Lv=!1}var ha=Lv?{passive:!1}:!1,mW=function(e){return e.tagName==="TEXTAREA"},D5=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!mW(e)&&n[t]==="visible")},gW=function(e){return D5(e,"overflowY")},xW=function(e){return D5(e,"overflowX")},kS=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var r=M5(e,s);if(r){var i=L5(e,s),o=i[1],a=i[2];if(o>a)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},vW=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},yW=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},M5=function(e,t){return e==="v"?gW(t):xW(t)},L5=function(e,t){return e==="v"?vW(t):yW(t)},_W=function(e,t){return e==="h"&&t==="rtl"?-1:1},bW=function(e,t,n,s,r){var i=_W(e,window.getComputedStyle(t).direction),o=i*s,a=n.target,c=t.contains(a),u=!1,d=o>0,h=0,p=0;do{if(!a)break;var f=L5(e,a),m=f[0],g=f[1],v=f[2],x=g-v-i*m;(m||x)&&M5(e,a)&&(h+=x,p+=m);var _=a.parentNode;a=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(d&&Math.abs(h)<1||!d&&Math.abs(p)<1)&&(u=!0),u},Od=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},CS=function(e){return[e.deltaX,e.deltaY]},NS=function(e){return e&&"current"in e?e.current:e},wW=function(e,t){return e[0]===t[0]&&e[1]===t[1]},SW=function(e){return`
|
|
674
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
675
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
676
|
+
`)},kW=0,fa=[];function CW(e){var t=y.useRef([]),n=y.useRef([0,0]),s=y.useRef(),r=y.useState(kW++)[0],i=y.useState(R5)[0],o=y.useRef(e);y.useEffect(function(){o.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var g=K7([e.lockRef.current],(e.shards||[]).map(NS),!0).filter(Boolean);return g.forEach(function(v){return v.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),g.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var a=y.useCallback(function(g,v){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!o.current.allowPinchZoom;var x=Od(g),_=n.current,b="deltaX"in g?g.deltaX:_[0]-x[0],S="deltaY"in g?g.deltaY:_[1]-x[1],C,w=g.target,j=Math.abs(b)>Math.abs(S)?"h":"v";if("touches"in g&&j==="h"&&w.type==="range")return!1;var T=window.getSelection(),F=T&&T.anchorNode,R=F?F===w||F.contains(w):!1;if(R)return!1;var B=kS(j,w);if(!B)return!0;if(B?C=j:(C=j==="v"?"h":"v",B=kS(j,w)),!B)return!1;if(!s.current&&"changedTouches"in g&&(b||S)&&(s.current=C),!C)return!0;var A=s.current||C;return bW(A,v,g,A==="h"?b:S)},[]),c=y.useCallback(function(g){var v=g;if(!(!fa.length||fa[fa.length-1]!==i)){var x="deltaY"in v?CS(v):Od(v),_=t.current.filter(function(C){return C.name===v.type&&(C.target===v.target||v.target===C.shadowParent)&&wW(C.delta,x)})[0];if(_&&_.should){v.cancelable&&v.preventDefault();return}if(!_){var b=(o.current.shards||[]).map(NS).filter(Boolean).filter(function(C){return C.contains(v.target)}),S=b.length>0?a(v,b[0]):!o.current.noIsolation;S&&v.cancelable&&v.preventDefault()}}},[]),u=y.useCallback(function(g,v,x,_){var b={name:g,delta:v,target:x,should:_,shadowParent:NW(x)};t.current.push(b),setTimeout(function(){t.current=t.current.filter(function(S){return S!==b})},1)},[]),d=y.useCallback(function(g){n.current=Od(g),s.current=void 0},[]),h=y.useCallback(function(g){u(g.type,CS(g),g.target,a(g,e.lockRef.current))},[]),p=y.useCallback(function(g){u(g.type,Od(g),g.target,a(g,e.lockRef.current))},[]);y.useEffect(function(){return fa.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:p}),document.addEventListener("wheel",c,ha),document.addEventListener("touchmove",c,ha),document.addEventListener("touchstart",d,ha),function(){fa=fa.filter(function(g){return g!==i}),document.removeEventListener("wheel",c,ha),document.removeEventListener("touchmove",c,ha),document.removeEventListener("touchstart",d,ha)}},[]);var f=e.removeScrollBar,m=e.inert;return y.createElement(y.Fragment,null,m?y.createElement(i,{styles:SW(r)}):null,f?y.createElement(pW,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function NW(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const jW=tW(T5,CW);var A5=y.forwardRef(function(e,t){return y.createElement(bp,lr({},e,{ref:t,sideCar:jW}))});A5.classNames=bp.classNames;var EW=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},pa=new WeakMap,Id=new WeakMap,Fd={},Qm=0,O5=function(e){return e&&(e.host||O5(e.parentNode))},PW=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=O5(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},TW=function(e,t,n,s){var r=PW(t,Array.isArray(e)?e:[e]);Fd[n]||(Fd[n]=new WeakMap);var i=Fd[n],o=[],a=new Set,c=new Set(r),u=function(h){!h||a.has(h)||(a.add(h),u(h.parentNode))};r.forEach(u);var d=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(p){if(a.has(p))d(p);else try{var f=p.getAttribute(s),m=f!==null&&f!=="false",g=(pa.get(p)||0)+1,v=(i.get(p)||0)+1;pa.set(p,g),i.set(p,v),o.push(p),g===1&&m&&Id.set(p,!0),v===1&&p.setAttribute(n,"true"),m||p.setAttribute(s,"true")}catch(x){console.error("aria-hidden: cannot operate on ",p,x)}})};return d(t),a.clear(),Qm++,function(){o.forEach(function(h){var p=pa.get(h)-1,f=i.get(h)-1;pa.set(h,p),i.set(h,f),p||(Id.has(h)||h.removeAttribute(s),Id.delete(h)),f||h.removeAttribute(n)}),Qm--,Qm||(pa=new WeakMap,pa=new WeakMap,Id=new WeakMap,Fd={})}},RW=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),r=EW(e);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live], script"))),TW(s,r,n,"aria-hidden")):function(){return null}},wp="Dialog",[I5]=o7(wp),[DW,Vs]=I5(wp),F5=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:r,onOpenChange:i,modal:o=!0}=e,a=y.useRef(null),c=y.useRef(null),[u,d]=d7({prop:s,defaultProp:r??!1,onChange:i,caller:wp});return l.jsx(DW,{scope:t,triggerRef:a,contentRef:c,contentId:zr(),titleId:zr(),descriptionId:zr(),open:u,onOpenChange:d,onOpenToggle:y.useCallback(()=>d(h=>!h),[d]),modal:o,children:n})};F5.displayName=wp;var B5="DialogTrigger",MW=y.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Vs(B5,n),i=oa(t,r.triggerRef);return l.jsx(Vu.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":G0(r.open),...s,ref:i,onClick:Hi(e.onClick,r.onOpenToggle)})});MW.displayName=B5;var X0="DialogPortal",[LW,z5]=I5(X0,{forceMount:void 0}),$5=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:r}=e,i=Vs(X0,t);return l.jsx(LW,{scope:t,forceMount:n,children:y.Children.map(s,o=>l.jsx(_p,{present:n||i.open,children:l.jsx(j5,{asChild:!0,container:r,children:o})}))})};$5.displayName=X0;var Cf="DialogOverlay",H5=y.forwardRef((e,t)=>{const n=z5(Cf,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,i=Vs(Cf,e.__scopeDialog);return i.modal?l.jsx(_p,{present:s||i.open,children:l.jsx(OW,{...r,ref:t})}):null});H5.displayName=Cf;var AW=Ku("DialogOverlay.RemoveScroll"),OW=y.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Vs(Cf,n);return l.jsx(A5,{as:AW,allowPinchZoom:!0,shards:[r.contentRef],children:l.jsx(Vu.div,{"data-state":G0(r.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),Go="DialogContent",W5=y.forwardRef((e,t)=>{const n=z5(Go,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,i=Vs(Go,e.__scopeDialog);return l.jsx(_p,{present:s||i.open,children:i.modal?l.jsx(IW,{...r,ref:t}):l.jsx(FW,{...r,ref:t})})});W5.displayName=Go;var IW=y.forwardRef((e,t)=>{const n=Vs(Go,e.__scopeDialog),s=y.useRef(null),r=oa(t,n.contentRef,s);return y.useEffect(()=>{const i=s.current;if(i)return RW(i)},[]),l.jsx(U5,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Hi(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Hi(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:Hi(e.onFocusOutside,i=>i.preventDefault())})}),FW=y.forwardRef((e,t)=>{const n=Vs(Go,e.__scopeDialog),s=y.useRef(!1),r=y.useRef(!1);return l.jsx(U5,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(s.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),s.current=!1,r.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(s.current=!0,i.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&r.current&&i.preventDefault()}})}),U5=y.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:i,...o}=e,a=Vs(Go,n),c=y.useRef(null),u=oa(t,c);return q7(),l.jsxs(l.Fragment,{children:[l.jsx(C5,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:r,onUnmountAutoFocus:i,children:l.jsx(S5,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":G0(a.open),...o,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(HW,{titleId:a.titleId}),l.jsx(UW,{contentRef:c,descriptionId:a.descriptionId})]})]})}),Q0="DialogTitle",BW=y.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Vs(Q0,n);return l.jsx(Vu.h2,{id:r.titleId,...s,ref:t})});BW.displayName=Q0;var q5="DialogDescription",zW=y.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Vs(q5,n);return l.jsx(Vu.p,{id:r.descriptionId,...s,ref:t})});zW.displayName=q5;var K5="DialogClose",$W=y.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Vs(K5,n);return l.jsx(Vu.button,{type:"button",...s,ref:t,onClick:Hi(e.onClick,()=>r.onOpenChange(!1))})});$W.displayName=K5;function G0(e){return e?"open":"closed"}var V5="DialogTitleWarning",[rte,Y5]=i7(V5,{contentName:Go,titleName:Q0,docsSlug:"dialog"}),HW=({titleId:e})=>{const t=Y5(V5),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
677
|
+
|
|
678
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
679
|
+
|
|
680
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return y.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},WW="DialogDescriptionWarning",UW=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Y5(WW).contentName}}.`;return y.useEffect(()=>{var i;const r=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},qW=F5,KW=$5,VW=H5,YW=W5,XW=Symbol.for("react.lazy"),Nf=iy[" use ".trim().toString()];function QW(e){return typeof e=="object"&&e!==null&&"then"in e}function X5(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===XW&&"_payload"in e&&QW(e._payload)}function GW(e){const t=JW(e),n=y.forwardRef((s,r)=>{let{children:i,...o}=s;X5(i)&&typeof Nf=="function"&&(i=Nf(i._payload));const a=y.Children.toArray(i),c=a.find(eU);if(c){const u=c.props.children,d=a.map(h=>h===c?y.Children.count(u)>1?y.Children.only(null):y.isValidElement(u)?u.props.children:null:h);return l.jsx(t,{...o,ref:r,children:y.isValidElement(u)?y.cloneElement(u,void 0,d):null})}return l.jsx(t,{...o,ref:r,children:i})});return n.displayName=`${e}.Slot`,n}function JW(e){const t=y.forwardRef((n,s)=>{let{children:r,...i}=n;if(X5(r)&&typeof Nf=="function"&&(r=Nf(r._payload)),y.isValidElement(r)){const o=nU(r),a=tU(i,r.props);return r.type!==y.Fragment&&(a.ref=s?Vi(s,o):o),y.cloneElement(r,a)}return y.Children.count(r)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ZW=Symbol("radix.slottable");function eU(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ZW}function tU(e,t){const n={...t};for(const s in t){const r=e[s],i=t[s];/^on[A-Z]/.test(s)?r&&i?n[s]=(...a)=>{const c=i(...a);return r(...a),c}:r&&(n[s]=r):s==="style"?n[s]={...r,...i}:s==="className"&&(n[s]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function nU(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var sU=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],eo=sU.reduce((e,t)=>{const n=GW(`Primitive.${t}`),s=y.forwardRef((r,i)=>{const{asChild:o,...a}=r,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),Jl='[cmdk-group=""]',Gm='[cmdk-group-items=""]',rU='[cmdk-group-heading=""]',Q5='[cmdk-item=""]',jS=`${Q5}:not([aria-disabled="true"])`,Av="cmdk-item-select",ga="data-value",iU=(e,t,n)=>r7(e,t,n),G5=y.createContext(void 0),Yu=()=>y.useContext(G5),J5=y.createContext(void 0),J0=()=>y.useContext(J5),Z5=y.createContext(void 0),eP=y.forwardRef((e,t)=>{let n=xa(()=>{var M,N;return{search:"",value:(N=(M=e.value)!=null?M:e.defaultValue)!=null?N:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=xa(()=>new Set),r=xa(()=>new Map),i=xa(()=>new Map),o=xa(()=>new Set),a=tP(e),{label:c,children:u,value:d,onValueChange:h,filter:p,shouldFilter:f,loop:m,disablePointerSelection:g=!1,vimBindings:v=!0,...x}=e,_=zr(),b=zr(),S=zr(),C=y.useRef(null),w=gU();Jo(()=>{if(d!==void 0){let M=d.trim();n.current.value=M,j.emit()}},[d]),Jo(()=>{w(6,D)},[]);let j=y.useMemo(()=>({subscribe:M=>(o.current.add(M),()=>o.current.delete(M)),snapshot:()=>n.current,setState:(M,N,z)=>{var U,K,Q,Y;if(!Object.is(n.current[M],N)){if(n.current[M]=N,M==="search")A(),R(),w(1,B);else if(M==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Z=document.getElementById(S);Z?Z.focus():(U=document.getElementById(_))==null||U.focus()}if(w(7,()=>{var Z;n.current.selectedItemId=(Z=P())==null?void 0:Z.id,j.emit()}),z||w(5,D),((K=a.current)==null?void 0:K.value)!==void 0){let Z=N??"";(Y=(Q=a.current).onValueChange)==null||Y.call(Q,Z);return}}j.emit()}},emit:()=>{o.current.forEach(M=>M())}}),[]),T=y.useMemo(()=>({value:(M,N,z)=>{var U;N!==((U=i.current.get(M))==null?void 0:U.value)&&(i.current.set(M,{value:N,keywords:z}),n.current.filtered.items.set(M,F(N,z)),w(2,()=>{R(),j.emit()}))},item:(M,N)=>(s.current.add(M),N&&(r.current.has(N)?r.current.get(N).add(M):r.current.set(N,new Set([M]))),w(3,()=>{A(),R(),n.current.value||B(),j.emit()}),()=>{i.current.delete(M),s.current.delete(M),n.current.filtered.items.delete(M);let z=P();w(4,()=>{A(),(z==null?void 0:z.getAttribute("id"))===M&&B(),j.emit()})}),group:M=>(r.current.has(M)||r.current.set(M,new Set),()=>{i.current.delete(M),r.current.delete(M)}),filter:()=>a.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:_,inputId:S,labelId:b,listInnerRef:C}),[]);function F(M,N){var z,U;let K=(U=(z=a.current)==null?void 0:z.filter)!=null?U:iU;return M?K(M,n.current.search,N):0}function R(){if(!n.current.search||a.current.shouldFilter===!1)return;let M=n.current.filtered.items,N=[];n.current.filtered.groups.forEach(U=>{let K=r.current.get(U),Q=0;K.forEach(Y=>{let Z=M.get(Y);Q=Math.max(Z,Q)}),N.push([U,Q])});let z=C.current;E().sort((U,K)=>{var Q,Y;let Z=U.getAttribute("id"),ue=K.getAttribute("id");return((Q=M.get(ue))!=null?Q:0)-((Y=M.get(Z))!=null?Y:0)}).forEach(U=>{let K=U.closest(Gm);K?K.appendChild(U.parentElement===K?U:U.closest(`${Gm} > *`)):z.appendChild(U.parentElement===z?U:U.closest(`${Gm} > *`))}),N.sort((U,K)=>K[1]-U[1]).forEach(U=>{var K;let Q=(K=C.current)==null?void 0:K.querySelector(`${Jl}[${ga}="${encodeURIComponent(U[0])}"]`);Q==null||Q.parentElement.appendChild(Q)})}function B(){let M=E().find(z=>z.getAttribute("aria-disabled")!=="true"),N=M==null?void 0:M.getAttribute(ga);j.setState("value",N||void 0)}function A(){var M,N,z,U;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=s.current.size;return}n.current.filtered.groups=new Set;let K=0;for(let Q of s.current){let Y=(N=(M=i.current.get(Q))==null?void 0:M.value)!=null?N:"",Z=(U=(z=i.current.get(Q))==null?void 0:z.keywords)!=null?U:[],ue=F(Y,Z);n.current.filtered.items.set(Q,ue),ue>0&&K++}for(let[Q,Y]of r.current)for(let Z of Y)if(n.current.filtered.items.get(Z)>0){n.current.filtered.groups.add(Q);break}n.current.filtered.count=K}function D(){var M,N,z;let U=P();U&&(((M=U.parentElement)==null?void 0:M.firstChild)===U&&((z=(N=U.closest(Jl))==null?void 0:N.querySelector(rU))==null||z.scrollIntoView({block:"nearest"})),U.scrollIntoView({block:"nearest"}))}function P(){var M;return(M=C.current)==null?void 0:M.querySelector(`${Q5}[aria-selected="true"]`)}function E(){var M;return Array.from(((M=C.current)==null?void 0:M.querySelectorAll(jS))||[])}function $(M){let N=E()[M];N&&j.setState("value",N.getAttribute(ga))}function W(M){var N;let z=P(),U=E(),K=U.findIndex(Y=>Y===z),Q=U[K+M];(N=a.current)!=null&&N.loop&&(Q=K+M<0?U[U.length-1]:K+M===U.length?U[0]:U[K+M]),Q&&j.setState("value",Q.getAttribute(ga))}function O(M){let N=P(),z=N==null?void 0:N.closest(Jl),U;for(;z&&!U;)z=M>0?pU(z,Jl):mU(z,Jl),U=z==null?void 0:z.querySelector(jS);U?j.setState("value",U.getAttribute(ga)):W(M)}let H=()=>$(E().length-1),k=M=>{M.preventDefault(),M.metaKey?H():M.altKey?O(1):W(1)},I=M=>{M.preventDefault(),M.metaKey?$(0):M.altKey?O(-1):W(-1)};return y.createElement(eo.div,{ref:t,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:M=>{var N;(N=x.onKeyDown)==null||N.call(x,M);let z=M.nativeEvent.isComposing||M.keyCode===229;if(!(M.defaultPrevented||z))switch(M.key){case"n":case"j":{v&&M.ctrlKey&&k(M);break}case"ArrowDown":{k(M);break}case"p":case"k":{v&&M.ctrlKey&&I(M);break}case"ArrowUp":{I(M);break}case"Home":{M.preventDefault(),$(0);break}case"End":{M.preventDefault(),H();break}case"Enter":{M.preventDefault();let U=P();if(U){let K=new Event(Av);U.dispatchEvent(K)}}}}},y.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:vU},c),Sp(e,M=>y.createElement(J5.Provider,{value:j},y.createElement(G5.Provider,{value:T},M))))}),oU=y.forwardRef((e,t)=>{var n,s;let r=zr(),i=y.useRef(null),o=y.useContext(Z5),a=Yu(),c=tP(e),u=(s=(n=c.current)==null?void 0:n.forceMount)!=null?s:o==null?void 0:o.forceMount;Jo(()=>{if(!u)return a.item(r,o==null?void 0:o.id)},[u]);let d=nP(r,i,[e.value,e.children,i],e.keywords),h=J0(),p=Yi(w=>w.value&&w.value===d.current),f=Yi(w=>u||a.filter()===!1?!0:w.search?w.filtered.items.get(r)>0:!0);y.useEffect(()=>{let w=i.current;if(!(!w||e.disabled))return w.addEventListener(Av,m),()=>w.removeEventListener(Av,m)},[f,e.onSelect,e.disabled]);function m(){var w,j;g(),(j=(w=c.current).onSelect)==null||j.call(w,d.current)}function g(){h.setState("value",d.current,!0)}if(!f)return null;let{disabled:v,value:x,onSelect:_,forceMount:b,keywords:S,...C}=e;return y.createElement(eo.div,{ref:Vi(i,t),...C,id:r,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!p,"data-disabled":!!v,"data-selected":!!p,onPointerMove:v||a.getDisablePointerSelection()?void 0:g,onClick:v?void 0:m},e.children)}),aU=y.forwardRef((e,t)=>{let{heading:n,children:s,forceMount:r,...i}=e,o=zr(),a=y.useRef(null),c=y.useRef(null),u=zr(),d=Yu(),h=Yi(f=>r||d.filter()===!1?!0:f.search?f.filtered.groups.has(o):!0);Jo(()=>d.group(o),[]),nP(o,a,[e.value,e.heading,c]);let p=y.useMemo(()=>({id:o,forceMount:r}),[r]);return y.createElement(eo.div,{ref:Vi(a,t),...i,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},n&&y.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),Sp(e,f=>y.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},y.createElement(Z5.Provider,{value:p},f))))}),lU=y.forwardRef((e,t)=>{let{alwaysRender:n,...s}=e,r=y.useRef(null),i=Yi(o=>!o.search);return!n&&!i?null:y.createElement(eo.div,{ref:Vi(r,t),...s,"cmdk-separator":"",role:"separator"})}),cU=y.forwardRef((e,t)=>{let{onValueChange:n,...s}=e,r=e.value!=null,i=J0(),o=Yi(u=>u.search),a=Yi(u=>u.selectedItemId),c=Yu();return y.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),y.createElement(eo.input,{ref:t,...s,"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":a,id:c.inputId,type:"text",value:r?e.value:o,onChange:u=>{r||i.setState("search",u.target.value),n==null||n(u.target.value)}})}),uU=y.forwardRef((e,t)=>{let{children:n,label:s="Suggestions",...r}=e,i=y.useRef(null),o=y.useRef(null),a=Yi(u=>u.selectedItemId),c=Yu();return y.useEffect(()=>{if(o.current&&i.current){let u=o.current,d=i.current,h,p=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let f=u.offsetHeight;d.style.setProperty("--cmdk-list-height",f.toFixed(1)+"px")})});return p.observe(u),()=>{cancelAnimationFrame(h),p.unobserve(u)}}},[]),y.createElement(eo.div,{ref:Vi(i,t),...r,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":s,id:c.listId},Sp(e,u=>y.createElement("div",{ref:Vi(o,c.listInnerRef),"cmdk-list-sizer":""},u)))}),dU=y.forwardRef((e,t)=>{let{open:n,onOpenChange:s,overlayClassName:r,contentClassName:i,container:o,...a}=e;return y.createElement(qW,{open:n,onOpenChange:s},y.createElement(KW,{container:o},y.createElement(VW,{"cmdk-overlay":"",className:r}),y.createElement(YW,{"aria-label":e.label,"cmdk-dialog":"",className:i},y.createElement(eP,{ref:t,...a}))))}),hU=y.forwardRef((e,t)=>Yi(n=>n.filtered.count===0)?y.createElement(eo.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),fU=y.forwardRef((e,t)=>{let{progress:n,children:s,label:r="Loading...",...i}=e;return y.createElement(eo.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":r},Sp(e,o=>y.createElement("div",{"aria-hidden":!0},o)))}),Oc=Object.assign(eP,{List:uU,Item:oU,Input:cU,Group:aU,Separator:lU,Dialog:dU,Empty:hU,Loading:fU});function pU(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function mU(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function tP(e){let t=y.useRef(e);return Jo(()=>{t.current=e}),t}var Jo=typeof window>"u"?y.useEffect:y.useLayoutEffect;function xa(e){let t=y.useRef();return t.current===void 0&&(t.current=e()),t}function Yi(e){let t=J0(),n=()=>e(t.snapshot());return y.useSyncExternalStore(t.subscribe,n,n)}function nP(e,t,n,s=[]){let r=y.useRef(),i=Yu();return Jo(()=>{var o;let a=(()=>{var u;for(let d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(u=d.current.textContent)==null?void 0:u.trim():r.current}})(),c=s.map(u=>u.trim());i.value(e,a,c),(o=t.current)==null||o.setAttribute(ga,a),r.current=a}),r}var gU=()=>{let[e,t]=y.useState(),n=xa(()=>new Map);return Jo(()=>{n.current.forEach(s=>s()),n.current=new Map},[e]),(s,r)=>{n.current.set(s,r),t({})}};function xU(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Sp({asChild:e,children:t},n){return e&&y.isValidElement(t)?y.cloneElement(xU(t),{ref:t.ref},n(t.props.children)):n(t)}var vU={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function yU(e,t,n={}){const{cycleFilter:s="current",includeCompletedFilter:r=!1,minQueryLength:i=2,maxResults:o=20,debounceMs:a=150}=n,c=Lt(),[u,d]=y.useState(e);y.useEffect(()=>{const m=setTimeout(()=>{d(e)},a);return()=>clearTimeout(m)},[e,a]);const h=c.getQueryData(["issues",s,r]),p=y.useMemo(()=>{if(!u||u.trim().length<i)return[];if(!h||h.length===0)return[];const m=u.toLowerCase().trim(),g=[];for(const v of h){if(t.sources.size>0&&v.source&&!t.sources.has(v.source)||!t.includeCompleted&&(v.status==="Done"||v.status==="Completed"||v.status==="Closed"))continue;let x=0,_=null;const b=v.identifier.toLowerCase();b===m?(x=100,_="identifier"):b.startsWith(m)?(x=80,_="identifier"):b.includes(m)&&(x=60,_="identifier");const S=v.title.toLowerCase();if(S.includes(m)){const C=S.startsWith(m)?70:50;C>x&&(x=C,_="title")}t.deepSearch&&v.description&&v.description.toLowerCase().includes(m)&&20>x&&(x=20,_="description"),x>0&&_&&g.push({issue:v,score:x,matchType:_})}return g.sort((v,x)=>x.score!==v.score?x.score-v.score:v.issue.identifier.localeCompare(x.issue.identifier)),g.slice(0,o)},[u,h,t,i,o]),f=y.useMemo(()=>{const m={};for(const g of p){const v=g.issue.source||"unknown";m[v]||(m[v]=[]),m[v].push(g)}return m},[p]);return{results:p,groupedResults:f,isSearching:e!==u,hasResults:p.length>0,resultCount:p.length}}const _U={linear:"Linear",github:"GitHub",rally:"Rally",gitlab:"GitLab",jira:"Jira",unknown:"Unknown"},bU={0:"text-content-muted",1:"text-red-500",2:"text-orange-500",3:"text-yellow-500",4:"text-blue-500"},wU={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 SU({groupedResults:e,onSelect:t,onExternalLink:n}){const s=Object.keys(e).sort();return l.jsx(l.Fragment,{children:s.map(r=>l.jsx(Oc.Group,{heading:_U[r]||r,children:e[r].map(i=>{const{issue:o,matchType:a}=i,c=Bt[o.status]||"backlog";return l.jsx(Oc.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:l.jsxs("div",{className:"flex items-start gap-3",children:[o.project&&l.jsx("span",{className:"w-2 h-2 rounded-full shrink-0 mt-1.5",style:{backgroundColor:o.project.color||"#6b7280"},title:o.project.name}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsxs("span",{className:"text-sm font-medium text-content flex items-center gap-1",children:[o.source==="github"&&l.jsx(n0,{className:"w-3 h-3 text-content-subtle"}),l.jsx("span",{className:"text-content-subtle",children:o.identifier})]}),l.jsx("span",{className:`px-2 py-0.5 rounded text-xs text-content ${wU[c]||"bg-surface-emphasis"}`,children:o.status}),l.jsx("span",{title:`Priority ${o.priority}`,children:l.jsx(XN,{className:`w-2 h-2 fill-current ${bU[o.priority]||"text-content-muted"}`})}),a&&l.jsxs("span",{className:"text-xs text-content-muted",children:["(",a," match)"]})]}),l.jsx("p",{className:"text-sm text-content-body mt-1 line-clamp-2",children:o.title}),o.labels.length>0&&l.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[o.labels.slice(0,3).map(u=>l.jsx("span",{className:"text-xs bg-surface-overlay text-content-subtle px-2 py-0.5 rounded",children:u},u)),o.labels.length>3&&l.jsxs("span",{className:"text-xs text-content-muted",children:["+",o.labels.length-3," more"]})]})]}),l.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:l.jsx(gr,{className:"w-4 h-4"})})]})},o.id)})},r))})}function kU({isOpen:e,onClose:t,onSelectIssue:n,cycleFilter:s="current",includeCompletedFilter:r=!1}){const[i,o]=y.useState(""),[a,c]=y.useState({sources:new Set,includeCompleted:!1,deepSearch:!1}),{groupedResults:u,isSearching:d,hasResults:h,resultCount:p}=yU(i,a,{cycleFilter:s,includeCompletedFilter:r});y.useEffect(()=>{e||(o(""),c({sources:new Set,includeCompleted:!1,deepSearch:!1}))},[e]),y.useEffect(()=>{const v=x=>{x.key==="Escape"&&t()};if(e)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,t]);const f=v=>{c(x=>{const _=new Set(x.sources);return _.has(v)?_.delete(v):_.add(v),{...x,sources:_}})},m=v=>{n(v),t()},g=(v,x)=>{x.stopPropagation(),window.open(v,"_blank","noopener,noreferrer")};return e?l.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",children:[l.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:t}),l.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:l.jsxs(Oc,{className:"flex flex-col h-full",shouldFilter:!1,children:[l.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-divider",children:[l.jsx(oM,{className:"w-5 h-5 text-content-subtle shrink-0"}),l.jsx(Oc.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}),l.jsx("button",{onClick:t,className:"p-1 text-content-subtle hover:text-content hover:bg-surface-overlay rounded transition-colors shrink-0",children:l.jsx(yt,{className:"w-5 h-5"})})]}),l.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-divider bg-gray-850 flex-wrap",children:[l.jsx("span",{className:"text-xs text-content-subtle",children:"Filters:"}),["linear","github","rally"].map(v=>l.jsxs("button",{onClick:()=>f(v),className:`px-2 py-1 text-xs rounded transition-colors ${a.sources.size===0||a.sources.has(v)?"bg-blue-600 text-content":"bg-surface-overlay text-content-subtle hover:text-content"}`,children:[v==="github"&&l.jsx(n0,{className:"w-3 h-3 inline mr-1"}),v.charAt(0).toUpperCase()+v.slice(1)]},v)),l.jsx("div",{className:"w-px h-4 bg-surface-emphasis"}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:a.includeCompleted,onChange:v=>c(x=>({...x,includeCompleted:v.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"}),l.jsx("span",{className:"text-xs text-content-subtle",children:"Show completed"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:a.deepSearch,onChange:v=>c(x=>({...x,deepSearch:v.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"}),l.jsx("span",{className:"text-xs text-content-subtle",children:"Deep search"})]})]}),l.jsxs(Oc.List,{className:"flex-1 overflow-y-auto",children:[i.length>0&&i.length<2&&l.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&&d&&l.jsx("div",{className:"px-4 py-8 text-center text-sm text-content-subtle",children:"Searching..."}),i.length>=2&&!d&&!h&&l.jsx("div",{className:"px-4 py-8 text-center text-sm text-content-subtle",children:"No issues found"}),i.length>=2&&!d&&h&&l.jsx(SU,{groupedResults:u,onSelect:m,onExternalLink:g})]}),p>0&&l.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:[l.jsxs("span",{children:[p," result",p!==1?"s":""]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("kbd",{className:"px-1.5 py-0.5 bg-surface-overlay rounded text-xs",children:"↑"}),l.jsx("kbd",{className:"px-1.5 py-0.5 bg-surface-overlay rounded text-xs",children:"↓"}),"navigate"]}),l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("kbd",{className:"px-1.5 py-0.5 bg-surface-overlay rounded text-xs",children:"Enter"}),"select"]}),l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("kbd",{className:"px-1.5 py-0.5 bg-surface-overlay rounded text-xs",children:"Esc"}),"close"]})]})]})]})})]}):null}const CU="_missionControl_1fx9v_4",NU="_layout_1fx9v_53",jU="_sidebar_1fx9v_60",EU="_resizeHandle_1fx9v_69",PU="_sidebarHeader_1fx9v_83",TU="_sidebarTitle_1fx9v_88",RU="_sidebarSubtitle_1fx9v_94",DU="_projectTree_1fx9v_100",MU="_projectNode_1fx9v_107",LU="_projectHeader_1fx9v_111",AU="_chevron_1fx9v_131",OU="_chevronOpen_1fx9v_137",IU="_projectName_1fx9v_141",FU="_featureCount_1fx9v_148",BU="_featureItem_1fx9v_155",zU="_featureItemSelected_1fx9v_174",$U="_featureStatus_1fx9v_178",HU="_featureLabel_1fx9v_187",WU="_featureId_sidebar_1fx9v_194",UU="_featureState_1fx9v_202",qU="_featureCost_1fx9v_212",KU="_emptyProject_1fx9v_218",VU="_content_1fx9v_226",YU="_contentEmpty_1fx9v_234",XU="_featureHeader_1fx9v_244",QU="_featureTitle_1fx9v_253",GU="_featureId_1fx9v_194",JU="_badgeBar_1fx9v_267",ZU="_badge_1fx9v_267",eq="_badgeDisabled_1fx9v_294",tq="_activityContainer_1fx9v_305",nq="_agentSection_1fx9v_315",sq="_agentSectionExpanded_1fx9v_327",rq="_sectionHeader_1fx9v_331",iq="_sectionChevron_1fx9v_350",oq="_sectionType_1fx9v_356",aq="_typeWork_1fx9v_370",lq="_typeReview_1fx9v_375",cq="_typeTest_1fx9v_380",uq="_typeMerge_1fx9v_385",dq="_sectionModel_1fx9v_392",hq="_sectionTime_1fx9v_398",fq="_sectionCost_1fx9v_404",pq="_costSummary_1fx9v_411",mq="_sectionStatus_1fx9v_419",gq="_statusRunning_1fx9v_426",xq="_statusCompleted_1fx9v_431",vq="_statusFailed_1fx9v_435",yq="_sectionPreview_1fx9v_445",_q="_sectionContent_1fx9v_458",bq="_sectionContentConstrained_1fx9v_474",wq="_sectionResizeHandle_1fx9v_479",Sq="_unreadDot_1fx9v_498",kq="_isolationOverlay_1fx9v_507",Cq="_isolationHeader_1fx9v_516",Nq="_isolationClose_1fx9v_525",jq="_isolationContent_1fx9v_541",Eq="_modalOverlay_1fx9v_553",Pq="_modalContent_1fx9v_564",Tq="_modalHeader_1fx9v_575",Rq="_modalTitle_1fx9v_583",Dq="_modalClose_1fx9v_589",Mq="_modalBody_1fx9v_604",Lq="_uploadZone_1fx9v_611",Aq="_uploadZoneActive_1fx9v_622",Oq="_uploadIcon_1fx9v_628",Iq="_uploadText_1fx9v_632",Fq="_uploadHint_1fx9v_637",Bq="_syncButton_1fx9v_678",zq="_spinning_1fx9v_707",$q="_markdownContent_1fx9v_739",Hq="_kbdHint_1fx9v_793",Wq="_deaconPanel_1fx9v_810",Uq="_deaconHeader_1fx9v_815",qq="_deaconTitle_1fx9v_828",Kq="_deaconMeta_1fx9v_836",Vq="_deaconActionCount_1fx9v_842",Yq="_deaconSpecialists_1fx9v_853",Xq="_deaconSpecRow_1fx9v_859",Qq="_deaconSpecDot_1fx9v_865",Gq="_deaconSpecName_1fx9v_872",Jq="_deaconSpecFailures_1fx9v_877",Zq="_deaconActions_1fx9v_883",eK="_deaconAction_1fx9v_842",tK="_deaconLogToggle_1fx9v_900",nK="_deaconLogViewer_1fx9v_917",sK="_deaconLogEmpty_1fx9v_928",rK="_deaconLogEntry_1fx9v_934",iK="_deaconLogTime_1fx9v_941",oK="_deaconLogLevel_1fx9v_947",aK="_deaconLogMessage_1fx9v_954",lK="_sidebarFooter_1fx9v_962",cK="_versionLabel_1fx9v_971",V={missionControl:CU,layout:NU,sidebar:jU,resizeHandle:EU,sidebarHeader:PU,sidebarTitle:TU,sidebarSubtitle:RU,projectTree:DU,projectNode:MU,projectHeader:LU,chevron:AU,chevronOpen:OU,projectName:IU,featureCount:FU,featureItem:BU,featureItemSelected:zU,featureStatus:$U,featureLabel:HU,featureId_sidebar:WU,featureState:UU,featureCost:qU,emptyProject:KU,content:VU,contentEmpty:YU,featureHeader:XU,featureTitle:QU,featureId:GU,badgeBar:JU,badge:ZU,badgeDisabled:eq,activityContainer:tq,agentSection:nq,agentSectionExpanded:sq,sectionHeader:rq,sectionChevron:iq,sectionType:oq,typeWork:aq,typeReview:lq,typeTest:cq,typeMerge:uq,sectionModel:dq,sectionTime:hq,sectionCost:fq,costSummary:pq,sectionStatus:mq,statusRunning:gq,statusCompleted:xq,statusFailed:vq,sectionPreview:yq,sectionContent:_q,sectionContentConstrained:bq,sectionResizeHandle:wq,unreadDot:Sq,isolationOverlay:kq,isolationHeader:Cq,isolationClose:Nq,isolationContent:jq,modalOverlay:Eq,modalContent:Pq,modalHeader:Tq,modalTitle:Rq,modalClose:Dq,modalBody:Mq,uploadZone:Lq,uploadZoneActive:Aq,uploadIcon:Oq,uploadText:Iq,uploadHint:Fq,syncButton:Bq,spinning:zq,markdownContent:$q,kbdHint:Hq,deaconPanel:Wq,deaconHeader:Uq,deaconTitle:qq,deaconMeta:Kq,deaconActionCount:Vq,deaconSpecialists:Yq,deaconSpecRow:Xq,deaconSpecDot:Qq,deaconSpecName:Gq,deaconSpecFailures:Jq,deaconActions:Zq,deaconAction:eK,deaconLogToggle:tK,deaconLogViewer:nK,deaconLogEmpty:sK,deaconLogEntry:rK,deaconLogTime:iK,deaconLogLevel:oK,deaconLogMessage:aK,sidebarFooter:lK,versionLabel:cK};function uK({status:e,agentStatus:t,stateLabel:n,isRally:s}){if(s){const r=n==="Done"?"var(--mc-success)":n==="In Progress"?"var(--mc-warning)":"var(--mc-text-muted)";return l.jsx(ej,{size:14,style:{color:r}})}return e==="running"?l.jsx(be,{size:14,className:V.spinning,style:{color:"var(--mc-success)"}}):t==="suspended"||n==="In Progress"||n==="Suspended"?l.jsx(kn,{size:14,style:{color:"var(--mc-warning)"}}):e==="has_state"?l.jsx(po,{size:14,style:{color:"var(--mc-text-muted)"}}):l.jsx(XN,{size:14,style:{color:"var(--mc-text-muted)"}})}function dK(e){return e<.01?"<$0.01":e<1?`$${e.toFixed(2)}`:`$${e.toFixed(2)}`}function hK({feature:e,isSelected:t,onSelect:n,title:s,cost:r}){const i=e.isRally&&e.childCount&&e.childCount>0?Math.round((e.completedCount||0)/e.childCount*100):null;return l.jsxs("button",{className:`${V.featureItem} ${t?V.featureItemSelected:""}`,onClick:n,children:[l.jsx("span",{className:V.featureStatus,children:e.isShadow?l.jsx(Lo,{size:14,style:{color:"var(--mc-accent)"}}):l.jsx(uK,{status:e.status,agentStatus:e.agentStatus,stateLabel:e.stateLabel,isRally:e.isRally})}),l.jsx("span",{className:V.featureId_sidebar,children:e.issueId}),l.jsx("span",{className:V.featureLabel,children:s||e.issueId}),e.isRally&&e.childCount!=null&&e.childCount>0?l.jsxs("span",{className:V.featureState,title:`${e.completedCount||0}/${e.childCount} stories done${e.inProgressCount?`, ${e.inProgressCount} active`:""}`,children:[e.completedCount||0,"/",e.childCount,i!==null&&l.jsx("span",{style:{display:"inline-block",width:24,height:4,marginLeft:4,background:"var(--mc-border)",borderRadius:2,overflow:"hidden",verticalAlign:"middle"},children:l.jsx("span",{style:{display:"block",width:`${i}%`,height:"100%",background:i===100?"var(--mc-success)":"var(--mc-warning)",borderRadius:2}})})]}):l.jsx("span",{className:V.featureState,children:e.stateLabel}),r!==void 0&&r>0&&l.jsx("span",{className:V.featureCost,children:dK(r)})]})}function fK({name:e,features:t,selectedFeature:n,onSelectFeature:s,issueTitles:r,issueCosts:i}){const[o,a]=y.useState(t.length>0);return l.jsxs("div",{className:V.projectNode,children:[l.jsxs("button",{className:V.projectHeader,onClick:()=>a(!o),children:[l.jsx(_l,{className:`${V.chevron} ${o?V.chevronOpen:""}`,size:14}),l.jsx("span",{className:V.projectName,children:e}),l.jsx("span",{className:V.featureCount,children:t.length})]}),o&&(t.length>0?t.map(c=>l.jsx(hK,{feature:c,isSelected:n===c.issueId,onSelect:()=>s(c.issueId),title:(r==null?void 0:r[c.issueId.toLowerCase()])||(r==null?void 0:r[c.issueId])||c.title,cost:(i==null?void 0:i[c.issueId.toLowerCase()])||(i==null?void 0:i[c.issueId])},c.issueId)):l.jsx("div",{className:V.emptyProject,children:"(no active features)"}))]})}const pK={work:V.typeWork,review:V.typeReview,test:V.typeTest,merge:V.typeMerge},mK={running:V.statusRunning,completed:V.statusCompleted,failed:V.statusFailed},gK={work:"#10B981",review:"#F59E0B",test:"#6366F1",merge:"#EC4899"};function xK(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 vK(e){if(!e)return"";try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function ES(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 yK(e){return e<.01?"<$0.01":`$${e.toFixed(2)}`}function _K(e){if(!e)return"(no output yet)";const t=e.split(`
|
|
681
|
+
`).filter(s=>s.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 bK({section:e,isUnread:t,onClick:n,cost:s,defaultExpanded:r=!1}){const i=y.useRef(null),[o,a]=y.useState(r),[c,u]=y.useState(null),d=y.useRef(!1),h=y.useRef(0),p=y.useRef(0);y.useEffect(()=>{e.status==="running"&&a(!0)},[e.status]),y.useEffect(()=>{i.current&&o&&e.status==="running"&&requestAnimationFrame(()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight)})},[e.transcript,e.status,o]);const f=y.useCallback(S=>{var C;S.preventDefault(),S.stopPropagation(),d.current=!0,h.current=S.clientY,p.current=((C=i.current)==null?void 0:C.offsetHeight)||300,document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[]);y.useEffect(()=>{const S=w=>{if(!d.current)return;const j=w.clientY-h.current,T=Math.max(80,Math.min(2e3,p.current+j));u(T)},C=()=>{d.current&&(d.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",S),document.addEventListener("mouseup",C),()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",C)}},[]);const m=y.useCallback(()=>{u(S=>S===null?400:null)},[]),g=S=>{if(S.button===1||S.ctrlKey){n();return}a(!o)},v=gK[e.type]||"var(--mc-border)",x=c!==null,_={};x&&o&&(_.maxHeight=`${c}px`);const b=x?`${V.sectionContent} ${V.sectionContentConstrained}`:V.sectionContent;return l.jsxs("div",{className:`${V.agentSection} ${o?V.agentSectionExpanded:""}`,style:{borderLeftColor:v},children:[l.jsxs("div",{className:V.sectionHeader,onClick:g,title:"Click to expand/collapse, Ctrl+click to isolate",children:[l.jsx("span",{className:V.sectionChevron,children:o?l.jsx(Mu,{size:12,style:{color:"var(--mc-text-muted)"}}):l.jsx(_l,{size:12,style:{color:"var(--mc-text-muted)"}})}),e.status==="running"?l.jsx(be,{size:12,className:V.spinning,style:{color:"var(--mc-success)",flexShrink:0}}):l.jsx("div",{className:`${V.sectionStatus} ${mK[e.status]||V.statusCompleted}`}),l.jsx("span",{className:`${V.sectionType} ${pK[e.type]||""}`,children:e.type}),ES(e.model)&&l.jsx("span",{className:V.sectionModel,children:ES(e.model)}),l.jsxs("span",{className:V.sectionTime,children:[vK(e.startedAt),e.duration!==null&&` (${xK(e.duration)})`]}),s!==void 0&&s>0&&l.jsx("span",{className:V.sectionCost,children:yK(s)}),t&&l.jsx("div",{className:V.unreadDot})]}),!o&&l.jsx("div",{className:V.sectionPreview,children:_K(e.transcript)}),o&&l.jsxs(l.Fragment,{children:[l.jsx("div",{ref:i,className:b,style:_,children:e.transcript||"(no output yet)"}),l.jsx("div",{className:V.sectionResizeHandle,onMouseDown:f,onDoubleClick:m,title:x?"Drag to resize, double-click to unconstrain":"Drag to constrain height, double-click to set default",children:l.jsx(QD,{size:12,style:{color:"var(--mc-text-muted)",opacity:x?.8:.4}})})]})]})}const wK={work:V.typeWork,review:V.typeReview,test:V.typeTest,merge:V.typeMerge};function PS(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 SK({section:e,onClose:t}){const n=y.useRef(null);return y.useEffect(()=>{e.status==="running"&&n.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.transcript,e.status]),y.useEffect(()=>{history.pushState({isolation:!0},"");const s=()=>{t()};return window.addEventListener("popstate",s),()=>{window.removeEventListener("popstate",s)}},[t]),l.jsxs("div",{className:V.isolationOverlay,children:[l.jsxs("div",{className:V.isolationHeader,children:[l.jsxs("button",{className:V.isolationClose,onClick:t,children:[l.jsx("kbd",{className:V.kbdHint,children:"Esc"})," Close"]}),l.jsx("span",{className:`${V.sectionType} ${wK[e.type]||""}`,children:e.type}),PS(e.model)&&l.jsx("span",{className:V.sectionModel,children:PS(e.model)}),l.jsx("span",{className:V.sectionTime,children:e.sessionId})]}),l.jsx("div",{ref:n,className:V.isolationContent,children:e.transcript||"(no output)"})]})}async function kK(e){const t=await fetch(`/api/mission-control/activity/${e}`);if(!t.ok)throw new Error("Failed to fetch activity");return t.json()}function CK(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 TS({feature:e,issues:t}){const n=t.filter(c=>c.source==="rally"&&c.parentRef===e.issueId),s=t.find(c=>c.source==="rally"&&c.identifier===e.issueId);if(n.length===0&&!s)return null;const r=e.completedCount||0,i=e.childCount||n.length,o=e.inProgressCount||0,a=i>0?Math.round(r/i*100):0;return l.jsxs("div",{style:{marginBottom:16},children:[l.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:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[l.jsx("span",{style:{fontWeight:600,color:"var(--mc-text-primary)",fontSize:"var(--mc-font-size-sm)"},children:e.issueId}),(s==null?void 0:s.url)&&l.jsx("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--mc-text-muted)"},children:l.jsx(gr,{size:12})}),e.rawTrackerState&&l.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&&l.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&&l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[l.jsx("div",{style:{flex:1,height:6,background:"var(--mc-border)",borderRadius:3,overflow:"hidden"},children:l.jsx("div",{style:{width:`${a}%`,height:"100%",background:a===100?"var(--mc-success)":"#6366f1",borderRadius:3,transition:"width 0.3s ease"}})}),l.jsxs("span",{style:{fontSize:11,color:"var(--mc-text-muted)",whiteSpace:"nowrap"},children:[r,"/",i," done",o>0?`, ${o} active`:""]})]})]}),n.length>0&&l.jsxs("div",{style:{background:"var(--mc-bg-secondary)",border:"1px solid var(--mc-border)",borderRadius:6,overflow:"hidden"},children:[l.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 l.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:[l.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:CK(c.status),flexShrink:0}}),l.jsx("a",{href:c.url,target:"_blank",rel:"noopener noreferrer",style:{color:"#6366f1",textDecoration:"none",fontFamily:"monospace",fontSize:11,flexShrink:0},children:c.identifier}),l.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)&&l.jsx("span",{style:{fontSize:11,color:"var(--mc-text-muted)",flexShrink:0},children:c.assignee.name}),c.rawTrackerState&&l.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 NK({issueId:e,issues:t=[],featureData:n}){const[s,r]=y.useState(null),[i,o]=y.useState(new Set),a=y.useRef([]),c=y.useRef(null),{data:u,isLoading:d}=he({queryKey:["mission-control-activity",e],queryFn:()=>kK(e),refetchInterval:5e3}),h=(u==null?void 0:u.sections)||[],p=(u==null?void 0:u.costByStage)||{},f=(u==null?void 0:u.totalCost)||0;y.useEffect(()=>{const b=h.map(C=>C.sessionId);b.filter(C=>!a.current.includes(C)).length>0&&a.current.length>0&&o(C=>new Set(C)),a.current=b},[h]);const m=b=>{r(b),o(S=>new Set([...S,b.sessionId]))},g=()=>{r(null)},v=y.useRef(null),x=y.useRef(!1);if(y.useEffect(()=>{v.current!==e&&(v.current=e,x.current=!1),h.length>0&&c.current&&!x.current&&(x.current=!0,requestAnimationFrame(()=>{requestAnimationFrame(()=>{c.current&&(c.current.scrollTop=c.current.scrollHeight)})}))},[e,h]),y.useEffect(()=>{const b=S=>{S.key==="Escape"&&s&&g()};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[s]),d&&h.length===0)return l.jsx("div",{className:V.activityContainer,children:l.jsx("div",{style:{color:"var(--mc-text-muted)",fontSize:"var(--mc-font-size-sm)"},children:"Loading activity..."})});if(h.length===0){const b=(n==null?void 0:n.isRally)===!0;return l.jsxs("div",{className:V.activityContainer,children:[b&&n&&l.jsx(TS,{feature:n,issues:t}),l.jsx("div",{style:{color:"var(--mc-text-muted)",fontSize:"var(--mc-font-size-sm)"},children:"No agent activity yet for this feature."})]})}const _=(n==null?void 0:n.isRally)===!0;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{ref:c,className:V.activityContainer,children:[_&&n&&l.jsx(TS,{feature:n,issues:t}),f>0&&l.jsxs("div",{className:V.costSummary,children:["Total: $",f<.01?"<0.01":f.toFixed(2)]}),h.map((b,S)=>{const j=({work:["implementation"],review:["review"],test:["test"],merge:["merge"]}[b.type]||[b.type]).reduce((R,B)=>{var A;return R+(((A=p[B])==null?void 0:A.cost)||0)},0)||void 0,T=S===h.length-1,F=b.status==="running"||T;return l.jsx(bK,{section:b,isUnread:!i.has(b.sessionId)&&a.current.length>0,onClick:()=>m(b),cost:j,defaultExpanded:F},b.sessionId)})]}),s&&l.jsx(SK,{section:s,onClose:g})]})}function RS(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,r=n.indexOf(t);for(;r!==-1;)s++,r=n.indexOf(t,r+t.length);return s}function jK(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function EK(e,t,n){const r=vp((n||{}).ignore||[]),i=PK(t);let o=-1;for(;++o<i.length;)p5(e,"text",a);function a(u,d){let h=-1,p;for(;++h<d.length;){const f=d[h],m=p?p.children:void 0;if(r(f,m?m.indexOf(f):void 0,p))return;p=f}if(p)return c(u,d)}function c(u,d){const h=d[d.length-1],p=i[o][0],f=i[o][1];let m=0;const v=h.children.indexOf(u);let x=!1,_=[];p.lastIndex=0;let b=p.exec(u.value);for(;b;){const S=b.index,C={index:b.index,input:b.input,stack:[...d,u]};let w=f(...b,C);if(typeof w=="string"&&(w=w.length>0?{type:"text",value:w}:void 0),w===!1?p.lastIndex=S+1:(m!==S&&_.push({type:"text",value:u.value.slice(m,S)}),Array.isArray(w)?_.push(...w):w&&_.push(w),m=S+b[0].length,x=!0),!p.global)break;b=p.exec(u.value)}return x?(m<u.value.length&&_.push({type:"text",value:u.value.slice(m)}),h.children.splice(v,1,..._)):_=[u],v+_.length}}function PK(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 s=-1;for(;++s<n.length;){const r=n[s];t.push([TK(r[0]),RK(r[1])])}return t}function TK(e){return typeof e=="string"?new RegExp(jK(e),"g"):e}function RK(e){return typeof e=="function"?e:function(){return e}}const Jm="phrasing",Zm=["autolink","link","image","label"];function DK(){return{transforms:[BK],enter:{literalAutolink:LK,literalAutolinkEmail:eg,literalAutolinkHttp:eg,literalAutolinkWww:eg},exit:{literalAutolink:FK,literalAutolinkEmail:IK,literalAutolinkHttp:AK,literalAutolinkWww:OK}}}function MK(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Jm,notInConstruct:Zm},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Jm,notInConstruct:Zm},{character:":",before:"[ps]",after:"\\/",inConstruct:Jm,notInConstruct:Zm}]}}function LK(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function eg(e){this.config.enter.autolinkProtocol.call(this,e)}function AK(e){this.config.exit.autolinkProtocol.call(this,e)}function OK(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 IK(e){this.config.exit.autolinkEmail.call(this,e)}function FK(e){this.exit(e)}function BK(e){EK(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,zK],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),$K]],{ignore:["link","linkReference"]})}function zK(e,t,n,s,r){let i="";if(!sP(r)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!HK(n)))return!1;const o=WK(n+s);if(!o[0])return!1;const a={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function $K(e,t,n,s){return!sP(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function HK(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 WK(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],s=n.indexOf(")");const r=RS(e,"(");let i=RS(e,")");for(;s!==-1&&r>i;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),i++;return[e,n]}function sP(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Qo(n)||mp(n))&&(!t||n!==47)}rP.peek=JK;function UK(){this.buffer()}function qK(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function KK(){this.buffer()}function VK(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function YK(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Us(this.sliceSerialize(e)).toLowerCase(),n.label=t}function XK(e){this.exit(e)}function QK(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Us(this.sliceSerialize(e)).toLowerCase(),n.label=t}function GK(e){this.exit(e)}function JK(){return"["}function rP(e,t,n,s){const r=n.createTracker(s);let i=r.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return i+=r.move(n.safe(n.associationId(e),{after:"]",before:i})),a(),o(),i+=r.move("]"),i}function ZK(){return{enter:{gfmFootnoteCallString:UK,gfmFootnoteCall:qK,gfmFootnoteDefinitionLabelString:KK,gfmFootnoteDefinition:VK},exit:{gfmFootnoteCallString:YK,gfmFootnoteCall:XK,gfmFootnoteDefinitionLabelString:QK,gfmFootnoteDefinition:GK}}}function eV(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:rP},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,r,i,o){const a=i.createTracker(o);let c=a.move("[^");const u=i.enter("footnoteDefinition"),d=i.enter("label");return c+=a.move(i.safe(i.associationId(s),{before:c,after:"]"})),d(),c+=a.move("]:"),s.children&&s.children.length>0&&(a.shift(4),c+=a.move((t?`
|
|
682
|
+
`:" ")+i.indentLines(i.containerFlow(s,a.current()),t?iP:tV))),u(),c}}function tV(e,t,n){return t===0?e:iP(e,t,n)}function iP(e,t,n){return(n?"":" ")+e}const nV=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];oP.peek=aV;function sV(){return{canContainEols:["delete"],enter:{strikethrough:iV},exit:{strikethrough:oV}}}function rV(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:nV}],handlers:{delete:oP}}}function iV(e){this.enter({type:"delete",children:[]},e)}function oV(e){this.exit(e)}function oP(e,t,n,s){const r=n.createTracker(s),i=n.enter("strikethrough");let o=r.move("~~");return o+=n.containerPhrasing(e,{...r.current(),before:o,after:"~"}),o+=r.move("~~"),i(),o}function aV(){return"~"}function lV(e){return e.length}function cV(e,t){const n=t||{},s=(n.align||[]).concat(),r=n.stringLength||lV,i=[],o=[],a=[],c=[];let u=0,d=-1;for(;++d<e.length;){const g=[],v=[];let x=-1;for(e[d].length>u&&(u=e[d].length);++x<e[d].length;){const _=uV(e[d][x]);if(n.alignDelimiters!==!1){const b=r(_);v[x]=b,(c[x]===void 0||b>c[x])&&(c[x]=b)}g.push(_)}o[d]=g,a[d]=v}let h=-1;if(typeof s=="object"&&"length"in s)for(;++h<u;)i[h]=DS(s[h]);else{const g=DS(s);for(;++h<u;)i[h]=g}h=-1;const p=[],f=[];for(;++h<u;){const g=i[h];let v="",x="";g===99?(v=":",x=":"):g===108?v=":":g===114&&(x=":");let _=n.alignDelimiters===!1?1:Math.max(1,c[h]-v.length-x.length);const b=v+"-".repeat(_)+x;n.alignDelimiters!==!1&&(_=v.length+_+x.length,_>c[h]&&(c[h]=_),f[h]=_),p[h]=b}o.splice(1,0,p),a.splice(1,0,f),d=-1;const m=[];for(;++d<o.length;){const g=o[d],v=a[d];h=-1;const x=[];for(;++h<u;){const _=g[h]||"";let b="",S="";if(n.alignDelimiters!==!1){const C=c[h]-(v[h]||0),w=i[h];w===114?b=" ".repeat(C):w===99?C%2?(b=" ".repeat(C/2+.5),S=" ".repeat(C/2-.5)):(b=" ".repeat(C/2),S=b):S=" ".repeat(C)}n.delimiterStart!==!1&&!h&&x.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&_==="")&&(n.delimiterStart!==!1||h)&&x.push(" "),n.alignDelimiters!==!1&&x.push(b),x.push(_),n.alignDelimiters!==!1&&x.push(S),n.padding!==!1&&x.push(" "),(n.delimiterEnd!==!1||h!==u-1)&&x.push("|")}m.push(n.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return m.join(`
|
|
683
|
+
`)}function uV(e){return e==null?"":String(e)}function DS(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 dV(e,t,n,s){const r=n.enter("blockquote"),i=n.createTracker(s);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),hV);return r(),o}function hV(e,t,n){return">"+(n?"":" ")+e}function fV(e,t){return MS(e,t.inConstruct,!0)&&!MS(e,t.notInConstruct,!1)}function MS(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let s=-1;for(;++s<t.length;)if(e.includes(t[s]))return!0;return!1}function LS(e,t,n,s){let r=-1;for(;++r<n.unsafe.length;)if(n.unsafe[r].character===`
|
|
684
|
+
`&&fV(n.stack,n.unsafe[r]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
685
|
+
`}function pV(e,t){const n=String(e);let s=n.indexOf(t),r=s,i=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===r?++i>o&&(o=i):i=1,r=s+t.length,s=n.indexOf(t,r);return o}function mV(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 gV(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 xV(e,t,n,s){const r=gV(n),i=e.value||"",o=r==="`"?"GraveAccent":"Tilde";if(mV(e,n)){const h=n.enter("codeIndented"),p=n.indentLines(i,vV);return h(),p}const a=n.createTracker(s),c=r.repeat(Math.max(pV(i,r)+1,3)),u=n.enter("codeFenced");let d=a.move(c);if(e.lang){const h=n.enter(`codeFencedLang${o}`);d+=a.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...a.current()})),h()}if(e.lang&&e.meta){const h=n.enter(`codeFencedMeta${o}`);d+=a.move(" "),d+=a.move(n.safe(e.meta,{before:d,after:`
|
|
686
|
+
`,encode:["`"],...a.current()})),h()}return d+=a.move(`
|
|
687
|
+
`),i&&(d+=a.move(i+`
|
|
688
|
+
`)),d+=a.move(c),u(),d}function vV(e,t,n){return(n?"":" ")+e}function Z0(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 yV(e,t,n,s){const r=Z0(n),i=r==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const c=n.createTracker(s);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(a=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":`
|
|
689
|
+
`,...c.current()}))),a(),e.title&&(a=n.enter(`title${i}`),u+=c.move(" "+r),u+=c.move(n.safe(e.title,{before:u,after:r,...c.current()})),u+=c.move(r),a()),o(),u}function _V(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 xu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function jf(e,t,n){const s=ul(e),r=ul(t);return s===void 0?r===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}aP.peek=bV;function aP(e,t,n,s){const r=_V(n),i=n.enter("emphasis"),o=n.createTracker(s),a=o.move(r);let c=o.move(n.containerPhrasing(e,{after:r,before:a,...o.current()}));const u=c.charCodeAt(0),d=jf(s.before.charCodeAt(s.before.length-1),u,r);d.inside&&(c=xu(u)+c.slice(1));const h=c.charCodeAt(c.length-1),p=jf(s.after.charCodeAt(0),h,r);p.inside&&(c=c.slice(0,-1)+xu(h));const f=o.move(r);return i(),n.attentionEncodeSurroundingInfo={after:p.outside,before:d.outside},a+c+f}function bV(e,t,n){return n.options.emphasis||"*"}function wV(e,t){let n=!1;return q0(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,Nv}),!!((!e.depth||e.depth<3)&&F0(e)&&(t.options.setext||n))}function SV(e,t,n,s){const r=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(s);if(wV(e,n)){const d=n.enter("headingSetext"),h=n.enter("phrasing"),p=n.containerPhrasing(e,{...i.current(),before:`
|
|
690
|
+
`,after:`
|
|
691
|
+
`});return h(),d(),p+`
|
|
692
|
+
`+(r===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
|
|
693
|
+
`))+1))}const o="#".repeat(r),a=n.enter("headingAtx"),c=n.enter("phrasing");i.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
|
|
694
|
+
`,...i.current()});return/^[\t ]/.test(u)&&(u=xu(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),c(),a(),u}lP.peek=kV;function lP(e){return e.value||""}function kV(){return"<"}cP.peek=CV;function cP(e,t,n,s){const r=Z0(n),i=r==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const c=n.createTracker(s);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(a=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),a(),e.title&&(a=n.enter(`title${i}`),u+=c.move(" "+r),u+=c.move(n.safe(e.title,{before:u,after:r,...c.current()})),u+=c.move(r),a()),u+=c.move(")"),o(),u}function CV(){return"!"}uP.peek=NV;function uP(e,t,n,s){const r=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(s);let c=a.move("![");const u=n.safe(e.alt,{before:c,after:"]",...a.current()});c+=a.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...a.current()});return o(),n.stack=d,i(),r==="full"||!u||u!==h?c+=a.move(h+"]"):r==="shortcut"?c=c.slice(0,-1):c+=a.move("]"),c}function NV(){return"!"}dP.peek=jV;function dP(e,t,n){let s=e.value||"",r="`",i=-1;for(;new RegExp("(^|[^`])"+r+"([^`]|$)").test(s);)r+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++i<n.unsafe.length;){const o=n.unsafe[i],a=n.compilePattern(o);let c;if(o.atBreak)for(;c=a.exec(s);){let u=c.index;s.charCodeAt(u)===10&&s.charCodeAt(u-1)===13&&u--,s=s.slice(0,u)+" "+s.slice(c.index+1)}}return r+s+r}function jV(){return"`"}function hP(e,t){const n=F0(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))}fP.peek=EV;function fP(e,t,n,s){const r=Z0(n),i=r==='"'?"Quote":"Apostrophe",o=n.createTracker(s);let a,c;if(hP(e,n)){const d=n.stack;n.stack=[],a=n.enter("autolink");let h=o.move("<");return h+=o.move(n.containerPhrasing(e,{before:h,after:">",...o.current()})),h+=o.move(">"),a(),n.stack=d,h}a=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(" "+r),u+=o.move(n.safe(e.title,{before:u,after:r,...o.current()})),u+=o.move(r),c()),u+=o.move(")"),a(),u}function EV(e,t,n){return hP(e,n)?"<":"["}pP.peek=PV;function pP(e,t,n,s){const r=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(s);let c=a.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...a.current()});c+=a.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...a.current()});return o(),n.stack=d,i(),r==="full"||!u||u!==h?c+=a.move(h+"]"):r==="shortcut"?c=c.slice(0,-1):c+=a.move("]"),c}function PV(){return"["}function e_(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 TV(e){const t=e_(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 RV(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 mP(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 DV(e,t,n,s){const r=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?RV(n):e_(n);const a=e.ordered?o==="."?")":".":TV(n);let c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.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),mP(n)===o&&d){let h=-1;for(;++h<e.children.length;){const p=e.children[h];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=a),n.bulletCurrent=o;const u=n.containerFlow(e,s);return n.bulletLastUsed=o,n.bulletCurrent=i,r(),u}function MV(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 LV(e,t,n,s){const r=MV(n);let i=n.bulletCurrent||e_(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;(r==="tab"||r==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(s);a.move(i+" ".repeat(o-i.length)),a.shift(o);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,a.current()),d);return c(),u;function d(h,p,f){return p?(f?"":" ".repeat(o))+h:(f?i:i+" ".repeat(o-i.length))+h}}function AV(e,t,n,s){const r=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,s);return i(),r(),o}const OV=vp(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function IV(e,t,n,s){return(e.children.some(function(o){return OV(o)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function FV(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}gP.peek=BV;function gP(e,t,n,s){const r=FV(n),i=n.enter("strong"),o=n.createTracker(s),a=o.move(r+r);let c=o.move(n.containerPhrasing(e,{after:r,before:a,...o.current()}));const u=c.charCodeAt(0),d=jf(s.before.charCodeAt(s.before.length-1),u,r);d.inside&&(c=xu(u)+c.slice(1));const h=c.charCodeAt(c.length-1),p=jf(s.after.charCodeAt(0),h,r);p.inside&&(c=c.slice(0,-1)+xu(h));const f=o.move(r+r);return i(),n.attentionEncodeSurroundingInfo={after:p.outside,before:d.outside},a+c+f}function BV(e,t,n){return n.options.strong||"*"}function zV(e,t,n,s){return n.safe(e.value,s)}function $V(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 HV(e,t,n){const s=(mP(n)+(n.options.ruleSpaces?" ":"")).repeat($V(n));return n.options.ruleSpaces?s.slice(0,-1):s}const xP={blockquote:dV,break:LS,code:xV,definition:yV,emphasis:aP,hardBreak:LS,heading:SV,html:lP,image:cP,imageReference:uP,inlineCode:dP,link:fP,linkReference:pP,list:DV,listItem:LV,paragraph:AV,root:IV,strong:gP,text:zV,thematicBreak:HV};function WV(){return{enter:{table:UV,tableData:AS,tableHeader:AS,tableRow:KV},exit:{codeText:VV,table:qV,tableData:tg,tableHeader:tg,tableRow:tg}}}function UV(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 qV(e){this.exit(e),this.data.inTable=void 0}function KV(e){this.enter({type:"tableRow",children:[]},e)}function tg(e){this.exit(e)}function AS(e){this.enter({type:"tableCell",children:[]},e)}function VV(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,YV));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function YV(e,t){return t==="|"?t:e}function XV(e){const t=e||{},n=t.tableCellPadding,s=t.tablePipeAlign,r=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
695
|
+
`,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:a}};function o(f,m,g,v){return u(d(f,g,v),f.align)}function a(f,m,g,v){const x=h(f,g,v),_=u([x]);return _.slice(0,_.indexOf(`
|
|
696
|
+
`))}function c(f,m,g,v){const x=g.enter("tableCell"),_=g.enter("phrasing"),b=g.containerPhrasing(f,{...v,before:i,after:i});return _(),x(),b}function u(f,m){return cV(f,{align:m,alignDelimiters:s,padding:n,stringLength:r})}function d(f,m,g){const v=f.children;let x=-1;const _=[],b=m.enter("table");for(;++x<v.length;)_[x]=h(v[x],m,g);return b(),_}function h(f,m,g){const v=f.children;let x=-1;const _=[],b=m.enter("tableRow");for(;++x<v.length;)_[x]=c(v[x],f,m,g);return b(),_}function p(f,m,g){let v=xP.inlineCode(f,m,g);return g.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function QV(){return{exit:{taskListCheckValueChecked:OS,taskListCheckValueUnchecked:OS,paragraph:JV}}}function GV(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:ZV}}}function OS(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function JV(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 s=n.children[0];if(s&&s.type==="text"){const r=t.children;let i=-1,o;for(;++i<r.length;){const a=r[i];if(a.type==="paragraph"){o=a;break}}o===n&&(s.value=s.value.slice(1),s.value.length===0?n.children.shift():n.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,n.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function ZV(e,t,n,s){const r=e.children[0],i=typeof e.checked=="boolean"&&r&&r.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(s);i&&a.move(o);let c=xP.listItem(e,t,n,{...s,...a.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),c;function u(d){return d+o}}function eY(){return[DK(),ZK(),sV(),WV(),QV()]}function tY(e){return{extensions:[MK(),eV(e),rV(),XV(e),GV()]}}const nY={tokenize:lY,partial:!0},vP={tokenize:cY,partial:!0},yP={tokenize:uY,partial:!0},_P={tokenize:dY,partial:!0},sY={tokenize:hY,partial:!0},bP={name:"wwwAutolink",tokenize:oY,previous:SP},wP={name:"protocolAutolink",tokenize:aY,previous:kP},Gr={name:"emailAutolink",tokenize:iY,previous:CP},wr={};function rY(){return{text:wr}}let so=48;for(;so<123;)wr[so]=Gr,so++,so===58?so=65:so===91&&(so=97);wr[43]=Gr;wr[45]=Gr;wr[46]=Gr;wr[95]=Gr;wr[72]=[Gr,wP];wr[104]=[Gr,wP];wr[87]=[Gr,bP];wr[119]=[Gr,bP];function iY(e,t,n){const s=this;let r,i;return o;function o(h){return!Ov(h)||!CP.call(s,s.previous)||t_(s.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(h))}function a(h){return Ov(h)?(e.consume(h),a):h===64?(e.consume(h),c):n(h)}function c(h){return h===46?e.check(sY,d,u)(h):h===45||h===95||Sn(h)?(i=!0,e.consume(h),c):d(h)}function u(h){return e.consume(h),r=!0,c}function d(h){return i&&r&&Ln(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function oY(e,t,n){const s=this;return r;function r(o){return o!==87&&o!==119||!SP.call(s,s.previous)||t_(s.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(nY,e.attempt(vP,e.attempt(yP,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function aY(e,t,n){const s=this;let r="",i=!1;return o;function o(h){return(h===72||h===104)&&kP.call(s,s.previous)&&!t_(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),r+=String.fromCodePoint(h),e.consume(h),a):n(h)}function a(h){if(Ln(h)&&r.length<5)return r+=String.fromCodePoint(h),e.consume(h),a;if(h===58){const p=r.toLowerCase();if(p==="http"||p==="https")return e.consume(h),c}return n(h)}function c(h){return h===47?(e.consume(h),i?u:(i=!0,c)):n(h)}function u(h){return h===null||wf(h)||Qe(h)||Qo(h)||mp(h)?n(h):e.attempt(vP,e.attempt(yP,d),n)(h)}function d(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function lY(e,t,n){let s=0;return r;function r(o){return(o===87||o===119)&&s<3?(s++,e.consume(o),r):o===46&&s===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):t(o)}}function cY(e,t,n){let s,r,i;return o;function o(u){return u===46||u===95?e.check(_P,c,a)(u):u===null||Qe(u)||Qo(u)||u!==45&&mp(u)?c(u):(i=!0,e.consume(u),o)}function a(u){return u===95?s=!0:(r=s,s=void 0),e.consume(u),o}function c(u){return r||s||!i?n(u):t(u)}}function uY(e,t){let n=0,s=0;return r;function r(o){return o===40?(n++,e.consume(o),r):o===41&&s<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(_P,t,i)(o):o===null||Qe(o)||Qo(o)?t(o):(e.consume(o),r)}function i(o){return o===41&&s++,e.consume(o),r}}function dY(e,t,n){return s;function s(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(e.consume(a),s):a===38?(e.consume(a),i):a===93?(e.consume(a),r):a===60||a===null||Qe(a)||Qo(a)?t(a):n(a)}function r(a){return a===null||a===40||a===91||Qe(a)||Qo(a)?t(a):s(a)}function i(a){return Ln(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),s):Ln(a)?(e.consume(a),o):n(a)}}function hY(e,t,n){return s;function s(i){return e.consume(i),r}function r(i){return Sn(i)?n(i):t(i)}}function SP(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Qe(e)}function kP(e){return!Ln(e)}function CP(e){return!(e===47||Ov(e))}function Ov(e){return e===43||e===45||e===46||e===95||Sn(e)}function t_(e){let t=e.length,n=!1;for(;t--;){const s=e[t][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){n=!0;break}if(s._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const fY={tokenize:bY,partial:!0};function pY(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:vY,continuation:{tokenize:yY},exit:_Y}},text:{91:{name:"gfmFootnoteCall",tokenize:xY},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:mY,resolveTo:gY}}}}function mY(e,t,n){const s=this;let r=s.events.length;const i=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o;for(;r--;){const c=s.events[r][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 a;function a(c){if(!o||!o._balanced)return n(c);const u=Us(s.sliceSerialize({start:o.end,end:s.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 gY(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 s={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},r={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};r.end.column++,r.end.offset++,r.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},r.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)},a=[e[n+1],e[n+2],["enter",s,t],e[n+3],e[n+4],["enter",r,t],["exit",r,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(n,e.length-n+1,...a),e}function xY(e,t,n){const s=this,r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i=0,o;return a;function a(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),c}function c(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(h){if(i>999||h===93&&!o||h===null||h===91||Qe(h))return n(h);if(h===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return r.includes(Us(s.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return Qe(h)||(o=!0),i++,e.consume(h),h===92?d:u}function d(h){return h===91||h===92||h===93?(e.consume(h),i++,u):u(h)}}function vY(e,t,n){const s=this,r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i,o=0,a;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",d):n(m)}function d(m){if(o>999||m===93&&!a||m===null||m===91||Qe(m))return n(m);if(m===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return i=Us(s.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return Qe(m)||(a=!0),o++,e.consume(m),m===92?h:d}function h(m){return m===91||m===92||m===93?(e.consume(m),o++,d):d(m)}function p(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),r.includes(i)||r.push(i),Be(e,f,"gfmFootnoteDefinitionWhitespace")):n(m)}function f(m){return t(m)}}function yY(e,t,n){return e.check(Uu,t,e.attempt(fY,t,n))}function _Y(e){e.exit("gfmFootnoteDefinition")}function bY(e,t,n){const s=this;return Be(e,r,"gfmFootnoteDefinitionIndent",5);function r(i){const o=s.events[s.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(i):n(i)}}function wY(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:i,resolveAll:r};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function r(o,a){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 d={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[c][1].end)},h={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[c][1].start)},p=[["enter",d,a],["enter",o[u][1],a],["exit",o[u][1],a],["enter",h,a]],f=a.parser.constructs.insideSpan.null;f&&us(p,p.length,0,gp(f,o.slice(u+1,c),a)),us(p,p.length,0,[["exit",h,a],["enter",o[c][1],a],["exit",o[c][1],a],["exit",d,a]]),us(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,a,c){const u=this.previous,d=this.events;let h=0;return p;function p(m){return u===126&&d[d.length-1][1].type!=="characterEscape"?c(m):(o.enter("strikethroughSequenceTemporary"),f(m))}function f(m){const g=ul(u);if(m===126)return h>1?c(m):(o.consume(m),h++,f);if(h<2&&!n)return c(m);const v=o.exit("strikethroughSequenceTemporary"),x=ul(m);return v._open=!x||x===2&&!!g,v._close=!g||g===2&&!!x,a(m)}}}class SY{constructor(){this.map=[]}add(t,n,s){kY(this,t,n,s)}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 s=[];for(;n>0;)n-=1,s.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];s.push(t.slice()),t.length=0;let r=s.pop();for(;r;){for(const i of r)t.push(i);r=s.pop()}this.map.length=0}}function kY(e,t,n,s){let r=0;if(!(n===0&&s.length===0)){for(;r<e.map.length;){if(e.map[r][0]===t){e.map[r][1]+=n,e.map[r][2].push(...s);return}r+=1}e.map.push([t,n,s])}}function CY(e,t){let n=!1;const s=[];for(;t<e.length;){const r=e[t];if(n){if(r[0]==="enter")r[1].type==="tableContent"&&s.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(r[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=s.length-1;s[i]=s[i]==="left"?"center":"right"}}else if(r[1].type==="tableDelimiterRow")break}else r[0]==="enter"&&r[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return s}function NY(){return{flow:{null:{name:"table",tokenize:jY,resolveAll:EY}}}}function jY(e,t,n){const s=this;let r=0,i=0,o;return a;function a(R){let B=s.events.length-1;for(;B>-1;){const P=s.events[B][1].type;if(P==="lineEnding"||P==="linePrefix")B--;else break}const A=B>-1?s.events[B][1].type:null,D=A==="tableHead"||A==="tableRow"?w:c;return D===w&&s.parser.lazy[s.now().line]?n(R):D(R)}function c(R){return e.enter("tableHead"),e.enter("tableRow"),u(R)}function u(R){return R===124||(o=!0,i+=1),d(R)}function d(R){return R===null?n(R):xe(R)?i>1?(i=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),f):n(R):Me(R)?Be(e,d,"whitespace")(R):(i+=1,o&&(o=!1,r+=1),R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),h(R)))}function h(R){return R===null||R===124||Qe(R)?(e.exit("data"),d(R)):(e.consume(R),R===92?p:h)}function p(R){return R===92||R===124?(e.consume(R),h):h(R)}function f(R){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(R):(e.enter("tableDelimiterRow"),o=!1,Me(R)?Be(e,m,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):m(R))}function m(R){return R===45||R===58?v(R):R===124?(o=!0,e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),g):C(R)}function g(R){return Me(R)?Be(e,v,"whitespace")(R):v(R)}function v(R){return R===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),x):R===45?(i+=1,x(R)):R===null||xe(R)?S(R):C(R)}function x(R){return R===45?(e.enter("tableDelimiterFiller"),_(R)):C(R)}function _(R){return R===45?(e.consume(R),_):R===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),b):(e.exit("tableDelimiterFiller"),b(R))}function b(R){return Me(R)?Be(e,S,"whitespace")(R):S(R)}function S(R){return R===124?m(R):R===null||xe(R)?!o||r!==i?C(R):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(R)):C(R)}function C(R){return n(R)}function w(R){return e.enter("tableRow"),j(R)}function j(R){return R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),j):R===null||xe(R)?(e.exit("tableRow"),t(R)):Me(R)?Be(e,j,"whitespace")(R):(e.enter("data"),T(R))}function T(R){return R===null||R===124||Qe(R)?(e.exit("data"),j(R)):(e.consume(R),R===92?F:T)}function F(R){return R===92||R===124?(e.consume(R),T):T(R)}}function EY(e,t){let n=-1,s=!0,r=0,i=[0,0,0,0],o=[0,0,0,0],a=!1,c=0,u,d,h;const p=new SY;for(;++n<e.length;){const f=e[n],m=f[1];f[0]==="enter"?m.type==="tableHead"?(a=!1,c!==0&&(IS(p,t,c,u,d),d=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"?(s=!0,h=void 0,i=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,d={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(n,0,[["enter",d,t]])),r=m.type==="tableDelimiterRow"?2:d?3:1):r&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(s=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],h=Bd(p,t,i,r,void 0,h),i=[0,0,0,0]),o[2]=n)):m.type==="tableCellDivider"&&(s?s=!1:(i[1]!==0&&(o[0]=o[1],h=Bd(p,t,i,r,void 0,h)),i=o,o=[i[1],n,0,0])):m.type==="tableHead"?(a=!0,c=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(c=n,i[1]!==0?(o[0]=o[1],h=Bd(p,t,i,r,n,h)):o[1]!==0&&(h=Bd(p,t,o,r,n,h)),r=0):r&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&IS(p,t,c,u,d),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=CY(t.events,n))}return e}function Bd(e,t,n,s,r,i){const o=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},va(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=va(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=va(t.events,n[2]),d=va(t.events,n[3]),h={type:a,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",h,t]]),s!==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",h,t]])}return r!==void 0&&(i.end=Object.assign({},va(t.events,r)),e.add(r,0,[["exit",i,t]]),i=void 0),i}function IS(e,t,n,s,r){const i=[],o=va(t.events,n);r&&(r.end=Object.assign({},o),i.push(["exit",r,t])),s.end=Object.assign({},o),i.push(["exit",s,t]),e.add(n+1,0,i)}function va(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const PY={name:"tasklistCheck",tokenize:RY};function TY(){return{text:{91:PY}}}function RY(e,t,n){const s=this;return r;function r(c){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Qe(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"),a):n(c)}function a(c){return xe(c)?t(c):Me(c)?e.check({tokenize:DY},t,n)(c):n(c)}}function DY(e,t,n){return Be(e,s,"whitespace");function s(r){return r===null?n(r):t(r)}}function MY(e){return XE([rY(),pY(),wY(e),NY(),TY()])}const LY={};function AY(e){const t=this,n=e||LY,s=t.data(),r=s.micromarkExtensions||(s.micromarkExtensions=[]),i=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),o=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);r.push(MY(n)),i.push(eY()),o.push(tY(n))}function OY({title:e,content:t,onClose:n}){return y.useEffect(()=>{const s=r=>{r.key==="Escape"&&n()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[n]),l.jsx("div",{className:V.modalOverlay,onClick:n,children:l.jsxs("div",{className:V.modalContent,onClick:s=>s.stopPropagation(),children:[l.jsxs("div",{className:V.modalHeader,children:[l.jsx("h2",{className:V.modalTitle,children:e}),l.jsx("button",{className:V.modalClose,onClick:n,children:l.jsx(yt,{size:18})})]}),l.jsx("div",{className:V.modalBody,children:l.jsx("div",{className:V.markdownContent,children:l.jsx(Tv,{remarkPlugins:[AY],children:t})})})]})})}function IY({issueId:e,onClose:t}){const[n,s]=y.useState(!1),[r,i]=y.useState("transcript"),[o,a]=y.useState(!1),[c,u]=y.useState(null),d=y.useRef(null),h=y.useCallback(async v=>{if(!v.name.endsWith(".md")&&!v.name.endsWith(".txt")&&!v.name.endsWith(".vtt")){u("Only .md, .txt, and .vtt files are supported");return}a(!0),u(null);try{const x=await v.text(),_=await fetch(`/api/mission-control/planning/${e}/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:r,filename:v.name,content:x})});if(!_.ok){const b=await _.json();throw new Error(b.error||"Upload failed")}u(`Uploaded ${v.name} as ${r}`),setTimeout(()=>t(),1500)}catch(x){u(`Error: ${x.message}`)}finally{a(!1)}},[e,r,t]),p=y.useCallback(v=>{v.preventDefault(),s(!1);const x=v.dataTransfer.files[0];x&&h(x)},[h]),f=y.useCallback(v=>{v.preventDefault(),s(!0)},[]),m=y.useCallback(()=>{s(!1)},[]),g=y.useCallback(v=>{var _;const x=(_=v.target.files)==null?void 0:_[0];x&&h(x)},[h]);return l.jsx("div",{className:V.modalOverlay,onClick:t,children:l.jsxs("div",{className:V.modalContent,onClick:v=>v.stopPropagation(),style:{maxWidth:500},children:[l.jsxs("div",{className:V.modalHeader,children:[l.jsx("h2",{className:V.modalTitle,children:"Upload Artifact"}),l.jsx("button",{className:V.modalClose,onClick:t,children:l.jsx(yt,{size:18})})]}),l.jsxs("div",{className:V.modalBody,children:[l.jsxs("div",{style:{display:"flex",gap:"var(--mc-space-2)",marginBottom:"var(--mc-space-4)"},children:[l.jsx("button",{className:V.badge,style:r==="transcript"?{borderColor:"var(--mc-accent)",color:"var(--mc-accent)"}:{},onClick:()=>i("transcript"),children:"Transcript"}),l.jsx("button",{className:V.badge,style:r==="note"?{borderColor:"var(--mc-accent)",color:"var(--mc-accent)"}:{},onClick:()=>i("note"),children:"Note"})]}),l.jsxs("div",{className:`${V.uploadZone} ${n?V.uploadZoneActive:""}`,onDrop:p,onDragOver:f,onDragLeave:m,onClick:()=>{var v;return(v=d.current)==null?void 0:v.click()},children:[l.jsx("div",{className:V.uploadIcon,children:o?l.jsx(qo,{size:32,className:V.spinning}):l.jsx(oj,{size:32})}),l.jsx("p",{className:V.uploadText,children:o?"Uploading...":"Drop a file here or click to browse"}),l.jsx("p",{className:V.uploadHint,children:"Accepts .md, .txt, and .vtt files"})]}),l.jsx("input",{ref:d,type:"file",accept:".md,.txt,.vtt",onChange:g,style:{display:"none"}}),c&&l.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 FY(e){const t=await fetch(`/api/mission-control/planning/${e}`);if(!t.ok)throw new Error("Failed to fetch planning");return t.json()}function BY({issueId:e,source:t,onOpenBeads:n}){var v,x;const[s,r]=y.useState(null),[i,o]=y.useState(!1),[a,c]=y.useState(!1),[u,d]=y.useState(null),[h,p]=y.useState(!1),{data:f,refetch:m}=he({queryKey:["mission-control-planning",e],queryFn:()=>FY(e),refetchInterval:3e4}),g=async()=>{c(!0),d(null);try{const _=t?[t]:["github","linear","rally"];let b=0,S=null;for(const C of _)try{const w=await fetch(`/api/mission-control/planning/${e}/sync-discussions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tracker:C})});if(w.ok){const j=await w.json();b+=j.synced||0}else t&&(S=(await w.json().catch(()=>({error:"Sync failed"}))).error||`HTTP ${w.status}`)}catch{t&&(S="Network error")}S&&b===0?d({message:S,isError:!0}):b>0?d({message:`Synced ${b} — generating status...`,isError:!1}):d({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 w=await C.json(),j=w.cached;j?d({message:b>0?`Synced ${b} (status unchanged)`:"No changes detected",isError:!1}):b>0?d({message:`Synced ${b} + status updated`,isError:!1}):d({message:"Status updated",isError:!1}),r({title:`Status Review${j?" (cached)":""} — ${new Date(w.reviewedAt).toLocaleString()}`,content:w.statusReview})}else{const w=await C.json().catch(()=>({error:"Status review failed"}));b>0&&d({message:`Synced ${b} (status: ${w.error})`,isError:!1})}}catch(C){console.error("Status review generation failed:",C)}finally{p(!1)}m()}catch(_){console.error("Sync failed:",_),d({message:"Sync failed",isError:!0})}finally{c(!1),setTimeout(()=>d(null),6e3)}};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:V.badgeBar,children:[l.jsxs("button",{className:V.badge,onClick:n,title:"View beads tasks",children:[l.jsx(tj,{size:12}),"Tasks"]}),l.jsxs("button",{className:`${V.badge} ${f!=null&&f.state?"":V.badgeDisabled}`,onClick:()=>(f==null?void 0:f.state)&&r({title:"STATE.md",content:f.state}),title:f!=null&&f.state?"View STATE.md":"No STATE.md available",children:[l.jsx(qo,{size:12}),"STATE"]}),l.jsxs("button",{className:`${V.badge} ${f!=null&&f.prd?"":V.badgeDisabled}`,onClick:()=>(f==null?void 0:f.prd)&&r({title:"PRD",content:f.prd}),title:f!=null&&f.prd?"View PRD":"No PRD available",children:[l.jsx(qo,{size:12}),"PRD"]}),l.jsxs("button",{className:`${V.badge} ${!(f!=null&&f.statusReview)&&!h?V.badgeDisabled:""}`,onClick:async()=>{if(f!=null&&f.statusReview)r({title:`Status Review${f.statusReviewedAt?` (${new Date(f.statusReviewedAt).toLocaleString()})`:""}`,content:f.statusReview});else{p(!0);try{const _=await fetch(`/api/mission-control/planning/${e}/status-review`,{method:"POST"});if(_.ok){const b=await _.json();r({title:"Status Review",content:b.statusReview}),m()}}catch(_){console.error("Failed to generate status review:",_)}finally{p(!1)}}},title:f!=null&&f.statusReview?"View status review (click to refresh)":"Generate status review",children:[l.jsx(VD,{size:12,className:h?V.spinning:""}),h?"Reviewing...":"Status"]}),(f==null?void 0:f.inference)&&l.jsxs("button",{className:V.badge,onClick:()=>r({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.*
|
|
697
|
+
|
|
698
|
+
---
|
|
699
|
+
|
|
700
|
+
${f.inference}`}),title:"View Inference Document (Shadow Engineering)",children:[l.jsx(ep,{size:12}),"Inference"]}),(((v=f==null?void 0:f.discussions)==null?void 0:v.length)??0)>0&&l.jsxs("button",{className:V.badge,onClick:()=>{const _=f.discussions.map(b=>`## ${b.filename}
|
|
701
|
+
|
|
702
|
+
${b.content}`).join(`
|
|
703
|
+
|
|
704
|
+
---
|
|
705
|
+
|
|
706
|
+
`);r({title:"Discussions",content:_})},children:["Discussions (",f.discussions.length,")"]}),(((x=f==null?void 0:f.transcripts)==null?void 0:x.length)??0)>0&&l.jsxs("button",{className:V.badge,onClick:()=>{const _=f.transcripts.map(b=>`## ${b.filename}
|
|
707
|
+
|
|
708
|
+
${b.content}`).join(`
|
|
709
|
+
|
|
710
|
+
---
|
|
711
|
+
|
|
712
|
+
`);r({title:"Transcripts",content:_})},children:["Transcripts (",f.transcripts.length,")"]}),l.jsxs("button",{className:V.badge,onClick:()=>o(!0),title:"Upload transcript or note",children:[l.jsx(oj,{size:12}),"Upload"]}),l.jsxs("button",{className:`${V.syncButton} `,onClick:g,disabled:a||h,title:"Sync discussions and generate AI status review",children:[l.jsx(Ar,{size:12,className:a||h?V.spinning:""}),h?"Reviewing...":a?"Syncing...":"Sync"]}),u&&l.jsx("span",{className:V.badge,style:{color:u.isError?"var(--mc-error, #ef4444)":"var(--mc-success, #22c55e)",fontSize:"0.7rem",opacity:.9},children:u.message})]}),s&&l.jsx(OY,{title:s.title,content:s.content,onClose:()=>r(null)}),i&&l.jsx(IY,{issueId:e,onClose:()=>{o(!1),m()}})]})}async function zY(){const e=await fetch("/api/deacon/status");if(!e.ok)throw new Error("Failed to fetch deacon status");return e.json()}async function $Y(){const e=await fetch("/api/deacon/logs?limit=50");if(!e.ok)throw new Error("Failed to fetch deacon logs");return e.json()}function HY(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 s=Math.floor(n/60);return s<60?`${s}m ago`:`${Math.floor(s/60)}h ago`}function WY(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 UY(e){return e.replace("-agent","")}function qY(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return""}}const KY={info:"var(--mc-text-muted)",warn:"var(--mc-warning)",action:"var(--mc-accent)",error:"var(--mc-error)"},VY={info:"INF",warn:"WRN",action:"ACT",error:"ERR"};function YY(){var h;const[e,t]=y.useState(!1),[n,s]=y.useState(!1),r=y.useRef(null),{data:i}=he({queryKey:["deacon-status"],queryFn:zY,refetchInterval:15e3}),{data:o}=he({queryKey:["deacon-logs"],queryFn:$Y,refetchInterval:n?5e3:!1,enabled:n});if(y.useEffect(()=>{n&&r.current&&r.current.scrollIntoView({behavior:"smooth"})},[o,n]),!i)return null;const a=Object.values(i.state.specialists||{}),c=((h=i.lastPatrol)==null?void 0:h.actions)||[],u=c.length>0,d=(o==null?void 0:o.logs)||[];return l.jsxs("div",{className:V.deaconPanel,children:[l.jsxs("div",{className:V.deaconHeader,onClick:()=>t(!e),children:[l.jsx(lM,{size:12,style:{color:i.isRunning?"var(--mc-success)":"var(--mc-text-muted)",flexShrink:0}}),l.jsx("span",{className:V.deaconTitle,children:"Deacon"}),l.jsx("span",{className:V.deaconMeta,children:i.isRunning?HY(i.state.lastPatrol):"stopped"}),u&&l.jsx("span",{className:V.deaconActionCount,children:c.length}),e?l.jsx(Mu,{size:12,style:{color:"var(--mc-text-muted)",flexShrink:0}}):l.jsx(_l,{size:12,style:{color:"var(--mc-text-muted)",flexShrink:0}})]}),l.jsx("div",{className:V.deaconSpecialists,children:a.map(p=>l.jsxs("div",{className:V.deaconSpecRow,children:[l.jsx("span",{className:V.deaconSpecDot,style:{background:WY(p)}}),l.jsx("span",{className:V.deaconSpecName,children:UY(p.specialistName)}),p.consecutiveFailures>0&&l.jsxs("span",{className:V.deaconSpecFailures,children:[p.consecutiveFailures,"x"]})]},p.specialistName))}),e&&l.jsxs(l.Fragment,{children:[u&&l.jsx("div",{className:V.deaconActions,children:c.map((p,f)=>l.jsx("div",{className:V.deaconAction,children:p},f))}),l.jsxs("div",{className:V.deaconLogToggle,onClick:p=>{p.stopPropagation(),s(!n)},children:[l.jsx(iM,{size:10,style:{color:"var(--mc-text-muted)",flexShrink:0}}),l.jsx("span",{children:n?"Hide logs":"Show logs"})]}),n&&l.jsxs("div",{className:V.deaconLogViewer,children:[d.length===0?l.jsx("div",{className:V.deaconLogEmpty,children:"No logs yet — waiting for patrol cycle..."}):d.map((p,f)=>l.jsxs("div",{className:V.deaconLogEntry,children:[l.jsx("span",{className:V.deaconLogTime,children:qY(p.timestamp)}),l.jsx("span",{className:V.deaconLogLevel,style:{color:KY[p.level]||"var(--mc-text-muted)"},children:VY[p.level]||p.level}),l.jsx("span",{className:V.deaconLogMessage,children:p.message})]},f)),l.jsx("div",{ref:r})]})]})]})}async function XY(){const e=await fetch("/api/mission-control/projects");if(!e.ok)throw new Error("Failed to fetch projects");return e.json()}async function QY(){const e=await fetch("/api/costs/by-issue");if(!e.ok)throw new Error("Failed to fetch costs");return e.json()}async function GY(){const e=await fetch("/api/version");if(!e.ok)throw new Error("Failed to fetch version");return e.json()}function JY({issues:e=[]}){var C;const[t,n]=y.useState(null),[s,r]=y.useState(!1),[i,o]=y.useState(()=>{const w=localStorage.getItem("mc-sidebar-width");return w?Number(w):600}),a=y.useRef(!1),c=y.useRef(0),u=y.useRef(0),d=y.useRef(i),{data:h=[],isLoading:p}=he({queryKey:["mission-control-projects"],queryFn:XY,refetchInterval:1e4}),{data:f}=he({queryKey:["costs-by-issue"],queryFn:QY,refetchInterval:15e3}),{data:m}=he({queryKey:["version"],queryFn:GY,staleTime:1/0}),g={},v={};for(const w of e)g[w.identifier.toLowerCase()]=w.title,g[w.identifier]=w.title;for(const w of(f==null?void 0:f.issues)||[])v[w.issueId]=w.totalCost,v[w.issueId.toLowerCase()]=w.totalCost;const x=y.useCallback(w=>{n(w)},[]),_=y.useCallback(w=>{a.current=!0,c.current=w.clientX,u.current=i,document.body.style.cursor="col-resize",document.body.style.userSelect="none",w.preventDefault()},[i]);y.useEffect(()=>{const w=T=>{if(!a.current)return;const F=T.clientX-c.current,R=Math.max(240,Math.min(600,u.current+F));o(R),d.current=R},j=()=>{a.current&&localStorage.setItem("mc-sidebar-width",String(d.current)),a.current=!1,document.body.style.cursor="",document.body.style.userSelect=""};return document.addEventListener("mousemove",w),document.addEventListener("mouseup",j),()=>{document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",j)}},[]);const b=t?h.flatMap(w=>w.features).find(w=>w.issueId===t):null,S=t?g[t.toLowerCase()]||g[t]||t:"";return l.jsxs("div",{className:V.missionControl,children:[l.jsxs("div",{className:V.layout,children:[l.jsxs("div",{className:V.sidebar,style:{width:i,minWidth:i},children:[l.jsxs("div",{className:V.sidebarHeader,children:[l.jsx("h2",{className:V.sidebarTitle,children:"Mission Control"}),l.jsx("p",{className:V.sidebarSubtitle,children:"Active features across projects"})]}),l.jsx("div",{className:V.projectTree,children:p&&h.length===0?l.jsx("div",{className:V.emptyProject,children:"Loading projects..."}):h.length===0?l.jsx("div",{className:V.emptyProject,children:"No projects configured"}):h.map(w=>l.jsx(fK,{name:w.name,features:w.features,selectedFeature:t,onSelectFeature:x,issueTitles:g,issueCosts:v},w.path))}),l.jsx(YY,{}),m&&l.jsx("div",{className:V.sidebarFooter,children:l.jsxs("span",{className:V.versionLabel,children:["v",m.version]})})]}),l.jsx("div",{className:V.resizeHandle,onMouseDown:_}),l.jsx("div",{className:V.content,children:t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:V.featureHeader,children:[l.jsx("h1",{className:V.featureTitle,children:S}),l.jsx("span",{className:V.featureId,children:t}),(b==null?void 0:b.isShadow)&&l.jsx("span",{className:V.badge,style:{borderColor:"var(--mc-accent)",color:"var(--mc-accent)"},children:"Shadow"})]}),l.jsx(BY,{issueId:t,source:(C=e.find(w=>w.identifier===t))==null?void 0:C.source,onOpenBeads:()=>r(!0)}),l.jsx(NK,{issueId:t,issues:e,featureData:b})]}):l.jsx("div",{className:V.contentEmpty,children:l.jsxs("div",{style:{textAlign:"center"},children:[l.jsx(QN,{size:48,style:{marginBottom:"var(--mc-space-4)",opacity:.3}}),l.jsx("p",{children:"Select a feature to view activity"})]})})})]}),s&&t&&l.jsx(P0,{issueId:t,isOpen:s,onClose:()=>r(!1)})]})}const vr=Object.create(null);vr.open="0";vr.close="1";vr.ping="2";vr.pong="3";vr.message="4";vr.upgrade="5";vr.noop="6";const Ph=Object.create(null);Object.keys(vr).forEach(e=>{Ph[vr[e]]=e});const Iv={type:"error",data:"parser error"},NP=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",jP=typeof ArrayBuffer=="function",EP=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,n_=({type:e,data:t},n,s)=>NP&&t instanceof Blob?n?s(t):FS(t,s):jP&&(t instanceof ArrayBuffer||EP(t))?n?s(t):FS(new Blob([t]),s):s(vr[e]+(t||"")),FS=(e,t)=>{const n=new FileReader;return n.onload=function(){const s=n.result.split(",")[1];t("b"+(s||""))},n.readAsDataURL(e)};function BS(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let ng;function ZY(e,t){if(NP&&e.data instanceof Blob)return e.data.arrayBuffer().then(BS).then(t);if(jP&&(e.data instanceof ArrayBuffer||EP(e.data)))return t(BS(e.data));n_(e,!1,n=>{ng||(ng=new TextEncoder),t(ng.encode(n))})}const zS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gc=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<zS.length;e++)gc[zS.charCodeAt(e)]=e;const eX=e=>{let t=e.length*.75,n=e.length,s,r=0,i,o,a,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),d=new Uint8Array(u);for(s=0;s<n;s+=4)i=gc[e.charCodeAt(s)],o=gc[e.charCodeAt(s+1)],a=gc[e.charCodeAt(s+2)],c=gc[e.charCodeAt(s+3)],d[r++]=i<<2|o>>4,d[r++]=(o&15)<<4|a>>2,d[r++]=(a&3)<<6|c&63;return u},tX=typeof ArrayBuffer=="function",s_=(e,t)=>{if(typeof e!="string")return{type:"message",data:PP(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:nX(e.substring(1),t)}:Ph[n]?e.length>1?{type:Ph[n],data:e.substring(1)}:{type:Ph[n]}:Iv},nX=(e,t)=>{if(tX){const n=eX(e);return PP(n,t)}else return{base64:!0,data:e}},PP=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},TP="",sX=(e,t)=>{const n=e.length,s=new Array(n);let r=0;e.forEach((i,o)=>{n_(i,!1,a=>{s[o]=a,++r===n&&t(s.join(TP))})})},rX=(e,t)=>{const n=e.split(TP),s=[];for(let r=0;r<n.length;r++){const i=s_(n[r],t);if(s.push(i),i.type==="error")break}return s};function iX(){return new TransformStream({transform(e,t){ZY(e,n=>{const s=n.length;let r;if(s<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,s);else if(s<65536){r=new Uint8Array(3);const i=new DataView(r.buffer);i.setUint8(0,126),i.setUint16(1,s)}else{r=new Uint8Array(9);const i=new DataView(r.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(s))}e.data&&typeof e.data!="string"&&(r[0]|=128),t.enqueue(r),t.enqueue(n)})}})}let sg;function zd(e){return e.reduce((t,n)=>t+n.length,0)}function $d(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let s=0;for(let r=0;r<t;r++)n[r]=e[0][s++],s===e[0].length&&(e.shift(),s=0);return e.length&&s<e[0].length&&(e[0]=e[0].slice(s)),n}function oX(e,t){sg||(sg=new TextDecoder);const n=[];let s=0,r=-1,i=!1;return new TransformStream({transform(o,a){for(n.push(o);;){if(s===0){if(zd(n)<1)break;const c=$d(n,1);i=(c[0]&128)===128,r=c[0]&127,r<126?s=3:r===126?s=1:s=2}else if(s===1){if(zd(n)<2)break;const c=$d(n,2);r=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),s=3}else if(s===2){if(zd(n)<8)break;const c=$d(n,8),u=new DataView(c.buffer,c.byteOffset,c.length),d=u.getUint32(0);if(d>Math.pow(2,21)-1){a.enqueue(Iv);break}r=d*Math.pow(2,32)+u.getUint32(4),s=3}else{if(zd(n)<r)break;const c=$d(n,r);a.enqueue(s_(i?c:sg.decode(c),t)),s=0}if(r===0||r>e){a.enqueue(Iv);break}}}})}const RP=4;function Dt(e){if(e)return aX(e)}function aX(e){for(var t in Dt.prototype)e[t]=Dt.prototype[t];return e}Dt.prototype.on=Dt.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Dt.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Dt.prototype.off=Dt.prototype.removeListener=Dt.prototype.removeAllListeners=Dt.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 s,r=0;r<n.length;r++)if(s=n[r],s===t||s.fn===t){n.splice(r,1);break}return n.length===0&&delete this._callbacks["$"+e],this};Dt.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],s=1;s<arguments.length;s++)t[s-1]=arguments[s];if(n){n=n.slice(0);for(var s=0,r=n.length;s<r;++s)n[s].apply(this,t)}return this};Dt.prototype.emitReserved=Dt.prototype.emit;Dt.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};Dt.prototype.hasListeners=function(e){return!!this.listeners(e).length};const kp=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Cs=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),lX="arraybuffer";function DP(e,...t){return t.reduce((n,s)=>(e.hasOwnProperty(s)&&(n[s]=e[s]),n),{})}const cX=Cs.setTimeout,uX=Cs.clearTimeout;function Cp(e,t){t.useNativeTimers?(e.setTimeoutFn=cX.bind(Cs),e.clearTimeoutFn=uX.bind(Cs)):(e.setTimeoutFn=Cs.setTimeout.bind(Cs),e.clearTimeoutFn=Cs.clearTimeout.bind(Cs))}const dX=1.33;function hX(e){return typeof e=="string"?fX(e):Math.ceil((e.byteLength||e.size)*dX)}function fX(e){let t=0,n=0;for(let s=0,r=e.length;s<r;s++)t=e.charCodeAt(s),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(s++,n+=4);return n}function MP(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function pX(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function mX(e){let t={},n=e.split("&");for(let s=0,r=n.length;s<r;s++){let i=n[s].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}class gX extends Error{constructor(t,n,s){super(t),this.description=n,this.context=s,this.type="TransportError"}}class r_ extends Dt{constructor(t){super(),this.writable=!1,Cp(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,s){return super.emitReserved("error",new gX(t,n,s)),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=s_(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=pX(t);return n.length?"?"+n:""}}class xX extends r_{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 s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||n()})),this.writable||(s++,this.once("drain",function(){--s||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};rX(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,sX(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]=MP()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let LP=!1;try{LP=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const vX=LP;function yX(){}class _X extends xX{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let s=location.port;s||(s=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||s!==t.port}}doWrite(t,n){const s=this.request({method:"POST",data:t});s.on("success",n),s.on("error",(r,i)=>{this.onError("xhr post error",r,i)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,s)=>{this.onError("xhr poll error",n,s)}),this.pollXhr=t}}class fr extends Dt{constructor(t,n,s){super(),this.createRequest=t,Cp(this,s),this._opts=s,this._method=s.method||"GET",this._uri=n,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var t;const n=DP(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(n);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&s.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var r;s.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=fr.requestsCount++,fr.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=yX,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete fr.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()}}fr.requestsCount=0;fr.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",$S);else if(typeof addEventListener=="function"){const e="onpagehide"in Cs?"pagehide":"unload";addEventListener(e,$S,!1)}}function $S(){for(let e in fr.requests)fr.requests.hasOwnProperty(e)&&fr.requests[e].abort()}const bX=function(){const e=AP({xdomain:!1});return e&&e.responseType!==null}();class wX extends _X{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=bX&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new fr(AP,this.uri(),t)}}function AP(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||vX))return new XMLHttpRequest}catch{}if(!t)try{return new Cs[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const OP=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class SX extends r_{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,s=OP?{}:DP(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,s)}catch(r){return this.emitReserved("error",r)}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 s=t[n],r=n===t.length-1;n_(s,this.supportsBinary,i=>{try{this.doWrite(s,i)}catch{}r&&kp(()=>{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]=MP()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const rg=Cs.WebSocket||Cs.MozWebSocket;class kX extends SX{createSocket(t,n,s){return OP?new rg(t,n,s):n?new rg(t,n):new rg(t)}doWrite(t,n){this.ws.send(n)}}class CX extends r_{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=oX(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=t.readable.pipeThrough(n).getReader(),r=iX();r.readable.pipeTo(t.writable),this._writer=r.writable.getWriter();const i=()=>{s.read().then(({done:a,value:c})=>{a||(this.onPacket(c),i())}).catch(a=>{})};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 s=t[n],r=n===t.length-1;this._writer.write(s).then(()=>{r&&kp(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const NX={websocket:kX,webtransport:CX,polling:wX},jX=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,EX=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Fv(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),s=e.indexOf("]");n!=-1&&s!=-1&&(e=e.substring(0,n)+e.substring(n,s).replace(/:/g,";")+e.substring(s,e.length));let r=jX.exec(e||""),i={},o=14;for(;o--;)i[EX[o]]=r[o]||"";return n!=-1&&s!=-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=PX(i,i.path),i.queryKey=TX(i,i.query),i}function PX(e,t){const n=/\/{2,9}/g,s=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&s.splice(0,1),t.slice(-1)=="/"&&s.splice(s.length-1,1),s}function TX(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,r,i){r&&(n[r]=i)}),n}const Bv=typeof addEventListener=="function"&&typeof removeEventListener=="function",Th=[];Bv&&addEventListener("offline",()=>{Th.forEach(e=>e())},!1);class Wi extends Dt{constructor(t,n){if(super(),this.binaryType=lX,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 s=Fv(t);n.hostname=s.host,n.secure=s.protocol==="https"||s.protocol==="wss",n.port=s.port,s.query&&(n.query=s.query)}else n.host&&(n.hostname=Fv(n.host).host);Cp(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(s=>{const r=s.prototype.name;this.transports.push(r),this._transportsByName[r]=s}),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=mX(this.opts.query)),Bv&&(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"})},Th.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=RP,n.transport=t,this.id&&(n.sid=this.id);const s=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](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&Wi.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",Wi.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 s=0;s<this.writeBuffer.length;s++){const r=this.writeBuffer[s].data;if(r&&(n+=hX(r)),s>0&&n>this._maxPayload)return this.writeBuffer.slice(0,s);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,kp(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,s){return this._sendPacket("message",t,n,s),this}send(t,n,s){return this._sendPacket("message",t,n,s),this}_sendPacket(t,n,s,r){if(typeof n=="function"&&(r=n,n=void 0),typeof s=="function"&&(r=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const i={type:t,data:n,options:s};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},s=()=>{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?s():t()}):this.upgrading?s():t()),this}_onError(t){if(Wi.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(),Bv&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=Th.indexOf(this._offlineEventListener);s!==-1&&Th.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}Wi.protocol=RP;class RX extends Wi{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),s=!1;Wi.priorWebsocketSuccess=!1;const r=()=>{s||(n.send([{type:"ping",data:"probe"}]),n.once("packet",h=>{if(!s)if(h.type==="pong"&&h.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Wi.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(d(),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(){s||(s=!0,d(),n.close(),n=null)}const o=h=>{const p=new Error("probe error: "+h);p.transport=n.name,i(),this.emitReserved("upgradeError",p)};function a(){o("transport closed")}function c(){o("socket closed")}function u(h){n&&h.name!==n.name&&i()}const d=()=>{n.removeListener("open",r),n.removeListener("error",o),n.removeListener("close",a),this.off("close",c),this.off("upgrading",u)};n.once("open",r),n.once("error",o),n.once("close",a),this.once("close",c),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{s||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let s=0;s<t.length;s++)~this.transports.indexOf(t[s])&&n.push(t[s]);return n}}let DX=class extends RX{constructor(t,n={}){const s=typeof t=="object"?t:n;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(r=>NX[r]).filter(r=>!!r)),super(t,s)}};function MX(e,t="",n){let s=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),s=Fv(e)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const i=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+i+":"+s.port+t,s.href=s.protocol+"://"+i+(n&&n.port===s.port?"":":"+s.port),s}const LX=typeof ArrayBuffer=="function",AX=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,IP=Object.prototype.toString,OX=typeof Blob=="function"||typeof Blob<"u"&&IP.call(Blob)==="[object BlobConstructor]",IX=typeof File=="function"||typeof File<"u"&&IP.call(File)==="[object FileConstructor]";function i_(e){return LX&&(e instanceof ArrayBuffer||AX(e))||OX&&e instanceof Blob||IX&&e instanceof File}function Rh(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,s=e.length;n<s;n++)if(Rh(e[n]))return!0;return!1}if(i_(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return Rh(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&Rh(e[n]))return!0;return!1}function FX(e){const t=[],n=e.data,s=e;return s.data=zv(n,t),s.attachments=t.length,{packet:s,buffers:t}}function zv(e,t){if(!e)return e;if(i_(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 s=0;s<e.length;s++)n[s]=zv(e[s],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=zv(e[s],t));return n}return e}function BX(e,t){return e.data=$v(e.data,t),delete e.attachments,e}function $v(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]=$v(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=$v(e[n],t));return e}const FP=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],zX=5;var je;(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"})(je||(je={}));class $X{constructor(t){this.replacer=t}encode(t){return(t.type===je.EVENT||t.type===je.ACK)&&Rh(t)?this.encodeAsBinary({type:t.type===je.EVENT?je.BINARY_EVENT:je.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===je.BINARY_EVENT||t.type===je.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=FX(t),s=this.encodeAsString(n.packet),r=n.buffers;return r.unshift(s),r}}class o_ extends Dt{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 s=n.type===je.BINARY_EVENT;s||n.type===je.BINARY_ACK?(n.type=s?je.EVENT:je.ACK,this.reconstructor=new HX(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(i_(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 s={type:Number(t.charAt(0))};if(je[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===je.BINARY_EVENT||s.type===je.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");s.attachments=Number(o)}if(t.charAt(n+1)==="/"){const i=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););s.nsp=t.substring(i,n)}else s.nsp="/";const r=t.charAt(n+1);if(r!==""&&Number(r)==r){const i=n+1;for(;++n;){const o=t.charAt(n);if(o==null||Number(o)!=o){--n;break}if(n===t.length)break}s.id=Number(t.substring(i,n+1))}if(t.charAt(++n)){const i=this.tryParse(t.substr(n));if(o_.isPayloadValid(s.type,i))s.data=i;else throw new Error("invalid payload")}return s}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case je.CONNECT:return Ef(n);case je.DISCONNECT:return n===void 0;case je.CONNECT_ERROR:return typeof n=="string"||Ef(n);case je.EVENT:case je.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&FP.indexOf(n[0])===-1);case je.ACK:case je.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class HX{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=BX(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function WX(e){return typeof e=="string"}const UX=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};function qX(e){return e===void 0||UX(e)}function Ef(e){return Object.prototype.toString.call(e)==="[object Object]"}function KX(e,t){switch(e){case je.CONNECT:return t===void 0||Ef(t);case je.DISCONNECT:return t===void 0;case je.EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&FP.indexOf(t[0])===-1);case je.ACK:return Array.isArray(t);case je.CONNECT_ERROR:return typeof t=="string"||Ef(t);default:return!1}}function VX(e){return WX(e.nsp)&&qX(e.id)&&KX(e.type,e.data)}const YX=Object.freeze(Object.defineProperty({__proto__:null,Decoder:o_,Encoder:$X,get PacketType(){return je},isPacketValid:VX,protocol:zX},Symbol.toStringTag,{value:"Module"}));function zs(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const XX=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class BP extends Dt{constructor(t,n,s){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,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[zs(t,"open",this.onopen.bind(this)),zs(t,"packet",this.onpacket.bind(this)),zs(t,"error",this.onerror.bind(this)),zs(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 s,r,i;if(XX.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:je.EVENT,data:n};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const d=this.ids++,h=n.pop();this._registerAckCallback(d,h),o.id=d}const a=(r=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||r===void 0?void 0:r.writable,c=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!a||(c?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,n){var s;const r=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(r===void 0){this.acks[t]=n;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===t&&this.sendBuffer.splice(a,1);n.call(this,new Error("operation has timed out"))},r),o=(...a)=>{this.io.clearTimeoutFn(i),n.apply(this,a)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...n){return new Promise((s,r)=>{const i=(o,a)=>o?r(o):s(a);i.withError=!0,n.push(i),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((r,...i)=>(this._queue[0],r!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(r)):(this._queue.shift(),n&&n(null,...i)),s.pending=!1,this._drainQueue())),this._queue.push(s),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:je.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(s=>String(s.id)===t)){const s=this.acks[t];delete this.acks[t],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case je.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 je.EVENT:case je.BINARY_EVENT:this.onevent(t);break;case je.ACK:case je.BINARY_ACK:this.onack(t);break;case je.DISCONNECT:this.ondisconnect();break;case je.CONNECT_ERROR:this.destroy();const s=new Error(t.data.message);s.data=t.data.data,this.emitReserved("connect_error",s);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 s of n)s.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 s=!1;return function(...r){s||(s=!0,n.packet({type:je.ACK,id:t,data:r}))}}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:je.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 s=0;s<n.length;s++)if(t===n[s])return n.splice(s,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 s=0;s<n.length;s++)if(t===n[s])return n.splice(s,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 s of n)s.apply(this,t.data)}}}function El(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}El.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};El.prototype.reset=function(){this.attempts=0};El.prototype.setMin=function(e){this.ms=e};El.prototype.setMax=function(e){this.max=e};El.prototype.setJitter=function(e){this.jitter=e};class Hv extends Dt{constructor(t,n){var s;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,Cp(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((s=n.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new El({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const r=n.parser||YX;this.encoder=new r.Encoder,this.decoder=new r.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 DX(this.uri,this.opts);const n=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const r=zs(n,"open",function(){s.onopen(),t&&t()}),i=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},o=zs(n,"error",i);if(this._timeout!==!1){const a=this._timeout,c=this.setTimeoutFn(()=>{r(),i(new Error("timeout")),n.close()},a);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(r),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(zs(t,"ping",this.onping.bind(this)),zs(t,"data",this.ondata.bind(this)),zs(t,"error",this.onerror.bind(this)),zs(t,"close",this.onclose.bind(this)),zs(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){kp(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let s=this.nsps[t];return s?this._autoConnect&&!s.active&&s.connect():(s=new BP(this,t,n),this.nsps[t]=s),s}_destroy(t){const n=Object.keys(this.nsps);for(const s of n)if(this.nsps[s].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let s=0;s<n.length;s++)this.engine.write(n[s],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 s;this.cleanup(),(s=this.engine)===null||s===void 0||s.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 s=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(r=>{r?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",r)):t.onreconnect()}))},n);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Zl={};function Ic(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=MX(e,t.path||"/socket.io"),s=n.source,r=n.id,i=n.path,o=Zl[r]&&i in Zl[r].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let c;return a?c=new Hv(s,t):(Zl[r]||(Zl[r]=new Hv(s,t)),c=Zl[r]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(Ic,{Manager:Hv,Socket:BP,io:Ic,connect:Ic});let bo=null,Hd=0;function QX(){return(!bo||!bo.connected)&&(bo=Ic({path:"/socket.io",transports:["websocket","polling"],reconnectionDelay:1e3,reconnectionDelayMax:1e4})),bo}function GX(){const e=Lt();y.useEffect(()=>{const t=QX();Hd++;const n=s=>{e.setQueryData(["resources"],s)};return t.on("resources:updated",n),()=>{t.off("resources:updated",n),Hd--,Hd<=0&&bo&&(bo.disconnect(),bo=null,Hd=0)}},[e])}function JX(e){return e>=85?"bg-red-500":e>=60?"bg-yellow-400":"bg-green-500"}function Pf({value:e,label:t,showValue:n=!0,className:s=""}){const r=Math.min(100,Math.max(0,e)),i=JX(r);return l.jsxs("div",{className:`flex flex-col gap-0.5 ${s}`,children:[(t||n)&&l.jsxs("div",{className:"flex justify-between items-center",children:[t&&l.jsx("span",{className:"text-xs text-content-subtle",children:t}),n&&l.jsxs("span",{className:"text-xs text-content-subtle ml-auto",children:[r.toFixed(1),"%"]})]}),l.jsx("div",{className:"h-1.5 bg-surface-overlay rounded-full overflow-hidden",children:l.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${i}`,style:{width:`${r}%`}})})]})}/*!
|
|
713
|
+
* @kurkle/color v0.3.4
|
|
714
|
+
* https://github.com/kurkle/color#readme
|
|
715
|
+
* (c) 2024 Jukka Kurkela
|
|
716
|
+
* Released under the MIT License
|
|
717
|
+
*/function Xu(e){return e+.5|0}const ji=(e,t,n)=>Math.max(Math.min(e,n),t);function xc(e){return ji(Xu(e*2.55),0,255)}function Ui(e){return ji(Xu(e*255),0,255)}function Pr(e){return ji(Xu(e/2.55)/100,0,1)}function HS(e){return ji(Xu(e*100),0,100)}const gs={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Wv=[..."0123456789ABCDEF"],ZX=e=>Wv[e&15],eQ=e=>Wv[(e&240)>>4]+Wv[e&15],Wd=e=>(e&240)>>4===(e&15),tQ=e=>Wd(e.r)&&Wd(e.g)&&Wd(e.b)&&Wd(e.a);function nQ(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&gs[e[1]]*17,g:255&gs[e[2]]*17,b:255&gs[e[3]]*17,a:t===5?gs[e[4]]*17:255}:(t===7||t===9)&&(n={r:gs[e[1]]<<4|gs[e[2]],g:gs[e[3]]<<4|gs[e[4]],b:gs[e[5]]<<4|gs[e[6]],a:t===9?gs[e[7]]<<4|gs[e[8]]:255})),n}const sQ=(e,t)=>e<255?t(e):"";function rQ(e){var t=tQ(e)?ZX:eQ;return e?"#"+t(e.r)+t(e.g)+t(e.b)+sQ(e.a,t):void 0}const iQ=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function zP(e,t,n){const s=t*Math.min(n,1-n),r=(i,o=(i+e/30)%12)=>n-s*Math.max(Math.min(o-3,9-o,1),-1);return[r(0),r(8),r(4)]}function oQ(e,t,n){const s=(r,i=(r+e/60)%6)=>n-n*t*Math.max(Math.min(i,4-i,1),0);return[s(5),s(3),s(1)]}function aQ(e,t,n){const s=zP(e,1,.5);let r;for(t+n>1&&(r=1/(t+n),t*=r,n*=r),r=0;r<3;r++)s[r]*=1-t-n,s[r]+=t;return s}function lQ(e,t,n,s,r){return e===r?(t-n)/s+(t<n?6:0):t===r?(n-e)/s+2:(e-t)/s+4}function a_(e){const n=e.r/255,s=e.g/255,r=e.b/255,i=Math.max(n,s,r),o=Math.min(n,s,r),a=(i+o)/2;let c,u,d;return i!==o&&(d=i-o,u=a>.5?d/(2-i-o):d/(i+o),c=lQ(n,s,r,d,i),c=c*60+.5),[c|0,u||0,a]}function l_(e,t,n,s){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,s)).map(Ui)}function c_(e,t,n){return l_(zP,e,t,n)}function cQ(e,t,n){return l_(aQ,e,t,n)}function uQ(e,t,n){return l_(oQ,e,t,n)}function $P(e){return(e%360+360)%360}function dQ(e){const t=iQ.exec(e);let n=255,s;if(!t)return;t[5]!==s&&(n=t[6]?xc(+t[5]):Ui(+t[5]));const r=$P(+t[2]),i=+t[3]/100,o=+t[4]/100;return t[1]==="hwb"?s=cQ(r,i,o):t[1]==="hsv"?s=uQ(r,i,o):s=c_(r,i,o),{r:s[0],g:s[1],b:s[2],a:n}}function hQ(e,t){var n=a_(e);n[0]=$P(n[0]+t),n=c_(n),e.r=n[0],e.g=n[1],e.b=n[2]}function fQ(e){if(!e)return;const t=a_(e),n=t[0],s=HS(t[1]),r=HS(t[2]);return e.a<255?`hsla(${n}, ${s}%, ${r}%, ${Pr(e.a)})`:`hsl(${n}, ${s}%, ${r}%)`}const WS={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},US={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function pQ(){const e={},t=Object.keys(US),n=Object.keys(WS);let s,r,i,o,a;for(s=0;s<t.length;s++){for(o=a=t[s],r=0;r<n.length;r++)i=n[r],a=a.replace(i,WS[i]);i=parseInt(US[o],16),e[a]=[i>>16&255,i>>8&255,i&255]}return e}let Ud;function mQ(e){Ud||(Ud=pQ(),Ud.transparent=[0,0,0,0]);const t=Ud[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const gQ=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function xQ(e){const t=gQ.exec(e);let n=255,s,r,i;if(t){if(t[7]!==s){const o=+t[7];n=t[8]?xc(o):ji(o*255,0,255)}return s=+t[1],r=+t[3],i=+t[5],s=255&(t[2]?xc(s):ji(s,0,255)),r=255&(t[4]?xc(r):ji(r,0,255)),i=255&(t[6]?xc(i):ji(i,0,255)),{r:s,g:r,b:i,a:n}}}function vQ(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${Pr(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}const ig=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,ma=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function yQ(e,t,n){const s=ma(Pr(e.r)),r=ma(Pr(e.g)),i=ma(Pr(e.b));return{r:Ui(ig(s+n*(ma(Pr(t.r))-s))),g:Ui(ig(r+n*(ma(Pr(t.g))-r))),b:Ui(ig(i+n*(ma(Pr(t.b))-i))),a:e.a+n*(t.a-e.a)}}function qd(e,t,n){if(e){let s=a_(e);s[t]=Math.max(0,Math.min(s[t]+s[t]*n,t===0?360:1)),s=c_(s),e.r=s[0],e.g=s[1],e.b=s[2]}}function HP(e,t){return e&&Object.assign(t||{},e)}function qS(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=Ui(e[3]))):(t=HP(e,{r:0,g:0,b:0,a:1}),t.a=Ui(t.a)),t}function _Q(e){return e.charAt(0)==="r"?xQ(e):dQ(e)}class vu{constructor(t){if(t instanceof vu)return t;const n=typeof t;let s;n==="object"?s=qS(t):n==="string"&&(s=nQ(t)||mQ(t)||_Q(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=HP(this._rgb);return t&&(t.a=Pr(t.a)),t}set rgb(t){this._rgb=qS(t)}rgbString(){return this._valid?vQ(this._rgb):void 0}hexString(){return this._valid?rQ(this._rgb):void 0}hslString(){return this._valid?fQ(this._rgb):void 0}mix(t,n){if(t){const s=this.rgb,r=t.rgb;let i;const o=n===i?.5:n,a=2*o-1,c=s.a-r.a,u=((a*c===-1?a:(a+c)/(1+a*c))+1)/2;i=1-u,s.r=255&u*s.r+i*r.r+.5,s.g=255&u*s.g+i*r.g+.5,s.b=255&u*s.b+i*r.b+.5,s.a=o*s.a+(1-o)*r.a,this.rgb=s}return this}interpolate(t,n){return t&&(this._rgb=yQ(this._rgb,t._rgb,n)),this}clone(){return new vu(this.rgb)}alpha(t){return this._rgb.a=Ui(t),this}clearer(t){const n=this._rgb;return n.a*=1-t,this}greyscale(){const t=this._rgb,n=Xu(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=n,this}opaquer(t){const n=this._rgb;return n.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return qd(this._rgb,2,t),this}darken(t){return qd(this._rgb,2,-t),this}saturate(t){return qd(this._rgb,1,t),this}desaturate(t){return qd(this._rgb,1,-t),this}rotate(t){return hQ(this._rgb,t),this}}/*!
|
|
718
|
+
* Chart.js v4.5.1
|
|
719
|
+
* https://www.chartjs.org
|
|
720
|
+
* (c) 2025 Chart.js Contributors
|
|
721
|
+
* Released under the MIT License
|
|
722
|
+
*/const bQ=(()=>{let e=0;return()=>e++})();function vt(e){return e==null}function dn(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function $e(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function Nn(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function Gs(e,t){return Nn(e)?e:t}function Ye(e,t){return typeof e>"u"?t:e}const wQ=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function kt(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function bn(e,t,n,s){let r,i,o;if(dn(e))for(i=e.length,r=0;r<i;r++)t.call(n,e[r],r);else if($e(e))for(o=Object.keys(e),i=o.length,r=0;r<i;r++)t.call(n,e[o[r]],o[r])}function KS(e,t){let n,s,r,i;if(!e||!t||e.length!==t.length)return!1;for(n=0,s=e.length;n<s;++n)if(r=e[n],i=t[n],r.datasetIndex!==i.datasetIndex||r.index!==i.index)return!1;return!0}function Tf(e){if(dn(e))return e.map(Tf);if($e(e)){const t=Object.create(null),n=Object.keys(e),s=n.length;let r=0;for(;r<s;++r)t[n[r]]=Tf(e[n[r]]);return t}return e}function WP(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function SQ(e,t,n,s){if(!WP(e))return;const r=t[e],i=n[e];$e(r)&&$e(i)?yu(r,i,s):t[e]=Tf(i)}function yu(e,t,n){const s=dn(t)?t:[t],r=s.length;if(!$e(e))return e;n=n||{};const i=n.merger||SQ;let o;for(let a=0;a<r;++a){if(o=s[a],!$e(o))continue;const c=Object.keys(o);for(let u=0,d=c.length;u<d;++u)i(c[u],e,o,n)}return e}function Fc(e,t){return yu(e,t,{merger:kQ})}function kQ(e,t,n){if(!WP(e))return;const s=t[e],r=n[e];$e(s)&&$e(r)?Fc(s,r):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=Tf(r))}const VS={"":e=>e,x:e=>e.x,y:e=>e.y};function CQ(e){const t=e.split("."),n=[];let s="";for(const r of t)s+=r,s.endsWith("\\")?s=s.slice(0,-1)+".":(n.push(s),s="");return n}function NQ(e){const t=CQ(e);return n=>{for(const s of t){if(s==="")break;n=n&&n[s]}return n}}function Rf(e,t){return(VS[t]||(VS[t]=NQ(t)))(e)}function u_(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Df=e=>typeof e<"u",Xi=e=>typeof e=="function",YS=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function jQ(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const hs=Math.PI,pr=2*hs,EQ=pr+hs,Mf=Number.POSITIVE_INFINITY,PQ=hs/180,Ei=hs/2,ro=hs/4,XS=hs*2/3,UP=Math.log10,dl=Math.sign;function Bc(e,t,n){return Math.abs(e-t)<n}function QS(e){const t=Math.round(e);e=Bc(e,t,e/1e3)?t:e;const n=Math.pow(10,Math.floor(UP(e))),s=e/n;return(s<=1?1:s<=2?2:s<=5?5:10)*n}function TQ(e){const t=[],n=Math.sqrt(e);let s;for(s=1;s<n;s++)e%s===0&&(t.push(s),t.push(e/s));return n===(n|0)&&t.push(n),t.sort((r,i)=>r-i).pop(),t}function RQ(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function Lf(e){return!RQ(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function DQ(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function MQ(e,t,n){let s,r,i;for(s=0,r=e.length;s<r;s++)i=e[s][n],isNaN(i)||(t.min=Math.min(t.min,i),t.max=Math.max(t.max,i))}function wo(e){return e*(hs/180)}function LQ(e){return e*(180/hs)}function GS(e){if(!Nn(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function AQ(e,t){const n=t.x-e.x,s=t.y-e.y,r=Math.sqrt(n*n+s*s);let i=Math.atan2(s,n);return i<-.5*hs&&(i+=pr),{angle:i,distance:r}}function JS(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function OQ(e,t){return(e-t+EQ)%pr-hs}function sr(e){return(e%pr+pr)%pr}function qP(e,t,n,s){const r=sr(e),i=sr(t),o=sr(n),a=sr(i-r),c=sr(o-r),u=sr(r-i),d=sr(r-o);return r===i||r===o||s&&i===o||a>c&&u<d}function Pi(e,t,n){return Math.max(t,Math.min(n,e))}function IQ(e){return Pi(e,-32768,32767)}function KP(e,t,n,s=1e-6){return e>=Math.min(t,n)-s&&e<=Math.max(t,n)+s}function d_(e,t,n){n=n||(o=>e[o]<t);let s=e.length-1,r=0,i;for(;s-r>1;)i=r+s>>1,n(i)?r=i:s=i;return{lo:r,hi:s}}const Uv=(e,t,n,s)=>d_(e,n,s?r=>{const i=e[r][t];return i<n||i===n&&e[r+1][t]===n}:r=>e[r][t]<n),FQ=(e,t,n)=>d_(e,n,s=>e[s][t]>=n);function BQ(e,t,n){let s=0,r=e.length;for(;s<r&&e[s]<t;)s++;for(;r>s&&e[r-1]>n;)r--;return s>0||r<e.length?e.slice(s,r):e}const VP=["push","pop","shift","splice","unshift"];function zQ(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),VP.forEach(n=>{const s="_onData"+u_(n),r=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...i){const o=r.apply(this,i);return e._chartjs.listeners.forEach(a=>{typeof a[s]=="function"&&a[s](...i)}),o}})})}function ZS(e,t){const n=e._chartjs;if(!n)return;const s=n.listeners,r=s.indexOf(t);r!==-1&&s.splice(r,1),!(s.length>0)&&(VP.forEach(i=>{delete e[i]}),delete e._chartjs)}function $Q(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const YP=function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame}();function XP(e,t){let n=[],s=!1;return function(...r){n=r,s||(s=!0,YP.call(window,()=>{s=!1,e.apply(t,n)}))}}function HQ(e,t){let n;return function(...s){return t?(clearTimeout(n),n=setTimeout(e,t,s)):e.apply(this,s),t}}const WQ=e=>e==="start"?"left":e==="end"?"right":"center",ek=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,Kd=e=>e===0||e===1,tk=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*pr/n)),nk=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*pr/n)+1,zc={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*Ei)+1,easeOutSine:e=>Math.sin(e*Ei),easeInOutSine:e=>-.5*(Math.cos(hs*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>Kd(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>Kd(e)?e:tk(e,.075,.3),easeOutElastic:e=>Kd(e)?e:nk(e,.075,.3),easeInOutElastic(e){return Kd(e)?e:e<.5?.5*tk(e*2,.1125,.45):.5+.5*nk(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-zc.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?zc.easeInBounce(e*2)*.5:zc.easeOutBounce(e*2-1)*.5+.5};function h_(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function sk(e){return h_(e)?e:new vu(e)}function og(e){return h_(e)?e:new vu(e).saturate(.5).darken(.1).hexString()}const UQ=["x","y","borderWidth","radius","tension"],qQ=["color","borderColor","backgroundColor"];function KQ(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:qQ},numbers:{type:"number",properties:UQ}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function VQ(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const rk=new Map;function YQ(e,t){t=t||{};const n=e+JSON.stringify(t);let s=rk.get(n);return s||(s=new Intl.NumberFormat(e,t),rk.set(n,s)),s}function QP(e,t,n){return YQ(t,n).format(e)}const XQ={values(e){return dn(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";const s=this.chart.options.locale;let r,i=e;if(n.length>1){const u=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(u<1e-4||u>1e15)&&(r="scientific"),i=QQ(e,n)}const o=UP(Math.abs(i)),a=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),c={notation:r,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(c,this.options.ticks.format),QP(e,s,c)}};function QQ(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var GP={formatters:XQ};function GQ(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,n)=>n.lineWidth,tickColor:(t,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:GP.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Zo=Object.create(null),qv=Object.create(null);function $c(e,t){if(!t)return e;const n=t.split(".");for(let s=0,r=n.length;s<r;++s){const i=n[s];e=e[i]||(e[i]=Object.create(null))}return e}function ag(e,t,n){return typeof t=="string"?yu($c(e,t),n):yu($c(e,""),t)}class JQ{constructor(t,n){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=s=>s.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(s,r)=>og(r.backgroundColor),this.hoverBorderColor=(s,r)=>og(r.borderColor),this.hoverColor=(s,r)=>og(r.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(n)}set(t,n){return ag(this,t,n)}get(t){return $c(this,t)}describe(t,n){return ag(qv,t,n)}override(t,n){return ag(Zo,t,n)}route(t,n,s,r){const i=$c(this,t),o=$c(this,s),a="_"+n;Object.defineProperties(i,{[a]:{value:i[n],writable:!0},[n]:{enumerable:!0,get(){const c=this[a],u=o[r];return $e(c)?Object.assign({},u,c):Ye(c,u)},set(c){this[a]=c}}})}apply(t){t.forEach(n=>n(this))}}var Mt=new JQ({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[KQ,VQ,GQ]);function ZQ(e){return!e||vt(e.size)||vt(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function ik(e,t,n,s,r){let i=t[r];return i||(i=t[r]=e.measureText(r).width,n.push(r)),i>s&&(s=i),s}function io(e,t,n){const s=e.currentDevicePixelRatio,r=n!==0?Math.max(n/2,.5):0;return Math.round((t-r)*s)/s+r}function ok(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function eG(e,t,n,s){tG(e,t,n,s)}function tG(e,t,n,s,r){let i,o,a,c,u,d,h,p;const f=t.pointStyle,m=t.rotation,g=t.radius;let v=(m||0)*PQ;if(f&&typeof f=="object"&&(i=f.toString(),i==="[object HTMLImageElement]"||i==="[object HTMLCanvasElement]")){e.save(),e.translate(n,s),e.rotate(v),e.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),e.restore();return}if(!(isNaN(g)||g<=0)){switch(e.beginPath(),f){default:e.arc(n,s,g,0,pr),e.closePath();break;case"triangle":d=g,e.moveTo(n+Math.sin(v)*d,s-Math.cos(v)*g),v+=XS,e.lineTo(n+Math.sin(v)*d,s-Math.cos(v)*g),v+=XS,e.lineTo(n+Math.sin(v)*d,s-Math.cos(v)*g),e.closePath();break;case"rectRounded":u=g*.516,c=g-u,o=Math.cos(v+ro)*c,h=Math.cos(v+ro)*c,a=Math.sin(v+ro)*c,p=Math.sin(v+ro)*c,e.arc(n-h,s-a,u,v-hs,v-Ei),e.arc(n+p,s-o,u,v-Ei,v),e.arc(n+h,s+a,u,v,v+Ei),e.arc(n-p,s+o,u,v+Ei,v+hs),e.closePath();break;case"rect":if(!m){c=Math.SQRT1_2*g,d=c,e.rect(n-d,s-c,2*d,2*c);break}v+=ro;case"rectRot":h=Math.cos(v)*g,o=Math.cos(v)*g,a=Math.sin(v)*g,p=Math.sin(v)*g,e.moveTo(n-h,s-a),e.lineTo(n+p,s-o),e.lineTo(n+h,s+a),e.lineTo(n-p,s+o),e.closePath();break;case"crossRot":v+=ro;case"cross":h=Math.cos(v)*g,o=Math.cos(v)*g,a=Math.sin(v)*g,p=Math.sin(v)*g,e.moveTo(n-h,s-a),e.lineTo(n+h,s+a),e.moveTo(n+p,s-o),e.lineTo(n-p,s+o);break;case"star":h=Math.cos(v)*g,o=Math.cos(v)*g,a=Math.sin(v)*g,p=Math.sin(v)*g,e.moveTo(n-h,s-a),e.lineTo(n+h,s+a),e.moveTo(n+p,s-o),e.lineTo(n-p,s+o),v+=ro,h=Math.cos(v)*g,o=Math.cos(v)*g,a=Math.sin(v)*g,p=Math.sin(v)*g,e.moveTo(n-h,s-a),e.lineTo(n+h,s+a),e.moveTo(n+p,s-o),e.lineTo(n-p,s+o);break;case"line":o=Math.cos(v)*g,a=Math.sin(v)*g,e.moveTo(n-o,s-a),e.lineTo(n+o,s+a);break;case"dash":e.moveTo(n,s),e.lineTo(n+Math.cos(v)*g,s+Math.sin(v)*g);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function _u(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function f_(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function p_(e){e.restore()}function nG(e,t,n,s,r){if(!t)return e.lineTo(n.x,n.y);if(r==="middle"){const i=(t.x+n.x)/2;e.lineTo(i,t.y),e.lineTo(i,n.y)}else r==="after"!=!!s?e.lineTo(t.x,n.y):e.lineTo(n.x,t.y);e.lineTo(n.x,n.y)}function sG(e,t,n,s){if(!t)return e.lineTo(n.x,n.y);e.bezierCurveTo(s?t.cp1x:t.cp2x,s?t.cp1y:t.cp2y,s?n.cp2x:n.cp1x,s?n.cp2y:n.cp1y,n.x,n.y)}function rG(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),vt(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function iG(e,t,n,s,r){if(r.strikethrough||r.underline){const i=e.measureText(s),o=t-i.actualBoundingBoxLeft,a=t+i.actualBoundingBoxRight,c=n-i.actualBoundingBoxAscent,u=n+i.actualBoundingBoxDescent,d=r.strikethrough?(c+u)/2:u;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=r.decorationWidth||2,e.moveTo(o,d),e.lineTo(a,d),e.stroke()}}function oG(e,t){const n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function ak(e,t,n,s,r,i={}){const o=dn(t)?t:[t],a=i.strokeWidth>0&&i.strokeColor!=="";let c,u;for(e.save(),e.font=r.string,rG(e,i),c=0;c<o.length;++c)u=o[c],i.backdrop&&oG(e,i.backdrop),a&&(i.strokeColor&&(e.strokeStyle=i.strokeColor),vt(i.strokeWidth)||(e.lineWidth=i.strokeWidth),e.strokeText(u,n,s,i.maxWidth)),e.fillText(u,n,s,i.maxWidth),iG(e,n,s,u,i),s+=Number(r.lineHeight);e.restore()}const aG=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,lG=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function cG(e,t){const n=(""+e).match(aG);if(!n||n[1]==="normal")return t*1.2;switch(e=+n[2],n[3]){case"px":return e;case"%":e/=100;break}return t*e}const uG=e=>+e||0;function dG(e,t){const n={},s=$e(t),r=s?Object.keys(t):t,i=$e(e)?s?o=>Ye(e[o],e[t[o]]):o=>e[o]:()=>e;for(const o of r)n[o]=uG(i(o));return n}function hG(e){return dG(e,{top:"y",right:"x",bottom:"y",left:"x"})}function bu(e){const t=hG(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Kv(e,t){e=e||{},t=t||Mt.font;let n=Ye(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let s=Ye(e.style,t.style);s&&!(""+s).match(lG)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const r={family:Ye(e.family,t.family),lineHeight:cG(Ye(e.lineHeight,t.lineHeight),n),size:n,style:s,weight:Ye(e.weight,t.weight),string:""};return r.string=ZQ(r),r}function Vd(e,t,n,s){let r,i,o;for(r=0,i=e.length;r<i;++r)if(o=e[r],o!==void 0&&o!==void 0)return o}function fG(e,t,n){const{min:s,max:r}=e,i=wQ(t,(r-s)/2),o=(a,c)=>n&&a===0?0:a+c;return{min:o(s,-Math.abs(i)),max:o(r,i)}}function Pl(e,t){return Object.assign(Object.create(e),t)}function m_(e,t=[""],n,s,r=()=>e[0]){const i=n||e;typeof s>"u"&&(s=t4("_fallback",e));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:i,_fallback:s,_getTarget:r,override:a=>m_([a,...e],t,i,s)};return new Proxy(o,{deleteProperty(a,c){return delete a[c],delete a._keys,delete e[0][c],!0},get(a,c){return ZP(a,c,()=>bG(c,t,e,a))},getOwnPropertyDescriptor(a,c){return Reflect.getOwnPropertyDescriptor(a._scopes[0],c)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,c){return ck(a).includes(c)},ownKeys(a){return ck(a)},set(a,c,u){const d=a._storage||(a._storage=r());return a[c]=d[c]=u,delete a._keys,!0}})}function hl(e,t,n,s){const r={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:JP(e,s),setContext:i=>hl(e,i,n,s),override:i=>hl(e.override(i),t,n,s)};return new Proxy(r,{deleteProperty(i,o){return delete i[o],delete e[o],!0},get(i,o,a){return ZP(i,o,()=>mG(i,o,a))},getOwnPropertyDescriptor(i,o){return i._descriptors.allKeys?Reflect.has(e,o)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,o)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(i,o){return Reflect.has(e,o)},ownKeys(){return Reflect.ownKeys(e)},set(i,o,a){return e[o]=a,delete i[o],!0}})}function JP(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:s=t.indexable,_allKeys:r=t.allKeys}=e;return{allKeys:r,scriptable:n,indexable:s,isScriptable:Xi(n)?n:()=>n,isIndexable:Xi(s)?s:()=>s}}const pG=(e,t)=>e?e+u_(t):t,g_=(e,t)=>$e(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function ZP(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const s=n();return e[t]=s,s}function mG(e,t,n){const{_proxy:s,_context:r,_subProxy:i,_descriptors:o}=e;let a=s[t];return Xi(a)&&o.isScriptable(t)&&(a=gG(t,a,e,n)),dn(a)&&a.length&&(a=xG(t,a,e,o.isIndexable)),g_(t,a)&&(a=hl(a,r,i&&i[t],o)),a}function gG(e,t,n,s){const{_proxy:r,_context:i,_subProxy:o,_stack:a}=n;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let c=t(i,o||s);return a.delete(e),g_(e,c)&&(c=x_(r._scopes,r,e,c)),c}function xG(e,t,n,s){const{_proxy:r,_context:i,_subProxy:o,_descriptors:a}=n;if(typeof i.index<"u"&&s(e))return t[i.index%t.length];if($e(t[0])){const c=t,u=r._scopes.filter(d=>d!==c);t=[];for(const d of c){const h=x_(u,r,e,d);t.push(hl(h,i,o&&o[e],a))}}return t}function e4(e,t,n){return Xi(e)?e(t,n):e}const vG=(e,t)=>e===!0?t:typeof e=="string"?Rf(t,e):void 0;function yG(e,t,n,s,r){for(const i of t){const o=vG(n,i);if(o){e.add(o);const a=e4(o._fallback,n,r);if(typeof a<"u"&&a!==n&&a!==s)return a}else if(o===!1&&typeof s<"u"&&n!==s)return null}return!1}function x_(e,t,n,s){const r=t._rootScopes,i=e4(t._fallback,n,s),o=[...e,...r],a=new Set;a.add(s);let c=lk(a,o,n,i||n,s);return c===null||typeof i<"u"&&i!==n&&(c=lk(a,o,i,c,s),c===null)?!1:m_(Array.from(a),[""],r,i,()=>_G(t,n,s))}function lk(e,t,n,s,r){for(;n;)n=yG(e,t,n,s,r);return n}function _G(e,t,n){const s=e._getTarget();t in s||(s[t]={});const r=s[t];return dn(r)&&$e(n)?n:r||{}}function bG(e,t,n,s){let r;for(const i of t)if(r=t4(pG(i,e),n),typeof r<"u")return g_(e,r)?x_(n,s,e,r):r}function t4(e,t){for(const n of t){if(!n)continue;const s=n[e];if(typeof s<"u")return s}}function ck(e){let t=e._keys;return t||(t=e._keys=wG(e._scopes)),t}function wG(e){const t=new Set;for(const n of e)for(const s of Object.keys(n).filter(r=>!r.startsWith("_")))t.add(s);return Array.from(t)}const SG=Number.EPSILON||1e-14,fl=(e,t)=>t<e.length&&!e[t].skip&&e[t],n4=e=>e==="x"?"y":"x";function kG(e,t,n,s){const r=e.skip?t:e,i=t,o=n.skip?t:n,a=JS(i,r),c=JS(o,i);let u=a/(a+c),d=c/(a+c);u=isNaN(u)?0:u,d=isNaN(d)?0:d;const h=s*u,p=s*d;return{previous:{x:i.x-h*(o.x-r.x),y:i.y-h*(o.y-r.y)},next:{x:i.x+p*(o.x-r.x),y:i.y+p*(o.y-r.y)}}}function CG(e,t,n){const s=e.length;let r,i,o,a,c,u=fl(e,0);for(let d=0;d<s-1;++d)if(c=u,u=fl(e,d+1),!(!c||!u)){if(Bc(t[d],0,SG)){n[d]=n[d+1]=0;continue}r=n[d]/t[d],i=n[d+1]/t[d],a=Math.pow(r,2)+Math.pow(i,2),!(a<=9)&&(o=3/Math.sqrt(a),n[d]=r*o*t[d],n[d+1]=i*o*t[d])}}function NG(e,t,n="x"){const s=n4(n),r=e.length;let i,o,a,c=fl(e,0);for(let u=0;u<r;++u){if(o=a,a=c,c=fl(e,u+1),!a)continue;const d=a[n],h=a[s];o&&(i=(d-o[n])/3,a[`cp1${n}`]=d-i,a[`cp1${s}`]=h-i*t[u]),c&&(i=(c[n]-d)/3,a[`cp2${n}`]=d+i,a[`cp2${s}`]=h+i*t[u])}}function jG(e,t="x"){const n=n4(t),s=e.length,r=Array(s).fill(0),i=Array(s);let o,a,c,u=fl(e,0);for(o=0;o<s;++o)if(a=c,c=u,u=fl(e,o+1),!!c){if(u){const d=u[t]-c[t];r[o]=d!==0?(u[n]-c[n])/d:0}i[o]=a?u?dl(r[o-1])!==dl(r[o])?0:(r[o-1]+r[o])/2:r[o-1]:r[o]}CG(e,r,i),NG(e,i,t)}function Yd(e,t,n){return Math.max(Math.min(e,n),t)}function EG(e,t){let n,s,r,i,o,a=_u(e[0],t);for(n=0,s=e.length;n<s;++n)o=i,i=a,a=n<s-1&&_u(e[n+1],t),i&&(r=e[n],o&&(r.cp1x=Yd(r.cp1x,t.left,t.right),r.cp1y=Yd(r.cp1y,t.top,t.bottom)),a&&(r.cp2x=Yd(r.cp2x,t.left,t.right),r.cp2y=Yd(r.cp2y,t.top,t.bottom)))}function PG(e,t,n,s,r){let i,o,a,c;if(t.spanGaps&&(e=e.filter(u=>!u.skip)),t.cubicInterpolationMode==="monotone")jG(e,r);else{let u=s?e[e.length-1]:e[0];for(i=0,o=e.length;i<o;++i)a=e[i],c=kG(u,a,e[Math.min(i+1,o-(s?0:1))%o],t.tension),a.cp1x=c.previous.x,a.cp1y=c.previous.y,a.cp2x=c.next.x,a.cp2y=c.next.y,u=a}t.capBezierPoints&&EG(e,n)}function v_(){return typeof window<"u"&&typeof document<"u"}function y_(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Af(e,t,n){let s;return typeof e=="string"?(s=parseInt(e,10),e.indexOf("%")!==-1&&(s=s/100*t.parentNode[n])):s=e,s}const Np=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function TG(e,t){return Np(e).getPropertyValue(t)}const RG=["top","right","bottom","left"];function Oo(e,t,n){const s={};n=n?"-"+n:"";for(let r=0;r<4;r++){const i=RG[r];s[i]=parseFloat(e[t+"-"+i+n])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const DG=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function MG(e,t){const n=e.touches,s=n&&n.length?n[0]:e,{offsetX:r,offsetY:i}=s;let o=!1,a,c;if(DG(r,i,e.target))a=r,c=i;else{const u=t.getBoundingClientRect();a=s.clientX-u.left,c=s.clientY-u.top,o=!0}return{x:a,y:c,box:o}}function ho(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:s}=t,r=Np(n),i=r.boxSizing==="border-box",o=Oo(r,"padding"),a=Oo(r,"border","width"),{x:c,y:u,box:d}=MG(e,n),h=o.left+(d&&a.left),p=o.top+(d&&a.top);let{width:f,height:m}=t;return i&&(f-=o.width+a.width,m-=o.height+a.height),{x:Math.round((c-h)/f*n.width/s),y:Math.round((u-p)/m*n.height/s)}}function LG(e,t,n){let s,r;if(t===void 0||n===void 0){const i=e&&y_(e);if(!i)t=e.clientWidth,n=e.clientHeight;else{const o=i.getBoundingClientRect(),a=Np(i),c=Oo(a,"border","width"),u=Oo(a,"padding");t=o.width-u.width-c.width,n=o.height-u.height-c.height,s=Af(a.maxWidth,i,"clientWidth"),r=Af(a.maxHeight,i,"clientHeight")}}return{width:t,height:n,maxWidth:s||Mf,maxHeight:r||Mf}}const Ti=e=>Math.round(e*10)/10;function AG(e,t,n,s){const r=Np(e),i=Oo(r,"margin"),o=Af(r.maxWidth,e,"clientWidth")||Mf,a=Af(r.maxHeight,e,"clientHeight")||Mf,c=LG(e,t,n);let{width:u,height:d}=c;if(r.boxSizing==="content-box"){const p=Oo(r,"border","width"),f=Oo(r,"padding");u-=f.width+p.width,d-=f.height+p.height}return u=Math.max(0,u-i.width),d=Math.max(0,s?u/s:d-i.height),u=Ti(Math.min(u,o,c.maxWidth)),d=Ti(Math.min(d,a,c.maxHeight)),u&&!d&&(d=Ti(u/2)),(t!==void 0||n!==void 0)&&s&&c.height&&d>c.height&&(d=c.height,u=Ti(Math.floor(d*s))),{width:u,height:d}}function uk(e,t,n){const s=t||1,r=Ti(e.height*s),i=Ti(e.width*s);e.height=Ti(e.height),e.width=Ti(e.width);const o=e.canvas;return o.style&&(n||!o.style.height&&!o.style.width)&&(o.style.height=`${e.height}px`,o.style.width=`${e.width}px`),e.currentDevicePixelRatio!==s||o.height!==r||o.width!==i?(e.currentDevicePixelRatio=s,o.height=r,o.width=i,e.ctx.setTransform(s,0,0,s,0,0),!0):!1}const OG=function(){let e=!1;try{const t={get passive(){return e=!0,!1}};v_()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e}();function dk(e,t){const n=TG(e,t),s=n&&n.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function fo(e,t,n,s){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function IG(e,t,n,s){return{x:e.x+n*(t.x-e.x),y:s==="middle"?n<.5?e.y:t.y:s==="after"?n<1?e.y:t.y:n>0?t.y:e.y}}function FG(e,t,n,s){const r={x:e.cp2x,y:e.cp2y},i={x:t.cp1x,y:t.cp1y},o=fo(e,r,n),a=fo(r,i,n),c=fo(i,t,n),u=fo(o,a,n),d=fo(a,c,n);return fo(u,d,n)}function s4(e){return e==="angle"?{between:qP,compare:OQ,normalize:sr}:{between:KP,compare:(t,n)=>t-n,normalize:t=>t}}function hk({start:e,end:t,count:n,loop:s,style:r}){return{start:e%n,end:t%n,loop:s&&(t-e+1)%n===0,style:r}}function BG(e,t,n){const{property:s,start:r,end:i}=n,{between:o,normalize:a}=s4(s),c=t.length;let{start:u,end:d,loop:h}=e,p,f;if(h){for(u+=c,d+=c,p=0,f=c;p<f&&o(a(t[u%c][s]),r,i);++p)u--,d--;u%=c,d%=c}return d<u&&(d+=c),{start:u,end:d,loop:h,style:e.style}}function r4(e,t,n){if(!n)return[e];const{property:s,start:r,end:i}=n,o=t.length,{compare:a,between:c,normalize:u}=s4(s),{start:d,end:h,loop:p,style:f}=BG(e,t,n),m=[];let g=!1,v=null,x,_,b;const S=()=>c(r,b,x)&&a(r,b)!==0,C=()=>a(i,x)===0||c(i,b,x),w=()=>g||S(),j=()=>!g||C();for(let T=d,F=d;T<=h;++T)_=t[T%o],!_.skip&&(x=u(_[s]),x!==b&&(g=c(x,r,i),v===null&&w()&&(v=a(x,r)===0?T:F),v!==null&&j()&&(m.push(hk({start:v,end:T,loop:p,count:o,style:f})),v=null),F=T,b=x));return v!==null&&m.push(hk({start:v,end:h,loop:p,count:o,style:f})),m}function i4(e,t){const n=[],s=e.segments;for(let r=0;r<s.length;r++){const i=r4(s[r],e.points,t);i.length&&n.push(...i)}return n}function zG(e,t,n,s){let r=0,i=t-1;if(n&&!s)for(;r<t&&!e[r].skip;)r++;for(;r<t&&e[r].skip;)r++;for(r%=t,n&&(i+=r);i>r&&e[i%t].skip;)i--;return i%=t,{start:r,end:i}}function $G(e,t,n,s){const r=e.length,i=[];let o=t,a=e[t],c;for(c=t+1;c<=n;++c){const u=e[c%r];u.skip||u.stop?a.skip||(s=!1,i.push({start:t%r,end:(c-1)%r,loop:s}),t=o=u.stop?c:null):(o=c,a.skip&&(t=c)),a=u}return o!==null&&i.push({start:t%r,end:o%r,loop:s}),i}function HG(e,t){const n=e.points,s=e.options.spanGaps,r=n.length;if(!r)return[];const i=!!e._loop,{start:o,end:a}=zG(n,r,i,s);if(s===!0)return fk(e,[{start:o,end:a,loop:i}],n,t);const c=a<o?a+r:a,u=!!e._fullLoop&&o===0&&a===r-1;return fk(e,$G(n,o,c,u),n,t)}function fk(e,t,n,s){return!s||!s.setContext||!n?t:WG(e,t,n,s)}function WG(e,t,n,s){const r=e._chart.getContext(),i=pk(e.options),{_datasetIndex:o,options:{spanGaps:a}}=e,c=n.length,u=[];let d=i,h=t[0].start,p=h;function f(m,g,v,x){const _=a?-1:1;if(m!==g){for(m+=c;n[m%c].skip;)m-=_;for(;n[g%c].skip;)g+=_;m%c!==g%c&&(u.push({start:m%c,end:g%c,loop:v,style:x}),d=x,h=g%c)}}for(const m of t){h=a?h:m.start;let g=n[h%c],v;for(p=h+1;p<=m.end;p++){const x=n[p%c];v=pk(s.setContext(Pl(r,{type:"segment",p0:g,p1:x,p0DataIndex:(p-1)%c,p1DataIndex:p%c,datasetIndex:o}))),UG(v,d)&&f(h,p-1,m.loop,d),g=x,d=v}h<p-1&&f(h,p-1,m.loop,d)}return u}function pk(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function UG(e,t){if(!t)return!1;const n=[],s=function(r,i){return h_(i)?(n.includes(i)||n.push(i),n.indexOf(i)):i};return JSON.stringify(e,s)!==JSON.stringify(t,s)}function Xd(e,t,n){return e.options.clip?e[n]:t[n]}function qG(e,t){const{xScale:n,yScale:s}=e;return n&&s?{left:Xd(n,t,"left"),right:Xd(n,t,"right"),top:Xd(s,t,"top"),bottom:Xd(s,t,"bottom")}:t}function o4(e,t){const n=t._clip;if(n.disabled)return!1;const s=qG(t,e.chartArea);return{left:n.left===!1?0:s.left-(n.left===!0?0:n.left),right:n.right===!1?e.width:s.right+(n.right===!0?0:n.right),top:n.top===!1?0:s.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?e.height:s.bottom+(n.bottom===!0?0:n.bottom)}}/*!
|
|
723
|
+
* Chart.js v4.5.1
|
|
724
|
+
* https://www.chartjs.org
|
|
725
|
+
* (c) 2025 Chart.js Contributors
|
|
726
|
+
* Released under the MIT License
|
|
727
|
+
*/class KG{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,s,r){const i=n.listeners[r],o=n.duration;i.forEach(a=>a({chart:t,initial:n.initial,numSteps:o,currentStep:Math.min(s-n.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=YP.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((s,r)=>{if(!s.running||!s.items.length)return;const i=s.items;let o=i.length-1,a=!1,c;for(;o>=0;--o)c=i[o],c._active?(c._total>s.duration&&(s.duration=c._total),c.tick(t),a=!0):(i[o]=i[i.length-1],i.pop());a&&(r.draw(),this._notify(r,s,t,"progress")),i.length||(s.running=!1,this._notify(r,s,t,"complete"),s.initial=!1),n+=i.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let s=n.get(t);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,s)),s}listen(t,n,s){this._getAnims(t).listeners[n].push(s)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((s,r)=>Math.max(s,r._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const s=n.items;let r=s.length-1;for(;r>=0;--r)s[r].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Nr=new KG;const mk="transparent",VG={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const s=sk(e||mk),r=s.valid&&sk(t||mk);return r&&r.valid?r.mix(s,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class YG{constructor(t,n,s,r){const i=n[s];r=Vd([t.to,r,i,t.from]);const o=Vd([t.from,i,r]);this._active=!0,this._fn=t.fn||VG[t.type||typeof o],this._easing=zc[t.easing]||zc.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=s,this._from=o,this._to=r,this._promises=void 0}active(){return this._active}update(t,n,s){if(this._active){this._notify(!1);const r=this._target[this._prop],i=s-this._start,o=this._duration-i;this._start=s,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=i,this._loop=!!t.loop,this._to=Vd([t.to,n,r,t.from]),this._from=Vd([t.from,r,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,s=this._duration,r=this._prop,i=this._from,o=this._loop,a=this._to;let c;if(this._active=i!==a&&(o||n<s),!this._active){this._target[r]=a,this._notify(!0);return}if(n<0){this._target[r]=i;return}c=n/s%2,c=o&&c>1?2-c:c,c=this._easing(Math.min(1,Math.max(0,c))),this._target[r]=this._fn(i,a,c)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,s)=>{t.push({res:n,rej:s})})}_notify(t){const n=t?"res":"rej",s=this._promises||[];for(let r=0;r<s.length;r++)s[r][n]()}}class XG{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!$e(t))return;const n=Object.keys(Mt.animation),s=this._properties;Object.getOwnPropertyNames(t).forEach(r=>{const i=t[r];if(!$e(i))return;const o={};for(const a of n)o[a]=i[a];(dn(i.properties)&&i.properties||[r]).forEach(a=>{(a===r||!s.has(a))&&s.set(a,o)})})}_animateOptions(t,n){const s=n.options,r=GG(t,s);if(!r)return[];const i=this._createAnimations(r,s);return s.$shared&&QG(t.options.$animations,s).then(()=>{t.options=s},()=>{}),i}_createAnimations(t,n){const s=this._properties,r=[],i=t.$animations||(t.$animations={}),o=Object.keys(n),a=Date.now();let c;for(c=o.length-1;c>=0;--c){const u=o[c];if(u.charAt(0)==="$")continue;if(u==="options"){r.push(...this._animateOptions(t,n));continue}const d=n[u];let h=i[u];const p=s.get(u);if(h)if(p&&h.active()){h.update(p,d,a);continue}else h.cancel();if(!p||!p.duration){t[u]=d;continue}i[u]=h=new YG(p,t,u,d),r.push(h)}return r}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const s=this._createAnimations(t,n);if(s.length)return Nr.add(this._chart,s),!0}}function QG(e,t){const n=[],s=Object.keys(t);for(let r=0;r<s.length;r++){const i=e[s[r]];i&&i.active()&&n.push(i.wait())}return Promise.all(n)}function GG(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function gk(e,t){const n=e&&e.options||{},s=n.reverse,r=n.min===void 0?t:0,i=n.max===void 0?t:0;return{start:s?i:r,end:s?r:i}}function JG(e,t,n){if(n===!1)return!1;const s=gk(e,n),r=gk(t,n);return{top:r.end,right:s.end,bottom:r.start,left:s.start}}function ZG(e){let t,n,s,r;return $e(e)?(t=e.top,n=e.right,s=e.bottom,r=e.left):t=n=s=r=e,{top:t,right:n,bottom:s,left:r,disabled:e===!1}}function a4(e,t){const n=[],s=e._getSortedDatasetMetas(t);let r,i;for(r=0,i=s.length;r<i;++r)n.push(s[r].index);return n}function xk(e,t,n,s={}){const r=e.keys,i=s.mode==="single";let o,a,c,u;if(t===null)return;let d=!1;for(o=0,a=r.length;o<a;++o){if(c=+r[o],c===n){if(d=!0,s.all)continue;break}u=e.values[c],Nn(u)&&(i||t===0||dl(t)===dl(u))&&(t+=u)}return!d&&!s.all?0:t}function eJ(e,t){const{iScale:n,vScale:s}=t,r=n.axis==="x"?"x":"y",i=s.axis==="x"?"x":"y",o=Object.keys(e),a=new Array(o.length);let c,u,d;for(c=0,u=o.length;c<u;++c)d=o[c],a[c]={[r]:d,[i]:e[d]};return a}function lg(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function tJ(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function nJ(e){const{min:t,max:n,minDefined:s,maxDefined:r}=e.getUserBounds();return{min:s?t:Number.NEGATIVE_INFINITY,max:r?n:Number.POSITIVE_INFINITY}}function sJ(e,t,n){const s=e[t]||(e[t]={});return s[n]||(s[n]={})}function vk(e,t,n,s){for(const r of t.getMatchingVisibleMetas(s).reverse()){const i=e[r.index];if(n&&i>0||!n&&i<0)return r.index}return null}function yk(e,t){const{chart:n,_cachedMeta:s}=e,r=n._stacks||(n._stacks={}),{iScale:i,vScale:o,index:a}=s,c=i.axis,u=o.axis,d=tJ(i,o,s),h=t.length;let p;for(let f=0;f<h;++f){const m=t[f],{[c]:g,[u]:v}=m,x=m._stacks||(m._stacks={});p=x[u]=sJ(r,d,g),p[a]=v,p._top=vk(p,o,!0,s.type),p._bottom=vk(p,o,!1,s.type);const _=p._visualValues||(p._visualValues={});_[a]=v}}function cg(e,t){const n=e.scales;return Object.keys(n).filter(s=>n[s].axis===t).shift()}function rJ(e,t){return Pl(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function iJ(e,t,n){return Pl(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function ec(e,t){const n=e.controller.index,s=e.vScale&&e.vScale.axis;if(s){t=t||e._parsed;for(const r of t){const i=r._stacks;if(!i||i[s]===void 0||i[s][n]===void 0)return;delete i[s][n],i[s]._visualValues!==void 0&&i[s]._visualValues[n]!==void 0&&delete i[s]._visualValues[n]}}}const ug=e=>e==="reset"||e==="none",_k=(e,t)=>t?e:Object.assign({},e),oJ=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:a4(n,!0),values:null};class Dh{constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=lg(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&ec(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,s=this.getDataset(),r=(h,p,f,m)=>h==="x"?p:h==="r"?m:f,i=n.xAxisID=Ye(s.xAxisID,cg(t,"x")),o=n.yAxisID=Ye(s.yAxisID,cg(t,"y")),a=n.rAxisID=Ye(s.rAxisID,cg(t,"r")),c=n.indexAxis,u=n.iAxisID=r(c,i,o,a),d=n.vAxisID=r(c,o,i,a);n.xScale=this.getScaleForId(i),n.yScale=this.getScaleForId(o),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(u),n.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&ZS(this._data,this),t._stacked&&ec(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),s=this._data;if($e(n)){const r=this._cachedMeta;this._data=eJ(n,r)}else if(s!==n){if(s){ZS(s,this);const r=this._cachedMeta;ec(r),r._parsed=[]}n&&Object.isExtensible(n)&&zQ(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,s=this.getDataset();let r=!1;this._dataCheck();const i=n._stacked;n._stacked=lg(n.vScale,n),n.stack!==s.stack&&(r=!0,ec(n),n.stack=s.stack),this._resyncElements(t),(r||i!==n._stacked)&&(yk(this,n._parsed),n._stacked=lg(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),s=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:s,_data:r}=this,{iScale:i,_stacked:o}=s,a=i.axis;let c=t===0&&n===r.length?!0:s._sorted,u=t>0&&s._parsed[t-1],d,h,p;if(this._parsing===!1)s._parsed=r,s._sorted=!0,p=r;else{dn(r[t])?p=this.parseArrayData(s,r,t,n):$e(r[t])?p=this.parseObjectData(s,r,t,n):p=this.parsePrimitiveData(s,r,t,n);const f=()=>h[a]===null||u&&h[a]<u[a];for(d=0;d<n;++d)s._parsed[d+t]=h=p[d],c&&(f()&&(c=!1),u=h);s._sorted=c}o&&yk(this,p)}parsePrimitiveData(t,n,s,r){const{iScale:i,vScale:o}=t,a=i.axis,c=o.axis,u=i.getLabels(),d=i===o,h=new Array(r);let p,f,m;for(p=0,f=r;p<f;++p)m=p+s,h[p]={[a]:d||i.parse(u[m],m),[c]:o.parse(n[m],m)};return h}parseArrayData(t,n,s,r){const{xScale:i,yScale:o}=t,a=new Array(r);let c,u,d,h;for(c=0,u=r;c<u;++c)d=c+s,h=n[d],a[c]={x:i.parse(h[0],d),y:o.parse(h[1],d)};return a}parseObjectData(t,n,s,r){const{xScale:i,yScale:o}=t,{xAxisKey:a="x",yAxisKey:c="y"}=this._parsing,u=new Array(r);let d,h,p,f;for(d=0,h=r;d<h;++d)p=d+s,f=n[p],u[d]={x:i.parse(Rf(f,a),p),y:o.parse(Rf(f,c),p)};return u}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,s){const r=this.chart,i=this._cachedMeta,o=n[t.axis],a={keys:a4(r,!0),values:n._stacks[t.axis]._visualValues};return xk(a,o,i.index,{mode:s})}updateRangeFromParsed(t,n,s,r){const i=s[n.axis];let o=i===null?NaN:i;const a=r&&s._stacks[n.axis];r&&a&&(r.values=a,o=xk(r,i,this._cachedMeta.index)),t.min=Math.min(t.min,o),t.max=Math.max(t.max,o)}getMinMax(t,n){const s=this._cachedMeta,r=s._parsed,i=s._sorted&&t===s.iScale,o=r.length,a=this._getOtherScale(t),c=oJ(n,s,this.chart),u={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:h}=nJ(a);let p,f;function m(){f=r[p];const g=f[a.axis];return!Nn(f[t.axis])||d>g||h<g}for(p=0;p<o&&!(!m()&&(this.updateRangeFromParsed(u,t,f,c),i));++p);if(i){for(p=o-1;p>=0;--p)if(!m()){this.updateRangeFromParsed(u,t,f,c);break}}return u}getAllParsedValues(t){const n=this._cachedMeta._parsed,s=[];let r,i,o;for(r=0,i=n.length;r<i;++r)o=n[r][t.axis],Nn(o)&&s.push(o);return s}getMaxOverflow(){return!1}getLabelAndValue(t){const n=this._cachedMeta,s=n.iScale,r=n.vScale,i=this.getParsed(t);return{label:s?""+s.getLabelForValue(i[s.axis]):"",value:r?""+r.getLabelForValue(i[r.axis]):""}}_update(t){const n=this._cachedMeta;this.update(t||"default"),n._clip=ZG(Ye(this.options.clip,JG(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,n=this.chart,s=this._cachedMeta,r=s.data||[],i=n.chartArea,o=[],a=this._drawStart||0,c=this._drawCount||r.length-a,u=this.options.drawActiveElementsOnTop;let d;for(s.dataset&&s.dataset.draw(t,i,a,c),d=a;d<a+c;++d){const h=r[d];h.hidden||(h.active&&u?o.push(h):h.draw(t,i))}for(d=0;d<o.length;++d)o[d].draw(t,i)}getStyle(t,n){const s=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(s):this.resolveDataElementOptions(t||0,s)}getContext(t,n,s){const r=this.getDataset();let i;if(t>=0&&t<this._cachedMeta.data.length){const o=this._cachedMeta.data[t];i=o.$context||(o.$context=iJ(this.getContext(),t,o)),i.parsed=this.getParsed(t),i.raw=r.data[t],i.index=i.dataIndex=t}else i=this.$context||(this.$context=rJ(this.chart.getContext(),this.index)),i.dataset=r,i.index=i.datasetIndex=this.index;return i.active=!!n,i.mode=s,i}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",s){const r=n==="active",i=this._cachedDataOpts,o=t+"-"+n,a=i[o],c=this.enableOptionSharing&&Df(s);if(a)return _k(a,c);const u=this.chart.config,d=u.datasetElementScopeKeys(this._type,t),h=r?[`${t}Hover`,"hover",t,""]:[t,""],p=u.getOptionScopes(this.getDataset(),d),f=Object.keys(Mt.elements[t]),m=()=>this.getContext(s,r,n),g=u.resolveNamedOptions(p,f,m,h);return g.$shared&&(g.$shared=c,i[o]=Object.freeze(_k(g,c))),g}_resolveAnimations(t,n,s){const r=this.chart,i=this._cachedDataOpts,o=`animation-${n}`,a=i[o];if(a)return a;let c;if(r.options.animation!==!1){const d=this.chart.config,h=d.datasetAnimationScopeKeys(this._type,n),p=d.getOptionScopes(this.getDataset(),h);c=d.createResolver(p,this.getContext(t,s,n))}const u=new XG(r,c&&c.animations);return c&&c._cacheable&&(i[o]=Object.freeze(u)),u}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||ug(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const s=this.resolveDataElementOptions(t,n),r=this._sharedOptions,i=this.getSharedOptions(s),o=this.includeOptions(n,i)||i!==r;return this.updateSharedOptions(i,n,s),{sharedOptions:i,includeOptions:o}}updateElement(t,n,s,r){ug(r)?Object.assign(t,s):this._resolveAnimations(n,r).update(t,s)}updateSharedOptions(t,n,s){t&&!ug(n)&&this._resolveAnimations(void 0,n).update(t,s)}_setStyle(t,n,s,r){t.active=r;const i=this.getStyle(n,r);this._resolveAnimations(n,s,r).update(t,{options:!r&&this.getSharedOptions(i)||i})}removeHoverStyle(t,n,s){this._setStyle(t,s,"active",!1)}setHoverStyle(t,n,s){this._setStyle(t,s,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,s=this._cachedMeta.data;for(const[a,c,u]of this._syncList)this[a](c,u);this._syncList=[];const r=s.length,i=n.length,o=Math.min(i,r);o&&this.parse(0,o),i>r?this._insertElements(r,i-r,t):i<r&&this._removeElements(i,r-i)}_insertElements(t,n,s=!0){const r=this._cachedMeta,i=r.data,o=t+n;let a;const c=u=>{for(u.length+=n,a=u.length-1;a>=o;a--)u[a]=u[a-n]};for(c(i),a=t;a<o;++a)i[a]=new this.dataElementType;this._parsing&&c(r._parsed),this.parse(t,n),s&&this.updateElements(i,t,n,"reset")}updateElements(t,n,s,r){}_removeElements(t,n){const s=this._cachedMeta;if(this._parsing){const r=s._parsed.splice(t,n);s._stacked&&ec(s,r)}s.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[n,s,r]=t;this[n](s,r)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,n){n&&this._sync(["_removeElements",t,n]);const s=arguments.length-2;s&&this._sync(["_insertElements",t,s])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}Ae(Dh,"defaults",{}),Ae(Dh,"datasetElementType",null),Ae(Dh,"dataElementType",null);function oo(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class __{constructor(t){Ae(this,"options");this.options=t||{}}static override(t){Object.assign(__.prototype,t)}init(){}formats(){return oo()}parse(){return oo()}format(){return oo()}add(){return oo()}diff(){return oo()}startOf(){return oo()}endOf(){return oo()}}var aJ={_date:__};function lJ(e,t,n,s){const{controller:r,data:i,_sorted:o}=e,a=r._cachedMeta.iScale,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&o&&i.length){const u=a._reversePixels?FQ:Uv;if(s){if(r._sharedOptions){const d=i[0],h=typeof d.getRange=="function"&&d.getRange(t);if(h){const p=u(i,t,n-h),f=u(i,t,n+h);return{lo:p.lo,hi:f.hi}}}}else{const d=u(i,t,n);if(c){const{vScale:h}=r._cachedMeta,{_parsed:p}=e,f=p.slice(0,d.lo+1).reverse().findIndex(g=>!vt(g[h.axis]));d.lo-=Math.max(0,f);const m=p.slice(d.hi).findIndex(g=>!vt(g[h.axis]));d.hi+=Math.max(0,m)}return d}}return{lo:0,hi:i.length-1}}function jp(e,t,n,s,r){const i=e.getSortedVisibleDatasetMetas(),o=n[t];for(let a=0,c=i.length;a<c;++a){const{index:u,data:d}=i[a],{lo:h,hi:p}=lJ(i[a],t,o,r);for(let f=h;f<=p;++f){const m=d[f];m.skip||s(m,u,f)}}}function cJ(e){const t=e.indexOf("x")!==-1,n=e.indexOf("y")!==-1;return function(s,r){const i=t?Math.abs(s.x-r.x):0,o=n?Math.abs(s.y-r.y):0;return Math.sqrt(Math.pow(i,2)+Math.pow(o,2))}}function dg(e,t,n,s,r){const i=[];return!r&&!e.isPointInArea(t)||jp(e,n,t,function(a,c,u){!r&&!_u(a,e.chartArea,0)||a.inRange(t.x,t.y,s)&&i.push({element:a,datasetIndex:c,index:u})},!0),i}function uJ(e,t,n,s){let r=[];function i(o,a,c){const{startAngle:u,endAngle:d}=o.getProps(["startAngle","endAngle"],s),{angle:h}=AQ(o,{x:t.x,y:t.y});qP(h,u,d)&&r.push({element:o,datasetIndex:a,index:c})}return jp(e,n,t,i),r}function dJ(e,t,n,s,r,i){let o=[];const a=cJ(n);let c=Number.POSITIVE_INFINITY;function u(d,h,p){const f=d.inRange(t.x,t.y,r);if(s&&!f)return;const m=d.getCenterPoint(r);if(!(!!i||e.isPointInArea(m))&&!f)return;const v=a(t,m);v<c?(o=[{element:d,datasetIndex:h,index:p}],c=v):v===c&&o.push({element:d,datasetIndex:h,index:p})}return jp(e,n,t,u),o}function hg(e,t,n,s,r,i){return!i&&!e.isPointInArea(t)?[]:n==="r"&&!s?uJ(e,t,n,r):dJ(e,t,n,s,r,i)}function bk(e,t,n,s,r){const i=[],o=n==="x"?"inXRange":"inYRange";let a=!1;return jp(e,n,t,(c,u,d)=>{c[o]&&c[o](t[n],r)&&(i.push({element:c,datasetIndex:u,index:d}),a=a||c.inRange(t.x,t.y,r))}),s&&!a?[]:i}var hJ={modes:{index(e,t,n,s){const r=ho(t,e),i=n.axis||"x",o=n.includeInvisible||!1,a=n.intersect?dg(e,r,i,s,o):hg(e,r,i,!1,s,o),c=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(u=>{const d=a[0].index,h=u.data[d];h&&!h.skip&&c.push({element:h,datasetIndex:u.index,index:d})}),c):[]},dataset(e,t,n,s){const r=ho(t,e),i=n.axis||"xy",o=n.includeInvisible||!1;let a=n.intersect?dg(e,r,i,s,o):hg(e,r,i,!1,s,o);if(a.length>0){const c=a[0].datasetIndex,u=e.getDatasetMeta(c).data;a=[];for(let d=0;d<u.length;++d)a.push({element:u[d],datasetIndex:c,index:d})}return a},point(e,t,n,s){const r=ho(t,e),i=n.axis||"xy",o=n.includeInvisible||!1;return dg(e,r,i,s,o)},nearest(e,t,n,s){const r=ho(t,e),i=n.axis||"xy",o=n.includeInvisible||!1;return hg(e,r,i,n.intersect,s,o)},x(e,t,n,s){const r=ho(t,e);return bk(e,r,"x",n.intersect,s)},y(e,t,n,s){const r=ho(t,e);return bk(e,r,"y",n.intersect,s)}}};const l4=["left","top","right","bottom"];function tc(e,t){return e.filter(n=>n.pos===t)}function wk(e,t){return e.filter(n=>l4.indexOf(n.pos)===-1&&n.box.axis===t)}function nc(e,t){return e.sort((n,s)=>{const r=t?s:n,i=t?n:s;return r.weight===i.weight?r.index-i.index:r.weight-i.weight})}function fJ(e){const t=[];let n,s,r,i,o,a;for(n=0,s=(e||[]).length;n<s;++n)r=e[n],{position:i,options:{stack:o,stackWeight:a=1}}=r,t.push({index:n,box:r,pos:i,horizontal:r.isHorizontal(),weight:r.weight,stack:o&&i+o,stackWeight:a});return t}function pJ(e){const t={};for(const n of e){const{stack:s,pos:r,stackWeight:i}=n;if(!s||!l4.includes(r))continue;const o=t[s]||(t[s]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=i}return t}function mJ(e,t){const n=pJ(e),{vBoxMaxWidth:s,hBoxMaxHeight:r}=t;let i,o,a;for(i=0,o=e.length;i<o;++i){a=e[i];const{fullSize:c}=a.box,u=n[a.stack],d=u&&a.stackWeight/u.weight;a.horizontal?(a.width=d?d*s:c&&t.availableWidth,a.height=r):(a.width=s,a.height=d?d*r:c&&t.availableHeight)}return n}function gJ(e){const t=fJ(e),n=nc(t.filter(u=>u.box.fullSize),!0),s=nc(tc(t,"left"),!0),r=nc(tc(t,"right")),i=nc(tc(t,"top"),!0),o=nc(tc(t,"bottom")),a=wk(t,"x"),c=wk(t,"y");return{fullSize:n,leftAndTop:s.concat(i),rightAndBottom:r.concat(c).concat(o).concat(a),chartArea:tc(t,"chartArea"),vertical:s.concat(r).concat(c),horizontal:i.concat(o).concat(a)}}function Sk(e,t,n,s){return Math.max(e[n],t[n])+Math.max(e[s],t[s])}function c4(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function xJ(e,t,n,s){const{pos:r,box:i}=n,o=e.maxPadding;if(!$e(r)){n.size&&(e[r]-=n.size);const h=s[n.stack]||{size:0,count:1};h.size=Math.max(h.size,n.horizontal?i.height:i.width),n.size=h.size/h.count,e[r]+=n.size}i.getPadding&&c4(o,i.getPadding());const a=Math.max(0,t.outerWidth-Sk(o,e,"left","right")),c=Math.max(0,t.outerHeight-Sk(o,e,"top","bottom")),u=a!==e.w,d=c!==e.h;return e.w=a,e.h=c,n.horizontal?{same:u,other:d}:{same:d,other:u}}function vJ(e){const t=e.maxPadding;function n(s){const r=Math.max(t[s]-e[s],0);return e[s]+=r,r}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function yJ(e,t){const n=t.maxPadding;function s(r){const i={left:0,top:0,right:0,bottom:0};return r.forEach(o=>{i[o]=Math.max(t[o],n[o])}),i}return s(e?["left","right"]:["top","bottom"])}function vc(e,t,n,s){const r=[];let i,o,a,c,u,d;for(i=0,o=e.length,u=0;i<o;++i){a=e[i],c=a.box,c.update(a.width||t.w,a.height||t.h,yJ(a.horizontal,t));const{same:h,other:p}=xJ(t,n,a,s);u|=h&&r.length,d=d||p,c.fullSize||r.push(a)}return u&&vc(r,t,n,s)||d}function Qd(e,t,n,s,r){e.top=n,e.left=t,e.right=t+s,e.bottom=n+r,e.width=s,e.height=r}function kk(e,t,n,s){const r=n.padding;let{x:i,y:o}=t;for(const a of e){const c=a.box,u=s[a.stack]||{placed:0,weight:1},d=a.stackWeight/u.weight||1;if(a.horizontal){const h=t.w*d,p=u.size||c.height;Df(u.start)&&(o=u.start),c.fullSize?Qd(c,r.left,o,n.outerWidth-r.right-r.left,p):Qd(c,t.left+u.placed,o,h,p),u.start=o,u.placed+=h,o=c.bottom}else{const h=t.h*d,p=u.size||c.width;Df(u.start)&&(i=u.start),c.fullSize?Qd(c,i,r.top,p,n.outerHeight-r.bottom-r.top):Qd(c,i,t.top+u.placed,p,h),u.start=i,u.placed+=h,i=c.right}}t.x=i,t.y=o}var Gd={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,s){if(!e)return;const r=bu(e.options.layout.padding),i=Math.max(t-r.width,0),o=Math.max(n-r.height,0),a=gJ(e.boxes),c=a.vertical,u=a.horizontal;bn(e.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});const d=c.reduce((g,v)=>v.box.options&&v.box.options.display===!1?g:g+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:n,padding:r,availableWidth:i,availableHeight:o,vBoxMaxWidth:i/2/d,hBoxMaxHeight:o/2}),p=Object.assign({},r);c4(p,bu(s));const f=Object.assign({maxPadding:p,w:i,h:o,x:r.left,y:r.top},r),m=mJ(c.concat(u),h);vc(a.fullSize,f,h,m),vc(c,f,h,m),vc(u,f,h,m)&&vc(c,f,h,m),vJ(f),kk(a.leftAndTop,f,h,m),f.x+=f.w,f.y+=f.h,kk(a.rightAndBottom,f,h,m),e.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},bn(a.chartArea,g=>{const v=g.box;Object.assign(v,e.chartArea),v.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class u4{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,s){}removeEventListener(t,n,s){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,s,r){return n=Math.max(0,n||t.width),s=s||t.height,{width:n,height:Math.max(0,r?Math.floor(n/r):s)}}isAttached(t){return!0}updateConfig(t){}}class _J extends u4{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Mh="$chartjs",bJ={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ck=e=>e===null||e==="";function wJ(e,t){const n=e.style,s=e.getAttribute("height"),r=e.getAttribute("width");if(e[Mh]={initial:{height:s,width:r,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",Ck(r)){const i=dk(e,"width");i!==void 0&&(e.width=i)}if(Ck(s))if(e.style.height==="")e.height=e.width/(t||2);else{const i=dk(e,"height");i!==void 0&&(e.height=i)}return e}const d4=OG?{passive:!0}:!1;function SJ(e,t,n){e&&e.addEventListener(t,n,d4)}function kJ(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,d4)}function CJ(e,t){const n=bJ[e.type]||e.type,{x:s,y:r}=ho(e,t);return{type:n,chart:t,native:e,x:s!==void 0?s:null,y:r!==void 0?r:null}}function Of(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function NJ(e,t,n){const s=e.canvas,r=new MutationObserver(i=>{let o=!1;for(const a of i)o=o||Of(a.addedNodes,s),o=o&&!Of(a.removedNodes,s);o&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}function jJ(e,t,n){const s=e.canvas,r=new MutationObserver(i=>{let o=!1;for(const a of i)o=o||Of(a.removedNodes,s),o=o&&!Of(a.addedNodes,s);o&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}const wu=new Map;let Nk=0;function h4(){const e=window.devicePixelRatio;e!==Nk&&(Nk=e,wu.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function EJ(e,t){wu.size||window.addEventListener("resize",h4),wu.set(e,t)}function PJ(e){wu.delete(e),wu.size||window.removeEventListener("resize",h4)}function TJ(e,t,n){const s=e.canvas,r=s&&y_(s);if(!r)return;const i=XP((a,c)=>{const u=r.clientWidth;n(a,c),u<r.clientWidth&&n()},window),o=new ResizeObserver(a=>{const c=a[0],u=c.contentRect.width,d=c.contentRect.height;u===0&&d===0||i(u,d)});return o.observe(r),EJ(e,i),o}function fg(e,t,n){n&&n.disconnect(),t==="resize"&&PJ(e)}function RJ(e,t,n){const s=e.canvas,r=XP(i=>{e.ctx!==null&&n(CJ(i,e))},e);return SJ(s,t,r),r}class DJ extends u4{acquireContext(t,n){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?(wJ(t,n),s):null}releaseContext(t){const n=t.canvas;if(!n[Mh])return!1;const s=n[Mh].initial;["height","width"].forEach(i=>{const o=s[i];vt(o)?n.removeAttribute(i):n.setAttribute(i,o)});const r=s.style||{};return Object.keys(r).forEach(i=>{n.style[i]=r[i]}),n.width=n.width,delete n[Mh],!0}addEventListener(t,n,s){this.removeEventListener(t,n);const r=t.$proxies||(t.$proxies={}),o={attach:NJ,detach:jJ,resize:TJ}[n]||RJ;r[n]=o(t,n,s)}removeEventListener(t,n){const s=t.$proxies||(t.$proxies={}),r=s[n];if(!r)return;({attach:fg,detach:fg,resize:fg}[n]||kJ)(t,n,r),s[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,s,r){return AG(t,n,s,r)}isAttached(t){const n=t&&y_(t);return!!(n&&n.isConnected)}}function MJ(e){return!v_()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?_J:DJ}var sh;let Ep=(sh=class{constructor(){Ae(this,"x");Ae(this,"y");Ae(this,"active",!1);Ae(this,"options");Ae(this,"$animations")}tooltipPosition(t){const{x:n,y:s}=this.getProps(["x","y"],t);return{x:n,y:s}}hasValue(){return Lf(this.x)&&Lf(this.y)}getProps(t,n){const s=this.$animations;if(!n||!s)return this;const r={};return t.forEach(i=>{r[i]=s[i]&&s[i].active()?s[i]._to:this[i]}),r}},Ae(sh,"defaults",{}),Ae(sh,"defaultRoutes"),sh);function LJ(e,t){const n=e.options.ticks,s=AJ(e),r=Math.min(n.maxTicksLimit||s,s),i=n.major.enabled?IJ(t):[],o=i.length,a=i[0],c=i[o-1],u=[];if(o>r)return FJ(t,u,i,o/r),u;const d=OJ(i,t,r);if(o>0){let h,p;const f=o>1?Math.round((c-a)/(o-1)):null;for(Jd(t,u,d,vt(f)?0:a-f,a),h=0,p=o-1;h<p;h++)Jd(t,u,d,i[h],i[h+1]);return Jd(t,u,d,c,vt(f)?t.length:c+f),u}return Jd(t,u,d),u}function AJ(e){const t=e.options.offset,n=e._tickSize(),s=e._length/n+(t?0:1),r=e._maxLength/n;return Math.floor(Math.min(s,r))}function OJ(e,t,n){const s=BJ(e),r=t.length/n;if(!s)return Math.max(r,1);const i=TQ(s);for(let o=0,a=i.length-1;o<a;o++){const c=i[o];if(c>r)return c}return Math.max(r,1)}function IJ(e){const t=[];let n,s;for(n=0,s=e.length;n<s;n++)e[n].major&&t.push(n);return t}function FJ(e,t,n,s){let r=0,i=n[0],o;for(s=Math.ceil(s),o=0;o<e.length;o++)o===i&&(t.push(e[o]),r++,i=n[r*s])}function Jd(e,t,n,s,r){const i=Ye(s,0),o=Math.min(Ye(r,e.length),e.length);let a=0,c,u,d;for(n=Math.ceil(n),r&&(c=r-s,n=c/Math.floor(c/n)),d=i;d<0;)a++,d=Math.round(i+a*n);for(u=Math.max(i,0);u<o;u++)u===d&&(t.push(e[u]),a++,d=Math.round(i+a*n))}function BJ(e){const t=e.length;let n,s;if(t<2)return!1;for(s=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==s)return!1;return s}const zJ=e=>e==="left"?"right":e==="right"?"left":e,jk=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,Ek=(e,t)=>Math.min(t||e,e);function Pk(e,t){const n=[],s=e.length/t,r=e.length;let i=0;for(;i<r;i+=s)n.push(e[Math.floor(i)]);return n}function $J(e,t,n){const s=e.ticks.length,r=Math.min(t,s-1),i=e._startPixel,o=e._endPixel,a=1e-6;let c=e.getPixelForTick(r),u;if(!(n&&(s===1?u=Math.max(c-i,o-c):t===0?u=(e.getPixelForTick(1)-c)/2:u=(c-e.getPixelForTick(r-1))/2,c+=r<t?u:-u,c<i-a||c>o+a)))return c}function HJ(e,t){bn(e,n=>{const s=n.gc,r=s.length/2;let i;if(r>t){for(i=0;i<r;++i)delete n.data[s[i]];s.splice(0,r)}})}function sc(e){return e.drawTicks?e.tickLength:0}function Tk(e,t){if(!e.display)return 0;const n=Kv(e.font,t),s=bu(e.padding);return(dn(e.text)?e.text.length:1)*n.lineHeight+s.height}function WJ(e,t){return Pl(e,{scale:t,type:"scale"})}function UJ(e,t,n){return Pl(e,{tick:n,index:t,type:"tick"})}function qJ(e,t,n){let s=WQ(e);return(n&&t!=="right"||!n&&t==="right")&&(s=zJ(s)),s}function KJ(e,t,n,s){const{top:r,left:i,bottom:o,right:a,chart:c}=e,{chartArea:u,scales:d}=c;let h=0,p,f,m;const g=o-r,v=a-i;if(e.isHorizontal()){if(f=ek(s,i,a),$e(n)){const x=Object.keys(n)[0],_=n[x];m=d[x].getPixelForValue(_)+g-t}else n==="center"?m=(u.bottom+u.top)/2+g-t:m=jk(e,n,t);p=a-i}else{if($e(n)){const x=Object.keys(n)[0],_=n[x];f=d[x].getPixelForValue(_)-v+t}else n==="center"?f=(u.left+u.right)/2-v+t:f=jk(e,n,t);m=ek(s,o,r),h=n==="left"?-Ei:Ei}return{titleX:f,titleY:m,maxWidth:p,rotation:h}}class Tl extends Ep{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,n){return t}getUserBounds(){let{_userMin:t,_userMax:n,_suggestedMin:s,_suggestedMax:r}=this;return t=Gs(t,Number.POSITIVE_INFINITY),n=Gs(n,Number.NEGATIVE_INFINITY),s=Gs(s,Number.POSITIVE_INFINITY),r=Gs(r,Number.NEGATIVE_INFINITY),{min:Gs(t,s),max:Gs(n,r),minDefined:Nn(t),maxDefined:Nn(n)}}getMinMax(t){let{min:n,max:s,minDefined:r,maxDefined:i}=this.getUserBounds(),o;if(r&&i)return{min:n,max:s};const a=this.getMatchingVisibleMetas();for(let c=0,u=a.length;c<u;++c)o=a[c].controller.getMinMax(this,t),r||(n=Math.min(n,o.min)),i||(s=Math.max(s,o.max));return n=i&&n>s?s:n,s=r&&n>s?n:s,{min:Gs(n,Gs(s,n)),max:Gs(s,Gs(n,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){kt(this.options.beforeUpdate,[this])}update(t,n,s){const{beginAtZero:r,grace:i,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=fG(this,i,r),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const c=a<this.ticks.length;this._convertTicksToLabels(c?Pk(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||o.source==="auto")&&(this.ticks=LJ(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),c&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,n,s;this.isHorizontal()?(n=this.left,s=this.right):(n=this.top,s=this.bottom,t=!t),this._startPixel=n,this._endPixel=s,this._reversePixels=t,this._length=s-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){kt(this.options.afterUpdate,[this])}beforeSetDimensions(){kt(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){kt(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),kt(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){kt(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const n=this.options.ticks;let s,r,i;for(s=0,r=t.length;s<r;s++)i=t[s],i.label=kt(n.callback,[i.value,s,t],this)}afterTickToLabelConversion(){kt(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){kt(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,s=Ek(this.ticks.length,t.ticks.maxTicksLimit),r=n.minRotation||0,i=n.maxRotation;let o=r,a,c,u;if(!this._isVisible()||!n.display||r>=i||s<=1||!this.isHorizontal()){this.labelRotation=r;return}const d=this._getLabelSizes(),h=d.widest.width,p=d.highest.height,f=Pi(this.chart.width-h,0,this.maxWidth);a=t.offset?this.maxWidth/s:f/(s-1),h+6>a&&(a=f/(s-(t.offset?.5:1)),c=this.maxHeight-sc(t.grid)-n.padding-Tk(t.title,this.chart.options.font),u=Math.sqrt(h*h+p*p),o=LQ(Math.min(Math.asin(Pi((d.highest.height+6)/a,-1,1)),Math.asin(Pi(c/u,-1,1))-Math.asin(Pi(p/u,-1,1)))),o=Math.max(r,Math.min(i,o))),this.labelRotation=o}afterCalculateLabelRotation(){kt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){kt(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:s,title:r,grid:i}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const c=Tk(r,n.options.font);if(a?(t.width=this.maxWidth,t.height=sc(i)+c):(t.height=this.maxHeight,t.width=sc(i)+c),s.display&&this.ticks.length){const{first:u,last:d,widest:h,highest:p}=this._getLabelSizes(),f=s.padding*2,m=wo(this.labelRotation),g=Math.cos(m),v=Math.sin(m);if(a){const x=s.mirror?0:v*h.width+g*p.height;t.height=Math.min(this.maxHeight,t.height+x+f)}else{const x=s.mirror?0:g*h.width+v*p.height;t.width=Math.min(this.maxWidth,t.width+x+f)}this._calculatePadding(u,d,v,g)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,s,r){const{ticks:{align:i,padding:o},position:a}=this.options,c=this.labelRotation!==0,u=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const d=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let p=0,f=0;c?u?(p=r*t.width,f=s*n.height):(p=s*t.height,f=r*n.width):i==="start"?f=n.width:i==="end"?p=t.width:i!=="inner"&&(p=t.width/2,f=n.width/2),this.paddingLeft=Math.max((p-d+o)*this.width/(this.width-d),0),this.paddingRight=Math.max((f-h+o)*this.width/(this.width-h),0)}else{let d=n.height/2,h=t.height/2;i==="start"?(d=0,h=t.height):i==="end"&&(d=n.height,h=0),this.paddingTop=d+o,this.paddingBottom=h+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){kt(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,s;for(n=0,s=t.length;n<s;n++)vt(t[n].label)&&(t.splice(n,1),s--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const n=this.options.ticks.sampleSize;let s=this.ticks;n<s.length&&(s=Pk(s,n)),this._labelSizes=t=this._computeLabelSizes(s,s.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,n,s){const{ctx:r,_longestTextCache:i}=this,o=[],a=[],c=Math.floor(n/Ek(n,s));let u=0,d=0,h,p,f,m,g,v,x,_,b,S,C;for(h=0;h<n;h+=c){if(m=t[h].label,g=this._resolveTickFontOptions(h),r.font=v=g.string,x=i[v]=i[v]||{data:{},gc:[]},_=g.lineHeight,b=S=0,!vt(m)&&!dn(m))b=ik(r,x.data,x.gc,b,m),S=_;else if(dn(m))for(p=0,f=m.length;p<f;++p)C=m[p],!vt(C)&&!dn(C)&&(b=ik(r,x.data,x.gc,b,C),S+=_);o.push(b),a.push(S),u=Math.max(b,u),d=Math.max(S,d)}HJ(i,n);const w=o.indexOf(u),j=a.indexOf(d),T=F=>({width:o[F]||0,height:a[F]||0});return{first:T(0),last:T(n-1),widest:T(w),highest:T(j),widths:o,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return IQ(this._alignToPixels?io(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&t<n.length){const s=n[t];return s.$context||(s.$context=UJ(this.getContext(),t,s))}return this.$context||(this.$context=WJ(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=wo(this.labelRotation),s=Math.abs(Math.cos(n)),r=Math.abs(Math.sin(n)),i=this._getLabelSizes(),o=t.autoSkipPadding||0,a=i?i.widest.width+o:0,c=i?i.highest.height+o:0;return this.isHorizontal()?c*s>a*r?a/s:c/r:c*r<a*s?c/s:a/r}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const n=this.axis,s=this.chart,r=this.options,{grid:i,position:o,border:a}=r,c=i.offset,u=this.isHorizontal(),h=this.ticks.length+(c?1:0),p=sc(i),f=[],m=a.setContext(this.getContext()),g=m.display?m.width:0,v=g/2,x=function($){return io(s,$,g)};let _,b,S,C,w,j,T,F,R,B,A,D;if(o==="top")_=x(this.bottom),j=this.bottom-p,F=_-v,B=x(t.top)+v,D=t.bottom;else if(o==="bottom")_=x(this.top),B=t.top,D=x(t.bottom)-v,j=_+v,F=this.top+p;else if(o==="left")_=x(this.right),w=this.right-p,T=_-v,R=x(t.left)+v,A=t.right;else if(o==="right")_=x(this.left),R=t.left,A=x(t.right)-v,w=_+v,T=this.left+p;else if(n==="x"){if(o==="center")_=x((t.top+t.bottom)/2+.5);else if($e(o)){const $=Object.keys(o)[0],W=o[$];_=x(this.chart.scales[$].getPixelForValue(W))}B=t.top,D=t.bottom,j=_+v,F=j+p}else if(n==="y"){if(o==="center")_=x((t.left+t.right)/2);else if($e(o)){const $=Object.keys(o)[0],W=o[$];_=x(this.chart.scales[$].getPixelForValue(W))}w=_-v,T=w-p,R=t.left,A=t.right}const P=Ye(r.ticks.maxTicksLimit,h),E=Math.max(1,Math.ceil(h/P));for(b=0;b<h;b+=E){const $=this.getContext(b),W=i.setContext($),O=a.setContext($),H=W.lineWidth,k=W.color,I=O.dash||[],M=O.dashOffset,N=W.tickWidth,z=W.tickColor,U=W.tickBorderDash||[],K=W.tickBorderDashOffset;S=$J(this,b,c),S!==void 0&&(C=io(s,S,H),u?w=T=R=A=C:j=F=B=D=C,f.push({tx1:w,ty1:j,tx2:T,ty2:F,x1:R,y1:B,x2:A,y2:D,width:H,color:k,borderDash:I,borderDashOffset:M,tickWidth:N,tickColor:z,tickBorderDash:U,tickBorderDashOffset:K}))}return this._ticksLength=h,this._borderValue=_,f}_computeLabelItems(t){const n=this.axis,s=this.options,{position:r,ticks:i}=s,o=this.isHorizontal(),a=this.ticks,{align:c,crossAlign:u,padding:d,mirror:h}=i,p=sc(s.grid),f=p+d,m=h?-d:f,g=-wo(this.labelRotation),v=[];let x,_,b,S,C,w,j,T,F,R,B,A,D="middle";if(r==="top")w=this.bottom-m,j=this._getXAxisLabelAlignment();else if(r==="bottom")w=this.top+m,j=this._getXAxisLabelAlignment();else if(r==="left"){const E=this._getYAxisLabelAlignment(p);j=E.textAlign,C=E.x}else if(r==="right"){const E=this._getYAxisLabelAlignment(p);j=E.textAlign,C=E.x}else if(n==="x"){if(r==="center")w=(t.top+t.bottom)/2+f;else if($e(r)){const E=Object.keys(r)[0],$=r[E];w=this.chart.scales[E].getPixelForValue($)+f}j=this._getXAxisLabelAlignment()}else if(n==="y"){if(r==="center")C=(t.left+t.right)/2-f;else if($e(r)){const E=Object.keys(r)[0],$=r[E];C=this.chart.scales[E].getPixelForValue($)}j=this._getYAxisLabelAlignment(p).textAlign}n==="y"&&(c==="start"?D="top":c==="end"&&(D="bottom"));const P=this._getLabelSizes();for(x=0,_=a.length;x<_;++x){b=a[x],S=b.label;const E=i.setContext(this.getContext(x));T=this.getPixelForTick(x)+i.labelOffset,F=this._resolveTickFontOptions(x),R=F.lineHeight,B=dn(S)?S.length:1;const $=B/2,W=E.color,O=E.textStrokeColor,H=E.textStrokeWidth;let k=j;o?(C=T,j==="inner"&&(x===_-1?k=this.options.reverse?"left":"right":x===0?k=this.options.reverse?"right":"left":k="center"),r==="top"?u==="near"||g!==0?A=-B*R+R/2:u==="center"?A=-P.highest.height/2-$*R+R:A=-P.highest.height+R/2:u==="near"||g!==0?A=R/2:u==="center"?A=P.highest.height/2-$*R:A=P.highest.height-B*R,h&&(A*=-1),g!==0&&!E.showLabelBackdrop&&(C+=R/2*Math.sin(g))):(w=T,A=(1-B)*R/2);let I;if(E.showLabelBackdrop){const M=bu(E.backdropPadding),N=P.heights[x],z=P.widths[x];let U=A-M.top,K=0-M.left;switch(D){case"middle":U-=N/2;break;case"bottom":U-=N;break}switch(j){case"center":K-=z/2;break;case"right":K-=z;break;case"inner":x===_-1?K-=z:x>0&&(K-=z/2);break}I={left:K,top:U,width:z+M.width,height:N+M.height,color:E.backdropColor}}v.push({label:S,font:F,textOffset:A,options:{rotation:g,color:W,strokeColor:O,strokeWidth:H,textAlign:k,textBaseline:D,translation:[C,w],backdrop:I}})}return v}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-wo(this.labelRotation))return t==="top"?"left":"right";let r="center";return n.align==="start"?r="left":n.align==="end"?r="right":n.align==="inner"&&(r="inner"),r}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:s,mirror:r,padding:i}}=this.options,o=this._getLabelSizes(),a=t+i,c=o.widest.width;let u,d;return n==="left"?r?(d=this.right+i,s==="near"?u="left":s==="center"?(u="center",d+=c/2):(u="right",d+=c)):(d=this.right-a,s==="near"?u="right":s==="center"?(u="center",d-=c/2):(u="left",d=this.left)):n==="right"?r?(d=this.left+i,s==="near"?u="right":s==="center"?(u="center",d-=c/2):(u="left",d-=c)):(d=this.left+a,s==="near"?u="left":s==="center"?(u="center",d+=c/2):(u="right",d=this.right)):u="right",{textAlign:u,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:s,top:r,width:i,height:o}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(s,r,i,o),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const r=this.ticks.findIndex(i=>i.value===t);return r>=0?n.setContext(this.getContext(r)).lineWidth:0}drawGrid(t){const n=this.options.grid,s=this.ctx,r=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let i,o;const a=(c,u,d)=>{!d.width||!d.color||(s.save(),s.lineWidth=d.width,s.strokeStyle=d.color,s.setLineDash(d.borderDash||[]),s.lineDashOffset=d.borderDashOffset,s.beginPath(),s.moveTo(c.x,c.y),s.lineTo(u.x,u.y),s.stroke(),s.restore())};if(n.display)for(i=0,o=r.length;i<o;++i){const c=r[i];n.drawOnChartArea&&a({x:c.x1,y:c.y1},{x:c.x2,y:c.y2},c),n.drawTicks&&a({x:c.tx1,y:c.ty1},{x:c.tx2,y:c.ty2},{color:c.tickColor,width:c.tickWidth,borderDash:c.tickBorderDash,borderDashOffset:c.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:n,options:{border:s,grid:r}}=this,i=s.setContext(this.getContext()),o=s.display?i.width:0;if(!o)return;const a=r.setContext(this.getContext(0)).lineWidth,c=this._borderValue;let u,d,h,p;this.isHorizontal()?(u=io(t,this.left,o)-o/2,d=io(t,this.right,a)+a/2,h=p=c):(h=io(t,this.top,o)-o/2,p=io(t,this.bottom,a)+a/2,u=d=c),n.save(),n.lineWidth=i.width,n.strokeStyle=i.color,n.beginPath(),n.moveTo(u,h),n.lineTo(d,p),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const s=this.ctx,r=this._computeLabelArea();r&&f_(s,r);const i=this.getLabelItems(t);for(const o of i){const a=o.options,c=o.font,u=o.label,d=o.textOffset;ak(s,u,0,d,c,a)}r&&p_(s)}drawTitle(){const{ctx:t,options:{position:n,title:s,reverse:r}}=this;if(!s.display)return;const i=Kv(s.font),o=bu(s.padding),a=s.align;let c=i.lineHeight/2;n==="bottom"||n==="center"||$e(n)?(c+=o.bottom,dn(s.text)&&(c+=i.lineHeight*(s.text.length-1))):c+=o.top;const{titleX:u,titleY:d,maxWidth:h,rotation:p}=KJ(this,c,n,a);ak(t,s.text,0,0,i,{color:s.color,maxWidth:h,rotation:p,textAlign:qJ(a,n,r),textBaseline:"middle",translation:[u,d]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,n=t.ticks&&t.ticks.z||0,s=Ye(t.grid&&t.grid.z,-1),r=Ye(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==Tl.prototype.draw?[{z:n,draw:i=>{this.draw(i)}}]:[{z:s,draw:i=>{this.drawBackground(),this.drawGrid(i),this.drawTitle()}},{z:r,draw:()=>{this.drawBorder()}},{z:n,draw:i=>{this.drawLabels(i)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",r=[];let i,o;for(i=0,o=n.length;i<o;++i){const a=n[i];a[s]===this.id&&(!t||a.type===t)&&r.push(a)}return r}_resolveTickFontOptions(t){const n=this.options.ticks.setContext(this.getContext(t));return Kv(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Zd{constructor(t,n,s){this.type=t,this.scope=n,this.override=s,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const n=Object.getPrototypeOf(t);let s;XJ(n)&&(s=this.register(n));const r=this.items,i=t.id,o=this.scope+"."+i;if(!i)throw new Error("class does not have id: "+t);return i in r||(r[i]=t,VJ(t,o,s),this.override&&Mt.override(t.id,t.overrides)),o}get(t){return this.items[t]}unregister(t){const n=this.items,s=t.id,r=this.scope;s in n&&delete n[s],r&&s in Mt[r]&&(delete Mt[r][s],this.override&&delete Zo[s])}}function VJ(e,t,n){const s=yu(Object.create(null),[n?Mt.get(n):{},Mt.get(t),e.defaults]);Mt.set(t,s),e.defaultRoutes&&YJ(t,e.defaultRoutes),e.descriptors&&Mt.describe(t,e.descriptors)}function YJ(e,t){Object.keys(t).forEach(n=>{const s=n.split("."),r=s.pop(),i=[e].concat(s).join("."),o=t[n].split("."),a=o.pop(),c=o.join(".");Mt.route(i,r,c,a)})}function XJ(e){return"id"in e&&"defaults"in e}class QJ{constructor(){this.controllers=new Zd(Dh,"datasets",!0),this.elements=new Zd(Ep,"elements"),this.plugins=new Zd(Object,"plugins"),this.scales=new Zd(Tl,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,s){[...n].forEach(r=>{const i=s||this._getRegistryForType(r);s||i.isForType(r)||i===this.plugins&&r.id?this._exec(t,i,r):bn(r,o=>{const a=s||this._getRegistryForType(o);this._exec(t,a,o)})})}_exec(t,n,s){const r=u_(t);kt(s["before"+r],[],s),n[t](s),kt(s["after"+r],[],s)}_getRegistryForType(t){for(let n=0;n<this._typedRegistries.length;n++){const s=this._typedRegistries[n];if(s.isForType(t))return s}return this.plugins}_get(t,n,s){const r=n.get(t);if(r===void 0)throw new Error('"'+t+'" is not a registered '+s+".");return r}}var nr=new QJ;class GJ{constructor(){this._init=void 0}notify(t,n,s,r){if(n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),this._init===void 0)return;const i=r?this._descriptors(t).filter(r):this._descriptors(t),o=this._notify(i,t,n,s);return n==="afterDestroy"&&(this._notify(i,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),o}_notify(t,n,s,r){r=r||{};for(const i of t){const o=i.plugin,a=o[s],c=[n,r,i.options];if(kt(a,c,o)===!1&&r.cancelable)return!1}return!0}invalidate(){vt(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),n}_createDescriptors(t,n){const s=t&&t.config,r=Ye(s.options&&s.options.plugins,{}),i=JJ(s);return r===!1&&!n?[]:eZ(t,i,r,n)}_notifyStateChanges(t){const n=this._oldCache||[],s=this._cache,r=(i,o)=>i.filter(a=>!o.some(c=>a.plugin.id===c.plugin.id));this._notify(r(n,s),t,"stop"),this._notify(r(s,n),t,"start")}}function JJ(e){const t={},n=[],s=Object.keys(nr.plugins.items);for(let i=0;i<s.length;i++)n.push(nr.getPlugin(s[i]));const r=e.plugins||[];for(let i=0;i<r.length;i++){const o=r[i];n.indexOf(o)===-1&&(n.push(o),t[o.id]=!0)}return{plugins:n,localIds:t}}function ZJ(e,t){return!t&&e===!1?null:e===!0?{}:e}function eZ(e,{plugins:t,localIds:n},s,r){const i=[],o=e.getContext();for(const a of t){const c=a.id,u=ZJ(s[c],r);u!==null&&i.push({plugin:a,options:tZ(e.config,{plugin:a,local:n[c]},u,o)})}return i}function tZ(e,{plugin:t,local:n},s,r){const i=e.pluginScopeKeys(t),o=e.getOptionScopes(s,i);return n&&t.defaults&&o.push(t.defaults),e.createResolver(o,r,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Vv(e,t){const n=Mt.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function nZ(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function sZ(e,t){return e===t?"_index_":"_value_"}function Rk(e){if(e==="x"||e==="y"||e==="r")return e}function rZ(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function Yv(e,...t){if(Rk(e))return e;for(const n of t){const s=n.axis||rZ(n.position)||e.length>1&&Rk(e[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function Dk(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function iZ(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(s=>s.xAxisID===e||s.yAxisID===e);if(n.length)return Dk(e,"x",n[0])||Dk(e,"y",n[0])}return{}}function oZ(e,t){const n=Zo[e.type]||{scales:{}},s=t.scales||{},r=Vv(e.type,t),i=Object.create(null);return Object.keys(s).forEach(o=>{const a=s[o];if(!$e(a))return console.error(`Invalid scale configuration for scale: ${o}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${o}`);const c=Yv(o,a,iZ(o,e),Mt.scales[a.type]),u=sZ(c,r),d=n.scales||{};i[o]=Fc(Object.create(null),[{axis:c},a,d[c],d[u]])}),e.data.datasets.forEach(o=>{const a=o.type||e.type,c=o.indexAxis||Vv(a,t),d=(Zo[a]||{}).scales||{};Object.keys(d).forEach(h=>{const p=nZ(h,c),f=o[p+"AxisID"]||p;i[f]=i[f]||Object.create(null),Fc(i[f],[{axis:p},s[f],d[h]])})}),Object.keys(i).forEach(o=>{const a=i[o];Fc(a,[Mt.scales[a.type],Mt.scale])}),i}function f4(e){const t=e.options||(e.options={});t.plugins=Ye(t.plugins,{}),t.scales=oZ(e,t)}function p4(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function aZ(e){return e=e||{},e.data=p4(e.data),f4(e),e}const Mk=new Map,m4=new Set;function eh(e,t){let n=Mk.get(e);return n||(n=t(),Mk.set(e,n),m4.add(n)),n}const rc=(e,t,n)=>{const s=Rf(t,n);s!==void 0&&e.add(s)};class lZ{constructor(t){this._config=aZ(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=p4(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),f4(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return eh(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return eh(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return eh(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,s=this.type;return eh(`${s}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const s=this._scopeCache;let r=s.get(t);return(!r||n)&&(r=new Map,s.set(t,r)),r}getOptionScopes(t,n,s){const{options:r,type:i}=this,o=this._cachedScopes(t,s),a=o.get(n);if(a)return a;const c=new Set;n.forEach(d=>{t&&(c.add(t),d.forEach(h=>rc(c,t,h))),d.forEach(h=>rc(c,r,h)),d.forEach(h=>rc(c,Zo[i]||{},h)),d.forEach(h=>rc(c,Mt,h)),d.forEach(h=>rc(c,qv,h))});const u=Array.from(c);return u.length===0&&u.push(Object.create(null)),m4.has(n)&&o.set(n,u),u}chartOptionScopes(){const{options:t,type:n}=this;return[t,Zo[n]||{},Mt.datasets[n]||{},{type:n},Mt,qv]}resolveNamedOptions(t,n,s,r=[""]){const i={$shared:!0},{resolver:o,subPrefixes:a}=Lk(this._resolverCache,t,r);let c=o;if(uZ(o,n)){i.$shared=!1,s=Xi(s)?s():s;const u=this.createResolver(t,s,a);c=hl(o,s,u)}for(const u of n)i[u]=c[u];return i}createResolver(t,n,s=[""],r){const{resolver:i}=Lk(this._resolverCache,t,s);return $e(n)?hl(i,n,void 0,r):i}}function Lk(e,t,n){let s=e.get(t);s||(s=new Map,e.set(t,s));const r=n.join();let i=s.get(r);return i||(i={resolver:m_(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},s.set(r,i)),i}const cZ=e=>$e(e)&&Object.getOwnPropertyNames(e).some(t=>Xi(e[t]));function uZ(e,t){const{isScriptable:n,isIndexable:s}=JP(e);for(const r of t){const i=n(r),o=s(r),a=(o||i)&&e[r];if(i&&(Xi(a)||cZ(a))||o&&dn(a))return!0}return!1}var dZ="4.5.1";const hZ=["top","bottom","left","right","chartArea"];function Ak(e,t){return e==="top"||e==="bottom"||hZ.indexOf(e)===-1&&t==="x"}function Ok(e,t){return function(n,s){return n[e]===s[e]?n[t]-s[t]:n[e]-s[e]}}function Ik(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),kt(n&&n.onComplete,[e],t)}function fZ(e){const t=e.chart,n=t.options.animation;kt(n&&n.onProgress,[e],t)}function g4(e){return v_()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const Lh={},Fk=e=>{const t=g4(e);return Object.values(Lh).filter(n=>n.canvas===t).pop()};function pZ(e,t,n){const s=Object.keys(e);for(const r of s){const i=+r;if(i>=t){const o=e[r];delete e[r],(n>0||i>t)&&(e[i+n]=o)}}}function mZ(e,t,n,s){return!n||e.type==="mouseout"?null:s?t:e}class Tr{static register(...t){nr.add(...t),Bk()}static unregister(...t){nr.remove(...t),Bk()}constructor(t,n){const s=this.config=new lZ(n),r=g4(t),i=Fk(r);if(i)throw new Error("Canvas is already in use. Chart with ID '"+i.id+"' must be destroyed before the canvas with ID '"+i.canvas.id+"' can be reused.");const o=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||MJ(r)),this.platform.updateConfig(s);const a=this.platform.acquireContext(r,o.aspectRatio),c=a&&a.canvas,u=c&&c.height,d=c&&c.width;if(this.id=bQ(),this.ctx=a,this.canvas=c,this.width=d,this.height=u,this._options=o,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new GJ,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=HQ(h=>this.update(h),o.resizeDelay||0),this._dataChanges=[],Lh[this.id]=this,!a||!c){console.error("Failed to create chart: can't acquire context from the given item");return}Nr.listen(this,"complete",Ik),Nr.listen(this,"progress",fZ),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:s,height:r,_aspectRatio:i}=this;return vt(t)?n&&i?i:r?s/r:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return nr}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():uk(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return ok(this.canvas,this.ctx),this}stop(){return Nr.stop(this),this}resize(t,n){Nr.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const s=this.options,r=this.canvas,i=s.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(r,t,n,i),a=s.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,uk(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),kt(s.onResize,[this,o],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};bn(n,(s,r)=>{s.id=r})}buildOrUpdateScales(){const t=this.options,n=t.scales,s=this.scales,r=Object.keys(s).reduce((o,a)=>(o[a]=!1,o),{});let i=[];n&&(i=i.concat(Object.keys(n).map(o=>{const a=n[o],c=Yv(o,a),u=c==="r",d=c==="x";return{options:a,dposition:u?"chartArea":d?"bottom":"left",dtype:u?"radialLinear":d?"category":"linear"}}))),bn(i,o=>{const a=o.options,c=a.id,u=Yv(c,a),d=Ye(a.type,o.dtype);(a.position===void 0||Ak(a.position,u)!==Ak(o.dposition))&&(a.position=o.dposition),r[c]=!0;let h=null;if(c in s&&s[c].type===d)h=s[c];else{const p=nr.getScale(d);h=new p({id:c,type:d,ctx:this.ctx,chart:this}),s[h.id]=h}h.init(a,t)}),bn(r,(o,a)=>{o||delete s[a]}),bn(s,o=>{Gd.configure(this,o,o.options),Gd.addBox(this,o)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,s=t.length;if(t.sort((r,i)=>r.index-i.index),s>n){for(let r=n;r<s;++r)this._destroyDatasetMeta(r);t.splice(n,s-n)}this._sortedMetasets=t.slice(0).sort(Ok("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((s,r)=>{n.filter(i=>i===s._dataset).length===0&&this._destroyDatasetMeta(r)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let s,r;for(this._removeUnreferencedMetasets(),s=0,r=n.length;s<r;s++){const i=n[s];let o=this.getDatasetMeta(s);const a=i.type||this.config.type;if(o.type&&o.type!==a&&(this._destroyDatasetMeta(s),o=this.getDatasetMeta(s)),o.type=a,o.indexAxis=i.indexAxis||Vv(a,this.options),o.order=i.order||0,o.index=s,o.label=""+i.label,o.visible=this.isDatasetVisible(s),o.controller)o.controller.updateIndex(s),o.controller.linkScales();else{const c=nr.getController(a),{datasetElementType:u,dataElementType:d}=Mt.datasets[a];Object.assign(c,{dataElementType:nr.getElement(d),datasetElementType:u&&nr.getElement(u)}),o.controller=new c(this,s),t.push(o.controller)}}return this._updateMetasets(),t}_resetElements(){bn(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const s=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),r=this._animationsDisabled=!s.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const i=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let u=0,d=this.data.datasets.length;u<d;u++){const{controller:h}=this.getDatasetMeta(u),p=!r&&i.indexOf(h)===-1;h.buildOrUpdateElements(p),o=Math.max(+h.getMaxOverflow(),o)}o=this._minPadding=s.layout.autoPadding?o:0,this._updateLayout(o),r||bn(i,u=>{u.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Ok("z","_idx"));const{_active:a,_lastEvent:c}=this;c?this._eventHandler(c,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){bn(this.scales,t=>{Gd.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!YS(n,s)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:s,start:r,count:i}of n){const o=s==="_removeElements"?-i:i;pZ(t,r,o)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,s=i=>new Set(t.filter(o=>o[0]===i).map((o,a)=>a+","+o.splice(1).join(","))),r=s(0);for(let i=1;i<n;i++)if(!YS(r,s(i)))return;return Array.from(r).map(i=>i.split(",")).map(i=>({method:i[1],start:+i[2],count:+i[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Gd.update(this,this.width,this.height,t);const n=this.chartArea,s=n.width<=0||n.height<=0;this._layers=[],bn(this.boxes,r=>{s&&r.position==="chartArea"||(r.configure&&r.configure(),this._layers.push(...r._layers()))},this),this._layers.forEach((r,i)=>{r._idx=i}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,s=this.data.datasets.length;n<s;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,s=this.data.datasets.length;n<s;++n)this._updateDataset(n,Xi(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){const s=this.getDatasetMeta(t),r={meta:s,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",r)!==!1&&(s.controller._update(n),r.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",r))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Nr.has(this)?this.attached&&!Nr.running(this)&&Nr.start(this):(this.draw(),Ik({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:s,height:r}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(s,r)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const n=this._sortedMetasets,s=[];let r,i;for(r=0,i=n.length;r<i;++r){const o=n[r];(!t||o.visible)&&s.push(o)}return s}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,s={meta:t,index:t.index,cancelable:!0},r=o4(this,t);this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(r&&f_(n,r),t.controller.draw(),r&&p_(n),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return _u(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,s,r){const i=hJ.modes[n];return typeof i=="function"?i(this,t,s,r):[]}getDatasetMeta(t){const n=this.data.datasets[t],s=this._metasets;let r=s.filter(i=>i&&i._dataset===n).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},s.push(r)),r}getContext(){return this.$context||(this.$context=Pl(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const s=this.getDatasetMeta(t);return typeof s.hidden=="boolean"?!s.hidden:!n.hidden}setDatasetVisibility(t,n){const s=this.getDatasetMeta(t);s.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,s){const r=s?"show":"hide",i=this.getDatasetMeta(t),o=i.controller._resolveAnimations(void 0,r);Df(n)?(i.data[n].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),o.update(i,{visible:s}),this.update(a=>a.datasetIndex===t?r:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),Nr.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),ok(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete Lh[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,n=this.platform,s=(i,o)=>{n.addEventListener(this,i,o),t[i]=o},r=(i,o,a)=>{i.offsetX=o,i.offsetY=a,this._eventHandler(i)};bn(this.options.events,i=>s(i,r))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,s=(c,u)=>{n.addEventListener(this,c,u),t[c]=u},r=(c,u)=>{t[c]&&(n.removeEventListener(this,c,u),delete t[c])},i=(c,u)=>{this.canvas&&this.resize(c,u)};let o;const a=()=>{r("attach",a),this.attached=!0,this.resize(),s("resize",i),s("detach",o)};o=()=>{this.attached=!1,r("resize",i),this._stop(),this._resize(0,0),s("attach",a)},n.isAttached(this.canvas)?a():o()}unbindEvents(){bn(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},bn(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,s){const r=s?"set":"remove";let i,o,a,c;for(n==="dataset"&&(i=this.getDatasetMeta(t[0].datasetIndex),i.controller["_"+r+"DatasetHoverStyle"]()),a=0,c=t.length;a<c;++a){o=t[a];const u=o&&this.getDatasetMeta(o.datasetIndex).controller;u&&u[r+"HoverStyle"](o.element,o.datasetIndex,o.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const n=this._active||[],s=t.map(({datasetIndex:i,index:o})=>{const a=this.getDatasetMeta(i);if(!a)throw new Error("No dataset found at index "+i);return{datasetIndex:i,element:a.data[o],index:o}});!KS(s,n)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,n))}notifyPlugins(t,n,s){return this._plugins.notify(this,t,n,s)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,s){const r=this.options.hover,i=(c,u)=>c.filter(d=>!u.some(h=>d.datasetIndex===h.datasetIndex&&d.index===h.index)),o=i(n,t),a=s?t:i(t,n);o.length&&this.updateHoverStyle(o,r.mode,!1),a.length&&r.mode&&this.updateHoverStyle(a,r.mode,!0)}_eventHandler(t,n){const s={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},r=o=>(o.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",s,r)===!1)return;const i=this._handleEvent(t,n,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,r),(i||s.changed)&&this.render(),this}_handleEvent(t,n,s){const{_active:r=[],options:i}=this,o=n,a=this._getActiveElements(t,r,s,o),c=jQ(t),u=mZ(t,this._lastEvent,s,c);s&&(this._lastEvent=null,kt(i.onHover,[t,a,this],this),c&&kt(i.onClick,[t,a,this],this));const d=!KS(a,r);return(d||n)&&(this._active=a,this._updateHoverStyles(a,r,n)),this._lastEvent=u,d}_getActiveElements(t,n,s,r){if(t.type==="mouseout")return[];if(!s)return n;const i=this.options.hover;return this.getElementsAtEventForMode(t,i.mode,i,r)}}Ae(Tr,"defaults",Mt),Ae(Tr,"instances",Lh),Ae(Tr,"overrides",Zo),Ae(Tr,"registry",nr),Ae(Tr,"version",dZ),Ae(Tr,"getChart",Fk);function Bk(){return bn(Tr.instances,e=>e._plugins.invalidate())}function x4(e,t,n=t){e.lineCap=Ye(n.borderCapStyle,t.borderCapStyle),e.setLineDash(Ye(n.borderDash,t.borderDash)),e.lineDashOffset=Ye(n.borderDashOffset,t.borderDashOffset),e.lineJoin=Ye(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=Ye(n.borderWidth,t.borderWidth),e.strokeStyle=Ye(n.borderColor,t.borderColor)}function gZ(e,t,n){e.lineTo(n.x,n.y)}function xZ(e){return e.stepped?nG:e.tension||e.cubicInterpolationMode==="monotone"?sG:gZ}function v4(e,t,n={}){const s=e.length,{start:r=0,end:i=s-1}=n,{start:o,end:a}=t,c=Math.max(r,o),u=Math.min(i,a),d=r<o&&i<o||r>a&&i>a;return{count:s,start:c,loop:t.loop,ilen:u<c&&!d?s+u-c:u-c}}function vZ(e,t,n,s){const{points:r,options:i}=t,{count:o,start:a,loop:c,ilen:u}=v4(r,n,s),d=xZ(i);let{move:h=!0,reverse:p}=s||{},f,m,g;for(f=0;f<=u;++f)m=r[(a+(p?u-f:f))%o],!m.skip&&(h?(e.moveTo(m.x,m.y),h=!1):d(e,g,m,p,i.stepped),g=m);return c&&(m=r[(a+(p?u:0))%o],d(e,g,m,p,i.stepped)),!!c}function yZ(e,t,n,s){const r=t.points,{count:i,start:o,ilen:a}=v4(r,n,s),{move:c=!0,reverse:u}=s||{};let d=0,h=0,p,f,m,g,v,x;const _=S=>(o+(u?a-S:S))%i,b=()=>{g!==v&&(e.lineTo(d,v),e.lineTo(d,g),e.lineTo(d,x))};for(c&&(f=r[_(0)],e.moveTo(f.x,f.y)),p=0;p<=a;++p){if(f=r[_(p)],f.skip)continue;const S=f.x,C=f.y,w=S|0;w===m?(C<g?g=C:C>v&&(v=C),d=(h*d+S)/++h):(b(),e.lineTo(S,C),m=w,h=0,g=v=C),x=C}b()}function Xv(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?yZ:vZ}function _Z(e){return e.stepped?IG:e.tension||e.cubicInterpolationMode==="monotone"?FG:fo}function bZ(e,t,n,s){let r=t._path;r||(r=t._path=new Path2D,t.path(r,n,s)&&r.closePath()),x4(e,t.options),e.stroke(r)}function wZ(e,t,n,s){const{segments:r,options:i}=t,o=Xv(t);for(const a of r)x4(e,i,a.style),e.beginPath(),o(e,t,a,{start:n,end:n+s-1})&&e.closePath(),e.stroke()}const SZ=typeof Path2D=="function";function kZ(e,t,n,s){SZ&&!t.options.segment?bZ(e,t,n,s):wZ(e,t,n,s)}class Ri extends Ep{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const s=this.options;if((s.tension||s.cubicInterpolationMode==="monotone")&&!s.stepped&&!this._pointsUpdated){const r=s.spanGaps?this._loop:this._fullLoop;PG(this._points,s,t,r,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=HG(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,s=t.length;return s&&n[t[s-1].end]}interpolate(t,n){const s=this.options,r=t[n],i=this.points,o=i4(this,{property:n,start:r,end:r});if(!o.length)return;const a=[],c=_Z(s);let u,d;for(u=0,d=o.length;u<d;++u){const{start:h,end:p}=o[u],f=i[h],m=i[p];if(f===m){a.push(f);continue}const g=Math.abs((r-f[n])/(m[n]-f[n])),v=c(f,m,g,s.stepped);v[n]=t[n],a.push(v)}return a.length===1?a[0]:a}pathSegment(t,n,s){return Xv(this)(t,this,n,s)}path(t,n,s){const r=this.segments,i=Xv(this);let o=this._loop;n=n||0,s=s||this.points.length-n;for(const a of r)o&=i(t,this,a,{start:n,end:n+s-1});return!!o}draw(t,n,s,r){const i=this.options||{};(this.points||[]).length&&i.borderWidth&&(t.save(),kZ(t,this,s,r),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}Ae(Ri,"id","line"),Ae(Ri,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),Ae(Ri,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),Ae(Ri,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function zk(e,t,n,s){const r=e.options,{[n]:i}=e.getProps([n],s);return Math.abs(t-i)<r.radius+r.hitRadius}class Ah extends Ep{constructor(n){super();Ae(this,"parsed");Ae(this,"skip");Ae(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,n&&Object.assign(this,n)}inRange(n,s,r){const i=this.options,{x:o,y:a}=this.getProps(["x","y"],r);return Math.pow(n-o,2)+Math.pow(s-a,2)<Math.pow(i.hitRadius+i.radius,2)}inXRange(n,s){return zk(this,n,"x",s)}inYRange(n,s){return zk(this,n,"y",s)}getCenterPoint(n){const{x:s,y:r}=this.getProps(["x","y"],n);return{x:s,y:r}}size(n){n=n||this.options||{};let s=n.radius||0;s=Math.max(s,s&&n.hoverRadius||0);const r=s&&n.borderWidth||0;return(s+r)*2}draw(n,s){const r=this.options;this.skip||r.radius<.1||!_u(this,s,this.size(r)/2)||(n.strokeStyle=r.borderColor,n.lineWidth=r.borderWidth,n.fillStyle=r.backgroundColor,eG(n,r,this.x,this.y))}getRange(){const n=this.options||{};return n.radius+n.hitRadius}}Ae(Ah,"id","point"),Ae(Ah,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),Ae(Ah,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function CZ(e,t,n){const s=e.segments,r=e.points,i=t.points,o=[];for(const a of s){let{start:c,end:u}=a;u=Pp(c,u,r);const d=Qv(n,r[c],r[u],a.loop);if(!t.segments){o.push({source:a,target:d,start:r[c],end:r[u]});continue}const h=i4(t,d);for(const p of h){const f=Qv(n,i[p.start],i[p.end],p.loop),m=r4(a,r,f);for(const g of m)o.push({source:g,target:p,start:{[n]:$k(d,f,"start",Math.max)},end:{[n]:$k(d,f,"end",Math.min)}})}}return o}function Qv(e,t,n,s){if(s)return;let r=t[e],i=n[e];return e==="angle"&&(r=sr(r),i=sr(i)),{property:e,start:r,end:i}}function NZ(e,t){const{x:n=null,y:s=null}=e||{},r=t.points,i=[];return t.segments.forEach(({start:o,end:a})=>{a=Pp(o,a,r);const c=r[o],u=r[a];s!==null?(i.push({x:c.x,y:s}),i.push({x:u.x,y:s})):n!==null&&(i.push({x:n,y:c.y}),i.push({x:n,y:u.y}))}),i}function Pp(e,t,n){for(;t>e;t--){const s=n[t];if(!isNaN(s.x)&&!isNaN(s.y))break}return t}function $k(e,t,n,s){return e&&t?s(e[n],t[n]):e?e[n]:t?t[n]:0}function y4(e,t){let n=[],s=!1;return dn(e)?(s=!0,n=e):n=NZ(e,t),n.length?new Ri({points:n,options:{tension:0},_loop:s,_fullLoop:s}):null}function Hk(e){return e&&e.fill!==!1}function jZ(e,t,n){let r=e[t].fill;const i=[t];let o;if(!n)return r;for(;r!==!1&&i.indexOf(r)===-1;){if(!Nn(r))return r;if(o=e[r],!o)return!1;if(o.visible)return r;i.push(r),r=o.fill}return!1}function EZ(e,t,n){const s=DZ(e);if($e(s))return isNaN(s.value)?!1:s;let r=parseFloat(s);return Nn(r)&&Math.floor(r)===r?PZ(s[0],t,r,n):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function PZ(e,t,n,s){return(e==="-"||e==="+")&&(n=t+n),n===t||n<0||n>=s?!1:n}function TZ(e,t){let n=null;return e==="start"?n=t.bottom:e==="end"?n=t.top:$e(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function RZ(e,t,n){let s;return e==="start"?s=n:e==="end"?s=t.options.reverse?t.min:t.max:$e(e)?s=e.value:s=t.getBaseValue(),s}function DZ(e){const t=e.options,n=t.fill;let s=Ye(n&&n.target,n);return s===void 0&&(s=!!t.backgroundColor),s===!1||s===null?!1:s===!0?"origin":s}function MZ(e){const{scale:t,index:n,line:s}=e,r=[],i=s.segments,o=s.points,a=LZ(t,n);a.push(y4({x:null,y:t.bottom},s));for(let c=0;c<i.length;c++){const u=i[c];for(let d=u.start;d<=u.end;d++)AZ(r,o[d],a)}return new Ri({points:r,options:{}})}function LZ(e,t){const n=[],s=e.getMatchingVisibleMetas("line");for(let r=0;r<s.length;r++){const i=s[r];if(i.index===t)break;i.hidden||n.unshift(i.dataset)}return n}function AZ(e,t,n){const s=[];for(let r=0;r<n.length;r++){const i=n[r],{first:o,last:a,point:c}=OZ(i,t,"x");if(!(!c||o&&a)){if(o)s.unshift(c);else if(e.push(c),!a)break}}e.push(...s)}function OZ(e,t,n){const s=e.interpolate(t,n);if(!s)return{};const r=s[n],i=e.segments,o=e.points;let a=!1,c=!1;for(let u=0;u<i.length;u++){const d=i[u],h=o[d.start][n],p=o[d.end][n];if(KP(r,h,p)){a=r===h,c=r===p;break}}return{first:a,last:c,point:s}}class _4{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,n,s){const{x:r,y:i,radius:o}=this;return n=n||{start:0,end:pr},t.arc(r,i,o,n.end,n.start,!0),!s.bounds}interpolate(t){const{x:n,y:s,radius:r}=this,i=t.angle;return{x:n+Math.cos(i)*r,y:s+Math.sin(i)*r,angle:i}}}function IZ(e){const{chart:t,fill:n,line:s}=e;if(Nn(n))return FZ(t,n);if(n==="stack")return MZ(e);if(n==="shape")return!0;const r=BZ(e);return r instanceof _4?r:y4(r,s)}function FZ(e,t){const n=e.getDatasetMeta(t);return n&&e.isDatasetVisible(t)?n.dataset:null}function BZ(e){return(e.scale||{}).getPointPositionForValue?$Z(e):zZ(e)}function zZ(e){const{scale:t={},fill:n}=e,s=TZ(n,t);if(Nn(s)){const r=t.isHorizontal();return{x:r?s:null,y:r?null:s}}return null}function $Z(e){const{scale:t,fill:n}=e,s=t.options,r=t.getLabels().length,i=s.reverse?t.max:t.min,o=RZ(n,t,i),a=[];if(s.grid.circular){const c=t.getPointPositionForValue(0,i);return new _4({x:c.x,y:c.y,radius:t.getDistanceFromCenterForValue(o)})}for(let c=0;c<r;++c)a.push(t.getPointPositionForValue(c,o));return a}function pg(e,t,n){const s=IZ(t),{chart:r,index:i,line:o,scale:a,axis:c}=t,u=o.options,d=u.fill,h=u.backgroundColor,{above:p=h,below:f=h}=d||{},m=r.getDatasetMeta(i),g=o4(r,m);s&&o.points.length&&(f_(e,n),HZ(e,{line:o,target:s,above:p,below:f,area:n,scale:a,axis:c,clip:g}),p_(e))}function HZ(e,t){const{line:n,target:s,above:r,below:i,area:o,scale:a,clip:c}=t,u=n._loop?"angle":t.axis;e.save();let d=i;i!==r&&(u==="x"?(Wk(e,s,o.top),mg(e,{line:n,target:s,color:r,scale:a,property:u,clip:c}),e.restore(),e.save(),Wk(e,s,o.bottom)):u==="y"&&(Uk(e,s,o.left),mg(e,{line:n,target:s,color:i,scale:a,property:u,clip:c}),e.restore(),e.save(),Uk(e,s,o.right),d=r)),mg(e,{line:n,target:s,color:d,scale:a,property:u,clip:c}),e.restore()}function Wk(e,t,n){const{segments:s,points:r}=t;let i=!0,o=!1;e.beginPath();for(const a of s){const{start:c,end:u}=a,d=r[c],h=r[Pp(c,u,r)];i?(e.moveTo(d.x,d.y),i=!1):(e.lineTo(d.x,n),e.lineTo(d.x,d.y)),o=!!t.pathSegment(e,a,{move:o}),o?e.closePath():e.lineTo(h.x,n)}e.lineTo(t.first().x,n),e.closePath(),e.clip()}function Uk(e,t,n){const{segments:s,points:r}=t;let i=!0,o=!1;e.beginPath();for(const a of s){const{start:c,end:u}=a,d=r[c],h=r[Pp(c,u,r)];i?(e.moveTo(d.x,d.y),i=!1):(e.lineTo(n,d.y),e.lineTo(d.x,d.y)),o=!!t.pathSegment(e,a,{move:o}),o?e.closePath():e.lineTo(n,h.y)}e.lineTo(n,t.first().y),e.closePath(),e.clip()}function mg(e,t){const{line:n,target:s,property:r,color:i,scale:o,clip:a}=t,c=CZ(n,s,r);for(const{source:u,target:d,start:h,end:p}of c){const{style:{backgroundColor:f=i}={}}=u,m=s!==!0;e.save(),e.fillStyle=f,WZ(e,o,a,m&&Qv(r,h,p)),e.beginPath();const g=!!n.pathSegment(e,u);let v;if(m){g?e.closePath():qk(e,s,p,r);const x=!!s.pathSegment(e,d,{move:g,reverse:!0});v=g&&x,v||qk(e,s,h,r)}e.closePath(),e.fill(v?"evenodd":"nonzero"),e.restore()}}function WZ(e,t,n,s){const r=t.chart.chartArea,{property:i,start:o,end:a}=s||{};if(i==="x"||i==="y"){let c,u,d,h;i==="x"?(c=o,u=r.top,d=a,h=r.bottom):(c=r.left,u=o,d=r.right,h=a),e.beginPath(),n&&(c=Math.max(c,n.left),d=Math.min(d,n.right),u=Math.max(u,n.top),h=Math.min(h,n.bottom)),e.rect(c,u,d-c,h-u),e.clip()}}function qk(e,t,n,s){const r=t.interpolate(n,s);r&&e.lineTo(r.x,r.y)}var UZ={id:"filler",afterDatasetsUpdate(e,t,n){const s=(e.data.datasets||[]).length,r=[];let i,o,a,c;for(o=0;o<s;++o)i=e.getDatasetMeta(o),a=i.dataset,c=null,a&&a.options&&a instanceof Ri&&(c={visible:e.isDatasetVisible(o),index:o,fill:EZ(a,o,s),chart:e,axis:i.controller.options.indexAxis,scale:i.vScale,line:a}),i.$filler=c,r.push(c);for(o=0;o<s;++o)c=r[o],!(!c||c.fill===!1)&&(c.fill=jZ(r,o,n.propagate))},beforeDraw(e,t,n){const s=n.drawTime==="beforeDraw",r=e.getSortedVisibleDatasetMetas(),i=e.chartArea;for(let o=r.length-1;o>=0;--o){const a=r[o].$filler;a&&(a.line.updateControlPoints(i,a.axis),s&&a.fill&&pg(e.ctx,a,i))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!=="beforeDatasetsDraw")return;const s=e.getSortedVisibleDatasetMetas();for(let r=s.length-1;r>=0;--r){const i=s[r].$filler;Hk(i)&&pg(e.ctx,i,e.chartArea)}},beforeDatasetDraw(e,t,n){const s=t.meta.$filler;!Hk(s)||n.drawTime!=="beforeDatasetDraw"||pg(e.ctx,s,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const qZ=(e,t,n,s)=>(typeof t=="string"?(n=e.push(t)-1,s.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function KZ(e,t,n,s){const r=e.indexOf(t);if(r===-1)return qZ(e,t,n,s);const i=e.lastIndexOf(t);return r!==i?n:r}const VZ=(e,t)=>e===null?null:Pi(Math.round(e),0,t);function Kk(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class Gv extends Tl{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const s=this.getLabels();for(const{index:r,label:i}of n)s[r]===i&&s.splice(r,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(vt(t))return null;const s=this.getLabels();return n=isFinite(n)&&s[n]===t?n:KZ(s,t,Ye(n,t),this._addedLabels),VZ(n,s.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:s,max:r}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(s=0),n||(r=this.getLabels().length-1)),this.min=s,this.max=r}buildTicks(){const t=this.min,n=this.max,s=this.options.offset,r=[];let i=this.getLabels();i=t===0&&n===i.length-1?i:i.slice(t,n+1),this._valueRange=Math.max(i.length-(s?0:1),1),this._startValue=this.min-(s?.5:0);for(let o=t;o<=n;o++)r.push({value:o});return r}getLabelForValue(t){return Kk.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}Ae(Gv,"id","category"),Ae(Gv,"defaults",{ticks:{callback:Kk}});function YZ(e,t){const n=[],{bounds:r,step:i,min:o,max:a,precision:c,count:u,maxTicks:d,maxDigits:h,includeBounds:p}=e,f=i||1,m=d-1,{min:g,max:v}=t,x=!vt(o),_=!vt(a),b=!vt(u),S=(v-g)/(h+1);let C=QS((v-g)/m/f)*f,w,j,T,F;if(C<1e-14&&!x&&!_)return[{value:g},{value:v}];F=Math.ceil(v/C)-Math.floor(g/C),F>m&&(C=QS(F*C/m/f)*f),vt(c)||(w=Math.pow(10,c),C=Math.ceil(C*w)/w),r==="ticks"?(j=Math.floor(g/C)*C,T=Math.ceil(v/C)*C):(j=g,T=v),x&&_&&i&&DQ((a-o)/i,C/1e3)?(F=Math.round(Math.min((a-o)/C,d)),C=(a-o)/F,j=o,T=a):b?(j=x?o:j,T=_?a:T,F=u-1,C=(T-j)/F):(F=(T-j)/C,Bc(F,Math.round(F),C/1e3)?F=Math.round(F):F=Math.ceil(F));const R=Math.max(GS(C),GS(j));w=Math.pow(10,vt(c)?R:c),j=Math.round(j*w)/w,T=Math.round(T*w)/w;let B=0;for(x&&(p&&j!==o?(n.push({value:o}),j<o&&B++,Bc(Math.round((j+B*C)*w)/w,o,Vk(o,S,e))&&B++):j<o&&B++);B<F;++B){const A=Math.round((j+B*C)*w)/w;if(_&&A>a)break;n.push({value:A})}return _&&p&&T!==a?n.length&&Bc(n[n.length-1].value,a,Vk(a,S,e))?n[n.length-1].value=a:n.push({value:a}):(!_||T===a)&&n.push({value:T}),n}function Vk(e,t,{horizontal:n,minRotation:s}){const r=wo(s),i=(n?Math.sin(r):Math.cos(r))||.001,o=.75*t*(""+e).length;return Math.min(t/i,o)}class XZ extends Tl{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return vt(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:s}=this.getUserBounds();let{min:r,max:i}=this;const o=c=>r=n?r:c,a=c=>i=s?i:c;if(t){const c=dl(r),u=dl(i);c<0&&u<0?a(0):c>0&&u>0&&o(0)}if(r===i){let c=i===0?1:Math.abs(i*.05);a(i+c),t||o(r-c)}this.min=r,this.max=i}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:s}=t,r;return s?(r=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,r>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${r} ticks. Limiting to 1000.`),r=1e3)):(r=this.computeTickLimit(),n=n||11),n&&(r=Math.min(n,r)),r}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let s=this.getTickLimit();s=Math.max(2,s);const r={maxTicks:s,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},i=this._range||this,o=YZ(r,i);return t.bounds==="ticks"&&MQ(o,this,"value"),t.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const t=this.ticks;let n=this.min,s=this.max;if(super.configure(),this.options.offset&&t.length){const r=(s-n)/Math.max(t.length-1,1)/2;n-=r,s+=r}this._startValue=n,this._endValue=s,this._valueRange=s-n}getLabelForValue(t){return QP(t,this.chart.options.locale,this.options.ticks.format)}}class Jv extends XZ{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Nn(t)?t:0,this.max=Nn(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,s=wo(this.options.ticks.minRotation),r=(t?Math.sin(s):Math.cos(s))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,i.lineHeight/r))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}Ae(Jv,"id","linear"),Ae(Jv,"defaults",{ticks:{callback:GP.formatters.numeric}});const Tp={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Yn=Object.keys(Tp);function Yk(e,t){return e-t}function Xk(e,t){if(vt(t))return null;const n=e._adapter,{parser:s,round:r,isoWeekday:i}=e._parseOpts;let o=t;return typeof s=="function"&&(o=s(o)),Nn(o)||(o=typeof s=="string"?n.parse(o,s):n.parse(o)),o===null?null:(r&&(o=r==="week"&&(Lf(i)||i===!0)?n.startOf(o,"isoWeek",i):n.startOf(o,r)),+o)}function Qk(e,t,n,s){const r=Yn.length;for(let i=Yn.indexOf(e);i<r-1;++i){const o=Tp[Yn[i]],a=o.steps?o.steps:Number.MAX_SAFE_INTEGER;if(o.common&&Math.ceil((n-t)/(a*o.size))<=s)return Yn[i]}return Yn[r-1]}function QZ(e,t,n,s,r){for(let i=Yn.length-1;i>=Yn.indexOf(n);i--){const o=Yn[i];if(Tp[o].common&&e._adapter.diff(r,s,o)>=t-1)return o}return Yn[n?Yn.indexOf(n):0]}function GZ(e){for(let t=Yn.indexOf(e)+1,n=Yn.length;t<n;++t)if(Tp[Yn[t]].common)return Yn[t]}function Gk(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:s,hi:r}=d_(n,t),i=n[s]>=t?n[s]:n[r];e[i]=!0}}function JZ(e,t,n,s){const r=e._adapter,i=+r.startOf(t[0].value,s),o=t[t.length-1].value;let a,c;for(a=i;a<=o;a=+r.add(a,1,s))c=n[a],c>=0&&(t[c].major=!0);return t}function Jk(e,t,n){const s=[],r={},i=t.length;let o,a;for(o=0;o<i;++o)a=t[o],r[a]=o,s.push({value:a,major:!1});return i===0||!n?s:JZ(e,s,r,n)}class If extends Tl{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const s=t.time||(t.time={}),r=this._adapter=new aJ._date(t.adapters.date);r.init(n),Fc(s.displayFormats,r.formats()),this._parseOpts={parser:s.parser,round:s.round,isoWeekday:s.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:Xk(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,s=t.time.unit||"day";let{min:r,max:i,minDefined:o,maxDefined:a}=this.getUserBounds();function c(u){!o&&!isNaN(u.min)&&(r=Math.min(r,u.min)),!a&&!isNaN(u.max)&&(i=Math.max(i,u.max))}(!o||!a)&&(c(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&c(this.getMinMax(!1))),r=Nn(r)&&!isNaN(r)?r:+n.startOf(Date.now(),s),i=Nn(i)&&!isNaN(i)?i:+n.endOf(Date.now(),s)+1,this.min=Math.min(r,i-1),this.max=Math.max(r+1,i)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],s=t[t.length-1]),{min:n,max:s}}buildTicks(){const t=this.options,n=t.time,s=t.ticks,r=s.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&r.length&&(this.min=this._userMin||r[0],this.max=this._userMax||r[r.length-1]);const i=this.min,o=this.max,a=BQ(r,i,o);return this._unit=n.unit||(s.autoSkip?Qk(n.minUnit,this.min,this.max,this._getLabelCapacity(i)):QZ(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!s.major.enabled||this._unit==="year"?void 0:GZ(this._unit),this.initOffsets(r),t.reverse&&a.reverse(),Jk(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,s=0,r,i;this.options.offset&&t.length&&(r=this.getDecimalForValue(t[0]),t.length===1?n=1-r:n=(this.getDecimalForValue(t[1])-r)/2,i=this.getDecimalForValue(t[t.length-1]),t.length===1?s=i:s=(i-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;n=Pi(n,0,o),s=Pi(s,0,o),this._offsets={start:n,end:s,factor:1/(n+1+s)}}_generate(){const t=this._adapter,n=this.min,s=this.max,r=this.options,i=r.time,o=i.unit||Qk(i.minUnit,n,s,this._getLabelCapacity(n)),a=Ye(r.ticks.stepSize,1),c=o==="week"?i.isoWeekday:!1,u=Lf(c)||c===!0,d={};let h=n,p,f;if(u&&(h=+t.startOf(h,"isoWeek",c)),h=+t.startOf(h,u?"day":o),t.diff(s,n,o)>1e5*a)throw new Error(n+" and "+s+" are too far apart with stepSize of "+a+" "+o);const m=r.ticks.source==="data"&&this.getDataTimestamps();for(p=h,f=0;p<s;p=+t.add(p,a,o),f++)Gk(d,p,m);return(p===s||r.bounds==="ticks"||f===1)&&Gk(d,p,m),Object.keys(d).sort(Yk).map(g=>+g)}getLabelForValue(t){const n=this._adapter,s=this.options.time;return s.tooltipFormat?n.format(t,s.tooltipFormat):n.format(t,s.displayFormats.datetime)}format(t,n){const r=this.options.time.displayFormats,i=this._unit,o=n||r[i];return this._adapter.format(t,o)}_tickFormatFunction(t,n,s,r){const i=this.options,o=i.ticks.callback;if(o)return kt(o,[t,n,s],this);const a=i.time.displayFormats,c=this._unit,u=this._majorUnit,d=c&&a[c],h=u&&a[u],p=s[n],f=u&&h&&p&&p.major;return this._adapter.format(t,r||(f?h:d))}generateTickLabels(t){let n,s,r;for(n=0,s=t.length;n<s;++n)r=t[n],r.label=this._tickFormatFunction(r.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,s=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+s)*n.factor)}getValueForPixel(t){const n=this._offsets,s=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+s*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,s=this.ctx.measureText(t).width,r=wo(this.isHorizontal()?n.maxRotation:n.minRotation),i=Math.cos(r),o=Math.sin(r),a=this._resolveTickFontOptions(0).size;return{w:s*i+a*o,h:s*o+a*i}}_getLabelCapacity(t){const n=this.options.time,s=n.displayFormats,r=s[n.unit]||s.millisecond,i=this._tickFormatFunction(t,0,Jk(this,[t],this._majorUnit),r),o=this._getLabelSize(i),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,s;if(t.length)return t;const r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(n=0,s=r.length;n<s;++n)t=t.concat(r[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,s;if(t.length)return t;const r=this.getLabels();for(n=0,s=r.length;n<s;++n)t.push(Xk(this,r[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return $Q(t.sort(Yk))}}Ae(If,"id","time"),Ae(If,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function th(e,t,n){let s=0,r=e.length-1,i,o,a,c;n?(t>=e[s].pos&&t<=e[r].pos&&({lo:s,hi:r}=Uv(e,"pos",t)),{pos:i,time:a}=e[s],{pos:o,time:c}=e[r]):(t>=e[s].time&&t<=e[r].time&&({lo:s,hi:r}=Uv(e,"time",t)),{time:i,pos:a}=e[s],{time:o,pos:c}=e[r]);const u=o-i;return u?a+(c-a)*(t-i)/u:a}class Zk extends If{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=th(n,this.min),this._tableRange=th(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:s}=this,r=[],i=[];let o,a,c,u,d;for(o=0,a=t.length;o<a;++o)u=t[o],u>=n&&u<=s&&r.push(u);if(r.length<2)return[{time:n,pos:0},{time:s,pos:1}];for(o=0,a=r.length;o<a;++o)d=r[o+1],c=r[o-1],u=r[o],Math.round((d+c)/2)!==u&&i.push({time:u,pos:o/(a-1)});return i}_generate(){const t=this.min,n=this.max;let s=super.getDataTimestamps();return(!s.includes(t)||!s.length)&&s.splice(0,0,t),(!s.includes(n)||s.length===1)&&s.push(n),s.sort((r,i)=>r-i)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),s=this.getLabelTimestamps();return n.length&&s.length?t=this.normalize(n.concat(s)):t=n.length?n:s,t=this._cache.all=t,t}getDecimalForValue(t){return(th(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,s=this.getDecimalForPixel(t)/n.factor-n.end;return th(this._table,s*this._tableRange+this._minPos,!0)}}Ae(Zk,"id","timeseries"),Ae(Zk,"defaults",If.defaults);Tr.register(Gv,Jv,Ah,Ri,UZ);function Zv({data:e,color:t="rgba(59,130,246,0.8)",height:n=32,maxValue:s=100}){const r=y.useRef(null),i=y.useRef(null);return y.useEffect(()=>{const o=r.current;if(!o)return;const a={labels:e.map(()=>""),datasets:[{data:e,borderColor:t,borderWidth:1.5,fill:!0,backgroundColor:t.replace(/[\d.]+\)$/,"0.15)"),pointRadius:0,tension:.3}]},c={responsive:!1,animation:!1,plugins:{legend:{display:!1},tooltip:{enabled:!1}},scales:{x:{display:!1},y:{display:!1,min:0,max:s}}};return i.current?(i.current.data=a,i.current.update("none")):i.current=new Tr(o,{type:"line",data:a,options:c}),()=>{var u;(u=i.current)==null||u.destroy(),i.current=null}},[]),y.useEffect(()=>{i.current&&(i.current.data.labels=e.map(()=>""),i.current.data.datasets[0].data=e,i.current.update("none"))},[e]),l.jsx("canvas",{ref:r,width:80,height:n,style:{display:"block"}})}function eC(e){return e>=1024**3?`${(e/1024**3).toFixed(1)}GiB`:e>=1024**2?`${(e/1024**2).toFixed(0)}MiB`:e>=1024?`${(e/1024).toFixed(0)}KiB`:`${e}B`}const ZZ={running:"bg-green-500",stopped:"bg-red-500",unhealthy:"bg-yellow-400",restarting:"bg-orange-400"},eee={running:"running",stopped:"stopped",unhealthy:"unhealthy",restarting:"restarting"},tee={healthy:"bg-green-500",warning:"bg-yellow-400",stuck:"bg-orange-400",dead:"bg-red-500",stopped:"bg-surface-overlay"};function nee({container:e,history:t,onClick:n}){const s=e.cpuPercent>=85?"rgba(239,68,68,0.8)":e.cpuPercent>=60?"rgba(234,179,8,0.8)":"rgba(59,130,246,0.8)";return l.jsxs("button",{onClick:()=>n(e),className:"w-full text-left bg-surface-raised border border-divider rounded-lg p-3 hover:border-blue-500/50 hover:bg-surface-overlay transition-colors",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${ZZ[e.status]}`}),l.jsx("span",{className:"text-xs font-medium text-content truncate flex-1",title:e.name,children:e.name}),l.jsx("span",{className:"text-xs text-content-subtle shrink-0",children:eee[e.status]})]}),l.jsxs("div",{className:"flex gap-2 items-end",children:[l.jsxs("div",{className:"flex-1 space-y-1.5",children:[l.jsx(Pf,{value:e.cpuPercent,label:"CPU"}),l.jsx(Pf,{value:e.memoryPercent,label:"MEM"}),e.memoryLimit>0&&l.jsxs("div",{className:"text-xs text-content-subtle",children:[eC(e.memoryUsage)," / ",eC(e.memoryLimit)]})]}),t&&t.cpuPercent.length>1&&l.jsx("div",{className:"shrink-0",children:l.jsx(Zv,{data:t.cpuPercent,color:s,height:36})})]})]})}function see({agent:e,onNavigate:t}){return l.jsxs("button",{onClick:()=>t(e.id),className:"w-full text-left bg-surface-raised border border-divider rounded-lg p-3 hover:border-blue-500/50 hover:bg-surface-overlay transition-colors",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${tee[e.status]}`}),l.jsx("span",{className:"text-xs font-medium text-content truncate flex-1",title:e.issueId??e.id,children:e.issueId??e.id}),l.jsx("span",{className:"text-xs text-content-subtle shrink-0",children:e.status})]}),l.jsxs("div",{className:"text-xs text-content-subtle space-y-0.5",children:[l.jsxs("div",{className:"flex justify-between",children:[l.jsx("span",{children:"Model"}),l.jsx("span",{className:"text-content",children:e.model})]}),l.jsxs("div",{className:"flex justify-between",children:[l.jsx("span",{children:"Runtime"}),l.jsx("span",{className:"text-content",children:e.runtime})]}),e.consecutiveFailures>0&&l.jsxs("div",{className:"flex justify-between text-orange-400",children:[l.jsx("span",{children:"Failures"}),l.jsx("span",{children:e.consecutiveFailures})]})]}),l.jsx("div",{className:"mt-1.5 text-xs text-blue-400",children:"Click to view in Agents →"})]})}function nh(e){return e>=1024**3?`${(e/1024**3).toFixed(1)}GiB`:e>=1024**2?`${(e/1024**2).toFixed(0)}MiB`:e>=1024?`${(e/1024).toFixed(0)}KiB`:`${e}B`}async function ree(e){const t=await fetch(`/api/resources/${e}/details`);if(!t.ok)throw new Error("Failed to fetch container details");return t.json()}function iee({container:e,history:t,onClose:n}){var a,c;const[s,r]=y.useState("overview"),{data:i}=he({queryKey:["container-details",e.id],queryFn:()=>ree(e.id),refetchInterval:s==="logs"?5e3:3e4});y.useEffect(()=>{const u=d=>{d.key==="Escape"&&n()};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[n]);const o=[{id:"overview",label:"Overview"},{id:"logs",label:"Logs"},{id:"ports-env",label:"Ports & Env"}];return l.jsxs("div",{className:"fixed inset-0 z-50 flex justify-end",children:[l.jsx("div",{className:"absolute inset-0 bg-black/40",onClick:n}),l.jsxs("div",{className:"relative w-full max-w-lg bg-surface-raised border-l border-divider flex flex-col shadow-2xl overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-divider shrink-0",children:[l.jsx("span",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${e.status==="running"?"bg-green-500":e.status==="unhealthy"?"bg-yellow-400":e.status==="restarting"?"bg-orange-400":"bg-red-500"}`}),l.jsx("h2",{className:"font-semibold text-content text-sm flex-1 truncate",title:e.name,children:e.name}),(i==null?void 0:i.image)&&l.jsx("span",{className:"text-xs text-content-subtle truncate max-w-[160px]",title:i.image,children:i.image}),l.jsx("button",{onClick:n,className:"p-1 rounded hover:bg-surface-overlay text-content-subtle hover:text-content",children:l.jsx(yt,{className:"w-4 h-4"})})]}),l.jsx("div",{className:"flex border-b border-divider shrink-0",children:o.map(u=>l.jsx("button",{onClick:()=>r(u.id),className:`px-4 py-2 text-xs transition-colors ${s===u.id?"text-blue-400 border-b-2 border-blue-500 -mb-px":"text-content-subtle hover:text-content"}`,children:u.label},u.id))}),l.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[s==="overview"&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-xs font-semibold text-content-subtle uppercase tracking-wider mb-2",children:"Current Usage"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Pf,{value:e.cpuPercent,label:"CPU"}),l.jsx(Pf,{value:e.memoryPercent,label:"Memory"}),e.memoryLimit>0&&l.jsxs("div",{className:"text-xs text-content-subtle text-right",children:[nh(e.memoryUsage)," / ",nh(e.memoryLimit)]})]})]}),t.cpuPercent.length>1&&l.jsxs("div",{children:[l.jsx("h3",{className:"text-xs font-semibold text-content-subtle uppercase tracking-wider mb-2",children:"5-Min History"}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-content-subtle mb-1",children:"CPU %"}),l.jsx("div",{className:"w-full",children:l.jsx(Zv,{data:t.cpuPercent,color:"rgba(59,130,246,0.8)",height:40})})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-content-subtle mb-1",children:"Memory %"}),l.jsx("div",{className:"w-full",children:l.jsx(Zv,{data:t.memoryPercent,color:"rgba(168,85,247,0.8)",height:40})})]})]})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-xs font-semibold text-content-subtle uppercase tracking-wider mb-2",children:"Network I/O"}),l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsxs("div",{className:"bg-surface p-2 rounded",children:[l.jsx("div",{className:"text-xs text-content-subtle",children:"In"}),l.jsx("div",{className:"text-sm font-medium text-content",children:nh(e.networkIn)})]}),l.jsxs("div",{className:"bg-surface p-2 rounded",children:[l.jsx("div",{className:"text-xs text-content-subtle",children:"Out"}),l.jsx("div",{className:"text-sm font-medium text-content",children:nh(e.networkOut)})]})]})]}),i&&l.jsxs("div",{children:[l.jsx("h3",{className:"text-xs font-semibold text-content-subtle uppercase tracking-wider mb-2",children:"Container Info"}),l.jsxs("dl",{className:"space-y-1 text-xs",children:[i.uptime&&l.jsxs("div",{className:"flex justify-between",children:[l.jsx("dt",{className:"text-content-subtle",children:"Uptime"}),l.jsx("dd",{className:"text-content",children:i.uptime})]}),i.created&&l.jsxs("div",{className:"flex justify-between",children:[l.jsx("dt",{className:"text-content-subtle",children:"Created"}),l.jsx("dd",{className:"text-content",children:new Date(i.created).toLocaleString()})]}),l.jsxs("div",{className:"flex justify-between",children:[l.jsx("dt",{className:"text-content-subtle",children:"Status"}),l.jsx("dd",{className:"text-content",children:i.status})]})]})]})]}),s==="logs"&&l.jsxs("div",{children:[l.jsx("h3",{className:"text-xs font-semibold text-content-subtle uppercase tracking-wider mb-2",children:"Recent Logs (tail 100)"}),i!=null&&i.logs?l.jsx("pre",{className:"text-xs text-content bg-surface p-3 rounded overflow-auto max-h-[600px] font-mono whitespace-pre-wrap break-all",children:i.logs}):l.jsx("div",{className:"text-xs text-content-subtle text-center py-8",children:"Loading logs…"})]}),s==="ports-env"&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-xs font-semibold text-content-subtle uppercase tracking-wider mb-2",children:"Port Mappings"}),(a=i==null?void 0:i.ports)!=null&&a.length?l.jsx("div",{className:"space-y-1",children:i.ports.map((u,d)=>l.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[l.jsx("span",{className:"text-content font-mono",children:u.host}),l.jsx("span",{className:"text-content-subtle",children:"→"}),l.jsxs("span",{className:"text-content font-mono",children:[u.container,"/",u.protocol]})]},d))}):l.jsx("div",{className:"text-xs text-content-subtle",children:"No port mappings"})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-xs font-semibold text-content-subtle uppercase tracking-wider mb-2",children:"Environment Variables"}),(c=i==null?void 0:i.env)!=null&&c.length?l.jsx("div",{className:"space-y-0.5 max-h-80 overflow-auto",children:i.env.map((u,d)=>{const[h,...p]=u.split("="),f=p.join("="),m=/token|secret|key|pass|pwd|auth/i.test(h??"");return l.jsxs("div",{className:"text-xs font-mono flex gap-1 flex-wrap",children:[l.jsx("span",{className:"text-blue-400",children:h}),l.jsx("span",{className:"text-content-subtle",children:"="}),l.jsx("span",{className:"text-content break-all",children:m?"***":f})]},d)})}):l.jsx("div",{className:"text-xs text-content-subtle",children:"No environment variables"})]})]})]})]})]})}async function oee(){const e=await fetch("/api/resources");if(!e.ok)throw new Error("Failed to fetch resources");return e.json()}async function aee(e){const t=await fetch(`/api/resources/${e}/history`);if(!t.ok)throw new Error("Failed to fetch history");return t.json()}function lee(e,t,n){if(n==="issue"){const r=new Map;for(const i of e){const o=i.name.match(/(?:feature[_-])?([A-Z]+-\d+)/i),a=o?o[1].toUpperCase():"__ungrouped__",c=o?o[1].toUpperCase():"Ungrouped";r.has(a)||r.set(a,{key:a,label:c,containers:[],agents:[]}),r.get(a).containers.push(i)}for(const i of t){const o=i.issueId??"__ungrouped__",a=i.issueId??"Ungrouped";r.has(o)||r.set(o,{key:o,label:a,containers:[],agents:[]}),r.get(o).agents.push(i)}return Array.from(r.values()).sort((i,o)=>i.label.localeCompare(o.label))}if(n==="type")return[{key:"containers",label:"Containers",containers:e,agents:[]},{key:"agents",label:"Agents",containers:[],agents:t}].filter(o=>o.containers.length+o.agents.length>0);const s=new Map;for(const r of e)s.has(r.status)||s.set(r.status,{key:r.status,label:r.status.charAt(0).toUpperCase()+r.status.slice(1),containers:[],agents:[]}),s.get(r.status).containers.push(r);for(const r of t)s.has(r.status)||s.set(r.status,{key:r.status,label:r.status.charAt(0).toUpperCase()+r.status.slice(1),containers:[],agents:[]}),s.get(r.status).agents.push(r);return Array.from(s.values())}function cee({onNavigateToAgents:e}){const[t,n]=y.useState("issue"),[s,r]=y.useState("all"),[i,o]=y.useState(null);GX();const{data:a,isLoading:c,error:u}=he({queryKey:["resources"],queryFn:oee,refetchInterval:5e3}),{data:d}=he({queryKey:["container-history",i==null?void 0:i.id],queryFn:()=>aee(i.id),enabled:!!i,refetchInterval:5e3});if(c)return l.jsx("div",{className:"p-6 text-content-subtle text-sm",children:"Loading resources…"});if(u)return l.jsxs("div",{className:"p-6 text-red-400 text-sm",children:["Failed to load resources: ",u.message]});const h=(a==null?void 0:a.containers)??[],p=(a==null?void 0:a.agents)??[],f=s==="running"?h.filter(v=>v.status==="running"):h,m=lee(f,p,t),g=f.length+p.length;return l.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-3 px-6 py-3 border-b border-divider shrink-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-content",children:"Resources"}),l.jsxs("span",{className:"text-xs text-content-subtle",children:[g," items"]}),l.jsxs("div",{className:"flex items-center gap-1 ml-4",children:[l.jsx("span",{className:"text-xs text-content-subtle mr-1",children:"Group by:"}),["issue","type","status"].map(v=>l.jsx("button",{onClick:()=>n(v),className:`px-2 py-0.5 rounded text-xs transition-colors ${t===v?"bg-blue-600 text-white":"text-content-subtle hover:text-content hover:bg-surface-overlay"}`,children:v.charAt(0).toUpperCase()+v.slice(1)},v))]}),l.jsx("div",{className:"flex items-center gap-1",children:["all","running"].map(v=>l.jsx("button",{onClick:()=>r(v),className:`px-2 py-0.5 rounded text-xs transition-colors ${s===v?"bg-surface-overlay text-content":"text-content-subtle hover:text-content hover:bg-surface-overlay"}`,children:v==="all"?"All":"Running only"},v))}),(a==null?void 0:a.updatedAt)&&l.jsxs("span",{className:"ml-auto text-xs text-content-subtle",children:["Updated ",new Date(a.updatedAt).toLocaleTimeString()]})]}),l.jsx("div",{className:"flex-1 overflow-auto p-6",children:g===0?l.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-content-subtle",children:[l.jsx("div",{className:"text-4xl mb-3",children:"📦"}),l.jsx("div",{className:"text-sm",children:"No containers or agents found"}),l.jsx("div",{className:"text-xs mt-1",children:"Docker may not be running or no workspaces are active"})]}):l.jsx("div",{className:"space-y-6",children:m.map(v=>l.jsxs("div",{children:[l.jsxs("h3",{className:"text-xs font-semibold text-content-subtle uppercase tracking-wider mb-3",children:[v.label,l.jsxs("span",{className:"ml-2 font-normal text-content-subtle/60",children:["(",v.containers.length+v.agents.length,")"]})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:[v.containers.map(x=>l.jsx(nee,{container:x,history:(a!=null&&a.containers,void 0),onClick:o},x.id)),v.agents.map(x=>l.jsx(see,{agent:x,onNavigate:e},x.id))]})]},v.key))})}),i&&l.jsx(iee,{container:i,history:d??{timestamps:[],cpuPercent:[],memoryPercent:[]},onClose:()=>o(null)})]})}const uee={},tC=e=>{let t;const n=new Set,s=(d,h)=>{const p=typeof d=="function"?d(t):d;if(!Object.is(p,t)){const f=t;t=h??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(m=>m(t,f))}},r=()=>t,c={setState:s,getState:r,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(uee?"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(s,r,c);return c},dee=e=>e?tC(e):tC;var b4={exports:{}},w4={},S4={exports:{}},k4={};/**
|
|
728
|
+
* @license React
|
|
729
|
+
* use-sync-external-store-shim.production.js
|
|
730
|
+
*
|
|
731
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
732
|
+
*
|
|
733
|
+
* This source code is licensed under the MIT license found in the
|
|
734
|
+
* LICENSE file in the root directory of this source tree.
|
|
735
|
+
*/var pl=y;function hee(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var fee=typeof Object.is=="function"?Object.is:hee,pee=pl.useState,mee=pl.useEffect,gee=pl.useLayoutEffect,xee=pl.useDebugValue;function vee(e,t){var n=t(),s=pee({inst:{value:n,getSnapshot:t}}),r=s[0].inst,i=s[1];return gee(function(){r.value=n,r.getSnapshot=t,gg(r)&&i({inst:r})},[e,n,t]),mee(function(){return gg(r)&&i({inst:r}),e(function(){gg(r)&&i({inst:r})})},[e]),xee(n),n}function gg(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!fee(e,n)}catch{return!0}}function yee(e,t){return t()}var _ee=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?yee:vee;k4.useSyncExternalStore=pl.useSyncExternalStore!==void 0?pl.useSyncExternalStore:_ee;S4.exports=k4;var bee=S4.exports;/**
|
|
736
|
+
* @license React
|
|
737
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
738
|
+
*
|
|
739
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
740
|
+
*
|
|
741
|
+
* This source code is licensed under the MIT license found in the
|
|
742
|
+
* LICENSE file in the root directory of this source tree.
|
|
743
|
+
*/var Rp=y,wee=bee;function See(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var kee=typeof Object.is=="function"?Object.is:See,Cee=wee.useSyncExternalStore,Nee=Rp.useRef,jee=Rp.useEffect,Eee=Rp.useMemo,Pee=Rp.useDebugValue;w4.useSyncExternalStoreWithSelector=function(e,t,n,s,r){var i=Nee(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=Eee(function(){function c(f){if(!u){if(u=!0,d=f,f=s(f),r!==void 0&&o.hasValue){var m=o.value;if(r(m,f))return h=m}return h=f}if(m=h,kee(d,f))return m;var g=s(f);return r!==void 0&&r(m,g)?(d=f,m):(d=f,h=g)}var u=!1,d,h,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,s,r]);var a=Cee(e,i[0],i[1]);return jee(function(){o.hasValue=!0,o.value=a},[a]),Pee(a),a};b4.exports=w4;var Tee=b4.exports;const Ree=ml(Tee),C4={},{useDebugValue:Dee}=J,{useSyncExternalStoreWithSelector:Mee}=Ree;let nC=!1;const Lee=e=>e;function Aee(e,t=Lee,n){(C4?"production":void 0)!=="production"&&n&&!nC&&(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"),nC=!0);const s=Mee(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Dee(s),s}const sC=e=>{(C4?"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"?dee(e):e,n=(s,r)=>Aee(t,s,r);return Object.assign(n,t),n},Oee=e=>e?sC(e):sC,Iee=Oee((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"),s=n==="light"||n==="dark"?n:null,r=s||"dark";s||localStorage.setItem("panopticon.ui.theme",r),r==="light"?document.documentElement.classList.add("light"):document.documentElement.classList.remove("light"),e({theme:r})}}));function Fee(){const e=Lt(),t=y.useRef(null);y.useEffect(()=>{const n=Ic({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 s=i=>{e.setQueriesData({queryKey:["issues"]},i)};n.on("issues:snapshot",s),n.on("issues:updated",s),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 r=()=>{document.visibilityState==="visible"&&n.connected&&n.emit("issues:request-snapshot")};return document.addEventListener("visibilitychange",r),()=>{document.removeEventListener("visibilitychange",r),n.disconnect(),t.current=null}},[e])}const N4={"mission-control":"/",kanban:"/kanban",agents:"/agents",resources:"/resources",convoys:"/convoys",handoffs:"/handoffs",activity:"/activity",metrics:"/metrics",costs:"/costs",skills:"/skills",health:"/health",settings:"/settings"},Bee=Object.fromEntries(Object.entries(N4).map(([e,t])=>[t,e]));function rC(){const e=window.location.pathname;return Bee[e]||"mission-control"}const zee=400,$ee=1200,Hee=700;async function Wee(){const e=await fetch("/api/agents");if(!e.ok)throw new Error("Failed to fetch agents");return e.json()}async function Uee(){const e=await fetch("/api/issues");if(!e.ok)throw new Error("Failed to fetch issues");return e.json()}async function qee(){const e=await fetch("/api/tracker-status");if(!e.ok)throw new Error("Failed to fetch tracker status");return e.json()}async function Kee(){const e=await fetch("/api/confirmations");if(!e.ok)throw new Error("Failed to fetch confirmations");return e.json()}async function iC(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 Vee(){const[e,t]=y.useState(rC),[n,s]=y.useState(null),[r,i]=y.useState(null),[o,a]=y.useState(Hee),[c,u]=y.useState(!1),[d,h]=y.useState(!1),[p,f]=y.useState(null),[m,g]=y.useState(!1),[v,x]=y.useState(!1),_=y.useRef(null),{theme:b,toggleTheme:S,initTheme:C}=Iee();Fee();const{data:w}=he({queryKey:["tracker-status"],queryFn:qee,refetchInterval:6e4,retry:!1}),j=(w==null?void 0:w.configured.filter(z=>!z.hasKey))||[];y.useEffect(()=>{C()},[C]);const T=y.useCallback(z=>{t(z);const U=N4[z];window.location.pathname!==U&&window.history.pushState({tab:z},"",U)},[]);y.useEffect(()=>{const z=()=>{t(rC())};return window.addEventListener("popstate",z),()=>window.removeEventListener("popstate",z)},[]);const{data:F=[]}=he({queryKey:["agents"],queryFn:Wee,refetchInterval:5e3}),{data:R=[]}=he({queryKey:["issues"],queryFn:Uee}),{data:B=[]}=he({queryKey:["confirmations"],queryFn:Kee,refetchInterval:2e3});y.useEffect(()=>{B.length>0&&!p&&f(B[0])},[B,p]);const A=y.useRef(new Set);y.useEffect(()=>{const z=F.filter(U=>U.agentPhase==="planning"&&U.hasPendingQuestion&&U.status!=="stopped");for(const U of z){const K=`${U.id}-input`;A.current.has(K)||(A.current.add(K),uc.info(`Planning agent needs input for ${U.issueId||U.id}`,{description:"The planning agent has a question for you. Open the Plan dialog to respond.",duration:1e4}))}for(const U of A.current){const K=U.replace("-input",""),Q=F.find(Y=>Y.id===K);(!Q||!Q.hasPendingQuestion||Q.status==="stopped")&&A.current.delete(U)}},[F]);const D=r?F.find(z=>{var U;return((U=z.issueId)==null?void 0:U.toLowerCase())===r.toLowerCase()}):null,P=r?R.find(z=>z.identifier.toLowerCase()===r.toLowerCase()):null,E=y.useCallback(z=>{z.preventDefault(),u(!0)},[]),$=y.useCallback(z=>{if(!c||!_.current)return;const K=_.current.getBoundingClientRect().right-z.clientX;a(Math.min($ee,Math.max(zee,K)))},[c]),W=y.useCallback(()=>{u(!1)},[]);y.useEffect(()=>(c&&(document.addEventListener("mousemove",$),document.addEventListener("mouseup",W),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",$),document.removeEventListener("mouseup",W),document.body.style.cursor="",document.body.style.userSelect=""}),[c,$,W]);const O=y.useCallback(()=>{h(z=>!z)},[]),H=y.useCallback(async()=>{if(p)try{await iC(p.id,!0),f(null)}catch(z){console.error("Failed to confirm:",z)}},[p]),k=y.useCallback(async()=>{if(p)try{await iC(p.id,!1),f(null)}catch(z){console.error("Failed to deny:",z)}},[p]),I=y.useCallback(()=>{f(null)},[]);y.useEffect(()=>{const z=U=>{U.key==="/"&&!["INPUT","TEXTAREA"].includes(U.target.tagName)&&(U.preventDefault(),g(!0))};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[]);const M=y.useCallback(z=>{i(z),T("kanban")},[]),N=d?"calc(100% - 300px)":`${o}px`;return l.jsxs("div",{className:"h-screen bg-surface flex flex-col overflow-hidden transition-colors duration-150",children:[l.jsx("header",{className:"bg-surface-raised border-b border-divider px-4 py-2 shrink-0",children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.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:[l.jsx(Lo,{className:"w-5 h-5 text-blue-400"}),l.jsx("h1",{className:"text-lg font-bold text-content whitespace-nowrap",children:"Panopticon"})]}),l.jsx(_H,{}),l.jsx("nav",{className:"flex gap-0.5 overflow-x-auto min-w-0 scrollbar-hide",children:[{id:"mission-control",label:"Mission Control",icon:QN},{id:"kanban",label:"Board",icon:GD},{id:"agents",label:"Agents",icon:au},{id:"resources",label:"Resources",icon:aM},{id:"convoys",label:"Convoys",icon:au},{id:"handoffs",label:"Handoffs",icon:t0},{id:"activity",label:"Activity",icon:Vo},{id:"metrics",label:"Metrics",icon:HD},{id:"costs",label:"Costs",icon:na},{id:"skills",label:"Skills",icon:VN},{id:"health",label:"Health",icon:al},{id:"settings",label:"Settings",icon:sj}].map(({id:z,label:U,icon:K})=>l.jsxs("button",{onClick:()=>T(z),className:`flex items-center gap-1 px-2.5 py-1.5 rounded-md text-xs whitespace-nowrap transition-colors ${e===z?"bg-blue-600 text-white":"text-content-subtle hover:text-content hover:bg-surface-overlay"}`,children:[l.jsx(K,{className:"w-3.5 h-3.5"}),U]},z))}),l.jsx("button",{onClick:S,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 ${b==="dark"?"light":"dark"} mode`,children:b==="dark"?l.jsx(cM,{className:"w-3.5 h-3.5"}):l.jsx(tM,{className:"w-3.5 h-3.5"})})]})}),j.length>0&&!v&&l.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:[l.jsx(kn,{className:"w-4 h-4 text-amber-400 shrink-0"}),l.jsxs("p",{className:"text-amber-400 text-sm flex-1",children:[l.jsxs("span",{className:"font-semibold",children:["Missing API key",j.length>1?"s":"",":"]})," ",j.map(z=>l.jsxs("span",{children:[z.name," (",l.jsx("code",{className:"font-mono text-xs bg-amber-500/20 px-1 rounded",children:z.envVar}),")"]},z.type)).reduce((z,U,K)=>K===0?[U]:[...z,", ",U],[]),"."," ",l.jsx("button",{onClick:()=>T("settings"),className:"underline hover:text-amber-300 font-semibold",children:"Configure in Settings"})]}),l.jsx("button",{onClick:()=>x(!0),className:"text-amber-400/60 hover:text-amber-400 shrink-0",title:"Dismiss",children:l.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]}),l.jsxs("main",{ref:_,className:"flex-1 flex overflow-hidden",children:[e==="mission-control"&&l.jsx("div",{className:"w-full h-full",children:l.jsx(JY,{issues:R})}),e==="kanban"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`flex-1 overflow-auto p-6 ${r?"":"w-full"}`,children:[l.jsx(LH,{}),l.jsx(tB,{selectedIssue:r,onSelectIssue:i})]}),r&&P&&l.jsxs(l.Fragment,{children:[l.jsx("div",{onMouseDown:E,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":""}`}),l.jsxs("div",{style:{width:N},className:"relative shrink-0 h-full flex flex-col",children:[l.jsx("button",{onClick:O,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:d?"Collapse panel":"Expand panel",children:d?l.jsx(eM,{className:"w-4 h-4"}):l.jsx(JD,{className:"w-4 h-4"})}),l.jsx(eH,{agent:D??void 0,issueId:r,issueUrl:P.url,issue:P,onClose:()=>i(null)})]})]})]}),e==="agents"&&l.jsx("div",{className:"p-6 w-full",children:l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[l.jsx(a6,{selectedAgent:n,onSelectAgent:s}),n&&l.jsx(u6,{agentId:n})]})}),e==="resources"&&l.jsx("div",{className:"w-full h-full overflow-hidden",children:l.jsx(cee,{onNavigateToAgents:z=>{s(z),T("agents")}})}),e==="skills"&&l.jsx("div",{className:"p-6 w-full overflow-auto",children:l.jsx(p6,{})}),e==="health"&&l.jsx("div",{className:"p-6 w-full overflow-auto",children:l.jsx(f6,{})}),e==="activity"&&l.jsx("div",{className:"w-full h-full",children:l.jsx(rH,{onClose:()=>T("kanban")})}),e==="convoys"&&l.jsx("div",{className:"w-full h-full",children:l.jsx(fH,{onClose:()=>T("kanban")})}),e==="metrics"&&l.jsx("div",{className:"w-full overflow-auto",children:l.jsx(IH,{})}),e==="costs"&&l.jsx("div",{className:"w-full overflow-auto",children:l.jsx(BH,{})}),e==="handoffs"&&l.jsx("div",{className:"w-full overflow-auto",children:l.jsx(PH,{})}),e==="settings"&&l.jsx("div",{className:"p-6 w-full overflow-auto",children:l.jsx(XH,{})})]}),l.jsx(TH,{request:p,isOpen:!!p,onConfirm:H,onDeny:k,onClose:I}),l.jsx(kU,{isOpen:m,onClose:()=>g(!1),onSelectIssue:M,cycleFilter:"current",includeCompletedFilter:!1}),l.jsx(zM,{})]})}function oC(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 Yee=new CD({defaultOptions:{queries:{refetchInterval:6e4,staleTime:3e4,refetchIntervalInBackground:!1,retry:(e,t)=>oC(t)&&e<3},mutations:{retry:(e,t)=>oC(t)&&e<3,retryDelay:e=>Math.min(1e3*2**e,8e3)}}});xg.createRoot(document.getElementById("root")).render(l.jsx(J.StrictMode,{children:l.jsx(ND,{client:Yee,children:l.jsx(fM,{children:l.jsx(Vee,{})})})}));
|