repoburg 1.3.307 → 1.3.309

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.
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalView-DPvOhRXU.js","assets/TerminalView-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
2
- var z0=Object.defineProperty;var F0=(e,n,r)=>n in e?z0(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var at=(e,n,r)=>F0(e,typeof n!="symbol"?n+"":n,r);(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))o(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&o(d)}).observe(document,{childList:!0,subtree:!0});function r(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function o(l){if(l.ep)return;l.ep=!0;const c=r(l);fetch(l.href,c)}})();function tv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pu={exports:{}},mi={},zu={exports:{}},He={};/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalView-CldV8OPX.js","assets/TerminalView-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
2
+ var z0=Object.defineProperty;var F0=(e,n,r)=>n in e?z0(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var at=(e,n,r)=>F0(e,typeof n!="symbol"?n+"":n,r);(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))o(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&o(d)}).observe(document,{childList:!0,subtree:!0});function r(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function o(l){if(l.ep)return;l.ep=!0;const c=r(l);fetch(l.href,c)}})();function tv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var zu={exports:{}},mi={},Fu={exports:{}},He={};/**
3
3
  * @license React
4
4
  * react.production.min.js
5
5
  *
@@ -7,7 +7,7 @@ var z0=Object.defineProperty;var F0=(e,n,r)=>n in e?z0(e,n,{enumerable:!0,config
7
7
  *
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
- */var Kh;function U0(){if(Kh)return He;Kh=1;var e=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),k=Symbol.iterator;function x(I){return I===null||typeof I!="object"?null:(I=k&&I[k]||I["@@iterator"],typeof I=="function"?I:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,T={};function E(I,$,ue){this.props=I,this.context=$,this.refs=T,this.updater=ue||S}E.prototype.isReactComponent={},E.prototype.setState=function(I,$){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,$,"setState")},E.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function b(){}b.prototype=E.prototype;function j(I,$,ue){this.props=I,this.context=$,this.refs=T,this.updater=ue||S}var P=j.prototype=new b;P.constructor=j,C(P,E.prototype),P.isPureReactComponent=!0;var M=Array.isArray,L=Object.prototype.hasOwnProperty,G={current:null},z={key:!0,ref:!0,__self:!0,__source:!0};function U(I,$,ue){var B,X={},ce=null,be=null;if($!=null)for(B in $.ref!==void 0&&(be=$.ref),$.key!==void 0&&(ce=""+$.key),$)L.call($,B)&&!z.hasOwnProperty(B)&&(X[B]=$[B]);var _e=arguments.length-2;if(_e===1)X.children=ue;else if(1<_e){for(var Ae=Array(_e),je=0;je<_e;je++)Ae[je]=arguments[je+2];X.children=Ae}if(I&&I.defaultProps)for(B in _e=I.defaultProps,_e)X[B]===void 0&&(X[B]=_e[B]);return{$$typeof:e,type:I,key:ce,ref:be,props:X,_owner:G.current}}function Q(I,$){return{$$typeof:e,type:I.type,key:$,ref:I.ref,props:I.props,_owner:I._owner}}function J(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function oe(I){var $={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(ue){return $[ue]})}var me=/\/+/g;function Se(I,$){return typeof I=="object"&&I!==null&&I.key!=null?oe(""+I.key):$.toString(36)}function Me(I,$,ue,B,X){var ce=typeof I;(ce==="undefined"||ce==="boolean")&&(I=null);var be=!1;if(I===null)be=!0;else switch(ce){case"string":case"number":be=!0;break;case"object":switch(I.$$typeof){case e:case n:be=!0}}if(be)return be=I,X=X(be),I=B===""?"."+Se(be,0):B,M(X)?(ue="",I!=null&&(ue=I.replace(me,"$&/")+"/"),Me(X,$,ue,"",function(je){return je})):X!=null&&(J(X)&&(X=Q(X,ue+(!X.key||be&&be.key===X.key?"":(""+X.key).replace(me,"$&/")+"/")+I)),$.push(X)),1;if(be=0,B=B===""?".":B+":",M(I))for(var _e=0;_e<I.length;_e++){ce=I[_e];var Ae=B+Se(ce,_e);be+=Me(ce,$,ue,Ae,X)}else if(Ae=x(I),typeof Ae=="function")for(I=Ae.call(I),_e=0;!(ce=I.next()).done;)ce=ce.value,Ae=B+Se(ce,_e++),be+=Me(ce,$,ue,Ae,X);else if(ce==="object")throw $=String(I),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.");return be}function ee(I,$,ue){if(I==null)return I;var B=[],X=0;return Me(I,B,"","",function(ce){return $.call(ue,ce,X++)}),B}function ie(I){if(I._status===-1){var $=I._result;$=$(),$.then(function(ue){(I._status===0||I._status===-1)&&(I._status=1,I._result=ue)},function(ue){(I._status===0||I._status===-1)&&(I._status=2,I._result=ue)}),I._status===-1&&(I._status=0,I._result=$)}if(I._status===1)return I._result.default;throw I._result}var te={current:null},F={transition:null},Z={ReactCurrentDispatcher:te,ReactCurrentBatchConfig:F,ReactCurrentOwner:G};function q(){throw Error("act(...) is not supported in production builds of React.")}return He.Children={map:ee,forEach:function(I,$,ue){ee(I,function(){$.apply(this,arguments)},ue)},count:function(I){var $=0;return ee(I,function(){$++}),$},toArray:function(I){return ee(I,function($){return $})||[]},only:function(I){if(!J(I))throw Error("React.Children.only expected to receive a single React element child.");return I}},He.Component=E,He.Fragment=r,He.Profiler=l,He.PureComponent=j,He.StrictMode=o,He.Suspense=h,He.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Z,He.act=q,He.cloneElement=function(I,$,ue){if(I==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+I+".");var B=C({},I.props),X=I.key,ce=I.ref,be=I._owner;if($!=null){if($.ref!==void 0&&(ce=$.ref,be=G.current),$.key!==void 0&&(X=""+$.key),I.type&&I.type.defaultProps)var _e=I.type.defaultProps;for(Ae in $)L.call($,Ae)&&!z.hasOwnProperty(Ae)&&(B[Ae]=$[Ae]===void 0&&_e!==void 0?_e[Ae]:$[Ae])}var Ae=arguments.length-2;if(Ae===1)B.children=ue;else if(1<Ae){_e=Array(Ae);for(var je=0;je<Ae;je++)_e[je]=arguments[je+2];B.children=_e}return{$$typeof:e,type:I.type,key:X,ref:ce,props:B,_owner:be}},He.createContext=function(I){return I={$$typeof:d,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},I.Provider={$$typeof:c,_context:I},I.Consumer=I},He.createElement=U,He.createFactory=function(I){var $=U.bind(null,I);return $.type=I,$},He.createRef=function(){return{current:null}},He.forwardRef=function(I){return{$$typeof:f,render:I}},He.isValidElement=J,He.lazy=function(I){return{$$typeof:v,_payload:{_status:-1,_result:I},_init:ie}},He.memo=function(I,$){return{$$typeof:m,type:I,compare:$===void 0?null:$}},He.startTransition=function(I){var $=F.transition;F.transition={};try{I()}finally{F.transition=$}},He.unstable_act=q,He.useCallback=function(I,$){return te.current.useCallback(I,$)},He.useContext=function(I){return te.current.useContext(I)},He.useDebugValue=function(){},He.useDeferredValue=function(I){return te.current.useDeferredValue(I)},He.useEffect=function(I,$){return te.current.useEffect(I,$)},He.useId=function(){return te.current.useId()},He.useImperativeHandle=function(I,$,ue){return te.current.useImperativeHandle(I,$,ue)},He.useInsertionEffect=function(I,$){return te.current.useInsertionEffect(I,$)},He.useLayoutEffect=function(I,$){return te.current.useLayoutEffect(I,$)},He.useMemo=function(I,$){return te.current.useMemo(I,$)},He.useReducer=function(I,$,ue){return te.current.useReducer(I,$,ue)},He.useRef=function(I){return te.current.useRef(I)},He.useState=function(I){return te.current.useState(I)},He.useSyncExternalStore=function(I,$,ue){return te.current.useSyncExternalStore(I,$,ue)},He.useTransition=function(){return te.current.useTransition()},He.version="18.3.1",He}var Gh;function Hd(){return Gh||(Gh=1,zu.exports=U0()),zu.exports}/**
10
+ */var Kh;function U0(){if(Kh)return He;Kh=1;var e=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),k=Symbol.iterator;function x(I){return I===null||typeof I!="object"?null:(I=k&&I[k]||I["@@iterator"],typeof I=="function"?I:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,T={};function E(I,$,ue){this.props=I,this.context=$,this.refs=T,this.updater=ue||S}E.prototype.isReactComponent={},E.prototype.setState=function(I,$){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,$,"setState")},E.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function b(){}b.prototype=E.prototype;function j(I,$,ue){this.props=I,this.context=$,this.refs=T,this.updater=ue||S}var P=j.prototype=new b;P.constructor=j,C(P,E.prototype),P.isPureReactComponent=!0;var M=Array.isArray,L=Object.prototype.hasOwnProperty,G={current:null},z={key:!0,ref:!0,__self:!0,__source:!0};function U(I,$,ue){var B,X={},ce=null,be=null;if($!=null)for(B in $.ref!==void 0&&(be=$.ref),$.key!==void 0&&(ce=""+$.key),$)L.call($,B)&&!z.hasOwnProperty(B)&&(X[B]=$[B]);var _e=arguments.length-2;if(_e===1)X.children=ue;else if(1<_e){for(var Ae=Array(_e),je=0;je<_e;je++)Ae[je]=arguments[je+2];X.children=Ae}if(I&&I.defaultProps)for(B in _e=I.defaultProps,_e)X[B]===void 0&&(X[B]=_e[B]);return{$$typeof:e,type:I,key:ce,ref:be,props:X,_owner:G.current}}function Q(I,$){return{$$typeof:e,type:I.type,key:$,ref:I.ref,props:I.props,_owner:I._owner}}function J(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function oe(I){var $={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(ue){return $[ue]})}var me=/\/+/g;function Se(I,$){return typeof I=="object"&&I!==null&&I.key!=null?oe(""+I.key):$.toString(36)}function Me(I,$,ue,B,X){var ce=typeof I;(ce==="undefined"||ce==="boolean")&&(I=null);var be=!1;if(I===null)be=!0;else switch(ce){case"string":case"number":be=!0;break;case"object":switch(I.$$typeof){case e:case n:be=!0}}if(be)return be=I,X=X(be),I=B===""?"."+Se(be,0):B,M(X)?(ue="",I!=null&&(ue=I.replace(me,"$&/")+"/"),Me(X,$,ue,"",function(je){return je})):X!=null&&(J(X)&&(X=Q(X,ue+(!X.key||be&&be.key===X.key?"":(""+X.key).replace(me,"$&/")+"/")+I)),$.push(X)),1;if(be=0,B=B===""?".":B+":",M(I))for(var _e=0;_e<I.length;_e++){ce=I[_e];var Ae=B+Se(ce,_e);be+=Me(ce,$,ue,Ae,X)}else if(Ae=x(I),typeof Ae=="function")for(I=Ae.call(I),_e=0;!(ce=I.next()).done;)ce=ce.value,Ae=B+Se(ce,_e++),be+=Me(ce,$,ue,Ae,X);else if(ce==="object")throw $=String(I),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.");return be}function ee(I,$,ue){if(I==null)return I;var B=[],X=0;return Me(I,B,"","",function(ce){return $.call(ue,ce,X++)}),B}function ie(I){if(I._status===-1){var $=I._result;$=$(),$.then(function(ue){(I._status===0||I._status===-1)&&(I._status=1,I._result=ue)},function(ue){(I._status===0||I._status===-1)&&(I._status=2,I._result=ue)}),I._status===-1&&(I._status=0,I._result=$)}if(I._status===1)return I._result.default;throw I._result}var te={current:null},F={transition:null},Z={ReactCurrentDispatcher:te,ReactCurrentBatchConfig:F,ReactCurrentOwner:G};function q(){throw Error("act(...) is not supported in production builds of React.")}return He.Children={map:ee,forEach:function(I,$,ue){ee(I,function(){$.apply(this,arguments)},ue)},count:function(I){var $=0;return ee(I,function(){$++}),$},toArray:function(I){return ee(I,function($){return $})||[]},only:function(I){if(!J(I))throw Error("React.Children.only expected to receive a single React element child.");return I}},He.Component=E,He.Fragment=r,He.Profiler=l,He.PureComponent=j,He.StrictMode=o,He.Suspense=h,He.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Z,He.act=q,He.cloneElement=function(I,$,ue){if(I==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+I+".");var B=C({},I.props),X=I.key,ce=I.ref,be=I._owner;if($!=null){if($.ref!==void 0&&(ce=$.ref,be=G.current),$.key!==void 0&&(X=""+$.key),I.type&&I.type.defaultProps)var _e=I.type.defaultProps;for(Ae in $)L.call($,Ae)&&!z.hasOwnProperty(Ae)&&(B[Ae]=$[Ae]===void 0&&_e!==void 0?_e[Ae]:$[Ae])}var Ae=arguments.length-2;if(Ae===1)B.children=ue;else if(1<Ae){_e=Array(Ae);for(var je=0;je<Ae;je++)_e[je]=arguments[je+2];B.children=_e}return{$$typeof:e,type:I.type,key:X,ref:ce,props:B,_owner:be}},He.createContext=function(I){return I={$$typeof:d,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},I.Provider={$$typeof:c,_context:I},I.Consumer=I},He.createElement=U,He.createFactory=function(I){var $=U.bind(null,I);return $.type=I,$},He.createRef=function(){return{current:null}},He.forwardRef=function(I){return{$$typeof:f,render:I}},He.isValidElement=J,He.lazy=function(I){return{$$typeof:v,_payload:{_status:-1,_result:I},_init:ie}},He.memo=function(I,$){return{$$typeof:m,type:I,compare:$===void 0?null:$}},He.startTransition=function(I){var $=F.transition;F.transition={};try{I()}finally{F.transition=$}},He.unstable_act=q,He.useCallback=function(I,$){return te.current.useCallback(I,$)},He.useContext=function(I){return te.current.useContext(I)},He.useDebugValue=function(){},He.useDeferredValue=function(I){return te.current.useDeferredValue(I)},He.useEffect=function(I,$){return te.current.useEffect(I,$)},He.useId=function(){return te.current.useId()},He.useImperativeHandle=function(I,$,ue){return te.current.useImperativeHandle(I,$,ue)},He.useInsertionEffect=function(I,$){return te.current.useInsertionEffect(I,$)},He.useLayoutEffect=function(I,$){return te.current.useLayoutEffect(I,$)},He.useMemo=function(I,$){return te.current.useMemo(I,$)},He.useReducer=function(I,$,ue){return te.current.useReducer(I,$,ue)},He.useRef=function(I){return te.current.useRef(I)},He.useState=function(I){return te.current.useState(I)},He.useSyncExternalStore=function(I,$,ue){return te.current.useSyncExternalStore(I,$,ue)},He.useTransition=function(){return te.current.useTransition()},He.version="18.3.1",He}var Gh;function Vd(){return Gh||(Gh=1,Fu.exports=U0()),Fu.exports}/**
11
11
  * @license React
12
12
  * react-jsx-runtime.production.min.js
13
13
  *
@@ -15,7 +15,7 @@ var z0=Object.defineProperty;var F0=(e,n,r)=>n in e?z0(e,n,{enumerable:!0,config
15
15
  *
16
16
  * This source code is licensed under the MIT license found in the
17
17
  * LICENSE file in the root directory of this source tree.
18
- */var qh;function B0(){if(qh)return mi;qh=1;var e=Hd(),n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,l=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function d(f,h,m){var v,k={},x=null,S=null;m!==void 0&&(x=""+m),h.key!==void 0&&(x=""+h.key),h.ref!==void 0&&(S=h.ref);for(v in h)o.call(h,v)&&!c.hasOwnProperty(v)&&(k[v]=h[v]);if(f&&f.defaultProps)for(v in h=f.defaultProps,h)k[v]===void 0&&(k[v]=h[v]);return{$$typeof:n,type:f,key:x,ref:S,props:k,_owner:l.current}}return mi.Fragment=r,mi.jsx=d,mi.jsxs=d,mi}var Xh;function W0(){return Xh||(Xh=1,Pu.exports=B0()),Pu.exports}var a=W0(),y=Hd();const ct=tv(y);var Ja={},Fu={exports:{}},In={},Uu={exports:{}},Bu={};/**
18
+ */var qh;function B0(){if(qh)return mi;qh=1;var e=Vd(),n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,l=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function d(f,h,m){var v,k={},x=null,S=null;m!==void 0&&(x=""+m),h.key!==void 0&&(x=""+h.key),h.ref!==void 0&&(S=h.ref);for(v in h)o.call(h,v)&&!c.hasOwnProperty(v)&&(k[v]=h[v]);if(f&&f.defaultProps)for(v in h=f.defaultProps,h)k[v]===void 0&&(k[v]=h[v]);return{$$typeof:n,type:f,key:x,ref:S,props:k,_owner:l.current}}return mi.Fragment=r,mi.jsx=d,mi.jsxs=d,mi}var Xh;function W0(){return Xh||(Xh=1,zu.exports=B0()),zu.exports}var a=W0(),y=Vd();const ct=tv(y);var Ja={},Uu={exports:{}},In={},Bu={exports:{}},Wu={};/**
19
19
  * @license React
20
20
  * scheduler.production.min.js
21
21
  *
@@ -23,7 +23,7 @@ var z0=Object.defineProperty;var F0=(e,n,r)=>n in e?z0(e,n,{enumerable:!0,config
23
23
  *
24
24
  * This source code is licensed under the MIT license found in the
25
25
  * LICENSE file in the root directory of this source tree.
26
- */var Yh;function H0(){return Yh||(Yh=1,(function(e){function n(F,Z){var q=F.length;F.push(Z);e:for(;0<q;){var I=q-1>>>1,$=F[I];if(0<l($,Z))F[I]=Z,F[q]=$,q=I;else break e}}function r(F){return F.length===0?null:F[0]}function o(F){if(F.length===0)return null;var Z=F[0],q=F.pop();if(q!==Z){F[0]=q;e:for(var I=0,$=F.length,ue=$>>>1;I<ue;){var B=2*(I+1)-1,X=F[B],ce=B+1,be=F[ce];if(0>l(X,q))ce<$&&0>l(be,X)?(F[I]=be,F[ce]=q,I=ce):(F[I]=X,F[B]=q,I=B);else if(ce<$&&0>l(be,q))F[I]=be,F[ce]=q,I=ce;else break e}}return Z}function l(F,Z){var q=F.sortIndex-Z.sortIndex;return q!==0?q:F.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var h=[],m=[],v=1,k=null,x=3,S=!1,C=!1,T=!1,E=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function P(F){for(var Z=r(m);Z!==null;){if(Z.callback===null)o(m);else if(Z.startTime<=F)o(m),Z.sortIndex=Z.expirationTime,n(h,Z);else break;Z=r(m)}}function M(F){if(T=!1,P(F),!C)if(r(h)!==null)C=!0,ie(L);else{var Z=r(m);Z!==null&&te(M,Z.startTime-F)}}function L(F,Z){C=!1,T&&(T=!1,b(U),U=-1),S=!0;var q=x;try{for(P(Z),k=r(h);k!==null&&(!(k.expirationTime>Z)||F&&!oe());){var I=k.callback;if(typeof I=="function"){k.callback=null,x=k.priorityLevel;var $=I(k.expirationTime<=Z);Z=e.unstable_now(),typeof $=="function"?k.callback=$:k===r(h)&&o(h),P(Z)}else o(h);k=r(h)}if(k!==null)var ue=!0;else{var B=r(m);B!==null&&te(M,B.startTime-Z),ue=!1}return ue}finally{k=null,x=q,S=!1}}var G=!1,z=null,U=-1,Q=5,J=-1;function oe(){return!(e.unstable_now()-J<Q)}function me(){if(z!==null){var F=e.unstable_now();J=F;var Z=!0;try{Z=z(!0,F)}finally{Z?Se():(G=!1,z=null)}}else G=!1}var Se;if(typeof j=="function")Se=function(){j(me)};else if(typeof MessageChannel<"u"){var Me=new MessageChannel,ee=Me.port2;Me.port1.onmessage=me,Se=function(){ee.postMessage(null)}}else Se=function(){E(me,0)};function ie(F){z=F,G||(G=!0,Se())}function te(F,Z){U=E(function(){F(e.unstable_now())},Z)}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(F){F.callback=null},e.unstable_continueExecution=function(){C||S||(C=!0,ie(L))},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_getFirstCallbackNode=function(){return r(h)},e.unstable_next=function(F){switch(x){case 1:case 2:case 3:var Z=3;break;default:Z=x}var q=x;x=Z;try{return F()}finally{x=q}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(F,Z){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var q=x;x=F;try{return Z()}finally{x=q}},e.unstable_scheduleCallback=function(F,Z,q){var I=e.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?I+q:I):q=I,F){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=q+$,F={id:v++,callback:Z,priorityLevel:F,startTime:q,expirationTime:$,sortIndex:-1},q>I?(F.sortIndex=q,n(m,F),r(h)===null&&F===r(m)&&(T?(b(U),U=-1):T=!0,te(M,q-I))):(F.sortIndex=$,n(h,F),C||S||(C=!0,ie(L))),F},e.unstable_shouldYield=oe,e.unstable_wrapCallback=function(F){var Z=x;return function(){var q=x;x=Z;try{return F.apply(this,arguments)}finally{x=q}}}})(Bu)),Bu}var Qh;function V0(){return Qh||(Qh=1,Uu.exports=H0()),Uu.exports}/**
26
+ */var Yh;function H0(){return Yh||(Yh=1,(function(e){function n(F,Z){var q=F.length;F.push(Z);e:for(;0<q;){var I=q-1>>>1,$=F[I];if(0<l($,Z))F[I]=Z,F[q]=$,q=I;else break e}}function r(F){return F.length===0?null:F[0]}function o(F){if(F.length===0)return null;var Z=F[0],q=F.pop();if(q!==Z){F[0]=q;e:for(var I=0,$=F.length,ue=$>>>1;I<ue;){var B=2*(I+1)-1,X=F[B],ce=B+1,be=F[ce];if(0>l(X,q))ce<$&&0>l(be,X)?(F[I]=be,F[ce]=q,I=ce):(F[I]=X,F[B]=q,I=B);else if(ce<$&&0>l(be,q))F[I]=be,F[ce]=q,I=ce;else break e}}return Z}function l(F,Z){var q=F.sortIndex-Z.sortIndex;return q!==0?q:F.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var h=[],m=[],v=1,k=null,x=3,S=!1,C=!1,T=!1,E=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function P(F){for(var Z=r(m);Z!==null;){if(Z.callback===null)o(m);else if(Z.startTime<=F)o(m),Z.sortIndex=Z.expirationTime,n(h,Z);else break;Z=r(m)}}function M(F){if(T=!1,P(F),!C)if(r(h)!==null)C=!0,ie(L);else{var Z=r(m);Z!==null&&te(M,Z.startTime-F)}}function L(F,Z){C=!1,T&&(T=!1,b(U),U=-1),S=!0;var q=x;try{for(P(Z),k=r(h);k!==null&&(!(k.expirationTime>Z)||F&&!oe());){var I=k.callback;if(typeof I=="function"){k.callback=null,x=k.priorityLevel;var $=I(k.expirationTime<=Z);Z=e.unstable_now(),typeof $=="function"?k.callback=$:k===r(h)&&o(h),P(Z)}else o(h);k=r(h)}if(k!==null)var ue=!0;else{var B=r(m);B!==null&&te(M,B.startTime-Z),ue=!1}return ue}finally{k=null,x=q,S=!1}}var G=!1,z=null,U=-1,Q=5,J=-1;function oe(){return!(e.unstable_now()-J<Q)}function me(){if(z!==null){var F=e.unstable_now();J=F;var Z=!0;try{Z=z(!0,F)}finally{Z?Se():(G=!1,z=null)}}else G=!1}var Se;if(typeof j=="function")Se=function(){j(me)};else if(typeof MessageChannel<"u"){var Me=new MessageChannel,ee=Me.port2;Me.port1.onmessage=me,Se=function(){ee.postMessage(null)}}else Se=function(){E(me,0)};function ie(F){z=F,G||(G=!0,Se())}function te(F,Z){U=E(function(){F(e.unstable_now())},Z)}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(F){F.callback=null},e.unstable_continueExecution=function(){C||S||(C=!0,ie(L))},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_getFirstCallbackNode=function(){return r(h)},e.unstable_next=function(F){switch(x){case 1:case 2:case 3:var Z=3;break;default:Z=x}var q=x;x=Z;try{return F()}finally{x=q}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(F,Z){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var q=x;x=F;try{return Z()}finally{x=q}},e.unstable_scheduleCallback=function(F,Z,q){var I=e.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?I+q:I):q=I,F){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=q+$,F={id:v++,callback:Z,priorityLevel:F,startTime:q,expirationTime:$,sortIndex:-1},q>I?(F.sortIndex=q,n(m,F),r(h)===null&&F===r(m)&&(T?(b(U),U=-1):T=!0,te(M,q-I))):(F.sortIndex=$,n(h,F),C||S||(C=!0,ie(L))),F},e.unstable_shouldYield=oe,e.unstable_wrapCallback=function(F){var Z=x;return function(){var q=x;x=Z;try{return F.apply(this,arguments)}finally{x=q}}}})(Wu)),Wu}var Qh;function V0(){return Qh||(Qh=1,Bu.exports=H0()),Bu.exports}/**
27
27
  * @license React
28
28
  * react-dom.production.min.js
29
29
  *
@@ -31,55 +31,55 @@ var z0=Object.defineProperty;var F0=(e,n,r)=>n in e?z0(e,n,{enumerable:!0,config
31
31
  *
32
32
  * This source code is licensed under the MIT license found in the
33
33
  * LICENSE file in the root directory of this source tree.
34
- */var Zh;function K0(){if(Zh)return In;Zh=1;var e=Hd(),n=V0();function r(t){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+t,i=1;i<arguments.length;i++)s+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+t+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var o=new Set,l={};function c(t,s){d(t,s),d(t+"Capture",s)}function d(t,s){for(l[t]=s,t=0;t<s.length;t++)o.add(s[t])}var f=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,m=/^[: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]*$/,v={},k={};function x(t){return h.call(k,t)?!0:h.call(v,t)?!1:m.test(t)?k[t]=!0:(v[t]=!0,!1)}function S(t,s,i,u){if(i!==null&&i.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return u?!1:i!==null?!i.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function C(t,s,i,u){if(s===null||typeof s>"u"||S(t,s,i,u))return!0;if(u)return!1;if(i!==null)switch(i.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function T(t,s,i,u,p,g,w){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=u,this.attributeNamespace=p,this.mustUseProperty=i,this.propertyName=t,this.type=s,this.sanitizeURL=g,this.removeEmptyString=w}var E={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){E[t]=new T(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var s=t[0];E[s]=new T(s,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){E[t]=new T(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){E[t]=new T(t,2,!1,t,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(t){E[t]=new T(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){E[t]=new T(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){E[t]=new T(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){E[t]=new T(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){E[t]=new T(t,5,!1,t.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function j(t){return t[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(t){var s=t.replace(b,j);E[s]=new T(s,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var s=t.replace(b,j);E[s]=new T(s,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var s=t.replace(b,j);E[s]=new T(s,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){E[t]=new T(t,1,!1,t.toLowerCase(),null,!1,!1)}),E.xlinkHref=new T("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){E[t]=new T(t,1,!1,t.toLowerCase(),null,!0,!0)});function P(t,s,i,u){var p=E.hasOwnProperty(s)?E[s]:null;(p!==null?p.type!==0:u||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(C(s,i,p,u)&&(i=null),u||p===null?x(s)&&(i===null?t.removeAttribute(s):t.setAttribute(s,""+i)):p.mustUseProperty?t[p.propertyName]=i===null?p.type===3?!1:"":i:(s=p.attributeName,u=p.attributeNamespace,i===null?t.removeAttribute(s):(p=p.type,i=p===3||p===4&&i===!0?"":""+i,u?t.setAttributeNS(u,s,i):t.setAttribute(s,i))))}var M=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,L=Symbol.for("react.element"),G=Symbol.for("react.portal"),z=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),Q=Symbol.for("react.profiler"),J=Symbol.for("react.provider"),oe=Symbol.for("react.context"),me=Symbol.for("react.forward_ref"),Se=Symbol.for("react.suspense"),Me=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),ie=Symbol.for("react.lazy"),te=Symbol.for("react.offscreen"),F=Symbol.iterator;function Z(t){return t===null||typeof t!="object"?null:(t=F&&t[F]||t["@@iterator"],typeof t=="function"?t:null)}var q=Object.assign,I;function $(t){if(I===void 0)try{throw Error()}catch(i){var s=i.stack.trim().match(/\n( *(at )?)/);I=s&&s[1]||""}return`
34
+ */var Zh;function K0(){if(Zh)return In;Zh=1;var e=Vd(),n=V0();function r(t){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+t,i=1;i<arguments.length;i++)s+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+t+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var o=new Set,l={};function c(t,s){d(t,s),d(t+"Capture",s)}function d(t,s){for(l[t]=s,t=0;t<s.length;t++)o.add(s[t])}var f=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,m=/^[: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]*$/,v={},k={};function x(t){return h.call(k,t)?!0:h.call(v,t)?!1:m.test(t)?k[t]=!0:(v[t]=!0,!1)}function S(t,s,i,u){if(i!==null&&i.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return u?!1:i!==null?!i.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function C(t,s,i,u){if(s===null||typeof s>"u"||S(t,s,i,u))return!0;if(u)return!1;if(i!==null)switch(i.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function T(t,s,i,u,p,g,w){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=u,this.attributeNamespace=p,this.mustUseProperty=i,this.propertyName=t,this.type=s,this.sanitizeURL=g,this.removeEmptyString=w}var E={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){E[t]=new T(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var s=t[0];E[s]=new T(s,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){E[t]=new T(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){E[t]=new T(t,2,!1,t,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(t){E[t]=new T(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){E[t]=new T(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){E[t]=new T(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){E[t]=new T(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){E[t]=new T(t,5,!1,t.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function j(t){return t[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(t){var s=t.replace(b,j);E[s]=new T(s,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var s=t.replace(b,j);E[s]=new T(s,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var s=t.replace(b,j);E[s]=new T(s,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){E[t]=new T(t,1,!1,t.toLowerCase(),null,!1,!1)}),E.xlinkHref=new T("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){E[t]=new T(t,1,!1,t.toLowerCase(),null,!0,!0)});function P(t,s,i,u){var p=E.hasOwnProperty(s)?E[s]:null;(p!==null?p.type!==0:u||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(C(s,i,p,u)&&(i=null),u||p===null?x(s)&&(i===null?t.removeAttribute(s):t.setAttribute(s,""+i)):p.mustUseProperty?t[p.propertyName]=i===null?p.type===3?!1:"":i:(s=p.attributeName,u=p.attributeNamespace,i===null?t.removeAttribute(s):(p=p.type,i=p===3||p===4&&i===!0?"":""+i,u?t.setAttributeNS(u,s,i):t.setAttribute(s,i))))}var M=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,L=Symbol.for("react.element"),G=Symbol.for("react.portal"),z=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),Q=Symbol.for("react.profiler"),J=Symbol.for("react.provider"),oe=Symbol.for("react.context"),me=Symbol.for("react.forward_ref"),Se=Symbol.for("react.suspense"),Me=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),ie=Symbol.for("react.lazy"),te=Symbol.for("react.offscreen"),F=Symbol.iterator;function Z(t){return t===null||typeof t!="object"?null:(t=F&&t[F]||t["@@iterator"],typeof t=="function"?t:null)}var q=Object.assign,I;function $(t){if(I===void 0)try{throw Error()}catch(i){var s=i.stack.trim().match(/\n( *(at )?)/);I=s&&s[1]||""}return`
35
35
  `+I+t}var ue=!1;function B(t,s){if(!t||ue)return"";ue=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(K){var u=K}Reflect.construct(t,[],s)}else{try{s.call()}catch(K){u=K}t.call(s.prototype)}else{try{throw Error()}catch(K){u=K}t()}}catch(K){if(K&&u&&typeof K.stack=="string"){for(var p=K.stack.split(`
36
36
  `),g=u.stack.split(`
37
37
  `),w=p.length-1,_=g.length-1;1<=w&&0<=_&&p[w]!==g[_];)_--;for(;1<=w&&0<=_;w--,_--)if(p[w]!==g[_]){if(w!==1||_!==1)do if(w--,_--,0>_||p[w]!==g[_]){var D=`
38
- `+p[w].replace(" at new "," at ");return t.displayName&&D.includes("<anonymous>")&&(D=D.replace("<anonymous>",t.displayName)),D}while(1<=w&&0<=_);break}}}finally{ue=!1,Error.prepareStackTrace=i}return(t=t?t.displayName||t.name:"")?$(t):""}function X(t){switch(t.tag){case 5:return $(t.type);case 16:return $("Lazy");case 13:return $("Suspense");case 19:return $("SuspenseList");case 0:case 2:case 15:return t=B(t.type,!1),t;case 11:return t=B(t.type.render,!1),t;case 1:return t=B(t.type,!0),t;default:return""}}function ce(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case z:return"Fragment";case G:return"Portal";case Q:return"Profiler";case U:return"StrictMode";case Se:return"Suspense";case Me:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case oe:return(t.displayName||"Context")+".Consumer";case J:return(t._context.displayName||"Context")+".Provider";case me:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case ee:return s=t.displayName||null,s!==null?s:ce(t.type)||"Memo";case ie:s=t._payload,t=t._init;try{return ce(t(s))}catch{}}return null}function be(t){var s=t.type;switch(t.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=s.render,t=t.displayName||t.name||"",s.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ce(s);case 8:return s===U?"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 s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function _e(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Ae(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function je(t){var s=Ae(t)?"checked":"value",i=Object.getOwnPropertyDescriptor(t.constructor.prototype,s),u=""+t[s];if(!t.hasOwnProperty(s)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var p=i.get,g=i.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return p.call(this)},set:function(w){u=""+w,g.call(this,w)}}),Object.defineProperty(t,s,{enumerable:i.enumerable}),{getValue:function(){return u},setValue:function(w){u=""+w},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function ge(t){t._valueTracker||(t._valueTracker=je(t))}function he(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var i=s.getValue(),u="";return t&&(u=Ae(t)?t.checked?"true":"false":t.value),t=u,t!==i?(s.setValue(t),!0):!1}function Ve(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Ie(t,s){var i=s.checked;return q({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??t._wrapperState.initialChecked})}function mt(t,s){var i=s.defaultValue==null?"":s.defaultValue,u=s.checked!=null?s.checked:s.defaultChecked;i=_e(s.value!=null?s.value:i),t._wrapperState={initialChecked:u,initialValue:i,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function Ue(t,s){s=s.checked,s!=null&&P(t,"checked",s,!1)}function Vt(t,s){Ue(t,s);var i=_e(s.value),u=s.type;if(i!=null)u==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+i):t.value!==""+i&&(t.value=""+i);else if(u==="submit"||u==="reset"){t.removeAttribute("value");return}s.hasOwnProperty("value")?St(t,s.type,i):s.hasOwnProperty("defaultValue")&&St(t,s.type,_e(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(t.defaultChecked=!!s.defaultChecked)}function tn(t,s,i){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var u=s.type;if(!(u!=="submit"&&u!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+t._wrapperState.initialValue,i||s===t.value||(t.value=s),t.defaultValue=s}i=t.name,i!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,i!==""&&(t.name=i)}function St(t,s,i){(s!=="number"||Ve(t.ownerDocument)!==t)&&(i==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+i&&(t.defaultValue=""+i))}var jt=Array.isArray;function Ft(t,s,i,u){if(t=t.options,s){s={};for(var p=0;p<i.length;p++)s["$"+i[p]]=!0;for(i=0;i<t.length;i++)p=s.hasOwnProperty("$"+t[i].value),t[i].selected!==p&&(t[i].selected=p),p&&u&&(t[i].defaultSelected=!0)}else{for(i=""+_e(i),s=null,p=0;p<t.length;p++){if(t[p].value===i){t[p].selected=!0,u&&(t[p].defaultSelected=!0);return}s!==null||t[p].disabled||(s=t[p])}s!==null&&(s.selected=!0)}}function Ot(t,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return q({},s,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Y(t,s){var i=s.value;if(i==null){if(i=s.children,s=s.defaultValue,i!=null){if(s!=null)throw Error(r(92));if(jt(i)){if(1<i.length)throw Error(r(93));i=i[0]}s=i}s==null&&(s=""),i=s}t._wrapperState={initialValue:_e(i)}}function ve(t,s){var i=_e(s.value),u=_e(s.defaultValue);i!=null&&(i=""+i,i!==t.value&&(t.value=i),s.defaultValue==null&&t.defaultValue!==i&&(t.defaultValue=i)),u!=null&&(t.defaultValue=""+u)}function Be(t){var s=t.textContent;s===t._wrapperState.initialValue&&s!==""&&s!==null&&(t.value=s)}function rt(t){switch(t){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 gt(t,s){return t==null||t==="http://www.w3.org/1999/xhtml"?rt(s):t==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var vt,_t=(function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,i,u,p){MSApp.execUnsafeLocalFunction(function(){return t(s,i,u,p)})}:t})(function(t,s){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=s;else{for(vt=vt||document.createElement("div"),vt.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=vt.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;s.firstChild;)t.appendChild(s.firstChild)}});function an(t,s){if(s){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=s;return}}t.textContent=s}var dt={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},Mn=["Webkit","ms","Moz","O"];Object.keys(dt).forEach(function(t){Mn.forEach(function(s){s=s+t.charAt(0).toUpperCase()+t.substring(1),dt[s]=dt[t]})});function Ln(t,s,i){return s==null||typeof s=="boolean"||s===""?"":i||typeof s!="number"||s===0||dt.hasOwnProperty(t)&&dt[t]?(""+s).trim():s+"px"}function hs(t,s){t=t.style;for(var i in s)if(s.hasOwnProperty(i)){var u=i.indexOf("--")===0,p=Ln(i,s[i],u);i==="float"&&(i="cssFloat"),u?t.setProperty(i,p):t[i]=p}}var ms=q({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 ns(t,s){if(s){if(ms[t]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(r(137,t));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(r(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(r(61))}if(s.style!=null&&typeof s.style!="object")throw Error(r(62))}}function On(t,s){if(t.indexOf("-")===-1)return typeof s.is=="string";switch(t){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 gn=null;function ln(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Kt=null,vn=null,Ze=null;function Rt(t){if(t=ei(t)){if(typeof Kt!="function")throw Error(r(280));var s=t.stateNode;s&&(s=ha(s),Kt(t.stateNode,t.type,s))}}function ft(t){vn?Ze?Ze.push(t):Ze=[t]:vn=t}function Gt(){if(vn){var t=vn,s=Ze;if(Ze=vn=null,Rt(t),s)for(t=0;t<s.length;t++)Rt(s[t])}}function yt(t,s){return t(s)}function xt(){}var lt=!1;function qt(t,s,i){if(lt)return t(s,i);lt=!0;try{return yt(t,s,i)}finally{lt=!1,(vn!==null||Ze!==null)&&(xt(),Gt())}}function it(t,s){var i=t.stateNode;if(i===null)return null;var u=ha(i);if(u===null)return null;i=u[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(i&&typeof i!="function")throw Error(r(231,s,typeof i));return i}var $t=!1;if(f)try{var R={};Object.defineProperty(R,"passive",{get:function(){$t=!0}}),window.addEventListener("test",R,R),window.removeEventListener("test",R,R)}catch{$t=!1}function pe(t,s,i,u,p,g,w,_,D){var K=Array.prototype.slice.call(arguments,3);try{s.apply(i,K)}catch(re){this.onError(re)}}var le=!1,we=null,$e=!1,qe=null,Pe={onError:function(t){le=!0,we=t}};function Ut(t,s,i,u,p,g,w,_,D){le=!1,we=null,pe.apply(Pe,arguments)}function $n(t,s,i,u,p,g,w,_,D){if(Ut.apply(this,arguments),le){if(le){var K=we;le=!1,we=null}else throw Error(r(198));$e||($e=!0,qe=K)}}function We(t){var s=t,i=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(i=s.return),t=s.return;while(t)}return s.tag===3?i:null}function yn(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function js(t){if(We(t)!==t)throw Error(r(188))}function Bs(t){var s=t.alternate;if(!s){if(s=We(t),s===null)throw Error(r(188));return s!==t?null:t}for(var i=t,u=s;;){var p=i.return;if(p===null)break;var g=p.alternate;if(g===null){if(u=p.return,u!==null){i=u;continue}break}if(p.child===g.child){for(g=p.child;g;){if(g===i)return js(p),t;if(g===u)return js(p),s;g=g.sibling}throw Error(r(188))}if(i.return!==u.return)i=p,u=g;else{for(var w=!1,_=p.child;_;){if(_===i){w=!0,i=p,u=g;break}if(_===u){w=!0,u=p,i=g;break}_=_.sibling}if(!w){for(_=g.child;_;){if(_===i){w=!0,i=g,u=p;break}if(_===u){w=!0,u=g,i=p;break}_=_.sibling}if(!w)throw Error(r(189))}}if(i.alternate!==u)throw Error(r(190))}if(i.tag!==3)throw Error(r(188));return i.stateNode.current===i?t:s}function Pn(t){return t=Bs(t),t!==null?gs(t):null}function gs(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var s=gs(t);if(s!==null)return s;t=t.sibling}return null}var Je=n.unstable_scheduleCallback,At=n.unstable_cancelCallback,vs=n.unstable_shouldYield,cc=n.unstable_requestPaint,bt=n.unstable_now,ys=n.unstable_getCurrentPriorityLevel,Ws=n.unstable_ImmediatePriority,xs=n.unstable_UserBlockingPriority,Wr=n.unstable_NormalPriority,xr=n.unstable_LowPriority,Yi=n.unstable_IdlePriority,wr=null,zn=null;function Hr(t){if(zn&&typeof zn.onCommitFiberRoot=="function")try{zn.onCommitFiberRoot(wr,t,void 0,(t.current.flags&128)===128)}catch{}}var xn=Math.clz32?Math.clz32:kr,Vr=Math.log,Hs=Math.LN2;function kr(t){return t>>>=0,t===0?32:31-(Vr(t)/Hs|0)|0}var wn=64,Kr=4194304;function Sr(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function br(t,s){var i=t.pendingLanes;if(i===0)return 0;var u=0,p=t.suspendedLanes,g=t.pingedLanes,w=i&268435455;if(w!==0){var _=w&~p;_!==0?u=Sr(_):(g&=w,g!==0&&(u=Sr(g)))}else w=i&~p,w!==0?u=Sr(w):g!==0&&(u=Sr(g));if(u===0)return 0;if(s!==0&&s!==u&&(s&p)===0&&(p=u&-u,g=s&-s,p>=g||p===16&&(g&4194240)!==0))return s;if((u&4)!==0&&(u|=i&16),s=t.entangledLanes,s!==0)for(t=t.entanglements,s&=u;0<s;)i=31-xn(s),p=1<<i,u|=t[i],s&=~p;return u}function Qi(t,s){switch(t){case 1:case 2:case 4:return s+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 s+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 Zi(t,s){for(var i=t.suspendedLanes,u=t.pingedLanes,p=t.expirationTimes,g=t.pendingLanes;0<g;){var w=31-xn(g),_=1<<w,D=p[w];D===-1?((_&i)===0||(_&u)!==0)&&(p[w]=Qi(_,s)):D<=s&&(t.expiredLanes|=_),g&=~_}}function $o(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Po(){var t=wn;return wn<<=1,(wn&4194240)===0&&(wn=64),t}function zo(t){for(var s=[],i=0;31>i;i++)s.push(t);return s}function Nr(t,s,i){t.pendingLanes|=s,s!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,s=31-xn(s),t[s]=i}function Ji(t,s){var i=t.pendingLanes&~s;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=s,t.mutableReadLanes&=s,t.entangledLanes&=s,s=t.entanglements;var u=t.eventTimes;for(t=t.expirationTimes;0<i;){var p=31-xn(i),g=1<<p;s[p]=0,u[p]=-1,t[p]=-1,i&=~g}}function Vs(t,s){var i=t.entangledLanes|=s;for(t=t.entanglements;i;){var u=31-xn(i),p=1<<u;p&s|t[u]&s&&(t[u]|=s),i&=~p}}var Xe=0;function de(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var N,W,ne,Te,Re,Fe=!1,Ye=[],et=null,Nt=null,Tt=null,_s=new Map,Dt=new Map,Ks=[],ax="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 _f(t,s){switch(t){case"focusin":case"focusout":et=null;break;case"dragenter":case"dragleave":Nt=null;break;case"mouseover":case"mouseout":Tt=null;break;case"pointerover":case"pointerout":_s.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Dt.delete(s.pointerId)}}function Fo(t,s,i,u,p,g){return t===null||t.nativeEvent!==g?(t={blockedOn:s,domEventName:i,eventSystemFlags:u,nativeEvent:g,targetContainers:[p]},s!==null&&(s=ei(s),s!==null&&W(s)),t):(t.eventSystemFlags|=u,s=t.targetContainers,p!==null&&s.indexOf(p)===-1&&s.push(p),t)}function lx(t,s,i,u,p){switch(s){case"focusin":return et=Fo(et,t,s,i,u,p),!0;case"dragenter":return Nt=Fo(Nt,t,s,i,u,p),!0;case"mouseover":return Tt=Fo(Tt,t,s,i,u,p),!0;case"pointerover":var g=p.pointerId;return _s.set(g,Fo(_s.get(g)||null,t,s,i,u,p)),!0;case"gotpointercapture":return g=p.pointerId,Dt.set(g,Fo(Dt.get(g)||null,t,s,i,u,p)),!0}return!1}function Rf(t){var s=Tr(t.target);if(s!==null){var i=We(s);if(i!==null){if(s=i.tag,s===13){if(s=yn(i),s!==null){t.blockedOn=s,Re(t.priority,function(){ne(i)});return}}else if(s===3&&i.stateNode.current.memoizedState.isDehydrated){t.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}t.blockedOn=null}function ea(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var i=dc(t.domEventName,t.eventSystemFlags,s[0],t.nativeEvent);if(i===null){i=t.nativeEvent;var u=new i.constructor(i.type,i);gn=u,i.target.dispatchEvent(u),gn=null}else return s=ei(i),s!==null&&W(s),t.blockedOn=i,!1;s.shift()}return!0}function Af(t,s,i){ea(t)&&i.delete(s)}function cx(){Fe=!1,et!==null&&ea(et)&&(et=null),Nt!==null&&ea(Nt)&&(Nt=null),Tt!==null&&ea(Tt)&&(Tt=null),_s.forEach(Af),Dt.forEach(Af)}function Uo(t,s){t.blockedOn===s&&(t.blockedOn=null,Fe||(Fe=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,cx)))}function Bo(t){function s(p){return Uo(p,t)}if(0<Ye.length){Uo(Ye[0],t);for(var i=1;i<Ye.length;i++){var u=Ye[i];u.blockedOn===t&&(u.blockedOn=null)}}for(et!==null&&Uo(et,t),Nt!==null&&Uo(Nt,t),Tt!==null&&Uo(Tt,t),_s.forEach(s),Dt.forEach(s),i=0;i<Ks.length;i++)u=Ks[i],u.blockedOn===t&&(u.blockedOn=null);for(;0<Ks.length&&(i=Ks[0],i.blockedOn===null);)Rf(i),i.blockedOn===null&&Ks.shift()}var Gr=M.ReactCurrentBatchConfig,ta=!0;function ux(t,s,i,u){var p=Xe,g=Gr.transition;Gr.transition=null;try{Xe=1,uc(t,s,i,u)}finally{Xe=p,Gr.transition=g}}function dx(t,s,i,u){var p=Xe,g=Gr.transition;Gr.transition=null;try{Xe=4,uc(t,s,i,u)}finally{Xe=p,Gr.transition=g}}function uc(t,s,i,u){if(ta){var p=dc(t,s,i,u);if(p===null)jc(t,s,u,na,i),_f(t,u);else if(lx(p,t,s,i,u))u.stopPropagation();else if(_f(t,u),s&4&&-1<ax.indexOf(t)){for(;p!==null;){var g=ei(p);if(g!==null&&N(g),g=dc(t,s,i,u),g===null&&jc(t,s,u,na,i),g===p)break;p=g}p!==null&&u.stopPropagation()}else jc(t,s,u,null,i)}}var na=null;function dc(t,s,i,u){if(na=null,t=ln(u),t=Tr(t),t!==null)if(s=We(t),s===null)t=null;else if(i=s.tag,i===13){if(t=yn(s),t!==null)return t;t=null}else if(i===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null);return na=t,null}function If(t){switch(t){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(ys()){case Ws:return 1;case xs:return 4;case Wr:case xr:return 16;case Yi:return 536870912;default:return 16}default:return 16}}var Gs=null,fc=null,sa=null;function Df(){if(sa)return sa;var t,s=fc,i=s.length,u,p="value"in Gs?Gs.value:Gs.textContent,g=p.length;for(t=0;t<i&&s[t]===p[t];t++);var w=i-t;for(u=1;u<=w&&s[i-u]===p[g-u];u++);return sa=p.slice(t,1<u?1-u:void 0)}function ra(t){var s=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function oa(){return!0}function Mf(){return!1}function Fn(t){function s(i,u,p,g,w){this._reactName=i,this._targetInst=p,this.type=u,this.nativeEvent=g,this.target=w,this.currentTarget=null;for(var _ in t)t.hasOwnProperty(_)&&(i=t[_],this[_]=i?i(g):g[_]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?oa:Mf,this.isPropagationStopped=Mf,this}return q(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=oa)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=oa)},persist:function(){},isPersistent:oa}),s}var qr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},pc=Fn(qr),Wo=q({},qr,{view:0,detail:0}),fx=Fn(Wo),hc,mc,Ho,ia=q({},Wo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Ho&&(Ho&&t.type==="mousemove"?(hc=t.screenX-Ho.screenX,mc=t.screenY-Ho.screenY):mc=hc=0,Ho=t),hc)},movementY:function(t){return"movementY"in t?t.movementY:mc}}),Lf=Fn(ia),px=q({},ia,{dataTransfer:0}),hx=Fn(px),mx=q({},Wo,{relatedTarget:0}),gc=Fn(mx),gx=q({},qr,{animationName:0,elapsedTime:0,pseudoElement:0}),vx=Fn(gx),yx=q({},qr,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),xx=Fn(yx),wx=q({},qr,{data:0}),Of=Fn(wx),kx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Sx={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"},bx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Nx(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=bx[t])?!!s[t]:!1}function vc(){return Nx}var Tx=q({},Wo,{key:function(t){if(t.key){var s=kx[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=ra(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Sx[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vc,charCode:function(t){return t.type==="keypress"?ra(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?ra(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Cx=Fn(Tx),Ex=q({},ia,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$f=Fn(Ex),jx=q({},Wo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vc}),_x=Fn(jx),Rx=q({},qr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ax=Fn(Rx),Ix=q({},ia,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Dx=Fn(Ix),Mx=[9,13,27,32],yc=f&&"CompositionEvent"in window,Vo=null;f&&"documentMode"in document&&(Vo=document.documentMode);var Lx=f&&"TextEvent"in window&&!Vo,Pf=f&&(!yc||Vo&&8<Vo&&11>=Vo),zf=" ",Ff=!1;function Uf(t,s){switch(t){case"keyup":return Mx.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Xr=!1;function Ox(t,s){switch(t){case"compositionend":return Bf(s);case"keypress":return s.which!==32?null:(Ff=!0,zf);case"textInput":return t=s.data,t===zf&&Ff?null:t;default:return null}}function $x(t,s){if(Xr)return t==="compositionend"||!yc&&Uf(t,s)?(t=Df(),sa=fc=Gs=null,Xr=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Pf&&s.locale!=="ko"?null:s.data;default:return null}}var Px={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 Wf(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!Px[t.type]:s==="textarea"}function Hf(t,s,i,u){ft(u),s=da(s,"onChange"),0<s.length&&(i=new pc("onChange","change",null,i,u),t.push({event:i,listeners:s}))}var Ko=null,Go=null;function zx(t){lp(t,0)}function aa(t){var s=eo(t);if(he(s))return t}function Fx(t,s){if(t==="change")return s}var Vf=!1;if(f){var xc;if(f){var wc="oninput"in document;if(!wc){var Kf=document.createElement("div");Kf.setAttribute("oninput","return;"),wc=typeof Kf.oninput=="function"}xc=wc}else xc=!1;Vf=xc&&(!document.documentMode||9<document.documentMode)}function Gf(){Ko&&(Ko.detachEvent("onpropertychange",qf),Go=Ko=null)}function qf(t){if(t.propertyName==="value"&&aa(Go)){var s=[];Hf(s,Go,t,ln(t)),qt(zx,s)}}function Ux(t,s,i){t==="focusin"?(Gf(),Ko=s,Go=i,Ko.attachEvent("onpropertychange",qf)):t==="focusout"&&Gf()}function Bx(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return aa(Go)}function Wx(t,s){if(t==="click")return aa(s)}function Hx(t,s){if(t==="input"||t==="change")return aa(s)}function Vx(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var ss=typeof Object.is=="function"?Object.is:Vx;function qo(t,s){if(ss(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var i=Object.keys(t),u=Object.keys(s);if(i.length!==u.length)return!1;for(u=0;u<i.length;u++){var p=i[u];if(!h.call(s,p)||!ss(t[p],s[p]))return!1}return!0}function Xf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Yf(t,s){var i=Xf(t);t=0;for(var u;i;){if(i.nodeType===3){if(u=t+i.textContent.length,t<=s&&u>=s)return{node:i,offset:s-t};t=u}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Xf(i)}}function Qf(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?Qf(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function Zf(){for(var t=window,s=Ve();s instanceof t.HTMLIFrameElement;){try{var i=typeof s.contentWindow.location.href=="string"}catch{i=!1}if(i)t=s.contentWindow;else break;s=Ve(t.document)}return s}function kc(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}function Kx(t){var s=Zf(),i=t.focusedElem,u=t.selectionRange;if(s!==i&&i&&i.ownerDocument&&Qf(i.ownerDocument.documentElement,i)){if(u!==null&&kc(i)){if(s=u.start,t=u.end,t===void 0&&(t=s),"selectionStart"in i)i.selectionStart=s,i.selectionEnd=Math.min(t,i.value.length);else if(t=(s=i.ownerDocument||document)&&s.defaultView||window,t.getSelection){t=t.getSelection();var p=i.textContent.length,g=Math.min(u.start,p);u=u.end===void 0?g:Math.min(u.end,p),!t.extend&&g>u&&(p=u,u=g,g=p),p=Yf(i,g);var w=Yf(i,u);p&&w&&(t.rangeCount!==1||t.anchorNode!==p.node||t.anchorOffset!==p.offset||t.focusNode!==w.node||t.focusOffset!==w.offset)&&(s=s.createRange(),s.setStart(p.node,p.offset),t.removeAllRanges(),g>u?(t.addRange(s),t.extend(w.node,w.offset)):(s.setEnd(w.node,w.offset),t.addRange(s)))}}for(s=[],t=i;t=t.parentNode;)t.nodeType===1&&s.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<s.length;i++)t=s[i],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var Gx=f&&"documentMode"in document&&11>=document.documentMode,Yr=null,Sc=null,Xo=null,bc=!1;function Jf(t,s,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;bc||Yr==null||Yr!==Ve(u)||(u=Yr,"selectionStart"in u&&kc(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Xo&&qo(Xo,u)||(Xo=u,u=da(Sc,"onSelect"),0<u.length&&(s=new pc("onSelect","select",null,s,i),t.push({event:s,listeners:u}),s.target=Yr)))}function la(t,s){var i={};return i[t.toLowerCase()]=s.toLowerCase(),i["Webkit"+t]="webkit"+s,i["Moz"+t]="moz"+s,i}var Qr={animationend:la("Animation","AnimationEnd"),animationiteration:la("Animation","AnimationIteration"),animationstart:la("Animation","AnimationStart"),transitionend:la("Transition","TransitionEnd")},Nc={},ep={};f&&(ep=document.createElement("div").style,"AnimationEvent"in window||(delete Qr.animationend.animation,delete Qr.animationiteration.animation,delete Qr.animationstart.animation),"TransitionEvent"in window||delete Qr.transitionend.transition);function ca(t){if(Nc[t])return Nc[t];if(!Qr[t])return t;var s=Qr[t],i;for(i in s)if(s.hasOwnProperty(i)&&i in ep)return Nc[t]=s[i];return t}var tp=ca("animationend"),np=ca("animationiteration"),sp=ca("animationstart"),rp=ca("transitionend"),op=new Map,ip="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 qs(t,s){op.set(t,s),c(s,[t])}for(var Tc=0;Tc<ip.length;Tc++){var Cc=ip[Tc],qx=Cc.toLowerCase(),Xx=Cc[0].toUpperCase()+Cc.slice(1);qs(qx,"on"+Xx)}qs(tp,"onAnimationEnd"),qs(np,"onAnimationIteration"),qs(sp,"onAnimationStart"),qs("dblclick","onDoubleClick"),qs("focusin","onFocus"),qs("focusout","onBlur"),qs(rp,"onTransitionEnd"),d("onMouseEnter",["mouseout","mouseover"]),d("onMouseLeave",["mouseout","mouseover"]),d("onPointerEnter",["pointerout","pointerover"]),d("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Yo="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(" "),Yx=new Set("cancel close invalid load scroll toggle".split(" ").concat(Yo));function ap(t,s,i){var u=t.type||"unknown-event";t.currentTarget=i,$n(u,s,void 0,t),t.currentTarget=null}function lp(t,s){s=(s&4)!==0;for(var i=0;i<t.length;i++){var u=t[i],p=u.event;u=u.listeners;e:{var g=void 0;if(s)for(var w=u.length-1;0<=w;w--){var _=u[w],D=_.instance,K=_.currentTarget;if(_=_.listener,D!==g&&p.isPropagationStopped())break e;ap(p,_,K),g=D}else for(w=0;w<u.length;w++){if(_=u[w],D=_.instance,K=_.currentTarget,_=_.listener,D!==g&&p.isPropagationStopped())break e;ap(p,_,K),g=D}}}if($e)throw t=qe,$e=!1,qe=null,t}function pt(t,s){var i=s[Mc];i===void 0&&(i=s[Mc]=new Set);var u=t+"__bubble";i.has(u)||(cp(s,t,2,!1),i.add(u))}function Ec(t,s,i){var u=0;s&&(u|=4),cp(i,t,u,s)}var ua="_reactListening"+Math.random().toString(36).slice(2);function Qo(t){if(!t[ua]){t[ua]=!0,o.forEach(function(i){i!=="selectionchange"&&(Yx.has(i)||Ec(i,!1,t),Ec(i,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[ua]||(s[ua]=!0,Ec("selectionchange",!1,s))}}function cp(t,s,i,u){switch(If(s)){case 1:var p=ux;break;case 4:p=dx;break;default:p=uc}i=p.bind(null,s,i,t),p=void 0,!$t||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(p=!0),u?p!==void 0?t.addEventListener(s,i,{capture:!0,passive:p}):t.addEventListener(s,i,!0):p!==void 0?t.addEventListener(s,i,{passive:p}):t.addEventListener(s,i,!1)}function jc(t,s,i,u,p){var g=u;if((s&1)===0&&(s&2)===0&&u!==null)e:for(;;){if(u===null)return;var w=u.tag;if(w===3||w===4){var _=u.stateNode.containerInfo;if(_===p||_.nodeType===8&&_.parentNode===p)break;if(w===4)for(w=u.return;w!==null;){var D=w.tag;if((D===3||D===4)&&(D=w.stateNode.containerInfo,D===p||D.nodeType===8&&D.parentNode===p))return;w=w.return}for(;_!==null;){if(w=Tr(_),w===null)return;if(D=w.tag,D===5||D===6){u=g=w;continue e}_=_.parentNode}}u=u.return}qt(function(){var K=g,re=ln(i),ae=[];e:{var se=op.get(t);if(se!==void 0){var xe=pc,Ne=t;switch(t){case"keypress":if(ra(i)===0)break e;case"keydown":case"keyup":xe=Cx;break;case"focusin":Ne="focus",xe=gc;break;case"focusout":Ne="blur",xe=gc;break;case"beforeblur":case"afterblur":xe=gc;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":xe=Lf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":xe=hx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":xe=_x;break;case tp:case np:case sp:xe=vx;break;case rp:xe=Ax;break;case"scroll":xe=fx;break;case"wheel":xe=Dx;break;case"copy":case"cut":case"paste":xe=xx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":xe=$f}var Ce=(s&4)!==0,Mt=!Ce&&t==="scroll",H=Ce?se!==null?se+"Capture":null:se;Ce=[];for(var O=K,V;O!==null;){V=O;var fe=V.stateNode;if(V.tag===5&&fe!==null&&(V=fe,H!==null&&(fe=it(O,H),fe!=null&&Ce.push(Zo(O,fe,V)))),Mt)break;O=O.return}0<Ce.length&&(se=new xe(se,Ne,null,i,re),ae.push({event:se,listeners:Ce}))}}if((s&7)===0){e:{if(se=t==="mouseover"||t==="pointerover",xe=t==="mouseout"||t==="pointerout",se&&i!==gn&&(Ne=i.relatedTarget||i.fromElement)&&(Tr(Ne)||Ne[Rs]))break e;if((xe||se)&&(se=re.window===re?re:(se=re.ownerDocument)?se.defaultView||se.parentWindow:window,xe?(Ne=i.relatedTarget||i.toElement,xe=K,Ne=Ne?Tr(Ne):null,Ne!==null&&(Mt=We(Ne),Ne!==Mt||Ne.tag!==5&&Ne.tag!==6)&&(Ne=null)):(xe=null,Ne=K),xe!==Ne)){if(Ce=Lf,fe="onMouseLeave",H="onMouseEnter",O="mouse",(t==="pointerout"||t==="pointerover")&&(Ce=$f,fe="onPointerLeave",H="onPointerEnter",O="pointer"),Mt=xe==null?se:eo(xe),V=Ne==null?se:eo(Ne),se=new Ce(fe,O+"leave",xe,i,re),se.target=Mt,se.relatedTarget=V,fe=null,Tr(re)===K&&(Ce=new Ce(H,O+"enter",Ne,i,re),Ce.target=V,Ce.relatedTarget=Mt,fe=Ce),Mt=fe,xe&&Ne)t:{for(Ce=xe,H=Ne,O=0,V=Ce;V;V=Zr(V))O++;for(V=0,fe=H;fe;fe=Zr(fe))V++;for(;0<O-V;)Ce=Zr(Ce),O--;for(;0<V-O;)H=Zr(H),V--;for(;O--;){if(Ce===H||H!==null&&Ce===H.alternate)break t;Ce=Zr(Ce),H=Zr(H)}Ce=null}else Ce=null;xe!==null&&up(ae,se,xe,Ce,!1),Ne!==null&&Mt!==null&&up(ae,Mt,Ne,Ce,!0)}}e:{if(se=K?eo(K):window,xe=se.nodeName&&se.nodeName.toLowerCase(),xe==="select"||xe==="input"&&se.type==="file")var Ee=Fx;else if(Wf(se))if(Vf)Ee=Hx;else{Ee=Bx;var Le=Ux}else(xe=se.nodeName)&&xe.toLowerCase()==="input"&&(se.type==="checkbox"||se.type==="radio")&&(Ee=Wx);if(Ee&&(Ee=Ee(t,K))){Hf(ae,Ee,i,re);break e}Le&&Le(t,se,K),t==="focusout"&&(Le=se._wrapperState)&&Le.controlled&&se.type==="number"&&St(se,"number",se.value)}switch(Le=K?eo(K):window,t){case"focusin":(Wf(Le)||Le.contentEditable==="true")&&(Yr=Le,Sc=K,Xo=null);break;case"focusout":Xo=Sc=Yr=null;break;case"mousedown":bc=!0;break;case"contextmenu":case"mouseup":case"dragend":bc=!1,Jf(ae,i,re);break;case"selectionchange":if(Gx)break;case"keydown":case"keyup":Jf(ae,i,re)}var Oe;if(yc)e:{switch(t){case"compositionstart":var ze="onCompositionStart";break e;case"compositionend":ze="onCompositionEnd";break e;case"compositionupdate":ze="onCompositionUpdate";break e}ze=void 0}else Xr?Uf(t,i)&&(ze="onCompositionEnd"):t==="keydown"&&i.keyCode===229&&(ze="onCompositionStart");ze&&(Pf&&i.locale!=="ko"&&(Xr||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&Xr&&(Oe=Df()):(Gs=re,fc="value"in Gs?Gs.value:Gs.textContent,Xr=!0)),Le=da(K,ze),0<Le.length&&(ze=new Of(ze,t,null,i,re),ae.push({event:ze,listeners:Le}),Oe?ze.data=Oe:(Oe=Bf(i),Oe!==null&&(ze.data=Oe)))),(Oe=Lx?Ox(t,i):$x(t,i))&&(K=da(K,"onBeforeInput"),0<K.length&&(re=new Of("onBeforeInput","beforeinput",null,i,re),ae.push({event:re,listeners:K}),re.data=Oe))}lp(ae,s)})}function Zo(t,s,i){return{instance:t,listener:s,currentTarget:i}}function da(t,s){for(var i=s+"Capture",u=[];t!==null;){var p=t,g=p.stateNode;p.tag===5&&g!==null&&(p=g,g=it(t,i),g!=null&&u.unshift(Zo(t,g,p)),g=it(t,s),g!=null&&u.push(Zo(t,g,p))),t=t.return}return u}function Zr(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function up(t,s,i,u,p){for(var g=s._reactName,w=[];i!==null&&i!==u;){var _=i,D=_.alternate,K=_.stateNode;if(D!==null&&D===u)break;_.tag===5&&K!==null&&(_=K,p?(D=it(i,g),D!=null&&w.unshift(Zo(i,D,_))):p||(D=it(i,g),D!=null&&w.push(Zo(i,D,_)))),i=i.return}w.length!==0&&t.push({event:s,listeners:w})}var Qx=/\r\n?/g,Zx=/\u0000|\uFFFD/g;function dp(t){return(typeof t=="string"?t:""+t).replace(Qx,`
39
- `).replace(Zx,"")}function fa(t,s,i){if(s=dp(s),dp(t)!==s&&i)throw Error(r(425))}function pa(){}var _c=null,Rc=null;function Ac(t,s){return t==="textarea"||t==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Ic=typeof setTimeout=="function"?setTimeout:void 0,Jx=typeof clearTimeout=="function"?clearTimeout:void 0,fp=typeof Promise=="function"?Promise:void 0,e0=typeof queueMicrotask=="function"?queueMicrotask:typeof fp<"u"?function(t){return fp.resolve(null).then(t).catch(t0)}:Ic;function t0(t){setTimeout(function(){throw t})}function Dc(t,s){var i=s,u=0;do{var p=i.nextSibling;if(t.removeChild(i),p&&p.nodeType===8)if(i=p.data,i==="/$"){if(u===0){t.removeChild(p),Bo(s);return}u--}else i!=="$"&&i!=="$?"&&i!=="$!"||u++;i=p}while(i);Bo(s)}function Xs(t){for(;t!=null;t=t.nextSibling){var s=t.nodeType;if(s===1||s===3)break;if(s===8){if(s=t.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return t}function pp(t){t=t.previousSibling;for(var s=0;t;){if(t.nodeType===8){var i=t.data;if(i==="$"||i==="$!"||i==="$?"){if(s===0)return t;s--}else i==="/$"&&s++}t=t.previousSibling}return null}var Jr=Math.random().toString(36).slice(2),ws="__reactFiber$"+Jr,Jo="__reactProps$"+Jr,Rs="__reactContainer$"+Jr,Mc="__reactEvents$"+Jr,n0="__reactListeners$"+Jr,s0="__reactHandles$"+Jr;function Tr(t){var s=t[ws];if(s)return s;for(var i=t.parentNode;i;){if(s=i[Rs]||i[ws]){if(i=s.alternate,s.child!==null||i!==null&&i.child!==null)for(t=pp(t);t!==null;){if(i=t[ws])return i;t=pp(t)}return s}t=i,i=t.parentNode}return null}function ei(t){return t=t[ws]||t[Rs],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function eo(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(r(33))}function ha(t){return t[Jo]||null}var Lc=[],to=-1;function Ys(t){return{current:t}}function ht(t){0>to||(t.current=Lc[to],Lc[to]=null,to--)}function ut(t,s){to++,Lc[to]=t.current,t.current=s}var Qs={},cn=Ys(Qs),En=Ys(!1),Cr=Qs;function no(t,s){var i=t.type.contextTypes;if(!i)return Qs;var u=t.stateNode;if(u&&u.__reactInternalMemoizedUnmaskedChildContext===s)return u.__reactInternalMemoizedMaskedChildContext;var p={},g;for(g in i)p[g]=s[g];return u&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=p),p}function jn(t){return t=t.childContextTypes,t!=null}function ma(){ht(En),ht(cn)}function hp(t,s,i){if(cn.current!==Qs)throw Error(r(168));ut(cn,s),ut(En,i)}function mp(t,s,i){var u=t.stateNode;if(s=s.childContextTypes,typeof u.getChildContext!="function")return i;u=u.getChildContext();for(var p in u)if(!(p in s))throw Error(r(108,be(t)||"Unknown",p));return q({},i,u)}function ga(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Qs,Cr=cn.current,ut(cn,t),ut(En,En.current),!0}function gp(t,s,i){var u=t.stateNode;if(!u)throw Error(r(169));i?(t=mp(t,s,Cr),u.__reactInternalMemoizedMergedChildContext=t,ht(En),ht(cn),ut(cn,t)):ht(En),ut(En,i)}var As=null,va=!1,Oc=!1;function vp(t){As===null?As=[t]:As.push(t)}function r0(t){va=!0,vp(t)}function Zs(){if(!Oc&&As!==null){Oc=!0;var t=0,s=Xe;try{var i=As;for(Xe=1;t<i.length;t++){var u=i[t];do u=u(!0);while(u!==null)}As=null,va=!1}catch(p){throw As!==null&&(As=As.slice(t+1)),Je(Ws,Zs),p}finally{Xe=s,Oc=!1}}return null}var so=[],ro=0,ya=null,xa=0,Gn=[],qn=0,Er=null,Is=1,Ds="";function jr(t,s){so[ro++]=xa,so[ro++]=ya,ya=t,xa=s}function yp(t,s,i){Gn[qn++]=Is,Gn[qn++]=Ds,Gn[qn++]=Er,Er=t;var u=Is;t=Ds;var p=32-xn(u)-1;u&=~(1<<p),i+=1;var g=32-xn(s)+p;if(30<g){var w=p-p%5;g=(u&(1<<w)-1).toString(32),u>>=w,p-=w,Is=1<<32-xn(s)+p|i<<p|u,Ds=g+t}else Is=1<<g|i<<p|u,Ds=t}function $c(t){t.return!==null&&(jr(t,1),yp(t,1,0))}function Pc(t){for(;t===ya;)ya=so[--ro],so[ro]=null,xa=so[--ro],so[ro]=null;for(;t===Er;)Er=Gn[--qn],Gn[qn]=null,Ds=Gn[--qn],Gn[qn]=null,Is=Gn[--qn],Gn[qn]=null}var Un=null,Bn=null,wt=!1,rs=null;function xp(t,s){var i=Zn(5,null,null,0);i.elementType="DELETED",i.stateNode=s,i.return=t,s=t.deletions,s===null?(t.deletions=[i],t.flags|=16):s.push(i)}function wp(t,s){switch(t.tag){case 5:var i=t.type;return s=s.nodeType!==1||i.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(t.stateNode=s,Un=t,Bn=Xs(s.firstChild),!0):!1;case 6:return s=t.pendingProps===""||s.nodeType!==3?null:s,s!==null?(t.stateNode=s,Un=t,Bn=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(i=Er!==null?{id:Is,overflow:Ds}:null,t.memoizedState={dehydrated:s,treeContext:i,retryLane:1073741824},i=Zn(18,null,null,0),i.stateNode=s,i.return=t,t.child=i,Un=t,Bn=null,!0):!1;default:return!1}}function zc(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Fc(t){if(wt){var s=Bn;if(s){var i=s;if(!wp(t,s)){if(zc(t))throw Error(r(418));s=Xs(i.nextSibling);var u=Un;s&&wp(t,s)?xp(u,i):(t.flags=t.flags&-4097|2,wt=!1,Un=t)}}else{if(zc(t))throw Error(r(418));t.flags=t.flags&-4097|2,wt=!1,Un=t}}}function kp(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Un=t}function wa(t){if(t!==Un)return!1;if(!wt)return kp(t),wt=!0,!1;var s;if((s=t.tag!==3)&&!(s=t.tag!==5)&&(s=t.type,s=s!=="head"&&s!=="body"&&!Ac(t.type,t.memoizedProps)),s&&(s=Bn)){if(zc(t))throw Sp(),Error(r(418));for(;s;)xp(t,s),s=Xs(s.nextSibling)}if(kp(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));e:{for(t=t.nextSibling,s=0;t;){if(t.nodeType===8){var i=t.data;if(i==="/$"){if(s===0){Bn=Xs(t.nextSibling);break e}s--}else i!=="$"&&i!=="$!"&&i!=="$?"||s++}t=t.nextSibling}Bn=null}}else Bn=Un?Xs(t.stateNode.nextSibling):null;return!0}function Sp(){for(var t=Bn;t;)t=Xs(t.nextSibling)}function oo(){Bn=Un=null,wt=!1}function Uc(t){rs===null?rs=[t]:rs.push(t)}var o0=M.ReactCurrentBatchConfig;function ti(t,s,i){if(t=i.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(r(309));var u=i.stateNode}if(!u)throw Error(r(147,t));var p=u,g=""+t;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===g?s.ref:(s=function(w){var _=p.refs;w===null?delete _[g]:_[g]=w},s._stringRef=g,s)}if(typeof t!="string")throw Error(r(284));if(!i._owner)throw Error(r(290,t))}return t}function ka(t,s){throw t=Object.prototype.toString.call(s),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t))}function bp(t){var s=t._init;return s(t._payload)}function Np(t){function s(H,O){if(t){var V=H.deletions;V===null?(H.deletions=[O],H.flags|=16):V.push(O)}}function i(H,O){if(!t)return null;for(;O!==null;)s(H,O),O=O.sibling;return null}function u(H,O){for(H=new Map;O!==null;)O.key!==null?H.set(O.key,O):H.set(O.index,O),O=O.sibling;return H}function p(H,O){return H=ir(H,O),H.index=0,H.sibling=null,H}function g(H,O,V){return H.index=V,t?(V=H.alternate,V!==null?(V=V.index,V<O?(H.flags|=2,O):V):(H.flags|=2,O)):(H.flags|=1048576,O)}function w(H){return t&&H.alternate===null&&(H.flags|=2),H}function _(H,O,V,fe){return O===null||O.tag!==6?(O=Iu(V,H.mode,fe),O.return=H,O):(O=p(O,V),O.return=H,O)}function D(H,O,V,fe){var Ee=V.type;return Ee===z?re(H,O,V.props.children,fe,V.key):O!==null&&(O.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===ie&&bp(Ee)===O.type)?(fe=p(O,V.props),fe.ref=ti(H,O,V),fe.return=H,fe):(fe=Va(V.type,V.key,V.props,null,H.mode,fe),fe.ref=ti(H,O,V),fe.return=H,fe)}function K(H,O,V,fe){return O===null||O.tag!==4||O.stateNode.containerInfo!==V.containerInfo||O.stateNode.implementation!==V.implementation?(O=Du(V,H.mode,fe),O.return=H,O):(O=p(O,V.children||[]),O.return=H,O)}function re(H,O,V,fe,Ee){return O===null||O.tag!==7?(O=Or(V,H.mode,fe,Ee),O.return=H,O):(O=p(O,V),O.return=H,O)}function ae(H,O,V){if(typeof O=="string"&&O!==""||typeof O=="number")return O=Iu(""+O,H.mode,V),O.return=H,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case L:return V=Va(O.type,O.key,O.props,null,H.mode,V),V.ref=ti(H,null,O),V.return=H,V;case G:return O=Du(O,H.mode,V),O.return=H,O;case ie:var fe=O._init;return ae(H,fe(O._payload),V)}if(jt(O)||Z(O))return O=Or(O,H.mode,V,null),O.return=H,O;ka(H,O)}return null}function se(H,O,V,fe){var Ee=O!==null?O.key:null;if(typeof V=="string"&&V!==""||typeof V=="number")return Ee!==null?null:_(H,O,""+V,fe);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case L:return V.key===Ee?D(H,O,V,fe):null;case G:return V.key===Ee?K(H,O,V,fe):null;case ie:return Ee=V._init,se(H,O,Ee(V._payload),fe)}if(jt(V)||Z(V))return Ee!==null?null:re(H,O,V,fe,null);ka(H,V)}return null}function xe(H,O,V,fe,Ee){if(typeof fe=="string"&&fe!==""||typeof fe=="number")return H=H.get(V)||null,_(O,H,""+fe,Ee);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case L:return H=H.get(fe.key===null?V:fe.key)||null,D(O,H,fe,Ee);case G:return H=H.get(fe.key===null?V:fe.key)||null,K(O,H,fe,Ee);case ie:var Le=fe._init;return xe(H,O,V,Le(fe._payload),Ee)}if(jt(fe)||Z(fe))return H=H.get(V)||null,re(O,H,fe,Ee,null);ka(O,fe)}return null}function Ne(H,O,V,fe){for(var Ee=null,Le=null,Oe=O,ze=O=0,Qt=null;Oe!==null&&ze<V.length;ze++){Oe.index>ze?(Qt=Oe,Oe=null):Qt=Oe.sibling;var tt=se(H,Oe,V[ze],fe);if(tt===null){Oe===null&&(Oe=Qt);break}t&&Oe&&tt.alternate===null&&s(H,Oe),O=g(tt,O,ze),Le===null?Ee=tt:Le.sibling=tt,Le=tt,Oe=Qt}if(ze===V.length)return i(H,Oe),wt&&jr(H,ze),Ee;if(Oe===null){for(;ze<V.length;ze++)Oe=ae(H,V[ze],fe),Oe!==null&&(O=g(Oe,O,ze),Le===null?Ee=Oe:Le.sibling=Oe,Le=Oe);return wt&&jr(H,ze),Ee}for(Oe=u(H,Oe);ze<V.length;ze++)Qt=xe(Oe,H,ze,V[ze],fe),Qt!==null&&(t&&Qt.alternate!==null&&Oe.delete(Qt.key===null?ze:Qt.key),O=g(Qt,O,ze),Le===null?Ee=Qt:Le.sibling=Qt,Le=Qt);return t&&Oe.forEach(function(ar){return s(H,ar)}),wt&&jr(H,ze),Ee}function Ce(H,O,V,fe){var Ee=Z(V);if(typeof Ee!="function")throw Error(r(150));if(V=Ee.call(V),V==null)throw Error(r(151));for(var Le=Ee=null,Oe=O,ze=O=0,Qt=null,tt=V.next();Oe!==null&&!tt.done;ze++,tt=V.next()){Oe.index>ze?(Qt=Oe,Oe=null):Qt=Oe.sibling;var ar=se(H,Oe,tt.value,fe);if(ar===null){Oe===null&&(Oe=Qt);break}t&&Oe&&ar.alternate===null&&s(H,Oe),O=g(ar,O,ze),Le===null?Ee=ar:Le.sibling=ar,Le=ar,Oe=Qt}if(tt.done)return i(H,Oe),wt&&jr(H,ze),Ee;if(Oe===null){for(;!tt.done;ze++,tt=V.next())tt=ae(H,tt.value,fe),tt!==null&&(O=g(tt,O,ze),Le===null?Ee=tt:Le.sibling=tt,Le=tt);return wt&&jr(H,ze),Ee}for(Oe=u(H,Oe);!tt.done;ze++,tt=V.next())tt=xe(Oe,H,ze,tt.value,fe),tt!==null&&(t&&tt.alternate!==null&&Oe.delete(tt.key===null?ze:tt.key),O=g(tt,O,ze),Le===null?Ee=tt:Le.sibling=tt,Le=tt);return t&&Oe.forEach(function(P0){return s(H,P0)}),wt&&jr(H,ze),Ee}function Mt(H,O,V,fe){if(typeof V=="object"&&V!==null&&V.type===z&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case L:e:{for(var Ee=V.key,Le=O;Le!==null;){if(Le.key===Ee){if(Ee=V.type,Ee===z){if(Le.tag===7){i(H,Le.sibling),O=p(Le,V.props.children),O.return=H,H=O;break e}}else if(Le.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===ie&&bp(Ee)===Le.type){i(H,Le.sibling),O=p(Le,V.props),O.ref=ti(H,Le,V),O.return=H,H=O;break e}i(H,Le);break}else s(H,Le);Le=Le.sibling}V.type===z?(O=Or(V.props.children,H.mode,fe,V.key),O.return=H,H=O):(fe=Va(V.type,V.key,V.props,null,H.mode,fe),fe.ref=ti(H,O,V),fe.return=H,H=fe)}return w(H);case G:e:{for(Le=V.key;O!==null;){if(O.key===Le)if(O.tag===4&&O.stateNode.containerInfo===V.containerInfo&&O.stateNode.implementation===V.implementation){i(H,O.sibling),O=p(O,V.children||[]),O.return=H,H=O;break e}else{i(H,O);break}else s(H,O);O=O.sibling}O=Du(V,H.mode,fe),O.return=H,H=O}return w(H);case ie:return Le=V._init,Mt(H,O,Le(V._payload),fe)}if(jt(V))return Ne(H,O,V,fe);if(Z(V))return Ce(H,O,V,fe);ka(H,V)}return typeof V=="string"&&V!==""||typeof V=="number"?(V=""+V,O!==null&&O.tag===6?(i(H,O.sibling),O=p(O,V),O.return=H,H=O):(i(H,O),O=Iu(V,H.mode,fe),O.return=H,H=O),w(H)):i(H,O)}return Mt}var io=Np(!0),Tp=Np(!1),Sa=Ys(null),ba=null,ao=null,Bc=null;function Wc(){Bc=ao=ba=null}function Hc(t){var s=Sa.current;ht(Sa),t._currentValue=s}function Vc(t,s,i){for(;t!==null;){var u=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,u!==null&&(u.childLanes|=s)):u!==null&&(u.childLanes&s)!==s&&(u.childLanes|=s),t===i)break;t=t.return}}function lo(t,s){ba=t,Bc=ao=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&s)!==0&&(_n=!0),t.firstContext=null)}function Xn(t){var s=t._currentValue;if(Bc!==t)if(t={context:t,memoizedValue:s,next:null},ao===null){if(ba===null)throw Error(r(308));ao=t,ba.dependencies={lanes:0,firstContext:t}}else ao=ao.next=t;return s}var _r=null;function Kc(t){_r===null?_r=[t]:_r.push(t)}function Cp(t,s,i,u){var p=s.interleaved;return p===null?(i.next=i,Kc(s)):(i.next=p.next,p.next=i),s.interleaved=i,Ms(t,u)}function Ms(t,s){t.lanes|=s;var i=t.alternate;for(i!==null&&(i.lanes|=s),i=t,t=t.return;t!==null;)t.childLanes|=s,i=t.alternate,i!==null&&(i.childLanes|=s),i=t,t=t.return;return i.tag===3?i.stateNode:null}var Js=!1;function Gc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ep(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Ls(t,s){return{eventTime:t,lane:s,tag:0,payload:null,callback:null,next:null}}function er(t,s,i){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(Qe&2)!==0){var p=u.pending;return p===null?s.next=s:(s.next=p.next,p.next=s),u.pending=s,Ms(t,i)}return p=u.interleaved,p===null?(s.next=s,Kc(u)):(s.next=p.next,p.next=s),u.interleaved=s,Ms(t,i)}function Na(t,s,i){if(s=s.updateQueue,s!==null&&(s=s.shared,(i&4194240)!==0)){var u=s.lanes;u&=t.pendingLanes,i|=u,s.lanes=i,Vs(t,i)}}function jp(t,s){var i=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var p=null,g=null;if(i=i.firstBaseUpdate,i!==null){do{var w={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};g===null?p=g=w:g=g.next=w,i=i.next}while(i!==null);g===null?p=g=s:g=g.next=s}else p=g=s;i={baseState:u.baseState,firstBaseUpdate:p,lastBaseUpdate:g,shared:u.shared,effects:u.effects},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=s:t.next=s,i.lastBaseUpdate=s}function Ta(t,s,i,u){var p=t.updateQueue;Js=!1;var g=p.firstBaseUpdate,w=p.lastBaseUpdate,_=p.shared.pending;if(_!==null){p.shared.pending=null;var D=_,K=D.next;D.next=null,w===null?g=K:w.next=K,w=D;var re=t.alternate;re!==null&&(re=re.updateQueue,_=re.lastBaseUpdate,_!==w&&(_===null?re.firstBaseUpdate=K:_.next=K,re.lastBaseUpdate=D))}if(g!==null){var ae=p.baseState;w=0,re=K=D=null,_=g;do{var se=_.lane,xe=_.eventTime;if((u&se)===se){re!==null&&(re=re.next={eventTime:xe,lane:0,tag:_.tag,payload:_.payload,callback:_.callback,next:null});e:{var Ne=t,Ce=_;switch(se=s,xe=i,Ce.tag){case 1:if(Ne=Ce.payload,typeof Ne=="function"){ae=Ne.call(xe,ae,se);break e}ae=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Ce.payload,se=typeof Ne=="function"?Ne.call(xe,ae,se):Ne,se==null)break e;ae=q({},ae,se);break e;case 2:Js=!0}}_.callback!==null&&_.lane!==0&&(t.flags|=64,se=p.effects,se===null?p.effects=[_]:se.push(_))}else xe={eventTime:xe,lane:se,tag:_.tag,payload:_.payload,callback:_.callback,next:null},re===null?(K=re=xe,D=ae):re=re.next=xe,w|=se;if(_=_.next,_===null){if(_=p.shared.pending,_===null)break;se=_,_=se.next,se.next=null,p.lastBaseUpdate=se,p.shared.pending=null}}while(!0);if(re===null&&(D=ae),p.baseState=D,p.firstBaseUpdate=K,p.lastBaseUpdate=re,s=p.shared.interleaved,s!==null){p=s;do w|=p.lane,p=p.next;while(p!==s)}else g===null&&(p.shared.lanes=0);Ir|=w,t.lanes=w,t.memoizedState=ae}}function _p(t,s,i){if(t=s.effects,s.effects=null,t!==null)for(s=0;s<t.length;s++){var u=t[s],p=u.callback;if(p!==null){if(u.callback=null,u=i,typeof p!="function")throw Error(r(191,p));p.call(u)}}}var ni={},ks=Ys(ni),si=Ys(ni),ri=Ys(ni);function Rr(t){if(t===ni)throw Error(r(174));return t}function qc(t,s){switch(ut(ri,s),ut(si,t),ut(ks,ni),t=s.nodeType,t){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:gt(null,"");break;default:t=t===8?s.parentNode:s,s=t.namespaceURI||null,t=t.tagName,s=gt(s,t)}ht(ks),ut(ks,s)}function co(){ht(ks),ht(si),ht(ri)}function Rp(t){Rr(ri.current);var s=Rr(ks.current),i=gt(s,t.type);s!==i&&(ut(si,t),ut(ks,i))}function Xc(t){si.current===t&&(ht(ks),ht(si))}var Ct=Ys(0);function Ca(t){for(var s=t;s!==null;){if(s.tag===13){var i=s.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Yc=[];function Qc(){for(var t=0;t<Yc.length;t++)Yc[t]._workInProgressVersionPrimary=null;Yc.length=0}var Ea=M.ReactCurrentDispatcher,Zc=M.ReactCurrentBatchConfig,Ar=0,Et=null,Bt=null,Xt=null,ja=!1,oi=!1,ii=0,i0=0;function un(){throw Error(r(321))}function Jc(t,s){if(s===null)return!1;for(var i=0;i<s.length&&i<t.length;i++)if(!ss(t[i],s[i]))return!1;return!0}function eu(t,s,i,u,p,g){if(Ar=g,Et=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,Ea.current=t===null||t.memoizedState===null?u0:d0,t=i(u,p),oi){g=0;do{if(oi=!1,ii=0,25<=g)throw Error(r(301));g+=1,Xt=Bt=null,s.updateQueue=null,Ea.current=f0,t=i(u,p)}while(oi)}if(Ea.current=Aa,s=Bt!==null&&Bt.next!==null,Ar=0,Xt=Bt=Et=null,ja=!1,s)throw Error(r(300));return t}function tu(){var t=ii!==0;return ii=0,t}function Ss(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Xt===null?Et.memoizedState=Xt=t:Xt=Xt.next=t,Xt}function Yn(){if(Bt===null){var t=Et.alternate;t=t!==null?t.memoizedState:null}else t=Bt.next;var s=Xt===null?Et.memoizedState:Xt.next;if(s!==null)Xt=s,Bt=t;else{if(t===null)throw Error(r(310));Bt=t,t={memoizedState:Bt.memoizedState,baseState:Bt.baseState,baseQueue:Bt.baseQueue,queue:Bt.queue,next:null},Xt===null?Et.memoizedState=Xt=t:Xt=Xt.next=t}return Xt}function ai(t,s){return typeof s=="function"?s(t):s}function nu(t){var s=Yn(),i=s.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=t;var u=Bt,p=u.baseQueue,g=i.pending;if(g!==null){if(p!==null){var w=p.next;p.next=g.next,g.next=w}u.baseQueue=p=g,i.pending=null}if(p!==null){g=p.next,u=u.baseState;var _=w=null,D=null,K=g;do{var re=K.lane;if((Ar&re)===re)D!==null&&(D=D.next={lane:0,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),u=K.hasEagerState?K.eagerState:t(u,K.action);else{var ae={lane:re,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null};D===null?(_=D=ae,w=u):D=D.next=ae,Et.lanes|=re,Ir|=re}K=K.next}while(K!==null&&K!==g);D===null?w=u:D.next=_,ss(u,s.memoizedState)||(_n=!0),s.memoizedState=u,s.baseState=w,s.baseQueue=D,i.lastRenderedState=u}if(t=i.interleaved,t!==null){p=t;do g=p.lane,Et.lanes|=g,Ir|=g,p=p.next;while(p!==t)}else p===null&&(i.lanes=0);return[s.memoizedState,i.dispatch]}function su(t){var s=Yn(),i=s.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=t;var u=i.dispatch,p=i.pending,g=s.memoizedState;if(p!==null){i.pending=null;var w=p=p.next;do g=t(g,w.action),w=w.next;while(w!==p);ss(g,s.memoizedState)||(_n=!0),s.memoizedState=g,s.baseQueue===null&&(s.baseState=g),i.lastRenderedState=g}return[g,u]}function Ap(){}function Ip(t,s){var i=Et,u=Yn(),p=s(),g=!ss(u.memoizedState,p);if(g&&(u.memoizedState=p,_n=!0),u=u.queue,ru(Lp.bind(null,i,u,t),[t]),u.getSnapshot!==s||g||Xt!==null&&Xt.memoizedState.tag&1){if(i.flags|=2048,li(9,Mp.bind(null,i,u,p,s),void 0,null),Yt===null)throw Error(r(349));(Ar&30)!==0||Dp(i,s,p)}return p}function Dp(t,s,i){t.flags|=16384,t={getSnapshot:s,value:i},s=Et.updateQueue,s===null?(s={lastEffect:null,stores:null},Et.updateQueue=s,s.stores=[t]):(i=s.stores,i===null?s.stores=[t]:i.push(t))}function Mp(t,s,i,u){s.value=i,s.getSnapshot=u,Op(s)&&$p(t)}function Lp(t,s,i){return i(function(){Op(s)&&$p(t)})}function Op(t){var s=t.getSnapshot;t=t.value;try{var i=s();return!ss(t,i)}catch{return!0}}function $p(t){var s=Ms(t,1);s!==null&&ls(s,t,1,-1)}function Pp(t){var s=Ss();return typeof t=="function"&&(t=t()),s.memoizedState=s.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ai,lastRenderedState:t},s.queue=t,t=t.dispatch=c0.bind(null,Et,t),[s.memoizedState,t]}function li(t,s,i,u){return t={tag:t,create:s,destroy:i,deps:u,next:null},s=Et.updateQueue,s===null?(s={lastEffect:null,stores:null},Et.updateQueue=s,s.lastEffect=t.next=t):(i=s.lastEffect,i===null?s.lastEffect=t.next=t:(u=i.next,i.next=t,t.next=u,s.lastEffect=t)),t}function zp(){return Yn().memoizedState}function _a(t,s,i,u){var p=Ss();Et.flags|=t,p.memoizedState=li(1|s,i,void 0,u===void 0?null:u)}function Ra(t,s,i,u){var p=Yn();u=u===void 0?null:u;var g=void 0;if(Bt!==null){var w=Bt.memoizedState;if(g=w.destroy,u!==null&&Jc(u,w.deps)){p.memoizedState=li(s,i,g,u);return}}Et.flags|=t,p.memoizedState=li(1|s,i,g,u)}function Fp(t,s){return _a(8390656,8,t,s)}function ru(t,s){return Ra(2048,8,t,s)}function Up(t,s){return Ra(4,2,t,s)}function Bp(t,s){return Ra(4,4,t,s)}function Wp(t,s){if(typeof s=="function")return t=t(),s(t),function(){s(null)};if(s!=null)return t=t(),s.current=t,function(){s.current=null}}function Hp(t,s,i){return i=i!=null?i.concat([t]):null,Ra(4,4,Wp.bind(null,s,t),i)}function ou(){}function Vp(t,s){var i=Yn();s=s===void 0?null:s;var u=i.memoizedState;return u!==null&&s!==null&&Jc(s,u[1])?u[0]:(i.memoizedState=[t,s],t)}function Kp(t,s){var i=Yn();s=s===void 0?null:s;var u=i.memoizedState;return u!==null&&s!==null&&Jc(s,u[1])?u[0]:(t=t(),i.memoizedState=[t,s],t)}function Gp(t,s,i){return(Ar&21)===0?(t.baseState&&(t.baseState=!1,_n=!0),t.memoizedState=i):(ss(i,s)||(i=Po(),Et.lanes|=i,Ir|=i,t.baseState=!0),s)}function a0(t,s){var i=Xe;Xe=i!==0&&4>i?i:4,t(!0);var u=Zc.transition;Zc.transition={};try{t(!1),s()}finally{Xe=i,Zc.transition=u}}function qp(){return Yn().memoizedState}function l0(t,s,i){var u=rr(t);if(i={lane:u,action:i,hasEagerState:!1,eagerState:null,next:null},Xp(t))Yp(s,i);else if(i=Cp(t,s,i,u),i!==null){var p=Sn();ls(i,t,u,p),Qp(i,s,u)}}function c0(t,s,i){var u=rr(t),p={lane:u,action:i,hasEagerState:!1,eagerState:null,next:null};if(Xp(t))Yp(s,p);else{var g=t.alternate;if(t.lanes===0&&(g===null||g.lanes===0)&&(g=s.lastRenderedReducer,g!==null))try{var w=s.lastRenderedState,_=g(w,i);if(p.hasEagerState=!0,p.eagerState=_,ss(_,w)){var D=s.interleaved;D===null?(p.next=p,Kc(s)):(p.next=D.next,D.next=p),s.interleaved=p;return}}catch{}finally{}i=Cp(t,s,p,u),i!==null&&(p=Sn(),ls(i,t,u,p),Qp(i,s,u))}}function Xp(t){var s=t.alternate;return t===Et||s!==null&&s===Et}function Yp(t,s){oi=ja=!0;var i=t.pending;i===null?s.next=s:(s.next=i.next,i.next=s),t.pending=s}function Qp(t,s,i){if((i&4194240)!==0){var u=s.lanes;u&=t.pendingLanes,i|=u,s.lanes=i,Vs(t,i)}}var Aa={readContext:Xn,useCallback:un,useContext:un,useEffect:un,useImperativeHandle:un,useInsertionEffect:un,useLayoutEffect:un,useMemo:un,useReducer:un,useRef:un,useState:un,useDebugValue:un,useDeferredValue:un,useTransition:un,useMutableSource:un,useSyncExternalStore:un,useId:un,unstable_isNewReconciler:!1},u0={readContext:Xn,useCallback:function(t,s){return Ss().memoizedState=[t,s===void 0?null:s],t},useContext:Xn,useEffect:Fp,useImperativeHandle:function(t,s,i){return i=i!=null?i.concat([t]):null,_a(4194308,4,Wp.bind(null,s,t),i)},useLayoutEffect:function(t,s){return _a(4194308,4,t,s)},useInsertionEffect:function(t,s){return _a(4,2,t,s)},useMemo:function(t,s){var i=Ss();return s=s===void 0?null:s,t=t(),i.memoizedState=[t,s],t},useReducer:function(t,s,i){var u=Ss();return s=i!==void 0?i(s):s,u.memoizedState=u.baseState=s,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:s},u.queue=t,t=t.dispatch=l0.bind(null,Et,t),[u.memoizedState,t]},useRef:function(t){var s=Ss();return t={current:t},s.memoizedState=t},useState:Pp,useDebugValue:ou,useDeferredValue:function(t){return Ss().memoizedState=t},useTransition:function(){var t=Pp(!1),s=t[0];return t=a0.bind(null,t[1]),Ss().memoizedState=t,[s,t]},useMutableSource:function(){},useSyncExternalStore:function(t,s,i){var u=Et,p=Ss();if(wt){if(i===void 0)throw Error(r(407));i=i()}else{if(i=s(),Yt===null)throw Error(r(349));(Ar&30)!==0||Dp(u,s,i)}p.memoizedState=i;var g={value:i,getSnapshot:s};return p.queue=g,Fp(Lp.bind(null,u,g,t),[t]),u.flags|=2048,li(9,Mp.bind(null,u,g,i,s),void 0,null),i},useId:function(){var t=Ss(),s=Yt.identifierPrefix;if(wt){var i=Ds,u=Is;i=(u&~(1<<32-xn(u)-1)).toString(32)+i,s=":"+s+"R"+i,i=ii++,0<i&&(s+="H"+i.toString(32)),s+=":"}else i=i0++,s=":"+s+"r"+i.toString(32)+":";return t.memoizedState=s},unstable_isNewReconciler:!1},d0={readContext:Xn,useCallback:Vp,useContext:Xn,useEffect:ru,useImperativeHandle:Hp,useInsertionEffect:Up,useLayoutEffect:Bp,useMemo:Kp,useReducer:nu,useRef:zp,useState:function(){return nu(ai)},useDebugValue:ou,useDeferredValue:function(t){var s=Yn();return Gp(s,Bt.memoizedState,t)},useTransition:function(){var t=nu(ai)[0],s=Yn().memoizedState;return[t,s]},useMutableSource:Ap,useSyncExternalStore:Ip,useId:qp,unstable_isNewReconciler:!1},f0={readContext:Xn,useCallback:Vp,useContext:Xn,useEffect:ru,useImperativeHandle:Hp,useInsertionEffect:Up,useLayoutEffect:Bp,useMemo:Kp,useReducer:su,useRef:zp,useState:function(){return su(ai)},useDebugValue:ou,useDeferredValue:function(t){var s=Yn();return Bt===null?s.memoizedState=t:Gp(s,Bt.memoizedState,t)},useTransition:function(){var t=su(ai)[0],s=Yn().memoizedState;return[t,s]},useMutableSource:Ap,useSyncExternalStore:Ip,useId:qp,unstable_isNewReconciler:!1};function os(t,s){if(t&&t.defaultProps){s=q({},s),t=t.defaultProps;for(var i in t)s[i]===void 0&&(s[i]=t[i]);return s}return s}function iu(t,s,i,u){s=t.memoizedState,i=i(u,s),i=i==null?s:q({},s,i),t.memoizedState=i,t.lanes===0&&(t.updateQueue.baseState=i)}var Ia={isMounted:function(t){return(t=t._reactInternals)?We(t)===t:!1},enqueueSetState:function(t,s,i){t=t._reactInternals;var u=Sn(),p=rr(t),g=Ls(u,p);g.payload=s,i!=null&&(g.callback=i),s=er(t,g,p),s!==null&&(ls(s,t,p,u),Na(s,t,p))},enqueueReplaceState:function(t,s,i){t=t._reactInternals;var u=Sn(),p=rr(t),g=Ls(u,p);g.tag=1,g.payload=s,i!=null&&(g.callback=i),s=er(t,g,p),s!==null&&(ls(s,t,p,u),Na(s,t,p))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var i=Sn(),u=rr(t),p=Ls(i,u);p.tag=2,s!=null&&(p.callback=s),s=er(t,p,u),s!==null&&(ls(s,t,u,i),Na(s,t,u))}};function Zp(t,s,i,u,p,g,w){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,g,w):s.prototype&&s.prototype.isPureReactComponent?!qo(i,u)||!qo(p,g):!0}function Jp(t,s,i){var u=!1,p=Qs,g=s.contextType;return typeof g=="object"&&g!==null?g=Xn(g):(p=jn(s)?Cr:cn.current,u=s.contextTypes,g=(u=u!=null)?no(t,p):Qs),s=new s(i,g),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Ia,t.stateNode=s,s._reactInternals=t,u&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=p,t.__reactInternalMemoizedMaskedChildContext=g),s}function eh(t,s,i,u){t=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(i,u),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(i,u),s.state!==t&&Ia.enqueueReplaceState(s,s.state,null)}function au(t,s,i,u){var p=t.stateNode;p.props=i,p.state=t.memoizedState,p.refs={},Gc(t);var g=s.contextType;typeof g=="object"&&g!==null?p.context=Xn(g):(g=jn(s)?Cr:cn.current,p.context=no(t,g)),p.state=t.memoizedState,g=s.getDerivedStateFromProps,typeof g=="function"&&(iu(t,s,g,i),p.state=t.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(s=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),s!==p.state&&Ia.enqueueReplaceState(p,p.state,null),Ta(t,i,p,u),p.state=t.memoizedState),typeof p.componentDidMount=="function"&&(t.flags|=4194308)}function uo(t,s){try{var i="",u=s;do i+=X(u),u=u.return;while(u);var p=i}catch(g){p=`
38
+ `+p[w].replace(" at new "," at ");return t.displayName&&D.includes("<anonymous>")&&(D=D.replace("<anonymous>",t.displayName)),D}while(1<=w&&0<=_);break}}}finally{ue=!1,Error.prepareStackTrace=i}return(t=t?t.displayName||t.name:"")?$(t):""}function X(t){switch(t.tag){case 5:return $(t.type);case 16:return $("Lazy");case 13:return $("Suspense");case 19:return $("SuspenseList");case 0:case 2:case 15:return t=B(t.type,!1),t;case 11:return t=B(t.type.render,!1),t;case 1:return t=B(t.type,!0),t;default:return""}}function ce(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case z:return"Fragment";case G:return"Portal";case Q:return"Profiler";case U:return"StrictMode";case Se:return"Suspense";case Me:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case oe:return(t.displayName||"Context")+".Consumer";case J:return(t._context.displayName||"Context")+".Provider";case me:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case ee:return s=t.displayName||null,s!==null?s:ce(t.type)||"Memo";case ie:s=t._payload,t=t._init;try{return ce(t(s))}catch{}}return null}function be(t){var s=t.type;switch(t.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=s.render,t=t.displayName||t.name||"",s.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ce(s);case 8:return s===U?"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 s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function _e(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Ae(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function je(t){var s=Ae(t)?"checked":"value",i=Object.getOwnPropertyDescriptor(t.constructor.prototype,s),u=""+t[s];if(!t.hasOwnProperty(s)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var p=i.get,g=i.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return p.call(this)},set:function(w){u=""+w,g.call(this,w)}}),Object.defineProperty(t,s,{enumerable:i.enumerable}),{getValue:function(){return u},setValue:function(w){u=""+w},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function ge(t){t._valueTracker||(t._valueTracker=je(t))}function he(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var i=s.getValue(),u="";return t&&(u=Ae(t)?t.checked?"true":"false":t.value),t=u,t!==i?(s.setValue(t),!0):!1}function Ve(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Ie(t,s){var i=s.checked;return q({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??t._wrapperState.initialChecked})}function mt(t,s){var i=s.defaultValue==null?"":s.defaultValue,u=s.checked!=null?s.checked:s.defaultChecked;i=_e(s.value!=null?s.value:i),t._wrapperState={initialChecked:u,initialValue:i,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function Ue(t,s){s=s.checked,s!=null&&P(t,"checked",s,!1)}function Vt(t,s){Ue(t,s);var i=_e(s.value),u=s.type;if(i!=null)u==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+i):t.value!==""+i&&(t.value=""+i);else if(u==="submit"||u==="reset"){t.removeAttribute("value");return}s.hasOwnProperty("value")?St(t,s.type,i):s.hasOwnProperty("defaultValue")&&St(t,s.type,_e(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(t.defaultChecked=!!s.defaultChecked)}function tn(t,s,i){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var u=s.type;if(!(u!=="submit"&&u!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+t._wrapperState.initialValue,i||s===t.value||(t.value=s),t.defaultValue=s}i=t.name,i!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,i!==""&&(t.name=i)}function St(t,s,i){(s!=="number"||Ve(t.ownerDocument)!==t)&&(i==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+i&&(t.defaultValue=""+i))}var jt=Array.isArray;function Ft(t,s,i,u){if(t=t.options,s){s={};for(var p=0;p<i.length;p++)s["$"+i[p]]=!0;for(i=0;i<t.length;i++)p=s.hasOwnProperty("$"+t[i].value),t[i].selected!==p&&(t[i].selected=p),p&&u&&(t[i].defaultSelected=!0)}else{for(i=""+_e(i),s=null,p=0;p<t.length;p++){if(t[p].value===i){t[p].selected=!0,u&&(t[p].defaultSelected=!0);return}s!==null||t[p].disabled||(s=t[p])}s!==null&&(s.selected=!0)}}function Ot(t,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return q({},s,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Y(t,s){var i=s.value;if(i==null){if(i=s.children,s=s.defaultValue,i!=null){if(s!=null)throw Error(r(92));if(jt(i)){if(1<i.length)throw Error(r(93));i=i[0]}s=i}s==null&&(s=""),i=s}t._wrapperState={initialValue:_e(i)}}function ve(t,s){var i=_e(s.value),u=_e(s.defaultValue);i!=null&&(i=""+i,i!==t.value&&(t.value=i),s.defaultValue==null&&t.defaultValue!==i&&(t.defaultValue=i)),u!=null&&(t.defaultValue=""+u)}function Be(t){var s=t.textContent;s===t._wrapperState.initialValue&&s!==""&&s!==null&&(t.value=s)}function rt(t){switch(t){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 gt(t,s){return t==null||t==="http://www.w3.org/1999/xhtml"?rt(s):t==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var vt,_t=(function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,i,u,p){MSApp.execUnsafeLocalFunction(function(){return t(s,i,u,p)})}:t})(function(t,s){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=s;else{for(vt=vt||document.createElement("div"),vt.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=vt.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;s.firstChild;)t.appendChild(s.firstChild)}});function an(t,s){if(s){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=s;return}}t.textContent=s}var dt={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},Mn=["Webkit","ms","Moz","O"];Object.keys(dt).forEach(function(t){Mn.forEach(function(s){s=s+t.charAt(0).toUpperCase()+t.substring(1),dt[s]=dt[t]})});function Ln(t,s,i){return s==null||typeof s=="boolean"||s===""?"":i||typeof s!="number"||s===0||dt.hasOwnProperty(t)&&dt[t]?(""+s).trim():s+"px"}function ms(t,s){t=t.style;for(var i in s)if(s.hasOwnProperty(i)){var u=i.indexOf("--")===0,p=Ln(i,s[i],u);i==="float"&&(i="cssFloat"),u?t.setProperty(i,p):t[i]=p}}var gs=q({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 ns(t,s){if(s){if(gs[t]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(r(137,t));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(r(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(r(61))}if(s.style!=null&&typeof s.style!="object")throw Error(r(62))}}function On(t,s){if(t.indexOf("-")===-1)return typeof s.is=="string";switch(t){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 gn=null;function ln(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Kt=null,vn=null,Ze=null;function Rt(t){if(t=ei(t)){if(typeof Kt!="function")throw Error(r(280));var s=t.stateNode;s&&(s=ha(s),Kt(t.stateNode,t.type,s))}}function ft(t){vn?Ze?Ze.push(t):Ze=[t]:vn=t}function Gt(){if(vn){var t=vn,s=Ze;if(Ze=vn=null,Rt(t),s)for(t=0;t<s.length;t++)Rt(s[t])}}function yt(t,s){return t(s)}function xt(){}var lt=!1;function qt(t,s,i){if(lt)return t(s,i);lt=!0;try{return yt(t,s,i)}finally{lt=!1,(vn!==null||Ze!==null)&&(xt(),Gt())}}function it(t,s){var i=t.stateNode;if(i===null)return null;var u=ha(i);if(u===null)return null;i=u[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(i&&typeof i!="function")throw Error(r(231,s,typeof i));return i}var $t=!1;if(f)try{var R={};Object.defineProperty(R,"passive",{get:function(){$t=!0}}),window.addEventListener("test",R,R),window.removeEventListener("test",R,R)}catch{$t=!1}function pe(t,s,i,u,p,g,w,_,D){var K=Array.prototype.slice.call(arguments,3);try{s.apply(i,K)}catch(re){this.onError(re)}}var le=!1,we=null,$e=!1,qe=null,Pe={onError:function(t){le=!0,we=t}};function Ut(t,s,i,u,p,g,w,_,D){le=!1,we=null,pe.apply(Pe,arguments)}function $n(t,s,i,u,p,g,w,_,D){if(Ut.apply(this,arguments),le){if(le){var K=we;le=!1,we=null}else throw Error(r(198));$e||($e=!0,qe=K)}}function We(t){var s=t,i=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(i=s.return),t=s.return;while(t)}return s.tag===3?i:null}function yn(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function js(t){if(We(t)!==t)throw Error(r(188))}function Bs(t){var s=t.alternate;if(!s){if(s=We(t),s===null)throw Error(r(188));return s!==t?null:t}for(var i=t,u=s;;){var p=i.return;if(p===null)break;var g=p.alternate;if(g===null){if(u=p.return,u!==null){i=u;continue}break}if(p.child===g.child){for(g=p.child;g;){if(g===i)return js(p),t;if(g===u)return js(p),s;g=g.sibling}throw Error(r(188))}if(i.return!==u.return)i=p,u=g;else{for(var w=!1,_=p.child;_;){if(_===i){w=!0,i=p,u=g;break}if(_===u){w=!0,u=p,i=g;break}_=_.sibling}if(!w){for(_=g.child;_;){if(_===i){w=!0,i=g,u=p;break}if(_===u){w=!0,u=g,i=p;break}_=_.sibling}if(!w)throw Error(r(189))}}if(i.alternate!==u)throw Error(r(190))}if(i.tag!==3)throw Error(r(188));return i.stateNode.current===i?t:s}function Pn(t){return t=Bs(t),t!==null?vs(t):null}function vs(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var s=vs(t);if(s!==null)return s;t=t.sibling}return null}var Je=n.unstable_scheduleCallback,At=n.unstable_cancelCallback,ys=n.unstable_shouldYield,uc=n.unstable_requestPaint,bt=n.unstable_now,xs=n.unstable_getCurrentPriorityLevel,Ws=n.unstable_ImmediatePriority,ws=n.unstable_UserBlockingPriority,Wr=n.unstable_NormalPriority,xr=n.unstable_LowPriority,Yi=n.unstable_IdlePriority,wr=null,zn=null;function Hr(t){if(zn&&typeof zn.onCommitFiberRoot=="function")try{zn.onCommitFiberRoot(wr,t,void 0,(t.current.flags&128)===128)}catch{}}var xn=Math.clz32?Math.clz32:kr,Vr=Math.log,Hs=Math.LN2;function kr(t){return t>>>=0,t===0?32:31-(Vr(t)/Hs|0)|0}var wn=64,Kr=4194304;function Sr(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function br(t,s){var i=t.pendingLanes;if(i===0)return 0;var u=0,p=t.suspendedLanes,g=t.pingedLanes,w=i&268435455;if(w!==0){var _=w&~p;_!==0?u=Sr(_):(g&=w,g!==0&&(u=Sr(g)))}else w=i&~p,w!==0?u=Sr(w):g!==0&&(u=Sr(g));if(u===0)return 0;if(s!==0&&s!==u&&(s&p)===0&&(p=u&-u,g=s&-s,p>=g||p===16&&(g&4194240)!==0))return s;if((u&4)!==0&&(u|=i&16),s=t.entangledLanes,s!==0)for(t=t.entanglements,s&=u;0<s;)i=31-xn(s),p=1<<i,u|=t[i],s&=~p;return u}function Qi(t,s){switch(t){case 1:case 2:case 4:return s+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 s+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 Zi(t,s){for(var i=t.suspendedLanes,u=t.pingedLanes,p=t.expirationTimes,g=t.pendingLanes;0<g;){var w=31-xn(g),_=1<<w,D=p[w];D===-1?((_&i)===0||(_&u)!==0)&&(p[w]=Qi(_,s)):D<=s&&(t.expiredLanes|=_),g&=~_}}function $o(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Po(){var t=wn;return wn<<=1,(wn&4194240)===0&&(wn=64),t}function zo(t){for(var s=[],i=0;31>i;i++)s.push(t);return s}function Nr(t,s,i){t.pendingLanes|=s,s!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,s=31-xn(s),t[s]=i}function Ji(t,s){var i=t.pendingLanes&~s;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=s,t.mutableReadLanes&=s,t.entangledLanes&=s,s=t.entanglements;var u=t.eventTimes;for(t=t.expirationTimes;0<i;){var p=31-xn(i),g=1<<p;s[p]=0,u[p]=-1,t[p]=-1,i&=~g}}function Vs(t,s){var i=t.entangledLanes|=s;for(t=t.entanglements;i;){var u=31-xn(i),p=1<<u;p&s|t[u]&s&&(t[u]|=s),i&=~p}}var Xe=0;function de(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var N,W,ne,Te,Re,Fe=!1,Ye=[],et=null,Nt=null,Tt=null,_s=new Map,Dt=new Map,Ks=[],ax="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 _f(t,s){switch(t){case"focusin":case"focusout":et=null;break;case"dragenter":case"dragleave":Nt=null;break;case"mouseover":case"mouseout":Tt=null;break;case"pointerover":case"pointerout":_s.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Dt.delete(s.pointerId)}}function Fo(t,s,i,u,p,g){return t===null||t.nativeEvent!==g?(t={blockedOn:s,domEventName:i,eventSystemFlags:u,nativeEvent:g,targetContainers:[p]},s!==null&&(s=ei(s),s!==null&&W(s)),t):(t.eventSystemFlags|=u,s=t.targetContainers,p!==null&&s.indexOf(p)===-1&&s.push(p),t)}function lx(t,s,i,u,p){switch(s){case"focusin":return et=Fo(et,t,s,i,u,p),!0;case"dragenter":return Nt=Fo(Nt,t,s,i,u,p),!0;case"mouseover":return Tt=Fo(Tt,t,s,i,u,p),!0;case"pointerover":var g=p.pointerId;return _s.set(g,Fo(_s.get(g)||null,t,s,i,u,p)),!0;case"gotpointercapture":return g=p.pointerId,Dt.set(g,Fo(Dt.get(g)||null,t,s,i,u,p)),!0}return!1}function Rf(t){var s=Tr(t.target);if(s!==null){var i=We(s);if(i!==null){if(s=i.tag,s===13){if(s=yn(i),s!==null){t.blockedOn=s,Re(t.priority,function(){ne(i)});return}}else if(s===3&&i.stateNode.current.memoizedState.isDehydrated){t.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}t.blockedOn=null}function ea(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var i=fc(t.domEventName,t.eventSystemFlags,s[0],t.nativeEvent);if(i===null){i=t.nativeEvent;var u=new i.constructor(i.type,i);gn=u,i.target.dispatchEvent(u),gn=null}else return s=ei(i),s!==null&&W(s),t.blockedOn=i,!1;s.shift()}return!0}function Af(t,s,i){ea(t)&&i.delete(s)}function cx(){Fe=!1,et!==null&&ea(et)&&(et=null),Nt!==null&&ea(Nt)&&(Nt=null),Tt!==null&&ea(Tt)&&(Tt=null),_s.forEach(Af),Dt.forEach(Af)}function Uo(t,s){t.blockedOn===s&&(t.blockedOn=null,Fe||(Fe=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,cx)))}function Bo(t){function s(p){return Uo(p,t)}if(0<Ye.length){Uo(Ye[0],t);for(var i=1;i<Ye.length;i++){var u=Ye[i];u.blockedOn===t&&(u.blockedOn=null)}}for(et!==null&&Uo(et,t),Nt!==null&&Uo(Nt,t),Tt!==null&&Uo(Tt,t),_s.forEach(s),Dt.forEach(s),i=0;i<Ks.length;i++)u=Ks[i],u.blockedOn===t&&(u.blockedOn=null);for(;0<Ks.length&&(i=Ks[0],i.blockedOn===null);)Rf(i),i.blockedOn===null&&Ks.shift()}var Gr=M.ReactCurrentBatchConfig,ta=!0;function ux(t,s,i,u){var p=Xe,g=Gr.transition;Gr.transition=null;try{Xe=1,dc(t,s,i,u)}finally{Xe=p,Gr.transition=g}}function dx(t,s,i,u){var p=Xe,g=Gr.transition;Gr.transition=null;try{Xe=4,dc(t,s,i,u)}finally{Xe=p,Gr.transition=g}}function dc(t,s,i,u){if(ta){var p=fc(t,s,i,u);if(p===null)_c(t,s,u,na,i),_f(t,u);else if(lx(p,t,s,i,u))u.stopPropagation();else if(_f(t,u),s&4&&-1<ax.indexOf(t)){for(;p!==null;){var g=ei(p);if(g!==null&&N(g),g=fc(t,s,i,u),g===null&&_c(t,s,u,na,i),g===p)break;p=g}p!==null&&u.stopPropagation()}else _c(t,s,u,null,i)}}var na=null;function fc(t,s,i,u){if(na=null,t=ln(u),t=Tr(t),t!==null)if(s=We(t),s===null)t=null;else if(i=s.tag,i===13){if(t=yn(s),t!==null)return t;t=null}else if(i===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null);return na=t,null}function If(t){switch(t){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(xs()){case Ws:return 1;case ws:return 4;case Wr:case xr:return 16;case Yi:return 536870912;default:return 16}default:return 16}}var Gs=null,pc=null,sa=null;function Df(){if(sa)return sa;var t,s=pc,i=s.length,u,p="value"in Gs?Gs.value:Gs.textContent,g=p.length;for(t=0;t<i&&s[t]===p[t];t++);var w=i-t;for(u=1;u<=w&&s[i-u]===p[g-u];u++);return sa=p.slice(t,1<u?1-u:void 0)}function ra(t){var s=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function oa(){return!0}function Mf(){return!1}function Fn(t){function s(i,u,p,g,w){this._reactName=i,this._targetInst=p,this.type=u,this.nativeEvent=g,this.target=w,this.currentTarget=null;for(var _ in t)t.hasOwnProperty(_)&&(i=t[_],this[_]=i?i(g):g[_]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?oa:Mf,this.isPropagationStopped=Mf,this}return q(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=oa)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=oa)},persist:function(){},isPersistent:oa}),s}var qr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hc=Fn(qr),Wo=q({},qr,{view:0,detail:0}),fx=Fn(Wo),mc,gc,Ho,ia=q({},Wo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:yc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Ho&&(Ho&&t.type==="mousemove"?(mc=t.screenX-Ho.screenX,gc=t.screenY-Ho.screenY):gc=mc=0,Ho=t),mc)},movementY:function(t){return"movementY"in t?t.movementY:gc}}),Lf=Fn(ia),px=q({},ia,{dataTransfer:0}),hx=Fn(px),mx=q({},Wo,{relatedTarget:0}),vc=Fn(mx),gx=q({},qr,{animationName:0,elapsedTime:0,pseudoElement:0}),vx=Fn(gx),yx=q({},qr,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),xx=Fn(yx),wx=q({},qr,{data:0}),Of=Fn(wx),kx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Sx={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"},bx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Nx(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=bx[t])?!!s[t]:!1}function yc(){return Nx}var Tx=q({},Wo,{key:function(t){if(t.key){var s=kx[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=ra(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Sx[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:yc,charCode:function(t){return t.type==="keypress"?ra(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?ra(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Cx=Fn(Tx),Ex=q({},ia,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$f=Fn(Ex),jx=q({},Wo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:yc}),_x=Fn(jx),Rx=q({},qr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ax=Fn(Rx),Ix=q({},ia,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Dx=Fn(Ix),Mx=[9,13,27,32],xc=f&&"CompositionEvent"in window,Vo=null;f&&"documentMode"in document&&(Vo=document.documentMode);var Lx=f&&"TextEvent"in window&&!Vo,Pf=f&&(!xc||Vo&&8<Vo&&11>=Vo),zf=" ",Ff=!1;function Uf(t,s){switch(t){case"keyup":return Mx.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Xr=!1;function Ox(t,s){switch(t){case"compositionend":return Bf(s);case"keypress":return s.which!==32?null:(Ff=!0,zf);case"textInput":return t=s.data,t===zf&&Ff?null:t;default:return null}}function $x(t,s){if(Xr)return t==="compositionend"||!xc&&Uf(t,s)?(t=Df(),sa=pc=Gs=null,Xr=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Pf&&s.locale!=="ko"?null:s.data;default:return null}}var Px={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 Wf(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!Px[t.type]:s==="textarea"}function Hf(t,s,i,u){ft(u),s=da(s,"onChange"),0<s.length&&(i=new hc("onChange","change",null,i,u),t.push({event:i,listeners:s}))}var Ko=null,Go=null;function zx(t){lp(t,0)}function aa(t){var s=eo(t);if(he(s))return t}function Fx(t,s){if(t==="change")return s}var Vf=!1;if(f){var wc;if(f){var kc="oninput"in document;if(!kc){var Kf=document.createElement("div");Kf.setAttribute("oninput","return;"),kc=typeof Kf.oninput=="function"}wc=kc}else wc=!1;Vf=wc&&(!document.documentMode||9<document.documentMode)}function Gf(){Ko&&(Ko.detachEvent("onpropertychange",qf),Go=Ko=null)}function qf(t){if(t.propertyName==="value"&&aa(Go)){var s=[];Hf(s,Go,t,ln(t)),qt(zx,s)}}function Ux(t,s,i){t==="focusin"?(Gf(),Ko=s,Go=i,Ko.attachEvent("onpropertychange",qf)):t==="focusout"&&Gf()}function Bx(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return aa(Go)}function Wx(t,s){if(t==="click")return aa(s)}function Hx(t,s){if(t==="input"||t==="change")return aa(s)}function Vx(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var ss=typeof Object.is=="function"?Object.is:Vx;function qo(t,s){if(ss(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var i=Object.keys(t),u=Object.keys(s);if(i.length!==u.length)return!1;for(u=0;u<i.length;u++){var p=i[u];if(!h.call(s,p)||!ss(t[p],s[p]))return!1}return!0}function Xf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Yf(t,s){var i=Xf(t);t=0;for(var u;i;){if(i.nodeType===3){if(u=t+i.textContent.length,t<=s&&u>=s)return{node:i,offset:s-t};t=u}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Xf(i)}}function Qf(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?Qf(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function Zf(){for(var t=window,s=Ve();s instanceof t.HTMLIFrameElement;){try{var i=typeof s.contentWindow.location.href=="string"}catch{i=!1}if(i)t=s.contentWindow;else break;s=Ve(t.document)}return s}function Sc(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}function Kx(t){var s=Zf(),i=t.focusedElem,u=t.selectionRange;if(s!==i&&i&&i.ownerDocument&&Qf(i.ownerDocument.documentElement,i)){if(u!==null&&Sc(i)){if(s=u.start,t=u.end,t===void 0&&(t=s),"selectionStart"in i)i.selectionStart=s,i.selectionEnd=Math.min(t,i.value.length);else if(t=(s=i.ownerDocument||document)&&s.defaultView||window,t.getSelection){t=t.getSelection();var p=i.textContent.length,g=Math.min(u.start,p);u=u.end===void 0?g:Math.min(u.end,p),!t.extend&&g>u&&(p=u,u=g,g=p),p=Yf(i,g);var w=Yf(i,u);p&&w&&(t.rangeCount!==1||t.anchorNode!==p.node||t.anchorOffset!==p.offset||t.focusNode!==w.node||t.focusOffset!==w.offset)&&(s=s.createRange(),s.setStart(p.node,p.offset),t.removeAllRanges(),g>u?(t.addRange(s),t.extend(w.node,w.offset)):(s.setEnd(w.node,w.offset),t.addRange(s)))}}for(s=[],t=i;t=t.parentNode;)t.nodeType===1&&s.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<s.length;i++)t=s[i],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var Gx=f&&"documentMode"in document&&11>=document.documentMode,Yr=null,bc=null,Xo=null,Nc=!1;function Jf(t,s,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Nc||Yr==null||Yr!==Ve(u)||(u=Yr,"selectionStart"in u&&Sc(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Xo&&qo(Xo,u)||(Xo=u,u=da(bc,"onSelect"),0<u.length&&(s=new hc("onSelect","select",null,s,i),t.push({event:s,listeners:u}),s.target=Yr)))}function la(t,s){var i={};return i[t.toLowerCase()]=s.toLowerCase(),i["Webkit"+t]="webkit"+s,i["Moz"+t]="moz"+s,i}var Qr={animationend:la("Animation","AnimationEnd"),animationiteration:la("Animation","AnimationIteration"),animationstart:la("Animation","AnimationStart"),transitionend:la("Transition","TransitionEnd")},Tc={},ep={};f&&(ep=document.createElement("div").style,"AnimationEvent"in window||(delete Qr.animationend.animation,delete Qr.animationiteration.animation,delete Qr.animationstart.animation),"TransitionEvent"in window||delete Qr.transitionend.transition);function ca(t){if(Tc[t])return Tc[t];if(!Qr[t])return t;var s=Qr[t],i;for(i in s)if(s.hasOwnProperty(i)&&i in ep)return Tc[t]=s[i];return t}var tp=ca("animationend"),np=ca("animationiteration"),sp=ca("animationstart"),rp=ca("transitionend"),op=new Map,ip="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 qs(t,s){op.set(t,s),c(s,[t])}for(var Cc=0;Cc<ip.length;Cc++){var Ec=ip[Cc],qx=Ec.toLowerCase(),Xx=Ec[0].toUpperCase()+Ec.slice(1);qs(qx,"on"+Xx)}qs(tp,"onAnimationEnd"),qs(np,"onAnimationIteration"),qs(sp,"onAnimationStart"),qs("dblclick","onDoubleClick"),qs("focusin","onFocus"),qs("focusout","onBlur"),qs(rp,"onTransitionEnd"),d("onMouseEnter",["mouseout","mouseover"]),d("onMouseLeave",["mouseout","mouseover"]),d("onPointerEnter",["pointerout","pointerover"]),d("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Yo="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(" "),Yx=new Set("cancel close invalid load scroll toggle".split(" ").concat(Yo));function ap(t,s,i){var u=t.type||"unknown-event";t.currentTarget=i,$n(u,s,void 0,t),t.currentTarget=null}function lp(t,s){s=(s&4)!==0;for(var i=0;i<t.length;i++){var u=t[i],p=u.event;u=u.listeners;e:{var g=void 0;if(s)for(var w=u.length-1;0<=w;w--){var _=u[w],D=_.instance,K=_.currentTarget;if(_=_.listener,D!==g&&p.isPropagationStopped())break e;ap(p,_,K),g=D}else for(w=0;w<u.length;w++){if(_=u[w],D=_.instance,K=_.currentTarget,_=_.listener,D!==g&&p.isPropagationStopped())break e;ap(p,_,K),g=D}}}if($e)throw t=qe,$e=!1,qe=null,t}function pt(t,s){var i=s[Lc];i===void 0&&(i=s[Lc]=new Set);var u=t+"__bubble";i.has(u)||(cp(s,t,2,!1),i.add(u))}function jc(t,s,i){var u=0;s&&(u|=4),cp(i,t,u,s)}var ua="_reactListening"+Math.random().toString(36).slice(2);function Qo(t){if(!t[ua]){t[ua]=!0,o.forEach(function(i){i!=="selectionchange"&&(Yx.has(i)||jc(i,!1,t),jc(i,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[ua]||(s[ua]=!0,jc("selectionchange",!1,s))}}function cp(t,s,i,u){switch(If(s)){case 1:var p=ux;break;case 4:p=dx;break;default:p=dc}i=p.bind(null,s,i,t),p=void 0,!$t||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(p=!0),u?p!==void 0?t.addEventListener(s,i,{capture:!0,passive:p}):t.addEventListener(s,i,!0):p!==void 0?t.addEventListener(s,i,{passive:p}):t.addEventListener(s,i,!1)}function _c(t,s,i,u,p){var g=u;if((s&1)===0&&(s&2)===0&&u!==null)e:for(;;){if(u===null)return;var w=u.tag;if(w===3||w===4){var _=u.stateNode.containerInfo;if(_===p||_.nodeType===8&&_.parentNode===p)break;if(w===4)for(w=u.return;w!==null;){var D=w.tag;if((D===3||D===4)&&(D=w.stateNode.containerInfo,D===p||D.nodeType===8&&D.parentNode===p))return;w=w.return}for(;_!==null;){if(w=Tr(_),w===null)return;if(D=w.tag,D===5||D===6){u=g=w;continue e}_=_.parentNode}}u=u.return}qt(function(){var K=g,re=ln(i),ae=[];e:{var se=op.get(t);if(se!==void 0){var xe=hc,Ne=t;switch(t){case"keypress":if(ra(i)===0)break e;case"keydown":case"keyup":xe=Cx;break;case"focusin":Ne="focus",xe=vc;break;case"focusout":Ne="blur",xe=vc;break;case"beforeblur":case"afterblur":xe=vc;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":xe=Lf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":xe=hx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":xe=_x;break;case tp:case np:case sp:xe=vx;break;case rp:xe=Ax;break;case"scroll":xe=fx;break;case"wheel":xe=Dx;break;case"copy":case"cut":case"paste":xe=xx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":xe=$f}var Ce=(s&4)!==0,Mt=!Ce&&t==="scroll",H=Ce?se!==null?se+"Capture":null:se;Ce=[];for(var O=K,V;O!==null;){V=O;var fe=V.stateNode;if(V.tag===5&&fe!==null&&(V=fe,H!==null&&(fe=it(O,H),fe!=null&&Ce.push(Zo(O,fe,V)))),Mt)break;O=O.return}0<Ce.length&&(se=new xe(se,Ne,null,i,re),ae.push({event:se,listeners:Ce}))}}if((s&7)===0){e:{if(se=t==="mouseover"||t==="pointerover",xe=t==="mouseout"||t==="pointerout",se&&i!==gn&&(Ne=i.relatedTarget||i.fromElement)&&(Tr(Ne)||Ne[Rs]))break e;if((xe||se)&&(se=re.window===re?re:(se=re.ownerDocument)?se.defaultView||se.parentWindow:window,xe?(Ne=i.relatedTarget||i.toElement,xe=K,Ne=Ne?Tr(Ne):null,Ne!==null&&(Mt=We(Ne),Ne!==Mt||Ne.tag!==5&&Ne.tag!==6)&&(Ne=null)):(xe=null,Ne=K),xe!==Ne)){if(Ce=Lf,fe="onMouseLeave",H="onMouseEnter",O="mouse",(t==="pointerout"||t==="pointerover")&&(Ce=$f,fe="onPointerLeave",H="onPointerEnter",O="pointer"),Mt=xe==null?se:eo(xe),V=Ne==null?se:eo(Ne),se=new Ce(fe,O+"leave",xe,i,re),se.target=Mt,se.relatedTarget=V,fe=null,Tr(re)===K&&(Ce=new Ce(H,O+"enter",Ne,i,re),Ce.target=V,Ce.relatedTarget=Mt,fe=Ce),Mt=fe,xe&&Ne)t:{for(Ce=xe,H=Ne,O=0,V=Ce;V;V=Zr(V))O++;for(V=0,fe=H;fe;fe=Zr(fe))V++;for(;0<O-V;)Ce=Zr(Ce),O--;for(;0<V-O;)H=Zr(H),V--;for(;O--;){if(Ce===H||H!==null&&Ce===H.alternate)break t;Ce=Zr(Ce),H=Zr(H)}Ce=null}else Ce=null;xe!==null&&up(ae,se,xe,Ce,!1),Ne!==null&&Mt!==null&&up(ae,Mt,Ne,Ce,!0)}}e:{if(se=K?eo(K):window,xe=se.nodeName&&se.nodeName.toLowerCase(),xe==="select"||xe==="input"&&se.type==="file")var Ee=Fx;else if(Wf(se))if(Vf)Ee=Hx;else{Ee=Bx;var Le=Ux}else(xe=se.nodeName)&&xe.toLowerCase()==="input"&&(se.type==="checkbox"||se.type==="radio")&&(Ee=Wx);if(Ee&&(Ee=Ee(t,K))){Hf(ae,Ee,i,re);break e}Le&&Le(t,se,K),t==="focusout"&&(Le=se._wrapperState)&&Le.controlled&&se.type==="number"&&St(se,"number",se.value)}switch(Le=K?eo(K):window,t){case"focusin":(Wf(Le)||Le.contentEditable==="true")&&(Yr=Le,bc=K,Xo=null);break;case"focusout":Xo=bc=Yr=null;break;case"mousedown":Nc=!0;break;case"contextmenu":case"mouseup":case"dragend":Nc=!1,Jf(ae,i,re);break;case"selectionchange":if(Gx)break;case"keydown":case"keyup":Jf(ae,i,re)}var Oe;if(xc)e:{switch(t){case"compositionstart":var ze="onCompositionStart";break e;case"compositionend":ze="onCompositionEnd";break e;case"compositionupdate":ze="onCompositionUpdate";break e}ze=void 0}else Xr?Uf(t,i)&&(ze="onCompositionEnd"):t==="keydown"&&i.keyCode===229&&(ze="onCompositionStart");ze&&(Pf&&i.locale!=="ko"&&(Xr||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&Xr&&(Oe=Df()):(Gs=re,pc="value"in Gs?Gs.value:Gs.textContent,Xr=!0)),Le=da(K,ze),0<Le.length&&(ze=new Of(ze,t,null,i,re),ae.push({event:ze,listeners:Le}),Oe?ze.data=Oe:(Oe=Bf(i),Oe!==null&&(ze.data=Oe)))),(Oe=Lx?Ox(t,i):$x(t,i))&&(K=da(K,"onBeforeInput"),0<K.length&&(re=new Of("onBeforeInput","beforeinput",null,i,re),ae.push({event:re,listeners:K}),re.data=Oe))}lp(ae,s)})}function Zo(t,s,i){return{instance:t,listener:s,currentTarget:i}}function da(t,s){for(var i=s+"Capture",u=[];t!==null;){var p=t,g=p.stateNode;p.tag===5&&g!==null&&(p=g,g=it(t,i),g!=null&&u.unshift(Zo(t,g,p)),g=it(t,s),g!=null&&u.push(Zo(t,g,p))),t=t.return}return u}function Zr(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function up(t,s,i,u,p){for(var g=s._reactName,w=[];i!==null&&i!==u;){var _=i,D=_.alternate,K=_.stateNode;if(D!==null&&D===u)break;_.tag===5&&K!==null&&(_=K,p?(D=it(i,g),D!=null&&w.unshift(Zo(i,D,_))):p||(D=it(i,g),D!=null&&w.push(Zo(i,D,_)))),i=i.return}w.length!==0&&t.push({event:s,listeners:w})}var Qx=/\r\n?/g,Zx=/\u0000|\uFFFD/g;function dp(t){return(typeof t=="string"?t:""+t).replace(Qx,`
39
+ `).replace(Zx,"")}function fa(t,s,i){if(s=dp(s),dp(t)!==s&&i)throw Error(r(425))}function pa(){}var Rc=null,Ac=null;function Ic(t,s){return t==="textarea"||t==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Dc=typeof setTimeout=="function"?setTimeout:void 0,Jx=typeof clearTimeout=="function"?clearTimeout:void 0,fp=typeof Promise=="function"?Promise:void 0,e0=typeof queueMicrotask=="function"?queueMicrotask:typeof fp<"u"?function(t){return fp.resolve(null).then(t).catch(t0)}:Dc;function t0(t){setTimeout(function(){throw t})}function Mc(t,s){var i=s,u=0;do{var p=i.nextSibling;if(t.removeChild(i),p&&p.nodeType===8)if(i=p.data,i==="/$"){if(u===0){t.removeChild(p),Bo(s);return}u--}else i!=="$"&&i!=="$?"&&i!=="$!"||u++;i=p}while(i);Bo(s)}function Xs(t){for(;t!=null;t=t.nextSibling){var s=t.nodeType;if(s===1||s===3)break;if(s===8){if(s=t.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return t}function pp(t){t=t.previousSibling;for(var s=0;t;){if(t.nodeType===8){var i=t.data;if(i==="$"||i==="$!"||i==="$?"){if(s===0)return t;s--}else i==="/$"&&s++}t=t.previousSibling}return null}var Jr=Math.random().toString(36).slice(2),ks="__reactFiber$"+Jr,Jo="__reactProps$"+Jr,Rs="__reactContainer$"+Jr,Lc="__reactEvents$"+Jr,n0="__reactListeners$"+Jr,s0="__reactHandles$"+Jr;function Tr(t){var s=t[ks];if(s)return s;for(var i=t.parentNode;i;){if(s=i[Rs]||i[ks]){if(i=s.alternate,s.child!==null||i!==null&&i.child!==null)for(t=pp(t);t!==null;){if(i=t[ks])return i;t=pp(t)}return s}t=i,i=t.parentNode}return null}function ei(t){return t=t[ks]||t[Rs],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function eo(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(r(33))}function ha(t){return t[Jo]||null}var Oc=[],to=-1;function Ys(t){return{current:t}}function ht(t){0>to||(t.current=Oc[to],Oc[to]=null,to--)}function ut(t,s){to++,Oc[to]=t.current,t.current=s}var Qs={},cn=Ys(Qs),En=Ys(!1),Cr=Qs;function no(t,s){var i=t.type.contextTypes;if(!i)return Qs;var u=t.stateNode;if(u&&u.__reactInternalMemoizedUnmaskedChildContext===s)return u.__reactInternalMemoizedMaskedChildContext;var p={},g;for(g in i)p[g]=s[g];return u&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=p),p}function jn(t){return t=t.childContextTypes,t!=null}function ma(){ht(En),ht(cn)}function hp(t,s,i){if(cn.current!==Qs)throw Error(r(168));ut(cn,s),ut(En,i)}function mp(t,s,i){var u=t.stateNode;if(s=s.childContextTypes,typeof u.getChildContext!="function")return i;u=u.getChildContext();for(var p in u)if(!(p in s))throw Error(r(108,be(t)||"Unknown",p));return q({},i,u)}function ga(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Qs,Cr=cn.current,ut(cn,t),ut(En,En.current),!0}function gp(t,s,i){var u=t.stateNode;if(!u)throw Error(r(169));i?(t=mp(t,s,Cr),u.__reactInternalMemoizedMergedChildContext=t,ht(En),ht(cn),ut(cn,t)):ht(En),ut(En,i)}var As=null,va=!1,$c=!1;function vp(t){As===null?As=[t]:As.push(t)}function r0(t){va=!0,vp(t)}function Zs(){if(!$c&&As!==null){$c=!0;var t=0,s=Xe;try{var i=As;for(Xe=1;t<i.length;t++){var u=i[t];do u=u(!0);while(u!==null)}As=null,va=!1}catch(p){throw As!==null&&(As=As.slice(t+1)),Je(Ws,Zs),p}finally{Xe=s,$c=!1}}return null}var so=[],ro=0,ya=null,xa=0,Gn=[],qn=0,Er=null,Is=1,Ds="";function jr(t,s){so[ro++]=xa,so[ro++]=ya,ya=t,xa=s}function yp(t,s,i){Gn[qn++]=Is,Gn[qn++]=Ds,Gn[qn++]=Er,Er=t;var u=Is;t=Ds;var p=32-xn(u)-1;u&=~(1<<p),i+=1;var g=32-xn(s)+p;if(30<g){var w=p-p%5;g=(u&(1<<w)-1).toString(32),u>>=w,p-=w,Is=1<<32-xn(s)+p|i<<p|u,Ds=g+t}else Is=1<<g|i<<p|u,Ds=t}function Pc(t){t.return!==null&&(jr(t,1),yp(t,1,0))}function zc(t){for(;t===ya;)ya=so[--ro],so[ro]=null,xa=so[--ro],so[ro]=null;for(;t===Er;)Er=Gn[--qn],Gn[qn]=null,Ds=Gn[--qn],Gn[qn]=null,Is=Gn[--qn],Gn[qn]=null}var Un=null,Bn=null,wt=!1,rs=null;function xp(t,s){var i=Zn(5,null,null,0);i.elementType="DELETED",i.stateNode=s,i.return=t,s=t.deletions,s===null?(t.deletions=[i],t.flags|=16):s.push(i)}function wp(t,s){switch(t.tag){case 5:var i=t.type;return s=s.nodeType!==1||i.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(t.stateNode=s,Un=t,Bn=Xs(s.firstChild),!0):!1;case 6:return s=t.pendingProps===""||s.nodeType!==3?null:s,s!==null?(t.stateNode=s,Un=t,Bn=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(i=Er!==null?{id:Is,overflow:Ds}:null,t.memoizedState={dehydrated:s,treeContext:i,retryLane:1073741824},i=Zn(18,null,null,0),i.stateNode=s,i.return=t,t.child=i,Un=t,Bn=null,!0):!1;default:return!1}}function Fc(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Uc(t){if(wt){var s=Bn;if(s){var i=s;if(!wp(t,s)){if(Fc(t))throw Error(r(418));s=Xs(i.nextSibling);var u=Un;s&&wp(t,s)?xp(u,i):(t.flags=t.flags&-4097|2,wt=!1,Un=t)}}else{if(Fc(t))throw Error(r(418));t.flags=t.flags&-4097|2,wt=!1,Un=t}}}function kp(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Un=t}function wa(t){if(t!==Un)return!1;if(!wt)return kp(t),wt=!0,!1;var s;if((s=t.tag!==3)&&!(s=t.tag!==5)&&(s=t.type,s=s!=="head"&&s!=="body"&&!Ic(t.type,t.memoizedProps)),s&&(s=Bn)){if(Fc(t))throw Sp(),Error(r(418));for(;s;)xp(t,s),s=Xs(s.nextSibling)}if(kp(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));e:{for(t=t.nextSibling,s=0;t;){if(t.nodeType===8){var i=t.data;if(i==="/$"){if(s===0){Bn=Xs(t.nextSibling);break e}s--}else i!=="$"&&i!=="$!"&&i!=="$?"||s++}t=t.nextSibling}Bn=null}}else Bn=Un?Xs(t.stateNode.nextSibling):null;return!0}function Sp(){for(var t=Bn;t;)t=Xs(t.nextSibling)}function oo(){Bn=Un=null,wt=!1}function Bc(t){rs===null?rs=[t]:rs.push(t)}var o0=M.ReactCurrentBatchConfig;function ti(t,s,i){if(t=i.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(r(309));var u=i.stateNode}if(!u)throw Error(r(147,t));var p=u,g=""+t;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===g?s.ref:(s=function(w){var _=p.refs;w===null?delete _[g]:_[g]=w},s._stringRef=g,s)}if(typeof t!="string")throw Error(r(284));if(!i._owner)throw Error(r(290,t))}return t}function ka(t,s){throw t=Object.prototype.toString.call(s),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t))}function bp(t){var s=t._init;return s(t._payload)}function Np(t){function s(H,O){if(t){var V=H.deletions;V===null?(H.deletions=[O],H.flags|=16):V.push(O)}}function i(H,O){if(!t)return null;for(;O!==null;)s(H,O),O=O.sibling;return null}function u(H,O){for(H=new Map;O!==null;)O.key!==null?H.set(O.key,O):H.set(O.index,O),O=O.sibling;return H}function p(H,O){return H=ir(H,O),H.index=0,H.sibling=null,H}function g(H,O,V){return H.index=V,t?(V=H.alternate,V!==null?(V=V.index,V<O?(H.flags|=2,O):V):(H.flags|=2,O)):(H.flags|=1048576,O)}function w(H){return t&&H.alternate===null&&(H.flags|=2),H}function _(H,O,V,fe){return O===null||O.tag!==6?(O=Du(V,H.mode,fe),O.return=H,O):(O=p(O,V),O.return=H,O)}function D(H,O,V,fe){var Ee=V.type;return Ee===z?re(H,O,V.props.children,fe,V.key):O!==null&&(O.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===ie&&bp(Ee)===O.type)?(fe=p(O,V.props),fe.ref=ti(H,O,V),fe.return=H,fe):(fe=Va(V.type,V.key,V.props,null,H.mode,fe),fe.ref=ti(H,O,V),fe.return=H,fe)}function K(H,O,V,fe){return O===null||O.tag!==4||O.stateNode.containerInfo!==V.containerInfo||O.stateNode.implementation!==V.implementation?(O=Mu(V,H.mode,fe),O.return=H,O):(O=p(O,V.children||[]),O.return=H,O)}function re(H,O,V,fe,Ee){return O===null||O.tag!==7?(O=Or(V,H.mode,fe,Ee),O.return=H,O):(O=p(O,V),O.return=H,O)}function ae(H,O,V){if(typeof O=="string"&&O!==""||typeof O=="number")return O=Du(""+O,H.mode,V),O.return=H,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case L:return V=Va(O.type,O.key,O.props,null,H.mode,V),V.ref=ti(H,null,O),V.return=H,V;case G:return O=Mu(O,H.mode,V),O.return=H,O;case ie:var fe=O._init;return ae(H,fe(O._payload),V)}if(jt(O)||Z(O))return O=Or(O,H.mode,V,null),O.return=H,O;ka(H,O)}return null}function se(H,O,V,fe){var Ee=O!==null?O.key:null;if(typeof V=="string"&&V!==""||typeof V=="number")return Ee!==null?null:_(H,O,""+V,fe);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case L:return V.key===Ee?D(H,O,V,fe):null;case G:return V.key===Ee?K(H,O,V,fe):null;case ie:return Ee=V._init,se(H,O,Ee(V._payload),fe)}if(jt(V)||Z(V))return Ee!==null?null:re(H,O,V,fe,null);ka(H,V)}return null}function xe(H,O,V,fe,Ee){if(typeof fe=="string"&&fe!==""||typeof fe=="number")return H=H.get(V)||null,_(O,H,""+fe,Ee);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case L:return H=H.get(fe.key===null?V:fe.key)||null,D(O,H,fe,Ee);case G:return H=H.get(fe.key===null?V:fe.key)||null,K(O,H,fe,Ee);case ie:var Le=fe._init;return xe(H,O,V,Le(fe._payload),Ee)}if(jt(fe)||Z(fe))return H=H.get(V)||null,re(O,H,fe,Ee,null);ka(O,fe)}return null}function Ne(H,O,V,fe){for(var Ee=null,Le=null,Oe=O,ze=O=0,Qt=null;Oe!==null&&ze<V.length;ze++){Oe.index>ze?(Qt=Oe,Oe=null):Qt=Oe.sibling;var tt=se(H,Oe,V[ze],fe);if(tt===null){Oe===null&&(Oe=Qt);break}t&&Oe&&tt.alternate===null&&s(H,Oe),O=g(tt,O,ze),Le===null?Ee=tt:Le.sibling=tt,Le=tt,Oe=Qt}if(ze===V.length)return i(H,Oe),wt&&jr(H,ze),Ee;if(Oe===null){for(;ze<V.length;ze++)Oe=ae(H,V[ze],fe),Oe!==null&&(O=g(Oe,O,ze),Le===null?Ee=Oe:Le.sibling=Oe,Le=Oe);return wt&&jr(H,ze),Ee}for(Oe=u(H,Oe);ze<V.length;ze++)Qt=xe(Oe,H,ze,V[ze],fe),Qt!==null&&(t&&Qt.alternate!==null&&Oe.delete(Qt.key===null?ze:Qt.key),O=g(Qt,O,ze),Le===null?Ee=Qt:Le.sibling=Qt,Le=Qt);return t&&Oe.forEach(function(ar){return s(H,ar)}),wt&&jr(H,ze),Ee}function Ce(H,O,V,fe){var Ee=Z(V);if(typeof Ee!="function")throw Error(r(150));if(V=Ee.call(V),V==null)throw Error(r(151));for(var Le=Ee=null,Oe=O,ze=O=0,Qt=null,tt=V.next();Oe!==null&&!tt.done;ze++,tt=V.next()){Oe.index>ze?(Qt=Oe,Oe=null):Qt=Oe.sibling;var ar=se(H,Oe,tt.value,fe);if(ar===null){Oe===null&&(Oe=Qt);break}t&&Oe&&ar.alternate===null&&s(H,Oe),O=g(ar,O,ze),Le===null?Ee=ar:Le.sibling=ar,Le=ar,Oe=Qt}if(tt.done)return i(H,Oe),wt&&jr(H,ze),Ee;if(Oe===null){for(;!tt.done;ze++,tt=V.next())tt=ae(H,tt.value,fe),tt!==null&&(O=g(tt,O,ze),Le===null?Ee=tt:Le.sibling=tt,Le=tt);return wt&&jr(H,ze),Ee}for(Oe=u(H,Oe);!tt.done;ze++,tt=V.next())tt=xe(Oe,H,ze,tt.value,fe),tt!==null&&(t&&tt.alternate!==null&&Oe.delete(tt.key===null?ze:tt.key),O=g(tt,O,ze),Le===null?Ee=tt:Le.sibling=tt,Le=tt);return t&&Oe.forEach(function(P0){return s(H,P0)}),wt&&jr(H,ze),Ee}function Mt(H,O,V,fe){if(typeof V=="object"&&V!==null&&V.type===z&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case L:e:{for(var Ee=V.key,Le=O;Le!==null;){if(Le.key===Ee){if(Ee=V.type,Ee===z){if(Le.tag===7){i(H,Le.sibling),O=p(Le,V.props.children),O.return=H,H=O;break e}}else if(Le.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===ie&&bp(Ee)===Le.type){i(H,Le.sibling),O=p(Le,V.props),O.ref=ti(H,Le,V),O.return=H,H=O;break e}i(H,Le);break}else s(H,Le);Le=Le.sibling}V.type===z?(O=Or(V.props.children,H.mode,fe,V.key),O.return=H,H=O):(fe=Va(V.type,V.key,V.props,null,H.mode,fe),fe.ref=ti(H,O,V),fe.return=H,H=fe)}return w(H);case G:e:{for(Le=V.key;O!==null;){if(O.key===Le)if(O.tag===4&&O.stateNode.containerInfo===V.containerInfo&&O.stateNode.implementation===V.implementation){i(H,O.sibling),O=p(O,V.children||[]),O.return=H,H=O;break e}else{i(H,O);break}else s(H,O);O=O.sibling}O=Mu(V,H.mode,fe),O.return=H,H=O}return w(H);case ie:return Le=V._init,Mt(H,O,Le(V._payload),fe)}if(jt(V))return Ne(H,O,V,fe);if(Z(V))return Ce(H,O,V,fe);ka(H,V)}return typeof V=="string"&&V!==""||typeof V=="number"?(V=""+V,O!==null&&O.tag===6?(i(H,O.sibling),O=p(O,V),O.return=H,H=O):(i(H,O),O=Du(V,H.mode,fe),O.return=H,H=O),w(H)):i(H,O)}return Mt}var io=Np(!0),Tp=Np(!1),Sa=Ys(null),ba=null,ao=null,Wc=null;function Hc(){Wc=ao=ba=null}function Vc(t){var s=Sa.current;ht(Sa),t._currentValue=s}function Kc(t,s,i){for(;t!==null;){var u=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,u!==null&&(u.childLanes|=s)):u!==null&&(u.childLanes&s)!==s&&(u.childLanes|=s),t===i)break;t=t.return}}function lo(t,s){ba=t,Wc=ao=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&s)!==0&&(_n=!0),t.firstContext=null)}function Xn(t){var s=t._currentValue;if(Wc!==t)if(t={context:t,memoizedValue:s,next:null},ao===null){if(ba===null)throw Error(r(308));ao=t,ba.dependencies={lanes:0,firstContext:t}}else ao=ao.next=t;return s}var _r=null;function Gc(t){_r===null?_r=[t]:_r.push(t)}function Cp(t,s,i,u){var p=s.interleaved;return p===null?(i.next=i,Gc(s)):(i.next=p.next,p.next=i),s.interleaved=i,Ms(t,u)}function Ms(t,s){t.lanes|=s;var i=t.alternate;for(i!==null&&(i.lanes|=s),i=t,t=t.return;t!==null;)t.childLanes|=s,i=t.alternate,i!==null&&(i.childLanes|=s),i=t,t=t.return;return i.tag===3?i.stateNode:null}var Js=!1;function qc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ep(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Ls(t,s){return{eventTime:t,lane:s,tag:0,payload:null,callback:null,next:null}}function er(t,s,i){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(Qe&2)!==0){var p=u.pending;return p===null?s.next=s:(s.next=p.next,p.next=s),u.pending=s,Ms(t,i)}return p=u.interleaved,p===null?(s.next=s,Gc(u)):(s.next=p.next,p.next=s),u.interleaved=s,Ms(t,i)}function Na(t,s,i){if(s=s.updateQueue,s!==null&&(s=s.shared,(i&4194240)!==0)){var u=s.lanes;u&=t.pendingLanes,i|=u,s.lanes=i,Vs(t,i)}}function jp(t,s){var i=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var p=null,g=null;if(i=i.firstBaseUpdate,i!==null){do{var w={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};g===null?p=g=w:g=g.next=w,i=i.next}while(i!==null);g===null?p=g=s:g=g.next=s}else p=g=s;i={baseState:u.baseState,firstBaseUpdate:p,lastBaseUpdate:g,shared:u.shared,effects:u.effects},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=s:t.next=s,i.lastBaseUpdate=s}function Ta(t,s,i,u){var p=t.updateQueue;Js=!1;var g=p.firstBaseUpdate,w=p.lastBaseUpdate,_=p.shared.pending;if(_!==null){p.shared.pending=null;var D=_,K=D.next;D.next=null,w===null?g=K:w.next=K,w=D;var re=t.alternate;re!==null&&(re=re.updateQueue,_=re.lastBaseUpdate,_!==w&&(_===null?re.firstBaseUpdate=K:_.next=K,re.lastBaseUpdate=D))}if(g!==null){var ae=p.baseState;w=0,re=K=D=null,_=g;do{var se=_.lane,xe=_.eventTime;if((u&se)===se){re!==null&&(re=re.next={eventTime:xe,lane:0,tag:_.tag,payload:_.payload,callback:_.callback,next:null});e:{var Ne=t,Ce=_;switch(se=s,xe=i,Ce.tag){case 1:if(Ne=Ce.payload,typeof Ne=="function"){ae=Ne.call(xe,ae,se);break e}ae=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Ce.payload,se=typeof Ne=="function"?Ne.call(xe,ae,se):Ne,se==null)break e;ae=q({},ae,se);break e;case 2:Js=!0}}_.callback!==null&&_.lane!==0&&(t.flags|=64,se=p.effects,se===null?p.effects=[_]:se.push(_))}else xe={eventTime:xe,lane:se,tag:_.tag,payload:_.payload,callback:_.callback,next:null},re===null?(K=re=xe,D=ae):re=re.next=xe,w|=se;if(_=_.next,_===null){if(_=p.shared.pending,_===null)break;se=_,_=se.next,se.next=null,p.lastBaseUpdate=se,p.shared.pending=null}}while(!0);if(re===null&&(D=ae),p.baseState=D,p.firstBaseUpdate=K,p.lastBaseUpdate=re,s=p.shared.interleaved,s!==null){p=s;do w|=p.lane,p=p.next;while(p!==s)}else g===null&&(p.shared.lanes=0);Ir|=w,t.lanes=w,t.memoizedState=ae}}function _p(t,s,i){if(t=s.effects,s.effects=null,t!==null)for(s=0;s<t.length;s++){var u=t[s],p=u.callback;if(p!==null){if(u.callback=null,u=i,typeof p!="function")throw Error(r(191,p));p.call(u)}}}var ni={},Ss=Ys(ni),si=Ys(ni),ri=Ys(ni);function Rr(t){if(t===ni)throw Error(r(174));return t}function Xc(t,s){switch(ut(ri,s),ut(si,t),ut(Ss,ni),t=s.nodeType,t){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:gt(null,"");break;default:t=t===8?s.parentNode:s,s=t.namespaceURI||null,t=t.tagName,s=gt(s,t)}ht(Ss),ut(Ss,s)}function co(){ht(Ss),ht(si),ht(ri)}function Rp(t){Rr(ri.current);var s=Rr(Ss.current),i=gt(s,t.type);s!==i&&(ut(si,t),ut(Ss,i))}function Yc(t){si.current===t&&(ht(Ss),ht(si))}var Ct=Ys(0);function Ca(t){for(var s=t;s!==null;){if(s.tag===13){var i=s.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Qc=[];function Zc(){for(var t=0;t<Qc.length;t++)Qc[t]._workInProgressVersionPrimary=null;Qc.length=0}var Ea=M.ReactCurrentDispatcher,Jc=M.ReactCurrentBatchConfig,Ar=0,Et=null,Bt=null,Xt=null,ja=!1,oi=!1,ii=0,i0=0;function un(){throw Error(r(321))}function eu(t,s){if(s===null)return!1;for(var i=0;i<s.length&&i<t.length;i++)if(!ss(t[i],s[i]))return!1;return!0}function tu(t,s,i,u,p,g){if(Ar=g,Et=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,Ea.current=t===null||t.memoizedState===null?u0:d0,t=i(u,p),oi){g=0;do{if(oi=!1,ii=0,25<=g)throw Error(r(301));g+=1,Xt=Bt=null,s.updateQueue=null,Ea.current=f0,t=i(u,p)}while(oi)}if(Ea.current=Aa,s=Bt!==null&&Bt.next!==null,Ar=0,Xt=Bt=Et=null,ja=!1,s)throw Error(r(300));return t}function nu(){var t=ii!==0;return ii=0,t}function bs(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Xt===null?Et.memoizedState=Xt=t:Xt=Xt.next=t,Xt}function Yn(){if(Bt===null){var t=Et.alternate;t=t!==null?t.memoizedState:null}else t=Bt.next;var s=Xt===null?Et.memoizedState:Xt.next;if(s!==null)Xt=s,Bt=t;else{if(t===null)throw Error(r(310));Bt=t,t={memoizedState:Bt.memoizedState,baseState:Bt.baseState,baseQueue:Bt.baseQueue,queue:Bt.queue,next:null},Xt===null?Et.memoizedState=Xt=t:Xt=Xt.next=t}return Xt}function ai(t,s){return typeof s=="function"?s(t):s}function su(t){var s=Yn(),i=s.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=t;var u=Bt,p=u.baseQueue,g=i.pending;if(g!==null){if(p!==null){var w=p.next;p.next=g.next,g.next=w}u.baseQueue=p=g,i.pending=null}if(p!==null){g=p.next,u=u.baseState;var _=w=null,D=null,K=g;do{var re=K.lane;if((Ar&re)===re)D!==null&&(D=D.next={lane:0,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),u=K.hasEagerState?K.eagerState:t(u,K.action);else{var ae={lane:re,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null};D===null?(_=D=ae,w=u):D=D.next=ae,Et.lanes|=re,Ir|=re}K=K.next}while(K!==null&&K!==g);D===null?w=u:D.next=_,ss(u,s.memoizedState)||(_n=!0),s.memoizedState=u,s.baseState=w,s.baseQueue=D,i.lastRenderedState=u}if(t=i.interleaved,t!==null){p=t;do g=p.lane,Et.lanes|=g,Ir|=g,p=p.next;while(p!==t)}else p===null&&(i.lanes=0);return[s.memoizedState,i.dispatch]}function ru(t){var s=Yn(),i=s.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=t;var u=i.dispatch,p=i.pending,g=s.memoizedState;if(p!==null){i.pending=null;var w=p=p.next;do g=t(g,w.action),w=w.next;while(w!==p);ss(g,s.memoizedState)||(_n=!0),s.memoizedState=g,s.baseQueue===null&&(s.baseState=g),i.lastRenderedState=g}return[g,u]}function Ap(){}function Ip(t,s){var i=Et,u=Yn(),p=s(),g=!ss(u.memoizedState,p);if(g&&(u.memoizedState=p,_n=!0),u=u.queue,ou(Lp.bind(null,i,u,t),[t]),u.getSnapshot!==s||g||Xt!==null&&Xt.memoizedState.tag&1){if(i.flags|=2048,li(9,Mp.bind(null,i,u,p,s),void 0,null),Yt===null)throw Error(r(349));(Ar&30)!==0||Dp(i,s,p)}return p}function Dp(t,s,i){t.flags|=16384,t={getSnapshot:s,value:i},s=Et.updateQueue,s===null?(s={lastEffect:null,stores:null},Et.updateQueue=s,s.stores=[t]):(i=s.stores,i===null?s.stores=[t]:i.push(t))}function Mp(t,s,i,u){s.value=i,s.getSnapshot=u,Op(s)&&$p(t)}function Lp(t,s,i){return i(function(){Op(s)&&$p(t)})}function Op(t){var s=t.getSnapshot;t=t.value;try{var i=s();return!ss(t,i)}catch{return!0}}function $p(t){var s=Ms(t,1);s!==null&&ls(s,t,1,-1)}function Pp(t){var s=bs();return typeof t=="function"&&(t=t()),s.memoizedState=s.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ai,lastRenderedState:t},s.queue=t,t=t.dispatch=c0.bind(null,Et,t),[s.memoizedState,t]}function li(t,s,i,u){return t={tag:t,create:s,destroy:i,deps:u,next:null},s=Et.updateQueue,s===null?(s={lastEffect:null,stores:null},Et.updateQueue=s,s.lastEffect=t.next=t):(i=s.lastEffect,i===null?s.lastEffect=t.next=t:(u=i.next,i.next=t,t.next=u,s.lastEffect=t)),t}function zp(){return Yn().memoizedState}function _a(t,s,i,u){var p=bs();Et.flags|=t,p.memoizedState=li(1|s,i,void 0,u===void 0?null:u)}function Ra(t,s,i,u){var p=Yn();u=u===void 0?null:u;var g=void 0;if(Bt!==null){var w=Bt.memoizedState;if(g=w.destroy,u!==null&&eu(u,w.deps)){p.memoizedState=li(s,i,g,u);return}}Et.flags|=t,p.memoizedState=li(1|s,i,g,u)}function Fp(t,s){return _a(8390656,8,t,s)}function ou(t,s){return Ra(2048,8,t,s)}function Up(t,s){return Ra(4,2,t,s)}function Bp(t,s){return Ra(4,4,t,s)}function Wp(t,s){if(typeof s=="function")return t=t(),s(t),function(){s(null)};if(s!=null)return t=t(),s.current=t,function(){s.current=null}}function Hp(t,s,i){return i=i!=null?i.concat([t]):null,Ra(4,4,Wp.bind(null,s,t),i)}function iu(){}function Vp(t,s){var i=Yn();s=s===void 0?null:s;var u=i.memoizedState;return u!==null&&s!==null&&eu(s,u[1])?u[0]:(i.memoizedState=[t,s],t)}function Kp(t,s){var i=Yn();s=s===void 0?null:s;var u=i.memoizedState;return u!==null&&s!==null&&eu(s,u[1])?u[0]:(t=t(),i.memoizedState=[t,s],t)}function Gp(t,s,i){return(Ar&21)===0?(t.baseState&&(t.baseState=!1,_n=!0),t.memoizedState=i):(ss(i,s)||(i=Po(),Et.lanes|=i,Ir|=i,t.baseState=!0),s)}function a0(t,s){var i=Xe;Xe=i!==0&&4>i?i:4,t(!0);var u=Jc.transition;Jc.transition={};try{t(!1),s()}finally{Xe=i,Jc.transition=u}}function qp(){return Yn().memoizedState}function l0(t,s,i){var u=rr(t);if(i={lane:u,action:i,hasEagerState:!1,eagerState:null,next:null},Xp(t))Yp(s,i);else if(i=Cp(t,s,i,u),i!==null){var p=Sn();ls(i,t,u,p),Qp(i,s,u)}}function c0(t,s,i){var u=rr(t),p={lane:u,action:i,hasEagerState:!1,eagerState:null,next:null};if(Xp(t))Yp(s,p);else{var g=t.alternate;if(t.lanes===0&&(g===null||g.lanes===0)&&(g=s.lastRenderedReducer,g!==null))try{var w=s.lastRenderedState,_=g(w,i);if(p.hasEagerState=!0,p.eagerState=_,ss(_,w)){var D=s.interleaved;D===null?(p.next=p,Gc(s)):(p.next=D.next,D.next=p),s.interleaved=p;return}}catch{}finally{}i=Cp(t,s,p,u),i!==null&&(p=Sn(),ls(i,t,u,p),Qp(i,s,u))}}function Xp(t){var s=t.alternate;return t===Et||s!==null&&s===Et}function Yp(t,s){oi=ja=!0;var i=t.pending;i===null?s.next=s:(s.next=i.next,i.next=s),t.pending=s}function Qp(t,s,i){if((i&4194240)!==0){var u=s.lanes;u&=t.pendingLanes,i|=u,s.lanes=i,Vs(t,i)}}var Aa={readContext:Xn,useCallback:un,useContext:un,useEffect:un,useImperativeHandle:un,useInsertionEffect:un,useLayoutEffect:un,useMemo:un,useReducer:un,useRef:un,useState:un,useDebugValue:un,useDeferredValue:un,useTransition:un,useMutableSource:un,useSyncExternalStore:un,useId:un,unstable_isNewReconciler:!1},u0={readContext:Xn,useCallback:function(t,s){return bs().memoizedState=[t,s===void 0?null:s],t},useContext:Xn,useEffect:Fp,useImperativeHandle:function(t,s,i){return i=i!=null?i.concat([t]):null,_a(4194308,4,Wp.bind(null,s,t),i)},useLayoutEffect:function(t,s){return _a(4194308,4,t,s)},useInsertionEffect:function(t,s){return _a(4,2,t,s)},useMemo:function(t,s){var i=bs();return s=s===void 0?null:s,t=t(),i.memoizedState=[t,s],t},useReducer:function(t,s,i){var u=bs();return s=i!==void 0?i(s):s,u.memoizedState=u.baseState=s,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:s},u.queue=t,t=t.dispatch=l0.bind(null,Et,t),[u.memoizedState,t]},useRef:function(t){var s=bs();return t={current:t},s.memoizedState=t},useState:Pp,useDebugValue:iu,useDeferredValue:function(t){return bs().memoizedState=t},useTransition:function(){var t=Pp(!1),s=t[0];return t=a0.bind(null,t[1]),bs().memoizedState=t,[s,t]},useMutableSource:function(){},useSyncExternalStore:function(t,s,i){var u=Et,p=bs();if(wt){if(i===void 0)throw Error(r(407));i=i()}else{if(i=s(),Yt===null)throw Error(r(349));(Ar&30)!==0||Dp(u,s,i)}p.memoizedState=i;var g={value:i,getSnapshot:s};return p.queue=g,Fp(Lp.bind(null,u,g,t),[t]),u.flags|=2048,li(9,Mp.bind(null,u,g,i,s),void 0,null),i},useId:function(){var t=bs(),s=Yt.identifierPrefix;if(wt){var i=Ds,u=Is;i=(u&~(1<<32-xn(u)-1)).toString(32)+i,s=":"+s+"R"+i,i=ii++,0<i&&(s+="H"+i.toString(32)),s+=":"}else i=i0++,s=":"+s+"r"+i.toString(32)+":";return t.memoizedState=s},unstable_isNewReconciler:!1},d0={readContext:Xn,useCallback:Vp,useContext:Xn,useEffect:ou,useImperativeHandle:Hp,useInsertionEffect:Up,useLayoutEffect:Bp,useMemo:Kp,useReducer:su,useRef:zp,useState:function(){return su(ai)},useDebugValue:iu,useDeferredValue:function(t){var s=Yn();return Gp(s,Bt.memoizedState,t)},useTransition:function(){var t=su(ai)[0],s=Yn().memoizedState;return[t,s]},useMutableSource:Ap,useSyncExternalStore:Ip,useId:qp,unstable_isNewReconciler:!1},f0={readContext:Xn,useCallback:Vp,useContext:Xn,useEffect:ou,useImperativeHandle:Hp,useInsertionEffect:Up,useLayoutEffect:Bp,useMemo:Kp,useReducer:ru,useRef:zp,useState:function(){return ru(ai)},useDebugValue:iu,useDeferredValue:function(t){var s=Yn();return Bt===null?s.memoizedState=t:Gp(s,Bt.memoizedState,t)},useTransition:function(){var t=ru(ai)[0],s=Yn().memoizedState;return[t,s]},useMutableSource:Ap,useSyncExternalStore:Ip,useId:qp,unstable_isNewReconciler:!1};function os(t,s){if(t&&t.defaultProps){s=q({},s),t=t.defaultProps;for(var i in t)s[i]===void 0&&(s[i]=t[i]);return s}return s}function au(t,s,i,u){s=t.memoizedState,i=i(u,s),i=i==null?s:q({},s,i),t.memoizedState=i,t.lanes===0&&(t.updateQueue.baseState=i)}var Ia={isMounted:function(t){return(t=t._reactInternals)?We(t)===t:!1},enqueueSetState:function(t,s,i){t=t._reactInternals;var u=Sn(),p=rr(t),g=Ls(u,p);g.payload=s,i!=null&&(g.callback=i),s=er(t,g,p),s!==null&&(ls(s,t,p,u),Na(s,t,p))},enqueueReplaceState:function(t,s,i){t=t._reactInternals;var u=Sn(),p=rr(t),g=Ls(u,p);g.tag=1,g.payload=s,i!=null&&(g.callback=i),s=er(t,g,p),s!==null&&(ls(s,t,p,u),Na(s,t,p))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var i=Sn(),u=rr(t),p=Ls(i,u);p.tag=2,s!=null&&(p.callback=s),s=er(t,p,u),s!==null&&(ls(s,t,u,i),Na(s,t,u))}};function Zp(t,s,i,u,p,g,w){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,g,w):s.prototype&&s.prototype.isPureReactComponent?!qo(i,u)||!qo(p,g):!0}function Jp(t,s,i){var u=!1,p=Qs,g=s.contextType;return typeof g=="object"&&g!==null?g=Xn(g):(p=jn(s)?Cr:cn.current,u=s.contextTypes,g=(u=u!=null)?no(t,p):Qs),s=new s(i,g),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Ia,t.stateNode=s,s._reactInternals=t,u&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=p,t.__reactInternalMemoizedMaskedChildContext=g),s}function eh(t,s,i,u){t=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(i,u),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(i,u),s.state!==t&&Ia.enqueueReplaceState(s,s.state,null)}function lu(t,s,i,u){var p=t.stateNode;p.props=i,p.state=t.memoizedState,p.refs={},qc(t);var g=s.contextType;typeof g=="object"&&g!==null?p.context=Xn(g):(g=jn(s)?Cr:cn.current,p.context=no(t,g)),p.state=t.memoizedState,g=s.getDerivedStateFromProps,typeof g=="function"&&(au(t,s,g,i),p.state=t.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(s=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),s!==p.state&&Ia.enqueueReplaceState(p,p.state,null),Ta(t,i,p,u),p.state=t.memoizedState),typeof p.componentDidMount=="function"&&(t.flags|=4194308)}function uo(t,s){try{var i="",u=s;do i+=X(u),u=u.return;while(u);var p=i}catch(g){p=`
40
40
  Error generating stack: `+g.message+`
41
- `+g.stack}return{value:t,source:s,stack:p,digest:null}}function lu(t,s,i){return{value:t,source:null,stack:i??null,digest:s??null}}function cu(t,s){try{console.error(s.value)}catch(i){setTimeout(function(){throw i})}}var p0=typeof WeakMap=="function"?WeakMap:Map;function th(t,s,i){i=Ls(-1,i),i.tag=3,i.payload={element:null};var u=s.value;return i.callback=function(){za||(za=!0,Nu=u),cu(t,s)},i}function nh(t,s,i){i=Ls(-1,i),i.tag=3;var u=t.type.getDerivedStateFromError;if(typeof u=="function"){var p=s.value;i.payload=function(){return u(p)},i.callback=function(){cu(t,s)}}var g=t.stateNode;return g!==null&&typeof g.componentDidCatch=="function"&&(i.callback=function(){cu(t,s),typeof u!="function"&&(nr===null?nr=new Set([this]):nr.add(this));var w=s.stack;this.componentDidCatch(s.value,{componentStack:w!==null?w:""})}),i}function sh(t,s,i){var u=t.pingCache;if(u===null){u=t.pingCache=new p0;var p=new Set;u.set(s,p)}else p=u.get(s),p===void 0&&(p=new Set,u.set(s,p));p.has(i)||(p.add(i),t=E0.bind(null,t,s,i),s.then(t,t))}function rh(t){do{var s;if((s=t.tag===13)&&(s=t.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return t;t=t.return}while(t!==null);return null}function oh(t,s,i,u,p){return(t.mode&1)===0?(t===s?t.flags|=65536:(t.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(s=Ls(-1,1),s.tag=2,er(i,s,1))),i.lanes|=1),t):(t.flags|=65536,t.lanes=p,t)}var h0=M.ReactCurrentOwner,_n=!1;function kn(t,s,i,u){s.child=t===null?Tp(s,null,i,u):io(s,t.child,i,u)}function ih(t,s,i,u,p){i=i.render;var g=s.ref;return lo(s,p),u=eu(t,s,i,u,g,p),i=tu(),t!==null&&!_n?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~p,Os(t,s,p)):(wt&&i&&$c(s),s.flags|=1,kn(t,s,u,p),s.child)}function ah(t,s,i,u,p){if(t===null){var g=i.type;return typeof g=="function"&&!Au(g)&&g.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(s.tag=15,s.type=g,lh(t,s,g,u,p)):(t=Va(i.type,null,u,s,s.mode,p),t.ref=s.ref,t.return=s,s.child=t)}if(g=t.child,(t.lanes&p)===0){var w=g.memoizedProps;if(i=i.compare,i=i!==null?i:qo,i(w,u)&&t.ref===s.ref)return Os(t,s,p)}return s.flags|=1,t=ir(g,u),t.ref=s.ref,t.return=s,s.child=t}function lh(t,s,i,u,p){if(t!==null){var g=t.memoizedProps;if(qo(g,u)&&t.ref===s.ref)if(_n=!1,s.pendingProps=u=g,(t.lanes&p)!==0)(t.flags&131072)!==0&&(_n=!0);else return s.lanes=t.lanes,Os(t,s,p)}return uu(t,s,i,u,p)}function ch(t,s,i){var u=s.pendingProps,p=u.children,g=t!==null?t.memoizedState:null;if(u.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},ut(po,Wn),Wn|=i;else{if((i&1073741824)===0)return t=g!==null?g.baseLanes|i:i,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:t,cachePool:null,transitions:null},s.updateQueue=null,ut(po,Wn),Wn|=t,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},u=g!==null?g.baseLanes:i,ut(po,Wn),Wn|=u}else g!==null?(u=g.baseLanes|i,s.memoizedState=null):u=i,ut(po,Wn),Wn|=u;return kn(t,s,p,i),s.child}function uh(t,s){var i=s.ref;(t===null&&i!==null||t!==null&&t.ref!==i)&&(s.flags|=512,s.flags|=2097152)}function uu(t,s,i,u,p){var g=jn(i)?Cr:cn.current;return g=no(s,g),lo(s,p),i=eu(t,s,i,u,g,p),u=tu(),t!==null&&!_n?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~p,Os(t,s,p)):(wt&&u&&$c(s),s.flags|=1,kn(t,s,i,p),s.child)}function dh(t,s,i,u,p){if(jn(i)){var g=!0;ga(s)}else g=!1;if(lo(s,p),s.stateNode===null)Ma(t,s),Jp(s,i,u),au(s,i,u,p),u=!0;else if(t===null){var w=s.stateNode,_=s.memoizedProps;w.props=_;var D=w.context,K=i.contextType;typeof K=="object"&&K!==null?K=Xn(K):(K=jn(i)?Cr:cn.current,K=no(s,K));var re=i.getDerivedStateFromProps,ae=typeof re=="function"||typeof w.getSnapshotBeforeUpdate=="function";ae||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(_!==u||D!==K)&&eh(s,w,u,K),Js=!1;var se=s.memoizedState;w.state=se,Ta(s,u,w,p),D=s.memoizedState,_!==u||se!==D||En.current||Js?(typeof re=="function"&&(iu(s,i,re,u),D=s.memoizedState),(_=Js||Zp(s,i,_,u,se,D,K))?(ae||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(s.flags|=4194308)):(typeof w.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=u,s.memoizedState=D),w.props=u,w.state=D,w.context=K,u=_):(typeof w.componentDidMount=="function"&&(s.flags|=4194308),u=!1)}else{w=s.stateNode,Ep(t,s),_=s.memoizedProps,K=s.type===s.elementType?_:os(s.type,_),w.props=K,ae=s.pendingProps,se=w.context,D=i.contextType,typeof D=="object"&&D!==null?D=Xn(D):(D=jn(i)?Cr:cn.current,D=no(s,D));var xe=i.getDerivedStateFromProps;(re=typeof xe=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(_!==ae||se!==D)&&eh(s,w,u,D),Js=!1,se=s.memoizedState,w.state=se,Ta(s,u,w,p);var Ne=s.memoizedState;_!==ae||se!==Ne||En.current||Js?(typeof xe=="function"&&(iu(s,i,xe,u),Ne=s.memoizedState),(K=Js||Zp(s,i,K,u,se,Ne,D)||!1)?(re||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(u,Ne,D),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(u,Ne,D)),typeof w.componentDidUpdate=="function"&&(s.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof w.componentDidUpdate!="function"||_===t.memoizedProps&&se===t.memoizedState||(s.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||_===t.memoizedProps&&se===t.memoizedState||(s.flags|=1024),s.memoizedProps=u,s.memoizedState=Ne),w.props=u,w.state=Ne,w.context=D,u=K):(typeof w.componentDidUpdate!="function"||_===t.memoizedProps&&se===t.memoizedState||(s.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||_===t.memoizedProps&&se===t.memoizedState||(s.flags|=1024),u=!1)}return du(t,s,i,u,g,p)}function du(t,s,i,u,p,g){uh(t,s);var w=(s.flags&128)!==0;if(!u&&!w)return p&&gp(s,i,!1),Os(t,s,g);u=s.stateNode,h0.current=s;var _=w&&typeof i.getDerivedStateFromError!="function"?null:u.render();return s.flags|=1,t!==null&&w?(s.child=io(s,t.child,null,g),s.child=io(s,null,_,g)):kn(t,s,_,g),s.memoizedState=u.state,p&&gp(s,i,!0),s.child}function fh(t){var s=t.stateNode;s.pendingContext?hp(t,s.pendingContext,s.pendingContext!==s.context):s.context&&hp(t,s.context,!1),qc(t,s.containerInfo)}function ph(t,s,i,u,p){return oo(),Uc(p),s.flags|=256,kn(t,s,i,u),s.child}var fu={dehydrated:null,treeContext:null,retryLane:0};function pu(t){return{baseLanes:t,cachePool:null,transitions:null}}function hh(t,s,i){var u=s.pendingProps,p=Ct.current,g=!1,w=(s.flags&128)!==0,_;if((_=w)||(_=t!==null&&t.memoizedState===null?!1:(p&2)!==0),_?(g=!0,s.flags&=-129):(t===null||t.memoizedState!==null)&&(p|=1),ut(Ct,p&1),t===null)return Fc(s),t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?((s.mode&1)===0?s.lanes=1:t.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(w=u.children,t=u.fallback,g?(u=s.mode,g=s.child,w={mode:"hidden",children:w},(u&1)===0&&g!==null?(g.childLanes=0,g.pendingProps=w):g=Ka(w,u,0,null),t=Or(t,u,i,null),g.return=s,t.return=s,g.sibling=t,s.child=g,s.child.memoizedState=pu(i),s.memoizedState=fu,t):hu(s,w));if(p=t.memoizedState,p!==null&&(_=p.dehydrated,_!==null))return m0(t,s,w,u,_,p,i);if(g){g=u.fallback,w=s.mode,p=t.child,_=p.sibling;var D={mode:"hidden",children:u.children};return(w&1)===0&&s.child!==p?(u=s.child,u.childLanes=0,u.pendingProps=D,s.deletions=null):(u=ir(p,D),u.subtreeFlags=p.subtreeFlags&14680064),_!==null?g=ir(_,g):(g=Or(g,w,i,null),g.flags|=2),g.return=s,u.return=s,u.sibling=g,s.child=u,u=g,g=s.child,w=t.child.memoizedState,w=w===null?pu(i):{baseLanes:w.baseLanes|i,cachePool:null,transitions:w.transitions},g.memoizedState=w,g.childLanes=t.childLanes&~i,s.memoizedState=fu,u}return g=t.child,t=g.sibling,u=ir(g,{mode:"visible",children:u.children}),(s.mode&1)===0&&(u.lanes=i),u.return=s,u.sibling=null,t!==null&&(i=s.deletions,i===null?(s.deletions=[t],s.flags|=16):i.push(t)),s.child=u,s.memoizedState=null,u}function hu(t,s){return s=Ka({mode:"visible",children:s},t.mode,0,null),s.return=t,t.child=s}function Da(t,s,i,u){return u!==null&&Uc(u),io(s,t.child,null,i),t=hu(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function m0(t,s,i,u,p,g,w){if(i)return s.flags&256?(s.flags&=-257,u=lu(Error(r(422))),Da(t,s,w,u)):s.memoizedState!==null?(s.child=t.child,s.flags|=128,null):(g=u.fallback,p=s.mode,u=Ka({mode:"visible",children:u.children},p,0,null),g=Or(g,p,w,null),g.flags|=2,u.return=s,g.return=s,u.sibling=g,s.child=u,(s.mode&1)!==0&&io(s,t.child,null,w),s.child.memoizedState=pu(w),s.memoizedState=fu,g);if((s.mode&1)===0)return Da(t,s,w,null);if(p.data==="$!"){if(u=p.nextSibling&&p.nextSibling.dataset,u)var _=u.dgst;return u=_,g=Error(r(419)),u=lu(g,u,void 0),Da(t,s,w,u)}if(_=(w&t.childLanes)!==0,_n||_){if(u=Yt,u!==null){switch(w&-w){case 4:p=2;break;case 16:p=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:p=32;break;case 536870912:p=268435456;break;default:p=0}p=(p&(u.suspendedLanes|w))!==0?0:p,p!==0&&p!==g.retryLane&&(g.retryLane=p,Ms(t,p),ls(u,t,p,-1))}return Ru(),u=lu(Error(r(421))),Da(t,s,w,u)}return p.data==="$?"?(s.flags|=128,s.child=t.child,s=j0.bind(null,t),p._reactRetry=s,null):(t=g.treeContext,Bn=Xs(p.nextSibling),Un=s,wt=!0,rs=null,t!==null&&(Gn[qn++]=Is,Gn[qn++]=Ds,Gn[qn++]=Er,Is=t.id,Ds=t.overflow,Er=s),s=hu(s,u.children),s.flags|=4096,s)}function mh(t,s,i){t.lanes|=s;var u=t.alternate;u!==null&&(u.lanes|=s),Vc(t.return,s,i)}function mu(t,s,i,u,p){var g=t.memoizedState;g===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:u,tail:i,tailMode:p}:(g.isBackwards=s,g.rendering=null,g.renderingStartTime=0,g.last=u,g.tail=i,g.tailMode=p)}function gh(t,s,i){var u=s.pendingProps,p=u.revealOrder,g=u.tail;if(kn(t,s,u.children,i),u=Ct.current,(u&2)!==0)u=u&1|2,s.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&mh(t,i,s);else if(t.tag===19)mh(t,i,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break e;for(;t.sibling===null;){if(t.return===null||t.return===s)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}u&=1}if(ut(Ct,u),(s.mode&1)===0)s.memoizedState=null;else switch(p){case"forwards":for(i=s.child,p=null;i!==null;)t=i.alternate,t!==null&&Ca(t)===null&&(p=i),i=i.sibling;i=p,i===null?(p=s.child,s.child=null):(p=i.sibling,i.sibling=null),mu(s,!1,p,i,g);break;case"backwards":for(i=null,p=s.child,s.child=null;p!==null;){if(t=p.alternate,t!==null&&Ca(t)===null){s.child=p;break}t=p.sibling,p.sibling=i,i=p,p=t}mu(s,!0,i,null,g);break;case"together":mu(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Ma(t,s){(s.mode&1)===0&&t!==null&&(t.alternate=null,s.alternate=null,s.flags|=2)}function Os(t,s,i){if(t!==null&&(s.dependencies=t.dependencies),Ir|=s.lanes,(i&s.childLanes)===0)return null;if(t!==null&&s.child!==t.child)throw Error(r(153));if(s.child!==null){for(t=s.child,i=ir(t,t.pendingProps),s.child=i,i.return=s;t.sibling!==null;)t=t.sibling,i=i.sibling=ir(t,t.pendingProps),i.return=s;i.sibling=null}return s.child}function g0(t,s,i){switch(s.tag){case 3:fh(s),oo();break;case 5:Rp(s);break;case 1:jn(s.type)&&ga(s);break;case 4:qc(s,s.stateNode.containerInfo);break;case 10:var u=s.type._context,p=s.memoizedProps.value;ut(Sa,u._currentValue),u._currentValue=p;break;case 13:if(u=s.memoizedState,u!==null)return u.dehydrated!==null?(ut(Ct,Ct.current&1),s.flags|=128,null):(i&s.child.childLanes)!==0?hh(t,s,i):(ut(Ct,Ct.current&1),t=Os(t,s,i),t!==null?t.sibling:null);ut(Ct,Ct.current&1);break;case 19:if(u=(i&s.childLanes)!==0,(t.flags&128)!==0){if(u)return gh(t,s,i);s.flags|=128}if(p=s.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),ut(Ct,Ct.current),u)break;return null;case 22:case 23:return s.lanes=0,ch(t,s,i)}return Os(t,s,i)}var vh,gu,yh,xh;vh=function(t,s){for(var i=s.child;i!==null;){if(i.tag===5||i.tag===6)t.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},gu=function(){},yh=function(t,s,i,u){var p=t.memoizedProps;if(p!==u){t=s.stateNode,Rr(ks.current);var g=null;switch(i){case"input":p=Ie(t,p),u=Ie(t,u),g=[];break;case"select":p=q({},p,{value:void 0}),u=q({},u,{value:void 0}),g=[];break;case"textarea":p=Ot(t,p),u=Ot(t,u),g=[];break;default:typeof p.onClick!="function"&&typeof u.onClick=="function"&&(t.onclick=pa)}ns(i,u);var w;i=null;for(K in p)if(!u.hasOwnProperty(K)&&p.hasOwnProperty(K)&&p[K]!=null)if(K==="style"){var _=p[K];for(w in _)_.hasOwnProperty(w)&&(i||(i={}),i[w]="")}else K!=="dangerouslySetInnerHTML"&&K!=="children"&&K!=="suppressContentEditableWarning"&&K!=="suppressHydrationWarning"&&K!=="autoFocus"&&(l.hasOwnProperty(K)?g||(g=[]):(g=g||[]).push(K,null));for(K in u){var D=u[K];if(_=p!=null?p[K]:void 0,u.hasOwnProperty(K)&&D!==_&&(D!=null||_!=null))if(K==="style")if(_){for(w in _)!_.hasOwnProperty(w)||D&&D.hasOwnProperty(w)||(i||(i={}),i[w]="");for(w in D)D.hasOwnProperty(w)&&_[w]!==D[w]&&(i||(i={}),i[w]=D[w])}else i||(g||(g=[]),g.push(K,i)),i=D;else K==="dangerouslySetInnerHTML"?(D=D?D.__html:void 0,_=_?_.__html:void 0,D!=null&&_!==D&&(g=g||[]).push(K,D)):K==="children"?typeof D!="string"&&typeof D!="number"||(g=g||[]).push(K,""+D):K!=="suppressContentEditableWarning"&&K!=="suppressHydrationWarning"&&(l.hasOwnProperty(K)?(D!=null&&K==="onScroll"&&pt("scroll",t),g||_===D||(g=[])):(g=g||[]).push(K,D))}i&&(g=g||[]).push("style",i);var K=g;(s.updateQueue=K)&&(s.flags|=4)}},xh=function(t,s,i,u){i!==u&&(s.flags|=4)};function ci(t,s){if(!wt)switch(t.tailMode){case"hidden":s=t.tail;for(var i=null;s!==null;)s.alternate!==null&&(i=s),s=s.sibling;i===null?t.tail=null:i.sibling=null;break;case"collapsed":i=t.tail;for(var u=null;i!==null;)i.alternate!==null&&(u=i),i=i.sibling;u===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function dn(t){var s=t.alternate!==null&&t.alternate.child===t.child,i=0,u=0;if(s)for(var p=t.child;p!==null;)i|=p.lanes|p.childLanes,u|=p.subtreeFlags&14680064,u|=p.flags&14680064,p.return=t,p=p.sibling;else for(p=t.child;p!==null;)i|=p.lanes|p.childLanes,u|=p.subtreeFlags,u|=p.flags,p.return=t,p=p.sibling;return t.subtreeFlags|=u,t.childLanes=i,s}function v0(t,s,i){var u=s.pendingProps;switch(Pc(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dn(s),null;case 1:return jn(s.type)&&ma(),dn(s),null;case 3:return u=s.stateNode,co(),ht(En),ht(cn),Qc(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(t===null||t.child===null)&&(wa(s)?s.flags|=4:t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,rs!==null&&(Eu(rs),rs=null))),gu(t,s),dn(s),null;case 5:Xc(s);var p=Rr(ri.current);if(i=s.type,t!==null&&s.stateNode!=null)yh(t,s,i,u,p),t.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!u){if(s.stateNode===null)throw Error(r(166));return dn(s),null}if(t=Rr(ks.current),wa(s)){u=s.stateNode,i=s.type;var g=s.memoizedProps;switch(u[ws]=s,u[Jo]=g,t=(s.mode&1)!==0,i){case"dialog":pt("cancel",u),pt("close",u);break;case"iframe":case"object":case"embed":pt("load",u);break;case"video":case"audio":for(p=0;p<Yo.length;p++)pt(Yo[p],u);break;case"source":pt("error",u);break;case"img":case"image":case"link":pt("error",u),pt("load",u);break;case"details":pt("toggle",u);break;case"input":mt(u,g),pt("invalid",u);break;case"select":u._wrapperState={wasMultiple:!!g.multiple},pt("invalid",u);break;case"textarea":Y(u,g),pt("invalid",u)}ns(i,g),p=null;for(var w in g)if(g.hasOwnProperty(w)){var _=g[w];w==="children"?typeof _=="string"?u.textContent!==_&&(g.suppressHydrationWarning!==!0&&fa(u.textContent,_,t),p=["children",_]):typeof _=="number"&&u.textContent!==""+_&&(g.suppressHydrationWarning!==!0&&fa(u.textContent,_,t),p=["children",""+_]):l.hasOwnProperty(w)&&_!=null&&w==="onScroll"&&pt("scroll",u)}switch(i){case"input":ge(u),tn(u,g,!0);break;case"textarea":ge(u),Be(u);break;case"select":case"option":break;default:typeof g.onClick=="function"&&(u.onclick=pa)}u=p,s.updateQueue=u,u!==null&&(s.flags|=4)}else{w=p.nodeType===9?p:p.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=rt(i)),t==="http://www.w3.org/1999/xhtml"?i==="script"?(t=w.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof u.is=="string"?t=w.createElement(i,{is:u.is}):(t=w.createElement(i),i==="select"&&(w=t,u.multiple?w.multiple=!0:u.size&&(w.size=u.size))):t=w.createElementNS(t,i),t[ws]=s,t[Jo]=u,vh(t,s,!1,!1),s.stateNode=t;e:{switch(w=On(i,u),i){case"dialog":pt("cancel",t),pt("close",t),p=u;break;case"iframe":case"object":case"embed":pt("load",t),p=u;break;case"video":case"audio":for(p=0;p<Yo.length;p++)pt(Yo[p],t);p=u;break;case"source":pt("error",t),p=u;break;case"img":case"image":case"link":pt("error",t),pt("load",t),p=u;break;case"details":pt("toggle",t),p=u;break;case"input":mt(t,u),p=Ie(t,u),pt("invalid",t);break;case"option":p=u;break;case"select":t._wrapperState={wasMultiple:!!u.multiple},p=q({},u,{value:void 0}),pt("invalid",t);break;case"textarea":Y(t,u),p=Ot(t,u),pt("invalid",t);break;default:p=u}ns(i,p),_=p;for(g in _)if(_.hasOwnProperty(g)){var D=_[g];g==="style"?hs(t,D):g==="dangerouslySetInnerHTML"?(D=D?D.__html:void 0,D!=null&&_t(t,D)):g==="children"?typeof D=="string"?(i!=="textarea"||D!=="")&&an(t,D):typeof D=="number"&&an(t,""+D):g!=="suppressContentEditableWarning"&&g!=="suppressHydrationWarning"&&g!=="autoFocus"&&(l.hasOwnProperty(g)?D!=null&&g==="onScroll"&&pt("scroll",t):D!=null&&P(t,g,D,w))}switch(i){case"input":ge(t),tn(t,u,!1);break;case"textarea":ge(t),Be(t);break;case"option":u.value!=null&&t.setAttribute("value",""+_e(u.value));break;case"select":t.multiple=!!u.multiple,g=u.value,g!=null?Ft(t,!!u.multiple,g,!1):u.defaultValue!=null&&Ft(t,!!u.multiple,u.defaultValue,!0);break;default:typeof p.onClick=="function"&&(t.onclick=pa)}switch(i){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}}u&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return dn(s),null;case 6:if(t&&s.stateNode!=null)xh(t,s,t.memoizedProps,u);else{if(typeof u!="string"&&s.stateNode===null)throw Error(r(166));if(i=Rr(ri.current),Rr(ks.current),wa(s)){if(u=s.stateNode,i=s.memoizedProps,u[ws]=s,(g=u.nodeValue!==i)&&(t=Un,t!==null))switch(t.tag){case 3:fa(u.nodeValue,i,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&fa(u.nodeValue,i,(t.mode&1)!==0)}g&&(s.flags|=4)}else u=(i.nodeType===9?i:i.ownerDocument).createTextNode(u),u[ws]=s,s.stateNode=u}return dn(s),null;case 13:if(ht(Ct),u=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(wt&&Bn!==null&&(s.mode&1)!==0&&(s.flags&128)===0)Sp(),oo(),s.flags|=98560,g=!1;else if(g=wa(s),u!==null&&u.dehydrated!==null){if(t===null){if(!g)throw Error(r(318));if(g=s.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));g[ws]=s}else oo(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;dn(s),g=!1}else rs!==null&&(Eu(rs),rs=null),g=!0;if(!g)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=i,s):(u=u!==null,u!==(t!==null&&t.memoizedState!==null)&&u&&(s.child.flags|=8192,(s.mode&1)!==0&&(t===null||(Ct.current&1)!==0?Wt===0&&(Wt=3):Ru())),s.updateQueue!==null&&(s.flags|=4),dn(s),null);case 4:return co(),gu(t,s),t===null&&Qo(s.stateNode.containerInfo),dn(s),null;case 10:return Hc(s.type._context),dn(s),null;case 17:return jn(s.type)&&ma(),dn(s),null;case 19:if(ht(Ct),g=s.memoizedState,g===null)return dn(s),null;if(u=(s.flags&128)!==0,w=g.rendering,w===null)if(u)ci(g,!1);else{if(Wt!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(w=Ca(t),w!==null){for(s.flags|=128,ci(g,!1),u=w.updateQueue,u!==null&&(s.updateQueue=u,s.flags|=4),s.subtreeFlags=0,u=i,i=s.child;i!==null;)g=i,t=u,g.flags&=14680066,w=g.alternate,w===null?(g.childLanes=0,g.lanes=t,g.child=null,g.subtreeFlags=0,g.memoizedProps=null,g.memoizedState=null,g.updateQueue=null,g.dependencies=null,g.stateNode=null):(g.childLanes=w.childLanes,g.lanes=w.lanes,g.child=w.child,g.subtreeFlags=0,g.deletions=null,g.memoizedProps=w.memoizedProps,g.memoizedState=w.memoizedState,g.updateQueue=w.updateQueue,g.type=w.type,t=w.dependencies,g.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),i=i.sibling;return ut(Ct,Ct.current&1|2),s.child}t=t.sibling}g.tail!==null&&bt()>ho&&(s.flags|=128,u=!0,ci(g,!1),s.lanes=4194304)}else{if(!u)if(t=Ca(w),t!==null){if(s.flags|=128,u=!0,i=t.updateQueue,i!==null&&(s.updateQueue=i,s.flags|=4),ci(g,!0),g.tail===null&&g.tailMode==="hidden"&&!w.alternate&&!wt)return dn(s),null}else 2*bt()-g.renderingStartTime>ho&&i!==1073741824&&(s.flags|=128,u=!0,ci(g,!1),s.lanes=4194304);g.isBackwards?(w.sibling=s.child,s.child=w):(i=g.last,i!==null?i.sibling=w:s.child=w,g.last=w)}return g.tail!==null?(s=g.tail,g.rendering=s,g.tail=s.sibling,g.renderingStartTime=bt(),s.sibling=null,i=Ct.current,ut(Ct,u?i&1|2:i&1),s):(dn(s),null);case 22:case 23:return _u(),u=s.memoizedState!==null,t!==null&&t.memoizedState!==null!==u&&(s.flags|=8192),u&&(s.mode&1)!==0?(Wn&1073741824)!==0&&(dn(s),s.subtreeFlags&6&&(s.flags|=8192)):dn(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function y0(t,s){switch(Pc(s),s.tag){case 1:return jn(s.type)&&ma(),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return co(),ht(En),ht(cn),Qc(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 5:return Xc(s),null;case 13:if(ht(Ct),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(r(340));oo()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return ht(Ct),null;case 4:return co(),null;case 10:return Hc(s.type._context),null;case 22:case 23:return _u(),null;case 24:return null;default:return null}}var La=!1,fn=!1,x0=typeof WeakSet=="function"?WeakSet:Set,ke=null;function fo(t,s){var i=t.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(u){It(t,s,u)}else i.current=null}function vu(t,s,i){try{i()}catch(u){It(t,s,u)}}var wh=!1;function w0(t,s){if(_c=ta,t=Zf(),kc(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var u=i.getSelection&&i.getSelection();if(u&&u.rangeCount!==0){i=u.anchorNode;var p=u.anchorOffset,g=u.focusNode;u=u.focusOffset;try{i.nodeType,g.nodeType}catch{i=null;break e}var w=0,_=-1,D=-1,K=0,re=0,ae=t,se=null;t:for(;;){for(var xe;ae!==i||p!==0&&ae.nodeType!==3||(_=w+p),ae!==g||u!==0&&ae.nodeType!==3||(D=w+u),ae.nodeType===3&&(w+=ae.nodeValue.length),(xe=ae.firstChild)!==null;)se=ae,ae=xe;for(;;){if(ae===t)break t;if(se===i&&++K===p&&(_=w),se===g&&++re===u&&(D=w),(xe=ae.nextSibling)!==null)break;ae=se,se=ae.parentNode}ae=xe}i=_===-1||D===-1?null:{start:_,end:D}}else i=null}i=i||{start:0,end:0}}else i=null;for(Rc={focusedElem:t,selectionRange:i},ta=!1,ke=s;ke!==null;)if(s=ke,t=s.child,(s.subtreeFlags&1028)!==0&&t!==null)t.return=s,ke=t;else for(;ke!==null;){s=ke;try{var Ne=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(Ne!==null){var Ce=Ne.memoizedProps,Mt=Ne.memoizedState,H=s.stateNode,O=H.getSnapshotBeforeUpdate(s.elementType===s.type?Ce:os(s.type,Ce),Mt);H.__reactInternalSnapshotBeforeUpdate=O}break;case 3:var V=s.stateNode.containerInfo;V.nodeType===1?V.textContent="":V.nodeType===9&&V.documentElement&&V.removeChild(V.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(fe){It(s,s.return,fe)}if(t=s.sibling,t!==null){t.return=s.return,ke=t;break}ke=s.return}return Ne=wh,wh=!1,Ne}function ui(t,s,i){var u=s.updateQueue;if(u=u!==null?u.lastEffect:null,u!==null){var p=u=u.next;do{if((p.tag&t)===t){var g=p.destroy;p.destroy=void 0,g!==void 0&&vu(s,i,g)}p=p.next}while(p!==u)}}function Oa(t,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var i=s=s.next;do{if((i.tag&t)===t){var u=i.create;i.destroy=u()}i=i.next}while(i!==s)}}function yu(t){var s=t.ref;if(s!==null){var i=t.stateNode;switch(t.tag){case 5:t=i;break;default:t=i}typeof s=="function"?s(t):s.current=t}}function kh(t){var s=t.alternate;s!==null&&(t.alternate=null,kh(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&(delete s[ws],delete s[Jo],delete s[Mc],delete s[n0],delete s[s0])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Sh(t){return t.tag===5||t.tag===3||t.tag===4}function bh(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Sh(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function xu(t,s,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,s?i.nodeType===8?i.parentNode.insertBefore(t,s):i.insertBefore(t,s):(i.nodeType===8?(s=i.parentNode,s.insertBefore(t,i)):(s=i,s.appendChild(t)),i=i._reactRootContainer,i!=null||s.onclick!==null||(s.onclick=pa));else if(u!==4&&(t=t.child,t!==null))for(xu(t,s,i),t=t.sibling;t!==null;)xu(t,s,i),t=t.sibling}function wu(t,s,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,s?i.insertBefore(t,s):i.appendChild(t);else if(u!==4&&(t=t.child,t!==null))for(wu(t,s,i),t=t.sibling;t!==null;)wu(t,s,i),t=t.sibling}var nn=null,is=!1;function tr(t,s,i){for(i=i.child;i!==null;)Nh(t,s,i),i=i.sibling}function Nh(t,s,i){if(zn&&typeof zn.onCommitFiberUnmount=="function")try{zn.onCommitFiberUnmount(wr,i)}catch{}switch(i.tag){case 5:fn||fo(i,s);case 6:var u=nn,p=is;nn=null,tr(t,s,i),nn=u,is=p,nn!==null&&(is?(t=nn,i=i.stateNode,t.nodeType===8?t.parentNode.removeChild(i):t.removeChild(i)):nn.removeChild(i.stateNode));break;case 18:nn!==null&&(is?(t=nn,i=i.stateNode,t.nodeType===8?Dc(t.parentNode,i):t.nodeType===1&&Dc(t,i),Bo(t)):Dc(nn,i.stateNode));break;case 4:u=nn,p=is,nn=i.stateNode.containerInfo,is=!0,tr(t,s,i),nn=u,is=p;break;case 0:case 11:case 14:case 15:if(!fn&&(u=i.updateQueue,u!==null&&(u=u.lastEffect,u!==null))){p=u=u.next;do{var g=p,w=g.destroy;g=g.tag,w!==void 0&&((g&2)!==0||(g&4)!==0)&&vu(i,s,w),p=p.next}while(p!==u)}tr(t,s,i);break;case 1:if(!fn&&(fo(i,s),u=i.stateNode,typeof u.componentWillUnmount=="function"))try{u.props=i.memoizedProps,u.state=i.memoizedState,u.componentWillUnmount()}catch(_){It(i,s,_)}tr(t,s,i);break;case 21:tr(t,s,i);break;case 22:i.mode&1?(fn=(u=fn)||i.memoizedState!==null,tr(t,s,i),fn=u):tr(t,s,i);break;default:tr(t,s,i)}}function Th(t){var s=t.updateQueue;if(s!==null){t.updateQueue=null;var i=t.stateNode;i===null&&(i=t.stateNode=new x0),s.forEach(function(u){var p=_0.bind(null,t,u);i.has(u)||(i.add(u),u.then(p,p))})}}function as(t,s){var i=s.deletions;if(i!==null)for(var u=0;u<i.length;u++){var p=i[u];try{var g=t,w=s,_=w;e:for(;_!==null;){switch(_.tag){case 5:nn=_.stateNode,is=!1;break e;case 3:nn=_.stateNode.containerInfo,is=!0;break e;case 4:nn=_.stateNode.containerInfo,is=!0;break e}_=_.return}if(nn===null)throw Error(r(160));Nh(g,w,p),nn=null,is=!1;var D=p.alternate;D!==null&&(D.return=null),p.return=null}catch(K){It(p,s,K)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Ch(s,t),s=s.sibling}function Ch(t,s){var i=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(as(s,t),bs(t),u&4){try{ui(3,t,t.return),Oa(3,t)}catch(Ce){It(t,t.return,Ce)}try{ui(5,t,t.return)}catch(Ce){It(t,t.return,Ce)}}break;case 1:as(s,t),bs(t),u&512&&i!==null&&fo(i,i.return);break;case 5:if(as(s,t),bs(t),u&512&&i!==null&&fo(i,i.return),t.flags&32){var p=t.stateNode;try{an(p,"")}catch(Ce){It(t,t.return,Ce)}}if(u&4&&(p=t.stateNode,p!=null)){var g=t.memoizedProps,w=i!==null?i.memoizedProps:g,_=t.type,D=t.updateQueue;if(t.updateQueue=null,D!==null)try{_==="input"&&g.type==="radio"&&g.name!=null&&Ue(p,g),On(_,w);var K=On(_,g);for(w=0;w<D.length;w+=2){var re=D[w],ae=D[w+1];re==="style"?hs(p,ae):re==="dangerouslySetInnerHTML"?_t(p,ae):re==="children"?an(p,ae):P(p,re,ae,K)}switch(_){case"input":Vt(p,g);break;case"textarea":ve(p,g);break;case"select":var se=p._wrapperState.wasMultiple;p._wrapperState.wasMultiple=!!g.multiple;var xe=g.value;xe!=null?Ft(p,!!g.multiple,xe,!1):se!==!!g.multiple&&(g.defaultValue!=null?Ft(p,!!g.multiple,g.defaultValue,!0):Ft(p,!!g.multiple,g.multiple?[]:"",!1))}p[Jo]=g}catch(Ce){It(t,t.return,Ce)}}break;case 6:if(as(s,t),bs(t),u&4){if(t.stateNode===null)throw Error(r(162));p=t.stateNode,g=t.memoizedProps;try{p.nodeValue=g}catch(Ce){It(t,t.return,Ce)}}break;case 3:if(as(s,t),bs(t),u&4&&i!==null&&i.memoizedState.isDehydrated)try{Bo(s.containerInfo)}catch(Ce){It(t,t.return,Ce)}break;case 4:as(s,t),bs(t);break;case 13:as(s,t),bs(t),p=t.child,p.flags&8192&&(g=p.memoizedState!==null,p.stateNode.isHidden=g,!g||p.alternate!==null&&p.alternate.memoizedState!==null||(bu=bt())),u&4&&Th(t);break;case 22:if(re=i!==null&&i.memoizedState!==null,t.mode&1?(fn=(K=fn)||re,as(s,t),fn=K):as(s,t),bs(t),u&8192){if(K=t.memoizedState!==null,(t.stateNode.isHidden=K)&&!re&&(t.mode&1)!==0)for(ke=t,re=t.child;re!==null;){for(ae=ke=re;ke!==null;){switch(se=ke,xe=se.child,se.tag){case 0:case 11:case 14:case 15:ui(4,se,se.return);break;case 1:fo(se,se.return);var Ne=se.stateNode;if(typeof Ne.componentWillUnmount=="function"){u=se,i=se.return;try{s=u,Ne.props=s.memoizedProps,Ne.state=s.memoizedState,Ne.componentWillUnmount()}catch(Ce){It(u,i,Ce)}}break;case 5:fo(se,se.return);break;case 22:if(se.memoizedState!==null){_h(ae);continue}}xe!==null?(xe.return=se,ke=xe):_h(ae)}re=re.sibling}e:for(re=null,ae=t;;){if(ae.tag===5){if(re===null){re=ae;try{p=ae.stateNode,K?(g=p.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none"):(_=ae.stateNode,D=ae.memoizedProps.style,w=D!=null&&D.hasOwnProperty("display")?D.display:null,_.style.display=Ln("display",w))}catch(Ce){It(t,t.return,Ce)}}}else if(ae.tag===6){if(re===null)try{ae.stateNode.nodeValue=K?"":ae.memoizedProps}catch(Ce){It(t,t.return,Ce)}}else if((ae.tag!==22&&ae.tag!==23||ae.memoizedState===null||ae===t)&&ae.child!==null){ae.child.return=ae,ae=ae.child;continue}if(ae===t)break e;for(;ae.sibling===null;){if(ae.return===null||ae.return===t)break e;re===ae&&(re=null),ae=ae.return}re===ae&&(re=null),ae.sibling.return=ae.return,ae=ae.sibling}}break;case 19:as(s,t),bs(t),u&4&&Th(t);break;case 21:break;default:as(s,t),bs(t)}}function bs(t){var s=t.flags;if(s&2){try{e:{for(var i=t.return;i!==null;){if(Sh(i)){var u=i;break e}i=i.return}throw Error(r(160))}switch(u.tag){case 5:var p=u.stateNode;u.flags&32&&(an(p,""),u.flags&=-33);var g=bh(t);wu(t,g,p);break;case 3:case 4:var w=u.stateNode.containerInfo,_=bh(t);xu(t,_,w);break;default:throw Error(r(161))}}catch(D){It(t,t.return,D)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function k0(t,s,i){ke=t,Eh(t)}function Eh(t,s,i){for(var u=(t.mode&1)!==0;ke!==null;){var p=ke,g=p.child;if(p.tag===22&&u){var w=p.memoizedState!==null||La;if(!w){var _=p.alternate,D=_!==null&&_.memoizedState!==null||fn;_=La;var K=fn;if(La=w,(fn=D)&&!K)for(ke=p;ke!==null;)w=ke,D=w.child,w.tag===22&&w.memoizedState!==null?Rh(p):D!==null?(D.return=w,ke=D):Rh(p);for(;g!==null;)ke=g,Eh(g),g=g.sibling;ke=p,La=_,fn=K}jh(t)}else(p.subtreeFlags&8772)!==0&&g!==null?(g.return=p,ke=g):jh(t)}}function jh(t){for(;ke!==null;){var s=ke;if((s.flags&8772)!==0){var i=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:fn||Oa(5,s);break;case 1:var u=s.stateNode;if(s.flags&4&&!fn)if(i===null)u.componentDidMount();else{var p=s.elementType===s.type?i.memoizedProps:os(s.type,i.memoizedProps);u.componentDidUpdate(p,i.memoizedState,u.__reactInternalSnapshotBeforeUpdate)}var g=s.updateQueue;g!==null&&_p(s,g,u);break;case 3:var w=s.updateQueue;if(w!==null){if(i=null,s.child!==null)switch(s.child.tag){case 5:i=s.child.stateNode;break;case 1:i=s.child.stateNode}_p(s,w,i)}break;case 5:var _=s.stateNode;if(i===null&&s.flags&4){i=_;var D=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":D.autoFocus&&i.focus();break;case"img":D.src&&(i.src=D.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var K=s.alternate;if(K!==null){var re=K.memoizedState;if(re!==null){var ae=re.dehydrated;ae!==null&&Bo(ae)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}fn||s.flags&512&&yu(s)}catch(se){It(s,s.return,se)}}if(s===t){ke=null;break}if(i=s.sibling,i!==null){i.return=s.return,ke=i;break}ke=s.return}}function _h(t){for(;ke!==null;){var s=ke;if(s===t){ke=null;break}var i=s.sibling;if(i!==null){i.return=s.return,ke=i;break}ke=s.return}}function Rh(t){for(;ke!==null;){var s=ke;try{switch(s.tag){case 0:case 11:case 15:var i=s.return;try{Oa(4,s)}catch(D){It(s,i,D)}break;case 1:var u=s.stateNode;if(typeof u.componentDidMount=="function"){var p=s.return;try{u.componentDidMount()}catch(D){It(s,p,D)}}var g=s.return;try{yu(s)}catch(D){It(s,g,D)}break;case 5:var w=s.return;try{yu(s)}catch(D){It(s,w,D)}}}catch(D){It(s,s.return,D)}if(s===t){ke=null;break}var _=s.sibling;if(_!==null){_.return=s.return,ke=_;break}ke=s.return}}var S0=Math.ceil,$a=M.ReactCurrentDispatcher,ku=M.ReactCurrentOwner,Qn=M.ReactCurrentBatchConfig,Qe=0,Yt=null,Pt=null,sn=0,Wn=0,po=Ys(0),Wt=0,di=null,Ir=0,Pa=0,Su=0,fi=null,Rn=null,bu=0,ho=1/0,$s=null,za=!1,Nu=null,nr=null,Fa=!1,sr=null,Ua=0,pi=0,Tu=null,Ba=-1,Wa=0;function Sn(){return(Qe&6)!==0?bt():Ba!==-1?Ba:Ba=bt()}function rr(t){return(t.mode&1)===0?1:(Qe&2)!==0&&sn!==0?sn&-sn:o0.transition!==null?(Wa===0&&(Wa=Po()),Wa):(t=Xe,t!==0||(t=window.event,t=t===void 0?16:If(t.type)),t)}function ls(t,s,i,u){if(50<pi)throw pi=0,Tu=null,Error(r(185));Nr(t,i,u),((Qe&2)===0||t!==Yt)&&(t===Yt&&((Qe&2)===0&&(Pa|=i),Wt===4&&or(t,sn)),An(t,u),i===1&&Qe===0&&(s.mode&1)===0&&(ho=bt()+500,va&&Zs()))}function An(t,s){var i=t.callbackNode;Zi(t,s);var u=br(t,t===Yt?sn:0);if(u===0)i!==null&&At(i),t.callbackNode=null,t.callbackPriority=0;else if(s=u&-u,t.callbackPriority!==s){if(i!=null&&At(i),s===1)t.tag===0?r0(Ih.bind(null,t)):vp(Ih.bind(null,t)),e0(function(){(Qe&6)===0&&Zs()}),i=null;else{switch(de(u)){case 1:i=Ws;break;case 4:i=xs;break;case 16:i=Wr;break;case 536870912:i=Yi;break;default:i=Wr}i=Fh(i,Ah.bind(null,t))}t.callbackPriority=s,t.callbackNode=i}}function Ah(t,s){if(Ba=-1,Wa=0,(Qe&6)!==0)throw Error(r(327));var i=t.callbackNode;if(mo()&&t.callbackNode!==i)return null;var u=br(t,t===Yt?sn:0);if(u===0)return null;if((u&30)!==0||(u&t.expiredLanes)!==0||s)s=Ha(t,u);else{s=u;var p=Qe;Qe|=2;var g=Mh();(Yt!==t||sn!==s)&&($s=null,ho=bt()+500,Mr(t,s));do try{T0();break}catch(_){Dh(t,_)}while(!0);Wc(),$a.current=g,Qe=p,Pt!==null?s=0:(Yt=null,sn=0,s=Wt)}if(s!==0){if(s===2&&(p=$o(t),p!==0&&(u=p,s=Cu(t,p))),s===1)throw i=di,Mr(t,0),or(t,u),An(t,bt()),i;if(s===6)or(t,u);else{if(p=t.current.alternate,(u&30)===0&&!b0(p)&&(s=Ha(t,u),s===2&&(g=$o(t),g!==0&&(u=g,s=Cu(t,g))),s===1))throw i=di,Mr(t,0),or(t,u),An(t,bt()),i;switch(t.finishedWork=p,t.finishedLanes=u,s){case 0:case 1:throw Error(r(345));case 2:Lr(t,Rn,$s);break;case 3:if(or(t,u),(u&130023424)===u&&(s=bu+500-bt(),10<s)){if(br(t,0)!==0)break;if(p=t.suspendedLanes,(p&u)!==u){Sn(),t.pingedLanes|=t.suspendedLanes&p;break}t.timeoutHandle=Ic(Lr.bind(null,t,Rn,$s),s);break}Lr(t,Rn,$s);break;case 4:if(or(t,u),(u&4194240)===u)break;for(s=t.eventTimes,p=-1;0<u;){var w=31-xn(u);g=1<<w,w=s[w],w>p&&(p=w),u&=~g}if(u=p,u=bt()-u,u=(120>u?120:480>u?480:1080>u?1080:1920>u?1920:3e3>u?3e3:4320>u?4320:1960*S0(u/1960))-u,10<u){t.timeoutHandle=Ic(Lr.bind(null,t,Rn,$s),u);break}Lr(t,Rn,$s);break;case 5:Lr(t,Rn,$s);break;default:throw Error(r(329))}}}return An(t,bt()),t.callbackNode===i?Ah.bind(null,t):null}function Cu(t,s){var i=fi;return t.current.memoizedState.isDehydrated&&(Mr(t,s).flags|=256),t=Ha(t,s),t!==2&&(s=Rn,Rn=i,s!==null&&Eu(s)),t}function Eu(t){Rn===null?Rn=t:Rn.push.apply(Rn,t)}function b0(t){for(var s=t;;){if(s.flags&16384){var i=s.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var u=0;u<i.length;u++){var p=i[u],g=p.getSnapshot;p=p.value;try{if(!ss(g(),p))return!1}catch{return!1}}}if(i=s.child,s.subtreeFlags&16384&&i!==null)i.return=s,s=i;else{if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function or(t,s){for(s&=~Su,s&=~Pa,t.suspendedLanes|=s,t.pingedLanes&=~s,t=t.expirationTimes;0<s;){var i=31-xn(s),u=1<<i;t[i]=-1,s&=~u}}function Ih(t){if((Qe&6)!==0)throw Error(r(327));mo();var s=br(t,0);if((s&1)===0)return An(t,bt()),null;var i=Ha(t,s);if(t.tag!==0&&i===2){var u=$o(t);u!==0&&(s=u,i=Cu(t,u))}if(i===1)throw i=di,Mr(t,0),or(t,s),An(t,bt()),i;if(i===6)throw Error(r(345));return t.finishedWork=t.current.alternate,t.finishedLanes=s,Lr(t,Rn,$s),An(t,bt()),null}function ju(t,s){var i=Qe;Qe|=1;try{return t(s)}finally{Qe=i,Qe===0&&(ho=bt()+500,va&&Zs())}}function Dr(t){sr!==null&&sr.tag===0&&(Qe&6)===0&&mo();var s=Qe;Qe|=1;var i=Qn.transition,u=Xe;try{if(Qn.transition=null,Xe=1,t)return t()}finally{Xe=u,Qn.transition=i,Qe=s,(Qe&6)===0&&Zs()}}function _u(){Wn=po.current,ht(po)}function Mr(t,s){t.finishedWork=null,t.finishedLanes=0;var i=t.timeoutHandle;if(i!==-1&&(t.timeoutHandle=-1,Jx(i)),Pt!==null)for(i=Pt.return;i!==null;){var u=i;switch(Pc(u),u.tag){case 1:u=u.type.childContextTypes,u!=null&&ma();break;case 3:co(),ht(En),ht(cn),Qc();break;case 5:Xc(u);break;case 4:co();break;case 13:ht(Ct);break;case 19:ht(Ct);break;case 10:Hc(u.type._context);break;case 22:case 23:_u()}i=i.return}if(Yt=t,Pt=t=ir(t.current,null),sn=Wn=s,Wt=0,di=null,Su=Pa=Ir=0,Rn=fi=null,_r!==null){for(s=0;s<_r.length;s++)if(i=_r[s],u=i.interleaved,u!==null){i.interleaved=null;var p=u.next,g=i.pending;if(g!==null){var w=g.next;g.next=p,u.next=w}i.pending=u}_r=null}return t}function Dh(t,s){do{var i=Pt;try{if(Wc(),Ea.current=Aa,ja){for(var u=Et.memoizedState;u!==null;){var p=u.queue;p!==null&&(p.pending=null),u=u.next}ja=!1}if(Ar=0,Xt=Bt=Et=null,oi=!1,ii=0,ku.current=null,i===null||i.return===null){Wt=1,di=s,Pt=null;break}e:{var g=t,w=i.return,_=i,D=s;if(s=sn,_.flags|=32768,D!==null&&typeof D=="object"&&typeof D.then=="function"){var K=D,re=_,ae=re.tag;if((re.mode&1)===0&&(ae===0||ae===11||ae===15)){var se=re.alternate;se?(re.updateQueue=se.updateQueue,re.memoizedState=se.memoizedState,re.lanes=se.lanes):(re.updateQueue=null,re.memoizedState=null)}var xe=rh(w);if(xe!==null){xe.flags&=-257,oh(xe,w,_,g,s),xe.mode&1&&sh(g,K,s),s=xe,D=K;var Ne=s.updateQueue;if(Ne===null){var Ce=new Set;Ce.add(D),s.updateQueue=Ce}else Ne.add(D);break e}else{if((s&1)===0){sh(g,K,s),Ru();break e}D=Error(r(426))}}else if(wt&&_.mode&1){var Mt=rh(w);if(Mt!==null){(Mt.flags&65536)===0&&(Mt.flags|=256),oh(Mt,w,_,g,s),Uc(uo(D,_));break e}}g=D=uo(D,_),Wt!==4&&(Wt=2),fi===null?fi=[g]:fi.push(g),g=w;do{switch(g.tag){case 3:g.flags|=65536,s&=-s,g.lanes|=s;var H=th(g,D,s);jp(g,H);break e;case 1:_=D;var O=g.type,V=g.stateNode;if((g.flags&128)===0&&(typeof O.getDerivedStateFromError=="function"||V!==null&&typeof V.componentDidCatch=="function"&&(nr===null||!nr.has(V)))){g.flags|=65536,s&=-s,g.lanes|=s;var fe=nh(g,_,s);jp(g,fe);break e}}g=g.return}while(g!==null)}Oh(i)}catch(Ee){s=Ee,Pt===i&&i!==null&&(Pt=i=i.return);continue}break}while(!0)}function Mh(){var t=$a.current;return $a.current=Aa,t===null?Aa:t}function Ru(){(Wt===0||Wt===3||Wt===2)&&(Wt=4),Yt===null||(Ir&268435455)===0&&(Pa&268435455)===0||or(Yt,sn)}function Ha(t,s){var i=Qe;Qe|=2;var u=Mh();(Yt!==t||sn!==s)&&($s=null,Mr(t,s));do try{N0();break}catch(p){Dh(t,p)}while(!0);if(Wc(),Qe=i,$a.current=u,Pt!==null)throw Error(r(261));return Yt=null,sn=0,Wt}function N0(){for(;Pt!==null;)Lh(Pt)}function T0(){for(;Pt!==null&&!vs();)Lh(Pt)}function Lh(t){var s=zh(t.alternate,t,Wn);t.memoizedProps=t.pendingProps,s===null?Oh(t):Pt=s,ku.current=null}function Oh(t){var s=t;do{var i=s.alternate;if(t=s.return,(s.flags&32768)===0){if(i=v0(i,s,Wn),i!==null){Pt=i;return}}else{if(i=y0(i,s),i!==null){i.flags&=32767,Pt=i;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Wt=6,Pt=null;return}}if(s=s.sibling,s!==null){Pt=s;return}Pt=s=t}while(s!==null);Wt===0&&(Wt=5)}function Lr(t,s,i){var u=Xe,p=Qn.transition;try{Qn.transition=null,Xe=1,C0(t,s,i,u)}finally{Qn.transition=p,Xe=u}return null}function C0(t,s,i,u){do mo();while(sr!==null);if((Qe&6)!==0)throw Error(r(327));i=t.finishedWork;var p=t.finishedLanes;if(i===null)return null;if(t.finishedWork=null,t.finishedLanes=0,i===t.current)throw Error(r(177));t.callbackNode=null,t.callbackPriority=0;var g=i.lanes|i.childLanes;if(Ji(t,g),t===Yt&&(Pt=Yt=null,sn=0),(i.subtreeFlags&2064)===0&&(i.flags&2064)===0||Fa||(Fa=!0,Fh(Wr,function(){return mo(),null})),g=(i.flags&15990)!==0,(i.subtreeFlags&15990)!==0||g){g=Qn.transition,Qn.transition=null;var w=Xe;Xe=1;var _=Qe;Qe|=4,ku.current=null,w0(t,i),Ch(i,t),Kx(Rc),ta=!!_c,Rc=_c=null,t.current=i,k0(i),cc(),Qe=_,Xe=w,Qn.transition=g}else t.current=i;if(Fa&&(Fa=!1,sr=t,Ua=p),g=t.pendingLanes,g===0&&(nr=null),Hr(i.stateNode),An(t,bt()),s!==null)for(u=t.onRecoverableError,i=0;i<s.length;i++)p=s[i],u(p.value,{componentStack:p.stack,digest:p.digest});if(za)throw za=!1,t=Nu,Nu=null,t;return(Ua&1)!==0&&t.tag!==0&&mo(),g=t.pendingLanes,(g&1)!==0?t===Tu?pi++:(pi=0,Tu=t):pi=0,Zs(),null}function mo(){if(sr!==null){var t=de(Ua),s=Qn.transition,i=Xe;try{if(Qn.transition=null,Xe=16>t?16:t,sr===null)var u=!1;else{if(t=sr,sr=null,Ua=0,(Qe&6)!==0)throw Error(r(331));var p=Qe;for(Qe|=4,ke=t.current;ke!==null;){var g=ke,w=g.child;if((ke.flags&16)!==0){var _=g.deletions;if(_!==null){for(var D=0;D<_.length;D++){var K=_[D];for(ke=K;ke!==null;){var re=ke;switch(re.tag){case 0:case 11:case 15:ui(8,re,g)}var ae=re.child;if(ae!==null)ae.return=re,ke=ae;else for(;ke!==null;){re=ke;var se=re.sibling,xe=re.return;if(kh(re),re===K){ke=null;break}if(se!==null){se.return=xe,ke=se;break}ke=xe}}}var Ne=g.alternate;if(Ne!==null){var Ce=Ne.child;if(Ce!==null){Ne.child=null;do{var Mt=Ce.sibling;Ce.sibling=null,Ce=Mt}while(Ce!==null)}}ke=g}}if((g.subtreeFlags&2064)!==0&&w!==null)w.return=g,ke=w;else e:for(;ke!==null;){if(g=ke,(g.flags&2048)!==0)switch(g.tag){case 0:case 11:case 15:ui(9,g,g.return)}var H=g.sibling;if(H!==null){H.return=g.return,ke=H;break e}ke=g.return}}var O=t.current;for(ke=O;ke!==null;){w=ke;var V=w.child;if((w.subtreeFlags&2064)!==0&&V!==null)V.return=w,ke=V;else e:for(w=O;ke!==null;){if(_=ke,(_.flags&2048)!==0)try{switch(_.tag){case 0:case 11:case 15:Oa(9,_)}}catch(Ee){It(_,_.return,Ee)}if(_===w){ke=null;break e}var fe=_.sibling;if(fe!==null){fe.return=_.return,ke=fe;break e}ke=_.return}}if(Qe=p,Zs(),zn&&typeof zn.onPostCommitFiberRoot=="function")try{zn.onPostCommitFiberRoot(wr,t)}catch{}u=!0}return u}finally{Xe=i,Qn.transition=s}}return!1}function $h(t,s,i){s=uo(i,s),s=th(t,s,1),t=er(t,s,1),s=Sn(),t!==null&&(Nr(t,1,s),An(t,s))}function It(t,s,i){if(t.tag===3)$h(t,t,i);else for(;s!==null;){if(s.tag===3){$h(s,t,i);break}else if(s.tag===1){var u=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(nr===null||!nr.has(u))){t=uo(i,t),t=nh(s,t,1),s=er(s,t,1),t=Sn(),s!==null&&(Nr(s,1,t),An(s,t));break}}s=s.return}}function E0(t,s,i){var u=t.pingCache;u!==null&&u.delete(s),s=Sn(),t.pingedLanes|=t.suspendedLanes&i,Yt===t&&(sn&i)===i&&(Wt===4||Wt===3&&(sn&130023424)===sn&&500>bt()-bu?Mr(t,0):Su|=i),An(t,s)}function Ph(t,s){s===0&&((t.mode&1)===0?s=1:(s=Kr,Kr<<=1,(Kr&130023424)===0&&(Kr=4194304)));var i=Sn();t=Ms(t,s),t!==null&&(Nr(t,s,i),An(t,i))}function j0(t){var s=t.memoizedState,i=0;s!==null&&(i=s.retryLane),Ph(t,i)}function _0(t,s){var i=0;switch(t.tag){case 13:var u=t.stateNode,p=t.memoizedState;p!==null&&(i=p.retryLane);break;case 19:u=t.stateNode;break;default:throw Error(r(314))}u!==null&&u.delete(s),Ph(t,i)}var zh;zh=function(t,s,i){if(t!==null)if(t.memoizedProps!==s.pendingProps||En.current)_n=!0;else{if((t.lanes&i)===0&&(s.flags&128)===0)return _n=!1,g0(t,s,i);_n=(t.flags&131072)!==0}else _n=!1,wt&&(s.flags&1048576)!==0&&yp(s,xa,s.index);switch(s.lanes=0,s.tag){case 2:var u=s.type;Ma(t,s),t=s.pendingProps;var p=no(s,cn.current);lo(s,i),p=eu(null,s,u,t,p,i);var g=tu();return s.flags|=1,typeof p=="object"&&p!==null&&typeof p.render=="function"&&p.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,jn(u)?(g=!0,ga(s)):g=!1,s.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,Gc(s),p.updater=Ia,s.stateNode=p,p._reactInternals=s,au(s,u,t,i),s=du(null,s,u,!0,g,i)):(s.tag=0,wt&&g&&$c(s),kn(null,s,p,i),s=s.child),s;case 16:u=s.elementType;e:{switch(Ma(t,s),t=s.pendingProps,p=u._init,u=p(u._payload),s.type=u,p=s.tag=A0(u),t=os(u,t),p){case 0:s=uu(null,s,u,t,i);break e;case 1:s=dh(null,s,u,t,i);break e;case 11:s=ih(null,s,u,t,i);break e;case 14:s=ah(null,s,u,os(u.type,t),i);break e}throw Error(r(306,u,""))}return s;case 0:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:os(u,p),uu(t,s,u,p,i);case 1:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:os(u,p),dh(t,s,u,p,i);case 3:e:{if(fh(s),t===null)throw Error(r(387));u=s.pendingProps,g=s.memoizedState,p=g.element,Ep(t,s),Ta(s,u,null,i);var w=s.memoizedState;if(u=w.element,g.isDehydrated)if(g={element:u,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},s.updateQueue.baseState=g,s.memoizedState=g,s.flags&256){p=uo(Error(r(423)),s),s=ph(t,s,u,i,p);break e}else if(u!==p){p=uo(Error(r(424)),s),s=ph(t,s,u,i,p);break e}else for(Bn=Xs(s.stateNode.containerInfo.firstChild),Un=s,wt=!0,rs=null,i=Tp(s,null,u,i),s.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(oo(),u===p){s=Os(t,s,i);break e}kn(t,s,u,i)}s=s.child}return s;case 5:return Rp(s),t===null&&Fc(s),u=s.type,p=s.pendingProps,g=t!==null?t.memoizedProps:null,w=p.children,Ac(u,p)?w=null:g!==null&&Ac(u,g)&&(s.flags|=32),uh(t,s),kn(t,s,w,i),s.child;case 6:return t===null&&Fc(s),null;case 13:return hh(t,s,i);case 4:return qc(s,s.stateNode.containerInfo),u=s.pendingProps,t===null?s.child=io(s,null,u,i):kn(t,s,u,i),s.child;case 11:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:os(u,p),ih(t,s,u,p,i);case 7:return kn(t,s,s.pendingProps,i),s.child;case 8:return kn(t,s,s.pendingProps.children,i),s.child;case 12:return kn(t,s,s.pendingProps.children,i),s.child;case 10:e:{if(u=s.type._context,p=s.pendingProps,g=s.memoizedProps,w=p.value,ut(Sa,u._currentValue),u._currentValue=w,g!==null)if(ss(g.value,w)){if(g.children===p.children&&!En.current){s=Os(t,s,i);break e}}else for(g=s.child,g!==null&&(g.return=s);g!==null;){var _=g.dependencies;if(_!==null){w=g.child;for(var D=_.firstContext;D!==null;){if(D.context===u){if(g.tag===1){D=Ls(-1,i&-i),D.tag=2;var K=g.updateQueue;if(K!==null){K=K.shared;var re=K.pending;re===null?D.next=D:(D.next=re.next,re.next=D),K.pending=D}}g.lanes|=i,D=g.alternate,D!==null&&(D.lanes|=i),Vc(g.return,i,s),_.lanes|=i;break}D=D.next}}else if(g.tag===10)w=g.type===s.type?null:g.child;else if(g.tag===18){if(w=g.return,w===null)throw Error(r(341));w.lanes|=i,_=w.alternate,_!==null&&(_.lanes|=i),Vc(w,i,s),w=g.sibling}else w=g.child;if(w!==null)w.return=g;else for(w=g;w!==null;){if(w===s){w=null;break}if(g=w.sibling,g!==null){g.return=w.return,w=g;break}w=w.return}g=w}kn(t,s,p.children,i),s=s.child}return s;case 9:return p=s.type,u=s.pendingProps.children,lo(s,i),p=Xn(p),u=u(p),s.flags|=1,kn(t,s,u,i),s.child;case 14:return u=s.type,p=os(u,s.pendingProps),p=os(u.type,p),ah(t,s,u,p,i);case 15:return lh(t,s,s.type,s.pendingProps,i);case 17:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:os(u,p),Ma(t,s),s.tag=1,jn(u)?(t=!0,ga(s)):t=!1,lo(s,i),Jp(s,u,p),au(s,u,p,i),du(null,s,u,!0,t,i);case 19:return gh(t,s,i);case 22:return ch(t,s,i)}throw Error(r(156,s.tag))};function Fh(t,s){return Je(t,s)}function R0(t,s,i,u){this.tag=t,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zn(t,s,i,u){return new R0(t,s,i,u)}function Au(t){return t=t.prototype,!(!t||!t.isReactComponent)}function A0(t){if(typeof t=="function")return Au(t)?1:0;if(t!=null){if(t=t.$$typeof,t===me)return 11;if(t===ee)return 14}return 2}function ir(t,s){var i=t.alternate;return i===null?(i=Zn(t.tag,s,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=s,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&14680064,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,s=t.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i}function Va(t,s,i,u,p,g){var w=2;if(u=t,typeof t=="function")Au(t)&&(w=1);else if(typeof t=="string")w=5;else e:switch(t){case z:return Or(i.children,p,g,s);case U:w=8,p|=8;break;case Q:return t=Zn(12,i,s,p|2),t.elementType=Q,t.lanes=g,t;case Se:return t=Zn(13,i,s,p),t.elementType=Se,t.lanes=g,t;case Me:return t=Zn(19,i,s,p),t.elementType=Me,t.lanes=g,t;case te:return Ka(i,p,g,s);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case J:w=10;break e;case oe:w=9;break e;case me:w=11;break e;case ee:w=14;break e;case ie:w=16,u=null;break e}throw Error(r(130,t==null?t:typeof t,""))}return s=Zn(w,i,s,p),s.elementType=t,s.type=u,s.lanes=g,s}function Or(t,s,i,u){return t=Zn(7,t,u,s),t.lanes=i,t}function Ka(t,s,i,u){return t=Zn(22,t,u,s),t.elementType=te,t.lanes=i,t.stateNode={isHidden:!1},t}function Iu(t,s,i){return t=Zn(6,t,null,s),t.lanes=i,t}function Du(t,s,i){return s=Zn(4,t.children!==null?t.children:[],t.key,s),s.lanes=i,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}function I0(t,s,i,u,p){this.tag=s,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zo(0),this.expirationTimes=zo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zo(0),this.identifierPrefix=u,this.onRecoverableError=p,this.mutableSourceEagerHydrationData=null}function Mu(t,s,i,u,p,g,w,_,D){return t=new I0(t,s,i,_,D),s===1?(s=1,g===!0&&(s|=8)):s=0,g=Zn(3,null,null,s),t.current=g,g.stateNode=t,g.memoizedState={element:u,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Gc(g),t}function D0(t,s,i){var u=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:G,key:u==null?null:""+u,children:t,containerInfo:s,implementation:i}}function Uh(t){if(!t)return Qs;t=t._reactInternals;e:{if(We(t)!==t||t.tag!==1)throw Error(r(170));var s=t;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(jn(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(r(171))}if(t.tag===1){var i=t.type;if(jn(i))return mp(t,i,s)}return s}function Bh(t,s,i,u,p,g,w,_,D){return t=Mu(i,u,!0,t,p,g,w,_,D),t.context=Uh(null),i=t.current,u=Sn(),p=rr(i),g=Ls(u,p),g.callback=s??null,er(i,g,p),t.current.lanes=p,Nr(t,p,u),An(t,u),t}function Ga(t,s,i,u){var p=s.current,g=Sn(),w=rr(p);return i=Uh(i),s.context===null?s.context=i:s.pendingContext=i,s=Ls(g,w),s.payload={element:t},u=u===void 0?null:u,u!==null&&(s.callback=u),t=er(p,s,w),t!==null&&(ls(t,p,w,g),Na(t,p,w)),w}function qa(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Wh(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i<s?i:s}}function Lu(t,s){Wh(t,s),(t=t.alternate)&&Wh(t,s)}function M0(){return null}var Hh=typeof reportError=="function"?reportError:function(t){console.error(t)};function Ou(t){this._internalRoot=t}Xa.prototype.render=Ou.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(r(409));Ga(t,s,null,null)},Xa.prototype.unmount=Ou.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;Dr(function(){Ga(null,t,null,null)}),s[Rs]=null}};function Xa(t){this._internalRoot=t}Xa.prototype.unstable_scheduleHydration=function(t){if(t){var s=Te();t={blockedOn:null,target:t,priority:s};for(var i=0;i<Ks.length&&s!==0&&s<Ks[i].priority;i++);Ks.splice(i,0,t),i===0&&Rf(t)}};function $u(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Ya(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Vh(){}function L0(t,s,i,u,p){if(p){if(typeof u=="function"){var g=u;u=function(){var K=qa(w);g.call(K)}}var w=Bh(s,u,t,0,null,!1,!1,"",Vh);return t._reactRootContainer=w,t[Rs]=w.current,Qo(t.nodeType===8?t.parentNode:t),Dr(),w}for(;p=t.lastChild;)t.removeChild(p);if(typeof u=="function"){var _=u;u=function(){var K=qa(D);_.call(K)}}var D=Mu(t,0,!1,null,null,!1,!1,"",Vh);return t._reactRootContainer=D,t[Rs]=D.current,Qo(t.nodeType===8?t.parentNode:t),Dr(function(){Ga(s,D,i,u)}),D}function Qa(t,s,i,u,p){var g=i._reactRootContainer;if(g){var w=g;if(typeof p=="function"){var _=p;p=function(){var D=qa(w);_.call(D)}}Ga(s,w,t,p)}else w=L0(i,s,t,p,u);return qa(w)}N=function(t){switch(t.tag){case 3:var s=t.stateNode;if(s.current.memoizedState.isDehydrated){var i=Sr(s.pendingLanes);i!==0&&(Vs(s,i|1),An(s,bt()),(Qe&6)===0&&(ho=bt()+500,Zs()))}break;case 13:Dr(function(){var u=Ms(t,1);if(u!==null){var p=Sn();ls(u,t,1,p)}}),Lu(t,1)}},W=function(t){if(t.tag===13){var s=Ms(t,134217728);if(s!==null){var i=Sn();ls(s,t,134217728,i)}Lu(t,134217728)}},ne=function(t){if(t.tag===13){var s=rr(t),i=Ms(t,s);if(i!==null){var u=Sn();ls(i,t,s,u)}Lu(t,s)}},Te=function(){return Xe},Re=function(t,s){var i=Xe;try{return Xe=t,s()}finally{Xe=i}},Kt=function(t,s,i){switch(s){case"input":if(Vt(t,i),s=i.name,i.type==="radio"&&s!=null){for(i=t;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<i.length;s++){var u=i[s];if(u!==t&&u.form===t.form){var p=ha(u);if(!p)throw Error(r(90));he(u),Vt(u,p)}}}break;case"textarea":ve(t,i);break;case"select":s=i.value,s!=null&&Ft(t,!!i.multiple,s,!1)}},yt=ju,xt=Dr;var O0={usingClientEntryPoint:!1,Events:[ei,eo,ha,ft,Gt,ju]},hi={findFiberByHostInstance:Tr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},$0={bundleType:hi.bundleType,version:hi.version,rendererPackageName:hi.rendererPackageName,rendererConfig:hi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:M.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Pn(t),t===null?null:t.stateNode},findFiberByHostInstance:hi.findFiberByHostInstance||M0,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 Za=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Za.isDisabled&&Za.supportsFiber)try{wr=Za.inject($0),zn=Za}catch{}}return In.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=O0,In.createPortal=function(t,s){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!$u(s))throw Error(r(200));return D0(t,s,null,i)},In.createRoot=function(t,s){if(!$u(t))throw Error(r(299));var i=!1,u="",p=Hh;return s!=null&&(s.unstable_strictMode===!0&&(i=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onRecoverableError!==void 0&&(p=s.onRecoverableError)),s=Mu(t,1,!1,null,null,i,!1,u,p),t[Rs]=s.current,Qo(t.nodeType===8?t.parentNode:t),new Ou(s)},In.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=Pn(s),t=t===null?null:t.stateNode,t},In.flushSync=function(t){return Dr(t)},In.hydrate=function(t,s,i){if(!Ya(s))throw Error(r(200));return Qa(null,t,s,!0,i)},In.hydrateRoot=function(t,s,i){if(!$u(t))throw Error(r(405));var u=i!=null&&i.hydratedSources||null,p=!1,g="",w=Hh;if(i!=null&&(i.unstable_strictMode===!0&&(p=!0),i.identifierPrefix!==void 0&&(g=i.identifierPrefix),i.onRecoverableError!==void 0&&(w=i.onRecoverableError)),s=Bh(s,null,t,1,i??null,p,!1,g,w),t[Rs]=s.current,Qo(t),u)for(t=0;t<u.length;t++)i=u[t],p=i._getVersion,p=p(i._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[i,p]:s.mutableSourceEagerHydrationData.push(i,p);return new Xa(s)},In.render=function(t,s,i){if(!Ya(s))throw Error(r(200));return Qa(null,t,s,!1,i)},In.unmountComponentAtNode=function(t){if(!Ya(t))throw Error(r(40));return t._reactRootContainer?(Dr(function(){Qa(null,null,t,!1,function(){t._reactRootContainer=null,t[Rs]=null})}),!0):!1},In.unstable_batchedUpdates=ju,In.unstable_renderSubtreeIntoContainer=function(t,s,i,u){if(!Ya(i))throw Error(r(200));if(t==null||t._reactInternals===void 0)throw Error(r(38));return Qa(t,s,i,!1,u)},In.version="18.3.1-next-f1338f8080-20240426",In}var Jh;function nv(){if(Jh)return Fu.exports;Jh=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Fu.exports=K0(),Fu.exports}var em;function G0(){if(em)return Ja;em=1;var e=nv();return Ja.createRoot=e.createRoot,Ja.hydrateRoot=e.hydrateRoot,Ja}var q0=G0();const X0=tv(q0),tm=e=>{let n;const r=new Set,o=(m,v)=>{const k=typeof m=="function"?m(n):m;if(!Object.is(k,n)){const x=n;n=v??(typeof k!="object"||k===null)?k:Object.assign({},n,k),r.forEach(S=>S(n,x))}},l=()=>n,f={setState:o,getState:l,getInitialState:()=>h,subscribe:m=>(r.add(m),()=>r.delete(m))},h=n=e(o,l,f);return f},Y0=(e=>e?tm(e):tm),Q0=e=>e;function Z0(e,n=Q0){const r=ct.useSyncExternalStore(e.subscribe,ct.useCallback(()=>n(e.getState()),[e,n]),ct.useCallback(()=>n(e.getInitialState()),[e,n]));return ct.useDebugValue(r),r}const J0=e=>{const n=Y0(e),r=o=>Z0(n,o);return Object.assign(r,n),r},ew=(e=>J0),sv="agentpane:machines",rv="agentpane:active-machine";function tw(e){return/^[a-z][a-z0-9-]{1,30}$/.test(e)}function ov(e){return`${e}.repoburg.com`}function iv(e){const n=/^([a-z][a-z0-9-]{1,30})\.repoburg\.com$/.exec(e);return n?n[1]:null}function av(e,n){try{const r=localStorage.getItem(e);return r==null?n:JSON.parse(r)}catch{return n}}function lv(e,n){try{localStorage.setItem(e,JSON.stringify(n))}catch{}}function nw(e){const{mahlas:n,hostname:r}=e??{};return typeof n=="string"&&tw(n)&&r===ov(n)}function cv(){const e=av(sv,[]);return Array.isArray(e)?e.filter(nw):[]}function sw(e){const n={mahlas:e,hostname:ov(e),lastConnectedAt:new Date().toISOString()},r=cv(),o=[n,...r.filter(l=>l.mahlas!==e)];return lv(sv,o),n}function rw(){const e=av(rv,null);return e?cv().find(n=>n.mahlas===e)??null:null}function ow(e){lv(rv,e)}function iw(){if(typeof window>"u")return;const e=new URLSearchParams(window.location.search).get("host");if(!e)return;const n=iv(e);n&&(sw(n),ow(n))}const nm="http://localhost:9998",aw=["agent.repoburg.com"];function mn(){if(typeof window>"u")return"";const e=new URLSearchParams(window.location.search),n=e.get("bport");if(n)return`http://localhost:${n}`;const r=e.get("host");if(r)return`https://${r}`;const o=window.location.hostname;if(aw.includes(o))return nm;if(iv(o))return"";const l=rw();return l?`https://${l.hostname}`:o==="localhost"||o==="127.0.0.1"||o==="0.0.0.0"?"":nm}function lw(e){const n=mn();return n?`${n.replace(/^http/,"ws")}${e}`:`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${e}`}const cw="/api";class Ui extends Error{constructor(r,o,l){super(r);at(this,"status");at(this,"body");this.name="ApiError",this.status=o,this.body=l}}function hr(e){var n;if(e instanceof Ui){const r=(n=e.body)==null?void 0:n.error;if(typeof r=="string"&&r)return r}return e instanceof Error?e.message:String(e)}async function Bi(e,n,r){const o=await fetch(`${mn()}${cw}${n}`,{method:e,headers:r?{"Content-Type":"application/json"}:void 0,body:r?JSON.stringify(r):void 0});if(!o.ok){let l=`${o.status} ${o.statusText}`,c=null;try{c=await o.json();const d=c==null?void 0:c.error;typeof d=="string"&&d&&(l=`${l} — ${d}`)}catch{}throw new Ui(`${e} ${n} failed: ${l}`,o.status,c)}return o.json()}function kt(e){return Bi("GET",e)}function st(e,n){return Bi("POST",e,n)}function Vl(e){return Bi("DELETE",e)}function ds(e,n){return Bi("PATCH",e,n)}function uw(e,n){return Bi("PUT",e,n)}const Ts=new Map;function Vd(e,n,r){return`${e}
41
+ `+g.stack}return{value:t,source:s,stack:p,digest:null}}function cu(t,s,i){return{value:t,source:null,stack:i??null,digest:s??null}}function uu(t,s){try{console.error(s.value)}catch(i){setTimeout(function(){throw i})}}var p0=typeof WeakMap=="function"?WeakMap:Map;function th(t,s,i){i=Ls(-1,i),i.tag=3,i.payload={element:null};var u=s.value;return i.callback=function(){za||(za=!0,Tu=u),uu(t,s)},i}function nh(t,s,i){i=Ls(-1,i),i.tag=3;var u=t.type.getDerivedStateFromError;if(typeof u=="function"){var p=s.value;i.payload=function(){return u(p)},i.callback=function(){uu(t,s)}}var g=t.stateNode;return g!==null&&typeof g.componentDidCatch=="function"&&(i.callback=function(){uu(t,s),typeof u!="function"&&(nr===null?nr=new Set([this]):nr.add(this));var w=s.stack;this.componentDidCatch(s.value,{componentStack:w!==null?w:""})}),i}function sh(t,s,i){var u=t.pingCache;if(u===null){u=t.pingCache=new p0;var p=new Set;u.set(s,p)}else p=u.get(s),p===void 0&&(p=new Set,u.set(s,p));p.has(i)||(p.add(i),t=E0.bind(null,t,s,i),s.then(t,t))}function rh(t){do{var s;if((s=t.tag===13)&&(s=t.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return t;t=t.return}while(t!==null);return null}function oh(t,s,i,u,p){return(t.mode&1)===0?(t===s?t.flags|=65536:(t.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(s=Ls(-1,1),s.tag=2,er(i,s,1))),i.lanes|=1),t):(t.flags|=65536,t.lanes=p,t)}var h0=M.ReactCurrentOwner,_n=!1;function kn(t,s,i,u){s.child=t===null?Tp(s,null,i,u):io(s,t.child,i,u)}function ih(t,s,i,u,p){i=i.render;var g=s.ref;return lo(s,p),u=tu(t,s,i,u,g,p),i=nu(),t!==null&&!_n?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~p,Os(t,s,p)):(wt&&i&&Pc(s),s.flags|=1,kn(t,s,u,p),s.child)}function ah(t,s,i,u,p){if(t===null){var g=i.type;return typeof g=="function"&&!Iu(g)&&g.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(s.tag=15,s.type=g,lh(t,s,g,u,p)):(t=Va(i.type,null,u,s,s.mode,p),t.ref=s.ref,t.return=s,s.child=t)}if(g=t.child,(t.lanes&p)===0){var w=g.memoizedProps;if(i=i.compare,i=i!==null?i:qo,i(w,u)&&t.ref===s.ref)return Os(t,s,p)}return s.flags|=1,t=ir(g,u),t.ref=s.ref,t.return=s,s.child=t}function lh(t,s,i,u,p){if(t!==null){var g=t.memoizedProps;if(qo(g,u)&&t.ref===s.ref)if(_n=!1,s.pendingProps=u=g,(t.lanes&p)!==0)(t.flags&131072)!==0&&(_n=!0);else return s.lanes=t.lanes,Os(t,s,p)}return du(t,s,i,u,p)}function ch(t,s,i){var u=s.pendingProps,p=u.children,g=t!==null?t.memoizedState:null;if(u.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},ut(po,Wn),Wn|=i;else{if((i&1073741824)===0)return t=g!==null?g.baseLanes|i:i,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:t,cachePool:null,transitions:null},s.updateQueue=null,ut(po,Wn),Wn|=t,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},u=g!==null?g.baseLanes:i,ut(po,Wn),Wn|=u}else g!==null?(u=g.baseLanes|i,s.memoizedState=null):u=i,ut(po,Wn),Wn|=u;return kn(t,s,p,i),s.child}function uh(t,s){var i=s.ref;(t===null&&i!==null||t!==null&&t.ref!==i)&&(s.flags|=512,s.flags|=2097152)}function du(t,s,i,u,p){var g=jn(i)?Cr:cn.current;return g=no(s,g),lo(s,p),i=tu(t,s,i,u,g,p),u=nu(),t!==null&&!_n?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~p,Os(t,s,p)):(wt&&u&&Pc(s),s.flags|=1,kn(t,s,i,p),s.child)}function dh(t,s,i,u,p){if(jn(i)){var g=!0;ga(s)}else g=!1;if(lo(s,p),s.stateNode===null)Ma(t,s),Jp(s,i,u),lu(s,i,u,p),u=!0;else if(t===null){var w=s.stateNode,_=s.memoizedProps;w.props=_;var D=w.context,K=i.contextType;typeof K=="object"&&K!==null?K=Xn(K):(K=jn(i)?Cr:cn.current,K=no(s,K));var re=i.getDerivedStateFromProps,ae=typeof re=="function"||typeof w.getSnapshotBeforeUpdate=="function";ae||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(_!==u||D!==K)&&eh(s,w,u,K),Js=!1;var se=s.memoizedState;w.state=se,Ta(s,u,w,p),D=s.memoizedState,_!==u||se!==D||En.current||Js?(typeof re=="function"&&(au(s,i,re,u),D=s.memoizedState),(_=Js||Zp(s,i,_,u,se,D,K))?(ae||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(s.flags|=4194308)):(typeof w.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=u,s.memoizedState=D),w.props=u,w.state=D,w.context=K,u=_):(typeof w.componentDidMount=="function"&&(s.flags|=4194308),u=!1)}else{w=s.stateNode,Ep(t,s),_=s.memoizedProps,K=s.type===s.elementType?_:os(s.type,_),w.props=K,ae=s.pendingProps,se=w.context,D=i.contextType,typeof D=="object"&&D!==null?D=Xn(D):(D=jn(i)?Cr:cn.current,D=no(s,D));var xe=i.getDerivedStateFromProps;(re=typeof xe=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(_!==ae||se!==D)&&eh(s,w,u,D),Js=!1,se=s.memoizedState,w.state=se,Ta(s,u,w,p);var Ne=s.memoizedState;_!==ae||se!==Ne||En.current||Js?(typeof xe=="function"&&(au(s,i,xe,u),Ne=s.memoizedState),(K=Js||Zp(s,i,K,u,se,Ne,D)||!1)?(re||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(u,Ne,D),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(u,Ne,D)),typeof w.componentDidUpdate=="function"&&(s.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof w.componentDidUpdate!="function"||_===t.memoizedProps&&se===t.memoizedState||(s.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||_===t.memoizedProps&&se===t.memoizedState||(s.flags|=1024),s.memoizedProps=u,s.memoizedState=Ne),w.props=u,w.state=Ne,w.context=D,u=K):(typeof w.componentDidUpdate!="function"||_===t.memoizedProps&&se===t.memoizedState||(s.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||_===t.memoizedProps&&se===t.memoizedState||(s.flags|=1024),u=!1)}return fu(t,s,i,u,g,p)}function fu(t,s,i,u,p,g){uh(t,s);var w=(s.flags&128)!==0;if(!u&&!w)return p&&gp(s,i,!1),Os(t,s,g);u=s.stateNode,h0.current=s;var _=w&&typeof i.getDerivedStateFromError!="function"?null:u.render();return s.flags|=1,t!==null&&w?(s.child=io(s,t.child,null,g),s.child=io(s,null,_,g)):kn(t,s,_,g),s.memoizedState=u.state,p&&gp(s,i,!0),s.child}function fh(t){var s=t.stateNode;s.pendingContext?hp(t,s.pendingContext,s.pendingContext!==s.context):s.context&&hp(t,s.context,!1),Xc(t,s.containerInfo)}function ph(t,s,i,u,p){return oo(),Bc(p),s.flags|=256,kn(t,s,i,u),s.child}var pu={dehydrated:null,treeContext:null,retryLane:0};function hu(t){return{baseLanes:t,cachePool:null,transitions:null}}function hh(t,s,i){var u=s.pendingProps,p=Ct.current,g=!1,w=(s.flags&128)!==0,_;if((_=w)||(_=t!==null&&t.memoizedState===null?!1:(p&2)!==0),_?(g=!0,s.flags&=-129):(t===null||t.memoizedState!==null)&&(p|=1),ut(Ct,p&1),t===null)return Uc(s),t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?((s.mode&1)===0?s.lanes=1:t.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(w=u.children,t=u.fallback,g?(u=s.mode,g=s.child,w={mode:"hidden",children:w},(u&1)===0&&g!==null?(g.childLanes=0,g.pendingProps=w):g=Ka(w,u,0,null),t=Or(t,u,i,null),g.return=s,t.return=s,g.sibling=t,s.child=g,s.child.memoizedState=hu(i),s.memoizedState=pu,t):mu(s,w));if(p=t.memoizedState,p!==null&&(_=p.dehydrated,_!==null))return m0(t,s,w,u,_,p,i);if(g){g=u.fallback,w=s.mode,p=t.child,_=p.sibling;var D={mode:"hidden",children:u.children};return(w&1)===0&&s.child!==p?(u=s.child,u.childLanes=0,u.pendingProps=D,s.deletions=null):(u=ir(p,D),u.subtreeFlags=p.subtreeFlags&14680064),_!==null?g=ir(_,g):(g=Or(g,w,i,null),g.flags|=2),g.return=s,u.return=s,u.sibling=g,s.child=u,u=g,g=s.child,w=t.child.memoizedState,w=w===null?hu(i):{baseLanes:w.baseLanes|i,cachePool:null,transitions:w.transitions},g.memoizedState=w,g.childLanes=t.childLanes&~i,s.memoizedState=pu,u}return g=t.child,t=g.sibling,u=ir(g,{mode:"visible",children:u.children}),(s.mode&1)===0&&(u.lanes=i),u.return=s,u.sibling=null,t!==null&&(i=s.deletions,i===null?(s.deletions=[t],s.flags|=16):i.push(t)),s.child=u,s.memoizedState=null,u}function mu(t,s){return s=Ka({mode:"visible",children:s},t.mode,0,null),s.return=t,t.child=s}function Da(t,s,i,u){return u!==null&&Bc(u),io(s,t.child,null,i),t=mu(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function m0(t,s,i,u,p,g,w){if(i)return s.flags&256?(s.flags&=-257,u=cu(Error(r(422))),Da(t,s,w,u)):s.memoizedState!==null?(s.child=t.child,s.flags|=128,null):(g=u.fallback,p=s.mode,u=Ka({mode:"visible",children:u.children},p,0,null),g=Or(g,p,w,null),g.flags|=2,u.return=s,g.return=s,u.sibling=g,s.child=u,(s.mode&1)!==0&&io(s,t.child,null,w),s.child.memoizedState=hu(w),s.memoizedState=pu,g);if((s.mode&1)===0)return Da(t,s,w,null);if(p.data==="$!"){if(u=p.nextSibling&&p.nextSibling.dataset,u)var _=u.dgst;return u=_,g=Error(r(419)),u=cu(g,u,void 0),Da(t,s,w,u)}if(_=(w&t.childLanes)!==0,_n||_){if(u=Yt,u!==null){switch(w&-w){case 4:p=2;break;case 16:p=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:p=32;break;case 536870912:p=268435456;break;default:p=0}p=(p&(u.suspendedLanes|w))!==0?0:p,p!==0&&p!==g.retryLane&&(g.retryLane=p,Ms(t,p),ls(u,t,p,-1))}return Au(),u=cu(Error(r(421))),Da(t,s,w,u)}return p.data==="$?"?(s.flags|=128,s.child=t.child,s=j0.bind(null,t),p._reactRetry=s,null):(t=g.treeContext,Bn=Xs(p.nextSibling),Un=s,wt=!0,rs=null,t!==null&&(Gn[qn++]=Is,Gn[qn++]=Ds,Gn[qn++]=Er,Is=t.id,Ds=t.overflow,Er=s),s=mu(s,u.children),s.flags|=4096,s)}function mh(t,s,i){t.lanes|=s;var u=t.alternate;u!==null&&(u.lanes|=s),Kc(t.return,s,i)}function gu(t,s,i,u,p){var g=t.memoizedState;g===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:u,tail:i,tailMode:p}:(g.isBackwards=s,g.rendering=null,g.renderingStartTime=0,g.last=u,g.tail=i,g.tailMode=p)}function gh(t,s,i){var u=s.pendingProps,p=u.revealOrder,g=u.tail;if(kn(t,s,u.children,i),u=Ct.current,(u&2)!==0)u=u&1|2,s.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&mh(t,i,s);else if(t.tag===19)mh(t,i,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break e;for(;t.sibling===null;){if(t.return===null||t.return===s)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}u&=1}if(ut(Ct,u),(s.mode&1)===0)s.memoizedState=null;else switch(p){case"forwards":for(i=s.child,p=null;i!==null;)t=i.alternate,t!==null&&Ca(t)===null&&(p=i),i=i.sibling;i=p,i===null?(p=s.child,s.child=null):(p=i.sibling,i.sibling=null),gu(s,!1,p,i,g);break;case"backwards":for(i=null,p=s.child,s.child=null;p!==null;){if(t=p.alternate,t!==null&&Ca(t)===null){s.child=p;break}t=p.sibling,p.sibling=i,i=p,p=t}gu(s,!0,i,null,g);break;case"together":gu(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Ma(t,s){(s.mode&1)===0&&t!==null&&(t.alternate=null,s.alternate=null,s.flags|=2)}function Os(t,s,i){if(t!==null&&(s.dependencies=t.dependencies),Ir|=s.lanes,(i&s.childLanes)===0)return null;if(t!==null&&s.child!==t.child)throw Error(r(153));if(s.child!==null){for(t=s.child,i=ir(t,t.pendingProps),s.child=i,i.return=s;t.sibling!==null;)t=t.sibling,i=i.sibling=ir(t,t.pendingProps),i.return=s;i.sibling=null}return s.child}function g0(t,s,i){switch(s.tag){case 3:fh(s),oo();break;case 5:Rp(s);break;case 1:jn(s.type)&&ga(s);break;case 4:Xc(s,s.stateNode.containerInfo);break;case 10:var u=s.type._context,p=s.memoizedProps.value;ut(Sa,u._currentValue),u._currentValue=p;break;case 13:if(u=s.memoizedState,u!==null)return u.dehydrated!==null?(ut(Ct,Ct.current&1),s.flags|=128,null):(i&s.child.childLanes)!==0?hh(t,s,i):(ut(Ct,Ct.current&1),t=Os(t,s,i),t!==null?t.sibling:null);ut(Ct,Ct.current&1);break;case 19:if(u=(i&s.childLanes)!==0,(t.flags&128)!==0){if(u)return gh(t,s,i);s.flags|=128}if(p=s.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),ut(Ct,Ct.current),u)break;return null;case 22:case 23:return s.lanes=0,ch(t,s,i)}return Os(t,s,i)}var vh,vu,yh,xh;vh=function(t,s){for(var i=s.child;i!==null;){if(i.tag===5||i.tag===6)t.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},vu=function(){},yh=function(t,s,i,u){var p=t.memoizedProps;if(p!==u){t=s.stateNode,Rr(Ss.current);var g=null;switch(i){case"input":p=Ie(t,p),u=Ie(t,u),g=[];break;case"select":p=q({},p,{value:void 0}),u=q({},u,{value:void 0}),g=[];break;case"textarea":p=Ot(t,p),u=Ot(t,u),g=[];break;default:typeof p.onClick!="function"&&typeof u.onClick=="function"&&(t.onclick=pa)}ns(i,u);var w;i=null;for(K in p)if(!u.hasOwnProperty(K)&&p.hasOwnProperty(K)&&p[K]!=null)if(K==="style"){var _=p[K];for(w in _)_.hasOwnProperty(w)&&(i||(i={}),i[w]="")}else K!=="dangerouslySetInnerHTML"&&K!=="children"&&K!=="suppressContentEditableWarning"&&K!=="suppressHydrationWarning"&&K!=="autoFocus"&&(l.hasOwnProperty(K)?g||(g=[]):(g=g||[]).push(K,null));for(K in u){var D=u[K];if(_=p!=null?p[K]:void 0,u.hasOwnProperty(K)&&D!==_&&(D!=null||_!=null))if(K==="style")if(_){for(w in _)!_.hasOwnProperty(w)||D&&D.hasOwnProperty(w)||(i||(i={}),i[w]="");for(w in D)D.hasOwnProperty(w)&&_[w]!==D[w]&&(i||(i={}),i[w]=D[w])}else i||(g||(g=[]),g.push(K,i)),i=D;else K==="dangerouslySetInnerHTML"?(D=D?D.__html:void 0,_=_?_.__html:void 0,D!=null&&_!==D&&(g=g||[]).push(K,D)):K==="children"?typeof D!="string"&&typeof D!="number"||(g=g||[]).push(K,""+D):K!=="suppressContentEditableWarning"&&K!=="suppressHydrationWarning"&&(l.hasOwnProperty(K)?(D!=null&&K==="onScroll"&&pt("scroll",t),g||_===D||(g=[])):(g=g||[]).push(K,D))}i&&(g=g||[]).push("style",i);var K=g;(s.updateQueue=K)&&(s.flags|=4)}},xh=function(t,s,i,u){i!==u&&(s.flags|=4)};function ci(t,s){if(!wt)switch(t.tailMode){case"hidden":s=t.tail;for(var i=null;s!==null;)s.alternate!==null&&(i=s),s=s.sibling;i===null?t.tail=null:i.sibling=null;break;case"collapsed":i=t.tail;for(var u=null;i!==null;)i.alternate!==null&&(u=i),i=i.sibling;u===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function dn(t){var s=t.alternate!==null&&t.alternate.child===t.child,i=0,u=0;if(s)for(var p=t.child;p!==null;)i|=p.lanes|p.childLanes,u|=p.subtreeFlags&14680064,u|=p.flags&14680064,p.return=t,p=p.sibling;else for(p=t.child;p!==null;)i|=p.lanes|p.childLanes,u|=p.subtreeFlags,u|=p.flags,p.return=t,p=p.sibling;return t.subtreeFlags|=u,t.childLanes=i,s}function v0(t,s,i){var u=s.pendingProps;switch(zc(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dn(s),null;case 1:return jn(s.type)&&ma(),dn(s),null;case 3:return u=s.stateNode,co(),ht(En),ht(cn),Zc(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(t===null||t.child===null)&&(wa(s)?s.flags|=4:t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,rs!==null&&(ju(rs),rs=null))),vu(t,s),dn(s),null;case 5:Yc(s);var p=Rr(ri.current);if(i=s.type,t!==null&&s.stateNode!=null)yh(t,s,i,u,p),t.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!u){if(s.stateNode===null)throw Error(r(166));return dn(s),null}if(t=Rr(Ss.current),wa(s)){u=s.stateNode,i=s.type;var g=s.memoizedProps;switch(u[ks]=s,u[Jo]=g,t=(s.mode&1)!==0,i){case"dialog":pt("cancel",u),pt("close",u);break;case"iframe":case"object":case"embed":pt("load",u);break;case"video":case"audio":for(p=0;p<Yo.length;p++)pt(Yo[p],u);break;case"source":pt("error",u);break;case"img":case"image":case"link":pt("error",u),pt("load",u);break;case"details":pt("toggle",u);break;case"input":mt(u,g),pt("invalid",u);break;case"select":u._wrapperState={wasMultiple:!!g.multiple},pt("invalid",u);break;case"textarea":Y(u,g),pt("invalid",u)}ns(i,g),p=null;for(var w in g)if(g.hasOwnProperty(w)){var _=g[w];w==="children"?typeof _=="string"?u.textContent!==_&&(g.suppressHydrationWarning!==!0&&fa(u.textContent,_,t),p=["children",_]):typeof _=="number"&&u.textContent!==""+_&&(g.suppressHydrationWarning!==!0&&fa(u.textContent,_,t),p=["children",""+_]):l.hasOwnProperty(w)&&_!=null&&w==="onScroll"&&pt("scroll",u)}switch(i){case"input":ge(u),tn(u,g,!0);break;case"textarea":ge(u),Be(u);break;case"select":case"option":break;default:typeof g.onClick=="function"&&(u.onclick=pa)}u=p,s.updateQueue=u,u!==null&&(s.flags|=4)}else{w=p.nodeType===9?p:p.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=rt(i)),t==="http://www.w3.org/1999/xhtml"?i==="script"?(t=w.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof u.is=="string"?t=w.createElement(i,{is:u.is}):(t=w.createElement(i),i==="select"&&(w=t,u.multiple?w.multiple=!0:u.size&&(w.size=u.size))):t=w.createElementNS(t,i),t[ks]=s,t[Jo]=u,vh(t,s,!1,!1),s.stateNode=t;e:{switch(w=On(i,u),i){case"dialog":pt("cancel",t),pt("close",t),p=u;break;case"iframe":case"object":case"embed":pt("load",t),p=u;break;case"video":case"audio":for(p=0;p<Yo.length;p++)pt(Yo[p],t);p=u;break;case"source":pt("error",t),p=u;break;case"img":case"image":case"link":pt("error",t),pt("load",t),p=u;break;case"details":pt("toggle",t),p=u;break;case"input":mt(t,u),p=Ie(t,u),pt("invalid",t);break;case"option":p=u;break;case"select":t._wrapperState={wasMultiple:!!u.multiple},p=q({},u,{value:void 0}),pt("invalid",t);break;case"textarea":Y(t,u),p=Ot(t,u),pt("invalid",t);break;default:p=u}ns(i,p),_=p;for(g in _)if(_.hasOwnProperty(g)){var D=_[g];g==="style"?ms(t,D):g==="dangerouslySetInnerHTML"?(D=D?D.__html:void 0,D!=null&&_t(t,D)):g==="children"?typeof D=="string"?(i!=="textarea"||D!=="")&&an(t,D):typeof D=="number"&&an(t,""+D):g!=="suppressContentEditableWarning"&&g!=="suppressHydrationWarning"&&g!=="autoFocus"&&(l.hasOwnProperty(g)?D!=null&&g==="onScroll"&&pt("scroll",t):D!=null&&P(t,g,D,w))}switch(i){case"input":ge(t),tn(t,u,!1);break;case"textarea":ge(t),Be(t);break;case"option":u.value!=null&&t.setAttribute("value",""+_e(u.value));break;case"select":t.multiple=!!u.multiple,g=u.value,g!=null?Ft(t,!!u.multiple,g,!1):u.defaultValue!=null&&Ft(t,!!u.multiple,u.defaultValue,!0);break;default:typeof p.onClick=="function"&&(t.onclick=pa)}switch(i){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}}u&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return dn(s),null;case 6:if(t&&s.stateNode!=null)xh(t,s,t.memoizedProps,u);else{if(typeof u!="string"&&s.stateNode===null)throw Error(r(166));if(i=Rr(ri.current),Rr(Ss.current),wa(s)){if(u=s.stateNode,i=s.memoizedProps,u[ks]=s,(g=u.nodeValue!==i)&&(t=Un,t!==null))switch(t.tag){case 3:fa(u.nodeValue,i,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&fa(u.nodeValue,i,(t.mode&1)!==0)}g&&(s.flags|=4)}else u=(i.nodeType===9?i:i.ownerDocument).createTextNode(u),u[ks]=s,s.stateNode=u}return dn(s),null;case 13:if(ht(Ct),u=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(wt&&Bn!==null&&(s.mode&1)!==0&&(s.flags&128)===0)Sp(),oo(),s.flags|=98560,g=!1;else if(g=wa(s),u!==null&&u.dehydrated!==null){if(t===null){if(!g)throw Error(r(318));if(g=s.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));g[ks]=s}else oo(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;dn(s),g=!1}else rs!==null&&(ju(rs),rs=null),g=!0;if(!g)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=i,s):(u=u!==null,u!==(t!==null&&t.memoizedState!==null)&&u&&(s.child.flags|=8192,(s.mode&1)!==0&&(t===null||(Ct.current&1)!==0?Wt===0&&(Wt=3):Au())),s.updateQueue!==null&&(s.flags|=4),dn(s),null);case 4:return co(),vu(t,s),t===null&&Qo(s.stateNode.containerInfo),dn(s),null;case 10:return Vc(s.type._context),dn(s),null;case 17:return jn(s.type)&&ma(),dn(s),null;case 19:if(ht(Ct),g=s.memoizedState,g===null)return dn(s),null;if(u=(s.flags&128)!==0,w=g.rendering,w===null)if(u)ci(g,!1);else{if(Wt!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(w=Ca(t),w!==null){for(s.flags|=128,ci(g,!1),u=w.updateQueue,u!==null&&(s.updateQueue=u,s.flags|=4),s.subtreeFlags=0,u=i,i=s.child;i!==null;)g=i,t=u,g.flags&=14680066,w=g.alternate,w===null?(g.childLanes=0,g.lanes=t,g.child=null,g.subtreeFlags=0,g.memoizedProps=null,g.memoizedState=null,g.updateQueue=null,g.dependencies=null,g.stateNode=null):(g.childLanes=w.childLanes,g.lanes=w.lanes,g.child=w.child,g.subtreeFlags=0,g.deletions=null,g.memoizedProps=w.memoizedProps,g.memoizedState=w.memoizedState,g.updateQueue=w.updateQueue,g.type=w.type,t=w.dependencies,g.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),i=i.sibling;return ut(Ct,Ct.current&1|2),s.child}t=t.sibling}g.tail!==null&&bt()>ho&&(s.flags|=128,u=!0,ci(g,!1),s.lanes=4194304)}else{if(!u)if(t=Ca(w),t!==null){if(s.flags|=128,u=!0,i=t.updateQueue,i!==null&&(s.updateQueue=i,s.flags|=4),ci(g,!0),g.tail===null&&g.tailMode==="hidden"&&!w.alternate&&!wt)return dn(s),null}else 2*bt()-g.renderingStartTime>ho&&i!==1073741824&&(s.flags|=128,u=!0,ci(g,!1),s.lanes=4194304);g.isBackwards?(w.sibling=s.child,s.child=w):(i=g.last,i!==null?i.sibling=w:s.child=w,g.last=w)}return g.tail!==null?(s=g.tail,g.rendering=s,g.tail=s.sibling,g.renderingStartTime=bt(),s.sibling=null,i=Ct.current,ut(Ct,u?i&1|2:i&1),s):(dn(s),null);case 22:case 23:return Ru(),u=s.memoizedState!==null,t!==null&&t.memoizedState!==null!==u&&(s.flags|=8192),u&&(s.mode&1)!==0?(Wn&1073741824)!==0&&(dn(s),s.subtreeFlags&6&&(s.flags|=8192)):dn(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function y0(t,s){switch(zc(s),s.tag){case 1:return jn(s.type)&&ma(),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return co(),ht(En),ht(cn),Zc(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 5:return Yc(s),null;case 13:if(ht(Ct),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(r(340));oo()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return ht(Ct),null;case 4:return co(),null;case 10:return Vc(s.type._context),null;case 22:case 23:return Ru(),null;case 24:return null;default:return null}}var La=!1,fn=!1,x0=typeof WeakSet=="function"?WeakSet:Set,ke=null;function fo(t,s){var i=t.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(u){It(t,s,u)}else i.current=null}function yu(t,s,i){try{i()}catch(u){It(t,s,u)}}var wh=!1;function w0(t,s){if(Rc=ta,t=Zf(),Sc(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var u=i.getSelection&&i.getSelection();if(u&&u.rangeCount!==0){i=u.anchorNode;var p=u.anchorOffset,g=u.focusNode;u=u.focusOffset;try{i.nodeType,g.nodeType}catch{i=null;break e}var w=0,_=-1,D=-1,K=0,re=0,ae=t,se=null;t:for(;;){for(var xe;ae!==i||p!==0&&ae.nodeType!==3||(_=w+p),ae!==g||u!==0&&ae.nodeType!==3||(D=w+u),ae.nodeType===3&&(w+=ae.nodeValue.length),(xe=ae.firstChild)!==null;)se=ae,ae=xe;for(;;){if(ae===t)break t;if(se===i&&++K===p&&(_=w),se===g&&++re===u&&(D=w),(xe=ae.nextSibling)!==null)break;ae=se,se=ae.parentNode}ae=xe}i=_===-1||D===-1?null:{start:_,end:D}}else i=null}i=i||{start:0,end:0}}else i=null;for(Ac={focusedElem:t,selectionRange:i},ta=!1,ke=s;ke!==null;)if(s=ke,t=s.child,(s.subtreeFlags&1028)!==0&&t!==null)t.return=s,ke=t;else for(;ke!==null;){s=ke;try{var Ne=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(Ne!==null){var Ce=Ne.memoizedProps,Mt=Ne.memoizedState,H=s.stateNode,O=H.getSnapshotBeforeUpdate(s.elementType===s.type?Ce:os(s.type,Ce),Mt);H.__reactInternalSnapshotBeforeUpdate=O}break;case 3:var V=s.stateNode.containerInfo;V.nodeType===1?V.textContent="":V.nodeType===9&&V.documentElement&&V.removeChild(V.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(fe){It(s,s.return,fe)}if(t=s.sibling,t!==null){t.return=s.return,ke=t;break}ke=s.return}return Ne=wh,wh=!1,Ne}function ui(t,s,i){var u=s.updateQueue;if(u=u!==null?u.lastEffect:null,u!==null){var p=u=u.next;do{if((p.tag&t)===t){var g=p.destroy;p.destroy=void 0,g!==void 0&&yu(s,i,g)}p=p.next}while(p!==u)}}function Oa(t,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var i=s=s.next;do{if((i.tag&t)===t){var u=i.create;i.destroy=u()}i=i.next}while(i!==s)}}function xu(t){var s=t.ref;if(s!==null){var i=t.stateNode;switch(t.tag){case 5:t=i;break;default:t=i}typeof s=="function"?s(t):s.current=t}}function kh(t){var s=t.alternate;s!==null&&(t.alternate=null,kh(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&(delete s[ks],delete s[Jo],delete s[Lc],delete s[n0],delete s[s0])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Sh(t){return t.tag===5||t.tag===3||t.tag===4}function bh(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Sh(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function wu(t,s,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,s?i.nodeType===8?i.parentNode.insertBefore(t,s):i.insertBefore(t,s):(i.nodeType===8?(s=i.parentNode,s.insertBefore(t,i)):(s=i,s.appendChild(t)),i=i._reactRootContainer,i!=null||s.onclick!==null||(s.onclick=pa));else if(u!==4&&(t=t.child,t!==null))for(wu(t,s,i),t=t.sibling;t!==null;)wu(t,s,i),t=t.sibling}function ku(t,s,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,s?i.insertBefore(t,s):i.appendChild(t);else if(u!==4&&(t=t.child,t!==null))for(ku(t,s,i),t=t.sibling;t!==null;)ku(t,s,i),t=t.sibling}var nn=null,is=!1;function tr(t,s,i){for(i=i.child;i!==null;)Nh(t,s,i),i=i.sibling}function Nh(t,s,i){if(zn&&typeof zn.onCommitFiberUnmount=="function")try{zn.onCommitFiberUnmount(wr,i)}catch{}switch(i.tag){case 5:fn||fo(i,s);case 6:var u=nn,p=is;nn=null,tr(t,s,i),nn=u,is=p,nn!==null&&(is?(t=nn,i=i.stateNode,t.nodeType===8?t.parentNode.removeChild(i):t.removeChild(i)):nn.removeChild(i.stateNode));break;case 18:nn!==null&&(is?(t=nn,i=i.stateNode,t.nodeType===8?Mc(t.parentNode,i):t.nodeType===1&&Mc(t,i),Bo(t)):Mc(nn,i.stateNode));break;case 4:u=nn,p=is,nn=i.stateNode.containerInfo,is=!0,tr(t,s,i),nn=u,is=p;break;case 0:case 11:case 14:case 15:if(!fn&&(u=i.updateQueue,u!==null&&(u=u.lastEffect,u!==null))){p=u=u.next;do{var g=p,w=g.destroy;g=g.tag,w!==void 0&&((g&2)!==0||(g&4)!==0)&&yu(i,s,w),p=p.next}while(p!==u)}tr(t,s,i);break;case 1:if(!fn&&(fo(i,s),u=i.stateNode,typeof u.componentWillUnmount=="function"))try{u.props=i.memoizedProps,u.state=i.memoizedState,u.componentWillUnmount()}catch(_){It(i,s,_)}tr(t,s,i);break;case 21:tr(t,s,i);break;case 22:i.mode&1?(fn=(u=fn)||i.memoizedState!==null,tr(t,s,i),fn=u):tr(t,s,i);break;default:tr(t,s,i)}}function Th(t){var s=t.updateQueue;if(s!==null){t.updateQueue=null;var i=t.stateNode;i===null&&(i=t.stateNode=new x0),s.forEach(function(u){var p=_0.bind(null,t,u);i.has(u)||(i.add(u),u.then(p,p))})}}function as(t,s){var i=s.deletions;if(i!==null)for(var u=0;u<i.length;u++){var p=i[u];try{var g=t,w=s,_=w;e:for(;_!==null;){switch(_.tag){case 5:nn=_.stateNode,is=!1;break e;case 3:nn=_.stateNode.containerInfo,is=!0;break e;case 4:nn=_.stateNode.containerInfo,is=!0;break e}_=_.return}if(nn===null)throw Error(r(160));Nh(g,w,p),nn=null,is=!1;var D=p.alternate;D!==null&&(D.return=null),p.return=null}catch(K){It(p,s,K)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Ch(s,t),s=s.sibling}function Ch(t,s){var i=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(as(s,t),Ns(t),u&4){try{ui(3,t,t.return),Oa(3,t)}catch(Ce){It(t,t.return,Ce)}try{ui(5,t,t.return)}catch(Ce){It(t,t.return,Ce)}}break;case 1:as(s,t),Ns(t),u&512&&i!==null&&fo(i,i.return);break;case 5:if(as(s,t),Ns(t),u&512&&i!==null&&fo(i,i.return),t.flags&32){var p=t.stateNode;try{an(p,"")}catch(Ce){It(t,t.return,Ce)}}if(u&4&&(p=t.stateNode,p!=null)){var g=t.memoizedProps,w=i!==null?i.memoizedProps:g,_=t.type,D=t.updateQueue;if(t.updateQueue=null,D!==null)try{_==="input"&&g.type==="radio"&&g.name!=null&&Ue(p,g),On(_,w);var K=On(_,g);for(w=0;w<D.length;w+=2){var re=D[w],ae=D[w+1];re==="style"?ms(p,ae):re==="dangerouslySetInnerHTML"?_t(p,ae):re==="children"?an(p,ae):P(p,re,ae,K)}switch(_){case"input":Vt(p,g);break;case"textarea":ve(p,g);break;case"select":var se=p._wrapperState.wasMultiple;p._wrapperState.wasMultiple=!!g.multiple;var xe=g.value;xe!=null?Ft(p,!!g.multiple,xe,!1):se!==!!g.multiple&&(g.defaultValue!=null?Ft(p,!!g.multiple,g.defaultValue,!0):Ft(p,!!g.multiple,g.multiple?[]:"",!1))}p[Jo]=g}catch(Ce){It(t,t.return,Ce)}}break;case 6:if(as(s,t),Ns(t),u&4){if(t.stateNode===null)throw Error(r(162));p=t.stateNode,g=t.memoizedProps;try{p.nodeValue=g}catch(Ce){It(t,t.return,Ce)}}break;case 3:if(as(s,t),Ns(t),u&4&&i!==null&&i.memoizedState.isDehydrated)try{Bo(s.containerInfo)}catch(Ce){It(t,t.return,Ce)}break;case 4:as(s,t),Ns(t);break;case 13:as(s,t),Ns(t),p=t.child,p.flags&8192&&(g=p.memoizedState!==null,p.stateNode.isHidden=g,!g||p.alternate!==null&&p.alternate.memoizedState!==null||(Nu=bt())),u&4&&Th(t);break;case 22:if(re=i!==null&&i.memoizedState!==null,t.mode&1?(fn=(K=fn)||re,as(s,t),fn=K):as(s,t),Ns(t),u&8192){if(K=t.memoizedState!==null,(t.stateNode.isHidden=K)&&!re&&(t.mode&1)!==0)for(ke=t,re=t.child;re!==null;){for(ae=ke=re;ke!==null;){switch(se=ke,xe=se.child,se.tag){case 0:case 11:case 14:case 15:ui(4,se,se.return);break;case 1:fo(se,se.return);var Ne=se.stateNode;if(typeof Ne.componentWillUnmount=="function"){u=se,i=se.return;try{s=u,Ne.props=s.memoizedProps,Ne.state=s.memoizedState,Ne.componentWillUnmount()}catch(Ce){It(u,i,Ce)}}break;case 5:fo(se,se.return);break;case 22:if(se.memoizedState!==null){_h(ae);continue}}xe!==null?(xe.return=se,ke=xe):_h(ae)}re=re.sibling}e:for(re=null,ae=t;;){if(ae.tag===5){if(re===null){re=ae;try{p=ae.stateNode,K?(g=p.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none"):(_=ae.stateNode,D=ae.memoizedProps.style,w=D!=null&&D.hasOwnProperty("display")?D.display:null,_.style.display=Ln("display",w))}catch(Ce){It(t,t.return,Ce)}}}else if(ae.tag===6){if(re===null)try{ae.stateNode.nodeValue=K?"":ae.memoizedProps}catch(Ce){It(t,t.return,Ce)}}else if((ae.tag!==22&&ae.tag!==23||ae.memoizedState===null||ae===t)&&ae.child!==null){ae.child.return=ae,ae=ae.child;continue}if(ae===t)break e;for(;ae.sibling===null;){if(ae.return===null||ae.return===t)break e;re===ae&&(re=null),ae=ae.return}re===ae&&(re=null),ae.sibling.return=ae.return,ae=ae.sibling}}break;case 19:as(s,t),Ns(t),u&4&&Th(t);break;case 21:break;default:as(s,t),Ns(t)}}function Ns(t){var s=t.flags;if(s&2){try{e:{for(var i=t.return;i!==null;){if(Sh(i)){var u=i;break e}i=i.return}throw Error(r(160))}switch(u.tag){case 5:var p=u.stateNode;u.flags&32&&(an(p,""),u.flags&=-33);var g=bh(t);ku(t,g,p);break;case 3:case 4:var w=u.stateNode.containerInfo,_=bh(t);wu(t,_,w);break;default:throw Error(r(161))}}catch(D){It(t,t.return,D)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function k0(t,s,i){ke=t,Eh(t)}function Eh(t,s,i){for(var u=(t.mode&1)!==0;ke!==null;){var p=ke,g=p.child;if(p.tag===22&&u){var w=p.memoizedState!==null||La;if(!w){var _=p.alternate,D=_!==null&&_.memoizedState!==null||fn;_=La;var K=fn;if(La=w,(fn=D)&&!K)for(ke=p;ke!==null;)w=ke,D=w.child,w.tag===22&&w.memoizedState!==null?Rh(p):D!==null?(D.return=w,ke=D):Rh(p);for(;g!==null;)ke=g,Eh(g),g=g.sibling;ke=p,La=_,fn=K}jh(t)}else(p.subtreeFlags&8772)!==0&&g!==null?(g.return=p,ke=g):jh(t)}}function jh(t){for(;ke!==null;){var s=ke;if((s.flags&8772)!==0){var i=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:fn||Oa(5,s);break;case 1:var u=s.stateNode;if(s.flags&4&&!fn)if(i===null)u.componentDidMount();else{var p=s.elementType===s.type?i.memoizedProps:os(s.type,i.memoizedProps);u.componentDidUpdate(p,i.memoizedState,u.__reactInternalSnapshotBeforeUpdate)}var g=s.updateQueue;g!==null&&_p(s,g,u);break;case 3:var w=s.updateQueue;if(w!==null){if(i=null,s.child!==null)switch(s.child.tag){case 5:i=s.child.stateNode;break;case 1:i=s.child.stateNode}_p(s,w,i)}break;case 5:var _=s.stateNode;if(i===null&&s.flags&4){i=_;var D=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":D.autoFocus&&i.focus();break;case"img":D.src&&(i.src=D.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var K=s.alternate;if(K!==null){var re=K.memoizedState;if(re!==null){var ae=re.dehydrated;ae!==null&&Bo(ae)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}fn||s.flags&512&&xu(s)}catch(se){It(s,s.return,se)}}if(s===t){ke=null;break}if(i=s.sibling,i!==null){i.return=s.return,ke=i;break}ke=s.return}}function _h(t){for(;ke!==null;){var s=ke;if(s===t){ke=null;break}var i=s.sibling;if(i!==null){i.return=s.return,ke=i;break}ke=s.return}}function Rh(t){for(;ke!==null;){var s=ke;try{switch(s.tag){case 0:case 11:case 15:var i=s.return;try{Oa(4,s)}catch(D){It(s,i,D)}break;case 1:var u=s.stateNode;if(typeof u.componentDidMount=="function"){var p=s.return;try{u.componentDidMount()}catch(D){It(s,p,D)}}var g=s.return;try{xu(s)}catch(D){It(s,g,D)}break;case 5:var w=s.return;try{xu(s)}catch(D){It(s,w,D)}}}catch(D){It(s,s.return,D)}if(s===t){ke=null;break}var _=s.sibling;if(_!==null){_.return=s.return,ke=_;break}ke=s.return}}var S0=Math.ceil,$a=M.ReactCurrentDispatcher,Su=M.ReactCurrentOwner,Qn=M.ReactCurrentBatchConfig,Qe=0,Yt=null,Pt=null,sn=0,Wn=0,po=Ys(0),Wt=0,di=null,Ir=0,Pa=0,bu=0,fi=null,Rn=null,Nu=0,ho=1/0,$s=null,za=!1,Tu=null,nr=null,Fa=!1,sr=null,Ua=0,pi=0,Cu=null,Ba=-1,Wa=0;function Sn(){return(Qe&6)!==0?bt():Ba!==-1?Ba:Ba=bt()}function rr(t){return(t.mode&1)===0?1:(Qe&2)!==0&&sn!==0?sn&-sn:o0.transition!==null?(Wa===0&&(Wa=Po()),Wa):(t=Xe,t!==0||(t=window.event,t=t===void 0?16:If(t.type)),t)}function ls(t,s,i,u){if(50<pi)throw pi=0,Cu=null,Error(r(185));Nr(t,i,u),((Qe&2)===0||t!==Yt)&&(t===Yt&&((Qe&2)===0&&(Pa|=i),Wt===4&&or(t,sn)),An(t,u),i===1&&Qe===0&&(s.mode&1)===0&&(ho=bt()+500,va&&Zs()))}function An(t,s){var i=t.callbackNode;Zi(t,s);var u=br(t,t===Yt?sn:0);if(u===0)i!==null&&At(i),t.callbackNode=null,t.callbackPriority=0;else if(s=u&-u,t.callbackPriority!==s){if(i!=null&&At(i),s===1)t.tag===0?r0(Ih.bind(null,t)):vp(Ih.bind(null,t)),e0(function(){(Qe&6)===0&&Zs()}),i=null;else{switch(de(u)){case 1:i=Ws;break;case 4:i=ws;break;case 16:i=Wr;break;case 536870912:i=Yi;break;default:i=Wr}i=Fh(i,Ah.bind(null,t))}t.callbackPriority=s,t.callbackNode=i}}function Ah(t,s){if(Ba=-1,Wa=0,(Qe&6)!==0)throw Error(r(327));var i=t.callbackNode;if(mo()&&t.callbackNode!==i)return null;var u=br(t,t===Yt?sn:0);if(u===0)return null;if((u&30)!==0||(u&t.expiredLanes)!==0||s)s=Ha(t,u);else{s=u;var p=Qe;Qe|=2;var g=Mh();(Yt!==t||sn!==s)&&($s=null,ho=bt()+500,Mr(t,s));do try{T0();break}catch(_){Dh(t,_)}while(!0);Hc(),$a.current=g,Qe=p,Pt!==null?s=0:(Yt=null,sn=0,s=Wt)}if(s!==0){if(s===2&&(p=$o(t),p!==0&&(u=p,s=Eu(t,p))),s===1)throw i=di,Mr(t,0),or(t,u),An(t,bt()),i;if(s===6)or(t,u);else{if(p=t.current.alternate,(u&30)===0&&!b0(p)&&(s=Ha(t,u),s===2&&(g=$o(t),g!==0&&(u=g,s=Eu(t,g))),s===1))throw i=di,Mr(t,0),or(t,u),An(t,bt()),i;switch(t.finishedWork=p,t.finishedLanes=u,s){case 0:case 1:throw Error(r(345));case 2:Lr(t,Rn,$s);break;case 3:if(or(t,u),(u&130023424)===u&&(s=Nu+500-bt(),10<s)){if(br(t,0)!==0)break;if(p=t.suspendedLanes,(p&u)!==u){Sn(),t.pingedLanes|=t.suspendedLanes&p;break}t.timeoutHandle=Dc(Lr.bind(null,t,Rn,$s),s);break}Lr(t,Rn,$s);break;case 4:if(or(t,u),(u&4194240)===u)break;for(s=t.eventTimes,p=-1;0<u;){var w=31-xn(u);g=1<<w,w=s[w],w>p&&(p=w),u&=~g}if(u=p,u=bt()-u,u=(120>u?120:480>u?480:1080>u?1080:1920>u?1920:3e3>u?3e3:4320>u?4320:1960*S0(u/1960))-u,10<u){t.timeoutHandle=Dc(Lr.bind(null,t,Rn,$s),u);break}Lr(t,Rn,$s);break;case 5:Lr(t,Rn,$s);break;default:throw Error(r(329))}}}return An(t,bt()),t.callbackNode===i?Ah.bind(null,t):null}function Eu(t,s){var i=fi;return t.current.memoizedState.isDehydrated&&(Mr(t,s).flags|=256),t=Ha(t,s),t!==2&&(s=Rn,Rn=i,s!==null&&ju(s)),t}function ju(t){Rn===null?Rn=t:Rn.push.apply(Rn,t)}function b0(t){for(var s=t;;){if(s.flags&16384){var i=s.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var u=0;u<i.length;u++){var p=i[u],g=p.getSnapshot;p=p.value;try{if(!ss(g(),p))return!1}catch{return!1}}}if(i=s.child,s.subtreeFlags&16384&&i!==null)i.return=s,s=i;else{if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function or(t,s){for(s&=~bu,s&=~Pa,t.suspendedLanes|=s,t.pingedLanes&=~s,t=t.expirationTimes;0<s;){var i=31-xn(s),u=1<<i;t[i]=-1,s&=~u}}function Ih(t){if((Qe&6)!==0)throw Error(r(327));mo();var s=br(t,0);if((s&1)===0)return An(t,bt()),null;var i=Ha(t,s);if(t.tag!==0&&i===2){var u=$o(t);u!==0&&(s=u,i=Eu(t,u))}if(i===1)throw i=di,Mr(t,0),or(t,s),An(t,bt()),i;if(i===6)throw Error(r(345));return t.finishedWork=t.current.alternate,t.finishedLanes=s,Lr(t,Rn,$s),An(t,bt()),null}function _u(t,s){var i=Qe;Qe|=1;try{return t(s)}finally{Qe=i,Qe===0&&(ho=bt()+500,va&&Zs())}}function Dr(t){sr!==null&&sr.tag===0&&(Qe&6)===0&&mo();var s=Qe;Qe|=1;var i=Qn.transition,u=Xe;try{if(Qn.transition=null,Xe=1,t)return t()}finally{Xe=u,Qn.transition=i,Qe=s,(Qe&6)===0&&Zs()}}function Ru(){Wn=po.current,ht(po)}function Mr(t,s){t.finishedWork=null,t.finishedLanes=0;var i=t.timeoutHandle;if(i!==-1&&(t.timeoutHandle=-1,Jx(i)),Pt!==null)for(i=Pt.return;i!==null;){var u=i;switch(zc(u),u.tag){case 1:u=u.type.childContextTypes,u!=null&&ma();break;case 3:co(),ht(En),ht(cn),Zc();break;case 5:Yc(u);break;case 4:co();break;case 13:ht(Ct);break;case 19:ht(Ct);break;case 10:Vc(u.type._context);break;case 22:case 23:Ru()}i=i.return}if(Yt=t,Pt=t=ir(t.current,null),sn=Wn=s,Wt=0,di=null,bu=Pa=Ir=0,Rn=fi=null,_r!==null){for(s=0;s<_r.length;s++)if(i=_r[s],u=i.interleaved,u!==null){i.interleaved=null;var p=u.next,g=i.pending;if(g!==null){var w=g.next;g.next=p,u.next=w}i.pending=u}_r=null}return t}function Dh(t,s){do{var i=Pt;try{if(Hc(),Ea.current=Aa,ja){for(var u=Et.memoizedState;u!==null;){var p=u.queue;p!==null&&(p.pending=null),u=u.next}ja=!1}if(Ar=0,Xt=Bt=Et=null,oi=!1,ii=0,Su.current=null,i===null||i.return===null){Wt=1,di=s,Pt=null;break}e:{var g=t,w=i.return,_=i,D=s;if(s=sn,_.flags|=32768,D!==null&&typeof D=="object"&&typeof D.then=="function"){var K=D,re=_,ae=re.tag;if((re.mode&1)===0&&(ae===0||ae===11||ae===15)){var se=re.alternate;se?(re.updateQueue=se.updateQueue,re.memoizedState=se.memoizedState,re.lanes=se.lanes):(re.updateQueue=null,re.memoizedState=null)}var xe=rh(w);if(xe!==null){xe.flags&=-257,oh(xe,w,_,g,s),xe.mode&1&&sh(g,K,s),s=xe,D=K;var Ne=s.updateQueue;if(Ne===null){var Ce=new Set;Ce.add(D),s.updateQueue=Ce}else Ne.add(D);break e}else{if((s&1)===0){sh(g,K,s),Au();break e}D=Error(r(426))}}else if(wt&&_.mode&1){var Mt=rh(w);if(Mt!==null){(Mt.flags&65536)===0&&(Mt.flags|=256),oh(Mt,w,_,g,s),Bc(uo(D,_));break e}}g=D=uo(D,_),Wt!==4&&(Wt=2),fi===null?fi=[g]:fi.push(g),g=w;do{switch(g.tag){case 3:g.flags|=65536,s&=-s,g.lanes|=s;var H=th(g,D,s);jp(g,H);break e;case 1:_=D;var O=g.type,V=g.stateNode;if((g.flags&128)===0&&(typeof O.getDerivedStateFromError=="function"||V!==null&&typeof V.componentDidCatch=="function"&&(nr===null||!nr.has(V)))){g.flags|=65536,s&=-s,g.lanes|=s;var fe=nh(g,_,s);jp(g,fe);break e}}g=g.return}while(g!==null)}Oh(i)}catch(Ee){s=Ee,Pt===i&&i!==null&&(Pt=i=i.return);continue}break}while(!0)}function Mh(){var t=$a.current;return $a.current=Aa,t===null?Aa:t}function Au(){(Wt===0||Wt===3||Wt===2)&&(Wt=4),Yt===null||(Ir&268435455)===0&&(Pa&268435455)===0||or(Yt,sn)}function Ha(t,s){var i=Qe;Qe|=2;var u=Mh();(Yt!==t||sn!==s)&&($s=null,Mr(t,s));do try{N0();break}catch(p){Dh(t,p)}while(!0);if(Hc(),Qe=i,$a.current=u,Pt!==null)throw Error(r(261));return Yt=null,sn=0,Wt}function N0(){for(;Pt!==null;)Lh(Pt)}function T0(){for(;Pt!==null&&!ys();)Lh(Pt)}function Lh(t){var s=zh(t.alternate,t,Wn);t.memoizedProps=t.pendingProps,s===null?Oh(t):Pt=s,Su.current=null}function Oh(t){var s=t;do{var i=s.alternate;if(t=s.return,(s.flags&32768)===0){if(i=v0(i,s,Wn),i!==null){Pt=i;return}}else{if(i=y0(i,s),i!==null){i.flags&=32767,Pt=i;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Wt=6,Pt=null;return}}if(s=s.sibling,s!==null){Pt=s;return}Pt=s=t}while(s!==null);Wt===0&&(Wt=5)}function Lr(t,s,i){var u=Xe,p=Qn.transition;try{Qn.transition=null,Xe=1,C0(t,s,i,u)}finally{Qn.transition=p,Xe=u}return null}function C0(t,s,i,u){do mo();while(sr!==null);if((Qe&6)!==0)throw Error(r(327));i=t.finishedWork;var p=t.finishedLanes;if(i===null)return null;if(t.finishedWork=null,t.finishedLanes=0,i===t.current)throw Error(r(177));t.callbackNode=null,t.callbackPriority=0;var g=i.lanes|i.childLanes;if(Ji(t,g),t===Yt&&(Pt=Yt=null,sn=0),(i.subtreeFlags&2064)===0&&(i.flags&2064)===0||Fa||(Fa=!0,Fh(Wr,function(){return mo(),null})),g=(i.flags&15990)!==0,(i.subtreeFlags&15990)!==0||g){g=Qn.transition,Qn.transition=null;var w=Xe;Xe=1;var _=Qe;Qe|=4,Su.current=null,w0(t,i),Ch(i,t),Kx(Ac),ta=!!Rc,Ac=Rc=null,t.current=i,k0(i),uc(),Qe=_,Xe=w,Qn.transition=g}else t.current=i;if(Fa&&(Fa=!1,sr=t,Ua=p),g=t.pendingLanes,g===0&&(nr=null),Hr(i.stateNode),An(t,bt()),s!==null)for(u=t.onRecoverableError,i=0;i<s.length;i++)p=s[i],u(p.value,{componentStack:p.stack,digest:p.digest});if(za)throw za=!1,t=Tu,Tu=null,t;return(Ua&1)!==0&&t.tag!==0&&mo(),g=t.pendingLanes,(g&1)!==0?t===Cu?pi++:(pi=0,Cu=t):pi=0,Zs(),null}function mo(){if(sr!==null){var t=de(Ua),s=Qn.transition,i=Xe;try{if(Qn.transition=null,Xe=16>t?16:t,sr===null)var u=!1;else{if(t=sr,sr=null,Ua=0,(Qe&6)!==0)throw Error(r(331));var p=Qe;for(Qe|=4,ke=t.current;ke!==null;){var g=ke,w=g.child;if((ke.flags&16)!==0){var _=g.deletions;if(_!==null){for(var D=0;D<_.length;D++){var K=_[D];for(ke=K;ke!==null;){var re=ke;switch(re.tag){case 0:case 11:case 15:ui(8,re,g)}var ae=re.child;if(ae!==null)ae.return=re,ke=ae;else for(;ke!==null;){re=ke;var se=re.sibling,xe=re.return;if(kh(re),re===K){ke=null;break}if(se!==null){se.return=xe,ke=se;break}ke=xe}}}var Ne=g.alternate;if(Ne!==null){var Ce=Ne.child;if(Ce!==null){Ne.child=null;do{var Mt=Ce.sibling;Ce.sibling=null,Ce=Mt}while(Ce!==null)}}ke=g}}if((g.subtreeFlags&2064)!==0&&w!==null)w.return=g,ke=w;else e:for(;ke!==null;){if(g=ke,(g.flags&2048)!==0)switch(g.tag){case 0:case 11:case 15:ui(9,g,g.return)}var H=g.sibling;if(H!==null){H.return=g.return,ke=H;break e}ke=g.return}}var O=t.current;for(ke=O;ke!==null;){w=ke;var V=w.child;if((w.subtreeFlags&2064)!==0&&V!==null)V.return=w,ke=V;else e:for(w=O;ke!==null;){if(_=ke,(_.flags&2048)!==0)try{switch(_.tag){case 0:case 11:case 15:Oa(9,_)}}catch(Ee){It(_,_.return,Ee)}if(_===w){ke=null;break e}var fe=_.sibling;if(fe!==null){fe.return=_.return,ke=fe;break e}ke=_.return}}if(Qe=p,Zs(),zn&&typeof zn.onPostCommitFiberRoot=="function")try{zn.onPostCommitFiberRoot(wr,t)}catch{}u=!0}return u}finally{Xe=i,Qn.transition=s}}return!1}function $h(t,s,i){s=uo(i,s),s=th(t,s,1),t=er(t,s,1),s=Sn(),t!==null&&(Nr(t,1,s),An(t,s))}function It(t,s,i){if(t.tag===3)$h(t,t,i);else for(;s!==null;){if(s.tag===3){$h(s,t,i);break}else if(s.tag===1){var u=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(nr===null||!nr.has(u))){t=uo(i,t),t=nh(s,t,1),s=er(s,t,1),t=Sn(),s!==null&&(Nr(s,1,t),An(s,t));break}}s=s.return}}function E0(t,s,i){var u=t.pingCache;u!==null&&u.delete(s),s=Sn(),t.pingedLanes|=t.suspendedLanes&i,Yt===t&&(sn&i)===i&&(Wt===4||Wt===3&&(sn&130023424)===sn&&500>bt()-Nu?Mr(t,0):bu|=i),An(t,s)}function Ph(t,s){s===0&&((t.mode&1)===0?s=1:(s=Kr,Kr<<=1,(Kr&130023424)===0&&(Kr=4194304)));var i=Sn();t=Ms(t,s),t!==null&&(Nr(t,s,i),An(t,i))}function j0(t){var s=t.memoizedState,i=0;s!==null&&(i=s.retryLane),Ph(t,i)}function _0(t,s){var i=0;switch(t.tag){case 13:var u=t.stateNode,p=t.memoizedState;p!==null&&(i=p.retryLane);break;case 19:u=t.stateNode;break;default:throw Error(r(314))}u!==null&&u.delete(s),Ph(t,i)}var zh;zh=function(t,s,i){if(t!==null)if(t.memoizedProps!==s.pendingProps||En.current)_n=!0;else{if((t.lanes&i)===0&&(s.flags&128)===0)return _n=!1,g0(t,s,i);_n=(t.flags&131072)!==0}else _n=!1,wt&&(s.flags&1048576)!==0&&yp(s,xa,s.index);switch(s.lanes=0,s.tag){case 2:var u=s.type;Ma(t,s),t=s.pendingProps;var p=no(s,cn.current);lo(s,i),p=tu(null,s,u,t,p,i);var g=nu();return s.flags|=1,typeof p=="object"&&p!==null&&typeof p.render=="function"&&p.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,jn(u)?(g=!0,ga(s)):g=!1,s.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,qc(s),p.updater=Ia,s.stateNode=p,p._reactInternals=s,lu(s,u,t,i),s=fu(null,s,u,!0,g,i)):(s.tag=0,wt&&g&&Pc(s),kn(null,s,p,i),s=s.child),s;case 16:u=s.elementType;e:{switch(Ma(t,s),t=s.pendingProps,p=u._init,u=p(u._payload),s.type=u,p=s.tag=A0(u),t=os(u,t),p){case 0:s=du(null,s,u,t,i);break e;case 1:s=dh(null,s,u,t,i);break e;case 11:s=ih(null,s,u,t,i);break e;case 14:s=ah(null,s,u,os(u.type,t),i);break e}throw Error(r(306,u,""))}return s;case 0:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:os(u,p),du(t,s,u,p,i);case 1:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:os(u,p),dh(t,s,u,p,i);case 3:e:{if(fh(s),t===null)throw Error(r(387));u=s.pendingProps,g=s.memoizedState,p=g.element,Ep(t,s),Ta(s,u,null,i);var w=s.memoizedState;if(u=w.element,g.isDehydrated)if(g={element:u,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},s.updateQueue.baseState=g,s.memoizedState=g,s.flags&256){p=uo(Error(r(423)),s),s=ph(t,s,u,i,p);break e}else if(u!==p){p=uo(Error(r(424)),s),s=ph(t,s,u,i,p);break e}else for(Bn=Xs(s.stateNode.containerInfo.firstChild),Un=s,wt=!0,rs=null,i=Tp(s,null,u,i),s.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(oo(),u===p){s=Os(t,s,i);break e}kn(t,s,u,i)}s=s.child}return s;case 5:return Rp(s),t===null&&Uc(s),u=s.type,p=s.pendingProps,g=t!==null?t.memoizedProps:null,w=p.children,Ic(u,p)?w=null:g!==null&&Ic(u,g)&&(s.flags|=32),uh(t,s),kn(t,s,w,i),s.child;case 6:return t===null&&Uc(s),null;case 13:return hh(t,s,i);case 4:return Xc(s,s.stateNode.containerInfo),u=s.pendingProps,t===null?s.child=io(s,null,u,i):kn(t,s,u,i),s.child;case 11:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:os(u,p),ih(t,s,u,p,i);case 7:return kn(t,s,s.pendingProps,i),s.child;case 8:return kn(t,s,s.pendingProps.children,i),s.child;case 12:return kn(t,s,s.pendingProps.children,i),s.child;case 10:e:{if(u=s.type._context,p=s.pendingProps,g=s.memoizedProps,w=p.value,ut(Sa,u._currentValue),u._currentValue=w,g!==null)if(ss(g.value,w)){if(g.children===p.children&&!En.current){s=Os(t,s,i);break e}}else for(g=s.child,g!==null&&(g.return=s);g!==null;){var _=g.dependencies;if(_!==null){w=g.child;for(var D=_.firstContext;D!==null;){if(D.context===u){if(g.tag===1){D=Ls(-1,i&-i),D.tag=2;var K=g.updateQueue;if(K!==null){K=K.shared;var re=K.pending;re===null?D.next=D:(D.next=re.next,re.next=D),K.pending=D}}g.lanes|=i,D=g.alternate,D!==null&&(D.lanes|=i),Kc(g.return,i,s),_.lanes|=i;break}D=D.next}}else if(g.tag===10)w=g.type===s.type?null:g.child;else if(g.tag===18){if(w=g.return,w===null)throw Error(r(341));w.lanes|=i,_=w.alternate,_!==null&&(_.lanes|=i),Kc(w,i,s),w=g.sibling}else w=g.child;if(w!==null)w.return=g;else for(w=g;w!==null;){if(w===s){w=null;break}if(g=w.sibling,g!==null){g.return=w.return,w=g;break}w=w.return}g=w}kn(t,s,p.children,i),s=s.child}return s;case 9:return p=s.type,u=s.pendingProps.children,lo(s,i),p=Xn(p),u=u(p),s.flags|=1,kn(t,s,u,i),s.child;case 14:return u=s.type,p=os(u,s.pendingProps),p=os(u.type,p),ah(t,s,u,p,i);case 15:return lh(t,s,s.type,s.pendingProps,i);case 17:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:os(u,p),Ma(t,s),s.tag=1,jn(u)?(t=!0,ga(s)):t=!1,lo(s,i),Jp(s,u,p),lu(s,u,p,i),fu(null,s,u,!0,t,i);case 19:return gh(t,s,i);case 22:return ch(t,s,i)}throw Error(r(156,s.tag))};function Fh(t,s){return Je(t,s)}function R0(t,s,i,u){this.tag=t,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zn(t,s,i,u){return new R0(t,s,i,u)}function Iu(t){return t=t.prototype,!(!t||!t.isReactComponent)}function A0(t){if(typeof t=="function")return Iu(t)?1:0;if(t!=null){if(t=t.$$typeof,t===me)return 11;if(t===ee)return 14}return 2}function ir(t,s){var i=t.alternate;return i===null?(i=Zn(t.tag,s,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=s,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&14680064,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,s=t.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i}function Va(t,s,i,u,p,g){var w=2;if(u=t,typeof t=="function")Iu(t)&&(w=1);else if(typeof t=="string")w=5;else e:switch(t){case z:return Or(i.children,p,g,s);case U:w=8,p|=8;break;case Q:return t=Zn(12,i,s,p|2),t.elementType=Q,t.lanes=g,t;case Se:return t=Zn(13,i,s,p),t.elementType=Se,t.lanes=g,t;case Me:return t=Zn(19,i,s,p),t.elementType=Me,t.lanes=g,t;case te:return Ka(i,p,g,s);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case J:w=10;break e;case oe:w=9;break e;case me:w=11;break e;case ee:w=14;break e;case ie:w=16,u=null;break e}throw Error(r(130,t==null?t:typeof t,""))}return s=Zn(w,i,s,p),s.elementType=t,s.type=u,s.lanes=g,s}function Or(t,s,i,u){return t=Zn(7,t,u,s),t.lanes=i,t}function Ka(t,s,i,u){return t=Zn(22,t,u,s),t.elementType=te,t.lanes=i,t.stateNode={isHidden:!1},t}function Du(t,s,i){return t=Zn(6,t,null,s),t.lanes=i,t}function Mu(t,s,i){return s=Zn(4,t.children!==null?t.children:[],t.key,s),s.lanes=i,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}function I0(t,s,i,u,p){this.tag=s,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zo(0),this.expirationTimes=zo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zo(0),this.identifierPrefix=u,this.onRecoverableError=p,this.mutableSourceEagerHydrationData=null}function Lu(t,s,i,u,p,g,w,_,D){return t=new I0(t,s,i,_,D),s===1?(s=1,g===!0&&(s|=8)):s=0,g=Zn(3,null,null,s),t.current=g,g.stateNode=t,g.memoizedState={element:u,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},qc(g),t}function D0(t,s,i){var u=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:G,key:u==null?null:""+u,children:t,containerInfo:s,implementation:i}}function Uh(t){if(!t)return Qs;t=t._reactInternals;e:{if(We(t)!==t||t.tag!==1)throw Error(r(170));var s=t;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(jn(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(r(171))}if(t.tag===1){var i=t.type;if(jn(i))return mp(t,i,s)}return s}function Bh(t,s,i,u,p,g,w,_,D){return t=Lu(i,u,!0,t,p,g,w,_,D),t.context=Uh(null),i=t.current,u=Sn(),p=rr(i),g=Ls(u,p),g.callback=s??null,er(i,g,p),t.current.lanes=p,Nr(t,p,u),An(t,u),t}function Ga(t,s,i,u){var p=s.current,g=Sn(),w=rr(p);return i=Uh(i),s.context===null?s.context=i:s.pendingContext=i,s=Ls(g,w),s.payload={element:t},u=u===void 0?null:u,u!==null&&(s.callback=u),t=er(p,s,w),t!==null&&(ls(t,p,w,g),Na(t,p,w)),w}function qa(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Wh(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i<s?i:s}}function Ou(t,s){Wh(t,s),(t=t.alternate)&&Wh(t,s)}function M0(){return null}var Hh=typeof reportError=="function"?reportError:function(t){console.error(t)};function $u(t){this._internalRoot=t}Xa.prototype.render=$u.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(r(409));Ga(t,s,null,null)},Xa.prototype.unmount=$u.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;Dr(function(){Ga(null,t,null,null)}),s[Rs]=null}};function Xa(t){this._internalRoot=t}Xa.prototype.unstable_scheduleHydration=function(t){if(t){var s=Te();t={blockedOn:null,target:t,priority:s};for(var i=0;i<Ks.length&&s!==0&&s<Ks[i].priority;i++);Ks.splice(i,0,t),i===0&&Rf(t)}};function Pu(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Ya(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Vh(){}function L0(t,s,i,u,p){if(p){if(typeof u=="function"){var g=u;u=function(){var K=qa(w);g.call(K)}}var w=Bh(s,u,t,0,null,!1,!1,"",Vh);return t._reactRootContainer=w,t[Rs]=w.current,Qo(t.nodeType===8?t.parentNode:t),Dr(),w}for(;p=t.lastChild;)t.removeChild(p);if(typeof u=="function"){var _=u;u=function(){var K=qa(D);_.call(K)}}var D=Lu(t,0,!1,null,null,!1,!1,"",Vh);return t._reactRootContainer=D,t[Rs]=D.current,Qo(t.nodeType===8?t.parentNode:t),Dr(function(){Ga(s,D,i,u)}),D}function Qa(t,s,i,u,p){var g=i._reactRootContainer;if(g){var w=g;if(typeof p=="function"){var _=p;p=function(){var D=qa(w);_.call(D)}}Ga(s,w,t,p)}else w=L0(i,s,t,p,u);return qa(w)}N=function(t){switch(t.tag){case 3:var s=t.stateNode;if(s.current.memoizedState.isDehydrated){var i=Sr(s.pendingLanes);i!==0&&(Vs(s,i|1),An(s,bt()),(Qe&6)===0&&(ho=bt()+500,Zs()))}break;case 13:Dr(function(){var u=Ms(t,1);if(u!==null){var p=Sn();ls(u,t,1,p)}}),Ou(t,1)}},W=function(t){if(t.tag===13){var s=Ms(t,134217728);if(s!==null){var i=Sn();ls(s,t,134217728,i)}Ou(t,134217728)}},ne=function(t){if(t.tag===13){var s=rr(t),i=Ms(t,s);if(i!==null){var u=Sn();ls(i,t,s,u)}Ou(t,s)}},Te=function(){return Xe},Re=function(t,s){var i=Xe;try{return Xe=t,s()}finally{Xe=i}},Kt=function(t,s,i){switch(s){case"input":if(Vt(t,i),s=i.name,i.type==="radio"&&s!=null){for(i=t;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<i.length;s++){var u=i[s];if(u!==t&&u.form===t.form){var p=ha(u);if(!p)throw Error(r(90));he(u),Vt(u,p)}}}break;case"textarea":ve(t,i);break;case"select":s=i.value,s!=null&&Ft(t,!!i.multiple,s,!1)}},yt=_u,xt=Dr;var O0={usingClientEntryPoint:!1,Events:[ei,eo,ha,ft,Gt,_u]},hi={findFiberByHostInstance:Tr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},$0={bundleType:hi.bundleType,version:hi.version,rendererPackageName:hi.rendererPackageName,rendererConfig:hi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:M.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Pn(t),t===null?null:t.stateNode},findFiberByHostInstance:hi.findFiberByHostInstance||M0,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 Za=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Za.isDisabled&&Za.supportsFiber)try{wr=Za.inject($0),zn=Za}catch{}}return In.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=O0,In.createPortal=function(t,s){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Pu(s))throw Error(r(200));return D0(t,s,null,i)},In.createRoot=function(t,s){if(!Pu(t))throw Error(r(299));var i=!1,u="",p=Hh;return s!=null&&(s.unstable_strictMode===!0&&(i=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onRecoverableError!==void 0&&(p=s.onRecoverableError)),s=Lu(t,1,!1,null,null,i,!1,u,p),t[Rs]=s.current,Qo(t.nodeType===8?t.parentNode:t),new $u(s)},In.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=Pn(s),t=t===null?null:t.stateNode,t},In.flushSync=function(t){return Dr(t)},In.hydrate=function(t,s,i){if(!Ya(s))throw Error(r(200));return Qa(null,t,s,!0,i)},In.hydrateRoot=function(t,s,i){if(!Pu(t))throw Error(r(405));var u=i!=null&&i.hydratedSources||null,p=!1,g="",w=Hh;if(i!=null&&(i.unstable_strictMode===!0&&(p=!0),i.identifierPrefix!==void 0&&(g=i.identifierPrefix),i.onRecoverableError!==void 0&&(w=i.onRecoverableError)),s=Bh(s,null,t,1,i??null,p,!1,g,w),t[Rs]=s.current,Qo(t),u)for(t=0;t<u.length;t++)i=u[t],p=i._getVersion,p=p(i._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[i,p]:s.mutableSourceEagerHydrationData.push(i,p);return new Xa(s)},In.render=function(t,s,i){if(!Ya(s))throw Error(r(200));return Qa(null,t,s,!1,i)},In.unmountComponentAtNode=function(t){if(!Ya(t))throw Error(r(40));return t._reactRootContainer?(Dr(function(){Qa(null,null,t,!1,function(){t._reactRootContainer=null,t[Rs]=null})}),!0):!1},In.unstable_batchedUpdates=_u,In.unstable_renderSubtreeIntoContainer=function(t,s,i,u){if(!Ya(i))throw Error(r(200));if(t==null||t._reactInternals===void 0)throw Error(r(38));return Qa(t,s,i,!1,u)},In.version="18.3.1-next-f1338f8080-20240426",In}var Jh;function nv(){if(Jh)return Uu.exports;Jh=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Uu.exports=K0(),Uu.exports}var em;function G0(){if(em)return Ja;em=1;var e=nv();return Ja.createRoot=e.createRoot,Ja.hydrateRoot=e.hydrateRoot,Ja}var q0=G0();const X0=tv(q0),tm=e=>{let n;const r=new Set,o=(m,v)=>{const k=typeof m=="function"?m(n):m;if(!Object.is(k,n)){const x=n;n=v??(typeof k!="object"||k===null)?k:Object.assign({},n,k),r.forEach(S=>S(n,x))}},l=()=>n,f={setState:o,getState:l,getInitialState:()=>h,subscribe:m=>(r.add(m),()=>r.delete(m))},h=n=e(o,l,f);return f},Y0=(e=>e?tm(e):tm),Q0=e=>e;function Z0(e,n=Q0){const r=ct.useSyncExternalStore(e.subscribe,ct.useCallback(()=>n(e.getState()),[e,n]),ct.useCallback(()=>n(e.getInitialState()),[e,n]));return ct.useDebugValue(r),r}const J0=e=>{const n=Y0(e),r=o=>Z0(n,o);return Object.assign(r,n),r},ew=(e=>J0),sv="agentpane:machines",rv="agentpane:active-machine";function tw(e){return/^[a-z][a-z0-9-]{1,30}$/.test(e)}function ov(e){return`${e}.repoburg.com`}function iv(e){const n=/^([a-z][a-z0-9-]{1,30})\.repoburg\.com$/.exec(e);return n?n[1]:null}function av(e,n){try{const r=localStorage.getItem(e);return r==null?n:JSON.parse(r)}catch{return n}}function lv(e,n){try{localStorage.setItem(e,JSON.stringify(n))}catch{}}function nw(e){const{mahlas:n,hostname:r}=e??{};return typeof n=="string"&&tw(n)&&r===ov(n)}function cv(){const e=av(sv,[]);return Array.isArray(e)?e.filter(nw):[]}function sw(e){const n={mahlas:e,hostname:ov(e),lastConnectedAt:new Date().toISOString()},r=cv(),o=[n,...r.filter(l=>l.mahlas!==e)];return lv(sv,o),n}function rw(){const e=av(rv,null);return e?cv().find(n=>n.mahlas===e)??null:null}function ow(e){lv(rv,e)}function iw(){if(typeof window>"u")return;const e=new URLSearchParams(window.location.search).get("host");if(!e)return;const n=iv(e);n&&(sw(n),ow(n))}const nm="http://localhost:9998",aw=["agent.repoburg.com"];function mn(){if(typeof window>"u")return"";const e=new URLSearchParams(window.location.search),n=e.get("bport");if(n)return`http://localhost:${n}`;const r=e.get("host");if(r)return`https://${r}`;const o=window.location.hostname;if(aw.includes(o))return nm;if(iv(o))return"";const l=rw();return l?`https://${l.hostname}`:o==="localhost"||o==="127.0.0.1"||o==="0.0.0.0"?"":nm}function lw(e){const n=mn();return n?`${n.replace(/^http/,"ws")}${e}`:`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${e}`}const cw="/api";class Ui extends Error{constructor(r,o,l){super(r);at(this,"status");at(this,"body");this.name="ApiError",this.status=o,this.body=l}}function hr(e){var n;if(e instanceof Ui){const r=(n=e.body)==null?void 0:n.error;if(typeof r=="string"&&r)return r}return e instanceof Error?e.message:String(e)}async function Bi(e,n,r){const o=await fetch(`${mn()}${cw}${n}`,{method:e,headers:r?{"Content-Type":"application/json"}:void 0,body:r?JSON.stringify(r):void 0});if(!o.ok){let l=`${o.status} ${o.statusText}`,c=null;try{c=await o.json();const d=c==null?void 0:c.error;typeof d=="string"&&d&&(l=`${l} — ${d}`)}catch{}throw new Ui(`${e} ${n} failed: ${l}`,o.status,c)}return o.json()}function kt(e){return Bi("GET",e)}function st(e,n){return Bi("POST",e,n)}function Kl(e){return Bi("DELETE",e)}function fs(e,n){return Bi("PATCH",e,n)}function uw(e,n){return Bi("PUT",e,n)}function dw(e){return`stream-text-${e}`}const ds=new Map;function kl(e,n,r){return`${e}
42
42
  ${n}
43
- ${r}`}function dw(e,n,r,o){const l=Vd(e,n,r),c=Ts.get(l);return c?(c.text+=o,c.text):(Ts.set(l,{sessionId:e,turnId:n,itemId:r,text:o}),o)}function fw(e,n){for(const[o,l]of Ts)(e===null||l.sessionId===e)&&Ts.delete(o);const r=n.filter(o=>o&&typeof o.sessionId=="string"&&typeof o.turnId=="string"&&typeof o.itemId=="string"&&typeof o.text=="string");for(const o of r)Ts.set(Vd(o.sessionId,o.turnId,o.itemId),{...o});return r}function Wu(e,n,r){var c;const o=r==null?void 0:r.external_item_id;if(!r||!o)return;const l=Vd(e,n,o);if(r.status==="in_progress"){const d=(c=r.data)==null?void 0:c.text;typeof d=="string"&&Ts.set(l,{sessionId:e,turnId:n,itemId:o,text:d});return}Ts.delete(l)}function gi(e,n){for(const[r,o]of Ts)o.sessionId===e&&o.turnId===n&&Ts.delete(r)}function uv(e,n,r){var f;const o=e.items??[];let l=-1;for(let h=o.length-1;h>=0;h--)if(o[h].external_item_id===n){l=h;break}if(l>=0){const h=o[l];if(h.status!=="in_progress"||((f=h.data)==null?void 0:f.text)===r)return e;const m=[...o];return m[l]={...h,data:{...h.data,text:r}},{...e,items:m,...h.type==="agent_message"?{agent_response:r}:{}}}const c=new Date().toISOString(),d={id:`delta-${n}`,turn_id:e.id,external_item_id:n,type:"agent_message",data:{text:r},status:"in_progress",created_at:c,updated_at:c};return{...e,items:[...o,d],agent_response:r}}function pw(e){var d;const n=[...Ts.values()].filter(f=>f.sessionId===e.id);if(n.length===0)return e;const r=f=>{if(f.status!=="running")return f;let h=f;for(const m of n)m.turnId===f.id&&(h=uv(h,m.itemId,m.text));return h},o=(e.turns??[]).map(r),l=(d=e.threads)==null?void 0:d.map(f=>{const h=(f.turns??[]).map(r);return h.some((m,v)=>{var k;return m!==((k=f.turns)==null?void 0:k[v])})?{...f,turns:h}:f});return o.some((f,h)=>f!==e.turns[h])||(l==null?void 0:l.some((f,h)=>{var m;return f!==((m=e.threads)==null?void 0:m[h])}))?{...e,turns:o,...l?{threads:l}:{}}:e}function hw(){return kt("/sessions")}function vi(e){return kt(`/sessions/${e}?items=summary`).then(pw)}function mw(e,n){return kt(`/sessions/${e}/turns/${n}`)}function Kd(e){return st("/sessions",e)}function sm(e){return Vl(`/sessions/${e}`)}function dv(e,n,r,o){return st(`/sessions/${e}/turns`,{user_prompt:n,...r!=null&&r.length?{attachments:r}:{},...o!=null&&o.originAppId?{origin_app_id:o.originAppId}:{}})}function gw(e){return st(`/sessions/${e}/cancel`)}function vw(e,n){return st(`/sessions/${encodeURIComponent(e)}/tasks/${encodeURIComponent(n)}/stop`)}function yw(e,n){return st(`/sessions/${e}/turns/${n}/resume`)}function xw(){return st("/turns/resume-signed-out")}function ww(e,n){return ds(`/sessions/${e}`,{title:n})}function rm(e){return ds(`/sessions/${e}`,{lifecycle:"finished"})}function om(e){return ds(`/sessions/${e}`,{lifecycle:"working"})}function kw(e,n){return ds(`/sessions/${e}`,{starred:n})}function im(e){return ds(`/sessions/${e}`,{has_unreviewed:0})}function Sw(e,n,r,o){const l={model:n,model_reasoning_effort:r};return o!==void 0&&(l.runtime_type=o),ds(`/sessions/${e}`,l)}function bw(e,n){return ds(`/sessions/${e}`,{runtime_config:n})}function Nw(e,n){return st(`/sessions/${e}/rewind`,{turn_id:n})}function Tw(e){return st(`/sessions/${e}/restore`,{})}function Cw(e,n,r){return st(`/sessions/${e}/branch`,{turn_id:n,title:r})}function fv(){return kt("/workspaces")}function Ew(e,n){return st("/workspaces",{path:e,label:n})}function jw(e){return st("/workspaces/hide",{path:e})}function _w(){return kt("/workspaces/picker")}function am(e){return kt(e?`/workspaces/browse?path=${encodeURIComponent(e)}`:"/workspaces/browse")}async function pv(){const e=await fetch(`${mn()}/api/pick-directory`);if(e.status===204)return{cancelled:!0};if(!e.ok)throw new Error(`GET /api/pick-directory failed: ${e.status} ${e.statusText}`);return e.json()}function hv(){return kt("/folders")}function Rw(e,n){return st("/folders",{workspace_path:e,name:n})}function lm(e,n){return ds(`/folders/${e}`,n)}function Aw(e){return Vl(`/folders/${e}`)}function Iw(e){return st("/sessions/reorder",{moves:e})}function Fs(e){return e.status==="pending"||e.status==="running"}function mv(e){return!!(e!=null&&e.turns.some(Fs))}function Kl(e){return e?e.turns.some(Fs)||(e.threads??[]).some(n=>(n.turns??[]).some(Fs)):!1}const Dw="s:",gd="a:",Fr=e=>`${Dw}${e}`,Ii=e=>`${gd}${e}`;function mr(e){return{kind:e.startsWith(gd)?"app":"session",id:e.slice(gd.length)}}function Gd(e){return e.activeAppTabId!==null?Ii(e.activeAppTabId):e.activeSessionId===null?null:Fr(e.activeSessionId)}function gv(e,n,r){const o=[...n.map(Fr),...r.map(Ii)],l=new Set(o),c=e.filter(h=>l.has(h)),d=new Set(c),f=o.filter(h=>!d.has(h));return f.length===0&&c.length===e.length?e:[...c,...f]}function Mw(e){return e.subscribe((n,r)=>{if(n.openTabs===r.openTabs&&n.openAppTabs===r.openAppTabs)return;const o=gv(n.tabOrder,n.openTabs,n.openAppTabs);o!==n.tabOrder&&e.setState({tabOrder:o})})}function cm(e,n,r){const o=e.indexOf(n);return e.slice(o+1).find(r)??e.slice(0,Math.max(o,0)).reverse().find(r)??null}function qd(e,n){const r=d=>!n.has(d),o=Gd(e);let{activeSessionId:l,activeAppTabId:c}=e;if(o!==null&&n.has(o)){const d=cm(e.tabOrder,o,r),f=d===null?null:mr(d);c=(f==null?void 0:f.kind)==="app"?f.id:null,(f==null?void 0:f.kind)==="session"&&(l=f.id)}if(l!==null&&n.has(Fr(l))){const d=h=>r(h)&&mr(h).kind==="session",f=cm(e.tabOrder,Fr(l),d);l=f===null?null:mr(f).id}return{activeSessionId:l,activeAppTabId:c}}function vv(e,n){if(e.tabOrder.includes(n))return!1;const{kind:r,id:o}=mr(n);return(r==="app"?e.apps:e.sessions).some(c=>c.id===o)}const yv=1;function xv(){let e="";try{e=mn()}catch{}return`agentpane:tabs:${e||window.location.origin}`}function Hu(e){return Array.isArray(e)&&e.every(n=>typeof n=="string")}function um(e){return e===null||typeof e=="string"}function Lw(e){if(e==null)return null;let n;try{n=JSON.parse(e)}catch{return null}if(typeof n!="object"||n===null)return null;const r=n;return r.v!==yv||!Hu(r.openTabs)||!um(r.activeSessionId)||!Hu(r.openAppTabs)||!um(r.activeAppTabId)?null:{openTabs:r.openTabs,activeSessionId:r.activeSessionId,openAppTabs:r.openAppTabs,activeAppTabId:r.activeAppTabId,tabOrder:Hu(r.tabOrder)?r.tabOrder:[]}}const wv=[()=>window.sessionStorage,()=>window.localStorage];function Ow(){const e=xv();for(const n of wv)try{const r=Lw(n().getItem(e));if(r)return r}catch{}return null}function $w(e){const n=xv(),r=JSON.stringify({v:yv,openTabs:e.openTabs,activeSessionId:e.activeSessionId,openAppTabs:e.openAppTabs,activeAppTabId:e.activeAppTabId,tabOrder:e.tabOrder});for(const o of wv)try{o().setItem(n,r)}catch{}}function Pw(e){return e.subscribe((n,r)=>{(n.openTabs!==r.openTabs||n.activeSessionId!==r.activeSessionId||n.openAppTabs!==r.openAppTabs||n.activeAppTabId!==r.activeAppTabId||n.tabOrder!==r.tabOrder)&&$w(n)})}function Ci(e){return[...new Set(e)]}function zw(e,n,r,o){const l=v=>r===null||r.has(v),c=Ci(((e==null?void 0:e.openTabs)??[]).filter(v=>n.has(v))),d=Ci(((e==null?void 0:e.openAppTabs)??[]).filter(l));let f=(e==null?void 0:e.activeSessionId)??null;f!==null&&!n.has(f)&&(f=null),f!==null&&!c.includes(f)&&c.push(f),f??(f=c.at(-1)??null);let h=(e==null?void 0:e.activeAppTabId)??null;h!==null&&!l(h)&&(h=null),h!==null&&!d.includes(h)&&d.push(h),o!==null&&n.has(o)&&(c.includes(o)||c.push(o),f=o,h=null);const m=gv(Ci((e==null?void 0:e.tabOrder)??[]),c,d);return{openTabs:c,activeSessionId:f,openAppTabs:d,activeAppTabId:h,tabOrder:m}}const Us=new Map,Xd=new Map,Gl=new Map,kl=new Set,Yd=new Map,ql=new Map;function Fw(e,n,r=""){Us.set(e,n),Xd.set(e,r)}function Uw(e){Us.delete(e),Xd.delete(e)}function dl(e,n){Gl.set(e,n)}function Bw(e,n){n?kl.add(e):kl.delete(e)}function dm(e,n,r){const o=Gl.get(e);if(!o||kl.has(o))return;const l=Us.get(o);l&&l({source:"agentpane-host",event:n,payload:r})}function fm(e,n){const r=Gl.get(e);if(!r||kl.has(r))return;const o=Us.get(r);o&&o({source:"agentpane-host",event:"background_tasks",payload:{sessionId:e,tasks:n}})}function Ww(e,n,r,o,l,c=null){if(typeof l=="string"&&l!==Xd.get(e))return;const d=Us.get(e);d&&d({source:"agentpane-host",event:"tool_call",payload:{callId:n,tool:r,name:r,args:o,caller:c}})}function Hw(e,n,r,o){const l=Gl.get(e);if(!l)return;const c=Us.get(l);c&&c({source:"agentpane-host",event:"turn:delta",payload:{sessionId:e,turnId:n,itemId:r,delta:o}})}function Vw(e,n){Yd.set(e,n)}function Kw(e){Yd.delete(e)}function Gw(e,n){ql.set(e,n)}function qw(e){ql.delete(e)}function kv(e,n={}){const r=ql.get(e);if(r){r(n);return}const o=Us.get(e);o&&o({source:"agentpane-host",event:"state_changed",payload:{}})}function Xw(){for(const e of new Set([...Us.keys(),...ql.keys()]))kv(e)}function Yw(e){var r;const n=Us.get(e);n&&n({source:"agentpane-host",event:"source:updated",payload:{}}),(r=Yd.get(e))==null||r()}const Qw=(e,n)=>({wsConnected:!1,backgroundTasks:{},retryStates:{},signedOutTurns:{},setWsConnected:r=>e({wsConnected:r}),onTurnCreated:(r,o)=>{e(l=>{const c=l.sessionDetails[r];return!c||o.thread_id?{}:c.turns.some(d=>d.id===o.id)?{}:{sessionDetails:{...l.sessionDetails,[r]:{...c,turns:[...c.turns,{...o,items:[]}]}}}})},onTurnStarted:(r,o)=>{n().addLogEntry("DEBUG",`turn:started — ${o.slice(0,8)}`),e(l=>{const c=cr(l.sessions,r,()=>({is_running:1,status:"running"})),d=l.sessionDetails[r];if(!d)return{sessions:c};const f=d.turns.findIndex(h=>h.id===o);return{sessionDetails:{...l.sessionDetails,[r]:{...bn(d,o,h=>({...h,status:"running"})),is_running:1,status:"running"}},sessions:c,activeTurnIndex:l.activeSessionId===r&&f>=0?f:l.activeTurnIndex}})},onItemStarted:(r,o,l)=>{n().addLogEntry("DEBUG",`item:started — ${l.type}`),e(c=>{const d=pm(l)?lr(c.retryStates,o):c.retryStates,f=c.sessionDetails[r];return f?{sessionDetails:{...c.sessionDetails,[r]:bn(f,o,h=>Ku(h,l))},retryStates:d}:{retryStates:d}})},onItemUpdated:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:bn(d,o,f=>Ku(f,l))}}:{}})},onItemCompleted:(r,o,l)=>{if(n().addLogEntry("DEBUG",`item:completed — ${l.type}`),l.type==="background_task"&&(l.status==="completed"||l.status==="failed")){const c=l.data||{},d=c.task_type||"unknown",f=c.description||"background task",m=d==="local_agent"?"Subagent":d==="local_bash"?"Monitor":"Task";l.status==="completed"?n().addToast("success",`${m} completed: ${f}`):c.status!=="stopped"&&n().addToast("error",`${m} failed: ${f}`)}e(c=>{const d=pm(l)?lr(c.retryStates,o):c.retryStates,f=c.sessionDetails[r];return f?{retryStates:d,sessionDetails:{...c.sessionDetails,[r]:bn(f,o,h=>{var v,k;let m=Ku(h,l);if(l.type==="agent_message"&&((v=l.data)!=null&&v.text)&&(m={...m,agent_response:l.data.text}),l.type==="reasoning"&&((k=l.data)!=null&&k.text)){const x=m.thoughts?m.thoughts+`
44
- `+l.data.text:l.data.text;m={...m,thoughts:x}}return m})}}:{retryStates:d}})},onItemDelta:(r,o,l,c,d)=>{Hw(r,o,l,c),e(f=>{const h=lr(f.retryStates,o),m=f.sessionDetails[r];return m?{sessionDetails:{...f.sessionDetails,[r]:bn(m,o,v=>tk(v,l,c,d))},retryStates:h}:{retryStates:h}})},onItemText:(r,o,l,c)=>{e(d=>{const f=d.sessionDetails[r];if(!f)return{};const h=bn(f,o,m=>m.status==="running"?uv(m,l,c):m);return{sessionDetails:{...d.sessionDetails,[r]:h}}})},onWidgetDelta:(r,o,l,c,d)=>{e(f=>{const h=lr(f.retryStates,o),m=f.sessionDetails[r];return m?{sessionDetails:{...f.sessionDetails,[r]:bn(m,o,v=>ek(v,l,c,d))},retryStates:h}:{retryStates:h}})},onTurnCompleted:(r,o,l,c,d)=>{n().dropSignedOutTurn(o);const f=(l==null?void 0:l.input_tokens)??0,h=(l==null?void 0:l.output_tokens)??0;n().addLogEntry("INFO",`turn:completed — ${f} in / ${h} out`),dm(r,"turn:completed",{sessionId:r,turnId:o,response:d??null}),n().refreshApps(),e(m=>{const v=m.sessionDetails[r],k=v?bn(v,o,E=>({...E,status:"completed",token_usage:l??E.token_usage??null,...d&&!E.agent_response?{agent_response:d}:{}})):null,x=Vu(k),S=x&&k?el(k):"active",C=cr(m.sessions,r,E=>({is_running:x,status:S,has_unreviewed:c?1:E.has_unreviewed})),T=lr(m.retryStates,o);return k?{sessionDetails:{...m.sessionDetails,[r]:{...k,is_running:x,status:S,has_unreviewed:c?1:k.has_unreviewed}},sessions:C,retryStates:T}:{sessions:C,retryStates:T}})},onTokenUsageUpdated:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:bn(d,o,f=>({...f,token_usage:l}))}}:{}})},onContextUsageUpdated:(r,o)=>{e(l=>{const c=l.sessionDetails[r];return c?{sessionDetails:{...l.sessionDetails,[r]:{...c,contextUsage:o}}}:{}})},onTurnFailed:(r,o,l,c)=>{n().dropSignedOutTurn(o),n().addLogEntry("ERROR",`turn:failed — ${l}`),n().addToast("error",`Turn failed — ${l}`),dm(r,"turn:failed",{sessionId:r,turnId:o,error:l}),e(d=>{const f=d.sessionDetails[r],h=l.includes("cancelled")||l.includes("aborted"),m=h?"aborted":"failed",v=f?bn(f,o,T=>({...T,status:m,error:l,...c?{resume_state:c}:{},items:T.items.map(E=>E.status==="in_progress"?{...E,status:"failed"}:E)})):null,k=Vu(v),x=k&&v?el(v):h?"active":"failed",S=cr(d.sessions,r,()=>({is_running:k,status:x})),C=lr(d.retryStates,o);return v?{sessionDetails:{...d.sessionDetails,[r]:{...v,is_running:k,status:x}},sessions:S,retryStates:C}:{sessions:S,retryStates:C}})},onTurnCancelled:(r,o)=>{n().dropSignedOutTurn(o),e(l=>{const c=l.sessionDetails[r],d=c?bn(c,o,k=>({...k,status:"aborted",...k.resume_state==="waiting"||k.resume_state==="resuming"?{resume_state:"cancelled"}:{},items:k.items.map(x=>x.status==="in_progress"?{...x,status:"completed"}:x)})):null,f=Vu(d),h=f&&d?el(d):"active",m=cr(l.sessions,r,()=>({is_running:f,status:h})),v=lr(l.retryStates,o);return d?{sessionDetails:{...l.sessionDetails,[r]:{...d,is_running:f,status:h}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnInterrupted:(r,o,l)=>{n().addLogEntry("WARN",`turn:interrupted — ${l.reason}${l.detail?` (${l.detail})`:""}`),n().addToast("warn",Zw(l.reason)),l.reason==="auth"?e(c=>({signedOutTurns:{...c.signedOutTurns,[o]:r}})):n().dropSignedOutTurn(o),e(c=>{const d=c.sessionDetails[r],f=d?bn(d,o,k=>({...k,status:"pending",error:null,resume_state:"waiting",interrupt_reason:l.reason,interrupted_at:l.interruptedAt,resume_attempts:l.attempts,resume_at:l.resumeAt??null})):null,h=f?el(f):"interrupted",m=cr(c.sessions,r,()=>({is_running:1,status:h})),v=lr(c.retryStates,o);return f?{sessionDetails:{...c.sessionDetails,[r]:{...f,is_running:1,status:h}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnResuming:(r,o,l)=>{n().dropSignedOutTurn(o),n().addLogEntry("INFO",`turn:resuming — ${o.slice(0,8)} (attempt ${l})`),e(c=>{const d=cr(c.sessions,r,()=>({is_running:1,status:"running"})),f=c.sessionDetails[r];return f?{sessionDetails:{...c.sessionDetails,[r]:{...bn(f,o,h=>({...h,status:"running",error:null,resume_state:"resuming",resume_attempts:l})),is_running:1,status:"running"}},sessions:d}:{sessions:d}})},onTurnResumed:(r,o)=>{n().addLogEntry("INFO",`turn:resumed — ${o.slice(0,8)}`),n().addToast("success","Interrupted turn resumed"),e(l=>{const c=l.sessionDetails[r];return c?{sessionDetails:{...l.sessionDetails,[r]:bn(c,o,d=>({...d,resume_state:"resumed"}))}}:{}})},onTurnRetrying:(r,o,l)=>{n().addLogEntry("WARN",`turn:retrying — ${r.slice(0,8)}/${o.slice(0,8)} attempt ${l.attempt}/${l.maxRetries} (${l.errorStatus??"no response"}${l.error?`, ${l.error}`:""})`),e(c=>({retryStates:{...c.retryStates,[o]:l}}))},onSessionTitle:(r,o)=>{e(l=>({sessions:l.sessions.map(c=>c.id===r?{...c,title:o}:c),sessionDetails:l.sessionDetails[r]?{...l.sessionDetails,[r]:{...l.sessionDetails[r],title:o}}:l.sessionDetails}))},onSessionTouched:r=>{e(o=>{const l=o.sessionDetails[r];return{sessions:cr(o.sessions,r,()=>({user_touched:1})),sessionDetails:l?{...o.sessionDetails,[r]:{...l,user_touched:1}}:o.sessionDetails}})},onSessionUpdated:r=>{const o={...r};delete o.is_running,delete o.status,e(l=>{const c=l.sessionDetails[r.id];return{sessions:cr(l.sessions,r.id,()=>o),sessionDetails:c?{...l.sessionDetails,[r.id]:{...c,...o}}:l.sessionDetails}})},onBackgroundTasksChanged:(r,o)=>{fm(r,o),e(l=>{if(o.length===0&&!l.backgroundTasks[r])return{};const c={...l.backgroundTasks};return o.length>0?c[r]=o:delete c[r],{backgroundTasks:c}})},onSignedOutTurnsSnapshot:r=>e({signedOutTurns:Object.fromEntries(r.map(o=>[o.turnId,o.sessionId]))}),dropSignedOutTurn:r=>{if(!(r in n().signedOutTurns))return;const o={...n().signedOutTurns};delete o[r],e({signedOutTurns:o})},onBackgroundTasksSnapshot:r=>{for(const[l,c]of Object.entries(r))fm(l,c);const o={};for(const[l,c]of Object.entries(r))c.length>0&&(o[l]=c);e({backgroundTasks:o})}});function Zw(e){switch(e){case"network":return"Network error — the turn will resume when the connection is back";case"process_exit":return"The agent process stopped — resuming the turn";case"auth":return"Claude is signed out — the turn waits until you sign in again";case"usage_limit":return"Usage limit reached — the turn waits until it is over";default:return"The agent host restarted — resuming the turn"}}function el(e){const n=[...e.turns,...(e.threads??[]).flatMap(r=>r.turns??[])].filter(Fs);return n.length>0&&n.every(r=>r.status==="pending"&&r.resume_state==="waiting")?"interrupted":"running"}function pm(e){return e.type!=="background_task"&&e.type!=="error"&&e.type!=="interruption"}function lr(e,n){if(!(n in e))return e;const r={...e};return delete r[n],r}function Vu(e){return e&&(e.turns.some(Fs)||(e.threads??[]).some(r=>(r.turns??[]).some(Fs)))?1:0}function cr(e,n,r){return e.some(o=>o.id===n)?e.map(o=>o.id===n?{...o,...r(o)}:o):e}function bn(e,n,r){const o=(e.threads??[]).map(l=>(l.turns??[]).some(c=>c.id===n)?{...l,turns:(l.turns??[]).map(c=>c.id===n?r(c):c)}:l);return{...e,turns:e.turns.map(l=>l.id===n?r(l):l),threads:o}}function Qd(e,n){for(let r=e.length-1;r>=0;r--)if(e[r].external_item_id===n)return r;return-1}function Ku(e,n){const r=Qd(e.items,n.external_item_id);if(r>=0){const c=[...e.items];return c[r]=n,{...e,items:c}}if(n.type==="agent_message"){const c=e.items.filter(d=>!(d.type==="agent_message"&&d.id.startsWith("delta-")));return{...e,items:[...c,n]}}const o=e.items;let l=o.length;if(e.deferred_item_count)for(;l>0&&o[l-1].created_at>n.created_at;)l--;return{...e,items:[...o.slice(0,l),n,...o.slice(l)]}}function Jw(e,n){const r=c=>c.external_item_id??c.id,o=new Map(e.items.map(c=>[r(c),c])),l=n.map(c=>{var f;const d=o.get(r(c));return o.delete(r(c)),d&&((f=d.data)==null?void 0:f.partial)!==!0&&d.updated_at>c.updated_at?d:c});return{...e,items:[...l,...o.values()],deferred_item_count:0,deferred_tool_calls:0}}function ek(e,n,r,o){var f;const l=new Date().toISOString(),c=Qd(e.items,n);if(c>=0){const h=e.items[c];if(((f=h.data)==null?void 0:f.partial)!==!0||h.data.title===r&&h.data.html===o)return e;const m=[...e.items];return m[c]={...h,data:{...h.data,title:r,html:o},updated_at:l},{...e,items:m}}const d={id:`delta-${n}`,turn_id:e.id,external_item_id:n,type:"widget",data:{title:r,html:o,error:null,partial:!0},status:"in_progress",created_at:l,updated_at:l};return{...e,items:[...e.items,d]}}function tk(e,n,r,o){var d;const l=Qd(e.items,n);if(l>=0){const f=e.items[l],h=((d=f.data)==null?void 0:d.text)??"",m=o??h+r,v=[...e.items];return v[l]={...f,data:{...f.data,text:m}},{...e,items:v,agent_response:m}}const c={id:`delta-${n}`,turn_id:e.id,external_item_id:n,type:"agent_message",data:{text:o??r},status:"in_progress",created_at:new Date().toISOString(),updated_at:new Date().toISOString()};return{...e,items:[...e.items,c],agent_response:o??r}}function nk(){const e=new URLSearchParams(window.location.search);return{session:e.get("session"),thread:e.get("thread")}}function sk(){const e=new URL(window.location.href);!e.searchParams.has("session")&&!e.searchParams.has("thread")||(e.searchParams.delete("session"),e.searchParams.delete("thread"),window.history.replaceState(window.history.state,"",e))}let Gu=0;function hm(e){return e==="sidecar"?"sidecar":"turns"}async function rk(e,n){const r=await Promise.allSettled(e.map(c=>n(c))),o=new Map;let l=null;return r.forEach((c,d)=>{var f;c.status==="fulfilled"?o.set(e[d],c.value):l===null&&(l=((f=c.reason)==null?void 0:f.message)??"Request failed")}),{updated:o,firstError:l}}function ok(e,n){const r={...e.sessionDetails};n.forEach(h=>delete r[h]);const o={...e.backgroundTasks};n.forEach(h=>delete o[h]);const l=Object.fromEntries(Object.entries(e.signedOutTurns).filter(([,h])=>!n.has(h))),c=e.openTabs.filter(h=>!n.has(h)),d=qd(e,new Set([...n].map(Fr)));let f=e.activeTurnIndex;if(d.activeSessionId!==e.activeSessionId){const h=d.activeSessionId?r[d.activeSessionId]:null;f=h&&h.turns.length>0?h.turns.length-1:0}return{sessions:e.sessions.filter(h=>!n.has(h.id)),sessionDetails:r,backgroundTasks:o,signedOutTurns:l,openTabs:c,...d,activeTurnIndex:f}}function ik(e){const n={...e};return delete n.turns,delete n.threads,delete n.contextUsage,n}function mm(e,n,r){const o=n().activeSessionId;e(c=>ok(c,r));const l=n().activeSessionId;l&&l!==o&&n().selectSession(l,{keepAppView:!0})}async function gm(e,n,r,o,l){if(r.length===0)return;e({error:null});const{updated:c,firstError:d}=await rk(r,o);c.size>0&&e(h=>({sessions:h.sessions.map(m=>c.get(m.id)??m)}));const f=r.length-c.size;if(f===0)n().addToast("info",`${r.length} session${r.length===1?"":"s"} ${l}`);else{e({error:d});const h=l[0].toUpperCase()+l.slice(1);n().addToast(f===r.length?"error":"warn",`${h} ${c.size} of ${r.length} — ${f} failed`)}}const qu=new Map,ak=(e,n)=>({sessions:[],sessionDetails:{},activeSessionId:null,openTabs:[],activeTurnIndex:0,submittingPrompt:null,quotedText:null,init:async()=>{const r=nk(),o=Ow();try{const l=localStorage.getItem("agentpane:last-model-config");l&&e({lastModelConfig:JSON.parse(l)})}catch{}e({loading:!0,error:null});try{const l=n().loadApps(),[c,d,f]=await Promise.all([hw(),fv(),hv()]);e({sessions:c,workspaces:d,folders:f,loading:!1}),sk();const h=await l,m=zw(o,new Set(c.map(v=>v.id)),h?new Set(n().apps.map(v=>v.id)):null,r.session);e(v=>{const k=v.activeSessionId!==null||v.activeAppTabId!==null;return{openTabs:Ci([...m.openTabs,...v.openTabs]),openAppTabs:Ci([...m.openAppTabs,...v.openAppTabs]),tabOrder:m.tabOrder,activeAppTabId:k?v.activeAppTabId:m.activeAppTabId}}),m.activeSessionId&&!n().activeSessionId&&await n().selectSession(m.activeSessionId,{keepAppView:!0}),r.thread&&(e({deepLinkThreadId:r.thread}),n().switchRightTab("threads"))}catch(l){e({loading:!1,error:l.message})}},selectSession:async(r,o)=>{const l=++Gu,c=o!=null&&o.keepAppView?{}:{activeAppTabId:null},d=f=>f.includes(r)?f:[...f,r];if(n().sessionDetails[r]){const f=n().sessionDetails[r];e({activeSessionId:r,activeTurnIndex:f.turns.length>0?f.turns.length-1:0,activeRightTab:hm(n().activeRightTab),...c,openTabs:d(n().openTabs)}),f.has_unreviewed===1&&(im(r).catch(()=>{}),e(h=>({sessions:h.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...h.sessionDetails,[r]:{...f,has_unreviewed:0}}})));return}e({loading:!0,error:null});try{const f=await vi(r);if(l!==Gu){e(h=>({sessionDetails:{...h.sessionDetails,[r]:f},openTabs:d(h.openTabs),loading:!1}));return}e(h=>({sessionDetails:{...h.sessionDetails,[r]:f},activeSessionId:r,activeTurnIndex:f.turns.length>0?f.turns.length-1:0,activeRightTab:hm(h.activeRightTab),...c,openTabs:d(h.openTabs),loading:!1})),f.has_unreviewed===1&&(im(r).catch(()=>{}),e(h=>({sessions:h.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...h.sessionDetails,[r]:{...f,has_unreviewed:0}}})))}catch(f){e(l===Gu?{loading:!1,error:f.message}:{loading:!1})}},closeTab:r=>n().closeTabs([Fr(r)]),updateModelConfig:async(r,o,l)=>{const c=n().activeSessionId;if(c){e({error:null});try{const d=await Sw(c,r,o,l),f={provider:d.runtime_type,model:d.model??"",reasoning:d.model_reasoning_effort??""};e({lastModelConfig:f}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(f)),e(h=>({sessions:h.sessions.map(m=>m.id===c?d:m),sessionDetails:h.sessionDetails[c]?{...h.sessionDetails,[c]:{...h.sessionDetails[c],model:d.model,model_reasoning_effort:d.model_reasoning_effort,external_thread_id:d.external_thread_id}}:h.sessionDetails})),await n().refreshActiveSession()}catch(d){e({error:d.message}),n().addToast("error",`Failed to update model — ${d.message}`)}}},createSession:async r=>{e({error:null});try{const o=await Kd(r);e(c=>({sessions:[o,...c.sessions],showNewSessionDialog:!1}));const l={provider:o.runtime_type,model:o.model??"",reasoning:o.model_reasoning_effort??""};e({lastModelConfig:l}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(l)),await n().selectSession(o.id),n().addLogEntry("INFO",`Session created — ${o.id.slice(0,8)}`),n().addToast("success",`Session created — ${o.title||o.id.slice(0,8)}`)}catch(o){e({error:o.message}),n().addToast("error",`Failed to create session — ${o.message}`)}},addSession:r=>{e(o=>({sessions:o.sessions.some(l=>l.id===r.id)?o.sessions:[r,...o.sessions]}))},revealSession:async r=>{let o=n().sessionDetails[r];if(!o){const l=await vi(r);e(c=>({sessionDetails:{...c.sessionDetails,[r]:l}})),o=l}n().sessions.some(l=>l.id===r)||n().addSession(ik(o)),await n().selectSession(r)},deleteSession:async r=>{var l;e({error:null});const o=(l=n().sessions.find(c=>c.id===r))==null?void 0:l.title;try{await sm(r),mm(e,n,new Set([r])),n().addLogEntry("INFO",`Session deleted — ${r.slice(0,8)}`),n().addToast("info",`Session "${o||r.slice(0,8)}" deleted`)}catch(c){e({error:c.message}),n().addToast("error",`Failed to delete session — ${c.message}`)}},renameSession:async(r,o)=>{e({error:null});try{const l=await ww(r,o.trim());e(c=>({sessions:c.sessions.map(d=>d.id===r?l:d),sessionDetails:c.sessionDetails[r]?{...c.sessionDetails,[r]:{...c.sessionDetails[r],title:l.title}}:c.sessionDetails}))}catch(l){e({error:l.message}),n().addToast("error",`Failed to rename session — ${l.message}`)}},markFinished:async r=>{e({error:null});try{const o=await rm(r);e(l=>({sessions:l.sessions.map(c=>c.id===r?o:c)})),n().addToast("info","Session marked as finished")}catch(o){e({error:o.message}),n().addToast("error",`Failed to mark as finished — ${o.message}`)}},markFinishedMany:async r=>{await gm(e,n,r,rm,"marked as finished")},toggleStar:async r=>{const o=n().sessions.find(l=>l.id===r);if(o){e({error:null});try{const l=await kw(r,o.starred?0:1);e(c=>({sessions:c.sessions.map(d=>d.id===r?l:d),sessionDetails:c.sessionDetails[r]?{...c.sessionDetails,[r]:{...c.sessionDetails[r],starred:l.starred}}:c.sessionDetails}))}catch(l){e({error:l.message}),n().addToast("error",`Failed to star session — ${l.message}`)}}},reopenSession:async r=>{e({error:null});try{const o=await om(r);e(l=>({sessions:l.sessions.map(c=>c.id===r?o:c)})),n().addToast("info","Session reopened")}catch(o){e({error:o.message}),n().addToast("error",`Failed to reopen session — ${o.message}`)}},reopenSessionMany:async r=>{await gm(e,n,r,om,"reopened")},deleteSessionMany:async r=>{if(r.length===0)return;e({error:null});const o=await Promise.allSettled(r.map(d=>sm(d))),l=new Set;if(o.forEach((d,f)=>{d.status==="fulfilled"&&l.add(r[f])}),l.size===0){e({error:"Failed to delete sessions"}),n().addToast("error","Failed to delete sessions");return}mm(e,n,l),n().addLogEntry("INFO",`${l.size} session${l.size===1?"":"s"} deleted`);const c=r.length-l.size;c===0?n().addToast("info",`${l.size} session${l.size===1?"":"s"} deleted`):(e({error:"One or more sessions failed to delete"}),n().addToast("warn",`Deleted ${l.size} of ${r.length} — ${c} failed`))},submitPrompt:async(r,o)=>{const l=n().activeSessionId;if(l){e({error:null,submittingPrompt:r}),e(c=>{const d=c.sessionDetails[l];return d?{sessionDetails:{...c.sessionDetails,[l]:{...d,is_running:1,status:"running"}},sessions:c.sessions.map(f=>f.id===l?{...f,is_running:1,status:"running"}:f)}:{}});try{const c=await dv(l,r,o);n().addLogEntry("INFO",`Turn submitted — "${r.slice(0,40)}"`),e(d=>{const f=d.sessionDetails[l];if(!f)return{submittingPrompt:null};const h=f.turns.findIndex(v=>v.id===c.id);if(h>=0)return{submittingPrompt:null,activeTurnIndex:h};const m={...c,items:[]};return{submittingPrompt:null,sessionDetails:{...d.sessionDetails,[l]:{...f,turns:[...f.turns,m]}},activeTurnIndex:f.turns.length}})}catch(c){e({submittingPrompt:null,error:c.message}),n().addLogEntry("ERROR",`Turn failed — ${c.message}`),n().addToast("error",`Failed to send prompt — ${c.message}`),e(d=>{const f=d.sessionDetails[l];if(!f)return{};const h=Kl(f)?1:0;return{sessionDetails:{...d.sessionDetails,[l]:{...f,is_running:h,status:h?"running":"active"}},sessions:d.sessions.map(m=>m.id===l?{...m,is_running:h,status:h?"running":"active"}:m)}})}}},cancelTurn:async()=>{const r=n().activeSessionId;if(r)try{await gw(r)}catch(o){e({error:o.message})}},rewindToTurn:async(r,o)=>{e({error:null});try{const l=await Nw(r,o),c=await vi(r);e(d=>({sessionDetails:{...d.sessionDetails,[r]:c},sessions:d.sessions.map(f=>f.id===r?{...f,external_thread_id:l.external_thread_id,is_running:0,status:"active"}:f),activeTurnIndex:c.turns.length>0?c.turns.length-1:0})),n().addToast("info","Rewound to selected turn")}catch(l){e({error:l.message}),n().addToast("error",`Failed to rewind — ${l.message}`)}},restoreSession:async r=>{e({error:null});try{const o=await Tw(r),l=await vi(r);e(c=>({sessionDetails:{...c.sessionDetails,[r]:l},sessions:c.sessions.map(d=>d.id===r?{...d,external_thread_id:o.external_thread_id,is_running:0,status:"active"}:d),activeTurnIndex:l.turns.length>0?l.turns.length-1:0})),n().addToast("info","Restored rewound session")}catch(o){e({error:o.message}),n().addToast("error",`Failed to restore — ${o.message}`)}},branchFromTurn:async(r,o,l)=>{e({error:null});try{const c=await Cw(r,o,l);e(d=>({sessions:[c,...d.sessions]})),await n().selectSession(c.id),n().addToast("success","Branched from selected turn")}catch(c){e({error:c.message}),n().addToast("error",`Failed to branch — ${c.message}`)}},updateRuntimeConfig:async r=>{const o=n().activeSessionId;if(o){e({error:null});try{const l=await bw(o,JSON.stringify(r));e(c=>({sessions:c.sessions.map(d=>d.id===o?l:d),sessionDetails:c.sessionDetails[o]?{...c.sessionDetails,[o]:{...c.sessionDetails[o],runtime_config:l.runtime_config}}:c.sessionDetails}))}catch(l){e({error:l.message}),n().addToast("error",`Failed to update config — ${l.message}`)}}},refreshActiveSession:async()=>{const r=n().activeSessionId;if(r)try{const o=await vi(r);e(l=>({sessionDetails:{...l.sessionDetails,[r]:o},activeTurnIndex:o.turns.length>0?Math.min(l.activeTurnIndex,o.turns.length-1):0,sessions:l.sessions.map(c=>c.id===r?{...c,is_running:o.is_running,status:o.status}:c)}))}catch(o){e({error:o.message})}},loadDeferredItems:(r,o)=>{const l=qu.get(o);if(l)return l;const c=mw(r,o).then(({items:d})=>(e(f=>{const h=f.sessionDetails[r];return h?{sessionDetails:{...f.sessionDetails,[r]:bn(h,o,m=>Jw(m,d))}}:{}}),!0)).catch(d=>(n().addToast("error",`Failed to load tool calls — ${d.message}`),!1)).finally(()=>qu.delete(o));return qu.set(o,c),c}});async function lk(e){const{sessions:n}=await kt(`/claude-sessions?workspace=${encodeURIComponent(e)}`);return n}function ck(e,n){return st(`/claude-sessions/${encodeURIComponent(e)}/import`,{workspace:n})}async function uk(e){const{sessions:n}=await kt(`/codex-sessions?workspace=${encodeURIComponent(e)}`);return n}function dk(e,n){return st(`/codex-sessions/${encodeURIComponent(e)}/import`,{workspace:n})}const vd=["claude","codex"],Xl={claude:"Claude Code",codex:"Codex"};function Xu(e){return`${e.runtime}:${e.id}`}function Sv(e){const n=e.length===1?"session":"sessions";return new Set(e).size===1?`${e.length} ${Xl[e[0]]} ${n}`:`${e.length} ${n}`}const fk={claude:e=>lk(e),codex:e=>uk(e)},pk={claude:(e,n)=>ck(e,n),codex:(e,n)=>dk(e,n)};async function bv(e){const n=await Promise.allSettled(vd.map(l=>fk[l](e))),r=[],o={};return n.forEach((l,c)=>{const d=vd[c];l.status==="fulfilled"?r.push(...l.value.map(f=>({...f,runtime:d}))):o[d]=hr(l.reason)}),r.sort((l,c)=>l.last_modified<c.last_modified?1:l.last_modified>c.last_modified?-1:0),{sessions:r,errors:o}}function hk(e,n){return pk[e.runtime](e.id,n)}const vm={available:!0,reason:null};let Yu=null;const mk=(e,n)=>({workspaces:[],pickerSupport:null,loadPickerSupport:()=>{const r=n().pickerSupport;return r?Promise.resolve(r):(Yu??(Yu=_w().then(o=>typeof(o==null?void 0:o.available)!="boolean"?vm:(e({pickerSupport:o}),o)).catch(()=>vm).finally(()=>{Yu=null})),Yu)},createWorkspaceAt:async r=>{const o=await Ew(r.trim());return e(l=>({workspaces:[...l.workspaces.filter(c=>c.id!==o.id),o]})),o},addWorkspace:async r=>{e({error:null});try{const o=await n().createWorkspaceAt(r);return n().addToast("success",`Workspace added — ${o.path}`),o}catch(o){return n().addToast("error",`Failed to add workspace — ${hr(o)}`),null}},removeWorkspace:async r=>{e({error:null});try{await jw(r);const o=await fv();e({workspaces:o}),n().addToast("info","Workspace hidden")}catch(o){n().addToast("error",`Failed to hide workspace — ${o.message}`)}},createSessionInWorkspace:async r=>{e({error:null});try{const o=n().lastModelConfig,l=await Kd({cwd:r,runtime_type:(o==null?void 0:o.provider)??"codex",model:o==null?void 0:o.model,model_reasoning_effort:o==null?void 0:o.reasoning});e(c=>({sessions:[l,...c.sessions]})),await n().selectSession(l.id),n().addLogEntry("INFO",`Session created in ${r} — ${l.id.slice(0,8)}`),n().addToast("success",`Session created in ${r.split("/").pop()||r}`)}catch(o){e({error:o.message}),n().addToast("error",`Failed to create session — ${o.message}`)}},pickAndAddWorkspace:async()=>{if(!(await n().loadPickerSupport()).available){n().setShowAddWorkspaceDialog(!0);return}try{const o=await pv();if(o.cancelled||!o.path)return;await n().addWorkspace(o.path)}catch(o){n().addToast("error",`Failed to pick directory — ${o.message}`)}},importSessions:async(r,o)=>{const l=[],c=[],d=[];for(const f of[...o].reverse())try{l.unshift(await hk(f,r)),c.unshift(f.runtime)}catch(h){d.unshift({...f,error:hr(h)})}if(l.length>0){e(h=>({sessions:[...l,...h.sessions]})),await n().selectSession(l[0].id);const f=Sv(c);n().addLogEntry("INFO",`Imported ${f} into ${r}`),n().addToast("success",l.length===1?`Imported — ${l[0].title||`${Xl[c[0]]} session`}`:`Imported ${f}`)}return{imported:l,failed:d}}});function Nv(e,n){const r=n?`?cwd=${encodeURIComponent(n)}`:"";return kt(`/providers/${encodeURIComponent(e)}/models${r}`)}const ym="curl -fsSL https://repoburg.com/install.sh | bash",gk=2e3,Tv="agentpane:daemon-seen";function vk(e=mn()){if(!e)return!1;try{const n=new URL(e);return n.protocol==="http:"&&(n.hostname==="localhost"||n.hostname==="127.0.0.1")}catch{return!1}}async function yk(e=mn()){try{return await fetch(`${e}/health`,{mode:"no-cors",cache:"no-store"}),!0}catch{return!1}}function xk(){try{return localStorage.getItem(Tv)==="true"}catch{return!1}}function wk(){try{localStorage.setItem(Tv,"true")}catch{}}function kk(e){let n=!1,r=!1,o=!1,l=null;function c(){l!==null&&(clearTimeout(l),l=null)}async function d(){if(n||r)return;c(),r=!0;const m=await yk();if(r=!1,!n){if(m){wk(),h(),e.onReady();return}o||(o=!0,e.onMissing()),l=setTimeout(()=>void d(),gk)}}function f(){document.visibilityState==="visible"&&d()}function h(){n=!0,c(),window.removeEventListener("focus",f),document.removeEventListener("visibilitychange",f)}return window.addEventListener("focus",f),document.addEventListener("visibilitychange",f),d(),h}const yd=160,xd=480,Sk=240,Sl=220,bk=300,Nk=600,Tk=36;function bl(){return typeof window>"u"?Nk:Math.max(Sl,Math.round(window.innerWidth*.7))}const xm="agentpane:sidebar-width",wm="agentpane:right-panel-width",Qu="agentpane:right-panel-collapsed";function km(e,n,r,o){try{const l=localStorage.getItem(e);if(l==null)return o;const c=Number(l);return Number.isFinite(c)?Math.min(r,Math.max(n,c)):o}catch{return o}}function Ck(e){try{return localStorage.getItem(e)==="true"}catch{return!1}}function Sm(e,n){try{localStorage.setItem(e,String(n))}catch{}}const bm=200,Ek=(e,n)=>({activeRightTab:"turns",eventLog:[],loading:!1,error:null,showNewSessionDialog:!1,showAddWorkspaceDialog:!1,importSessionsWorkspace:null,showRemoteModal:!1,toasts:[],showCommandPalette:!1,lastModelConfig:null,models:[],modelsLoading:!1,showModelSelector:!1,sidebarWidth:km(xm,yd,xd,Sk),rightPanelWidth:km(wm,Sl,bl(),bk),rightPanelCollapsed:Ck(Qu),deepLinkThreadId:null,vscodeViewOpen:!1,vscodeState:"stopped",vscodeId:null,vscodeToken:null,usageViewOpen:!1,terminalViewOpen:!1,canGoBack:!1,canGoForward:!1,daemonStatus:vk()?"checking":"ready",setActiveTurnIndex:r=>e({activeTurnIndex:r}),switchRightTab:r=>{n().rightPanelCollapsed&&Sm(Qu,!1),e({activeRightTab:r,rightPanelCollapsed:!1})},setShowNewSessionDialog:r=>e({showNewSessionDialog:r}),setShowAddWorkspaceDialog:r=>e({showAddWorkspaceDialog:r}),setImportSessionsWorkspace:r=>e({importSessionsWorkspace:r}),setShowRemoteModal:r=>e({showRemoteModal:r}),setShowCommandPalette:r=>e({showCommandPalette:r}),setShowModelSelector:r=>e({showModelSelector:r}),setDeepLinkThreadId:r=>e({deepLinkThreadId:r}),setSidebarWidth:r=>{const o=Math.min(xd,Math.max(yd,Math.round(r)));e({sidebarWidth:o});try{localStorage.setItem(xm,String(o))}catch{}},setRightPanelWidth:r=>{const o=Math.min(bl(),Math.max(Sl,Math.round(r)));e({rightPanelWidth:o});try{localStorage.setItem(wm,String(o))}catch{}},setRightPanelCollapsed:r=>{e({rightPanelCollapsed:r}),Sm(Qu,r)},toggleRightPanel:()=>n().setRightPanelCollapsed(!n().rightPanelCollapsed),toggleVscodeView:()=>{if(n().vscodeViewOpen){e({vscodeViewOpen:!1});return}e({vscodeViewOpen:!0,terminalViewOpen:!1,vscodeState:"starting",vscodeId:null,vscodeToken:null})},setVscodeView:(r,o,l)=>e({vscodeState:r,vscodeId:o,vscodeToken:l}),toggleUsageView:()=>e({usageViewOpen:!n().usageViewOpen,terminalViewOpen:!1}),toggleTerminalView:()=>e(n().terminalViewOpen?{terminalViewOpen:!1}:{terminalViewOpen:!0,vscodeViewOpen:!1,usageViewOpen:!1}),setDaemonStatus:r=>e({daemonStatus:r}),addToast:(r,o,l,c)=>{const d=Math.random().toString(36).slice(2,9);e(f=>({toasts:[...f.toasts,{id:d,type:r,message:o,undoAction:l,undoLabel:c}]}))},removeToast:r=>{e(o=>({toasts:o.toasts.filter(l=>l.id!==r)}))},addLogEntry:(r,o)=>{const l=new Date().toLocaleTimeString("en-GB",{hour12:!1});e(c=>{const d=[...c.eventLog,{time:l,level:r,message:o}];return d.length>bm&&d.splice(0,d.length-bm),{eventLog:d}})},loadModels:async(r,o)=>{if(!n().modelsLoading){e({modelsLoading:!0,models:[]});try{const l=await Nv(r,o);e({models:l,modelsLoading:!1})}catch{e({modelsLoading:!1})}}}}),jk=(e,n)=>({createThread:async(r,o)=>{try{await st(`/sessions/${r}/threads`,o),n().addLogEntry("INFO",`Thread created — "${o.message.slice(0,40)}"`)}catch(l){n().addToast("error",`Failed to create thread — ${l.message}`)}},followupThread:async(r,o,l)=>{try{await st(`/sessions/${r}/threads/${o}/followup`,{message:l}),n().addLogEntry("INFO",`Thread follow-up — "${l.slice(0,40)}"`)}catch(c){n().addToast("error",`Failed to send follow-up — ${c.message}`)}},cancelThreadTurn:async(r,o)=>{try{await st(`/sessions/${r}/cancel?threadId=${encodeURIComponent(o)}`),n().addLogEntry("INFO","Thread turn cancelled")}catch(l){n().addToast("error",`Failed to cancel thread turn — ${l.message}`)}},resolveThread:async(r,o)=>{try{await ds(`/sessions/${r}/threads/${o}`,{status:"resolved"})}catch(l){n().addToast("error",`Failed to resolve thread — ${l.message}`)}},reopenThread:async(r,o)=>{try{await ds(`/sessions/${r}/threads/${o}`,{status:"open"})}catch(l){n().addToast("error",`Failed to reopen thread — ${l.message}`)}},shareThread:async(r,o,l)=>{try{const c=await st(`/sessions/${r}/threads/${o}/summarize`,{directives:l}),d=`
43
+ ${r}`}function fw(e,n,r,o){const l=kl(e,n,r),c=ds.get(l);return c?(c.text+=o,c.text):(ds.set(l,{sessionId:e,turnId:n,itemId:r,text:o}),o)}function pw(e,n){for(const[o,l]of ds)(e===null||l.sessionId===e)&&ds.delete(o);const r=n.filter(o=>o&&typeof o.sessionId=="string"&&typeof o.turnId=="string"&&typeof o.itemId=="string"&&typeof o.text=="string");for(const o of r)ds.set(kl(o.sessionId,o.turnId,o.itemId),{...o});return r}function Hu(e,n,r){var c;const o=r==null?void 0:r.external_item_id;if(!r||!o)return;const l=kl(e,n,o);if(r.status==="in_progress"){const d=(c=r.data)==null?void 0:c.text;typeof d=="string"&&ds.set(l,{sessionId:e,turnId:n,itemId:o,text:d});return}ds.delete(l),r.type==="agent_message"&&ds.delete(kl(e,n,dw(n)))}function gi(e,n){for(const[r,o]of ds)o.sessionId===e&&o.turnId===n&&ds.delete(r)}function uv(e,n,r){var f;const o=e.items??[];let l=-1;for(let h=o.length-1;h>=0;h--)if(o[h].external_item_id===n){l=h;break}if(l>=0){const h=o[l];if(h.status!=="in_progress"||((f=h.data)==null?void 0:f.text)===r)return e;const m=[...o];return m[l]={...h,data:{...h.data,text:r}},{...e,items:m,...h.type==="agent_message"?{agent_response:r}:{}}}const c=new Date().toISOString(),d={id:`delta-${n}`,turn_id:e.id,external_item_id:n,type:"agent_message",data:{text:r},status:"in_progress",created_at:c,updated_at:c};return{...e,items:[...o,d],agent_response:r}}function hw(e){var d;const n=[...ds.values()].filter(f=>f.sessionId===e.id);if(n.length===0)return e;const r=f=>{if(f.status!=="running")return f;let h=f;for(const m of n)m.turnId===f.id&&(h=uv(h,m.itemId,m.text));return h},o=(e.turns??[]).map(r),l=(d=e.threads)==null?void 0:d.map(f=>{const h=(f.turns??[]).map(r);return h.some((m,v)=>{var k;return m!==((k=f.turns)==null?void 0:k[v])})?{...f,turns:h}:f});return o.some((f,h)=>f!==e.turns[h])||(l==null?void 0:l.some((f,h)=>{var m;return f!==((m=e.threads)==null?void 0:m[h])}))?{...e,turns:o,...l?{threads:l}:{}}:e}function mw(){return kt("/sessions")}function vi(e){return kt(`/sessions/${e}?items=summary`).then(hw)}function gw(e,n){return kt(`/sessions/${e}/turns/${n}`)}function Kd(e){return st("/sessions",e)}function sm(e){return Kl(`/sessions/${e}`)}function dv(e,n,r,o){return st(`/sessions/${e}/turns`,{user_prompt:n,...r!=null&&r.length?{attachments:r}:{},...o!=null&&o.originAppId?{origin_app_id:o.originAppId}:{}})}function vw(e){return st(`/sessions/${e}/cancel`)}function yw(e,n){return st(`/sessions/${encodeURIComponent(e)}/tasks/${encodeURIComponent(n)}/stop`)}function xw(e,n){return st(`/sessions/${e}/turns/${n}/resume`)}function ww(){return st("/turns/resume-signed-out")}function kw(e,n){return fs(`/sessions/${e}`,{title:n})}function rm(e){return fs(`/sessions/${e}`,{lifecycle:"finished"})}function om(e){return fs(`/sessions/${e}`,{lifecycle:"working"})}function Sw(e,n){return fs(`/sessions/${e}`,{starred:n})}function im(e){return fs(`/sessions/${e}`,{has_unreviewed:0})}function bw(e,n,r,o){const l={model:n,model_reasoning_effort:r};return o!==void 0&&(l.runtime_type=o),fs(`/sessions/${e}`,l)}function Nw(e,n){return fs(`/sessions/${e}`,{runtime_config:n})}function Tw(e,n){return st(`/sessions/${e}/rewind`,{turn_id:n})}function Cw(e){return st(`/sessions/${e}/restore`,{})}function Ew(e,n,r){return st(`/sessions/${e}/branch`,{turn_id:n,title:r})}function fv(){return kt("/workspaces")}function jw(e,n){return st("/workspaces",{path:e,label:n})}function _w(e){return st("/workspaces/hide",{path:e})}function Rw(){return kt("/workspaces/picker")}function am(e){return kt(e?`/workspaces/browse?path=${encodeURIComponent(e)}`:"/workspaces/browse")}async function pv(){const e=await fetch(`${mn()}/api/pick-directory`);if(e.status===204)return{cancelled:!0};if(!e.ok)throw new Error(`GET /api/pick-directory failed: ${e.status} ${e.statusText}`);return e.json()}function hv(){return kt("/folders")}function Aw(e,n){return st("/folders",{workspace_path:e,name:n})}function lm(e,n){return fs(`/folders/${e}`,n)}function Iw(e){return Kl(`/folders/${e}`)}function Dw(e){return st("/sessions/reorder",{moves:e})}function Fs(e){return e.status==="pending"||e.status==="running"}function mv(e){return!!(e!=null&&e.turns.some(Fs))}function Gl(e){return e?e.turns.some(Fs)||(e.threads??[]).some(n=>(n.turns??[]).some(Fs)):!1}const Mw="s:",vd="a:",Fr=e=>`${Mw}${e}`,Ii=e=>`${vd}${e}`;function mr(e){return{kind:e.startsWith(vd)?"app":"session",id:e.slice(vd.length)}}function Gd(e){return e.activeAppTabId!==null?Ii(e.activeAppTabId):e.activeSessionId===null?null:Fr(e.activeSessionId)}function gv(e,n,r){const o=[...n.map(Fr),...r.map(Ii)],l=new Set(o),c=e.filter(h=>l.has(h)),d=new Set(c),f=o.filter(h=>!d.has(h));return f.length===0&&c.length===e.length?e:[...c,...f]}function Lw(e){return e.subscribe((n,r)=>{if(n.openTabs===r.openTabs&&n.openAppTabs===r.openAppTabs)return;const o=gv(n.tabOrder,n.openTabs,n.openAppTabs);o!==n.tabOrder&&e.setState({tabOrder:o})})}function cm(e,n,r){const o=e.indexOf(n);return e.slice(o+1).find(r)??e.slice(0,Math.max(o,0)).reverse().find(r)??null}function qd(e,n){const r=d=>!n.has(d),o=Gd(e);let{activeSessionId:l,activeAppTabId:c}=e;if(o!==null&&n.has(o)){const d=cm(e.tabOrder,o,r),f=d===null?null:mr(d);c=(f==null?void 0:f.kind)==="app"?f.id:null,(f==null?void 0:f.kind)==="session"&&(l=f.id)}if(l!==null&&n.has(Fr(l))){const d=h=>r(h)&&mr(h).kind==="session",f=cm(e.tabOrder,Fr(l),d);l=f===null?null:mr(f).id}return{activeSessionId:l,activeAppTabId:c}}function vv(e,n){if(e.tabOrder.includes(n))return!1;const{kind:r,id:o}=mr(n);return(r==="app"?e.apps:e.sessions).some(c=>c.id===o)}const yv=1;function xv(){let e="";try{e=mn()}catch{}return`agentpane:tabs:${e||window.location.origin}`}function Vu(e){return Array.isArray(e)&&e.every(n=>typeof n=="string")}function um(e){return e===null||typeof e=="string"}function Ow(e){if(e==null)return null;let n;try{n=JSON.parse(e)}catch{return null}if(typeof n!="object"||n===null)return null;const r=n;return r.v!==yv||!Vu(r.openTabs)||!um(r.activeSessionId)||!Vu(r.openAppTabs)||!um(r.activeAppTabId)?null:{openTabs:r.openTabs,activeSessionId:r.activeSessionId,openAppTabs:r.openAppTabs,activeAppTabId:r.activeAppTabId,tabOrder:Vu(r.tabOrder)?r.tabOrder:[]}}const wv=[()=>window.sessionStorage,()=>window.localStorage];function $w(){const e=xv();for(const n of wv)try{const r=Ow(n().getItem(e));if(r)return r}catch{}return null}function Pw(e){const n=xv(),r=JSON.stringify({v:yv,openTabs:e.openTabs,activeSessionId:e.activeSessionId,openAppTabs:e.openAppTabs,activeAppTabId:e.activeAppTabId,tabOrder:e.tabOrder});for(const o of wv)try{o().setItem(n,r)}catch{}}function zw(e){return e.subscribe((n,r)=>{(n.openTabs!==r.openTabs||n.activeSessionId!==r.activeSessionId||n.openAppTabs!==r.openAppTabs||n.activeAppTabId!==r.activeAppTabId||n.tabOrder!==r.tabOrder)&&Pw(n)})}function Ci(e){return[...new Set(e)]}function Fw(e,n,r,o){const l=v=>r===null||r.has(v),c=Ci(((e==null?void 0:e.openTabs)??[]).filter(v=>n.has(v))),d=Ci(((e==null?void 0:e.openAppTabs)??[]).filter(l));let f=(e==null?void 0:e.activeSessionId)??null;f!==null&&!n.has(f)&&(f=null),f!==null&&!c.includes(f)&&c.push(f),f??(f=c.at(-1)??null);let h=(e==null?void 0:e.activeAppTabId)??null;h!==null&&!l(h)&&(h=null),h!==null&&!d.includes(h)&&d.push(h),o!==null&&n.has(o)&&(c.includes(o)||c.push(o),f=o,h=null);const m=gv(Ci((e==null?void 0:e.tabOrder)??[]),c,d);return{openTabs:c,activeSessionId:f,openAppTabs:d,activeAppTabId:h,tabOrder:m}}const Us=new Map,Xd=new Map,ql=new Map,Sl=new Set,Yd=new Map,Xl=new Map;function Uw(e,n,r=""){Us.set(e,n),Xd.set(e,r)}function Bw(e){Us.delete(e),Xd.delete(e)}function dl(e,n){ql.set(e,n)}function Ww(e,n){n?Sl.add(e):Sl.delete(e)}function dm(e,n,r){const o=ql.get(e);if(!o||Sl.has(o))return;const l=Us.get(o);l&&l({source:"agentpane-host",event:n,payload:r})}function fm(e,n){const r=ql.get(e);if(!r||Sl.has(r))return;const o=Us.get(r);o&&o({source:"agentpane-host",event:"background_tasks",payload:{sessionId:e,tasks:n}})}function Hw(e,n,r,o,l,c=null){if(typeof l=="string"&&l!==Xd.get(e))return;const d=Us.get(e);d&&d({source:"agentpane-host",event:"tool_call",payload:{callId:n,tool:r,name:r,args:o,caller:c}})}function Vw(e,n,r,o){const l=ql.get(e);if(!l)return;const c=Us.get(l);c&&c({source:"agentpane-host",event:"turn:delta",payload:{sessionId:e,turnId:n,itemId:r,delta:o}})}function Kw(e,n){Yd.set(e,n)}function Gw(e){Yd.delete(e)}function qw(e,n){Xl.set(e,n)}function Xw(e){Xl.delete(e)}function kv(e,n={}){const r=Xl.get(e);if(r){r(n);return}const o=Us.get(e);o&&o({source:"agentpane-host",event:"state_changed",payload:{}})}function Yw(){for(const e of new Set([...Us.keys(),...Xl.keys()]))kv(e)}function Qw(e){var r;const n=Us.get(e);n&&n({source:"agentpane-host",event:"source:updated",payload:{}}),(r=Yd.get(e))==null||r()}const Zw=(e,n)=>({wsConnected:!1,backgroundTasks:{},retryStates:{},signedOutTurns:{},setWsConnected:r=>e({wsConnected:r}),onTurnCreated:(r,o)=>{e(l=>{const c=l.sessionDetails[r];return!c||o.thread_id?{}:c.turns.some(d=>d.id===o.id)?{}:{sessionDetails:{...l.sessionDetails,[r]:{...c,turns:[...c.turns,{...o,items:[]}]}}}})},onTurnStarted:(r,o)=>{n().addLogEntry("DEBUG",`turn:started — ${o.slice(0,8)}`),e(l=>{const c=cr(l.sessions,r,()=>({is_running:1,status:"running"})),d=l.sessionDetails[r];if(!d)return{sessions:c};const f=d.turns.findIndex(h=>h.id===o);return{sessionDetails:{...l.sessionDetails,[r]:{...bn(d,o,h=>({...h,status:"running"})),is_running:1,status:"running"}},sessions:c,activeTurnIndex:l.activeSessionId===r&&f>=0?f:l.activeTurnIndex}})},onItemStarted:(r,o,l)=>{n().addLogEntry("DEBUG",`item:started — ${l.type}`),e(c=>{const d=pm(l)?lr(c.retryStates,o):c.retryStates,f=c.sessionDetails[r];return f?{sessionDetails:{...c.sessionDetails,[r]:bn(f,o,h=>Gu(h,l))},retryStates:d}:{retryStates:d}})},onItemUpdated:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:bn(d,o,f=>Gu(f,l))}}:{}})},onItemCompleted:(r,o,l)=>{if(n().addLogEntry("DEBUG",`item:completed — ${l.type}`),l.type==="background_task"&&(l.status==="completed"||l.status==="failed")){const c=l.data||{},d=c.task_type||"unknown",f=c.description||"background task",m=d==="local_agent"?"Subagent":d==="local_bash"?"Monitor":"Task";l.status==="completed"?n().addToast("success",`${m} completed: ${f}`):c.status!=="stopped"&&n().addToast("error",`${m} failed: ${f}`)}e(c=>{const d=pm(l)?lr(c.retryStates,o):c.retryStates,f=c.sessionDetails[r];return f?{retryStates:d,sessionDetails:{...c.sessionDetails,[r]:bn(f,o,h=>{var v,k;let m=Gu(h,l);if(l.type==="agent_message"&&((v=l.data)!=null&&v.text)&&(m={...m,agent_response:l.data.text}),l.type==="reasoning"&&((k=l.data)!=null&&k.text)){const x=m.thoughts?m.thoughts+`
44
+ `+l.data.text:l.data.text;m={...m,thoughts:x}}return m})}}:{retryStates:d}})},onItemDelta:(r,o,l,c,d)=>{Vw(r,o,l,c),e(f=>{const h=lr(f.retryStates,o),m=f.sessionDetails[r];return m?{sessionDetails:{...f.sessionDetails,[r]:bn(m,o,v=>nk(v,l,c,d))},retryStates:h}:{retryStates:h}})},onItemText:(r,o,l,c)=>{e(d=>{const f=d.sessionDetails[r];if(!f)return{};const h=bn(f,o,m=>m.status==="running"?uv(m,l,c):m);return{sessionDetails:{...d.sessionDetails,[r]:h}}})},onWidgetDelta:(r,o,l,c,d)=>{e(f=>{const h=lr(f.retryStates,o),m=f.sessionDetails[r];return m?{sessionDetails:{...f.sessionDetails,[r]:bn(m,o,v=>tk(v,l,c,d))},retryStates:h}:{retryStates:h}})},onTurnCompleted:(r,o,l,c,d)=>{n().dropSignedOutTurn(o);const f=(l==null?void 0:l.input_tokens)??0,h=(l==null?void 0:l.output_tokens)??0;n().addLogEntry("INFO",`turn:completed — ${f} in / ${h} out`),dm(r,"turn:completed",{sessionId:r,turnId:o,response:d??null}),n().refreshApps(),e(m=>{const v=m.sessionDetails[r],k=v?bn(v,o,E=>({...E,status:"completed",token_usage:l??E.token_usage??null,...d&&!E.agent_response?{agent_response:d}:{}})):null,x=Ku(k),S=x&&k?el(k):"active",C=cr(m.sessions,r,E=>({is_running:x,status:S,has_unreviewed:c?1:E.has_unreviewed})),T=lr(m.retryStates,o);return k?{sessionDetails:{...m.sessionDetails,[r]:{...k,is_running:x,status:S,has_unreviewed:c?1:k.has_unreviewed}},sessions:C,retryStates:T}:{sessions:C,retryStates:T}})},onTokenUsageUpdated:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:bn(d,o,f=>({...f,token_usage:l}))}}:{}})},onContextUsageUpdated:(r,o)=>{e(l=>{const c=l.sessionDetails[r];return c?{sessionDetails:{...l.sessionDetails,[r]:{...c,contextUsage:o}}}:{}})},onTurnFailed:(r,o,l,c)=>{n().dropSignedOutTurn(o),n().addLogEntry("ERROR",`turn:failed — ${l}`),n().addToast("error",`Turn failed — ${l}`),dm(r,"turn:failed",{sessionId:r,turnId:o,error:l}),e(d=>{const f=d.sessionDetails[r],h=l.includes("cancelled")||l.includes("aborted"),m=h?"aborted":"failed",v=f?bn(f,o,T=>({...T,status:m,error:l,...c?{resume_state:c}:{},items:T.items.map(E=>E.status==="in_progress"?{...E,status:"failed"}:E)})):null,k=Ku(v),x=k&&v?el(v):h?"active":"failed",S=cr(d.sessions,r,()=>({is_running:k,status:x})),C=lr(d.retryStates,o);return v?{sessionDetails:{...d.sessionDetails,[r]:{...v,is_running:k,status:x}},sessions:S,retryStates:C}:{sessions:S,retryStates:C}})},onTurnCancelled:(r,o)=>{n().dropSignedOutTurn(o),e(l=>{const c=l.sessionDetails[r],d=c?bn(c,o,k=>({...k,status:"aborted",...k.resume_state==="waiting"||k.resume_state==="resuming"?{resume_state:"cancelled"}:{},items:k.items.map(x=>x.status==="in_progress"?{...x,status:"completed"}:x)})):null,f=Ku(d),h=f&&d?el(d):"active",m=cr(l.sessions,r,()=>({is_running:f,status:h})),v=lr(l.retryStates,o);return d?{sessionDetails:{...l.sessionDetails,[r]:{...d,is_running:f,status:h}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnInterrupted:(r,o,l)=>{n().addLogEntry("WARN",`turn:interrupted — ${l.reason}${l.detail?` (${l.detail})`:""}`),n().addToast("warn",Jw(l.reason)),l.reason==="auth"?e(c=>({signedOutTurns:{...c.signedOutTurns,[o]:r}})):n().dropSignedOutTurn(o),e(c=>{const d=c.sessionDetails[r],f=d?bn(d,o,k=>({...k,status:"pending",error:null,resume_state:"waiting",interrupt_reason:l.reason,interrupted_at:l.interruptedAt,resume_attempts:l.attempts,resume_at:l.resumeAt??null})):null,h=f?el(f):"interrupted",m=cr(c.sessions,r,()=>({is_running:1,status:h})),v=lr(c.retryStates,o);return f?{sessionDetails:{...c.sessionDetails,[r]:{...f,is_running:1,status:h}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnResuming:(r,o,l)=>{n().dropSignedOutTurn(o),n().addLogEntry("INFO",`turn:resuming — ${o.slice(0,8)} (attempt ${l})`),e(c=>{const d=cr(c.sessions,r,()=>({is_running:1,status:"running"})),f=c.sessionDetails[r];return f?{sessionDetails:{...c.sessionDetails,[r]:{...bn(f,o,h=>({...h,status:"running",error:null,resume_state:"resuming",resume_attempts:l})),is_running:1,status:"running"}},sessions:d}:{sessions:d}})},onTurnResumed:(r,o)=>{n().addLogEntry("INFO",`turn:resumed — ${o.slice(0,8)}`),n().addToast("success","Interrupted turn resumed"),e(l=>{const c=l.sessionDetails[r];return c?{sessionDetails:{...l.sessionDetails,[r]:bn(c,o,d=>({...d,resume_state:"resumed"}))}}:{}})},onTurnRetrying:(r,o,l)=>{n().addLogEntry("WARN",`turn:retrying — ${r.slice(0,8)}/${o.slice(0,8)} attempt ${l.attempt}/${l.maxRetries} (${l.errorStatus??"no response"}${l.error?`, ${l.error}`:""})`),e(c=>({retryStates:{...c.retryStates,[o]:l}}))},onSessionTitle:(r,o)=>{e(l=>({sessions:l.sessions.map(c=>c.id===r?{...c,title:o}:c),sessionDetails:l.sessionDetails[r]?{...l.sessionDetails,[r]:{...l.sessionDetails[r],title:o}}:l.sessionDetails}))},onSessionTouched:r=>{e(o=>{const l=o.sessionDetails[r];return{sessions:cr(o.sessions,r,()=>({user_touched:1})),sessionDetails:l?{...o.sessionDetails,[r]:{...l,user_touched:1}}:o.sessionDetails}})},onSessionUpdated:r=>{const o={...r};delete o.is_running,delete o.status,e(l=>{const c=l.sessionDetails[r.id];return{sessions:cr(l.sessions,r.id,()=>o),sessionDetails:c?{...l.sessionDetails,[r.id]:{...c,...o}}:l.sessionDetails}})},onBackgroundTasksChanged:(r,o)=>{fm(r,o),e(l=>{if(o.length===0&&!l.backgroundTasks[r])return{};const c={...l.backgroundTasks};return o.length>0?c[r]=o:delete c[r],{backgroundTasks:c}})},onSignedOutTurnsSnapshot:r=>e({signedOutTurns:Object.fromEntries(r.map(o=>[o.turnId,o.sessionId]))}),dropSignedOutTurn:r=>{if(!(r in n().signedOutTurns))return;const o={...n().signedOutTurns};delete o[r],e({signedOutTurns:o})},onBackgroundTasksSnapshot:r=>{for(const[l,c]of Object.entries(r))fm(l,c);const o={};for(const[l,c]of Object.entries(r))c.length>0&&(o[l]=c);e({backgroundTasks:o})}});function Jw(e){switch(e){case"network":return"Network error — the turn will resume when the connection is back";case"process_exit":return"The agent process stopped — resuming the turn";case"auth":return"Claude is signed out — the turn waits until you sign in again";case"usage_limit":return"Usage limit reached — the turn waits until it is over";default:return"The agent host restarted — resuming the turn"}}function el(e){const n=[...e.turns,...(e.threads??[]).flatMap(r=>r.turns??[])].filter(Fs);return n.length>0&&n.every(r=>r.status==="pending"&&r.resume_state==="waiting")?"interrupted":"running"}function pm(e){return e.type!=="background_task"&&e.type!=="error"&&e.type!=="interruption"}function lr(e,n){if(!(n in e))return e;const r={...e};return delete r[n],r}function Ku(e){return e&&(e.turns.some(Fs)||(e.threads??[]).some(r=>(r.turns??[]).some(Fs)))?1:0}function cr(e,n,r){return e.some(o=>o.id===n)?e.map(o=>o.id===n?{...o,...r(o)}:o):e}function bn(e,n,r){const o=(e.threads??[]).map(l=>(l.turns??[]).some(c=>c.id===n)?{...l,turns:(l.turns??[]).map(c=>c.id===n?r(c):c)}:l);return{...e,turns:e.turns.map(l=>l.id===n?r(l):l),threads:o}}function Qd(e,n){for(let r=e.length-1;r>=0;r--)if(e[r].external_item_id===n)return r;return-1}function Gu(e,n){const r=Qd(e.items,n.external_item_id);if(r>=0){const c=[...e.items];return c[r]=n,{...e,items:c}}if(n.type==="agent_message"){const c=e.items.filter(d=>!(d.type==="agent_message"&&d.id.startsWith("delta-")));return{...e,items:[...c,n]}}const o=e.items;let l=o.length;if(e.deferred_item_count)for(;l>0&&o[l-1].created_at>n.created_at;)l--;return{...e,items:[...o.slice(0,l),n,...o.slice(l)]}}function ek(e,n){const r=c=>c.external_item_id??c.id,o=new Map(e.items.map(c=>[r(c),c])),l=n.map(c=>{var f;const d=o.get(r(c));return o.delete(r(c)),d&&((f=d.data)==null?void 0:f.partial)!==!0&&d.updated_at>c.updated_at?d:c});return{...e,items:[...l,...o.values()],deferred_item_count:0,deferred_tool_calls:0}}function tk(e,n,r,o){var f;const l=new Date().toISOString(),c=Qd(e.items,n);if(c>=0){const h=e.items[c];if(((f=h.data)==null?void 0:f.partial)!==!0||h.data.title===r&&h.data.html===o)return e;const m=[...e.items];return m[c]={...h,data:{...h.data,title:r,html:o},updated_at:l},{...e,items:m}}const d={id:`delta-${n}`,turn_id:e.id,external_item_id:n,type:"widget",data:{title:r,html:o,error:null,partial:!0},status:"in_progress",created_at:l,updated_at:l};return{...e,items:[...e.items,d]}}function nk(e,n,r,o){var d;const l=Qd(e.items,n);if(l>=0){const f=e.items[l],h=((d=f.data)==null?void 0:d.text)??"",m=o??h+r,v=[...e.items];return v[l]={...f,data:{...f.data,text:m}},{...e,items:v,agent_response:m}}const c={id:`delta-${n}`,turn_id:e.id,external_item_id:n,type:"agent_message",data:{text:o??r},status:"in_progress",created_at:new Date().toISOString(),updated_at:new Date().toISOString()};return{...e,items:[...e.items,c],agent_response:o??r}}function sk(){const e=new URLSearchParams(window.location.search);return{session:e.get("session"),thread:e.get("thread")}}function rk(){const e=new URL(window.location.href);!e.searchParams.has("session")&&!e.searchParams.has("thread")||(e.searchParams.delete("session"),e.searchParams.delete("thread"),window.history.replaceState(window.history.state,"",e))}let qu=0;function hm(e){return e==="sidecar"?"sidecar":"turns"}async function ok(e,n){const r=await Promise.allSettled(e.map(c=>n(c))),o=new Map;let l=null;return r.forEach((c,d)=>{var f;c.status==="fulfilled"?o.set(e[d],c.value):l===null&&(l=((f=c.reason)==null?void 0:f.message)??"Request failed")}),{updated:o,firstError:l}}function ik(e,n){const r={...e.sessionDetails};n.forEach(h=>delete r[h]);const o={...e.backgroundTasks};n.forEach(h=>delete o[h]);const l=Object.fromEntries(Object.entries(e.signedOutTurns).filter(([,h])=>!n.has(h))),c=e.openTabs.filter(h=>!n.has(h)),d=qd(e,new Set([...n].map(Fr)));let f=e.activeTurnIndex;if(d.activeSessionId!==e.activeSessionId){const h=d.activeSessionId?r[d.activeSessionId]:null;f=h&&h.turns.length>0?h.turns.length-1:0}return{sessions:e.sessions.filter(h=>!n.has(h.id)),sessionDetails:r,backgroundTasks:o,signedOutTurns:l,openTabs:c,...d,activeTurnIndex:f}}function ak(e){const n={...e};return delete n.turns,delete n.threads,delete n.contextUsage,n}function mm(e,n,r){const o=n().activeSessionId;e(c=>ik(c,r));const l=n().activeSessionId;l&&l!==o&&n().selectSession(l,{keepAppView:!0})}async function gm(e,n,r,o,l){if(r.length===0)return;e({error:null});const{updated:c,firstError:d}=await ok(r,o);c.size>0&&e(h=>({sessions:h.sessions.map(m=>c.get(m.id)??m)}));const f=r.length-c.size;if(f===0)n().addToast("info",`${r.length} session${r.length===1?"":"s"} ${l}`);else{e({error:d});const h=l[0].toUpperCase()+l.slice(1);n().addToast(f===r.length?"error":"warn",`${h} ${c.size} of ${r.length} — ${f} failed`)}}const Xu=new Map,lk=(e,n)=>({sessions:[],sessionDetails:{},activeSessionId:null,openTabs:[],activeTurnIndex:0,submittingPrompt:null,quotedText:null,init:async()=>{const r=sk(),o=$w();try{const l=localStorage.getItem("agentpane:last-model-config");l&&e({lastModelConfig:JSON.parse(l)})}catch{}e({loading:!0,error:null});try{const l=n().loadApps(),[c,d,f]=await Promise.all([mw(),fv(),hv()]);e({sessions:c,workspaces:d,folders:f,loading:!1}),rk();const h=await l,m=Fw(o,new Set(c.map(v=>v.id)),h?new Set(n().apps.map(v=>v.id)):null,r.session);e(v=>{const k=v.activeSessionId!==null||v.activeAppTabId!==null;return{openTabs:Ci([...m.openTabs,...v.openTabs]),openAppTabs:Ci([...m.openAppTabs,...v.openAppTabs]),tabOrder:m.tabOrder,activeAppTabId:k?v.activeAppTabId:m.activeAppTabId}}),m.activeSessionId&&!n().activeSessionId&&await n().selectSession(m.activeSessionId,{keepAppView:!0}),r.thread&&(e({deepLinkThreadId:r.thread}),n().switchRightTab("threads"))}catch(l){e({loading:!1,error:l.message})}},selectSession:async(r,o)=>{const l=++qu,c=o!=null&&o.keepAppView?{}:{activeAppTabId:null},d=f=>f.includes(r)?f:[...f,r];if(n().sessionDetails[r]){const f=n().sessionDetails[r];e({activeSessionId:r,activeTurnIndex:f.turns.length>0?f.turns.length-1:0,activeRightTab:hm(n().activeRightTab),...c,openTabs:d(n().openTabs)}),f.has_unreviewed===1&&(im(r).catch(()=>{}),e(h=>({sessions:h.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...h.sessionDetails,[r]:{...f,has_unreviewed:0}}})));return}e({loading:!0,error:null});try{const f=await vi(r);if(l!==qu){e(h=>({sessionDetails:{...h.sessionDetails,[r]:f},openTabs:d(h.openTabs),loading:!1}));return}e(h=>({sessionDetails:{...h.sessionDetails,[r]:f},activeSessionId:r,activeTurnIndex:f.turns.length>0?f.turns.length-1:0,activeRightTab:hm(h.activeRightTab),...c,openTabs:d(h.openTabs),loading:!1})),f.has_unreviewed===1&&(im(r).catch(()=>{}),e(h=>({sessions:h.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...h.sessionDetails,[r]:{...f,has_unreviewed:0}}})))}catch(f){e(l===qu?{loading:!1,error:f.message}:{loading:!1})}},closeTab:r=>n().closeTabs([Fr(r)]),updateModelConfig:async(r,o,l)=>{const c=n().activeSessionId;if(c){e({error:null});try{const d=await bw(c,r,o,l),f={provider:d.runtime_type,model:d.model??"",reasoning:d.model_reasoning_effort??""};e({lastModelConfig:f}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(f)),e(h=>({sessions:h.sessions.map(m=>m.id===c?d:m),sessionDetails:h.sessionDetails[c]?{...h.sessionDetails,[c]:{...h.sessionDetails[c],model:d.model,model_reasoning_effort:d.model_reasoning_effort,external_thread_id:d.external_thread_id}}:h.sessionDetails})),await n().refreshActiveSession()}catch(d){e({error:d.message}),n().addToast("error",`Failed to update model — ${d.message}`)}}},createSession:async r=>{e({error:null});try{const o=await Kd(r);e(c=>({sessions:[o,...c.sessions],showNewSessionDialog:!1}));const l={provider:o.runtime_type,model:o.model??"",reasoning:o.model_reasoning_effort??""};e({lastModelConfig:l}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(l)),await n().selectSession(o.id),n().addLogEntry("INFO",`Session created — ${o.id.slice(0,8)}`),n().addToast("success",`Session created — ${o.title||o.id.slice(0,8)}`)}catch(o){e({error:o.message}),n().addToast("error",`Failed to create session — ${o.message}`)}},addSession:r=>{e(o=>({sessions:o.sessions.some(l=>l.id===r.id)?o.sessions:[r,...o.sessions]}))},revealSession:async r=>{let o=n().sessionDetails[r];if(!o){const l=await vi(r);e(c=>({sessionDetails:{...c.sessionDetails,[r]:l}})),o=l}n().sessions.some(l=>l.id===r)||n().addSession(ak(o)),await n().selectSession(r)},deleteSession:async r=>{var l;e({error:null});const o=(l=n().sessions.find(c=>c.id===r))==null?void 0:l.title;try{await sm(r),mm(e,n,new Set([r])),n().addLogEntry("INFO",`Session deleted — ${r.slice(0,8)}`),n().addToast("info",`Session "${o||r.slice(0,8)}" deleted`)}catch(c){e({error:c.message}),n().addToast("error",`Failed to delete session — ${c.message}`)}},renameSession:async(r,o)=>{e({error:null});try{const l=await kw(r,o.trim());e(c=>({sessions:c.sessions.map(d=>d.id===r?l:d),sessionDetails:c.sessionDetails[r]?{...c.sessionDetails,[r]:{...c.sessionDetails[r],title:l.title}}:c.sessionDetails}))}catch(l){e({error:l.message}),n().addToast("error",`Failed to rename session — ${l.message}`)}},markFinished:async r=>{e({error:null});try{const o=await rm(r);e(l=>({sessions:l.sessions.map(c=>c.id===r?o:c)})),n().addToast("info","Session marked as finished")}catch(o){e({error:o.message}),n().addToast("error",`Failed to mark as finished — ${o.message}`)}},markFinishedMany:async r=>{await gm(e,n,r,rm,"marked as finished")},toggleStar:async r=>{const o=n().sessions.find(l=>l.id===r);if(o){e({error:null});try{const l=await Sw(r,o.starred?0:1);e(c=>({sessions:c.sessions.map(d=>d.id===r?l:d),sessionDetails:c.sessionDetails[r]?{...c.sessionDetails,[r]:{...c.sessionDetails[r],starred:l.starred}}:c.sessionDetails}))}catch(l){e({error:l.message}),n().addToast("error",`Failed to star session — ${l.message}`)}}},reopenSession:async r=>{e({error:null});try{const o=await om(r);e(l=>({sessions:l.sessions.map(c=>c.id===r?o:c)})),n().addToast("info","Session reopened")}catch(o){e({error:o.message}),n().addToast("error",`Failed to reopen session — ${o.message}`)}},reopenSessionMany:async r=>{await gm(e,n,r,om,"reopened")},deleteSessionMany:async r=>{if(r.length===0)return;e({error:null});const o=await Promise.allSettled(r.map(d=>sm(d))),l=new Set;if(o.forEach((d,f)=>{d.status==="fulfilled"&&l.add(r[f])}),l.size===0){e({error:"Failed to delete sessions"}),n().addToast("error","Failed to delete sessions");return}mm(e,n,l),n().addLogEntry("INFO",`${l.size} session${l.size===1?"":"s"} deleted`);const c=r.length-l.size;c===0?n().addToast("info",`${l.size} session${l.size===1?"":"s"} deleted`):(e({error:"One or more sessions failed to delete"}),n().addToast("warn",`Deleted ${l.size} of ${r.length} — ${c} failed`))},submitPrompt:async(r,o)=>{const l=n().activeSessionId;if(l){e({error:null,submittingPrompt:r}),e(c=>{const d=c.sessionDetails[l];return d?{sessionDetails:{...c.sessionDetails,[l]:{...d,is_running:1,status:"running"}},sessions:c.sessions.map(f=>f.id===l?{...f,is_running:1,status:"running"}:f)}:{}});try{const c=await dv(l,r,o);n().addLogEntry("INFO",`Turn submitted — "${r.slice(0,40)}"`),e(d=>{const f=d.sessionDetails[l];if(!f)return{submittingPrompt:null};const h=f.turns.findIndex(v=>v.id===c.id);if(h>=0)return{submittingPrompt:null,activeTurnIndex:h};const m={...c,items:[]};return{submittingPrompt:null,sessionDetails:{...d.sessionDetails,[l]:{...f,turns:[...f.turns,m]}},activeTurnIndex:f.turns.length}})}catch(c){e({submittingPrompt:null,error:c.message}),n().addLogEntry("ERROR",`Turn failed — ${c.message}`),n().addToast("error",`Failed to send prompt — ${c.message}`),e(d=>{const f=d.sessionDetails[l];if(!f)return{};const h=Gl(f)?1:0;return{sessionDetails:{...d.sessionDetails,[l]:{...f,is_running:h,status:h?"running":"active"}},sessions:d.sessions.map(m=>m.id===l?{...m,is_running:h,status:h?"running":"active"}:m)}})}}},cancelTurn:async()=>{const r=n().activeSessionId;if(r)try{await vw(r)}catch(o){e({error:o.message})}},rewindToTurn:async(r,o)=>{e({error:null});try{const l=await Tw(r,o),c=await vi(r);e(d=>({sessionDetails:{...d.sessionDetails,[r]:c},sessions:d.sessions.map(f=>f.id===r?{...f,external_thread_id:l.external_thread_id,is_running:0,status:"active"}:f),activeTurnIndex:c.turns.length>0?c.turns.length-1:0})),n().addToast("info","Rewound to selected turn")}catch(l){e({error:l.message}),n().addToast("error",`Failed to rewind — ${l.message}`)}},restoreSession:async r=>{e({error:null});try{const o=await Cw(r),l=await vi(r);e(c=>({sessionDetails:{...c.sessionDetails,[r]:l},sessions:c.sessions.map(d=>d.id===r?{...d,external_thread_id:o.external_thread_id,is_running:0,status:"active"}:d),activeTurnIndex:l.turns.length>0?l.turns.length-1:0})),n().addToast("info","Restored rewound session")}catch(o){e({error:o.message}),n().addToast("error",`Failed to restore — ${o.message}`)}},branchFromTurn:async(r,o,l)=>{e({error:null});try{const c=await Ew(r,o,l);e(d=>({sessions:[c,...d.sessions]})),await n().selectSession(c.id),n().addToast("success","Branched from selected turn")}catch(c){e({error:c.message}),n().addToast("error",`Failed to branch — ${c.message}`)}},updateRuntimeConfig:async r=>{const o=n().activeSessionId;if(o){e({error:null});try{const l=await Nw(o,JSON.stringify(r));e(c=>({sessions:c.sessions.map(d=>d.id===o?l:d),sessionDetails:c.sessionDetails[o]?{...c.sessionDetails,[o]:{...c.sessionDetails[o],runtime_config:l.runtime_config}}:c.sessionDetails}))}catch(l){e({error:l.message}),n().addToast("error",`Failed to update config — ${l.message}`)}}},refreshActiveSession:async()=>{const r=n().activeSessionId;if(r)try{const o=await vi(r);e(l=>({sessionDetails:{...l.sessionDetails,[r]:o},activeTurnIndex:o.turns.length>0?Math.min(l.activeTurnIndex,o.turns.length-1):0,sessions:l.sessions.map(c=>c.id===r?{...c,is_running:o.is_running,status:o.status}:c)}))}catch(o){e({error:o.message})}},loadDeferredItems:(r,o)=>{const l=Xu.get(o);if(l)return l;const c=gw(r,o).then(({items:d})=>(e(f=>{const h=f.sessionDetails[r];return h?{sessionDetails:{...f.sessionDetails,[r]:bn(h,o,m=>ek(m,d))}}:{}}),!0)).catch(d=>(n().addToast("error",`Failed to load tool calls — ${d.message}`),!1)).finally(()=>Xu.delete(o));return Xu.set(o,c),c}});async function ck(e){const{sessions:n}=await kt(`/claude-sessions?workspace=${encodeURIComponent(e)}`);return n}function uk(e,n){return st(`/claude-sessions/${encodeURIComponent(e)}/import`,{workspace:n})}async function dk(e){const{sessions:n}=await kt(`/codex-sessions?workspace=${encodeURIComponent(e)}`);return n}function fk(e,n){return st(`/codex-sessions/${encodeURIComponent(e)}/import`,{workspace:n})}const yd=["claude","codex"],Yl={claude:"Claude Code",codex:"Codex"};function Yu(e){return`${e.runtime}:${e.id}`}function Sv(e){const n=e.length===1?"session":"sessions";return new Set(e).size===1?`${e.length} ${Yl[e[0]]} ${n}`:`${e.length} ${n}`}const pk={claude:e=>ck(e),codex:e=>dk(e)},hk={claude:(e,n)=>uk(e,n),codex:(e,n)=>fk(e,n)};async function bv(e){const n=await Promise.allSettled(yd.map(l=>pk[l](e))),r=[],o={};return n.forEach((l,c)=>{const d=yd[c];l.status==="fulfilled"?r.push(...l.value.map(f=>({...f,runtime:d}))):o[d]=hr(l.reason)}),r.sort((l,c)=>l.last_modified<c.last_modified?1:l.last_modified>c.last_modified?-1:0),{sessions:r,errors:o}}function mk(e,n){return hk[e.runtime](e.id,n)}const vm={available:!0,reason:null};let Qu=null;const gk=(e,n)=>({workspaces:[],pickerSupport:null,loadPickerSupport:()=>{const r=n().pickerSupport;return r?Promise.resolve(r):(Qu??(Qu=Rw().then(o=>typeof(o==null?void 0:o.available)!="boolean"?vm:(e({pickerSupport:o}),o)).catch(()=>vm).finally(()=>{Qu=null})),Qu)},createWorkspaceAt:async r=>{const o=await jw(r.trim());return e(l=>({workspaces:[...l.workspaces.filter(c=>c.id!==o.id),o]})),o},addWorkspace:async r=>{e({error:null});try{const o=await n().createWorkspaceAt(r);return n().addToast("success",`Workspace added — ${o.path}`),o}catch(o){return n().addToast("error",`Failed to add workspace — ${hr(o)}`),null}},removeWorkspace:async r=>{e({error:null});try{await _w(r);const o=await fv();e({workspaces:o}),n().addToast("info","Workspace hidden")}catch(o){n().addToast("error",`Failed to hide workspace — ${o.message}`)}},createSessionInWorkspace:async r=>{e({error:null});try{const o=n().lastModelConfig,l=await Kd({cwd:r,runtime_type:(o==null?void 0:o.provider)??"codex",model:o==null?void 0:o.model,model_reasoning_effort:o==null?void 0:o.reasoning});e(c=>({sessions:[l,...c.sessions]})),await n().selectSession(l.id),n().addLogEntry("INFO",`Session created in ${r} — ${l.id.slice(0,8)}`),n().addToast("success",`Session created in ${r.split("/").pop()||r}`)}catch(o){e({error:o.message}),n().addToast("error",`Failed to create session — ${o.message}`)}},pickAndAddWorkspace:async()=>{if(!(await n().loadPickerSupport()).available){n().setShowAddWorkspaceDialog(!0);return}try{const o=await pv();if(o.cancelled||!o.path)return;await n().addWorkspace(o.path)}catch(o){n().addToast("error",`Failed to pick directory — ${o.message}`)}},importSessions:async(r,o)=>{const l=[],c=[],d=[];for(const f of[...o].reverse())try{l.unshift(await mk(f,r)),c.unshift(f.runtime)}catch(h){d.unshift({...f,error:hr(h)})}if(l.length>0){e(h=>({sessions:[...l,...h.sessions]})),await n().selectSession(l[0].id);const f=Sv(c);n().addLogEntry("INFO",`Imported ${f} into ${r}`),n().addToast("success",l.length===1?`Imported — ${l[0].title||`${Yl[c[0]]} session`}`:`Imported ${f}`)}return{imported:l,failed:d}}});function Nv(e,n){const r=n?`?cwd=${encodeURIComponent(n)}`:"";return kt(`/providers/${encodeURIComponent(e)}/models${r}`)}const ym="curl -fsSL https://repoburg.com/install.sh | bash",vk=2e3,Tv="agentpane:daemon-seen";function yk(e=mn()){if(!e)return!1;try{const n=new URL(e);return n.protocol==="http:"&&(n.hostname==="localhost"||n.hostname==="127.0.0.1")}catch{return!1}}async function xk(e=mn()){try{return await fetch(`${e}/health`,{mode:"no-cors",cache:"no-store"}),!0}catch{return!1}}function wk(){try{return localStorage.getItem(Tv)==="true"}catch{return!1}}function kk(){try{localStorage.setItem(Tv,"true")}catch{}}function Sk(e){let n=!1,r=!1,o=!1,l=null;function c(){l!==null&&(clearTimeout(l),l=null)}async function d(){if(n||r)return;c(),r=!0;const m=await xk();if(r=!1,!n){if(m){kk(),h(),e.onReady();return}o||(o=!0,e.onMissing()),l=setTimeout(()=>void d(),vk)}}function f(){document.visibilityState==="visible"&&d()}function h(){n=!0,c(),window.removeEventListener("focus",f),document.removeEventListener("visibilitychange",f)}return window.addEventListener("focus",f),document.addEventListener("visibilitychange",f),d(),h}const xd=160,wd=480,bk=240,bl=220,Nk=300,Tk=600,Ck=36;function Nl(){return typeof window>"u"?Tk:Math.max(bl,Math.round(window.innerWidth*.7))}const xm="agentpane:sidebar-width",wm="agentpane:right-panel-width",Zu="agentpane:right-panel-collapsed";function km(e,n,r,o){try{const l=localStorage.getItem(e);if(l==null)return o;const c=Number(l);return Number.isFinite(c)?Math.min(r,Math.max(n,c)):o}catch{return o}}function Ek(e){try{return localStorage.getItem(e)==="true"}catch{return!1}}function Sm(e,n){try{localStorage.setItem(e,String(n))}catch{}}const bm=200,jk=(e,n)=>({activeRightTab:"turns",eventLog:[],loading:!1,error:null,showNewSessionDialog:!1,showAddWorkspaceDialog:!1,importSessionsWorkspace:null,showRemoteModal:!1,toasts:[],showCommandPalette:!1,lastModelConfig:null,models:[],modelsLoading:!1,showModelSelector:!1,sidebarWidth:km(xm,xd,wd,bk),rightPanelWidth:km(wm,bl,Nl(),Nk),rightPanelCollapsed:Ek(Zu),deepLinkThreadId:null,vscodeViewOpen:!1,vscodeState:"stopped",vscodeId:null,vscodeToken:null,usageViewOpen:!1,terminalViewOpen:!1,canGoBack:!1,canGoForward:!1,daemonStatus:yk()?"checking":"ready",setActiveTurnIndex:r=>e({activeTurnIndex:r}),switchRightTab:r=>{n().rightPanelCollapsed&&Sm(Zu,!1),e({activeRightTab:r,rightPanelCollapsed:!1})},setShowNewSessionDialog:r=>e({showNewSessionDialog:r}),setShowAddWorkspaceDialog:r=>e({showAddWorkspaceDialog:r}),setImportSessionsWorkspace:r=>e({importSessionsWorkspace:r}),setShowRemoteModal:r=>e({showRemoteModal:r}),setShowCommandPalette:r=>e({showCommandPalette:r}),setShowModelSelector:r=>e({showModelSelector:r}),setDeepLinkThreadId:r=>e({deepLinkThreadId:r}),setSidebarWidth:r=>{const o=Math.min(wd,Math.max(xd,Math.round(r)));e({sidebarWidth:o});try{localStorage.setItem(xm,String(o))}catch{}},setRightPanelWidth:r=>{const o=Math.min(Nl(),Math.max(bl,Math.round(r)));e({rightPanelWidth:o});try{localStorage.setItem(wm,String(o))}catch{}},setRightPanelCollapsed:r=>{e({rightPanelCollapsed:r}),Sm(Zu,r)},toggleRightPanel:()=>n().setRightPanelCollapsed(!n().rightPanelCollapsed),toggleVscodeView:()=>{if(n().vscodeViewOpen){e({vscodeViewOpen:!1});return}e({vscodeViewOpen:!0,terminalViewOpen:!1,vscodeState:"starting",vscodeId:null,vscodeToken:null})},setVscodeView:(r,o,l)=>e({vscodeState:r,vscodeId:o,vscodeToken:l}),toggleUsageView:()=>e({usageViewOpen:!n().usageViewOpen,terminalViewOpen:!1}),toggleTerminalView:()=>e(n().terminalViewOpen?{terminalViewOpen:!1}:{terminalViewOpen:!0,vscodeViewOpen:!1,usageViewOpen:!1}),setDaemonStatus:r=>e({daemonStatus:r}),addToast:(r,o,l,c)=>{const d=Math.random().toString(36).slice(2,9);e(f=>({toasts:[...f.toasts,{id:d,type:r,message:o,undoAction:l,undoLabel:c}]}))},removeToast:r=>{e(o=>({toasts:o.toasts.filter(l=>l.id!==r)}))},addLogEntry:(r,o)=>{const l=new Date().toLocaleTimeString("en-GB",{hour12:!1});e(c=>{const d=[...c.eventLog,{time:l,level:r,message:o}];return d.length>bm&&d.splice(0,d.length-bm),{eventLog:d}})},loadModels:async(r,o)=>{if(!n().modelsLoading){e({modelsLoading:!0,models:[]});try{const l=await Nv(r,o);e({models:l,modelsLoading:!1})}catch{e({modelsLoading:!1})}}}}),_k=(e,n)=>({createThread:async(r,o)=>{try{await st(`/sessions/${r}/threads`,o),n().addLogEntry("INFO",`Thread created — "${o.message.slice(0,40)}"`)}catch(l){n().addToast("error",`Failed to create thread — ${l.message}`)}},followupThread:async(r,o,l)=>{try{await st(`/sessions/${r}/threads/${o}/followup`,{message:l}),n().addLogEntry("INFO",`Thread follow-up — "${l.slice(0,40)}"`)}catch(c){n().addToast("error",`Failed to send follow-up — ${c.message}`)}},cancelThreadTurn:async(r,o)=>{try{await st(`/sessions/${r}/cancel?threadId=${encodeURIComponent(o)}`),n().addLogEntry("INFO","Thread turn cancelled")}catch(l){n().addToast("error",`Failed to cancel thread turn — ${l.message}`)}},resolveThread:async(r,o)=>{try{await fs(`/sessions/${r}/threads/${o}`,{status:"resolved"})}catch(l){n().addToast("error",`Failed to resolve thread — ${l.message}`)}},reopenThread:async(r,o)=>{try{await fs(`/sessions/${r}/threads/${o}`,{status:"open"})}catch(l){n().addToast("error",`Failed to reopen thread — ${l.message}`)}},shareThread:async(r,o,l)=>{try{const c=await st(`/sessions/${r}/threads/${o}/summarize`,{directives:l}),d=`
45
45
  [Shared from a resolved discussion thread — summary of its findings]
46
46
 
47
47
  \`\`\`QUOTE
48
48
  ${c.summary}
49
49
  \`\`\`
50
50
 
51
- `;return e({quotedText:d}),n().addLogEntry("INFO",`Thread shared to main session — "${c.summary.slice(0,40)}"`),n().addToast("success","Thread summary added to your input"),!0}catch(c){return n().addToast("error",`Failed to share thread — ${c.message}`),!1}},deleteThread:async(r,o)=>{try{await Vl(`/sessions/${r}/threads/${o}`)}catch(l){n().addToast("error",`Failed to delete thread — ${l.message}`)}},askSidecar:async(r,o)=>{try{return await st(`/sessions/${r}/sidecar`,{message:o}),n().addLogEntry("INFO",`Sidecar asked — "${o.slice(0,40)}"`),!0}catch(l){return n().addToast("error",`Failed to ask the sidecar — ${l.message}`),!1}},onThreadCreated:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:[...d.threads??[],{...o,turns:[{...l,items:[]}]}]}}}:{}})},onThreadFollowup:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:(d.threads??[]).map(f=>f.id===o?{...f,turns:[...f.turns??[],{...l,items:[]}]}:f)}}}:{}})},onThreadResolved:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];if(!d)return{};const f=(d.threads??[]).map(h=>h.id===o?{...h,status:l,resolved_at:l==="resolved"?new Date().toISOString():null}:h);return{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:f}}}})},onThreadDeleted:(r,o)=>{e(l=>{const c=l.sessionDetails[r];return c?{sessionDetails:{...l.sessionDetails,[r]:{...c,threads:(c.threads??[]).filter(d=>d.id!==o)}}}:{}})}}),_k=(e,n)=>({folders:[],loadFolders:async()=>{const r=await hv();e({folders:r})},createSidebarFolder:async(r,o)=>{try{const l=await Rw(r,o);return e(c=>({folders:[...c.folders,l]})),l}catch(l){return n().addToast("error",`Failed to create folder — ${l.message}`),null}},renameFolder:async(r,o)=>{try{const l=await lm(r,{name:o});e(c=>({folders:c.folders.map(d=>d.id===r?l:d)}))}catch(l){n().addToast("error",`Failed to rename folder — ${l.message}`)}},deleteFolder:async r=>{const o=n().folders,l=n().sessions;e(c=>({folders:c.folders.filter(d=>d.id!==r),sessions:c.sessions.map(d=>d.folder_id===r?{...d,folder_id:null}:d)}));try{await Aw(r)}catch(c){e({folders:o,sessions:l}),n().addToast("error",`Failed to delete folder — ${c.message}`)}},applyMoves:async r=>{if(r.length===0)return;const o=n().sessions,l=new Map(r.map(c=>[c.id,c]));e(c=>({sessions:c.sessions.map(d=>{const f=l.get(d.id);return f?{...d,folder_id:f.folder_id,sort_order:f.sort_order}:d})}));try{await Iw(r)}catch(c){e({sessions:o}),n().addToast("error",`Failed to save session order — ${c.message}`)}},reorderFolders:async r=>{const o=n().folders,l=new Map(r.map((c,d)=>[c,d]));e(c=>({folders:c.folders.map(d=>l.has(d.id)?{...d,sort_order:l.get(d.id)}:d)}));try{await Promise.all(r.map((c,d)=>lm(c,{sort_order:d})))}catch(c){e({folders:o}),n().addToast("error",`Failed to save folder order — ${c.message}`)}}});function Nm(){return kt("/apps")}function Rk(){return kt("/apps/root")}function Tm(e){return kt(`/apps/${e}/source`)}function Cm(e,n=""){return kt(`/apps/${e}/state?workspace=${encodeURIComponent(n)}`)}function Cv(e,n,r=""){return uw(`/apps/${e}/state?workspace=${encodeURIComponent(r)}`,n)}function Ak(e){return Vl(`/apps/${e}`)}function Ik(e){return kt(`/apps/${e}/sessions`)}async function Em(e,n){try{return await kt(`/apps/${e}/sessions/${encodeURIComponent(n)}`)}catch(r){if(r instanceof Ui&&r.status===404)return null;throw r}}function Dk(e,n,r={}){const o=new URLSearchParams({workspace:n});return r.lifecycle&&o.set("lifecycle",r.lifecycle),typeof r.running=="boolean"&&o.set("running",String(r.running)),kt(`/apps/${e}/workspace-sessions?${o}`)}async function Mk(e,n,r){try{return await kt(`/apps/${e}/workspace-sessions/${encodeURIComponent(r)}?workspace=${encodeURIComponent(n)}`)}catch(o){if(o instanceof Ui&&o.status===404)return null;throw o}}function Lk(e,n){return st(`/apps/${e}/sessions/${encodeURIComponent(n)}/cancel`)}function Ok(e,n,r){return ds(`/apps/${e}/sessions/${encodeURIComponent(n)}`,{lifecycle:r})}async function $k(e,n,r,o){const l=await st("/apps/mcp/call",{tool:`${e}__${r}`,args:o,workspace:n});if(!l.ok)throw new Error(l.error||`callTool: ${r} failed`);return l.result}function Pk(){return kt("/apps/examples")}function zk(e){return st(`/apps/examples/${e}/install`,{})}function Fk(e){return st("/apps",e)}function Uk(e,n){return st("/apps/import",{id:e,files:n})}function Bk(e,n,r){return st(`/apps/mcp/calls/${e}/result`,{result:n,error:null})}function Wk(e,n){return st(`/apps/${e}/edit-session`,n)}function Hk(e,n){return st(`/apps/${e}/files`,n)}async function Vk(e,n){const r=await fetch(`${mn()}/api/apps/${e}/files/${encodeURIComponent(n)}/meta`);if(r.status===404)return null;if(!r.ok)throw new Error(`GET /apps/${e}/files/${n}/meta failed: ${r.status} ${r.statusText}`);return await r.json()}async function Kk(e,n){const r=await fetch(`${mn()}/api/apps/${e}/files/${encodeURIComponent(n)}`);if(!r.ok)throw new Error(`GET /apps/${e}/files/${n} failed: ${r.status} ${r.statusText}`);return r.blob()}const fl=new Set;async function Zu(e,n){fl.add(n),await e().loadApps();const r=e().apps.find(o=>o.id===n);e().openAppTab(n),e().addToast("success",`Mini app added: ${(r==null?void 0:r.title)??n}`)}const wd="agentpane:app-workspaces";function Gk(){try{const e=JSON.parse(localStorage.getItem(wd)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}const qk=(e,n)=>({apps:[],appsRootPath:null,openAppTabs:[],activeAppTabId:null,appCatalogOpen:!1,appWorkspaces:Gk(),loadApps:async()=>{try{const[r,o]=await Promise.all([Nm(),Rk().catch(()=>null)]);return r.forEach(l=>fl.add(l.id)),e(o?{apps:r,appsRootPath:o.root}:{apps:r}),!0}catch{return!1}},refreshApps:async()=>{try{const r=await Nm();for(const o of r)fl.has(o.id)||(fl.add(o.id),n().addToast("success",`New mini app discovered: ${o.title}`));e({apps:r})}catch{}},openAppTab:r=>{e(o=>({activeAppTabId:r,openAppTabs:o.openAppTabs.includes(r)?o.openAppTabs:[...o.openAppTabs,r]}))},closeAppTab:r=>n().closeTabs([Ii(r)]),setActiveAppTab:r=>e({activeAppTabId:r}),openAppCatalog:()=>e({appCatalogOpen:!0}),closeAppCatalog:()=>e({appCatalogOpen:!1}),setAppWorkspace:(r,o)=>{e(l=>{const c={...l.appWorkspaces,[r]:o};try{localStorage.setItem(wd,JSON.stringify(c))}catch{}return{appWorkspaces:c}})},installExampleApp:async r=>{try{return await zk(r),await Zu(n,r),!0}catch(o){return n().addToast("error",`Failed to install app — ${o.message}`),!1}},createSkeletonApp:async r=>{try{return await Fk(r),await Zu(n,r.id),!0}catch(o){return n().addToast("error",`Failed to create app — ${o.message}`),!1}},importAppFolder:async(r,o)=>{try{return await Uk(r,o),await Zu(n,r),!0}catch(l){return n().addToast("error",`Failed to import app — ${l.message}`),!1}},startAppEdit:async r=>{try{const o=n().lastModelConfig,l=await Wk(r,{runtime_type:o==null?void 0:o.provider,model:(o==null?void 0:o.model)??null,model_reasoning_effort:(o==null?void 0:o.reasoning)??null});n().sessions.some(c=>c.id===l.id)||e(c=>({sessions:[l,...c.sessions]})),await n().selectSession(l.id),n().addLogEntry("INFO",`App edit session opened for ${r}`)}catch(o){n().addToast("error",`Failed to open app edit session — ${o.message}`)}},toggleAppPin:async r=>{const o=n().apps.find(l=>l.id===r);if(o)try{await Cv(r,{pinned:!o.pinned}),await n().loadApps()}catch(l){n().addToast("error",`Failed to pin app — ${l.message}`)}},deleteApp:async r=>{try{await Ak(r);const o=n().activeSessionId;e(c=>{const d={...c.appWorkspaces};delete d[r];try{localStorage.setItem(wd,JSON.stringify(d))}catch{}return{apps:c.apps.filter(f=>f.id!==r),openAppTabs:c.openAppTabs.filter(f=>f!==r),...qd(c,new Set([Ii(r)])),appWorkspaces:d}});const l=n().activeSessionId;l&&l!==o&&n().selectSession(l,{keepAppView:!0}),n().addToast("success",`Mini app deleted: ${r}`)}catch(o){n().addToast("error",`Failed to delete app — ${o.message}`)}}}),Xk=(e,n)=>({tabOrder:[],closedTabs:[],moveTab:(r,o)=>{const l=[...n().tabOrder],c=l.indexOf(r),d=l.indexOf(o);c===-1||d===-1||c===d||(l.splice(d,0,...l.splice(c,1)),e({tabOrder:l}))},closeTabs:r=>{const o=n(),l=new Set(r.filter(h=>o.tabOrder.includes(h)));if(l.size===0)return;const c=qd(o,l),d=o.tabOrder.map((h,m)=>({key:h,index:m})).filter(h=>l.has(h.key)).reverse();e({...c,openTabs:o.openTabs.filter(h=>!l.has(Fr(h))),openAppTabs:o.openAppTabs.filter(h=>!l.has(Ii(h))),tabOrder:o.tabOrder.filter(h=>!l.has(h)),closedTabs:[...o.closedTabs,...d].slice(-20)});const f=c.activeSessionId;f!==null&&f!==o.activeSessionId&&n().selectSession(f,{keepAppView:!0})},reopenClosedTab:()=>{const r=n(),o=[...r.closedTabs];let l=o.pop();for(;l&&!vv(r,l.key);)l=o.pop();if(!l){e({closedTabs:[]});return}const c=[...r.tabOrder];c.splice(l.index,0,l.key);const{kind:d,id:f}=mr(l.key);d==="app"?(e({closedTabs:o,tabOrder:c,openAppTabs:[...r.openAppTabs,f]}),n().openAppTab(f)):(e({closedTabs:o,tabOrder:c,openTabs:[...r.openTabs,f]}),n().selectSession(f))}}),jm=3e3,Vn={lagMs:100,longtaskBufferMs:50,longtaskLogMs:100,eventBufferMs:50,eventLogMs:100,keypressMs:100,wsPerSecLog:15,storePerSecLog:15,renderPerSecLog:6,frameGapMs:150},Kn=[];let Nl=0,Zd=0,Tl=0,Jd=0,Cl=0,ef=0,tf=0;const Di=new Map,Mi=new Map;let Eo=new Map,To=0,jo=new Map,Ju=!1;function El(e,n,r){if(Kn.push({t:Date.now(),cat:e,msg:n,ms:r}),Kn.length>jm){const o=Kn.length-jm;Kn.splice(0,o),Dn=Math.max(0,Dn-o)}}function Co(e,n,r){El(e,n,r),console.log(`[perf:${e}] ${n}`)}function Ev(e){Co("note",e)}function jv(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function Yk(e,n){let r=Eo.get(e);r||Eo.set(e,r={n:0,bytes:0}),r.n++,r.bytes+=n;let o=Di.get(e);o||Di.set(e,o={n:0,bytes:0}),o.n++,o.bytes+=n}function Qk(){To++,tf++}function Zk(e){jo.set(e,(jo.get(e)??0)+1),Mi.set(e,(Mi.get(e)??0)+1)}let pl=0;function Jk(){pl=performance.now()}function e1(){const e=performance.now(),n=pl?e-pl:null;pl=0,requestAnimationFrame(()=>{if(n===null)return;const r=performance.now()-e+n;r>Vn.keypressMs&&Co("input",`keystroke→paint ${Math.round(r)}ms (keydown→change ${Math.round(n)}ms, change→paint ${Math.round(performance.now()-e)}ms)`)})}const t1=5e3,_v=500,_m=2e3;let Dn=0,ed=!1;function n1(e){return st("/perf-log",{entries:e}).then(()=>{Dn+=e.length})}function s1(){if(ed||Dn>=Kn.length)return;const e=Kn.slice(Dn,Dn+_v);e.length!==0&&(ed=!0,n1(e).catch(()=>{Kn.length-Dn>_m&&(Dn=Math.max(Dn,Kn.length-_m))}).finally(()=>{ed=!1}))}function Rm(){if(typeof navigator>"u"||typeof navigator.sendBeacon!="function"||Dn>=Kn.length)return;const e=Kn.slice(Dn,Dn+_v);if(e.length!==0)try{const n=new Blob([JSON.stringify({entries:e})],{type:"application/json"});navigator.sendBeacon(`${mn()}/api/perf-log`,n),Dn+=e.length}catch{}}function r1(){let e=0;for(const o of Eo.values())e+=o.n;const n=[];if(e>0){const o=[...Eo.entries()].sort((l,c)=>c[1].n-l[1].n).map(([l,c])=>`${l}×${c.n}(${jv(c.bytes)})`).join(", ");n.push(`ws ${e}/s [${o}]`)}To>0&&n.push(`store ${To}/s`);const r=[...jo.entries()].sort((o,l)=>l[1]-o[1]).map(([o,l])=>`${o}×${l}`);if(r.length>0&&n.push(`renders ${r.join(" ")}`),n.length>0){const o=n.join(" · ");El("stat",o);const l=[...jo.values()].some(c=>c>Vn.renderPerSecLog);(e>Vn.wsPerSecLog||To>Vn.storePerSecLog||l)&&console.log(`[perf:stat] ${o}`)}Eo=new Map,To=0,jo=new Map}function o1(e){if(e instanceof Element){const n=e.id?`#${e.id}`:"",r=typeof e.className=="string"&&e.className?`.${e.className.trim().split(/\s+/)[0]}`:"";return`${e.tagName.toLowerCase()}${n}${r}`}return e?"window":"unknown"}function i1(){if(Ju||typeof window>"u")return()=>{};Ju=!0,Nl=Date.now();const e=[];let n=performance.now()+250;const r=window.setInterval(()=>{const c=performance.now(),d=c-n;n=c+250,d>Vn.lagMs&&(Zd++,Tl=Math.max(Tl,d),Co("lag",`event loop blocked ${Math.round(d)}ms`))},250);if(e.push(()=>window.clearInterval(r)),typeof window.requestAnimationFrame=="function"){let c=performance.now(),d=0;const f=h=>{const m=h-c;c=h,m>Vn.frameGapMs&&Co("lag",`frame gap ${Math.round(m)}ms`),d=window.requestAnimationFrame(f)};d=window.requestAnimationFrame(f),e.push(()=>window.cancelAnimationFrame(d))}if(typeof PerformanceObserver<"u"){try{const c=new PerformanceObserver(d=>{var f;for(const h of d.getEntries()){const m=h.duration;if(m<Vn.longtaskBufferMs)continue;Jd++,Cl=Math.max(Cl,m);const v=(f=h.attribution)==null?void 0:f[0],k=(v==null?void 0:v.containerName)||(v==null?void 0:v.name)||"unknown",x=`long task ${Math.round(m)}ms (${k})`;m>=Vn.longtaskLogMs?Co("longtask",x,m):El("longtask",x,m)}});c.observe({type:"longtask",buffered:!1}),e.push(()=>c.disconnect())}catch{}try{const c=new PerformanceObserver(d=>{for(const f of d.getEntries()){const h=f.duration,m=f.processingStart-f.startTime;ef++;const v=`${f.name} ${Math.round(h)}ms (input delay ${Math.round(m)}ms) on ${o1(f.target)}`;h>=Vn.eventLogMs?Co("input",v,h):El("input",v,h)}});c.observe({type:"event",durationThreshold:Vn.eventBufferMs}),e.push(()=>c.disconnect())}catch{}}const o=window.setInterval(r1,1e3);e.push(()=>window.clearInterval(o)),Ev("perf logger session started");const l=window.setInterval(s1,t1);return e.push(()=>window.clearInterval(l)),window.addEventListener("beforeunload",Rm),e.push(()=>window.removeEventListener("beforeunload",Rm)),window.__agentPanePerf={dump:Rv,reset:Av},()=>{e.forEach(c=>c()),Ju=!1}}function Rv(){const e=[],n=Nl?Math.round((Date.now()-Nl)/1e3):0;if(e.push("=== agent-pane perf report ==="),e.push(`uptime ${n}s · ${Kn.length} buffered entries`),e.push(`event-loop lag: ${Zd} blocks >${Vn.lagMs}ms (max ${Math.round(Tl)}ms)`),e.push(`long tasks: ${Jd} ≥${Vn.longtaskBufferMs}ms (max ${Math.round(Cl)}ms)`),e.push(`slow input events (≥${Vn.eventBufferMs}ms): ${ef}`),e.push(`store updates: ${tf} total`),Di.size>0){e.push("ws messages by type (top 15):");for(const[r,o]of[...Di.entries()].sort((l,c)=>c[1].n-l[1].n).slice(0,15))e.push(` ${r}: ${o.n} msgs, ${jv(o.bytes)}`)}if(Mi.size>0){e.push("render counts by component:");for(const[r,o]of[...Mi.entries()].sort((l,c)=>c[1]-l[1]))e.push(` ${r}: ${o}`)}e.push("--- last 200 entries ---");for(const r of Kn.slice(-200))e.push(`${new Date(r.t).toISOString().slice(11,23)} [${r.cat}] ${r.msg}`);return e.join(`
52
- `)}function Av(){Kn.length=0,Dn=0,Nl=Date.now(),Zd=0,Tl=0,Jd=0,Cl=0,ef=0,tf=0,Di.clear(),Mi.clear(),Eo=new Map,To=0,jo=new Map}const Lt={start:i1,note:Ev,trackWsEvent:Yk,trackStoreUpdate:Qk,trackRender:Zk,markKeystroke:Jk,markInputChange:e1,dump:Rv,reset:Av},A=ew()((...e)=>({...ak(...e),...mk(...e),...Qw(...e),...Ek(...e),...jk(...e),..._k(...e),...qk(...e),...Xk(...e)}));typeof window<"u"&&(A.subscribe(()=>Lt.trackStoreUpdate()),Mw(A),Pw(A));const a1="modulepreload",l1=function(e){return"/"+e},Am={},c1=function(n,r,o){let l=Promise.resolve();if(r&&r.length>0){let d=function(m){return Promise.all(m.map(v=>Promise.resolve(v).then(k=>({status:"fulfilled",value:k}),k=>({status:"rejected",reason:k}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),h=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=d(r.map(m=>{if(m=l1(m),m in Am)return;Am[m]=!0;const v=m.endsWith(".css"),k=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${k}`))return;const x=document.createElement("link");if(x.rel=v?"stylesheet":a1,v||(x.as="script"),x.crossOrigin="",x.href=m,h&&x.setAttribute("nonce",h),document.head.appendChild(x),v)return new Promise((S,C)=>{x.addEventListener("load",S),x.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(d){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=d,window.dispatchEvent(f),!f.defaultPrevented)throw d}return l.then(d=>{for(const f of d||[])f.status==="rejected"&&c(f.reason);return n().catch(c)})};function kd(e){switch(e){case"claude":return{iconClass:"ic-claude",iconText:"CL"};case"codex":return{iconClass:"ic-codex",iconText:"CX"};case"repoburg":return{iconClass:"ic-repoburg",iconText:"RB"};case"cursor":return{iconClass:"ic-cursor",iconText:"CR"};default:return{iconClass:"ic-codex",iconText:"CX"}}}function u1(e,n,r=!1,o="working",l=0){if(o==="finished")return"";if(e==="interrupted")return"interrupted";if(n)return"running";if(l>0)return"background";if(r&&e!=="failed")return"queued";switch(e){case"failed":return"error";case"aborted":return"paused";default:return"paused"}}function d1(e,n,r=!1,o="working",l=0){if(o==="finished")return"Finished";if(e==="interrupted")return"Interrupted";if(n)return"Running";if(l>0)return"Background";if(r&&e!=="failed")return"Review Pending";switch(e){case"failed":return"Failed";case"aborted":return"Aborted";case"active":return"Idle";case"completed":return"Completed";case"running":return"Running";default:return e}}function Yl(e,n=0){const r=e.is_running===1,o=e.lifecycle==="finished",l=kd(e.runtime_type),c=u1(e.status,r,e.has_unreviewed===1,e.lifecycle,n),d=d1(e.status,r,e.has_unreviewed===1,e.lifecycle,n);return{dot:c,label:d,dotTitle:c==="background"?`${n} background task${n===1?"":"s"} running`:d,iconClass:l.iconClass,iconText:l.iconText,isRunning:r,isFinished:o,backgroundTaskCount:n}}function Wi(e,n,r=!0){y.useEffect(()=>{if(!r)return;function o(l){e.current&&!e.current.contains(l.target)&&n()}return document.addEventListener("mousedown",o),document.addEventListener("touchstart",o),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("touchstart",o)}},[e,n,r])}function Io(e,n=!0){y.useEffect(()=>{if(!n)return;function r(o){o.key==="Escape"&&e()}return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,n])}function nf({status:e,size:n=6,title:r}){return a.jsx("span",{className:`status-dot ${e}`,style:n!==6?{width:n,height:n}:void 0,title:r})}function sf({iconClass:e,iconText:n,size:r=20}){return a.jsx("span",{className:`runtime-icon ${e}`,style:r!==20?{width:r,height:r,fontSize:r*.45}:void 0,children:n})}/**
51
+ `;return e({quotedText:d}),n().addLogEntry("INFO",`Thread shared to main session — "${c.summary.slice(0,40)}"`),n().addToast("success","Thread summary added to your input"),!0}catch(c){return n().addToast("error",`Failed to share thread — ${c.message}`),!1}},deleteThread:async(r,o)=>{try{await Kl(`/sessions/${r}/threads/${o}`)}catch(l){n().addToast("error",`Failed to delete thread — ${l.message}`)}},askSidecar:async(r,o)=>{try{return await st(`/sessions/${r}/sidecar`,{message:o}),n().addLogEntry("INFO",`Sidecar asked — "${o.slice(0,40)}"`),!0}catch(l){return n().addToast("error",`Failed to ask the sidecar — ${l.message}`),!1}},onThreadCreated:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:[...d.threads??[],{...o,turns:[{...l,items:[]}]}]}}}:{}})},onThreadFollowup:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:(d.threads??[]).map(f=>f.id===o?{...f,turns:[...f.turns??[],{...l,items:[]}]}:f)}}}:{}})},onThreadResolved:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];if(!d)return{};const f=(d.threads??[]).map(h=>h.id===o?{...h,status:l,resolved_at:l==="resolved"?new Date().toISOString():null}:h);return{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:f}}}})},onThreadDeleted:(r,o)=>{e(l=>{const c=l.sessionDetails[r];return c?{sessionDetails:{...l.sessionDetails,[r]:{...c,threads:(c.threads??[]).filter(d=>d.id!==o)}}}:{}})}}),Rk=(e,n)=>({folders:[],loadFolders:async()=>{const r=await hv();e({folders:r})},createSidebarFolder:async(r,o)=>{try{const l=await Aw(r,o);return e(c=>({folders:[...c.folders,l]})),l}catch(l){return n().addToast("error",`Failed to create folder — ${l.message}`),null}},renameFolder:async(r,o)=>{try{const l=await lm(r,{name:o});e(c=>({folders:c.folders.map(d=>d.id===r?l:d)}))}catch(l){n().addToast("error",`Failed to rename folder — ${l.message}`)}},deleteFolder:async r=>{const o=n().folders,l=n().sessions;e(c=>({folders:c.folders.filter(d=>d.id!==r),sessions:c.sessions.map(d=>d.folder_id===r?{...d,folder_id:null}:d)}));try{await Iw(r)}catch(c){e({folders:o,sessions:l}),n().addToast("error",`Failed to delete folder — ${c.message}`)}},applyMoves:async r=>{if(r.length===0)return;const o=n().sessions,l=new Map(r.map(c=>[c.id,c]));e(c=>({sessions:c.sessions.map(d=>{const f=l.get(d.id);return f?{...d,folder_id:f.folder_id,sort_order:f.sort_order}:d})}));try{await Dw(r)}catch(c){e({sessions:o}),n().addToast("error",`Failed to save session order — ${c.message}`)}},reorderFolders:async r=>{const o=n().folders,l=new Map(r.map((c,d)=>[c,d]));e(c=>({folders:c.folders.map(d=>l.has(d.id)?{...d,sort_order:l.get(d.id)}:d)}));try{await Promise.all(r.map((c,d)=>lm(c,{sort_order:d})))}catch(c){e({folders:o}),n().addToast("error",`Failed to save folder order — ${c.message}`)}}});function Nm(){return kt("/apps")}function Ak(){return kt("/apps/root")}function Tm(e){return kt(`/apps/${e}/source`)}function Cm(e,n=""){return kt(`/apps/${e}/state?workspace=${encodeURIComponent(n)}`)}function Cv(e,n,r=""){return uw(`/apps/${e}/state?workspace=${encodeURIComponent(r)}`,n)}function Ik(e){return Kl(`/apps/${e}`)}function Dk(e){return kt(`/apps/${e}/sessions`)}async function Em(e,n){try{return await kt(`/apps/${e}/sessions/${encodeURIComponent(n)}`)}catch(r){if(r instanceof Ui&&r.status===404)return null;throw r}}function Mk(e,n,r={}){const o=new URLSearchParams({workspace:n});return r.lifecycle&&o.set("lifecycle",r.lifecycle),typeof r.running=="boolean"&&o.set("running",String(r.running)),kt(`/apps/${e}/workspace-sessions?${o}`)}async function Lk(e,n,r){try{return await kt(`/apps/${e}/workspace-sessions/${encodeURIComponent(r)}?workspace=${encodeURIComponent(n)}`)}catch(o){if(o instanceof Ui&&o.status===404)return null;throw o}}function Ok(e,n){return st(`/apps/${e}/sessions/${encodeURIComponent(n)}/cancel`)}function $k(e,n,r){return fs(`/apps/${e}/sessions/${encodeURIComponent(n)}`,{lifecycle:r})}async function Pk(e,n,r,o){const l=await st("/apps/mcp/call",{tool:`${e}__${r}`,args:o,workspace:n});if(!l.ok)throw new Error(l.error||`callTool: ${r} failed`);return l.result}function zk(){return kt("/apps/examples")}function Fk(e){return st(`/apps/examples/${e}/install`,{})}function Uk(e){return st("/apps",e)}function Bk(e,n){return st("/apps/import",{id:e,files:n})}function Wk(e,n,r){return st(`/apps/mcp/calls/${e}/result`,{result:n,error:null})}function Hk(e,n){return st(`/apps/${e}/edit-session`,n)}function Vk(e,n){return st(`/apps/${e}/files`,n)}async function Kk(e,n){const r=await fetch(`${mn()}/api/apps/${e}/files/${encodeURIComponent(n)}/meta`);if(r.status===404)return null;if(!r.ok)throw new Error(`GET /apps/${e}/files/${n}/meta failed: ${r.status} ${r.statusText}`);return await r.json()}async function Gk(e,n){const r=await fetch(`${mn()}/api/apps/${e}/files/${encodeURIComponent(n)}`);if(!r.ok)throw new Error(`GET /apps/${e}/files/${n} failed: ${r.status} ${r.statusText}`);return r.blob()}const fl=new Set;async function Ju(e,n){fl.add(n),await e().loadApps();const r=e().apps.find(o=>o.id===n);e().openAppTab(n),e().addToast("success",`Mini app added: ${(r==null?void 0:r.title)??n}`)}const kd="agentpane:app-workspaces";function qk(){try{const e=JSON.parse(localStorage.getItem(kd)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}const Xk=(e,n)=>({apps:[],appsRootPath:null,openAppTabs:[],activeAppTabId:null,appCatalogOpen:!1,appWorkspaces:qk(),loadApps:async()=>{try{const[r,o]=await Promise.all([Nm(),Ak().catch(()=>null)]);return r.forEach(l=>fl.add(l.id)),e(o?{apps:r,appsRootPath:o.root}:{apps:r}),!0}catch{return!1}},refreshApps:async()=>{try{const r=await Nm();for(const o of r)fl.has(o.id)||(fl.add(o.id),n().addToast("success",`New mini app discovered: ${o.title}`));e({apps:r})}catch{}},openAppTab:r=>{e(o=>({activeAppTabId:r,openAppTabs:o.openAppTabs.includes(r)?o.openAppTabs:[...o.openAppTabs,r]}))},closeAppTab:r=>n().closeTabs([Ii(r)]),setActiveAppTab:r=>e({activeAppTabId:r}),openAppCatalog:()=>e({appCatalogOpen:!0}),closeAppCatalog:()=>e({appCatalogOpen:!1}),setAppWorkspace:(r,o)=>{e(l=>{const c={...l.appWorkspaces,[r]:o};try{localStorage.setItem(kd,JSON.stringify(c))}catch{}return{appWorkspaces:c}})},installExampleApp:async r=>{try{return await Fk(r),await Ju(n,r),!0}catch(o){return n().addToast("error",`Failed to install app — ${o.message}`),!1}},createSkeletonApp:async r=>{try{return await Uk(r),await Ju(n,r.id),!0}catch(o){return n().addToast("error",`Failed to create app — ${o.message}`),!1}},importAppFolder:async(r,o)=>{try{return await Bk(r,o),await Ju(n,r),!0}catch(l){return n().addToast("error",`Failed to import app — ${l.message}`),!1}},startAppEdit:async r=>{try{const o=n().lastModelConfig,l=await Hk(r,{runtime_type:o==null?void 0:o.provider,model:(o==null?void 0:o.model)??null,model_reasoning_effort:(o==null?void 0:o.reasoning)??null});n().sessions.some(c=>c.id===l.id)||e(c=>({sessions:[l,...c.sessions]})),await n().selectSession(l.id),n().addLogEntry("INFO",`App edit session opened for ${r}`)}catch(o){n().addToast("error",`Failed to open app edit session — ${o.message}`)}},toggleAppPin:async r=>{const o=n().apps.find(l=>l.id===r);if(o)try{await Cv(r,{pinned:!o.pinned}),await n().loadApps()}catch(l){n().addToast("error",`Failed to pin app — ${l.message}`)}},deleteApp:async r=>{try{await Ik(r);const o=n().activeSessionId;e(c=>{const d={...c.appWorkspaces};delete d[r];try{localStorage.setItem(kd,JSON.stringify(d))}catch{}return{apps:c.apps.filter(f=>f.id!==r),openAppTabs:c.openAppTabs.filter(f=>f!==r),...qd(c,new Set([Ii(r)])),appWorkspaces:d}});const l=n().activeSessionId;l&&l!==o&&n().selectSession(l,{keepAppView:!0}),n().addToast("success",`Mini app deleted: ${r}`)}catch(o){n().addToast("error",`Failed to delete app — ${o.message}`)}}}),Yk=(e,n)=>({tabOrder:[],closedTabs:[],moveTab:(r,o)=>{const l=[...n().tabOrder],c=l.indexOf(r),d=l.indexOf(o);c===-1||d===-1||c===d||(l.splice(d,0,...l.splice(c,1)),e({tabOrder:l}))},closeTabs:r=>{const o=n(),l=new Set(r.filter(h=>o.tabOrder.includes(h)));if(l.size===0)return;const c=qd(o,l),d=o.tabOrder.map((h,m)=>({key:h,index:m})).filter(h=>l.has(h.key)).reverse();e({...c,openTabs:o.openTabs.filter(h=>!l.has(Fr(h))),openAppTabs:o.openAppTabs.filter(h=>!l.has(Ii(h))),tabOrder:o.tabOrder.filter(h=>!l.has(h)),closedTabs:[...o.closedTabs,...d].slice(-20)});const f=c.activeSessionId;f!==null&&f!==o.activeSessionId&&n().selectSession(f,{keepAppView:!0})},reopenClosedTab:()=>{const r=n(),o=[...r.closedTabs];let l=o.pop();for(;l&&!vv(r,l.key);)l=o.pop();if(!l){e({closedTabs:[]});return}const c=[...r.tabOrder];c.splice(l.index,0,l.key);const{kind:d,id:f}=mr(l.key);d==="app"?(e({closedTabs:o,tabOrder:c,openAppTabs:[...r.openAppTabs,f]}),n().openAppTab(f)):(e({closedTabs:o,tabOrder:c,openTabs:[...r.openTabs,f]}),n().selectSession(f))}}),jm=3e3,Vn={lagMs:100,longtaskBufferMs:50,longtaskLogMs:100,eventBufferMs:50,eventLogMs:100,keypressMs:100,wsPerSecLog:15,storePerSecLog:15,renderPerSecLog:6,frameGapMs:150},Kn=[];let Tl=0,Zd=0,Cl=0,Jd=0,El=0,ef=0,tf=0;const Di=new Map,Mi=new Map;let Eo=new Map,To=0,jo=new Map,ed=!1;function jl(e,n,r){if(Kn.push({t:Date.now(),cat:e,msg:n,ms:r}),Kn.length>jm){const o=Kn.length-jm;Kn.splice(0,o),Dn=Math.max(0,Dn-o)}}function Co(e,n,r){jl(e,n,r),console.log(`[perf:${e}] ${n}`)}function Ev(e){Co("note",e)}function jv(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function Qk(e,n){let r=Eo.get(e);r||Eo.set(e,r={n:0,bytes:0}),r.n++,r.bytes+=n;let o=Di.get(e);o||Di.set(e,o={n:0,bytes:0}),o.n++,o.bytes+=n}function Zk(){To++,tf++}function Jk(e){jo.set(e,(jo.get(e)??0)+1),Mi.set(e,(Mi.get(e)??0)+1)}let pl=0;function e1(){pl=performance.now()}function t1(){const e=performance.now(),n=pl?e-pl:null;pl=0,requestAnimationFrame(()=>{if(n===null)return;const r=performance.now()-e+n;r>Vn.keypressMs&&Co("input",`keystroke→paint ${Math.round(r)}ms (keydown→change ${Math.round(n)}ms, change→paint ${Math.round(performance.now()-e)}ms)`)})}const n1=5e3,_v=500,_m=2e3;let Dn=0,td=!1;function s1(e){return st("/perf-log",{entries:e}).then(()=>{Dn+=e.length})}function r1(){if(td||Dn>=Kn.length)return;const e=Kn.slice(Dn,Dn+_v);e.length!==0&&(td=!0,s1(e).catch(()=>{Kn.length-Dn>_m&&(Dn=Math.max(Dn,Kn.length-_m))}).finally(()=>{td=!1}))}function Rm(){if(typeof navigator>"u"||typeof navigator.sendBeacon!="function"||Dn>=Kn.length)return;const e=Kn.slice(Dn,Dn+_v);if(e.length!==0)try{const n=new Blob([JSON.stringify({entries:e})],{type:"application/json"});navigator.sendBeacon(`${mn()}/api/perf-log`,n),Dn+=e.length}catch{}}function o1(){let e=0;for(const o of Eo.values())e+=o.n;const n=[];if(e>0){const o=[...Eo.entries()].sort((l,c)=>c[1].n-l[1].n).map(([l,c])=>`${l}×${c.n}(${jv(c.bytes)})`).join(", ");n.push(`ws ${e}/s [${o}]`)}To>0&&n.push(`store ${To}/s`);const r=[...jo.entries()].sort((o,l)=>l[1]-o[1]).map(([o,l])=>`${o}×${l}`);if(r.length>0&&n.push(`renders ${r.join(" ")}`),n.length>0){const o=n.join(" · ");jl("stat",o);const l=[...jo.values()].some(c=>c>Vn.renderPerSecLog);(e>Vn.wsPerSecLog||To>Vn.storePerSecLog||l)&&console.log(`[perf:stat] ${o}`)}Eo=new Map,To=0,jo=new Map}function i1(e){if(e instanceof Element){const n=e.id?`#${e.id}`:"",r=typeof e.className=="string"&&e.className?`.${e.className.trim().split(/\s+/)[0]}`:"";return`${e.tagName.toLowerCase()}${n}${r}`}return e?"window":"unknown"}function a1(){if(ed||typeof window>"u")return()=>{};ed=!0,Tl=Date.now();const e=[];let n=performance.now()+250;const r=window.setInterval(()=>{const c=performance.now(),d=c-n;n=c+250,d>Vn.lagMs&&(Zd++,Cl=Math.max(Cl,d),Co("lag",`event loop blocked ${Math.round(d)}ms`))},250);if(e.push(()=>window.clearInterval(r)),typeof window.requestAnimationFrame=="function"){let c=performance.now(),d=0;const f=h=>{const m=h-c;c=h,m>Vn.frameGapMs&&Co("lag",`frame gap ${Math.round(m)}ms`),d=window.requestAnimationFrame(f)};d=window.requestAnimationFrame(f),e.push(()=>window.cancelAnimationFrame(d))}if(typeof PerformanceObserver<"u"){try{const c=new PerformanceObserver(d=>{var f;for(const h of d.getEntries()){const m=h.duration;if(m<Vn.longtaskBufferMs)continue;Jd++,El=Math.max(El,m);const v=(f=h.attribution)==null?void 0:f[0],k=(v==null?void 0:v.containerName)||(v==null?void 0:v.name)||"unknown",x=`long task ${Math.round(m)}ms (${k})`;m>=Vn.longtaskLogMs?Co("longtask",x,m):jl("longtask",x,m)}});c.observe({type:"longtask",buffered:!1}),e.push(()=>c.disconnect())}catch{}try{const c=new PerformanceObserver(d=>{for(const f of d.getEntries()){const h=f.duration,m=f.processingStart-f.startTime;ef++;const v=`${f.name} ${Math.round(h)}ms (input delay ${Math.round(m)}ms) on ${i1(f.target)}`;h>=Vn.eventLogMs?Co("input",v,h):jl("input",v,h)}});c.observe({type:"event",durationThreshold:Vn.eventBufferMs}),e.push(()=>c.disconnect())}catch{}}const o=window.setInterval(o1,1e3);e.push(()=>window.clearInterval(o)),Ev("perf logger session started");const l=window.setInterval(r1,n1);return e.push(()=>window.clearInterval(l)),window.addEventListener("beforeunload",Rm),e.push(()=>window.removeEventListener("beforeunload",Rm)),window.__agentPanePerf={dump:Rv,reset:Av},()=>{e.forEach(c=>c()),ed=!1}}function Rv(){const e=[],n=Tl?Math.round((Date.now()-Tl)/1e3):0;if(e.push("=== agent-pane perf report ==="),e.push(`uptime ${n}s · ${Kn.length} buffered entries`),e.push(`event-loop lag: ${Zd} blocks >${Vn.lagMs}ms (max ${Math.round(Cl)}ms)`),e.push(`long tasks: ${Jd} ≥${Vn.longtaskBufferMs}ms (max ${Math.round(El)}ms)`),e.push(`slow input events (≥${Vn.eventBufferMs}ms): ${ef}`),e.push(`store updates: ${tf} total`),Di.size>0){e.push("ws messages by type (top 15):");for(const[r,o]of[...Di.entries()].sort((l,c)=>c[1].n-l[1].n).slice(0,15))e.push(` ${r}: ${o.n} msgs, ${jv(o.bytes)}`)}if(Mi.size>0){e.push("render counts by component:");for(const[r,o]of[...Mi.entries()].sort((l,c)=>c[1]-l[1]))e.push(` ${r}: ${o}`)}e.push("--- last 200 entries ---");for(const r of Kn.slice(-200))e.push(`${new Date(r.t).toISOString().slice(11,23)} [${r.cat}] ${r.msg}`);return e.join(`
52
+ `)}function Av(){Kn.length=0,Dn=0,Tl=Date.now(),Zd=0,Cl=0,Jd=0,El=0,ef=0,tf=0,Di.clear(),Mi.clear(),Eo=new Map,To=0,jo=new Map}const Lt={start:a1,note:Ev,trackWsEvent:Qk,trackStoreUpdate:Zk,trackRender:Jk,markKeystroke:e1,markInputChange:t1,dump:Rv,reset:Av},A=ew()((...e)=>({...lk(...e),...gk(...e),...Zw(...e),...jk(...e),..._k(...e),...Rk(...e),...Xk(...e),...Yk(...e)}));typeof window<"u"&&(A.subscribe(()=>Lt.trackStoreUpdate()),Lw(A),zw(A));const l1="modulepreload",c1=function(e){return"/"+e},Am={},u1=function(n,r,o){let l=Promise.resolve();if(r&&r.length>0){let d=function(m){return Promise.all(m.map(v=>Promise.resolve(v).then(k=>({status:"fulfilled",value:k}),k=>({status:"rejected",reason:k}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),h=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=d(r.map(m=>{if(m=c1(m),m in Am)return;Am[m]=!0;const v=m.endsWith(".css"),k=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${k}`))return;const x=document.createElement("link");if(x.rel=v?"stylesheet":l1,v||(x.as="script"),x.crossOrigin="",x.href=m,h&&x.setAttribute("nonce",h),document.head.appendChild(x),v)return new Promise((S,C)=>{x.addEventListener("load",S),x.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(d){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=d,window.dispatchEvent(f),!f.defaultPrevented)throw d}return l.then(d=>{for(const f of d||[])f.status==="rejected"&&c(f.reason);return n().catch(c)})};function Sd(e){switch(e){case"claude":return{iconClass:"ic-claude",iconText:"CL"};case"codex":return{iconClass:"ic-codex",iconText:"CX"};case"repoburg":return{iconClass:"ic-repoburg",iconText:"RB"};case"cursor":return{iconClass:"ic-cursor",iconText:"CR"};default:return{iconClass:"ic-codex",iconText:"CX"}}}function d1(e,n,r=!1,o="working",l=0){if(o==="finished")return"";if(e==="interrupted")return"interrupted";if(n)return"running";if(l>0)return"background";if(r&&e!=="failed")return"queued";switch(e){case"failed":return"error";case"aborted":return"paused";default:return"paused"}}function f1(e,n,r=!1,o="working",l=0){if(o==="finished")return"Finished";if(e==="interrupted")return"Interrupted";if(n)return"Running";if(l>0)return"Background";if(r&&e!=="failed")return"Review Pending";switch(e){case"failed":return"Failed";case"aborted":return"Aborted";case"active":return"Idle";case"completed":return"Completed";case"running":return"Running";default:return e}}function Ql(e,n=0){const r=e.is_running===1,o=e.lifecycle==="finished",l=Sd(e.runtime_type),c=d1(e.status,r,e.has_unreviewed===1,e.lifecycle,n),d=f1(e.status,r,e.has_unreviewed===1,e.lifecycle,n);return{dot:c,label:d,dotTitle:c==="background"?`${n} background task${n===1?"":"s"} running`:d,iconClass:l.iconClass,iconText:l.iconText,isRunning:r,isFinished:o,backgroundTaskCount:n}}function Wi(e,n,r=!0){y.useEffect(()=>{if(!r)return;function o(l){e.current&&!e.current.contains(l.target)&&n()}return document.addEventListener("mousedown",o),document.addEventListener("touchstart",o),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("touchstart",o)}},[e,n,r])}function Io(e,n=!0){y.useEffect(()=>{if(!n)return;function r(o){o.key==="Escape"&&e()}return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,n])}function nf({status:e,size:n=6,title:r}){return a.jsx("span",{className:`status-dot ${e}`,style:n!==6?{width:n,height:n}:void 0,title:r})}function sf({iconClass:e,iconText:n,size:r=20}){return a.jsx("span",{className:`runtime-icon ${e}`,style:r!==20?{width:r,height:r,fontSize:r*.45}:void 0,children:n})}/**
53
53
  * @license lucide-react v0.469.0 - ISC
54
54
  *
55
55
  * This source code is licensed under the ISC license.
56
56
  * See the LICENSE file in the root directory of this source tree.
57
- */const f1=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Iv=(...e)=>e.filter((n,r,o)=>!!n&&n.trim()!==""&&o.indexOf(n)===r).join(" ").trim();/**
57
+ */const p1=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Iv=(...e)=>e.filter((n,r,o)=>!!n&&n.trim()!==""&&o.indexOf(n)===r).join(" ").trim();/**
58
58
  * @license lucide-react v0.469.0 - ISC
59
59
  *
60
60
  * This source code is licensed under the ISC license.
61
61
  * See the LICENSE file in the root directory of this source tree.
62
- */var p1={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"};/**
62
+ */var h1={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"};/**
63
63
  * @license lucide-react v0.469.0 - ISC
64
64
  *
65
65
  * This source code is licensed under the ISC license.
66
66
  * See the LICENSE file in the root directory of this source tree.
67
- */const Dv=y.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:l="",children:c,iconNode:d,...f},h)=>y.createElement("svg",{ref:h,...p1,width:n,height:n,stroke:e,strokeWidth:o?Number(r)*24/Number(n):r,className:Iv("lucide",l),...f},[...d.map(([m,v])=>y.createElement(m,v)),...Array.isArray(c)?c:[c]]));/**
67
+ */const Dv=y.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:l="",children:c,iconNode:d,...f},h)=>y.createElement("svg",{ref:h,...h1,width:n,height:n,stroke:e,strokeWidth:o?Number(r)*24/Number(n):r,className:Iv("lucide",l),...f},[...d.map(([m,v])=>y.createElement(m,v)),...Array.isArray(c)?c:[c]]));/**
68
68
  * @license lucide-react v0.469.0 - ISC
69
69
  *
70
70
  * This source code is licensed under the ISC license.
71
71
  * See the LICENSE file in the root directory of this source tree.
72
- */const ye=(e,n)=>{const r=y.forwardRef(({className:o,...l},c)=>y.createElement(Dv,{ref:c,iconNode:n,className:Iv(`lucide-${f1(e)}`,o),...l}));return r.displayName=`${e}`,r};/**
72
+ */const ye=(e,n)=>{const r=y.forwardRef(({className:o,...l},c)=>y.createElement(Dv,{ref:c,iconNode:n,className:Iv(`lucide-${p1(e)}`,o),...l}));return r.displayName=`${e}`,r};/**
73
73
  * @license lucide-react v0.469.0 - ISC
74
74
  *
75
75
  * This source code is licensed under the ISC license.
76
76
  * See the LICENSE file in the root directory of this source tree.
77
- */const h1=ye("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
77
+ */const m1=ye("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
78
78
  * @license lucide-react v0.469.0 - ISC
79
79
  *
80
80
  * This source code is licensed under the ISC license.
81
81
  * See the LICENSE file in the root directory of this source tree.
82
- */const m1=ye("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
82
+ */const g1=ye("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
83
83
  * @license lucide-react v0.469.0 - ISC
84
84
  *
85
85
  * This source code is licensed under the ISC license.
@@ -89,7 +89,7 @@ ${c.summary}
89
89
  *
90
90
  * This source code is licensed under the ISC license.
91
91
  * See the LICENSE file in the root directory of this source tree.
92
- */const g1=ye("BotOff",[["path",{d:"M13.67 8H18a2 2 0 0 1 2 2v4.33",key:"7az073"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}],["path",{d:"M8 8H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 1.414-.586",key:"s09a7a"}],["path",{d:"M9 13v2",key:"rq6x2g"}],["path",{d:"M9.67 4H12v2.33",key:"110xot"}]]);/**
92
+ */const v1=ye("BotOff",[["path",{d:"M13.67 8H18a2 2 0 0 1 2 2v4.33",key:"7az073"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}],["path",{d:"M8 8H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 1.414-.586",key:"s09a7a"}],["path",{d:"M9 13v2",key:"rq6x2g"}],["path",{d:"M9.67 4H12v2.33",key:"110xot"}]]);/**
93
93
  * @license lucide-react v0.469.0 - ISC
94
94
  *
95
95
  * This source code is licensed under the ISC license.
@@ -99,7 +99,7 @@ ${c.summary}
99
99
  *
100
100
  * This source code is licensed under the ISC license.
101
101
  * See the LICENSE file in the root directory of this source tree.
102
- */const v1=ye("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"}]]);/**
102
+ */const y1=ye("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"}]]);/**
103
103
  * @license lucide-react v0.469.0 - ISC
104
104
  *
105
105
  * This source code is licensed under the ISC license.
@@ -119,32 +119,32 @@ ${c.summary}
119
119
  *
120
120
  * This source code is licensed under the ISC license.
121
121
  * See the LICENSE file in the root directory of this source tree.
122
- */const Ql=ye("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"}]]);/**
122
+ */const Zl=ye("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"}]]);/**
123
123
  * @license lucide-react v0.469.0 - ISC
124
124
  *
125
125
  * This source code is licensed under the ISC license.
126
126
  * See the LICENSE file in the root directory of this source tree.
127
- */const y1=ye("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
127
+ */const x1=ye("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
128
128
  * @license lucide-react v0.469.0 - ISC
129
129
  *
130
130
  * This source code is licensed under the ISC license.
131
131
  * See the LICENSE file in the root directory of this source tree.
132
- */const jl=ye("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
132
+ */const _l=ye("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
133
133
  * @license lucide-react v0.469.0 - ISC
134
134
  *
135
135
  * This source code is licensed under the ISC license.
136
136
  * See the LICENSE file in the root directory of this source tree.
137
- */const x1=ye("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"}]]);/**
137
+ */const w1=ye("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"}]]);/**
138
138
  * @license lucide-react v0.469.0 - ISC
139
139
  *
140
140
  * This source code is licensed under the ISC license.
141
141
  * See the LICENSE file in the root directory of this source tree.
142
- */const w1=ye("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
142
+ */const k1=ye("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
143
143
  * @license lucide-react v0.469.0 - ISC
144
144
  *
145
145
  * This source code is licensed under the ISC license.
146
146
  * See the LICENSE file in the root directory of this source tree.
147
- */const k1=ye("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
147
+ */const S1=ye("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
148
148
  * @license lucide-react v0.469.0 - ISC
149
149
  *
150
150
  * This source code is licensed under the ISC license.
@@ -164,7 +164,7 @@ ${c.summary}
164
164
  *
165
165
  * This source code is licensed under the ISC license.
166
166
  * See the LICENSE file in the root directory of this source tree.
167
- */const S1=ye("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
167
+ */const b1=ye("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
168
168
  * @license lucide-react v0.469.0 - ISC
169
169
  *
170
170
  * This source code is licensed under the ISC license.
@@ -174,7 +174,7 @@ ${c.summary}
174
174
  *
175
175
  * This source code is licensed under the ISC license.
176
176
  * See the LICENSE file in the root directory of this source tree.
177
- */const b1=ye("FilePlus",[["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:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/**
177
+ */const N1=ye("FilePlus",[["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:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/**
178
178
  * @license lucide-react v0.469.0 - ISC
179
179
  *
180
180
  * This source code is licensed under the ISC license.
@@ -184,22 +184,22 @@ ${c.summary}
184
184
  *
185
185
  * This source code is licensed under the ISC license.
186
186
  * See the LICENSE file in the root directory of this source tree.
187
- */const N1=ye("FolderGit2",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);/**
187
+ */const T1=ye("FolderGit2",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);/**
188
188
  * @license lucide-react v0.469.0 - ISC
189
189
  *
190
190
  * This source code is licensed under the ISC license.
191
191
  * See the LICENSE file in the root directory of this source tree.
192
- */const T1=ye("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
192
+ */const C1=ye("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
193
193
  * @license lucide-react v0.469.0 - ISC
194
194
  *
195
195
  * This source code is licensed under the ISC license.
196
196
  * See the LICENSE file in the root directory of this source tree.
197
- */const td=ye("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"}]]);/**
197
+ */const nd=ye("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"}]]);/**
198
198
  * @license lucide-react v0.469.0 - ISC
199
199
  *
200
200
  * This source code is licensed under the ISC license.
201
201
  * See the LICENSE file in the root directory of this source tree.
202
- */const _l=ye("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"}]]);/**
202
+ */const Rl=ye("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"}]]);/**
203
203
  * @license lucide-react v0.469.0 - ISC
204
204
  *
205
205
  * This source code is licensed under the ISC license.
@@ -219,17 +219,17 @@ ${c.summary}
219
219
  *
220
220
  * This source code is licensed under the ISC license.
221
221
  * See the LICENSE file in the root directory of this source tree.
222
- */const C1=ye("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
222
+ */const E1=ye("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
223
223
  * @license lucide-react v0.469.0 - ISC
224
224
  *
225
225
  * This source code is licensed under the ISC license.
226
226
  * See the LICENSE file in the root directory of this source tree.
227
- */const E1=ye("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
227
+ */const j1=ye("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
228
228
  * @license lucide-react v0.469.0 - ISC
229
229
  *
230
230
  * This source code is licensed under the ISC license.
231
231
  * See the LICENSE file in the root directory of this source tree.
232
- */const j1=ye("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/**
232
+ */const _1=ye("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/**
233
233
  * @license lucide-react v0.469.0 - ISC
234
234
  *
235
235
  * This source code is licensed under the ISC license.
@@ -239,22 +239,22 @@ ${c.summary}
239
239
  *
240
240
  * This source code is licensed under the ISC license.
241
241
  * See the LICENSE file in the root directory of this source tree.
242
- */const _1=ye("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
242
+ */const R1=ye("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
243
243
  * @license lucide-react v0.469.0 - ISC
244
244
  *
245
245
  * This source code is licensed under the ISC license.
246
246
  * See the LICENSE file in the root directory of this source tree.
247
- */const R1=ye("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
247
+ */const A1=ye("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
248
248
  * @license lucide-react v0.469.0 - ISC
249
249
  *
250
250
  * This source code is licensed under the ISC license.
251
251
  * See the LICENSE file in the root directory of this source tree.
252
- */const A1=ye("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"}]]);/**
252
+ */const I1=ye("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"}]]);/**
253
253
  * @license lucide-react v0.469.0 - ISC
254
254
  *
255
255
  * This source code is licensed under the ISC license.
256
256
  * See the LICENSE file in the root directory of this source tree.
257
- */const I1=ye("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
257
+ */const D1=ye("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
258
258
  * @license lucide-react v0.469.0 - ISC
259
259
  *
260
260
  * This source code is licensed under the ISC license.
@@ -264,12 +264,12 @@ ${c.summary}
264
264
  *
265
265
  * This source code is licensed under the ISC license.
266
266
  * See the LICENSE file in the root directory of this source tree.
267
- */const D1=ye("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
267
+ */const M1=ye("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
268
268
  * @license lucide-react v0.469.0 - ISC
269
269
  *
270
270
  * This source code is licensed under the ISC license.
271
271
  * See the LICENSE file in the root directory of this source tree.
272
- */const M1=ye("MessageSquarePlus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/**
272
+ */const L1=ye("MessageSquarePlus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/**
273
273
  * @license lucide-react v0.469.0 - ISC
274
274
  *
275
275
  * This source code is licensed under the ISC license.
@@ -284,7 +284,7 @@ ${c.summary}
284
284
  *
285
285
  * This source code is licensed under the ISC license.
286
286
  * See the LICENSE file in the root directory of this source tree.
287
- */const L1=ye("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"}]]);/**
287
+ */const O1=ye("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"}]]);/**
288
288
  * @license lucide-react v0.469.0 - ISC
289
289
  *
290
290
  * This source code is licensed under the ISC license.
@@ -294,27 +294,27 @@ ${c.summary}
294
294
  *
295
295
  * This source code is licensed under the ISC license.
296
296
  * See the LICENSE file in the root directory of this source tree.
297
- */const O1=ye("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/**
297
+ */const $1=ye("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/**
298
298
  * @license lucide-react v0.469.0 - ISC
299
299
  *
300
300
  * This source code is licensed under the ISC license.
301
301
  * See the LICENSE file in the root directory of this source tree.
302
- */const $1=ye("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);/**
302
+ */const P1=ye("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);/**
303
303
  * @license lucide-react v0.469.0 - ISC
304
304
  *
305
305
  * This source code is licensed under the ISC license.
306
306
  * See the LICENSE file in the root directory of this source tree.
307
- */const P1=ye("PanelRightOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);/**
307
+ */const z1=ye("PanelRightOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);/**
308
308
  * @license lucide-react v0.469.0 - ISC
309
309
  *
310
310
  * This source code is licensed under the ISC license.
311
311
  * See the LICENSE file in the root directory of this source tree.
312
- */const z1=ye("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
312
+ */const F1=ye("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
313
313
  * @license lucide-react v0.469.0 - ISC
314
314
  *
315
315
  * This source code is licensed under the ISC license.
316
316
  * See the LICENSE file in the root directory of this source tree.
317
- */const F1=ye("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/**
317
+ */const U1=ye("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/**
318
318
  * @license lucide-react v0.469.0 - ISC
319
319
  *
320
320
  * This source code is licensed under the ISC license.
@@ -324,12 +324,12 @@ ${c.summary}
324
324
  *
325
325
  * This source code is licensed under the ISC license.
326
326
  * See the LICENSE file in the root directory of this source tree.
327
- */const U1=ye("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
327
+ */const B1=ye("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
328
328
  * @license lucide-react v0.469.0 - ISC
329
329
  *
330
330
  * This source code is licensed under the ISC license.
331
331
  * See the LICENSE file in the root directory of this source tree.
332
- */const B1=ye("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
332
+ */const W1=ye("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
333
333
  * @license lucide-react v0.469.0 - ISC
334
334
  *
335
335
  * This source code is licensed under the ISC license.
@@ -349,7 +349,7 @@ ${c.summary}
349
349
  *
350
350
  * This source code is licensed under the ISC license.
351
351
  * See the LICENSE file in the root directory of this source tree.
352
- */const W1=ye("Rewind",[["polygon",{points:"11 19 2 12 11 5 11 19",key:"14yba5"}],["polygon",{points:"22 19 13 12 22 5 22 19",key:"1pi1cj"}]]);/**
352
+ */const H1=ye("Rewind",[["polygon",{points:"11 19 2 12 11 5 11 19",key:"14yba5"}],["polygon",{points:"22 19 13 12 22 5 22 19",key:"1pi1cj"}]]);/**
353
353
  * @license lucide-react v0.469.0 - ISC
354
354
  *
355
355
  * This source code is licensed under the ISC license.
@@ -369,7 +369,7 @@ ${c.summary}
369
369
  *
370
370
  * This source code is licensed under the ISC license.
371
371
  * See the LICENSE file in the root directory of this source tree.
372
- */const H1=ye("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
372
+ */const V1=ye("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
373
373
  * @license lucide-react v0.469.0 - ISC
374
374
  *
375
375
  * This source code is licensed under the ISC license.
@@ -379,12 +379,12 @@ ${c.summary}
379
379
  *
380
380
  * This source code is licensed under the ISC license.
381
381
  * See the LICENSE file in the root directory of this source tree.
382
- */const V1=ye("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/**
382
+ */const K1=ye("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/**
383
383
  * @license lucide-react v0.469.0 - ISC
384
384
  *
385
385
  * This source code is licensed under the ISC license.
386
386
  * See the LICENSE file in the root directory of this source tree.
387
- */const K1=ye("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
387
+ */const G1=ye("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
388
388
  * @license lucide-react v0.469.0 - ISC
389
389
  *
390
390
  * This source code is licensed under the ISC license.
@@ -399,12 +399,12 @@ ${c.summary}
399
399
  *
400
400
  * This source code is licensed under the ISC license.
401
401
  * See the LICENSE file in the root directory of this source tree.
402
- */const Rl=ye("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
402
+ */const Al=ye("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
403
403
  * @license lucide-react v0.469.0 - ISC
404
404
  *
405
405
  * This source code is licensed under the ISC license.
406
406
  * See the LICENSE file in the root directory of this source tree.
407
- */const Zl=ye("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
407
+ */const Jl=ye("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
408
408
  * @license lucide-react v0.469.0 - ISC
409
409
  *
410
410
  * This source code is licensed under the ISC license.
@@ -414,22 +414,22 @@ ${c.summary}
414
414
  *
415
415
  * This source code is licensed under the ISC license.
416
416
  * See the LICENSE file in the root directory of this source tree.
417
- */const Jl=ye("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"}]]);/**
417
+ */const ec=ye("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"}]]);/**
418
418
  * @license lucide-react v0.469.0 - ISC
419
419
  *
420
420
  * This source code is licensed under the ISC license.
421
421
  * See the LICENSE file in the root directory of this source tree.
422
- */const G1=ye("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/**
422
+ */const q1=ye("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/**
423
423
  * @license lucide-react v0.469.0 - ISC
424
424
  *
425
425
  * This source code is licensed under the ISC license.
426
426
  * See the LICENSE file in the root directory of this source tree.
427
- */const q1=ye("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"}]]);/**
427
+ */const X1=ye("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"}]]);/**
428
428
  * @license lucide-react v0.469.0 - ISC
429
429
  *
430
430
  * This source code is licensed under the ISC license.
431
431
  * See the LICENSE file in the root directory of this source tree.
432
- */const X1=ye("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"}]]);/**
432
+ */const Y1=ye("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"}]]);/**
433
433
  * @license lucide-react v0.469.0 - ISC
434
434
  *
435
435
  * This source code is licensed under the ISC license.
@@ -439,7 +439,7 @@ ${c.summary}
439
439
  *
440
440
  * This source code is licensed under the ISC license.
441
441
  * See the LICENSE file in the root directory of this source tree.
442
- */const Y1=ye("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
442
+ */const Q1=ye("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
443
443
  * @license lucide-react v0.469.0 - ISC
444
444
  *
445
445
  * This source code is licensed under the ISC license.
@@ -449,15 +449,15 @@ ${c.summary}
449
449
  *
450
450
  * This source code is licensed under the ISC license.
451
451
  * See the LICENSE file in the root directory of this source tree.
452
- */const Q1=ye("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"}]]),Z1=new Set(["path","circle","rect","line","ellipse","polyline","polygon"]),J1=new Set("d cx cy r rx ry x y width height x1 x2 y1 y2 points fill".split(" "));function eS(e){return e.filter(([n])=>Z1.has(n)).map(([n,r],o)=>[n,{...Object.fromEntries(Object.entries(r).filter(([l])=>J1.has(l))),key:String(o)}])}function Do({iconNode:e,size:n=14,className:r}){const o=y.useMemo(()=>e?eS(e):[],[e]);return o.length===0?a.jsx(Uv,{size:n,className:r,"aria-hidden":"true","data-testid":"app-icon-default"}):a.jsx(Dv,{iconNode:o,size:n,className:r,"aria-hidden":"true","data-testid":"app-icon"})}var Ni=nv();function tS(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return y.useMemo(()=>o=>{n.forEach(l=>l(o))},n)}const ec=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Mo(e){const n=Object.prototype.toString.call(e);return n==="[object Window]"||n==="[object global]"}function rf(e){return"nodeType"in e}function Cn(e){var n,r;return e?Mo(e)?e:rf(e)&&(n=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?n:window:window}function of(e){const{Document:n}=Cn(e);return e instanceof n}function Vi(e){return Mo(e)?!1:e instanceof Cn(e).HTMLElement}function Xv(e){return e instanceof Cn(e).SVGElement}function Lo(e){return e?Mo(e)?e.document:rf(e)?of(e)?e:Vi(e)||Xv(e)?e.ownerDocument:document:document:document}const fs=ec?y.useLayoutEffect:y.useEffect;function tc(e){const n=y.useRef(e);return fs(()=>{n.current=e}),y.useCallback(function(){for(var r=arguments.length,o=new Array(r),l=0;l<r;l++)o[l]=arguments[l];return n.current==null?void 0:n.current(...o)},[])}function nS(){const e=y.useRef(null),n=y.useCallback((o,l)=>{e.current=setInterval(o,l)},[]),r=y.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[n,r]}function Pi(e,n){n===void 0&&(n=[e]);const r=y.useRef(e);return fs(()=>{r.current!==e&&(r.current=e)},n),r}function Ki(e,n){const r=y.useRef();return y.useMemo(()=>{const o=e(r.current);return r.current=o,o},[...n])}function Al(e){const n=tc(e),r=y.useRef(null),o=y.useCallback(l=>{l!==r.current&&(n==null||n(l,r.current)),r.current=l},[]);return[r,o]}function Il(e){const n=y.useRef();return y.useEffect(()=>{n.current=e},[e]),n.current}let nd={};function Gi(e,n){return y.useMemo(()=>{if(n)return n;const r=nd[e]==null?0:nd[e]+1;return nd[e]=r,e+"-"+r},[e,n])}function Yv(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];return o.reduce((c,d)=>{const f=Object.entries(d);for(const[h,m]of f){const v=c[h];v!=null&&(c[h]=v+e*m)}return c},{...n})}}const Ro=Yv(1),Dl=Yv(-1);function sS(e){return"clientX"in e&&"clientY"in e}function nc(e){if(!e)return!1;const{KeyboardEvent:n}=Cn(e.target);return n&&e instanceof n}function rS(e){if(!e)return!1;const{TouchEvent:n}=Cn(e.target);return n&&e instanceof n}function Ml(e){if(rS(e)){if(e.touches&&e.touches.length){const{clientX:n,clientY:r}=e.touches[0];return{x:n,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:n,clientY:r}=e.changedTouches[0];return{x:n,y:r}}}return sS(e)?{x:e.clientX,y:e.clientY}:null}const Es=Object.freeze({Translate:{toString(e){if(!e)return;const{x:n,y:r}=e;return"translate3d("+(n?Math.round(n):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:n,scaleY:r}=e;return"scaleX("+n+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Es.Translate.toString(e),Es.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:n,duration:r,easing:o}=e;return n+" "+r+"ms "+o}}}),Lm="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function oS(e){return e.matches(Lm)?e:e.querySelector(Lm)}const iS={display:"none"};function aS(e){let{id:n,value:r}=e;return ct.createElement("div",{id:n,style:iS},r)}function lS(e){let{id:n,announcement:r,ariaLiveType:o="assertive"}=e;const l={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 ct.createElement("div",{id:n,style:l,role:"status","aria-live":o,"aria-atomic":!0},r)}function cS(){const[e,n]=y.useState("");return{announce:y.useCallback(o=>{o!=null&&n(o)},[]),announcement:e}}const Qv=y.createContext(null);function uS(e){const n=y.useContext(Qv);y.useEffect(()=>{if(!n)throw new Error("useDndMonitor must be used within a children of <DndContext>");return n(e)},[e,n])}function dS(){const[e]=y.useState(()=>new Set),n=y.useCallback(o=>(e.add(o),()=>e.delete(o)),[e]);return[y.useCallback(o=>{let{type:l,event:c}=o;e.forEach(d=>{var f;return(f=d[l])==null?void 0:f.call(d,c)})},[e]),n]}const fS={draggable:`
452
+ */const Z1=ye("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"}]]),J1=new Set(["path","circle","rect","line","ellipse","polyline","polygon"]),eS=new Set("d cx cy r rx ry x y width height x1 x2 y1 y2 points fill".split(" "));function tS(e){return e.filter(([n])=>J1.has(n)).map(([n,r],o)=>[n,{...Object.fromEntries(Object.entries(r).filter(([l])=>eS.has(l))),key:String(o)}])}function Do({iconNode:e,size:n=14,className:r}){const o=y.useMemo(()=>e?tS(e):[],[e]);return o.length===0?a.jsx(Uv,{size:n,className:r,"aria-hidden":"true","data-testid":"app-icon-default"}):a.jsx(Dv,{iconNode:o,size:n,className:r,"aria-hidden":"true","data-testid":"app-icon"})}var Ni=nv();function nS(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return y.useMemo(()=>o=>{n.forEach(l=>l(o))},n)}const tc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Mo(e){const n=Object.prototype.toString.call(e);return n==="[object Window]"||n==="[object global]"}function rf(e){return"nodeType"in e}function Cn(e){var n,r;return e?Mo(e)?e:rf(e)&&(n=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?n:window:window}function of(e){const{Document:n}=Cn(e);return e instanceof n}function Vi(e){return Mo(e)?!1:e instanceof Cn(e).HTMLElement}function Xv(e){return e instanceof Cn(e).SVGElement}function Lo(e){return e?Mo(e)?e.document:rf(e)?of(e)?e:Vi(e)||Xv(e)?e.ownerDocument:document:document:document}const ps=tc?y.useLayoutEffect:y.useEffect;function nc(e){const n=y.useRef(e);return ps(()=>{n.current=e}),y.useCallback(function(){for(var r=arguments.length,o=new Array(r),l=0;l<r;l++)o[l]=arguments[l];return n.current==null?void 0:n.current(...o)},[])}function sS(){const e=y.useRef(null),n=y.useCallback((o,l)=>{e.current=setInterval(o,l)},[]),r=y.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[n,r]}function Pi(e,n){n===void 0&&(n=[e]);const r=y.useRef(e);return ps(()=>{r.current!==e&&(r.current=e)},n),r}function Ki(e,n){const r=y.useRef();return y.useMemo(()=>{const o=e(r.current);return r.current=o,o},[...n])}function Il(e){const n=nc(e),r=y.useRef(null),o=y.useCallback(l=>{l!==r.current&&(n==null||n(l,r.current)),r.current=l},[]);return[r,o]}function Dl(e){const n=y.useRef();return y.useEffect(()=>{n.current=e},[e]),n.current}let sd={};function Gi(e,n){return y.useMemo(()=>{if(n)return n;const r=sd[e]==null?0:sd[e]+1;return sd[e]=r,e+"-"+r},[e,n])}function Yv(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];return o.reduce((c,d)=>{const f=Object.entries(d);for(const[h,m]of f){const v=c[h];v!=null&&(c[h]=v+e*m)}return c},{...n})}}const Ro=Yv(1),Ml=Yv(-1);function rS(e){return"clientX"in e&&"clientY"in e}function sc(e){if(!e)return!1;const{KeyboardEvent:n}=Cn(e.target);return n&&e instanceof n}function oS(e){if(!e)return!1;const{TouchEvent:n}=Cn(e.target);return n&&e instanceof n}function Ll(e){if(oS(e)){if(e.touches&&e.touches.length){const{clientX:n,clientY:r}=e.touches[0];return{x:n,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:n,clientY:r}=e.changedTouches[0];return{x:n,y:r}}}return rS(e)?{x:e.clientX,y:e.clientY}:null}const Es=Object.freeze({Translate:{toString(e){if(!e)return;const{x:n,y:r}=e;return"translate3d("+(n?Math.round(n):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:n,scaleY:r}=e;return"scaleX("+n+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Es.Translate.toString(e),Es.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:n,duration:r,easing:o}=e;return n+" "+r+"ms "+o}}}),Lm="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function iS(e){return e.matches(Lm)?e:e.querySelector(Lm)}const aS={display:"none"};function lS(e){let{id:n,value:r}=e;return ct.createElement("div",{id:n,style:aS},r)}function cS(e){let{id:n,announcement:r,ariaLiveType:o="assertive"}=e;const l={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 ct.createElement("div",{id:n,style:l,role:"status","aria-live":o,"aria-atomic":!0},r)}function uS(){const[e,n]=y.useState("");return{announce:y.useCallback(o=>{o!=null&&n(o)},[]),announcement:e}}const Qv=y.createContext(null);function dS(e){const n=y.useContext(Qv);y.useEffect(()=>{if(!n)throw new Error("useDndMonitor must be used within a children of <DndContext>");return n(e)},[e,n])}function fS(){const[e]=y.useState(()=>new Set),n=y.useCallback(o=>(e.add(o),()=>e.delete(o)),[e]);return[y.useCallback(o=>{let{type:l,event:c}=o;e.forEach(d=>{var f;return(f=d[l])==null?void 0:f.call(d,c)})},[e]),n]}const pS={draggable:`
453
453
  To pick up a draggable item, press the space bar.
454
454
  While dragging, use the arrow keys to move the item.
455
455
  Press space again to drop the item in its new position, or press escape to cancel.
456
- `},pS={onDragStart(e){let{active:n}=e;return"Picked up draggable item "+n.id+"."},onDragOver(e){let{active:n,over:r}=e;return r?"Draggable item "+n.id+" was moved over droppable area "+r.id+".":"Draggable item "+n.id+" is no longer over a droppable area."},onDragEnd(e){let{active:n,over:r}=e;return r?"Draggable item "+n.id+" was dropped over droppable area "+r.id:"Draggable item "+n.id+" was dropped."},onDragCancel(e){let{active:n}=e;return"Dragging was cancelled. Draggable item "+n.id+" was dropped."}};function hS(e){let{announcements:n=pS,container:r,hiddenTextDescribedById:o,screenReaderInstructions:l=fS}=e;const{announce:c,announcement:d}=cS(),f=Gi("DndLiveRegion"),[h,m]=y.useState(!1);if(y.useEffect(()=>{m(!0)},[]),uS(y.useMemo(()=>({onDragStart(k){let{active:x}=k;c(n.onDragStart({active:x}))},onDragMove(k){let{active:x,over:S}=k;n.onDragMove&&c(n.onDragMove({active:x,over:S}))},onDragOver(k){let{active:x,over:S}=k;c(n.onDragOver({active:x,over:S}))},onDragEnd(k){let{active:x,over:S}=k;c(n.onDragEnd({active:x,over:S}))},onDragCancel(k){let{active:x,over:S}=k;c(n.onDragCancel({active:x,over:S}))}}),[c,n])),!h)return null;const v=ct.createElement(ct.Fragment,null,ct.createElement(aS,{id:o,value:l.draggable}),ct.createElement(lS,{id:f,announcement:d}));return r?Ni.createPortal(v,r):v}var Ht;(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"})(Ht||(Ht={}));function Ll(){}function Zv(e,n){return y.useMemo(()=>({sensor:e,options:n??{}}),[e,n])}function Jv(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return y.useMemo(()=>[...n].filter(o=>o!=null),[...n])}const ps=Object.freeze({x:0,y:0});function mS(e,n){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function gS(e,n){const r=Ml(e);if(!r)return"0 0";const o={x:(r.x-n.left)/n.width*100,y:(r.y-n.top)/n.height*100};return o.x+"% "+o.y+"%"}function vS(e,n){let{data:{value:r}}=e,{data:{value:o}}=n;return r-o}function yS(e,n){let{data:{value:r}}=e,{data:{value:o}}=n;return o-r}function xS(e,n){if(!e||e.length===0)return null;const[r]=e;return r[n]}function Om(e,n,r){return n===void 0&&(n=e.left),r===void 0&&(r=e.top),{x:n+e.width*.5,y:r+e.height*.5}}const ey=e=>{let{collisionRect:n,droppableRects:r,droppableContainers:o}=e;const l=Om(n,n.left,n.top),c=[];for(const d of o){const{id:f}=d,h=r.get(f);if(h){const m=mS(Om(h),l);c.push({id:f,data:{droppableContainer:d,value:m}})}}return c.sort(vS)};function wS(e,n){const r=Math.max(n.top,e.top),o=Math.max(n.left,e.left),l=Math.min(n.left+n.width,e.left+e.width),c=Math.min(n.top+n.height,e.top+e.height),d=l-o,f=c-r;if(o<l&&r<c){const h=n.width*n.height,m=e.width*e.height,v=d*f,k=v/(h+m-v);return Number(k.toFixed(4))}return 0}const kS=e=>{let{collisionRect:n,droppableRects:r,droppableContainers:o}=e;const l=[];for(const c of o){const{id:d}=c,f=r.get(d);if(f){const h=wS(f,n);h>0&&l.push({id:d,data:{droppableContainer:c,value:h}})}}return l.sort(yS)};function SS(e,n,r){return{...e,scaleX:n&&r?n.width/r.width:1,scaleY:n&&r?n.height/r.height:1}}function ty(e,n){return e&&n?{x:e.left-n.left,y:e.top-n.top}:ps}function bS(e){return function(r){for(var o=arguments.length,l=new Array(o>1?o-1:0),c=1;c<o;c++)l[c-1]=arguments[c];return l.reduce((d,f)=>({...d,top:d.top+e*f.y,bottom:d.bottom+e*f.y,left:d.left+e*f.x,right:d.right+e*f.x}),{...r})}}const NS=bS(1);function ny(e){if(e.startsWith("matrix3d(")){const n=e.slice(9,-1).split(/, /);return{x:+n[12],y:+n[13],scaleX:+n[0],scaleY:+n[5]}}else if(e.startsWith("matrix(")){const n=e.slice(7,-1).split(/, /);return{x:+n[4],y:+n[5],scaleX:+n[0],scaleY:+n[3]}}return null}function TS(e,n,r){const o=ny(n);if(!o)return e;const{scaleX:l,scaleY:c,x:d,y:f}=o,h=e.left-d-(1-l)*parseFloat(r),m=e.top-f-(1-c)*parseFloat(r.slice(r.indexOf(" ")+1)),v=l?e.width/l:e.width,k=c?e.height/c:e.height;return{width:v,height:k,top:m,right:h+v,bottom:m+k,left:h}}const CS={ignoreTransform:!1};function Oo(e,n){n===void 0&&(n=CS);let r=e.getBoundingClientRect();if(n.ignoreTransform){const{transform:m,transformOrigin:v}=Cn(e).getComputedStyle(e);m&&(r=TS(r,m,v))}const{top:o,left:l,width:c,height:d,bottom:f,right:h}=r;return{top:o,left:l,width:c,height:d,bottom:f,right:h}}function $m(e){return Oo(e,{ignoreTransform:!0})}function ES(e){const n=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:n,bottom:r,width:n,height:r}}function jS(e,n){return n===void 0&&(n=Cn(e).getComputedStyle(e)),n.position==="fixed"}function _S(e,n){n===void 0&&(n=Cn(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(l=>{const c=n[l];return typeof c=="string"?r.test(c):!1})}function af(e,n){const r=[];function o(l){if(n!=null&&r.length>=n||!l)return r;if(of(l)&&l.scrollingElement!=null&&!r.includes(l.scrollingElement))return r.push(l.scrollingElement),r;if(!Vi(l)||Xv(l)||r.includes(l))return r;const c=Cn(e).getComputedStyle(l);return l!==e&&_S(l,c)&&r.push(l),jS(l,c)?r:o(l.parentNode)}return e?o(e):r}function sy(e){const[n]=af(e,1);return n??null}function sd(e){return!ec||!e?null:Mo(e)?e:rf(e)?of(e)||e===Lo(e).scrollingElement?window:Vi(e)?e:null:null}function ry(e){return Mo(e)?e.scrollX:e.scrollLeft}function oy(e){return Mo(e)?e.scrollY:e.scrollTop}function Sd(e){return{x:ry(e),y:oy(e)}}var en;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(en||(en={}));function iy(e){return!ec||!e?!1:e===document.scrollingElement}function ay(e){const n={x:0,y:0},r=iy(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},o={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},l=e.scrollTop<=n.y,c=e.scrollLeft<=n.x,d=e.scrollTop>=o.y,f=e.scrollLeft>=o.x;return{isTop:l,isLeft:c,isBottom:d,isRight:f,maxScroll:o,minScroll:n}}const RS={x:.2,y:.2};function AS(e,n,r,o,l){let{top:c,left:d,right:f,bottom:h}=r;o===void 0&&(o=10),l===void 0&&(l=RS);const{isTop:m,isBottom:v,isLeft:k,isRight:x}=ay(e),S={x:0,y:0},C={x:0,y:0},T={height:n.height*l.y,width:n.width*l.x};return!m&&c<=n.top+T.height?(S.y=en.Backward,C.y=o*Math.abs((n.top+T.height-c)/T.height)):!v&&h>=n.bottom-T.height&&(S.y=en.Forward,C.y=o*Math.abs((n.bottom-T.height-h)/T.height)),!x&&f>=n.right-T.width?(S.x=en.Forward,C.x=o*Math.abs((n.right-T.width-f)/T.width)):!k&&d<=n.left+T.width&&(S.x=en.Backward,C.x=o*Math.abs((n.left+T.width-d)/T.width)),{direction:S,speed:C}}function IS(e){if(e===document.scrollingElement){const{innerWidth:c,innerHeight:d}=window;return{top:0,left:0,right:c,bottom:d,width:c,height:d}}const{top:n,left:r,right:o,bottom:l}=e.getBoundingClientRect();return{top:n,left:r,right:o,bottom:l,width:e.clientWidth,height:e.clientHeight}}function ly(e){return e.reduce((n,r)=>Ro(n,Sd(r)),ps)}function DS(e){return e.reduce((n,r)=>n+ry(r),0)}function MS(e){return e.reduce((n,r)=>n+oy(r),0)}function cy(e,n){if(n===void 0&&(n=Oo),!e)return;const{top:r,left:o,bottom:l,right:c}=n(e);sy(e)&&(l<=0||c<=0||r>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const LS=[["x",["left","right"],DS],["y",["top","bottom"],MS]];class lf{constructor(n,r){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 o=af(r),l=ly(o);this.rect={...n},this.width=n.width,this.height=n.height;for(const[c,d,f]of LS)for(const h of d)Object.defineProperty(this,h,{get:()=>{const m=f(o),v=l[c]-m;return this.rect[h]+v},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ei{constructor(n){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...r)})},this.target=n}add(n,r,o){var l;(l=this.target)==null||l.addEventListener(n,r,o),this.listeners.push([n,r,o])}}function OS(e){const{EventTarget:n}=Cn(e);return e instanceof n?e:Lo(e)}function rd(e,n){const r=Math.abs(e.x),o=Math.abs(e.y);return typeof n=="number"?Math.sqrt(r**2+o**2)>n:"x"in n&&"y"in n?r>n.x&&o>n.y:"x"in n?r>n.x:"y"in n?o>n.y:!1}var es;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(es||(es={}));function Pm(e){e.preventDefault()}function $S(e){e.stopPropagation()}var nt;(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"})(nt||(nt={}));const uy={start:[nt.Space,nt.Enter],cancel:[nt.Esc],end:[nt.Space,nt.Enter,nt.Tab]},PS=(e,n)=>{let{currentCoordinates:r}=n;switch(e.code){case nt.Right:return{...r,x:r.x+25};case nt.Left:return{...r,x:r.x-25};case nt.Down:return{...r,y:r.y+25};case nt.Up:return{...r,y:r.y-25}}};class dy{constructor(n){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=n;const{event:{target:r}}=n;this.props=n,this.listeners=new Ei(Lo(r)),this.windowListeners=new Ei(Cn(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(es.Resize,this.handleCancel),this.windowListeners.add(es.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(es.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:n,onStart:r}=this.props,o=n.node.current;o&&cy(o),r(ps)}handleKeyDown(n){if(nc(n)){const{active:r,context:o,options:l}=this.props,{keyboardCodes:c=uy,coordinateGetter:d=PS,scrollBehavior:f="smooth"}=l,{code:h}=n;if(c.end.includes(h)){this.handleEnd(n);return}if(c.cancel.includes(h)){this.handleCancel(n);return}const{collisionRect:m}=o.current,v=m?{x:m.left,y:m.top}:ps;this.referenceCoordinates||(this.referenceCoordinates=v);const k=d(n,{active:r,context:o.current,currentCoordinates:v});if(k){const x=Dl(k,v),S={x:0,y:0},{scrollableAncestors:C}=o.current;for(const T of C){const E=n.code,{isTop:b,isRight:j,isLeft:P,isBottom:M,maxScroll:L,minScroll:G}=ay(T),z=IS(T),U={x:Math.min(E===nt.Right?z.right-z.width/2:z.right,Math.max(E===nt.Right?z.left:z.left+z.width/2,k.x)),y:Math.min(E===nt.Down?z.bottom-z.height/2:z.bottom,Math.max(E===nt.Down?z.top:z.top+z.height/2,k.y))},Q=E===nt.Right&&!j||E===nt.Left&&!P,J=E===nt.Down&&!M||E===nt.Up&&!b;if(Q&&U.x!==k.x){const oe=T.scrollLeft+x.x,me=E===nt.Right&&oe<=L.x||E===nt.Left&&oe>=G.x;if(me&&!x.y){T.scrollTo({left:oe,behavior:f});return}me?S.x=T.scrollLeft-oe:S.x=E===nt.Right?T.scrollLeft-L.x:T.scrollLeft-G.x,S.x&&T.scrollBy({left:-S.x,behavior:f});break}else if(J&&U.y!==k.y){const oe=T.scrollTop+x.y,me=E===nt.Down&&oe<=L.y||E===nt.Up&&oe>=G.y;if(me&&!x.x){T.scrollTo({top:oe,behavior:f});return}me?S.y=T.scrollTop-oe:S.y=E===nt.Down?T.scrollTop-L.y:T.scrollTop-G.y,S.y&&T.scrollBy({top:-S.y,behavior:f});break}}this.handleMove(n,Ro(Dl(k,this.referenceCoordinates),S))}}}handleMove(n,r){const{onMove:o}=this.props;n.preventDefault(),o(r)}handleEnd(n){const{onEnd:r}=this.props;n.preventDefault(),this.detach(),r()}handleCancel(n){const{onCancel:r}=this.props;n.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}dy.activators=[{eventName:"onKeyDown",handler:(e,n,r)=>{let{keyboardCodes:o=uy,onActivation:l}=n,{active:c}=r;const{code:d}=e.nativeEvent;if(o.start.includes(d)){const f=c.activatorNode.current;return f&&e.target!==f?!1:(e.preventDefault(),l==null||l({event:e.nativeEvent}),!0)}return!1}}];function zm(e){return!!(e&&"distance"in e)}function Fm(e){return!!(e&&"delay"in e)}class cf{constructor(n,r,o){var l;o===void 0&&(o=OS(n.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=n,this.events=r;const{event:c}=n,{target:d}=c;this.props=n,this.events=r,this.document=Lo(d),this.documentListeners=new Ei(this.document),this.listeners=new Ei(o),this.windowListeners=new Ei(Cn(d)),this.initialCoordinates=(l=Ml(c))!=null?l:ps,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:n,props:{options:{activationConstraint:r,bypassActivationConstraint:o}}}=this;if(this.listeners.add(n.move.name,this.handleMove,{passive:!1}),this.listeners.add(n.end.name,this.handleEnd),n.cancel&&this.listeners.add(n.cancel.name,this.handleCancel),this.windowListeners.add(es.Resize,this.handleCancel),this.windowListeners.add(es.DragStart,Pm),this.windowListeners.add(es.VisibilityChange,this.handleCancel),this.windowListeners.add(es.ContextMenu,Pm),this.documentListeners.add(es.Keydown,this.handleKeydown),r){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Fm(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(zm(r)){this.handlePending(r);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(n,r){const{active:o,onPending:l}=this.props;l(o,n,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:n}=this,{onStart:r}=this.props;n&&(this.activated=!0,this.documentListeners.add(es.Click,$S,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(es.SelectionChange,this.removeTextSelection),r(n))}handleMove(n){var r;const{activated:o,initialCoordinates:l,props:c}=this,{onMove:d,options:{activationConstraint:f}}=c;if(!l)return;const h=(r=Ml(n))!=null?r:ps,m=Dl(l,h);if(!o&&f){if(zm(f)){if(f.tolerance!=null&&rd(m,f.tolerance))return this.handleCancel();if(rd(m,f.distance))return this.handleStart()}if(Fm(f)&&rd(m,f.tolerance))return this.handleCancel();this.handlePending(f,m);return}n.cancelable&&n.preventDefault(),d(h)}handleEnd(){const{onAbort:n,onEnd:r}=this.props;this.detach(),this.activated||n(this.props.active),r()}handleCancel(){const{onAbort:n,onCancel:r}=this.props;this.detach(),this.activated||n(this.props.active),r()}handleKeydown(n){n.code===nt.Esc&&this.handleCancel()}removeTextSelection(){var n;(n=this.document.getSelection())==null||n.removeAllRanges()}}const zS={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class sc extends cf{constructor(n){const{event:r}=n,o=Lo(r.target);super(n,zS,o)}}sc.activators=[{eventName:"onPointerDown",handler:(e,n)=>{let{nativeEvent:r}=e,{onActivation:o}=n;return!r.isPrimary||r.button!==0?!1:(o==null||o({event:r}),!0)}}];const FS={move:{name:"mousemove"},end:{name:"mouseup"}};var bd;(function(e){e[e.RightClick=2]="RightClick"})(bd||(bd={}));class US extends cf{constructor(n){super(n,FS,Lo(n.event.target))}}US.activators=[{eventName:"onMouseDown",handler:(e,n)=>{let{nativeEvent:r}=e,{onActivation:o}=n;return r.button===bd.RightClick?!1:(o==null||o({event:r}),!0)}}];const od={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class BS extends cf{constructor(n){super(n,od)}static setup(){return window.addEventListener(od.move.name,n,{capture:!1,passive:!1}),function(){window.removeEventListener(od.move.name,n)};function n(){}}}BS.activators=[{eventName:"onTouchStart",handler:(e,n)=>{let{nativeEvent:r}=e,{onActivation:o}=n;const{touches:l}=r;return l.length>1?!1:(o==null||o({event:r}),!0)}}];var ji;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ji||(ji={}));var Ol;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ol||(Ol={}));function WS(e){let{acceleration:n,activator:r=ji.Pointer,canScroll:o,draggingRect:l,enabled:c,interval:d=5,order:f=Ol.TreeOrder,pointerCoordinates:h,scrollableAncestors:m,scrollableAncestorRects:v,delta:k,threshold:x}=e;const S=VS({delta:k,disabled:!c}),[C,T]=nS(),E=y.useRef({x:0,y:0}),b=y.useRef({x:0,y:0}),j=y.useMemo(()=>{switch(r){case ji.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case ji.DraggableRect:return l}},[r,l,h]),P=y.useRef(null),M=y.useCallback(()=>{const G=P.current;if(!G)return;const z=E.current.x*b.current.x,U=E.current.y*b.current.y;G.scrollBy(z,U)},[]),L=y.useMemo(()=>f===Ol.TreeOrder?[...m].reverse():m,[f,m]);y.useEffect(()=>{if(!c||!m.length||!j){T();return}for(const G of L){if((o==null?void 0:o(G))===!1)continue;const z=m.indexOf(G),U=v[z];if(!U)continue;const{direction:Q,speed:J}=AS(G,U,j,n,x);for(const oe of["x","y"])S[oe][Q[oe]]||(J[oe]=0,Q[oe]=0);if(J.x>0||J.y>0){T(),P.current=G,C(M,d),E.current=J,b.current=Q;return}}E.current={x:0,y:0},b.current={x:0,y:0},T()},[n,M,o,T,c,d,JSON.stringify(j),JSON.stringify(S),C,m,L,v,JSON.stringify(x)])}const HS={x:{[en.Backward]:!1,[en.Forward]:!1},y:{[en.Backward]:!1,[en.Forward]:!1}};function VS(e){let{delta:n,disabled:r}=e;const o=Il(n);return Ki(l=>{if(r||!o||!l)return HS;const c={x:Math.sign(n.x-o.x),y:Math.sign(n.y-o.y)};return{x:{[en.Backward]:l.x[en.Backward]||c.x===-1,[en.Forward]:l.x[en.Forward]||c.x===1},y:{[en.Backward]:l.y[en.Backward]||c.y===-1,[en.Forward]:l.y[en.Forward]||c.y===1}}},[r,n,o])}function KS(e,n){const r=n!=null?e.get(n):void 0,o=r?r.node.current:null;return Ki(l=>{var c;return n==null?null:(c=o??l)!=null?c:null},[o,n])}function GS(e,n){return y.useMemo(()=>e.reduce((r,o)=>{const{sensor:l}=o,c=l.activators.map(d=>({eventName:d.eventName,handler:n(d.handler,o)}));return[...r,...c]},[]),[e,n])}var zi;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(zi||(zi={}));var Nd;(function(e){e.Optimized="optimized"})(Nd||(Nd={}));const Um=new Map;function qS(e,n){let{dragging:r,dependencies:o,config:l}=n;const[c,d]=y.useState(null),{frequency:f,measure:h,strategy:m}=l,v=y.useRef(e),k=E(),x=Pi(k),S=y.useCallback(function(b){b===void 0&&(b=[]),!x.current&&d(j=>j===null?b:j.concat(b.filter(P=>!j.includes(P))))},[x]),C=y.useRef(null),T=Ki(b=>{if(k&&!r)return Um;if(!b||b===Um||v.current!==e||c!=null){const j=new Map;for(let P of e){if(!P)continue;if(c&&c.length>0&&!c.includes(P.id)&&P.rect.current){j.set(P.id,P.rect.current);continue}const M=P.node.current,L=M?new lf(h(M),M):null;P.rect.current=L,L&&j.set(P.id,L)}return j}return b},[e,c,r,k,h]);return y.useEffect(()=>{v.current=e},[e]),y.useEffect(()=>{k||S()},[r,k]),y.useEffect(()=>{c&&c.length>0&&d(null)},[JSON.stringify(c)]),y.useEffect(()=>{k||typeof f!="number"||C.current!==null||(C.current=setTimeout(()=>{S(),C.current=null},f))},[f,k,S,...o]),{droppableRects:T,measureDroppableContainers:S,measuringScheduled:c!=null};function E(){switch(m){case zi.Always:return!1;case zi.BeforeDragging:return r;default:return!r}}}function uf(e,n){return Ki(r=>e?r||(typeof n=="function"?n(e):e):null,[n,e])}function XS(e,n){return uf(e,n)}function YS(e){let{callback:n,disabled:r}=e;const o=tc(n),l=y.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(o)},[o,r]);return y.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function rc(e){let{callback:n,disabled:r}=e;const o=tc(n),l=y.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(o)},[r]);return y.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function QS(e){return new lf(Oo(e),e)}function Bm(e,n,r){n===void 0&&(n=QS);const[o,l]=y.useState(null);function c(){l(h=>{if(!e)return null;if(e.isConnected===!1){var m;return(m=h??r)!=null?m:null}const v=n(e);return JSON.stringify(h)===JSON.stringify(v)?h:v})}const d=YS({callback(h){if(e)for(const m of h){const{type:v,target:k}=m;if(v==="childList"&&k instanceof HTMLElement&&k.contains(e)){c();break}}}}),f=rc({callback:c});return fs(()=>{c(),e?(f==null||f.observe(e),d==null||d.observe(document.body,{childList:!0,subtree:!0})):(f==null||f.disconnect(),d==null||d.disconnect())},[e]),o}function ZS(e){const n=uf(e);return ty(e,n)}const Wm=[];function JS(e){const n=y.useRef(e),r=Ki(o=>e?o&&o!==Wm&&e&&n.current&&e.parentNode===n.current.parentNode?o:af(e):Wm,[e]);return y.useEffect(()=>{n.current=e},[e]),r}function eb(e){const[n,r]=y.useState(null),o=y.useRef(e),l=y.useCallback(c=>{const d=sd(c.target);d&&r(f=>f?(f.set(d,Sd(d)),new Map(f)):null)},[]);return y.useEffect(()=>{const c=o.current;if(e!==c){d(c);const f=e.map(h=>{const m=sd(h);return m?(m.addEventListener("scroll",l,{passive:!0}),[m,Sd(m)]):null}).filter(h=>h!=null);r(f.length?new Map(f):null),o.current=e}return()=>{d(e),d(c)};function d(f){f.forEach(h=>{const m=sd(h);m==null||m.removeEventListener("scroll",l)})}},[l,e]),y.useMemo(()=>e.length?n?Array.from(n.values()).reduce((c,d)=>Ro(c,d),ps):ly(e):ps,[e,n])}function Hm(e,n){n===void 0&&(n=[]);const r=y.useRef(null);return y.useEffect(()=>{r.current=null},n),y.useEffect(()=>{const o=e!==ps;o&&!r.current&&(r.current=e),!o&&r.current&&(r.current=null)},[e]),r.current?Dl(e,r.current):ps}function tb(e){y.useEffect(()=>{if(!ec)return;const n=e.map(r=>{let{sensor:o}=r;return o.setup==null?void 0:o.setup()});return()=>{for(const r of n)r==null||r()}},e.map(n=>{let{sensor:r}=n;return r}))}function nb(e,n){return y.useMemo(()=>e.reduce((r,o)=>{let{eventName:l,handler:c}=o;return r[l]=d=>{c(d,n)},r},{}),[e,n])}function fy(e){return y.useMemo(()=>e?ES(e):null,[e])}const Vm=[];function sb(e,n){n===void 0&&(n=Oo);const[r]=e,o=fy(r?Cn(r):null),[l,c]=y.useState(Vm);function d(){c(()=>e.length?e.map(h=>iy(h)?o:new lf(n(h),h)):Vm)}const f=rc({callback:d});return fs(()=>{f==null||f.disconnect(),d(),e.forEach(h=>f==null?void 0:f.observe(h))},[e]),l}function py(e){if(!e)return null;if(e.children.length>1)return e;const n=e.children[0];return Vi(n)?n:e}function rb(e){let{measure:n}=e;const[r,o]=y.useState(null),l=y.useCallback(m=>{for(const{target:v}of m)if(Vi(v)){o(k=>{const x=n(v);return k?{...k,width:x.width,height:x.height}:x});break}},[n]),c=rc({callback:l}),d=y.useCallback(m=>{const v=py(m);c==null||c.disconnect(),v&&(c==null||c.observe(v)),o(v?n(v):null)},[n,c]),[f,h]=Al(d);return y.useMemo(()=>({nodeRef:f,rect:r,setRef:h}),[r,f,h])}const ob=[{sensor:sc,options:{}},{sensor:dy,options:{}}],ib={current:{}},ml={draggable:{measure:$m},droppable:{measure:$m,strategy:zi.WhileDragging,frequency:Nd.Optimized},dragOverlay:{measure:Oo}};class _i extends Map{get(n){var r;return n!=null&&(r=super.get(n))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(n=>{let{disabled:r}=n;return!r})}getNodeFor(n){var r,o;return(r=(o=this.get(n))==null?void 0:o.node.current)!=null?r:void 0}}const ab={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new _i,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ll},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ml,measureDroppableContainers:Ll,windowRect:null,measuringScheduled:!1},hy={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Ll,draggableNodes:new Map,over:null,measureDroppableContainers:Ll},qi=y.createContext(hy),my=y.createContext(ab);function lb(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new _i}}}function cb(e,n){switch(n.type){case Ht.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:n.initialCoordinates,active:n.active}};case Ht.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:n.coordinates.x-e.draggable.initialCoordinates.x,y:n.coordinates.y-e.draggable.initialCoordinates.y}}};case Ht.DragEnd:case Ht.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ht.RegisterDroppable:{const{element:r}=n,{id:o}=r,l=new _i(e.droppable.containers);return l.set(o,r),{...e,droppable:{...e.droppable,containers:l}}}case Ht.SetDroppableDisabled:{const{id:r,key:o,disabled:l}=n,c=e.droppable.containers.get(r);if(!c||o!==c.key)return e;const d=new _i(e.droppable.containers);return d.set(r,{...c,disabled:l}),{...e,droppable:{...e.droppable,containers:d}}}case Ht.UnregisterDroppable:{const{id:r,key:o}=n,l=e.droppable.containers.get(r);if(!l||o!==l.key)return e;const c=new _i(e.droppable.containers);return c.delete(r),{...e,droppable:{...e.droppable,containers:c}}}default:return e}}function ub(e){let{disabled:n}=e;const{active:r,activatorEvent:o,draggableNodes:l}=y.useContext(qi),c=Il(o),d=Il(r==null?void 0:r.id);return y.useEffect(()=>{if(!n&&!o&&c&&d!=null){if(!nc(c)||document.activeElement===c.target)return;const f=l.get(d);if(!f)return;const{activatorNode:h,node:m}=f;if(!h.current&&!m.current)return;requestAnimationFrame(()=>{for(const v of[h.current,m.current]){if(!v)continue;const k=oS(v);if(k){k.focus();break}}})}},[o,n,l,d,c]),null}function gy(e,n){let{transform:r,...o}=n;return e!=null&&e.length?e.reduce((l,c)=>c({transform:l,...o}),r):r}function db(e){return y.useMemo(()=>({draggable:{...ml.draggable,...e==null?void 0:e.draggable},droppable:{...ml.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ml.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 fb(e){let{activeNode:n,measure:r,initialRect:o,config:l=!0}=e;const c=y.useRef(!1),{x:d,y:f}=typeof l=="boolean"?{x:l,y:l}:l;fs(()=>{if(!d&&!f||!n){c.current=!1;return}if(c.current||!o)return;const m=n==null?void 0:n.node.current;if(!m||m.isConnected===!1)return;const v=r(m),k=ty(v,o);if(d||(k.x=0),f||(k.y=0),c.current=!0,Math.abs(k.x)>0||Math.abs(k.y)>0){const x=sy(m);x&&x.scrollBy({top:k.y,left:k.x})}},[n,d,f,o,r])}const oc=y.createContext({...ps,scaleX:1,scaleY:1});var dr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(dr||(dr={}));const vy=y.memo(function(n){var r,o,l,c;let{id:d,accessibility:f,autoScroll:h=!0,children:m,sensors:v=ob,collisionDetection:k=kS,measuring:x,modifiers:S,...C}=n;const T=y.useReducer(cb,void 0,lb),[E,b]=T,[j,P]=dS(),[M,L]=y.useState(dr.Uninitialized),G=M===dr.Initialized,{draggable:{active:z,nodes:U,translate:Q},droppable:{containers:J}}=E,oe=z!=null?U.get(z):null,me=y.useRef({initial:null,translated:null}),Se=y.useMemo(()=>{var Ze;return z!=null?{id:z,data:(Ze=oe==null?void 0:oe.data)!=null?Ze:ib,rect:me}:null},[z,oe]),Me=y.useRef(null),[ee,ie]=y.useState(null),[te,F]=y.useState(null),Z=Pi(C,Object.values(C)),q=Gi("DndDescribedBy",d),I=y.useMemo(()=>J.getEnabled(),[J]),$=db(x),{droppableRects:ue,measureDroppableContainers:B,measuringScheduled:X}=qS(I,{dragging:G,dependencies:[Q.x,Q.y],config:$.droppable}),ce=KS(U,z),be=y.useMemo(()=>te?Ml(te):null,[te]),_e=vn(),Ae=XS(ce,$.draggable.measure);fb({activeNode:z!=null?U.get(z):null,config:_e.layoutShiftCompensation,initialRect:Ae,measure:$.draggable.measure});const je=Bm(ce,$.draggable.measure,Ae),ge=Bm(ce?ce.parentElement:null),he=y.useRef({activatorEvent:null,active:null,activeNode:ce,collisionRect:null,collisions:null,droppableRects:ue,draggableNodes:U,draggingNode:null,draggingNodeRect:null,droppableContainers:J,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ve=J.getNodeFor((r=he.current.over)==null?void 0:r.id),Ie=rb({measure:$.dragOverlay.measure}),mt=(o=Ie.nodeRef.current)!=null?o:ce,Ue=G?(l=Ie.rect)!=null?l:je:null,Vt=!!(Ie.nodeRef.current&&Ie.rect),tn=ZS(Vt?null:je),St=fy(mt?Cn(mt):null),jt=JS(G?Ve??ce:null),Ft=sb(jt),Ot=gy(S,{transform:{x:Q.x-tn.x,y:Q.y-tn.y,scaleX:1,scaleY:1},activatorEvent:te,active:Se,activeNodeRect:je,containerNodeRect:ge,draggingNodeRect:Ue,over:he.current.over,overlayNodeRect:Ie.rect,scrollableAncestors:jt,scrollableAncestorRects:Ft,windowRect:St}),Y=be?Ro(be,Q):null,ve=eb(jt),Be=Hm(ve),rt=Hm(ve,[je]),gt=Ro(Ot,Be),vt=Ue?NS(Ue,Ot):null,_t=Se&&vt?k({active:Se,collisionRect:vt,droppableRects:ue,droppableContainers:I,pointerCoordinates:Y}):null,an=xS(_t,"id"),[dt,Mn]=y.useState(null),Ln=Vt?Ot:Ro(Ot,rt),hs=SS(Ln,(c=dt==null?void 0:dt.rect)!=null?c:null,je),ms=y.useRef(null),ns=y.useCallback((Ze,Rt)=>{let{sensor:ft,options:Gt}=Rt;if(Me.current==null)return;const yt=U.get(Me.current);if(!yt)return;const xt=Ze.nativeEvent,lt=new ft({active:Me.current,activeNode:yt,event:xt,options:Gt,context:he,onAbort(it){if(!U.get(it))return;const{onDragAbort:R}=Z.current,pe={id:it};R==null||R(pe),j({type:"onDragAbort",event:pe})},onPending(it,$t,R,pe){if(!U.get(it))return;const{onDragPending:we}=Z.current,$e={id:it,constraint:$t,initialCoordinates:R,offset:pe};we==null||we($e),j({type:"onDragPending",event:$e})},onStart(it){const $t=Me.current;if($t==null)return;const R=U.get($t);if(!R)return;const{onDragStart:pe}=Z.current,le={activatorEvent:xt,active:{id:$t,data:R.data,rect:me}};Ni.unstable_batchedUpdates(()=>{pe==null||pe(le),L(dr.Initializing),b({type:Ht.DragStart,initialCoordinates:it,active:$t}),j({type:"onDragStart",event:le}),ie(ms.current),F(xt)})},onMove(it){b({type:Ht.DragMove,coordinates:it})},onEnd:qt(Ht.DragEnd),onCancel:qt(Ht.DragCancel)});ms.current=lt;function qt(it){return async function(){const{active:R,collisions:pe,over:le,scrollAdjustedTranslate:we}=he.current;let $e=null;if(R&&we){const{cancelDrop:qe}=Z.current;$e={activatorEvent:xt,active:R,collisions:pe,delta:we,over:le},it===Ht.DragEnd&&typeof qe=="function"&&await Promise.resolve(qe($e))&&(it=Ht.DragCancel)}Me.current=null,Ni.unstable_batchedUpdates(()=>{b({type:it}),L(dr.Uninitialized),Mn(null),ie(null),F(null),ms.current=null;const qe=it===Ht.DragEnd?"onDragEnd":"onDragCancel";if($e){const Pe=Z.current[qe];Pe==null||Pe($e),j({type:qe,event:$e})}})}}},[U]),On=y.useCallback((Ze,Rt)=>(ft,Gt)=>{const yt=ft.nativeEvent,xt=U.get(Gt);if(Me.current!==null||!xt||yt.dndKit||yt.defaultPrevented)return;const lt={active:xt};Ze(ft,Rt.options,lt)===!0&&(yt.dndKit={capturedBy:Rt.sensor},Me.current=Gt,ns(ft,Rt))},[U,ns]),gn=GS(v,On);tb(v),fs(()=>{je&&M===dr.Initializing&&L(dr.Initialized)},[je,M]),y.useEffect(()=>{const{onDragMove:Ze}=Z.current,{active:Rt,activatorEvent:ft,collisions:Gt,over:yt}=he.current;if(!Rt||!ft)return;const xt={active:Rt,activatorEvent:ft,collisions:Gt,delta:{x:gt.x,y:gt.y},over:yt};Ni.unstable_batchedUpdates(()=>{Ze==null||Ze(xt),j({type:"onDragMove",event:xt})})},[gt.x,gt.y]),y.useEffect(()=>{const{active:Ze,activatorEvent:Rt,collisions:ft,droppableContainers:Gt,scrollAdjustedTranslate:yt}=he.current;if(!Ze||Me.current==null||!Rt||!yt)return;const{onDragOver:xt}=Z.current,lt=Gt.get(an),qt=lt&&lt.rect.current?{id:lt.id,rect:lt.rect.current,data:lt.data,disabled:lt.disabled}:null,it={active:Ze,activatorEvent:Rt,collisions:ft,delta:{x:yt.x,y:yt.y},over:qt};Ni.unstable_batchedUpdates(()=>{Mn(qt),xt==null||xt(it),j({type:"onDragOver",event:it})})},[an]),fs(()=>{he.current={activatorEvent:te,active:Se,activeNode:ce,collisionRect:vt,collisions:_t,droppableRects:ue,draggableNodes:U,draggingNode:mt,draggingNodeRect:Ue,droppableContainers:J,over:dt,scrollableAncestors:jt,scrollAdjustedTranslate:gt},me.current={initial:Ue,translated:vt}},[Se,ce,_t,vt,U,mt,Ue,ue,J,dt,jt,gt]),WS({..._e,delta:Q,draggingRect:vt,pointerCoordinates:Y,scrollableAncestors:jt,scrollableAncestorRects:Ft});const ln=y.useMemo(()=>({active:Se,activeNode:ce,activeNodeRect:je,activatorEvent:te,collisions:_t,containerNodeRect:ge,dragOverlay:Ie,draggableNodes:U,droppableContainers:J,droppableRects:ue,over:dt,measureDroppableContainers:B,scrollableAncestors:jt,scrollableAncestorRects:Ft,measuringConfiguration:$,measuringScheduled:X,windowRect:St}),[Se,ce,je,te,_t,ge,Ie,U,J,ue,dt,B,jt,Ft,$,X,St]),Kt=y.useMemo(()=>({activatorEvent:te,activators:gn,active:Se,activeNodeRect:je,ariaDescribedById:{draggable:q},dispatch:b,draggableNodes:U,over:dt,measureDroppableContainers:B}),[te,gn,Se,je,b,q,U,dt,B]);return ct.createElement(Qv.Provider,{value:P},ct.createElement(qi.Provider,{value:Kt},ct.createElement(my.Provider,{value:ln},ct.createElement(oc.Provider,{value:hs},m)),ct.createElement(ub,{disabled:(f==null?void 0:f.restoreFocus)===!1})),ct.createElement(hS,{...f,hiddenTextDescribedById:q}));function vn(){const Ze=(ee==null?void 0:ee.autoScrollEnabled)===!1,Rt=typeof h=="object"?h.enabled===!1:h===!1,ft=G&&!Ze&&!Rt;return typeof h=="object"?{...h,enabled:ft}:{enabled:ft}}}),pb=y.createContext(null),Km="button",hb="Draggable";function mb(e){let{id:n,data:r,disabled:o=!1,attributes:l}=e;const c=Gi(hb),{activators:d,activatorEvent:f,active:h,activeNodeRect:m,ariaDescribedById:v,draggableNodes:k,over:x}=y.useContext(qi),{role:S=Km,roleDescription:C="draggable",tabIndex:T=0}=l??{},E=(h==null?void 0:h.id)===n,b=y.useContext(E?oc:pb),[j,P]=Al(),[M,L]=Al(),G=nb(d,n),z=Pi(r);fs(()=>(k.set(n,{id:n,key:c,node:j,activatorNode:M,data:z}),()=>{const Q=k.get(n);Q&&Q.key===c&&k.delete(n)}),[k,n]);const U=y.useMemo(()=>({role:S,tabIndex:T,"aria-disabled":o,"aria-pressed":E&&S===Km?!0:void 0,"aria-roledescription":C,"aria-describedby":v.draggable}),[o,S,T,E,C,v.draggable]);return{active:h,activatorEvent:f,activeNodeRect:m,attributes:U,isDragging:E,listeners:o?void 0:G,node:j,over:x,setNodeRef:P,setActivatorNodeRef:L,transform:b}}function yy(){return y.useContext(my)}const gb="Droppable",vb={timeout:25};function xy(e){let{data:n,disabled:r=!1,id:o,resizeObserverConfig:l}=e;const c=Gi(gb),{active:d,dispatch:f,over:h,measureDroppableContainers:m}=y.useContext(qi),v=y.useRef({disabled:r}),k=y.useRef(!1),x=y.useRef(null),S=y.useRef(null),{disabled:C,updateMeasurementsFor:T,timeout:E}={...vb,...l},b=Pi(T??o),j=y.useCallback(()=>{if(!k.current){k.current=!0;return}S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{m(Array.isArray(b.current)?b.current:[b.current]),S.current=null},E)},[E]),P=rc({callback:j,disabled:C||!d}),M=y.useCallback((U,Q)=>{P&&(Q&&(P.unobserve(Q),k.current=!1),U&&P.observe(U))},[P]),[L,G]=Al(M),z=Pi(n);return y.useEffect(()=>{!P||!L.current||(P.disconnect(),k.current=!1,P.observe(L.current))},[L,P]),y.useEffect(()=>(f({type:Ht.RegisterDroppable,element:{id:o,key:c,disabled:r,node:L,rect:x,data:z}}),()=>f({type:Ht.UnregisterDroppable,key:c,id:o})),[o]),y.useEffect(()=>{r!==v.current.disabled&&(f({type:Ht.SetDroppableDisabled,id:o,key:c,disabled:r}),v.current.disabled=r)},[o,c,r,f]),{active:d,rect:x,isOver:(h==null?void 0:h.id)===o,node:L,over:h,setNodeRef:G}}function yb(e){let{animation:n,children:r}=e;const[o,l]=y.useState(null),[c,d]=y.useState(null),f=Il(r);return!r&&!o&&f&&l(f),fs(()=>{if(!c)return;const h=o==null?void 0:o.key,m=o==null?void 0:o.props.id;if(h==null||m==null){l(null);return}Promise.resolve(n(m,c)).then(()=>{l(null)})},[n,o,c]),ct.createElement(ct.Fragment,null,r,o?y.cloneElement(o,{ref:d}):null)}const xb={x:0,y:0,scaleX:1,scaleY:1};function wb(e){let{children:n}=e;return ct.createElement(qi.Provider,{value:hy},ct.createElement(oc.Provider,{value:xb},n))}const kb={position:"fixed",touchAction:"none"},Sb=e=>nc(e)?"transform 250ms ease":void 0,bb=y.forwardRef((e,n)=>{let{as:r,activatorEvent:o,adjustScale:l,children:c,className:d,rect:f,style:h,transform:m,transition:v=Sb}=e;if(!f)return null;const k=l?m:{...m,scaleX:1,scaleY:1},x={...kb,width:f.width,height:f.height,top:f.top,left:f.left,transform:Es.Transform.toString(k),transformOrigin:l&&o?gS(o,f):void 0,transition:typeof v=="function"?v(o):v,...h};return ct.createElement(r,{className:d,style:x,ref:n},c)}),Nb=e=>n=>{let{active:r,dragOverlay:o}=n;const l={},{styles:c,className:d}=e;if(c!=null&&c.active)for(const[f,h]of Object.entries(c.active))h!==void 0&&(l[f]=r.node.style.getPropertyValue(f),r.node.style.setProperty(f,h));if(c!=null&&c.dragOverlay)for(const[f,h]of Object.entries(c.dragOverlay))h!==void 0&&o.node.style.setProperty(f,h);return d!=null&&d.active&&r.node.classList.add(d.active),d!=null&&d.dragOverlay&&o.node.classList.add(d.dragOverlay),function(){for(const[h,m]of Object.entries(l))r.node.style.setProperty(h,m);d!=null&&d.active&&r.node.classList.remove(d.active)}},Tb=e=>{let{transform:{initial:n,final:r}}=e;return[{transform:Es.Transform.toString(n)},{transform:Es.Transform.toString(r)}]},Cb={duration:250,easing:"ease",keyframes:Tb,sideEffects:Nb({styles:{active:{opacity:"0"}}})};function Eb(e){let{config:n,draggableNodes:r,droppableContainers:o,measuringConfiguration:l}=e;return tc((c,d)=>{if(n===null)return;const f=r.get(c);if(!f)return;const h=f.node.current;if(!h)return;const m=py(d);if(!m)return;const{transform:v}=Cn(d).getComputedStyle(d),k=ny(v);if(!k)return;const x=typeof n=="function"?n:jb(n);return cy(h,l.draggable.measure),x({active:{id:c,data:f.data,node:h,rect:l.draggable.measure(h)},draggableNodes:r,dragOverlay:{node:d,rect:l.dragOverlay.measure(m)},droppableContainers:o,measuringConfiguration:l,transform:k})})}function jb(e){const{duration:n,easing:r,sideEffects:o,keyframes:l}={...Cb,...e};return c=>{let{active:d,dragOverlay:f,transform:h,...m}=c;if(!n)return;const v={x:f.rect.left-d.rect.left,y:f.rect.top-d.rect.top},k={scaleX:h.scaleX!==1?d.rect.width*h.scaleX/f.rect.width:1,scaleY:h.scaleY!==1?d.rect.height*h.scaleY/f.rect.height:1},x={x:h.x-v.x,y:h.y-v.y,...k},S=l({...m,active:d,dragOverlay:f,transform:{initial:h,final:x}}),[C]=S,T=S[S.length-1];if(JSON.stringify(C)===JSON.stringify(T))return;const E=o==null?void 0:o({active:d,dragOverlay:f,...m}),b=f.node.animate(S,{duration:n,easing:r,fill:"forwards"});return new Promise(j=>{b.onfinish=()=>{E==null||E(),j()}})}}let Gm=0;function _b(e){return y.useMemo(()=>{if(e!=null)return Gm++,Gm},[e])}const Rb=ct.memo(e=>{let{adjustScale:n=!1,children:r,dropAnimation:o,style:l,transition:c,modifiers:d,wrapperElement:f="div",className:h,zIndex:m=999}=e;const{activatorEvent:v,active:k,activeNodeRect:x,containerNodeRect:S,draggableNodes:C,droppableContainers:T,dragOverlay:E,over:b,measuringConfiguration:j,scrollableAncestors:P,scrollableAncestorRects:M,windowRect:L}=yy(),G=y.useContext(oc),z=_b(k==null?void 0:k.id),U=gy(d,{activatorEvent:v,active:k,activeNodeRect:x,containerNodeRect:S,draggingNodeRect:E.rect,over:b,overlayNodeRect:E.rect,scrollableAncestors:P,scrollableAncestorRects:M,transform:G,windowRect:L}),Q=uf(x),J=Eb({config:o,draggableNodes:C,droppableContainers:T,measuringConfiguration:j}),oe=Q?E.setRef:void 0;return ct.createElement(wb,null,ct.createElement(yb,{animation:J},k&&z?ct.createElement(bb,{key:z,id:k.id,ref:oe,as:f,activatorEvent:v,adjustScale:n,className:h,transition:c,rect:Q,style:{zIndex:m,...l},transform:U},r):null))});function wy(e,n,r){const o=e.slice();return o.splice(r<0?o.length+r:r,0,o.splice(n,1)[0]),o}function Ab(e,n){return e.reduce((r,o,l)=>{const c=n.get(o);return c&&(r[l]=c),r},Array(e.length))}function tl(e){return e!==null&&e>=0}function Ib(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}function Db(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const nl={scaleX:1,scaleY:1},Mb=e=>{var n;let{rects:r,activeNodeRect:o,activeIndex:l,overIndex:c,index:d}=e;const f=(n=r[l])!=null?n:o;if(!f)return null;const h=Lb(r,d,l);if(d===l){const m=r[c];return m?{x:l<c?m.left+m.width-(f.left+f.width):m.left-f.left,y:0,...nl}:null}return d>l&&d<=c?{x:-f.width-h,y:0,...nl}:d<l&&d>=c?{x:f.width+h,y:0,...nl}:{x:0,y:0,...nl}};function Lb(e,n,r){const o=e[n],l=e[n-1],c=e[n+1];return!o||!l&&!c?0:r<n?l?o.left-(l.left+l.width):c.left-(o.left+o.width):c?c.left-(o.left+o.width):o.left-(l.left+l.width)}const ky=e=>{let{rects:n,activeIndex:r,overIndex:o,index:l}=e;const c=wy(n,o,r),d=n[l],f=c[l];return!f||!d?null:{x:f.left-d.left,y:f.top-d.top,scaleX:f.width/d.width,scaleY:f.height/d.height}},sl={scaleX:1,scaleY:1},qm=e=>{var n;let{activeIndex:r,activeNodeRect:o,index:l,rects:c,overIndex:d}=e;const f=(n=c[r])!=null?n:o;if(!f)return null;if(l===r){const m=c[d];return m?{x:0,y:r<d?m.top+m.height-(f.top+f.height):m.top-f.top,...sl}:null}const h=Ob(c,l,r);return l>r&&l<=d?{x:0,y:-f.height-h,...sl}:l<r&&l>=d?{x:0,y:f.height+h,...sl}:{x:0,y:0,...sl}};function Ob(e,n,r){const o=e[n],l=e[n-1],c=e[n+1];return o?r<n?l?o.top-(l.top+l.height):c?c.top-(o.top+o.height):0:c?c.top-(o.top+o.height):l?o.top-(l.top+l.height):0:0}const Sy="Sortable",by=ct.createContext({activeIndex:-1,containerId:Sy,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:ky,disabled:{draggable:!1,droppable:!1}});function Td(e){let{children:n,id:r,items:o,strategy:l=ky,disabled:c=!1}=e;const{active:d,dragOverlay:f,droppableRects:h,over:m,measureDroppableContainers:v}=yy(),k=Gi(Sy,r),x=f.rect!==null,S=y.useMemo(()=>o.map(G=>typeof G=="object"&&"id"in G?G.id:G),[o]),C=d!=null,T=d?S.indexOf(d.id):-1,E=m?S.indexOf(m.id):-1,b=y.useRef(S),j=!Ib(S,b.current),P=E!==-1&&T===-1||j,M=Db(c);fs(()=>{j&&C&&v(S)},[j,S,C,v]),y.useEffect(()=>{b.current=S},[S]);const L=y.useMemo(()=>({activeIndex:T,containerId:k,disabled:M,disableTransforms:P,items:S,overIndex:E,useDragOverlay:x,sortedRects:Ab(S,h),strategy:l}),[T,k,M.draggable,M.droppable,P,S,E,h,x,l]);return ct.createElement(by.Provider,{value:L},n)}const $b=e=>{let{id:n,items:r,activeIndex:o,overIndex:l}=e;return wy(r,o,l).indexOf(n)},Pb=e=>{let{containerId:n,isSorting:r,wasDragging:o,index:l,items:c,newIndex:d,previousItems:f,previousContainerId:h,transition:m}=e;return!m||!o||f!==c&&l===d?!1:r?!0:d!==l&&n===h},zb={duration:200,easing:"ease"},Ny="transform",Fb=Es.Transition.toString({property:Ny,duration:0,easing:"linear"}),Ub={roleDescription:"sortable"};function Bb(e){let{disabled:n,index:r,node:o,rect:l}=e;const[c,d]=y.useState(null),f=y.useRef(r);return fs(()=>{if(!n&&r!==f.current&&o.current){const h=l.current;if(h){const m=Oo(o.current,{ignoreTransform:!0}),v={x:h.left-m.left,y:h.top-m.top,scaleX:h.width/m.width,scaleY:h.height/m.height};(v.x||v.y)&&d(v)}}r!==f.current&&(f.current=r)},[n,r,o,l]),y.useEffect(()=>{c&&d(null)},[c]),c}function df(e){let{animateLayoutChanges:n=Pb,attributes:r,disabled:o,data:l,getNewIndex:c=$b,id:d,strategy:f,resizeObserverConfig:h,transition:m=zb}=e;const{items:v,containerId:k,activeIndex:x,disabled:S,disableTransforms:C,sortedRects:T,overIndex:E,useDragOverlay:b,strategy:j}=y.useContext(by),P=Wb(o,S),M=v.indexOf(d),L=y.useMemo(()=>({sortable:{containerId:k,index:M,items:v},...l}),[k,l,M,v]),G=y.useMemo(()=>v.slice(v.indexOf(d)),[v,d]),{rect:z,node:U,isOver:Q,setNodeRef:J}=xy({id:d,data:L,disabled:P.droppable,resizeObserverConfig:{updateMeasurementsFor:G,...h}}),{active:oe,activatorEvent:me,activeNodeRect:Se,attributes:Me,setNodeRef:ee,listeners:ie,isDragging:te,over:F,setActivatorNodeRef:Z,transform:q}=mb({id:d,data:L,attributes:{...Ub,...r},disabled:P.draggable}),I=tS(J,ee),$=!!oe,ue=$&&!C&&tl(x)&&tl(E),B=!b&&te,X=B&&ue?q:null,be=ue?X??(f??j)({rects:T,activeNodeRect:Se,activeIndex:x,overIndex:E,index:M}):null,_e=tl(x)&&tl(E)?c({id:d,items:v,activeIndex:x,overIndex:E}):M,Ae=oe==null?void 0:oe.id,je=y.useRef({activeId:Ae,items:v,newIndex:_e,containerId:k}),ge=v!==je.current.items,he=n({active:oe,containerId:k,isDragging:te,isSorting:$,id:d,index:M,items:v,newIndex:je.current.newIndex,previousItems:je.current.items,previousContainerId:je.current.containerId,transition:m,wasDragging:je.current.activeId!=null}),Ve=Bb({disabled:!he,index:M,node:U,rect:z});return y.useEffect(()=>{$&&je.current.newIndex!==_e&&(je.current.newIndex=_e),k!==je.current.containerId&&(je.current.containerId=k),v!==je.current.items&&(je.current.items=v)},[$,_e,k,v]),y.useEffect(()=>{if(Ae===je.current.activeId)return;if(Ae!=null&&je.current.activeId==null){je.current.activeId=Ae;return}const mt=setTimeout(()=>{je.current.activeId=Ae},50);return()=>clearTimeout(mt)},[Ae]),{active:oe,activeIndex:x,attributes:Me,data:L,rect:z,index:M,newIndex:_e,items:v,isOver:Q,isSorting:$,isDragging:te,listeners:ie,node:U,overIndex:E,over:F,setNodeRef:I,setActivatorNodeRef:Z,setDroppableNodeRef:J,setDraggableNodeRef:ee,transform:Ve??be,transition:Ie()};function Ie(){if(Ve||ge&&je.current.newIndex===M)return Fb;if(!(B&&!nc(me)||!m)&&($||he))return Es.Transition.toString({...m,property:Ny})}}function Wb(e,n){var r,o;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:n.draggable,droppable:(o=e==null?void 0:e.droppable)!=null?o:n.droppable}}nt.Down,nt.Right,nt.Up,nt.Left;function rl(e){const[n,r]=y.useState(()=>{try{const l=localStorage.getItem(e);if(l==null)return new Set;const c=JSON.parse(l);return Array.isArray(c)?new Set(c.filter(d=>typeof d=="string")):new Set}catch{return new Set}}),o=y.useCallback(l=>{r(c=>{const d=l(new Set(c));try{localStorage.setItem(e,JSON.stringify([...d]))}catch{}return d})},[e]);return[n,o]}function Hb(e,n=!1){const[r,o]=y.useState(()=>{try{const c=localStorage.getItem(e);return c==="1"?!0:c==="0"?!1:n}catch{return n}}),l=y.useCallback(c=>{o(c);try{localStorage.setItem(e,c?"1":"0")}catch{}},[e]);return[r,l]}async function Fi(e){try{return await navigator.clipboard.writeText(e),!0}catch{try{const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select();const r=document.execCommand("copy");return document.body.removeChild(n),r}catch{return!1}}}function Vb(e){return e.origin_app_id!=null&&!e.user_touched&&!e.starred}const Cd="(no directory)";function gr(e){return e.replaceAll("\\","/").replace(/\/+$/,"")}function Ed(e,n){if(!n||!e.cwd)return!1;const r=gr(e.cwd),o=gr(n);return r.startsWith(`${o}/`)}function Kb(e,n){const r=new Map;for(const d of n){const f=d.cwd||Cd,h=r.get(f)??[];h.push(d),r.set(f,h)}const o=new Set,l=new Set(e.filter(d=>d.deleted===1).map(d=>d.path)),c=[];for(const d of e){if(d.deleted===1){o.add(d.path);continue}o.add(d.path),c.push({path:d.path,label:d.label||d.path.split("/").pop()||d.path,sessions:r.get(d.path)??[],workspace:d})}for(const[d,f]of r)o.has(d)||l.has(d)||c.push({path:d,label:d===Cd?"Other":d.split("/").pop()||d,sessions:f,workspace:null});return c}function Gb(e,n,r){if(n.length===0)return!1;const o=new Set(e.filter(l=>l.deleted===1).map(l=>l.path));return n.some(l=>!Ed(l,r)&&!o.has(l.cwd||Cd))}function $l(e){return[...e].sort((n,r)=>r.sort_order-n.sort_order||(n.created_at<r.created_at?1:-1))}function Xm(e,n,r,o){const l=n.map(c=>({folder:c,sessions:e.sessions.filter(d=>d.folder_id===c.id),finishedKey:`folder:${c.id}:finished`,hidden:o.has(c.id)}));return l.push({folder:null,sessions:e.sessions.filter(c=>!(c.folder_id&&r.has(c.folder_id))),finishedKey:`${e.path}:finished`,hidden:!1}),l}function Ym(e,n){return{working:$l(e.sessions.filter(r=>r.lifecycle!=="finished")),finished:$l(e.sessions.filter(r=>r.lifecycle==="finished")),finishedCollapsed:n.has(e.finishedKey)}}function ol(e,n){return e.folder_id&&n.has(e.folder_id)?e.folder_id:null}function qb(e){const n=new Set(e.map(o=>o.name));if(!n.has("New Folder"))return"New Folder";let r=2;for(;n.has(`New Folder ${r}`);)r++;return`New Folder ${r}`}function Qm({id:e,children:n,className:r}){const{setNodeRef:o,isOver:l}=xy({id:e});return a.jsx("div",{ref:o,className:`${r??""}${l?" drop-over":""}`,children:n})}function ff({inputRef:e,value:n,onChange:r,onConfirm:o,onCancel:l}){return a.jsx("input",{ref:e,className:"tree-rename-input",value:n,onChange:c=>r(c.target.value),onClick:c=>c.stopPropagation(),onPointerDown:c=>c.stopPropagation(),onKeyDown:c=>{c.key==="Enter"&&o(),c.key==="Escape"&&l()},onBlur:o})}function Xb({s:e,backgroundTaskCount:n,isActive:r,isSelected:o,originApp:l,renaming:c,renameValue:d,renameRef:f,onRenameValue:h,onRenameConfirm:m,onRenameCancel:v,onSelect:k,onCtxMenu:x,onToggleStar:S}){const{attributes:C,listeners:T,setNodeRef:E,transform:b,transition:j,isDragging:P}=df({id:`s:${e.id}`}),M=Yl(e,n);return a.jsxs("div",{ref:E,style:{transform:Es.Transform.toString(b),transition:j},className:`tree-item ${r?"active":""}${o?" selected":""} ${M.isFinished?"tree-item-finished":""}${P?" dragging":""}${e.starred?" tree-item-starred":""}`,...C,...T,onClick:k,onContextMenu:x,children:[a.jsx(sf,{iconClass:M.iconClass,iconText:M.iconText,size:16}),l&&a.jsx("span",{className:"tree-app-badge",title:"Created by a mini app",children:a.jsx(Do,{iconNode:l.iconNode,size:10})}),c?a.jsx(ff,{inputRef:f,value:d,onChange:h,onConfirm:m,onCancel:v}):a.jsx("span",{className:"tree-label",children:e.title||e.id.slice(0,8)}),!c&&a.jsx("button",{className:`star-btn${e.starred?" starred":""}`,title:e.starred?"Unstar session":"Star session",onClick:L=>{L.stopPropagation(),S()},onPointerDown:L=>L.stopPropagation(),children:a.jsx(Rl,{size:10,fill:e.starred?"currentColor":"none"})}),M.dot&&a.jsx(nf,{status:M.dot,title:M.dotTitle})]})}function Yb({folder:e,count:n,collapsed:r,renaming:o,renameValue:l,renameRef:c,onRenameValue:d,onRenameConfirm:f,onRenameCancel:h,onToggle:m,onCtxMenu:v,children:k}){const{attributes:x,listeners:S,setNodeRef:C,transform:T,transition:E,isDragging:b,over:j}=df({id:`f:${e.id}`}),P=j!=null&&String(j.id).startsWith("s:");return a.jsxs("div",{ref:C,style:{transform:Es.Transform.toString(T),transition:E},className:`tree-folder ${r?"collapsed":""}${b?" dragging":""}`,children:[a.jsx("div",{className:`tree-folder-header${P?" drop-over":""}`,...x,...S,onClick:()=>{o||m()},onContextMenu:v,children:o?a.jsx(ff,{inputRef:c,value:l,onChange:d,onConfirm:f,onCancel:h}):a.jsxs(a.Fragment,{children:[a.jsx(_o,{size:8,className:"tree-chevron"}),a.jsx(_l,{size:12}),a.jsx("span",{className:"tree-folder-label",children:e.name}),a.jsx("span",{className:"tree-count",children:n})]})}),!r&&a.jsx("div",{className:"tree-folder-children",children:k})]})}function Qb(){const e=A(R=>R.sessions),n=A(R=>R.backgroundTasks),r=A(R=>R.workspaces),o=A(R=>R.folders),l=A(R=>R.activeSessionId),c=A(R=>R.selectSession),d=A(R=>R.deleteSession),f=A(R=>R.removeWorkspace),h=A(R=>R.createSessionInWorkspace),m=A(R=>R.pickAndAddWorkspace),v=A(R=>R.setImportSessionsWorkspace),k=A(R=>R.renameSession),x=A(R=>R.markFinished),S=A(R=>R.markFinishedMany),C=A(R=>R.toggleStar),T=A(R=>R.reopenSession),E=A(R=>R.reopenSessionMany),b=A(R=>R.deleteSessionMany),j=A(R=>R.createSidebarFolder),P=A(R=>R.renameFolder),M=A(R=>R.deleteFolder),L=A(R=>R.applyMoves),G=A(R=>R.reorderFolders),z=A(R=>R.apps),U=A(R=>R.appsRootPath),Q=A(R=>R.activeAppTabId),J=A(R=>R.openAppTab),oe=A(R=>R.startAppEdit),me=A(R=>R.toggleAppPin),Se=A(R=>R.deleteApp),Me=A(R=>R.openAppCatalog),[ee,ie]=rl("agentpane:sidebar-ws-collapsed"),[te,F]=rl("agentpane:sidebar-sub-collapsed"),[Z,q]=rl("agentpane:sidebar-folders-collapsed"),[I,$]=rl("agentpane:sidebar-app-edits-collapsed"),[ue,B]=Hb("agentpane:sidebar-hide-auto-sessions"),[X,ce]=y.useState(null),[be,_e]=y.useState(null),[Ae,je]=y.useState(""),[ge,he]=y.useState(null),[Ve,Ie]=y.useState(new Set),[mt,Ue]=y.useState(null),Vt=y.useRef(null),tn=y.useRef(null),St=y.useRef(null),jt=y.useRef(!1),Ft=Jv(Zv(sc,{activationConstraint:{distance:5}}));function Ot(){Ie(new Set),Ue(null)}Wi(Vt,()=>ce(null),!!X),Io(()=>{ce(null),Ot()},!!X||Ve.size>0),y.useLayoutEffect(()=>{const R=Vt.current;if(!X||!R)return;const pe=8,{offsetWidth:le,offsetHeight:we}=R,$e=X.x+le>window.innerWidth-pe?Math.max(pe,X.x-le):X.x,qe=X.y+we>window.innerHeight-pe?Math.max(pe,X.y-we):X.y;R.style.left=`${$e}px`,R.style.top=`${qe}px`},[X]);const Y=y.useMemo(()=>new Map(e.map(R=>[R.id,R])),[e]),ve=y.useMemo(()=>new Map(o.map(R=>[R.id,R])),[o]),Be=y.useMemo(()=>{const R=new Map;for(const pe of[...o].sort((le,we)=>le.sort_order-we.sort_order)){const le=R.get(pe.workspace_path)??[];le.push(pe),R.set(pe.workspace_path,le)}return R},[o]);function rt(R){ie(pe=>{const le=new Set(pe);return le.has(R)?le.delete(R):le.add(R),le})}function gt(R){F(pe=>{const le=new Set(pe);return le.has(R)?le.delete(R):le.add(R),le})}function vt(R){q(pe=>{const le=new Set(pe);return le.has(R)?le.delete(R):le.add(R),le})}function _t(){B(!ue),Ot()}function an(R){$(pe=>{const le=new Set(pe);return le.has(R)?le.delete(R):le.add(R),le})}y.useEffect(()=>{be&&tn.current&&(tn.current.focus(),tn.current.select())},[be]),y.useEffect(()=>{var R,pe,le;jt.current||!l||(jt.current=!0,(le=(pe=(R=St.current)==null?void 0:R.querySelector(".tree-item.active, .sidebar-app-edit-row.active"))==null?void 0:pe.scrollIntoView)==null||le.call(pe,{block:"nearest"}))},[l]);function dt(R,pe,le,we=""){_e({kind:R,id:pe}),je(le||we)}function Mn(){if(be){const R=Ae.trim();R&&(be.kind==="session"?k(be.id,R):P(be.id,R))}_e(null)}function Ln(){_e(null),je("")}async function hs(R){const pe=qb(Be.get(R)??[]),le=await j(R,pe);le&&dt("folder",le.id,le.name)}function ms(R){const pe=String(R.active.id);if(pe.startsWith("s:")){const le=Y.get(pe.slice(2));le&&he({kind:"session",label:le.title||le.id.slice(0,8)})}else if(pe.startsWith("f:")){const le=ve.get(pe.slice(2));le&&he({kind:"folder",label:le.name})}}function ns(R){he(null);const{active:pe,over:le}=R;if(!le)return;const we=String(pe.id),$e=String(le.id);if(we.startsWith("s:")){const qe=Y.get(we.slice(2));if(!qe)return;const Pe=qe.cwd||"(no directory)",Ut=ol(qe,ve);let $n,We;if($e.startsWith("f:")){const Je=ve.get($e.slice(2));if(!Je)return;$n=Je.workspace_path,We=Je.id}else if($e.startsWith("s:")){const Je=Y.get($e.slice(2));if(!Je)return;$n=Je.cwd||"(no directory)",We=ol(Je,ve)}else if($e.startsWith("c:")){const Je=$e.slice(2),At=Je.lastIndexOf("|");$n=Je.slice(0,At);const vs=Je.slice(At+1);We=vs==="root"?null:vs}else return;if($n!==Pe)return;const yn=$l(e.filter(Je=>(Je.cwd||"(no directory)")===$n&&ol(Je,ve)===We)),js=yn.filter(Je=>Je.id!==qe.id);let Bs=js.length;if($e.startsWith("s:")){const Je=js.findIndex(At=>At.id===$e.slice(2));Je>=0&&(Bs=Je)}const Pn=[...js.slice(0,Bs),qe,...js.slice(Bs)],gs=[];if(We===Ut){if(Pn.length===yn.length&&Pn.every((Je,At)=>Je.id===yn[At].id))return;Pn.forEach((Je,At)=>gs.push({id:Je.id,folder_id:We,sort_order:Pn.length-1-At}))}else{const Je=$l(e.filter(At=>(At.cwd||"(no directory)")===Pe&&ol(At,ve)===Ut)).filter(At=>At.id!==qe.id);Je.forEach((At,vs)=>gs.push({id:At.id,folder_id:Ut,sort_order:Je.length-1-vs})),Pn.forEach((At,vs)=>gs.push({id:At.id,folder_id:We,sort_order:Pn.length-1-vs}))}L(gs);return}if(we.startsWith("f:")){if(!$e.startsWith("f:"))return;const qe=ve.get(we.slice(2)),Pe=ve.get($e.slice(2));if(!qe||!Pe||qe.id===Pe.id||qe.workspace_path!==Pe.workspace_path)return;const Ut=(Be.get(qe.workspace_path)??[]).map(yn=>yn.id),$n=Ut.indexOf(qe.id),We=Ut.indexOf(Pe.id);Ut.splice(We,0,...Ut.splice($n,1)),G(Ut)}}const On=U?e.filter(R=>!Ed(R,U)):e,gn=new Set(ue?On.filter(R=>Vb(R)&&R.id!==l).map(R=>R.id):[]),ln=Kb(r,gn.size>0?On.filter(R=>!gn.has(R.id)):On),Kt=y.useMemo(()=>{const R=new Map;if(!U)return R;const pe=gr(U);for(const le of e){if(!Ed(le,U))continue;const we=gr(le.cwd).slice(pe.length+1).split("/")[0],$e=R.get(we)??[];$e.push(le),R.set(we,$e)}return R},[e,U]);function vn(R){return{folder:null,sessions:Kt.get(R)??[],finishedKey:`app:${R}:finished`,hidden:I.has(R)}}const Ze=[],Rt=R=>{if(R.hidden)return;const{working:pe,finished:le,finishedCollapsed:we}=Ym(R,te);Ze.push(...pe.map($e=>$e.id)),we||Ze.push(...le.map($e=>$e.id))};for(const R of ln){if(ee.has(R.path))continue;const pe=Be.get(R.path)??[],le=new Set(pe.map(we=>we.id));Xm(R,pe,le,Z).forEach(Rt)}z.forEach(R=>Rt(vn(R.id)));const ft=e.filter(R=>Ve.has(R.id)),Gt=ft.filter(R=>R.lifecycle!=="finished").map(R=>R.id),yt=ft.filter(R=>R.lifecycle==="finished").map(R=>R.id);function xt(R,pe){if(pe.metaKey||pe.ctrlKey){pe.preventDefault(),Ue(R.id),Ie(le=>{const we=new Set(le);return we.has(R.id)?we.delete(R.id):we.add(R.id),we});return}if(pe.shiftKey){pe.preventDefault();const le=mt??R.id;Ue(le);const we=Ze.indexOf(le),$e=Ze.indexOf(R.id);if(we>=0&&$e>=0){const[qe,Pe]=we<$e?[we,$e]:[$e,we];Ie(new Set(Ze.slice(qe,Pe+1)))}return}Ot(),Ue(R.id),c(R.id)}function lt(R,pe){pe.preventDefault();const le=Ve.has(R.id)&&Ve.size>1;Ve.has(R.id)||(Ie(new Set),Ue(R.id)),ce({x:pe.clientX,y:pe.clientY,type:"session",sessionId:R.id,sessionTitle:R.title,sessionLifecycle:R.lifecycle,sessionExternalId:R.external_thread_id,multi:le})}function qt(R){var le;const pe=R.origin_app_id?z.find(we=>we.id===R.origin_app_id):null;return a.jsx(Xb,{s:R,backgroundTaskCount:((le=n[R.id])==null?void 0:le.length)??0,isActive:l===R.id,isSelected:Ve.has(R.id),originApp:pe??null,renaming:(be==null?void 0:be.kind)==="session"&&be.id===R.id,renameValue:Ae,renameRef:tn,onRenameValue:je,onRenameConfirm:Mn,onRenameCancel:Ln,onSelect:we=>xt(R,we),onToggleStar:()=>C(R.id),onCtxMenu:we=>lt(R,we)},R.id)}function it(R){var le;const pe=Yl(R,((le=n[R.id])==null?void 0:le.length)??0);return a.jsxs("div",{className:`sidebar-app-edit-row${l===R.id?" active":""}${Ve.has(R.id)?" selected":""}${pe.isFinished?" tree-item-finished":""}`,title:"App edit session — click to open",onClick:we=>xt(R,we),onContextMenu:we=>lt(R,we),children:[a.jsx(sf,{iconClass:pe.iconClass,iconText:pe.iconText,size:14}),(be==null?void 0:be.kind)==="session"&&be.id===R.id?a.jsx(ff,{inputRef:tn,value:Ae,onChange:je,onConfirm:Mn,onCancel:Ln}):a.jsx("span",{className:"tree-label",children:R.title||R.id.slice(0,8)}),pe.dot&&a.jsx(nf,{status:pe.dot,title:pe.dotTitle})]},R.id)}function $t(R,pe="workspace"){const{working:le,finished:we,finishedCollapsed:$e}=Ym(R,te),qe=pe==="workspace"?qt:it,Pe=a.jsxs(a.Fragment,{children:[le.length===0&&we.length===0?a.jsx("div",{className:"tree-empty",children:"No sessions"}):le.map(qe),we.length>0&&a.jsxs("div",{className:`tree-subgroup ${$e?"collapsed":""}`,children:[a.jsxs("div",{className:"tree-subgroup-header",onClick:()=>gt(R.finishedKey),children:[a.jsx(_o,{size:8,className:"tree-chevron"}),a.jsx("span",{className:"tree-subgroup-label",children:"Finished"}),a.jsx("span",{className:"tree-subgroup-count",children:we.length})]}),!$e&&a.jsx("div",{className:"tree-subgroup-items",children:we.map(qe)})]})]});if(pe==="app")return Pe;const Ut=[...le,...we].map($n=>`s:${$n.id}`);return a.jsx(Td,{items:Ut,strategy:qm,children:Pe})}return a.jsxs("div",{className:"ide-sidebar",ref:St,children:[a.jsxs("div",{className:"sidebar-header",children:[a.jsx("span",{className:"sidebar-header-title",children:"Workspaces"}),a.jsxs("div",{className:"sidebar-header-actions",children:[a.jsx("button",{className:`sidebar-add sidebar-filter${ue?" active":""}`,title:ue?`Show automatic sessions (${gn.size} hidden)`:"Hide automatic sessions — the ones mini apps run on their own. Sessions you message, stop, rewind, rename or star stay visible.","aria-label":ue?"Show automatic sessions":"Hide automatic sessions","aria-pressed":ue,onClick:_t,children:ue?a.jsx(g1,{size:14}):a.jsx(vr,{size:14})}),a.jsx("button",{className:"sidebar-add",title:"Add workspace",onClick:()=>m(),children:a.jsx(pr,{size:14})})]})]}),a.jsxs(vy,{sensors:Ft,collisionDetection:ey,onDragStart:ms,onDragEnd:ns,children:[ln.length===0?a.jsx("div",{className:"empty-state",style:{padding:"16px"},children:"No workspaces yet. Click + to add one."}):ln.map(R=>{const pe=ee.has(R.path),le=Be.get(R.path)??[],we=new Set(le.map(Pe=>Pe.id)),$e=Xm(R,le,we,Z),qe=$e[$e.length-1];return a.jsxs("div",{className:`tree-section ${pe?"collapsed":""}`,children:[a.jsxs("div",{className:"tree-section-header",onClick:()=>rt(R.path),onContextMenu:Pe=>{Pe.preventDefault(),ce({x:Pe.clientX,y:Pe.clientY,type:"workspace",path:R.path})},children:[a.jsx(_o,{size:9,className:"tree-chevron"}),a.jsx(_l,{size:14}),a.jsx("span",{className:"tree-section-label",children:R.label}),a.jsx("button",{className:"tree-section-add",title:"New session in this workspace",onClick:Pe=>{Pe.stopPropagation(),h(R.path)},children:a.jsx(pr,{size:11})}),a.jsx("button",{className:"tree-section-add",title:"New folder in this workspace",onClick:Pe=>{Pe.stopPropagation(),hs(R.path)},children:a.jsx(td,{size:11})}),a.jsx("span",{className:"tree-count",children:R.sessions.length})]}),!pe&&a.jsxs("div",{className:"tree-children",children:[a.jsx(Td,{items:le.map(Pe=>`f:${Pe.id}`),strategy:qm,children:$e.filter(Pe=>Pe.folder).map(Pe=>a.jsx(Yb,{folder:Pe.folder,count:Pe.sessions.length,collapsed:Pe.hidden,renaming:(be==null?void 0:be.kind)==="folder"&&be.id===Pe.folder.id,renameValue:Ae,renameRef:tn,onRenameValue:je,onRenameConfirm:Mn,onRenameCancel:Ln,onToggle:()=>vt(Pe.folder.id),onCtxMenu:Ut=>{Ut.preventDefault(),ce({x:Ut.clientX,y:Ut.clientY,type:"folder",folderId:Pe.folder.id,folderName:Pe.folder.name})},children:a.jsx(Qm,{id:`c:${R.path}|${Pe.folder.id}`,children:$t(Pe)})},Pe.folder.id))}),a.jsx(Qm,{id:`c:${R.path}|root`,children:$t(qe)})]})]},R.path)}),a.jsx(Rb,{children:ge&&a.jsxs("div",{className:"drag-overlay",children:[ge.kind==="folder"&&a.jsx(_l,{size:12}),a.jsx("span",{children:ge.label})]})})]}),a.jsxs("div",{className:"sidebar-apps",children:[a.jsxs("div",{className:"sidebar-header sidebar-apps-header",children:[a.jsx("span",{className:"sidebar-header-title",children:"Apps"}),a.jsx("button",{className:"sidebar-add",title:"Add mini app",onClick:()=>Me(),children:a.jsx(pr,{size:14})})]}),z.length===0&&a.jsx("div",{className:"tree-empty",children:"No apps yet"}),z.map(R=>{const pe=vn(R.id),le=pe.sessions.length>0&&!pe.hidden;return a.jsxs("div",{className:"sidebar-app-block",children:[a.jsxs("div",{className:`sidebar-app-row${Q===R.id?" active":""}`,title:R.description??void 0,onClick:()=>J(R.id),onContextMenu:we=>{we.preventDefault(),ce({x:we.clientX,y:we.clientY,type:"app",appId:R.id,appPinned:R.pinned})},children:[pe.sessions.length>0&&a.jsx("button",{className:`sidebar-app-chevron${le?"":" closed"}`,title:"Edit sessions of this app",onClick:we=>{we.stopPropagation(),an(R.id)},children:a.jsx(_o,{size:10,className:"tree-chevron"})}),a.jsx(Do,{iconNode:R.iconNode,size:14,className:"sidebar-app-icon"}),a.jsx("span",{className:"tree-label",children:R.title}),pe.sessions.length>0&&a.jsx("span",{className:"sidebar-app-count",children:pe.sessions.length}),R.pinned&&a.jsx(Rl,{size:10,className:"sidebar-app-pin",fill:"currentColor"})]}),le&&a.jsx("div",{className:"sidebar-app-edits",children:$t(pe,"app")})]},R.id)})]}),a.jsxs("div",{className:"sidebar-footer",onClick:()=>m(),children:[a.jsx(td,{size:14}),a.jsx("span",{children:"Add workspace"})]}),X&&a.jsxs("div",{ref:Vt,className:"ctx-menu",style:{position:"fixed",left:X.x,top:X.y,zIndex:500},children:[X.type==="workspace"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{h(X.path),ce(null)},children:[a.jsx(pr,{size:12})," New Session"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{hs(X.path),ce(null)},children:[a.jsx(td,{size:12})," New Folder"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{v(X.path),ce(null)},children:[a.jsx(Fv,{size:12})," Import Sessions…"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{f(X.path),ce(null)},children:[a.jsx(us,{size:12})," Hide Workspace"]})]}),X.type==="folder"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{dt("folder",X.folderId,X.folderName??""),ce(null)},children:[a.jsx(hl,{size:12})," Rename Folder"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{M(X.folderId),ce(null)},children:[a.jsx(us,{size:12})," Delete Folder"]})]}),X.type==="session"&&!X.multi&&a.jsx(a.Fragment,{children:X.sessionLifecycle!=="finished"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{dt("session",X.sessionId,X.sessionTitle??""),ce(null)},children:[a.jsx(hl,{size:12})," Rename"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{x(X.sessionId),ce(null)},children:[a.jsx(jl,{size:12})," Mark as Finished"]}),a.jsxs("div",{className:`ctx-menu-item${X.sessionExternalId?"":" ctx-disabled"}`,title:X.sessionExternalId?void 0:"Session not started",onClick:()=>{X.sessionExternalId&&(Fi(X.sessionExternalId),ce(null))},children:[a.jsx(Oi,{size:12})," Copy Session ID"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{d(X.sessionId),ce(null)},children:[a.jsx(us,{size:12})," Delete Session"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{T(X.sessionId),ce(null)},children:[a.jsx($i,{size:12})," Reopen"]}),a.jsxs("div",{className:`ctx-menu-item${X.sessionExternalId?"":" ctx-disabled"}`,title:X.sessionExternalId?void 0:"Session not started",onClick:()=>{X.sessionExternalId&&(Fi(X.sessionExternalId),ce(null))},children:[a.jsx(Oi,{size:12})," Copy Session ID"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{d(X.sessionId),ce(null)},children:[a.jsx(us,{size:12})," Delete Session"]})]})}),X.type==="session"&&X.multi&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-header",children:[ft.length," sessions selected"]}),Gt.length>0&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{S(Gt),ce(null),Ot()},children:[a.jsx(jl,{size:12})," Mark ",Gt.length," as Finished"]}),yt.length>0&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{E(yt),ce(null),Ot()},children:[a.jsx($i,{size:12})," Reopen ",yt.length]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{b([...Ve]),ce(null),Ot()},children:[a.jsx(us,{size:12})," Delete ",ft.length," Sessions"]})]}),X.type==="app"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{oe(X.appId),ce(null)},children:[a.jsx(hl,{size:12})," Edit App"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{me(X.appId),ce(null)},children:[a.jsx(Rl,{size:12})," ",X.appPinned?"Unpin":"Pin"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{Se(X.appId),ce(null)},children:[a.jsx(us,{size:12})," Delete App"]})]})]})]})}const il=4,Zb=({transform:e})=>({...e,y:0});function Zm({tabKey:e,title:n,active:r,icon:o,badge:l,onSelect:c,onClose:d,onMenu:f}){const{attributes:h,listeners:m,setNodeRef:v,transform:k,transition:x,isDragging:S}=df({id:e});return a.jsxs("div",{ref:v,style:{transform:Es.Translate.toString(k),transition:x},className:`ide-tab ${r?"active":""} ${S?"dragging":""}`,title:n,...h,...m,onClick:c,onMouseDown:C=>{C.button===1&&C.preventDefault()},onAuxClick:C=>{C.button===1&&d()},onContextMenu:C=>{C.preventDefault(),C.stopPropagation(),f(C.clientX,C.clientY)},children:[o,n,l,a.jsx("span",{className:"ide-tab-close",onClick:C=>{C.stopPropagation(),d()},children:a.jsx(Tn,{size:12})})]})}function Jb({menu:e,tabs:n,onDone:r}){const o=A(k=>k.closeTabs),l=A(k=>k.reopenClosedTab),c=A(k=>k.closedTabs.some(x=>vv(k,x.key))),d=y.useRef(null),[f,h]=y.useState({left:e.x,top:e.y});Wi(d,r,!0),Io(r,!0),y.useLayoutEffect(()=>{if(!d.current)return;const{width:k,height:x}=d.current.getBoundingClientRect();h({left:Math.max(il,Math.min(e.x,window.innerWidth-k-il)),top:Math.max(il,Math.min(e.y,window.innerHeight-x-il))})},[e.x,e.y]);const m=e.key!==null&&n.includes(e.key)?e.key:null,v=(k,x,S=!1)=>a.jsx("div",{role:"menuitem","aria-disabled":S,className:`ctx-menu-item ${S?"ctx-disabled":""}`,onClick:()=>{S||(x(),r())},children:k});return a.jsxs("div",{ref:d,role:"menu",className:"ctx-menu",style:{position:"fixed",...f,zIndex:500},children:[m!==null&&a.jsxs(a.Fragment,{children:[v("Close",()=>o([m])),v("Close Others",()=>o(n.filter(k=>k!==m)),n.length<2),v("Close to the Right",()=>o(n.slice(n.indexOf(m)+1)),n.at(-1)===m),v("Close All",()=>o(n))]}),v("Reopen Closed Tab",l,!c)]})}function eN(){const e=A(L=>L.tabOrder),n=A(L=>L.activeSessionId),r=A(L=>L.sessions),o=A(L=>L.backgroundTasks),l=A(L=>L.selectSession),c=A(L=>L.closeTab),d=A(L=>L.setShowNewSessionDialog),f=A(L=>L.apps),h=A(L=>L.activeAppTabId),m=A(L=>L.openAppTab),v=A(L=>L.closeAppTab),k=A(L=>L.moveTab),[x,S]=y.useState(null),C=y.useRef(null),T=Jv(Zv(sc,{activationConstraint:{distance:5}})),E=Gd({activeSessionId:n,activeAppTabId:h});y.useEffect(()=>{var L,G,z;(z=(G=(L=C.current)==null?void 0:L.querySelector(".ide-tab.active"))==null?void 0:G.scrollIntoView)==null||z.call(G,{block:"nearest",inline:"nearest"})},[E]);const b=e.filter(L=>{const{kind:G,id:z}=mr(L);return G==="app"||r.some(U=>U.id===z)}),j=({active:L,over:G})=>{G&&k(String(L.id),String(G.id))},P=L=>{L.preventDefault(),S({x:L.clientX,y:L.clientY,key:null})},M=L=>{var oe;const{kind:G,id:z}=mr(L),U=(me,Se)=>S({x:me,y:Se,key:L});if(G==="app"){const me=f.find(Se=>Se.id===z);return a.jsx(Zm,{tabKey:L,title:(me==null?void 0:me.title)??z,active:h===z,icon:a.jsx(Do,{iconNode:me==null?void 0:me.iconNode,size:12,className:"miniapp-tab-icon"}),onSelect:()=>m(z),onClose:()=>v(z),onMenu:U},L)}const Q=r.find(me=>me.id===z);if(!Q)return null;const J=Yl(Q,((oe=o[z])==null?void 0:oe.length)??0);return a.jsx(Zm,{tabKey:L,title:Q.title||z.slice(0,8),active:n===z&&h==null,icon:a.jsx(sf,{iconClass:J.iconClass,iconText:J.iconText,size:14}),badge:J.dot&&a.jsx(nf,{status:J.dot,title:J.dotTitle}),onSelect:()=>void l(z),onClose:()=>c(z),onMenu:U},L)};return a.jsxs(vy,{sensors:T,collisionDetection:ey,modifiers:[Zb],onDragEnd:j,children:[a.jsx(Td,{items:b,strategy:Mb,children:a.jsxs("div",{ref:C,className:"ide-tabs",onContextMenu:P,onWheel:L=>{L.deltaX===0&&(L.currentTarget.scrollLeft+=L.deltaY)},children:[b.map(M),a.jsx("div",{className:"ide-tab-add",title:"New Session",onClick:()=>d(!0),children:a.jsx(pr,{size:14})})]})}),x&&a.jsx(Jb,{menu:x,tabs:b,onDone:()=>S(null)})]})}function pf(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Br=pf();function Ty(e){Br=e}var Ri={exec:()=>null};function ot(e,n=""){let r=typeof e=="string"?e:e.source;const o={replace:(l,c)=>{let d=typeof c=="string"?c:c.source;return d=d.replace(Nn.caret,"$1"),r=r.replace(l,d),o},getRegex:()=>new RegExp(r,n)};return o}var Nn={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},tN=/^(?:[ \t]*(?:\n|$))+/,nN=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,sN=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Xi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,rN=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hf=/(?:[*+-]|\d{1,9}[.)])/,Cy=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ey=ot(Cy).replace(/bull/g,hf).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),oN=ot(Cy).replace(/bull/g,hf).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),mf=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,iN=/^[^\n]+/,gf=/(?!\s*\])(?:\\.|[^\[\]\\])+/,aN=ot(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",gf).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),lN=ot(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,hf).getRegex(),ic="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",vf=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,cN=ot("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",vf).replace("tag",ic).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),jy=ot(mf).replace("hr",Xi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ic).getRegex(),uN=ot(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",jy).getRegex(),yf={blockquote:uN,code:nN,def:aN,fences:sN,heading:rN,hr:Xi,html:cN,lheading:Ey,list:lN,newline:tN,paragraph:jy,table:Ri,text:iN},Jm=ot("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Xi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ic).getRegex(),dN={...yf,lheading:oN,table:Jm,paragraph:ot(mf).replace("hr",Xi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Jm).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ic).getRegex()},fN={...yf,html:ot(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",vf).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ri,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ot(mf).replace("hr",Xi).replace("heading",` *#{1,6} *[^
457
- ]`).replace("lheading",Ey).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},pN=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,hN=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,_y=/^( {2,}|\\)\n(?!\s*$)/,mN=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ac=/[\p{P}\p{S}]/u,xf=/[\s\p{P}\p{S}]/u,Ry=/[^\s\p{P}\p{S}]/u,gN=ot(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,xf).getRegex(),Ay=/(?!~)[\p{P}\p{S}]/u,vN=/(?!~)[\s\p{P}\p{S}]/u,yN=/(?:[^\s\p{P}\p{S}]|~)/u,xN=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Iy=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,wN=ot(Iy,"u").replace(/punct/g,ac).getRegex(),kN=ot(Iy,"u").replace(/punct/g,Ay).getRegex(),Dy="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",SN=ot(Dy,"gu").replace(/notPunctSpace/g,Ry).replace(/punctSpace/g,xf).replace(/punct/g,ac).getRegex(),bN=ot(Dy,"gu").replace(/notPunctSpace/g,yN).replace(/punctSpace/g,vN).replace(/punct/g,Ay).getRegex(),NN=ot("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ry).replace(/punctSpace/g,xf).replace(/punct/g,ac).getRegex(),TN=ot(/\\(punct)/,"gu").replace(/punct/g,ac).getRegex(),CN=ot(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),EN=ot(vf).replace("(?:-->|$)","-->").getRegex(),jN=ot("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",EN).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Pl=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,_N=ot(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Pl).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),My=ot(/^!?\[(label)\]\[(ref)\]/).replace("label",Pl).replace("ref",gf).getRegex(),Ly=ot(/^!?\[(ref)\](?:\[\])?/).replace("ref",gf).getRegex(),RN=ot("reflink|nolink(?!\\()","g").replace("reflink",My).replace("nolink",Ly).getRegex(),wf={_backpedal:Ri,anyPunctuation:TN,autolink:CN,blockSkip:xN,br:_y,code:hN,del:Ri,emStrongLDelim:wN,emStrongRDelimAst:SN,emStrongRDelimUnd:NN,escape:pN,link:_N,nolink:Ly,punctuation:gN,reflink:My,reflinkSearch:RN,tag:jN,text:mN,url:Ri},AN={...wf,link:ot(/^!?\[(label)\]\((.*?)\)/).replace("label",Pl).getRegex(),reflink:ot(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Pl).getRegex()},jd={...wf,emStrongRDelimAst:bN,emStrongLDelim:kN,url:ot(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},IN={...jd,br:ot(_y).replace("{2,}","*").getRegex(),text:ot(jd.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},al={normal:yf,gfm:dN,pedantic:fN},yi={normal:wf,gfm:jd,breaks:IN,pedantic:AN},DN={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},eg=e=>DN[e];function Ns(e,n){if(n){if(Nn.escapeTest.test(e))return e.replace(Nn.escapeReplace,eg)}else if(Nn.escapeTestNoEncode.test(e))return e.replace(Nn.escapeReplaceNoEncode,eg);return e}function tg(e){try{e=encodeURI(e).replace(Nn.percentDecode,"%")}catch{return null}return e}function ng(e,n){var c;const r=e.replace(Nn.findPipe,(d,f,h)=>{let m=!1,v=f;for(;--v>=0&&h[v]==="\\";)m=!m;return m?"|":" |"}),o=r.split(Nn.splitPipe);let l=0;if(o[0].trim()||o.shift(),o.length>0&&!((c=o.at(-1))!=null&&c.trim())&&o.pop(),n)if(o.length>n)o.splice(n);else for(;o.length<n;)o.push("");for(;l<o.length;l++)o[l]=o[l].trim().replace(Nn.slashPipe,"|");return o}function xi(e,n,r){const o=e.length;if(o===0)return"";let l=0;for(;l<o&&e.charAt(o-l-1)===n;)l++;return e.slice(0,o-l)}function MN(e,n){if(e.indexOf(n[1])===-1)return-1;let r=0;for(let o=0;o<e.length;o++)if(e[o]==="\\")o++;else if(e[o]===n[0])r++;else if(e[o]===n[1]&&(r--,r<0))return o;return r>0?-2:-1}function sg(e,n,r,o,l){const c=n.href,d=n.title||null,f=e[1].replace(l.other.outputLinkReplace,"$1");o.state.inLink=!0;const h={type:e[0].charAt(0)==="!"?"image":"link",raw:r,href:c,title:d,text:f,tokens:o.inlineTokens(f)};return o.state.inLink=!1,h}function LN(e,n,r){const o=e.match(r.other.indentCodeCompensation);if(o===null)return n;const l=o[1];return n.split(`
456
+ `},hS={onDragStart(e){let{active:n}=e;return"Picked up draggable item "+n.id+"."},onDragOver(e){let{active:n,over:r}=e;return r?"Draggable item "+n.id+" was moved over droppable area "+r.id+".":"Draggable item "+n.id+" is no longer over a droppable area."},onDragEnd(e){let{active:n,over:r}=e;return r?"Draggable item "+n.id+" was dropped over droppable area "+r.id:"Draggable item "+n.id+" was dropped."},onDragCancel(e){let{active:n}=e;return"Dragging was cancelled. Draggable item "+n.id+" was dropped."}};function mS(e){let{announcements:n=hS,container:r,hiddenTextDescribedById:o,screenReaderInstructions:l=pS}=e;const{announce:c,announcement:d}=uS(),f=Gi("DndLiveRegion"),[h,m]=y.useState(!1);if(y.useEffect(()=>{m(!0)},[]),dS(y.useMemo(()=>({onDragStart(k){let{active:x}=k;c(n.onDragStart({active:x}))},onDragMove(k){let{active:x,over:S}=k;n.onDragMove&&c(n.onDragMove({active:x,over:S}))},onDragOver(k){let{active:x,over:S}=k;c(n.onDragOver({active:x,over:S}))},onDragEnd(k){let{active:x,over:S}=k;c(n.onDragEnd({active:x,over:S}))},onDragCancel(k){let{active:x,over:S}=k;c(n.onDragCancel({active:x,over:S}))}}),[c,n])),!h)return null;const v=ct.createElement(ct.Fragment,null,ct.createElement(lS,{id:o,value:l.draggable}),ct.createElement(cS,{id:f,announcement:d}));return r?Ni.createPortal(v,r):v}var Ht;(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"})(Ht||(Ht={}));function Ol(){}function Zv(e,n){return y.useMemo(()=>({sensor:e,options:n??{}}),[e,n])}function Jv(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return y.useMemo(()=>[...n].filter(o=>o!=null),[...n])}const hs=Object.freeze({x:0,y:0});function gS(e,n){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function vS(e,n){const r=Ll(e);if(!r)return"0 0";const o={x:(r.x-n.left)/n.width*100,y:(r.y-n.top)/n.height*100};return o.x+"% "+o.y+"%"}function yS(e,n){let{data:{value:r}}=e,{data:{value:o}}=n;return r-o}function xS(e,n){let{data:{value:r}}=e,{data:{value:o}}=n;return o-r}function wS(e,n){if(!e||e.length===0)return null;const[r]=e;return r[n]}function Om(e,n,r){return n===void 0&&(n=e.left),r===void 0&&(r=e.top),{x:n+e.width*.5,y:r+e.height*.5}}const ey=e=>{let{collisionRect:n,droppableRects:r,droppableContainers:o}=e;const l=Om(n,n.left,n.top),c=[];for(const d of o){const{id:f}=d,h=r.get(f);if(h){const m=gS(Om(h),l);c.push({id:f,data:{droppableContainer:d,value:m}})}}return c.sort(yS)};function kS(e,n){const r=Math.max(n.top,e.top),o=Math.max(n.left,e.left),l=Math.min(n.left+n.width,e.left+e.width),c=Math.min(n.top+n.height,e.top+e.height),d=l-o,f=c-r;if(o<l&&r<c){const h=n.width*n.height,m=e.width*e.height,v=d*f,k=v/(h+m-v);return Number(k.toFixed(4))}return 0}const SS=e=>{let{collisionRect:n,droppableRects:r,droppableContainers:o}=e;const l=[];for(const c of o){const{id:d}=c,f=r.get(d);if(f){const h=kS(f,n);h>0&&l.push({id:d,data:{droppableContainer:c,value:h}})}}return l.sort(xS)};function bS(e,n,r){return{...e,scaleX:n&&r?n.width/r.width:1,scaleY:n&&r?n.height/r.height:1}}function ty(e,n){return e&&n?{x:e.left-n.left,y:e.top-n.top}:hs}function NS(e){return function(r){for(var o=arguments.length,l=new Array(o>1?o-1:0),c=1;c<o;c++)l[c-1]=arguments[c];return l.reduce((d,f)=>({...d,top:d.top+e*f.y,bottom:d.bottom+e*f.y,left:d.left+e*f.x,right:d.right+e*f.x}),{...r})}}const TS=NS(1);function ny(e){if(e.startsWith("matrix3d(")){const n=e.slice(9,-1).split(/, /);return{x:+n[12],y:+n[13],scaleX:+n[0],scaleY:+n[5]}}else if(e.startsWith("matrix(")){const n=e.slice(7,-1).split(/, /);return{x:+n[4],y:+n[5],scaleX:+n[0],scaleY:+n[3]}}return null}function CS(e,n,r){const o=ny(n);if(!o)return e;const{scaleX:l,scaleY:c,x:d,y:f}=o,h=e.left-d-(1-l)*parseFloat(r),m=e.top-f-(1-c)*parseFloat(r.slice(r.indexOf(" ")+1)),v=l?e.width/l:e.width,k=c?e.height/c:e.height;return{width:v,height:k,top:m,right:h+v,bottom:m+k,left:h}}const ES={ignoreTransform:!1};function Oo(e,n){n===void 0&&(n=ES);let r=e.getBoundingClientRect();if(n.ignoreTransform){const{transform:m,transformOrigin:v}=Cn(e).getComputedStyle(e);m&&(r=CS(r,m,v))}const{top:o,left:l,width:c,height:d,bottom:f,right:h}=r;return{top:o,left:l,width:c,height:d,bottom:f,right:h}}function $m(e){return Oo(e,{ignoreTransform:!0})}function jS(e){const n=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:n,bottom:r,width:n,height:r}}function _S(e,n){return n===void 0&&(n=Cn(e).getComputedStyle(e)),n.position==="fixed"}function RS(e,n){n===void 0&&(n=Cn(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(l=>{const c=n[l];return typeof c=="string"?r.test(c):!1})}function af(e,n){const r=[];function o(l){if(n!=null&&r.length>=n||!l)return r;if(of(l)&&l.scrollingElement!=null&&!r.includes(l.scrollingElement))return r.push(l.scrollingElement),r;if(!Vi(l)||Xv(l)||r.includes(l))return r;const c=Cn(e).getComputedStyle(l);return l!==e&&RS(l,c)&&r.push(l),_S(l,c)?r:o(l.parentNode)}return e?o(e):r}function sy(e){const[n]=af(e,1);return n??null}function rd(e){return!tc||!e?null:Mo(e)?e:rf(e)?of(e)||e===Lo(e).scrollingElement?window:Vi(e)?e:null:null}function ry(e){return Mo(e)?e.scrollX:e.scrollLeft}function oy(e){return Mo(e)?e.scrollY:e.scrollTop}function bd(e){return{x:ry(e),y:oy(e)}}var en;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(en||(en={}));function iy(e){return!tc||!e?!1:e===document.scrollingElement}function ay(e){const n={x:0,y:0},r=iy(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},o={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},l=e.scrollTop<=n.y,c=e.scrollLeft<=n.x,d=e.scrollTop>=o.y,f=e.scrollLeft>=o.x;return{isTop:l,isLeft:c,isBottom:d,isRight:f,maxScroll:o,minScroll:n}}const AS={x:.2,y:.2};function IS(e,n,r,o,l){let{top:c,left:d,right:f,bottom:h}=r;o===void 0&&(o=10),l===void 0&&(l=AS);const{isTop:m,isBottom:v,isLeft:k,isRight:x}=ay(e),S={x:0,y:0},C={x:0,y:0},T={height:n.height*l.y,width:n.width*l.x};return!m&&c<=n.top+T.height?(S.y=en.Backward,C.y=o*Math.abs((n.top+T.height-c)/T.height)):!v&&h>=n.bottom-T.height&&(S.y=en.Forward,C.y=o*Math.abs((n.bottom-T.height-h)/T.height)),!x&&f>=n.right-T.width?(S.x=en.Forward,C.x=o*Math.abs((n.right-T.width-f)/T.width)):!k&&d<=n.left+T.width&&(S.x=en.Backward,C.x=o*Math.abs((n.left+T.width-d)/T.width)),{direction:S,speed:C}}function DS(e){if(e===document.scrollingElement){const{innerWidth:c,innerHeight:d}=window;return{top:0,left:0,right:c,bottom:d,width:c,height:d}}const{top:n,left:r,right:o,bottom:l}=e.getBoundingClientRect();return{top:n,left:r,right:o,bottom:l,width:e.clientWidth,height:e.clientHeight}}function ly(e){return e.reduce((n,r)=>Ro(n,bd(r)),hs)}function MS(e){return e.reduce((n,r)=>n+ry(r),0)}function LS(e){return e.reduce((n,r)=>n+oy(r),0)}function cy(e,n){if(n===void 0&&(n=Oo),!e)return;const{top:r,left:o,bottom:l,right:c}=n(e);sy(e)&&(l<=0||c<=0||r>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const OS=[["x",["left","right"],MS],["y",["top","bottom"],LS]];class lf{constructor(n,r){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 o=af(r),l=ly(o);this.rect={...n},this.width=n.width,this.height=n.height;for(const[c,d,f]of OS)for(const h of d)Object.defineProperty(this,h,{get:()=>{const m=f(o),v=l[c]-m;return this.rect[h]+v},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ei{constructor(n){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...r)})},this.target=n}add(n,r,o){var l;(l=this.target)==null||l.addEventListener(n,r,o),this.listeners.push([n,r,o])}}function $S(e){const{EventTarget:n}=Cn(e);return e instanceof n?e:Lo(e)}function od(e,n){const r=Math.abs(e.x),o=Math.abs(e.y);return typeof n=="number"?Math.sqrt(r**2+o**2)>n:"x"in n&&"y"in n?r>n.x&&o>n.y:"x"in n?r>n.x:"y"in n?o>n.y:!1}var es;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(es||(es={}));function Pm(e){e.preventDefault()}function PS(e){e.stopPropagation()}var nt;(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"})(nt||(nt={}));const uy={start:[nt.Space,nt.Enter],cancel:[nt.Esc],end:[nt.Space,nt.Enter,nt.Tab]},zS=(e,n)=>{let{currentCoordinates:r}=n;switch(e.code){case nt.Right:return{...r,x:r.x+25};case nt.Left:return{...r,x:r.x-25};case nt.Down:return{...r,y:r.y+25};case nt.Up:return{...r,y:r.y-25}}};class dy{constructor(n){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=n;const{event:{target:r}}=n;this.props=n,this.listeners=new Ei(Lo(r)),this.windowListeners=new Ei(Cn(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(es.Resize,this.handleCancel),this.windowListeners.add(es.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(es.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:n,onStart:r}=this.props,o=n.node.current;o&&cy(o),r(hs)}handleKeyDown(n){if(sc(n)){const{active:r,context:o,options:l}=this.props,{keyboardCodes:c=uy,coordinateGetter:d=zS,scrollBehavior:f="smooth"}=l,{code:h}=n;if(c.end.includes(h)){this.handleEnd(n);return}if(c.cancel.includes(h)){this.handleCancel(n);return}const{collisionRect:m}=o.current,v=m?{x:m.left,y:m.top}:hs;this.referenceCoordinates||(this.referenceCoordinates=v);const k=d(n,{active:r,context:o.current,currentCoordinates:v});if(k){const x=Ml(k,v),S={x:0,y:0},{scrollableAncestors:C}=o.current;for(const T of C){const E=n.code,{isTop:b,isRight:j,isLeft:P,isBottom:M,maxScroll:L,minScroll:G}=ay(T),z=DS(T),U={x:Math.min(E===nt.Right?z.right-z.width/2:z.right,Math.max(E===nt.Right?z.left:z.left+z.width/2,k.x)),y:Math.min(E===nt.Down?z.bottom-z.height/2:z.bottom,Math.max(E===nt.Down?z.top:z.top+z.height/2,k.y))},Q=E===nt.Right&&!j||E===nt.Left&&!P,J=E===nt.Down&&!M||E===nt.Up&&!b;if(Q&&U.x!==k.x){const oe=T.scrollLeft+x.x,me=E===nt.Right&&oe<=L.x||E===nt.Left&&oe>=G.x;if(me&&!x.y){T.scrollTo({left:oe,behavior:f});return}me?S.x=T.scrollLeft-oe:S.x=E===nt.Right?T.scrollLeft-L.x:T.scrollLeft-G.x,S.x&&T.scrollBy({left:-S.x,behavior:f});break}else if(J&&U.y!==k.y){const oe=T.scrollTop+x.y,me=E===nt.Down&&oe<=L.y||E===nt.Up&&oe>=G.y;if(me&&!x.x){T.scrollTo({top:oe,behavior:f});return}me?S.y=T.scrollTop-oe:S.y=E===nt.Down?T.scrollTop-L.y:T.scrollTop-G.y,S.y&&T.scrollBy({top:-S.y,behavior:f});break}}this.handleMove(n,Ro(Ml(k,this.referenceCoordinates),S))}}}handleMove(n,r){const{onMove:o}=this.props;n.preventDefault(),o(r)}handleEnd(n){const{onEnd:r}=this.props;n.preventDefault(),this.detach(),r()}handleCancel(n){const{onCancel:r}=this.props;n.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}dy.activators=[{eventName:"onKeyDown",handler:(e,n,r)=>{let{keyboardCodes:o=uy,onActivation:l}=n,{active:c}=r;const{code:d}=e.nativeEvent;if(o.start.includes(d)){const f=c.activatorNode.current;return f&&e.target!==f?!1:(e.preventDefault(),l==null||l({event:e.nativeEvent}),!0)}return!1}}];function zm(e){return!!(e&&"distance"in e)}function Fm(e){return!!(e&&"delay"in e)}class cf{constructor(n,r,o){var l;o===void 0&&(o=$S(n.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=n,this.events=r;const{event:c}=n,{target:d}=c;this.props=n,this.events=r,this.document=Lo(d),this.documentListeners=new Ei(this.document),this.listeners=new Ei(o),this.windowListeners=new Ei(Cn(d)),this.initialCoordinates=(l=Ll(c))!=null?l:hs,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:n,props:{options:{activationConstraint:r,bypassActivationConstraint:o}}}=this;if(this.listeners.add(n.move.name,this.handleMove,{passive:!1}),this.listeners.add(n.end.name,this.handleEnd),n.cancel&&this.listeners.add(n.cancel.name,this.handleCancel),this.windowListeners.add(es.Resize,this.handleCancel),this.windowListeners.add(es.DragStart,Pm),this.windowListeners.add(es.VisibilityChange,this.handleCancel),this.windowListeners.add(es.ContextMenu,Pm),this.documentListeners.add(es.Keydown,this.handleKeydown),r){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Fm(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(zm(r)){this.handlePending(r);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(n,r){const{active:o,onPending:l}=this.props;l(o,n,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:n}=this,{onStart:r}=this.props;n&&(this.activated=!0,this.documentListeners.add(es.Click,PS,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(es.SelectionChange,this.removeTextSelection),r(n))}handleMove(n){var r;const{activated:o,initialCoordinates:l,props:c}=this,{onMove:d,options:{activationConstraint:f}}=c;if(!l)return;const h=(r=Ll(n))!=null?r:hs,m=Ml(l,h);if(!o&&f){if(zm(f)){if(f.tolerance!=null&&od(m,f.tolerance))return this.handleCancel();if(od(m,f.distance))return this.handleStart()}if(Fm(f)&&od(m,f.tolerance))return this.handleCancel();this.handlePending(f,m);return}n.cancelable&&n.preventDefault(),d(h)}handleEnd(){const{onAbort:n,onEnd:r}=this.props;this.detach(),this.activated||n(this.props.active),r()}handleCancel(){const{onAbort:n,onCancel:r}=this.props;this.detach(),this.activated||n(this.props.active),r()}handleKeydown(n){n.code===nt.Esc&&this.handleCancel()}removeTextSelection(){var n;(n=this.document.getSelection())==null||n.removeAllRanges()}}const FS={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class rc extends cf{constructor(n){const{event:r}=n,o=Lo(r.target);super(n,FS,o)}}rc.activators=[{eventName:"onPointerDown",handler:(e,n)=>{let{nativeEvent:r}=e,{onActivation:o}=n;return!r.isPrimary||r.button!==0?!1:(o==null||o({event:r}),!0)}}];const US={move:{name:"mousemove"},end:{name:"mouseup"}};var Nd;(function(e){e[e.RightClick=2]="RightClick"})(Nd||(Nd={}));class BS extends cf{constructor(n){super(n,US,Lo(n.event.target))}}BS.activators=[{eventName:"onMouseDown",handler:(e,n)=>{let{nativeEvent:r}=e,{onActivation:o}=n;return r.button===Nd.RightClick?!1:(o==null||o({event:r}),!0)}}];const id={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class WS extends cf{constructor(n){super(n,id)}static setup(){return window.addEventListener(id.move.name,n,{capture:!1,passive:!1}),function(){window.removeEventListener(id.move.name,n)};function n(){}}}WS.activators=[{eventName:"onTouchStart",handler:(e,n)=>{let{nativeEvent:r}=e,{onActivation:o}=n;const{touches:l}=r;return l.length>1?!1:(o==null||o({event:r}),!0)}}];var ji;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ji||(ji={}));var $l;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})($l||($l={}));function HS(e){let{acceleration:n,activator:r=ji.Pointer,canScroll:o,draggingRect:l,enabled:c,interval:d=5,order:f=$l.TreeOrder,pointerCoordinates:h,scrollableAncestors:m,scrollableAncestorRects:v,delta:k,threshold:x}=e;const S=KS({delta:k,disabled:!c}),[C,T]=sS(),E=y.useRef({x:0,y:0}),b=y.useRef({x:0,y:0}),j=y.useMemo(()=>{switch(r){case ji.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case ji.DraggableRect:return l}},[r,l,h]),P=y.useRef(null),M=y.useCallback(()=>{const G=P.current;if(!G)return;const z=E.current.x*b.current.x,U=E.current.y*b.current.y;G.scrollBy(z,U)},[]),L=y.useMemo(()=>f===$l.TreeOrder?[...m].reverse():m,[f,m]);y.useEffect(()=>{if(!c||!m.length||!j){T();return}for(const G of L){if((o==null?void 0:o(G))===!1)continue;const z=m.indexOf(G),U=v[z];if(!U)continue;const{direction:Q,speed:J}=IS(G,U,j,n,x);for(const oe of["x","y"])S[oe][Q[oe]]||(J[oe]=0,Q[oe]=0);if(J.x>0||J.y>0){T(),P.current=G,C(M,d),E.current=J,b.current=Q;return}}E.current={x:0,y:0},b.current={x:0,y:0},T()},[n,M,o,T,c,d,JSON.stringify(j),JSON.stringify(S),C,m,L,v,JSON.stringify(x)])}const VS={x:{[en.Backward]:!1,[en.Forward]:!1},y:{[en.Backward]:!1,[en.Forward]:!1}};function KS(e){let{delta:n,disabled:r}=e;const o=Dl(n);return Ki(l=>{if(r||!o||!l)return VS;const c={x:Math.sign(n.x-o.x),y:Math.sign(n.y-o.y)};return{x:{[en.Backward]:l.x[en.Backward]||c.x===-1,[en.Forward]:l.x[en.Forward]||c.x===1},y:{[en.Backward]:l.y[en.Backward]||c.y===-1,[en.Forward]:l.y[en.Forward]||c.y===1}}},[r,n,o])}function GS(e,n){const r=n!=null?e.get(n):void 0,o=r?r.node.current:null;return Ki(l=>{var c;return n==null?null:(c=o??l)!=null?c:null},[o,n])}function qS(e,n){return y.useMemo(()=>e.reduce((r,o)=>{const{sensor:l}=o,c=l.activators.map(d=>({eventName:d.eventName,handler:n(d.handler,o)}));return[...r,...c]},[]),[e,n])}var zi;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(zi||(zi={}));var Td;(function(e){e.Optimized="optimized"})(Td||(Td={}));const Um=new Map;function XS(e,n){let{dragging:r,dependencies:o,config:l}=n;const[c,d]=y.useState(null),{frequency:f,measure:h,strategy:m}=l,v=y.useRef(e),k=E(),x=Pi(k),S=y.useCallback(function(b){b===void 0&&(b=[]),!x.current&&d(j=>j===null?b:j.concat(b.filter(P=>!j.includes(P))))},[x]),C=y.useRef(null),T=Ki(b=>{if(k&&!r)return Um;if(!b||b===Um||v.current!==e||c!=null){const j=new Map;for(let P of e){if(!P)continue;if(c&&c.length>0&&!c.includes(P.id)&&P.rect.current){j.set(P.id,P.rect.current);continue}const M=P.node.current,L=M?new lf(h(M),M):null;P.rect.current=L,L&&j.set(P.id,L)}return j}return b},[e,c,r,k,h]);return y.useEffect(()=>{v.current=e},[e]),y.useEffect(()=>{k||S()},[r,k]),y.useEffect(()=>{c&&c.length>0&&d(null)},[JSON.stringify(c)]),y.useEffect(()=>{k||typeof f!="number"||C.current!==null||(C.current=setTimeout(()=>{S(),C.current=null},f))},[f,k,S,...o]),{droppableRects:T,measureDroppableContainers:S,measuringScheduled:c!=null};function E(){switch(m){case zi.Always:return!1;case zi.BeforeDragging:return r;default:return!r}}}function uf(e,n){return Ki(r=>e?r||(typeof n=="function"?n(e):e):null,[n,e])}function YS(e,n){return uf(e,n)}function QS(e){let{callback:n,disabled:r}=e;const o=nc(n),l=y.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(o)},[o,r]);return y.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function oc(e){let{callback:n,disabled:r}=e;const o=nc(n),l=y.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(o)},[r]);return y.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function ZS(e){return new lf(Oo(e),e)}function Bm(e,n,r){n===void 0&&(n=ZS);const[o,l]=y.useState(null);function c(){l(h=>{if(!e)return null;if(e.isConnected===!1){var m;return(m=h??r)!=null?m:null}const v=n(e);return JSON.stringify(h)===JSON.stringify(v)?h:v})}const d=QS({callback(h){if(e)for(const m of h){const{type:v,target:k}=m;if(v==="childList"&&k instanceof HTMLElement&&k.contains(e)){c();break}}}}),f=oc({callback:c});return ps(()=>{c(),e?(f==null||f.observe(e),d==null||d.observe(document.body,{childList:!0,subtree:!0})):(f==null||f.disconnect(),d==null||d.disconnect())},[e]),o}function JS(e){const n=uf(e);return ty(e,n)}const Wm=[];function eb(e){const n=y.useRef(e),r=Ki(o=>e?o&&o!==Wm&&e&&n.current&&e.parentNode===n.current.parentNode?o:af(e):Wm,[e]);return y.useEffect(()=>{n.current=e},[e]),r}function tb(e){const[n,r]=y.useState(null),o=y.useRef(e),l=y.useCallback(c=>{const d=rd(c.target);d&&r(f=>f?(f.set(d,bd(d)),new Map(f)):null)},[]);return y.useEffect(()=>{const c=o.current;if(e!==c){d(c);const f=e.map(h=>{const m=rd(h);return m?(m.addEventListener("scroll",l,{passive:!0}),[m,bd(m)]):null}).filter(h=>h!=null);r(f.length?new Map(f):null),o.current=e}return()=>{d(e),d(c)};function d(f){f.forEach(h=>{const m=rd(h);m==null||m.removeEventListener("scroll",l)})}},[l,e]),y.useMemo(()=>e.length?n?Array.from(n.values()).reduce((c,d)=>Ro(c,d),hs):ly(e):hs,[e,n])}function Hm(e,n){n===void 0&&(n=[]);const r=y.useRef(null);return y.useEffect(()=>{r.current=null},n),y.useEffect(()=>{const o=e!==hs;o&&!r.current&&(r.current=e),!o&&r.current&&(r.current=null)},[e]),r.current?Ml(e,r.current):hs}function nb(e){y.useEffect(()=>{if(!tc)return;const n=e.map(r=>{let{sensor:o}=r;return o.setup==null?void 0:o.setup()});return()=>{for(const r of n)r==null||r()}},e.map(n=>{let{sensor:r}=n;return r}))}function sb(e,n){return y.useMemo(()=>e.reduce((r,o)=>{let{eventName:l,handler:c}=o;return r[l]=d=>{c(d,n)},r},{}),[e,n])}function fy(e){return y.useMemo(()=>e?jS(e):null,[e])}const Vm=[];function rb(e,n){n===void 0&&(n=Oo);const[r]=e,o=fy(r?Cn(r):null),[l,c]=y.useState(Vm);function d(){c(()=>e.length?e.map(h=>iy(h)?o:new lf(n(h),h)):Vm)}const f=oc({callback:d});return ps(()=>{f==null||f.disconnect(),d(),e.forEach(h=>f==null?void 0:f.observe(h))},[e]),l}function py(e){if(!e)return null;if(e.children.length>1)return e;const n=e.children[0];return Vi(n)?n:e}function ob(e){let{measure:n}=e;const[r,o]=y.useState(null),l=y.useCallback(m=>{for(const{target:v}of m)if(Vi(v)){o(k=>{const x=n(v);return k?{...k,width:x.width,height:x.height}:x});break}},[n]),c=oc({callback:l}),d=y.useCallback(m=>{const v=py(m);c==null||c.disconnect(),v&&(c==null||c.observe(v)),o(v?n(v):null)},[n,c]),[f,h]=Il(d);return y.useMemo(()=>({nodeRef:f,rect:r,setRef:h}),[r,f,h])}const ib=[{sensor:rc,options:{}},{sensor:dy,options:{}}],ab={current:{}},ml={draggable:{measure:$m},droppable:{measure:$m,strategy:zi.WhileDragging,frequency:Td.Optimized},dragOverlay:{measure:Oo}};class _i extends Map{get(n){var r;return n!=null&&(r=super.get(n))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(n=>{let{disabled:r}=n;return!r})}getNodeFor(n){var r,o;return(r=(o=this.get(n))==null?void 0:o.node.current)!=null?r:void 0}}const lb={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new _i,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ol},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ml,measureDroppableContainers:Ol,windowRect:null,measuringScheduled:!1},hy={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Ol,draggableNodes:new Map,over:null,measureDroppableContainers:Ol},qi=y.createContext(hy),my=y.createContext(lb);function cb(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new _i}}}function ub(e,n){switch(n.type){case Ht.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:n.initialCoordinates,active:n.active}};case Ht.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:n.coordinates.x-e.draggable.initialCoordinates.x,y:n.coordinates.y-e.draggable.initialCoordinates.y}}};case Ht.DragEnd:case Ht.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ht.RegisterDroppable:{const{element:r}=n,{id:o}=r,l=new _i(e.droppable.containers);return l.set(o,r),{...e,droppable:{...e.droppable,containers:l}}}case Ht.SetDroppableDisabled:{const{id:r,key:o,disabled:l}=n,c=e.droppable.containers.get(r);if(!c||o!==c.key)return e;const d=new _i(e.droppable.containers);return d.set(r,{...c,disabled:l}),{...e,droppable:{...e.droppable,containers:d}}}case Ht.UnregisterDroppable:{const{id:r,key:o}=n,l=e.droppable.containers.get(r);if(!l||o!==l.key)return e;const c=new _i(e.droppable.containers);return c.delete(r),{...e,droppable:{...e.droppable,containers:c}}}default:return e}}function db(e){let{disabled:n}=e;const{active:r,activatorEvent:o,draggableNodes:l}=y.useContext(qi),c=Dl(o),d=Dl(r==null?void 0:r.id);return y.useEffect(()=>{if(!n&&!o&&c&&d!=null){if(!sc(c)||document.activeElement===c.target)return;const f=l.get(d);if(!f)return;const{activatorNode:h,node:m}=f;if(!h.current&&!m.current)return;requestAnimationFrame(()=>{for(const v of[h.current,m.current]){if(!v)continue;const k=iS(v);if(k){k.focus();break}}})}},[o,n,l,d,c]),null}function gy(e,n){let{transform:r,...o}=n;return e!=null&&e.length?e.reduce((l,c)=>c({transform:l,...o}),r):r}function fb(e){return y.useMemo(()=>({draggable:{...ml.draggable,...e==null?void 0:e.draggable},droppable:{...ml.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ml.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 pb(e){let{activeNode:n,measure:r,initialRect:o,config:l=!0}=e;const c=y.useRef(!1),{x:d,y:f}=typeof l=="boolean"?{x:l,y:l}:l;ps(()=>{if(!d&&!f||!n){c.current=!1;return}if(c.current||!o)return;const m=n==null?void 0:n.node.current;if(!m||m.isConnected===!1)return;const v=r(m),k=ty(v,o);if(d||(k.x=0),f||(k.y=0),c.current=!0,Math.abs(k.x)>0||Math.abs(k.y)>0){const x=sy(m);x&&x.scrollBy({top:k.y,left:k.x})}},[n,d,f,o,r])}const ic=y.createContext({...hs,scaleX:1,scaleY:1});var dr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(dr||(dr={}));const vy=y.memo(function(n){var r,o,l,c;let{id:d,accessibility:f,autoScroll:h=!0,children:m,sensors:v=ib,collisionDetection:k=SS,measuring:x,modifiers:S,...C}=n;const T=y.useReducer(ub,void 0,cb),[E,b]=T,[j,P]=fS(),[M,L]=y.useState(dr.Uninitialized),G=M===dr.Initialized,{draggable:{active:z,nodes:U,translate:Q},droppable:{containers:J}}=E,oe=z!=null?U.get(z):null,me=y.useRef({initial:null,translated:null}),Se=y.useMemo(()=>{var Ze;return z!=null?{id:z,data:(Ze=oe==null?void 0:oe.data)!=null?Ze:ab,rect:me}:null},[z,oe]),Me=y.useRef(null),[ee,ie]=y.useState(null),[te,F]=y.useState(null),Z=Pi(C,Object.values(C)),q=Gi("DndDescribedBy",d),I=y.useMemo(()=>J.getEnabled(),[J]),$=fb(x),{droppableRects:ue,measureDroppableContainers:B,measuringScheduled:X}=XS(I,{dragging:G,dependencies:[Q.x,Q.y],config:$.droppable}),ce=GS(U,z),be=y.useMemo(()=>te?Ll(te):null,[te]),_e=vn(),Ae=YS(ce,$.draggable.measure);pb({activeNode:z!=null?U.get(z):null,config:_e.layoutShiftCompensation,initialRect:Ae,measure:$.draggable.measure});const je=Bm(ce,$.draggable.measure,Ae),ge=Bm(ce?ce.parentElement:null),he=y.useRef({activatorEvent:null,active:null,activeNode:ce,collisionRect:null,collisions:null,droppableRects:ue,draggableNodes:U,draggingNode:null,draggingNodeRect:null,droppableContainers:J,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ve=J.getNodeFor((r=he.current.over)==null?void 0:r.id),Ie=ob({measure:$.dragOverlay.measure}),mt=(o=Ie.nodeRef.current)!=null?o:ce,Ue=G?(l=Ie.rect)!=null?l:je:null,Vt=!!(Ie.nodeRef.current&&Ie.rect),tn=JS(Vt?null:je),St=fy(mt?Cn(mt):null),jt=eb(G?Ve??ce:null),Ft=rb(jt),Ot=gy(S,{transform:{x:Q.x-tn.x,y:Q.y-tn.y,scaleX:1,scaleY:1},activatorEvent:te,active:Se,activeNodeRect:je,containerNodeRect:ge,draggingNodeRect:Ue,over:he.current.over,overlayNodeRect:Ie.rect,scrollableAncestors:jt,scrollableAncestorRects:Ft,windowRect:St}),Y=be?Ro(be,Q):null,ve=tb(jt),Be=Hm(ve),rt=Hm(ve,[je]),gt=Ro(Ot,Be),vt=Ue?TS(Ue,Ot):null,_t=Se&&vt?k({active:Se,collisionRect:vt,droppableRects:ue,droppableContainers:I,pointerCoordinates:Y}):null,an=wS(_t,"id"),[dt,Mn]=y.useState(null),Ln=Vt?Ot:Ro(Ot,rt),ms=bS(Ln,(c=dt==null?void 0:dt.rect)!=null?c:null,je),gs=y.useRef(null),ns=y.useCallback((Ze,Rt)=>{let{sensor:ft,options:Gt}=Rt;if(Me.current==null)return;const yt=U.get(Me.current);if(!yt)return;const xt=Ze.nativeEvent,lt=new ft({active:Me.current,activeNode:yt,event:xt,options:Gt,context:he,onAbort(it){if(!U.get(it))return;const{onDragAbort:R}=Z.current,pe={id:it};R==null||R(pe),j({type:"onDragAbort",event:pe})},onPending(it,$t,R,pe){if(!U.get(it))return;const{onDragPending:we}=Z.current,$e={id:it,constraint:$t,initialCoordinates:R,offset:pe};we==null||we($e),j({type:"onDragPending",event:$e})},onStart(it){const $t=Me.current;if($t==null)return;const R=U.get($t);if(!R)return;const{onDragStart:pe}=Z.current,le={activatorEvent:xt,active:{id:$t,data:R.data,rect:me}};Ni.unstable_batchedUpdates(()=>{pe==null||pe(le),L(dr.Initializing),b({type:Ht.DragStart,initialCoordinates:it,active:$t}),j({type:"onDragStart",event:le}),ie(gs.current),F(xt)})},onMove(it){b({type:Ht.DragMove,coordinates:it})},onEnd:qt(Ht.DragEnd),onCancel:qt(Ht.DragCancel)});gs.current=lt;function qt(it){return async function(){const{active:R,collisions:pe,over:le,scrollAdjustedTranslate:we}=he.current;let $e=null;if(R&&we){const{cancelDrop:qe}=Z.current;$e={activatorEvent:xt,active:R,collisions:pe,delta:we,over:le},it===Ht.DragEnd&&typeof qe=="function"&&await Promise.resolve(qe($e))&&(it=Ht.DragCancel)}Me.current=null,Ni.unstable_batchedUpdates(()=>{b({type:it}),L(dr.Uninitialized),Mn(null),ie(null),F(null),gs.current=null;const qe=it===Ht.DragEnd?"onDragEnd":"onDragCancel";if($e){const Pe=Z.current[qe];Pe==null||Pe($e),j({type:qe,event:$e})}})}}},[U]),On=y.useCallback((Ze,Rt)=>(ft,Gt)=>{const yt=ft.nativeEvent,xt=U.get(Gt);if(Me.current!==null||!xt||yt.dndKit||yt.defaultPrevented)return;const lt={active:xt};Ze(ft,Rt.options,lt)===!0&&(yt.dndKit={capturedBy:Rt.sensor},Me.current=Gt,ns(ft,Rt))},[U,ns]),gn=qS(v,On);nb(v),ps(()=>{je&&M===dr.Initializing&&L(dr.Initialized)},[je,M]),y.useEffect(()=>{const{onDragMove:Ze}=Z.current,{active:Rt,activatorEvent:ft,collisions:Gt,over:yt}=he.current;if(!Rt||!ft)return;const xt={active:Rt,activatorEvent:ft,collisions:Gt,delta:{x:gt.x,y:gt.y},over:yt};Ni.unstable_batchedUpdates(()=>{Ze==null||Ze(xt),j({type:"onDragMove",event:xt})})},[gt.x,gt.y]),y.useEffect(()=>{const{active:Ze,activatorEvent:Rt,collisions:ft,droppableContainers:Gt,scrollAdjustedTranslate:yt}=he.current;if(!Ze||Me.current==null||!Rt||!yt)return;const{onDragOver:xt}=Z.current,lt=Gt.get(an),qt=lt&&lt.rect.current?{id:lt.id,rect:lt.rect.current,data:lt.data,disabled:lt.disabled}:null,it={active:Ze,activatorEvent:Rt,collisions:ft,delta:{x:yt.x,y:yt.y},over:qt};Ni.unstable_batchedUpdates(()=>{Mn(qt),xt==null||xt(it),j({type:"onDragOver",event:it})})},[an]),ps(()=>{he.current={activatorEvent:te,active:Se,activeNode:ce,collisionRect:vt,collisions:_t,droppableRects:ue,draggableNodes:U,draggingNode:mt,draggingNodeRect:Ue,droppableContainers:J,over:dt,scrollableAncestors:jt,scrollAdjustedTranslate:gt},me.current={initial:Ue,translated:vt}},[Se,ce,_t,vt,U,mt,Ue,ue,J,dt,jt,gt]),HS({..._e,delta:Q,draggingRect:vt,pointerCoordinates:Y,scrollableAncestors:jt,scrollableAncestorRects:Ft});const ln=y.useMemo(()=>({active:Se,activeNode:ce,activeNodeRect:je,activatorEvent:te,collisions:_t,containerNodeRect:ge,dragOverlay:Ie,draggableNodes:U,droppableContainers:J,droppableRects:ue,over:dt,measureDroppableContainers:B,scrollableAncestors:jt,scrollableAncestorRects:Ft,measuringConfiguration:$,measuringScheduled:X,windowRect:St}),[Se,ce,je,te,_t,ge,Ie,U,J,ue,dt,B,jt,Ft,$,X,St]),Kt=y.useMemo(()=>({activatorEvent:te,activators:gn,active:Se,activeNodeRect:je,ariaDescribedById:{draggable:q},dispatch:b,draggableNodes:U,over:dt,measureDroppableContainers:B}),[te,gn,Se,je,b,q,U,dt,B]);return ct.createElement(Qv.Provider,{value:P},ct.createElement(qi.Provider,{value:Kt},ct.createElement(my.Provider,{value:ln},ct.createElement(ic.Provider,{value:ms},m)),ct.createElement(db,{disabled:(f==null?void 0:f.restoreFocus)===!1})),ct.createElement(mS,{...f,hiddenTextDescribedById:q}));function vn(){const Ze=(ee==null?void 0:ee.autoScrollEnabled)===!1,Rt=typeof h=="object"?h.enabled===!1:h===!1,ft=G&&!Ze&&!Rt;return typeof h=="object"?{...h,enabled:ft}:{enabled:ft}}}),hb=y.createContext(null),Km="button",mb="Draggable";function gb(e){let{id:n,data:r,disabled:o=!1,attributes:l}=e;const c=Gi(mb),{activators:d,activatorEvent:f,active:h,activeNodeRect:m,ariaDescribedById:v,draggableNodes:k,over:x}=y.useContext(qi),{role:S=Km,roleDescription:C="draggable",tabIndex:T=0}=l??{},E=(h==null?void 0:h.id)===n,b=y.useContext(E?ic:hb),[j,P]=Il(),[M,L]=Il(),G=sb(d,n),z=Pi(r);ps(()=>(k.set(n,{id:n,key:c,node:j,activatorNode:M,data:z}),()=>{const Q=k.get(n);Q&&Q.key===c&&k.delete(n)}),[k,n]);const U=y.useMemo(()=>({role:S,tabIndex:T,"aria-disabled":o,"aria-pressed":E&&S===Km?!0:void 0,"aria-roledescription":C,"aria-describedby":v.draggable}),[o,S,T,E,C,v.draggable]);return{active:h,activatorEvent:f,activeNodeRect:m,attributes:U,isDragging:E,listeners:o?void 0:G,node:j,over:x,setNodeRef:P,setActivatorNodeRef:L,transform:b}}function yy(){return y.useContext(my)}const vb="Droppable",yb={timeout:25};function xy(e){let{data:n,disabled:r=!1,id:o,resizeObserverConfig:l}=e;const c=Gi(vb),{active:d,dispatch:f,over:h,measureDroppableContainers:m}=y.useContext(qi),v=y.useRef({disabled:r}),k=y.useRef(!1),x=y.useRef(null),S=y.useRef(null),{disabled:C,updateMeasurementsFor:T,timeout:E}={...yb,...l},b=Pi(T??o),j=y.useCallback(()=>{if(!k.current){k.current=!0;return}S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{m(Array.isArray(b.current)?b.current:[b.current]),S.current=null},E)},[E]),P=oc({callback:j,disabled:C||!d}),M=y.useCallback((U,Q)=>{P&&(Q&&(P.unobserve(Q),k.current=!1),U&&P.observe(U))},[P]),[L,G]=Il(M),z=Pi(n);return y.useEffect(()=>{!P||!L.current||(P.disconnect(),k.current=!1,P.observe(L.current))},[L,P]),y.useEffect(()=>(f({type:Ht.RegisterDroppable,element:{id:o,key:c,disabled:r,node:L,rect:x,data:z}}),()=>f({type:Ht.UnregisterDroppable,key:c,id:o})),[o]),y.useEffect(()=>{r!==v.current.disabled&&(f({type:Ht.SetDroppableDisabled,id:o,key:c,disabled:r}),v.current.disabled=r)},[o,c,r,f]),{active:d,rect:x,isOver:(h==null?void 0:h.id)===o,node:L,over:h,setNodeRef:G}}function xb(e){let{animation:n,children:r}=e;const[o,l]=y.useState(null),[c,d]=y.useState(null),f=Dl(r);return!r&&!o&&f&&l(f),ps(()=>{if(!c)return;const h=o==null?void 0:o.key,m=o==null?void 0:o.props.id;if(h==null||m==null){l(null);return}Promise.resolve(n(m,c)).then(()=>{l(null)})},[n,o,c]),ct.createElement(ct.Fragment,null,r,o?y.cloneElement(o,{ref:d}):null)}const wb={x:0,y:0,scaleX:1,scaleY:1};function kb(e){let{children:n}=e;return ct.createElement(qi.Provider,{value:hy},ct.createElement(ic.Provider,{value:wb},n))}const Sb={position:"fixed",touchAction:"none"},bb=e=>sc(e)?"transform 250ms ease":void 0,Nb=y.forwardRef((e,n)=>{let{as:r,activatorEvent:o,adjustScale:l,children:c,className:d,rect:f,style:h,transform:m,transition:v=bb}=e;if(!f)return null;const k=l?m:{...m,scaleX:1,scaleY:1},x={...Sb,width:f.width,height:f.height,top:f.top,left:f.left,transform:Es.Transform.toString(k),transformOrigin:l&&o?vS(o,f):void 0,transition:typeof v=="function"?v(o):v,...h};return ct.createElement(r,{className:d,style:x,ref:n},c)}),Tb=e=>n=>{let{active:r,dragOverlay:o}=n;const l={},{styles:c,className:d}=e;if(c!=null&&c.active)for(const[f,h]of Object.entries(c.active))h!==void 0&&(l[f]=r.node.style.getPropertyValue(f),r.node.style.setProperty(f,h));if(c!=null&&c.dragOverlay)for(const[f,h]of Object.entries(c.dragOverlay))h!==void 0&&o.node.style.setProperty(f,h);return d!=null&&d.active&&r.node.classList.add(d.active),d!=null&&d.dragOverlay&&o.node.classList.add(d.dragOverlay),function(){for(const[h,m]of Object.entries(l))r.node.style.setProperty(h,m);d!=null&&d.active&&r.node.classList.remove(d.active)}},Cb=e=>{let{transform:{initial:n,final:r}}=e;return[{transform:Es.Transform.toString(n)},{transform:Es.Transform.toString(r)}]},Eb={duration:250,easing:"ease",keyframes:Cb,sideEffects:Tb({styles:{active:{opacity:"0"}}})};function jb(e){let{config:n,draggableNodes:r,droppableContainers:o,measuringConfiguration:l}=e;return nc((c,d)=>{if(n===null)return;const f=r.get(c);if(!f)return;const h=f.node.current;if(!h)return;const m=py(d);if(!m)return;const{transform:v}=Cn(d).getComputedStyle(d),k=ny(v);if(!k)return;const x=typeof n=="function"?n:_b(n);return cy(h,l.draggable.measure),x({active:{id:c,data:f.data,node:h,rect:l.draggable.measure(h)},draggableNodes:r,dragOverlay:{node:d,rect:l.dragOverlay.measure(m)},droppableContainers:o,measuringConfiguration:l,transform:k})})}function _b(e){const{duration:n,easing:r,sideEffects:o,keyframes:l}={...Eb,...e};return c=>{let{active:d,dragOverlay:f,transform:h,...m}=c;if(!n)return;const v={x:f.rect.left-d.rect.left,y:f.rect.top-d.rect.top},k={scaleX:h.scaleX!==1?d.rect.width*h.scaleX/f.rect.width:1,scaleY:h.scaleY!==1?d.rect.height*h.scaleY/f.rect.height:1},x={x:h.x-v.x,y:h.y-v.y,...k},S=l({...m,active:d,dragOverlay:f,transform:{initial:h,final:x}}),[C]=S,T=S[S.length-1];if(JSON.stringify(C)===JSON.stringify(T))return;const E=o==null?void 0:o({active:d,dragOverlay:f,...m}),b=f.node.animate(S,{duration:n,easing:r,fill:"forwards"});return new Promise(j=>{b.onfinish=()=>{E==null||E(),j()}})}}let Gm=0;function Rb(e){return y.useMemo(()=>{if(e!=null)return Gm++,Gm},[e])}const Ab=ct.memo(e=>{let{adjustScale:n=!1,children:r,dropAnimation:o,style:l,transition:c,modifiers:d,wrapperElement:f="div",className:h,zIndex:m=999}=e;const{activatorEvent:v,active:k,activeNodeRect:x,containerNodeRect:S,draggableNodes:C,droppableContainers:T,dragOverlay:E,over:b,measuringConfiguration:j,scrollableAncestors:P,scrollableAncestorRects:M,windowRect:L}=yy(),G=y.useContext(ic),z=Rb(k==null?void 0:k.id),U=gy(d,{activatorEvent:v,active:k,activeNodeRect:x,containerNodeRect:S,draggingNodeRect:E.rect,over:b,overlayNodeRect:E.rect,scrollableAncestors:P,scrollableAncestorRects:M,transform:G,windowRect:L}),Q=uf(x),J=jb({config:o,draggableNodes:C,droppableContainers:T,measuringConfiguration:j}),oe=Q?E.setRef:void 0;return ct.createElement(kb,null,ct.createElement(xb,{animation:J},k&&z?ct.createElement(Nb,{key:z,id:k.id,ref:oe,as:f,activatorEvent:v,adjustScale:n,className:h,transition:c,rect:Q,style:{zIndex:m,...l},transform:U},r):null))});function wy(e,n,r){const o=e.slice();return o.splice(r<0?o.length+r:r,0,o.splice(n,1)[0]),o}function Ib(e,n){return e.reduce((r,o,l)=>{const c=n.get(o);return c&&(r[l]=c),r},Array(e.length))}function tl(e){return e!==null&&e>=0}function Db(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}function Mb(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const nl={scaleX:1,scaleY:1},Lb=e=>{var n;let{rects:r,activeNodeRect:o,activeIndex:l,overIndex:c,index:d}=e;const f=(n=r[l])!=null?n:o;if(!f)return null;const h=Ob(r,d,l);if(d===l){const m=r[c];return m?{x:l<c?m.left+m.width-(f.left+f.width):m.left-f.left,y:0,...nl}:null}return d>l&&d<=c?{x:-f.width-h,y:0,...nl}:d<l&&d>=c?{x:f.width+h,y:0,...nl}:{x:0,y:0,...nl}};function Ob(e,n,r){const o=e[n],l=e[n-1],c=e[n+1];return!o||!l&&!c?0:r<n?l?o.left-(l.left+l.width):c.left-(o.left+o.width):c?c.left-(o.left+o.width):o.left-(l.left+l.width)}const ky=e=>{let{rects:n,activeIndex:r,overIndex:o,index:l}=e;const c=wy(n,o,r),d=n[l],f=c[l];return!f||!d?null:{x:f.left-d.left,y:f.top-d.top,scaleX:f.width/d.width,scaleY:f.height/d.height}},sl={scaleX:1,scaleY:1},qm=e=>{var n;let{activeIndex:r,activeNodeRect:o,index:l,rects:c,overIndex:d}=e;const f=(n=c[r])!=null?n:o;if(!f)return null;if(l===r){const m=c[d];return m?{x:0,y:r<d?m.top+m.height-(f.top+f.height):m.top-f.top,...sl}:null}const h=$b(c,l,r);return l>r&&l<=d?{x:0,y:-f.height-h,...sl}:l<r&&l>=d?{x:0,y:f.height+h,...sl}:{x:0,y:0,...sl}};function $b(e,n,r){const o=e[n],l=e[n-1],c=e[n+1];return o?r<n?l?o.top-(l.top+l.height):c?c.top-(o.top+o.height):0:c?c.top-(o.top+o.height):l?o.top-(l.top+l.height):0:0}const Sy="Sortable",by=ct.createContext({activeIndex:-1,containerId:Sy,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:ky,disabled:{draggable:!1,droppable:!1}});function Cd(e){let{children:n,id:r,items:o,strategy:l=ky,disabled:c=!1}=e;const{active:d,dragOverlay:f,droppableRects:h,over:m,measureDroppableContainers:v}=yy(),k=Gi(Sy,r),x=f.rect!==null,S=y.useMemo(()=>o.map(G=>typeof G=="object"&&"id"in G?G.id:G),[o]),C=d!=null,T=d?S.indexOf(d.id):-1,E=m?S.indexOf(m.id):-1,b=y.useRef(S),j=!Db(S,b.current),P=E!==-1&&T===-1||j,M=Mb(c);ps(()=>{j&&C&&v(S)},[j,S,C,v]),y.useEffect(()=>{b.current=S},[S]);const L=y.useMemo(()=>({activeIndex:T,containerId:k,disabled:M,disableTransforms:P,items:S,overIndex:E,useDragOverlay:x,sortedRects:Ib(S,h),strategy:l}),[T,k,M.draggable,M.droppable,P,S,E,h,x,l]);return ct.createElement(by.Provider,{value:L},n)}const Pb=e=>{let{id:n,items:r,activeIndex:o,overIndex:l}=e;return wy(r,o,l).indexOf(n)},zb=e=>{let{containerId:n,isSorting:r,wasDragging:o,index:l,items:c,newIndex:d,previousItems:f,previousContainerId:h,transition:m}=e;return!m||!o||f!==c&&l===d?!1:r?!0:d!==l&&n===h},Fb={duration:200,easing:"ease"},Ny="transform",Ub=Es.Transition.toString({property:Ny,duration:0,easing:"linear"}),Bb={roleDescription:"sortable"};function Wb(e){let{disabled:n,index:r,node:o,rect:l}=e;const[c,d]=y.useState(null),f=y.useRef(r);return ps(()=>{if(!n&&r!==f.current&&o.current){const h=l.current;if(h){const m=Oo(o.current,{ignoreTransform:!0}),v={x:h.left-m.left,y:h.top-m.top,scaleX:h.width/m.width,scaleY:h.height/m.height};(v.x||v.y)&&d(v)}}r!==f.current&&(f.current=r)},[n,r,o,l]),y.useEffect(()=>{c&&d(null)},[c]),c}function df(e){let{animateLayoutChanges:n=zb,attributes:r,disabled:o,data:l,getNewIndex:c=Pb,id:d,strategy:f,resizeObserverConfig:h,transition:m=Fb}=e;const{items:v,containerId:k,activeIndex:x,disabled:S,disableTransforms:C,sortedRects:T,overIndex:E,useDragOverlay:b,strategy:j}=y.useContext(by),P=Hb(o,S),M=v.indexOf(d),L=y.useMemo(()=>({sortable:{containerId:k,index:M,items:v},...l}),[k,l,M,v]),G=y.useMemo(()=>v.slice(v.indexOf(d)),[v,d]),{rect:z,node:U,isOver:Q,setNodeRef:J}=xy({id:d,data:L,disabled:P.droppable,resizeObserverConfig:{updateMeasurementsFor:G,...h}}),{active:oe,activatorEvent:me,activeNodeRect:Se,attributes:Me,setNodeRef:ee,listeners:ie,isDragging:te,over:F,setActivatorNodeRef:Z,transform:q}=gb({id:d,data:L,attributes:{...Bb,...r},disabled:P.draggable}),I=nS(J,ee),$=!!oe,ue=$&&!C&&tl(x)&&tl(E),B=!b&&te,X=B&&ue?q:null,be=ue?X??(f??j)({rects:T,activeNodeRect:Se,activeIndex:x,overIndex:E,index:M}):null,_e=tl(x)&&tl(E)?c({id:d,items:v,activeIndex:x,overIndex:E}):M,Ae=oe==null?void 0:oe.id,je=y.useRef({activeId:Ae,items:v,newIndex:_e,containerId:k}),ge=v!==je.current.items,he=n({active:oe,containerId:k,isDragging:te,isSorting:$,id:d,index:M,items:v,newIndex:je.current.newIndex,previousItems:je.current.items,previousContainerId:je.current.containerId,transition:m,wasDragging:je.current.activeId!=null}),Ve=Wb({disabled:!he,index:M,node:U,rect:z});return y.useEffect(()=>{$&&je.current.newIndex!==_e&&(je.current.newIndex=_e),k!==je.current.containerId&&(je.current.containerId=k),v!==je.current.items&&(je.current.items=v)},[$,_e,k,v]),y.useEffect(()=>{if(Ae===je.current.activeId)return;if(Ae!=null&&je.current.activeId==null){je.current.activeId=Ae;return}const mt=setTimeout(()=>{je.current.activeId=Ae},50);return()=>clearTimeout(mt)},[Ae]),{active:oe,activeIndex:x,attributes:Me,data:L,rect:z,index:M,newIndex:_e,items:v,isOver:Q,isSorting:$,isDragging:te,listeners:ie,node:U,overIndex:E,over:F,setNodeRef:I,setActivatorNodeRef:Z,setDroppableNodeRef:J,setDraggableNodeRef:ee,transform:Ve??be,transition:Ie()};function Ie(){if(Ve||ge&&je.current.newIndex===M)return Ub;if(!(B&&!sc(me)||!m)&&($||he))return Es.Transition.toString({...m,property:Ny})}}function Hb(e,n){var r,o;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:n.draggable,droppable:(o=e==null?void 0:e.droppable)!=null?o:n.droppable}}nt.Down,nt.Right,nt.Up,nt.Left;function rl(e){const[n,r]=y.useState(()=>{try{const l=localStorage.getItem(e);if(l==null)return new Set;const c=JSON.parse(l);return Array.isArray(c)?new Set(c.filter(d=>typeof d=="string")):new Set}catch{return new Set}}),o=y.useCallback(l=>{r(c=>{const d=l(new Set(c));try{localStorage.setItem(e,JSON.stringify([...d]))}catch{}return d})},[e]);return[n,o]}function Vb(e,n=!1){const[r,o]=y.useState(()=>{try{const c=localStorage.getItem(e);return c==="1"?!0:c==="0"?!1:n}catch{return n}}),l=y.useCallback(c=>{o(c);try{localStorage.setItem(e,c?"1":"0")}catch{}},[e]);return[r,l]}async function Fi(e){try{return await navigator.clipboard.writeText(e),!0}catch{try{const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select();const r=document.execCommand("copy");return document.body.removeChild(n),r}catch{return!1}}}function Kb(e){return e.origin_app_id!=null&&!e.user_touched&&!e.starred}const Ed="(no directory)";function gr(e){return e.replaceAll("\\","/").replace(/\/+$/,"")}function jd(e,n){if(!n||!e.cwd)return!1;const r=gr(e.cwd),o=gr(n);return r.startsWith(`${o}/`)}function Gb(e,n){const r=new Map;for(const d of n){const f=d.cwd||Ed,h=r.get(f)??[];h.push(d),r.set(f,h)}const o=new Set,l=new Set(e.filter(d=>d.deleted===1).map(d=>d.path)),c=[];for(const d of e){if(d.deleted===1){o.add(d.path);continue}o.add(d.path),c.push({path:d.path,label:d.label||d.path.split("/").pop()||d.path,sessions:r.get(d.path)??[],workspace:d})}for(const[d,f]of r)o.has(d)||l.has(d)||c.push({path:d,label:d===Ed?"Other":d.split("/").pop()||d,sessions:f,workspace:null});return c}function qb(e,n,r){if(n.length===0)return!1;const o=new Set(e.filter(l=>l.deleted===1).map(l=>l.path));return n.some(l=>!jd(l,r)&&!o.has(l.cwd||Ed))}function Pl(e){return[...e].sort((n,r)=>r.sort_order-n.sort_order||(n.created_at<r.created_at?1:-1))}function Xm(e,n,r,o){const l=n.map(c=>({folder:c,sessions:e.sessions.filter(d=>d.folder_id===c.id),finishedKey:`folder:${c.id}:finished`,hidden:o.has(c.id)}));return l.push({folder:null,sessions:e.sessions.filter(c=>!(c.folder_id&&r.has(c.folder_id))),finishedKey:`${e.path}:finished`,hidden:!1}),l}function Ym(e,n){return{working:Pl(e.sessions.filter(r=>r.lifecycle!=="finished")),finished:Pl(e.sessions.filter(r=>r.lifecycle==="finished")),finishedCollapsed:n.has(e.finishedKey)}}function ol(e,n){return e.folder_id&&n.has(e.folder_id)?e.folder_id:null}function Xb(e){const n=new Set(e.map(o=>o.name));if(!n.has("New Folder"))return"New Folder";let r=2;for(;n.has(`New Folder ${r}`);)r++;return`New Folder ${r}`}function Qm({id:e,children:n,className:r}){const{setNodeRef:o,isOver:l}=xy({id:e});return a.jsx("div",{ref:o,className:`${r??""}${l?" drop-over":""}`,children:n})}function ff({inputRef:e,value:n,onChange:r,onConfirm:o,onCancel:l}){return a.jsx("input",{ref:e,className:"tree-rename-input",value:n,onChange:c=>r(c.target.value),onClick:c=>c.stopPropagation(),onPointerDown:c=>c.stopPropagation(),onKeyDown:c=>{c.key==="Enter"&&o(),c.key==="Escape"&&l()},onBlur:o})}function Yb({s:e,backgroundTaskCount:n,isActive:r,isSelected:o,originApp:l,renaming:c,renameValue:d,renameRef:f,onRenameValue:h,onRenameConfirm:m,onRenameCancel:v,onSelect:k,onCtxMenu:x,onToggleStar:S}){const{attributes:C,listeners:T,setNodeRef:E,transform:b,transition:j,isDragging:P}=df({id:`s:${e.id}`}),M=Ql(e,n);return a.jsxs("div",{ref:E,style:{transform:Es.Transform.toString(b),transition:j},className:`tree-item ${r?"active":""}${o?" selected":""} ${M.isFinished?"tree-item-finished":""}${P?" dragging":""}${e.starred?" tree-item-starred":""}`,...C,...T,onClick:k,onContextMenu:x,children:[a.jsx(sf,{iconClass:M.iconClass,iconText:M.iconText,size:16}),l&&a.jsx("span",{className:"tree-app-badge",title:"Created by a mini app",children:a.jsx(Do,{iconNode:l.iconNode,size:10})}),c?a.jsx(ff,{inputRef:f,value:d,onChange:h,onConfirm:m,onCancel:v}):a.jsx("span",{className:"tree-label",children:e.title||e.id.slice(0,8)}),!c&&a.jsx("button",{className:`star-btn${e.starred?" starred":""}`,title:e.starred?"Unstar session":"Star session",onClick:L=>{L.stopPropagation(),S()},onPointerDown:L=>L.stopPropagation(),children:a.jsx(Al,{size:10,fill:e.starred?"currentColor":"none"})}),M.dot&&a.jsx(nf,{status:M.dot,title:M.dotTitle})]})}function Qb({folder:e,count:n,collapsed:r,renaming:o,renameValue:l,renameRef:c,onRenameValue:d,onRenameConfirm:f,onRenameCancel:h,onToggle:m,onCtxMenu:v,children:k}){const{attributes:x,listeners:S,setNodeRef:C,transform:T,transition:E,isDragging:b,over:j}=df({id:`f:${e.id}`}),P=j!=null&&String(j.id).startsWith("s:");return a.jsxs("div",{ref:C,style:{transform:Es.Transform.toString(T),transition:E},className:`tree-folder ${r?"collapsed":""}${b?" dragging":""}`,children:[a.jsx("div",{className:`tree-folder-header${P?" drop-over":""}`,...x,...S,onClick:()=>{o||m()},onContextMenu:v,children:o?a.jsx(ff,{inputRef:c,value:l,onChange:d,onConfirm:f,onCancel:h}):a.jsxs(a.Fragment,{children:[a.jsx(_o,{size:8,className:"tree-chevron"}),a.jsx(Rl,{size:12}),a.jsx("span",{className:"tree-folder-label",children:e.name}),a.jsx("span",{className:"tree-count",children:n})]})}),!r&&a.jsx("div",{className:"tree-folder-children",children:k})]})}function Zb(){const e=A(R=>R.sessions),n=A(R=>R.backgroundTasks),r=A(R=>R.workspaces),o=A(R=>R.folders),l=A(R=>R.activeSessionId),c=A(R=>R.selectSession),d=A(R=>R.deleteSession),f=A(R=>R.removeWorkspace),h=A(R=>R.createSessionInWorkspace),m=A(R=>R.pickAndAddWorkspace),v=A(R=>R.setImportSessionsWorkspace),k=A(R=>R.renameSession),x=A(R=>R.markFinished),S=A(R=>R.markFinishedMany),C=A(R=>R.toggleStar),T=A(R=>R.reopenSession),E=A(R=>R.reopenSessionMany),b=A(R=>R.deleteSessionMany),j=A(R=>R.createSidebarFolder),P=A(R=>R.renameFolder),M=A(R=>R.deleteFolder),L=A(R=>R.applyMoves),G=A(R=>R.reorderFolders),z=A(R=>R.apps),U=A(R=>R.appsRootPath),Q=A(R=>R.activeAppTabId),J=A(R=>R.openAppTab),oe=A(R=>R.startAppEdit),me=A(R=>R.toggleAppPin),Se=A(R=>R.deleteApp),Me=A(R=>R.openAppCatalog),[ee,ie]=rl("agentpane:sidebar-ws-collapsed"),[te,F]=rl("agentpane:sidebar-sub-collapsed"),[Z,q]=rl("agentpane:sidebar-folders-collapsed"),[I,$]=rl("agentpane:sidebar-app-edits-collapsed"),[ue,B]=Vb("agentpane:sidebar-hide-auto-sessions"),[X,ce]=y.useState(null),[be,_e]=y.useState(null),[Ae,je]=y.useState(""),[ge,he]=y.useState(null),[Ve,Ie]=y.useState(new Set),[mt,Ue]=y.useState(null),Vt=y.useRef(null),tn=y.useRef(null),St=y.useRef(null),jt=y.useRef(!1),Ft=Jv(Zv(rc,{activationConstraint:{distance:5}}));function Ot(){Ie(new Set),Ue(null)}Wi(Vt,()=>ce(null),!!X),Io(()=>{ce(null),Ot()},!!X||Ve.size>0),y.useLayoutEffect(()=>{const R=Vt.current;if(!X||!R)return;const pe=8,{offsetWidth:le,offsetHeight:we}=R,$e=X.x+le>window.innerWidth-pe?Math.max(pe,X.x-le):X.x,qe=X.y+we>window.innerHeight-pe?Math.max(pe,X.y-we):X.y;R.style.left=`${$e}px`,R.style.top=`${qe}px`},[X]);const Y=y.useMemo(()=>new Map(e.map(R=>[R.id,R])),[e]),ve=y.useMemo(()=>new Map(o.map(R=>[R.id,R])),[o]),Be=y.useMemo(()=>{const R=new Map;for(const pe of[...o].sort((le,we)=>le.sort_order-we.sort_order)){const le=R.get(pe.workspace_path)??[];le.push(pe),R.set(pe.workspace_path,le)}return R},[o]);function rt(R){ie(pe=>{const le=new Set(pe);return le.has(R)?le.delete(R):le.add(R),le})}function gt(R){F(pe=>{const le=new Set(pe);return le.has(R)?le.delete(R):le.add(R),le})}function vt(R){q(pe=>{const le=new Set(pe);return le.has(R)?le.delete(R):le.add(R),le})}function _t(){B(!ue),Ot()}function an(R){$(pe=>{const le=new Set(pe);return le.has(R)?le.delete(R):le.add(R),le})}y.useEffect(()=>{be&&tn.current&&(tn.current.focus(),tn.current.select())},[be]),y.useEffect(()=>{var R,pe,le;jt.current||!l||(jt.current=!0,(le=(pe=(R=St.current)==null?void 0:R.querySelector(".tree-item.active, .sidebar-app-edit-row.active"))==null?void 0:pe.scrollIntoView)==null||le.call(pe,{block:"nearest"}))},[l]);function dt(R,pe,le,we=""){_e({kind:R,id:pe}),je(le||we)}function Mn(){if(be){const R=Ae.trim();R&&(be.kind==="session"?k(be.id,R):P(be.id,R))}_e(null)}function Ln(){_e(null),je("")}async function ms(R){const pe=Xb(Be.get(R)??[]),le=await j(R,pe);le&&dt("folder",le.id,le.name)}function gs(R){const pe=String(R.active.id);if(pe.startsWith("s:")){const le=Y.get(pe.slice(2));le&&he({kind:"session",label:le.title||le.id.slice(0,8)})}else if(pe.startsWith("f:")){const le=ve.get(pe.slice(2));le&&he({kind:"folder",label:le.name})}}function ns(R){he(null);const{active:pe,over:le}=R;if(!le)return;const we=String(pe.id),$e=String(le.id);if(we.startsWith("s:")){const qe=Y.get(we.slice(2));if(!qe)return;const Pe=qe.cwd||"(no directory)",Ut=ol(qe,ve);let $n,We;if($e.startsWith("f:")){const Je=ve.get($e.slice(2));if(!Je)return;$n=Je.workspace_path,We=Je.id}else if($e.startsWith("s:")){const Je=Y.get($e.slice(2));if(!Je)return;$n=Je.cwd||"(no directory)",We=ol(Je,ve)}else if($e.startsWith("c:")){const Je=$e.slice(2),At=Je.lastIndexOf("|");$n=Je.slice(0,At);const ys=Je.slice(At+1);We=ys==="root"?null:ys}else return;if($n!==Pe)return;const yn=Pl(e.filter(Je=>(Je.cwd||"(no directory)")===$n&&ol(Je,ve)===We)),js=yn.filter(Je=>Je.id!==qe.id);let Bs=js.length;if($e.startsWith("s:")){const Je=js.findIndex(At=>At.id===$e.slice(2));Je>=0&&(Bs=Je)}const Pn=[...js.slice(0,Bs),qe,...js.slice(Bs)],vs=[];if(We===Ut){if(Pn.length===yn.length&&Pn.every((Je,At)=>Je.id===yn[At].id))return;Pn.forEach((Je,At)=>vs.push({id:Je.id,folder_id:We,sort_order:Pn.length-1-At}))}else{const Je=Pl(e.filter(At=>(At.cwd||"(no directory)")===Pe&&ol(At,ve)===Ut)).filter(At=>At.id!==qe.id);Je.forEach((At,ys)=>vs.push({id:At.id,folder_id:Ut,sort_order:Je.length-1-ys})),Pn.forEach((At,ys)=>vs.push({id:At.id,folder_id:We,sort_order:Pn.length-1-ys}))}L(vs);return}if(we.startsWith("f:")){if(!$e.startsWith("f:"))return;const qe=ve.get(we.slice(2)),Pe=ve.get($e.slice(2));if(!qe||!Pe||qe.id===Pe.id||qe.workspace_path!==Pe.workspace_path)return;const Ut=(Be.get(qe.workspace_path)??[]).map(yn=>yn.id),$n=Ut.indexOf(qe.id),We=Ut.indexOf(Pe.id);Ut.splice(We,0,...Ut.splice($n,1)),G(Ut)}}const On=U?e.filter(R=>!jd(R,U)):e,gn=new Set(ue?On.filter(R=>Kb(R)&&R.id!==l).map(R=>R.id):[]),ln=Gb(r,gn.size>0?On.filter(R=>!gn.has(R.id)):On),Kt=y.useMemo(()=>{const R=new Map;if(!U)return R;const pe=gr(U);for(const le of e){if(!jd(le,U))continue;const we=gr(le.cwd).slice(pe.length+1).split("/")[0],$e=R.get(we)??[];$e.push(le),R.set(we,$e)}return R},[e,U]);function vn(R){return{folder:null,sessions:Kt.get(R)??[],finishedKey:`app:${R}:finished`,hidden:I.has(R)}}const Ze=[],Rt=R=>{if(R.hidden)return;const{working:pe,finished:le,finishedCollapsed:we}=Ym(R,te);Ze.push(...pe.map($e=>$e.id)),we||Ze.push(...le.map($e=>$e.id))};for(const R of ln){if(ee.has(R.path))continue;const pe=Be.get(R.path)??[],le=new Set(pe.map(we=>we.id));Xm(R,pe,le,Z).forEach(Rt)}z.forEach(R=>Rt(vn(R.id)));const ft=e.filter(R=>Ve.has(R.id)),Gt=ft.filter(R=>R.lifecycle!=="finished").map(R=>R.id),yt=ft.filter(R=>R.lifecycle==="finished").map(R=>R.id);function xt(R,pe){if(pe.metaKey||pe.ctrlKey){pe.preventDefault(),Ue(R.id),Ie(le=>{const we=new Set(le);return we.has(R.id)?we.delete(R.id):we.add(R.id),we});return}if(pe.shiftKey){pe.preventDefault();const le=mt??R.id;Ue(le);const we=Ze.indexOf(le),$e=Ze.indexOf(R.id);if(we>=0&&$e>=0){const[qe,Pe]=we<$e?[we,$e]:[$e,we];Ie(new Set(Ze.slice(qe,Pe+1)))}return}Ot(),Ue(R.id),c(R.id)}function lt(R,pe){pe.preventDefault();const le=Ve.has(R.id)&&Ve.size>1;Ve.has(R.id)||(Ie(new Set),Ue(R.id)),ce({x:pe.clientX,y:pe.clientY,type:"session",sessionId:R.id,sessionTitle:R.title,sessionLifecycle:R.lifecycle,sessionExternalId:R.external_thread_id,multi:le})}function qt(R){var le;const pe=R.origin_app_id?z.find(we=>we.id===R.origin_app_id):null;return a.jsx(Yb,{s:R,backgroundTaskCount:((le=n[R.id])==null?void 0:le.length)??0,isActive:l===R.id,isSelected:Ve.has(R.id),originApp:pe??null,renaming:(be==null?void 0:be.kind)==="session"&&be.id===R.id,renameValue:Ae,renameRef:tn,onRenameValue:je,onRenameConfirm:Mn,onRenameCancel:Ln,onSelect:we=>xt(R,we),onToggleStar:()=>C(R.id),onCtxMenu:we=>lt(R,we)},R.id)}function it(R){var le;const pe=Ql(R,((le=n[R.id])==null?void 0:le.length)??0);return a.jsxs("div",{className:`sidebar-app-edit-row${l===R.id?" active":""}${Ve.has(R.id)?" selected":""}${pe.isFinished?" tree-item-finished":""}`,title:"App edit session — click to open",onClick:we=>xt(R,we),onContextMenu:we=>lt(R,we),children:[a.jsx(sf,{iconClass:pe.iconClass,iconText:pe.iconText,size:14}),(be==null?void 0:be.kind)==="session"&&be.id===R.id?a.jsx(ff,{inputRef:tn,value:Ae,onChange:je,onConfirm:Mn,onCancel:Ln}):a.jsx("span",{className:"tree-label",children:R.title||R.id.slice(0,8)}),pe.dot&&a.jsx(nf,{status:pe.dot,title:pe.dotTitle})]},R.id)}function $t(R,pe="workspace"){const{working:le,finished:we,finishedCollapsed:$e}=Ym(R,te),qe=pe==="workspace"?qt:it,Pe=a.jsxs(a.Fragment,{children:[le.length===0&&we.length===0?a.jsx("div",{className:"tree-empty",children:"No sessions"}):le.map(qe),we.length>0&&a.jsxs("div",{className:`tree-subgroup ${$e?"collapsed":""}`,children:[a.jsxs("div",{className:"tree-subgroup-header",onClick:()=>gt(R.finishedKey),children:[a.jsx(_o,{size:8,className:"tree-chevron"}),a.jsx("span",{className:"tree-subgroup-label",children:"Finished"}),a.jsx("span",{className:"tree-subgroup-count",children:we.length})]}),!$e&&a.jsx("div",{className:"tree-subgroup-items",children:we.map(qe)})]})]});if(pe==="app")return Pe;const Ut=[...le,...we].map($n=>`s:${$n.id}`);return a.jsx(Cd,{items:Ut,strategy:qm,children:Pe})}return a.jsxs("div",{className:"ide-sidebar",ref:St,children:[a.jsxs("div",{className:"sidebar-header",children:[a.jsx("span",{className:"sidebar-header-title",children:"Workspaces"}),a.jsxs("div",{className:"sidebar-header-actions",children:[a.jsx("button",{className:`sidebar-add sidebar-filter${ue?" active":""}`,title:ue?`Show automatic sessions (${gn.size} hidden)`:"Hide automatic sessions — the ones mini apps run on their own. Sessions you message, stop, rewind, rename or star stay visible.","aria-label":ue?"Show automatic sessions":"Hide automatic sessions","aria-pressed":ue,onClick:_t,children:ue?a.jsx(v1,{size:14}):a.jsx(vr,{size:14})}),a.jsx("button",{className:"sidebar-add",title:"Add workspace",onClick:()=>m(),children:a.jsx(pr,{size:14})})]})]}),a.jsxs(vy,{sensors:Ft,collisionDetection:ey,onDragStart:gs,onDragEnd:ns,children:[ln.length===0?a.jsx("div",{className:"empty-state",style:{padding:"16px"},children:"No workspaces yet. Click + to add one."}):ln.map(R=>{const pe=ee.has(R.path),le=Be.get(R.path)??[],we=new Set(le.map(Pe=>Pe.id)),$e=Xm(R,le,we,Z),qe=$e[$e.length-1];return a.jsxs("div",{className:`tree-section ${pe?"collapsed":""}`,children:[a.jsxs("div",{className:"tree-section-header",onClick:()=>rt(R.path),onContextMenu:Pe=>{Pe.preventDefault(),ce({x:Pe.clientX,y:Pe.clientY,type:"workspace",path:R.path})},children:[a.jsx(_o,{size:9,className:"tree-chevron"}),a.jsx(Rl,{size:14}),a.jsx("span",{className:"tree-section-label",children:R.label}),a.jsx("button",{className:"tree-section-add",title:"New session in this workspace",onClick:Pe=>{Pe.stopPropagation(),h(R.path)},children:a.jsx(pr,{size:11})}),a.jsx("button",{className:"tree-section-add",title:"New folder in this workspace",onClick:Pe=>{Pe.stopPropagation(),ms(R.path)},children:a.jsx(nd,{size:11})}),a.jsx("span",{className:"tree-count",children:R.sessions.length})]}),!pe&&a.jsxs("div",{className:"tree-children",children:[a.jsx(Cd,{items:le.map(Pe=>`f:${Pe.id}`),strategy:qm,children:$e.filter(Pe=>Pe.folder).map(Pe=>a.jsx(Qb,{folder:Pe.folder,count:Pe.sessions.length,collapsed:Pe.hidden,renaming:(be==null?void 0:be.kind)==="folder"&&be.id===Pe.folder.id,renameValue:Ae,renameRef:tn,onRenameValue:je,onRenameConfirm:Mn,onRenameCancel:Ln,onToggle:()=>vt(Pe.folder.id),onCtxMenu:Ut=>{Ut.preventDefault(),ce({x:Ut.clientX,y:Ut.clientY,type:"folder",folderId:Pe.folder.id,folderName:Pe.folder.name})},children:a.jsx(Qm,{id:`c:${R.path}|${Pe.folder.id}`,children:$t(Pe)})},Pe.folder.id))}),a.jsx(Qm,{id:`c:${R.path}|root`,children:$t(qe)})]})]},R.path)}),a.jsx(Ab,{children:ge&&a.jsxs("div",{className:"drag-overlay",children:[ge.kind==="folder"&&a.jsx(Rl,{size:12}),a.jsx("span",{children:ge.label})]})})]}),a.jsxs("div",{className:"sidebar-apps",children:[a.jsxs("div",{className:"sidebar-header sidebar-apps-header",children:[a.jsx("span",{className:"sidebar-header-title",children:"Apps"}),a.jsx("button",{className:"sidebar-add",title:"Add mini app",onClick:()=>Me(),children:a.jsx(pr,{size:14})})]}),z.length===0&&a.jsx("div",{className:"tree-empty",children:"No apps yet"}),z.map(R=>{const pe=vn(R.id),le=pe.sessions.length>0&&!pe.hidden;return a.jsxs("div",{className:"sidebar-app-block",children:[a.jsxs("div",{className:`sidebar-app-row${Q===R.id?" active":""}`,title:R.description??void 0,onClick:()=>J(R.id),onContextMenu:we=>{we.preventDefault(),ce({x:we.clientX,y:we.clientY,type:"app",appId:R.id,appPinned:R.pinned})},children:[pe.sessions.length>0&&a.jsx("button",{className:`sidebar-app-chevron${le?"":" closed"}`,title:"Edit sessions of this app",onClick:we=>{we.stopPropagation(),an(R.id)},children:a.jsx(_o,{size:10,className:"tree-chevron"})}),a.jsx(Do,{iconNode:R.iconNode,size:14,className:"sidebar-app-icon"}),a.jsx("span",{className:"tree-label",children:R.title}),pe.sessions.length>0&&a.jsx("span",{className:"sidebar-app-count",children:pe.sessions.length}),R.pinned&&a.jsx(Al,{size:10,className:"sidebar-app-pin",fill:"currentColor"})]}),le&&a.jsx("div",{className:"sidebar-app-edits",children:$t(pe,"app")})]},R.id)})]}),a.jsxs("div",{className:"sidebar-footer",onClick:()=>m(),children:[a.jsx(nd,{size:14}),a.jsx("span",{children:"Add workspace"})]}),X&&a.jsxs("div",{ref:Vt,className:"ctx-menu",style:{position:"fixed",left:X.x,top:X.y,zIndex:500},children:[X.type==="workspace"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{h(X.path),ce(null)},children:[a.jsx(pr,{size:12})," New Session"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{ms(X.path),ce(null)},children:[a.jsx(nd,{size:12})," New Folder"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{v(X.path),ce(null)},children:[a.jsx(Fv,{size:12})," Import Sessions…"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{f(X.path),ce(null)},children:[a.jsx(us,{size:12})," Hide Workspace"]})]}),X.type==="folder"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{dt("folder",X.folderId,X.folderName??""),ce(null)},children:[a.jsx(hl,{size:12})," Rename Folder"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{M(X.folderId),ce(null)},children:[a.jsx(us,{size:12})," Delete Folder"]})]}),X.type==="session"&&!X.multi&&a.jsx(a.Fragment,{children:X.sessionLifecycle!=="finished"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{dt("session",X.sessionId,X.sessionTitle??""),ce(null)},children:[a.jsx(hl,{size:12})," Rename"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{x(X.sessionId),ce(null)},children:[a.jsx(_l,{size:12})," Mark as Finished"]}),a.jsxs("div",{className:`ctx-menu-item${X.sessionExternalId?"":" ctx-disabled"}`,title:X.sessionExternalId?void 0:"Session not started",onClick:()=>{X.sessionExternalId&&(Fi(X.sessionExternalId),ce(null))},children:[a.jsx(Oi,{size:12})," Copy Session ID"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{d(X.sessionId),ce(null)},children:[a.jsx(us,{size:12})," Delete Session"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{T(X.sessionId),ce(null)},children:[a.jsx($i,{size:12})," Reopen"]}),a.jsxs("div",{className:`ctx-menu-item${X.sessionExternalId?"":" ctx-disabled"}`,title:X.sessionExternalId?void 0:"Session not started",onClick:()=>{X.sessionExternalId&&(Fi(X.sessionExternalId),ce(null))},children:[a.jsx(Oi,{size:12})," Copy Session ID"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{d(X.sessionId),ce(null)},children:[a.jsx(us,{size:12})," Delete Session"]})]})}),X.type==="session"&&X.multi&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-header",children:[ft.length," sessions selected"]}),Gt.length>0&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{S(Gt),ce(null),Ot()},children:[a.jsx(_l,{size:12})," Mark ",Gt.length," as Finished"]}),yt.length>0&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{E(yt),ce(null),Ot()},children:[a.jsx($i,{size:12})," Reopen ",yt.length]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{b([...Ve]),ce(null),Ot()},children:[a.jsx(us,{size:12})," Delete ",ft.length," Sessions"]})]}),X.type==="app"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{oe(X.appId),ce(null)},children:[a.jsx(hl,{size:12})," Edit App"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{me(X.appId),ce(null)},children:[a.jsx(Al,{size:12})," ",X.appPinned?"Unpin":"Pin"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{Se(X.appId),ce(null)},children:[a.jsx(us,{size:12})," Delete App"]})]})]})]})}const il=4,Jb=({transform:e})=>({...e,y:0});function Zm({tabKey:e,title:n,active:r,icon:o,badge:l,onSelect:c,onClose:d,onMenu:f}){const{attributes:h,listeners:m,setNodeRef:v,transform:k,transition:x,isDragging:S}=df({id:e});return a.jsxs("div",{ref:v,style:{transform:Es.Translate.toString(k),transition:x},className:`ide-tab ${r?"active":""} ${S?"dragging":""}`,title:n,...h,...m,onClick:c,onMouseDown:C=>{C.button===1&&C.preventDefault()},onAuxClick:C=>{C.button===1&&d()},onContextMenu:C=>{C.preventDefault(),C.stopPropagation(),f(C.clientX,C.clientY)},children:[o,n,l,a.jsx("span",{className:"ide-tab-close",onClick:C=>{C.stopPropagation(),d()},children:a.jsx(Tn,{size:12})})]})}function eN({menu:e,tabs:n,onDone:r}){const o=A(k=>k.closeTabs),l=A(k=>k.reopenClosedTab),c=A(k=>k.closedTabs.some(x=>vv(k,x.key))),d=y.useRef(null),[f,h]=y.useState({left:e.x,top:e.y});Wi(d,r,!0),Io(r,!0),y.useLayoutEffect(()=>{if(!d.current)return;const{width:k,height:x}=d.current.getBoundingClientRect();h({left:Math.max(il,Math.min(e.x,window.innerWidth-k-il)),top:Math.max(il,Math.min(e.y,window.innerHeight-x-il))})},[e.x,e.y]);const m=e.key!==null&&n.includes(e.key)?e.key:null,v=(k,x,S=!1)=>a.jsx("div",{role:"menuitem","aria-disabled":S,className:`ctx-menu-item ${S?"ctx-disabled":""}`,onClick:()=>{S||(x(),r())},children:k});return a.jsxs("div",{ref:d,role:"menu",className:"ctx-menu",style:{position:"fixed",...f,zIndex:500},children:[m!==null&&a.jsxs(a.Fragment,{children:[v("Close",()=>o([m])),v("Close Others",()=>o(n.filter(k=>k!==m)),n.length<2),v("Close to the Right",()=>o(n.slice(n.indexOf(m)+1)),n.at(-1)===m),v("Close All",()=>o(n))]}),v("Reopen Closed Tab",l,!c)]})}function tN(){const e=A(L=>L.tabOrder),n=A(L=>L.activeSessionId),r=A(L=>L.sessions),o=A(L=>L.backgroundTasks),l=A(L=>L.selectSession),c=A(L=>L.closeTab),d=A(L=>L.setShowNewSessionDialog),f=A(L=>L.apps),h=A(L=>L.activeAppTabId),m=A(L=>L.openAppTab),v=A(L=>L.closeAppTab),k=A(L=>L.moveTab),[x,S]=y.useState(null),C=y.useRef(null),T=Jv(Zv(rc,{activationConstraint:{distance:5}})),E=Gd({activeSessionId:n,activeAppTabId:h});y.useEffect(()=>{var L,G,z;(z=(G=(L=C.current)==null?void 0:L.querySelector(".ide-tab.active"))==null?void 0:G.scrollIntoView)==null||z.call(G,{block:"nearest",inline:"nearest"})},[E]);const b=e.filter(L=>{const{kind:G,id:z}=mr(L);return G==="app"||r.some(U=>U.id===z)}),j=({active:L,over:G})=>{G&&k(String(L.id),String(G.id))},P=L=>{L.preventDefault(),S({x:L.clientX,y:L.clientY,key:null})},M=L=>{var oe;const{kind:G,id:z}=mr(L),U=(me,Se)=>S({x:me,y:Se,key:L});if(G==="app"){const me=f.find(Se=>Se.id===z);return a.jsx(Zm,{tabKey:L,title:(me==null?void 0:me.title)??z,active:h===z,icon:a.jsx(Do,{iconNode:me==null?void 0:me.iconNode,size:12,className:"miniapp-tab-icon"}),onSelect:()=>m(z),onClose:()=>v(z),onMenu:U},L)}const Q=r.find(me=>me.id===z);if(!Q)return null;const J=Ql(Q,((oe=o[z])==null?void 0:oe.length)??0);return a.jsx(Zm,{tabKey:L,title:Q.title||z.slice(0,8),active:n===z&&h==null,icon:a.jsx(sf,{iconClass:J.iconClass,iconText:J.iconText,size:14}),badge:J.dot&&a.jsx(nf,{status:J.dot,title:J.dotTitle}),onSelect:()=>void l(z),onClose:()=>c(z),onMenu:U},L)};return a.jsxs(vy,{sensors:T,collisionDetection:ey,modifiers:[Jb],onDragEnd:j,children:[a.jsx(Cd,{items:b,strategy:Lb,children:a.jsxs("div",{ref:C,className:"ide-tabs",onContextMenu:P,onWheel:L=>{L.deltaX===0&&(L.currentTarget.scrollLeft+=L.deltaY)},children:[b.map(M),a.jsx("div",{className:"ide-tab-add",title:"New Session",onClick:()=>d(!0),children:a.jsx(pr,{size:14})})]})}),x&&a.jsx(eN,{menu:x,tabs:b,onDone:()=>S(null)})]})}function pf(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Br=pf();function Ty(e){Br=e}var Ri={exec:()=>null};function ot(e,n=""){let r=typeof e=="string"?e:e.source;const o={replace:(l,c)=>{let d=typeof c=="string"?c:c.source;return d=d.replace(Nn.caret,"$1"),r=r.replace(l,d),o},getRegex:()=>new RegExp(r,n)};return o}var Nn={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},nN=/^(?:[ \t]*(?:\n|$))+/,sN=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,rN=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Xi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,oN=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hf=/(?:[*+-]|\d{1,9}[.)])/,Cy=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ey=ot(Cy).replace(/bull/g,hf).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),iN=ot(Cy).replace(/bull/g,hf).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),mf=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,aN=/^[^\n]+/,gf=/(?!\s*\])(?:\\.|[^\[\]\\])+/,lN=ot(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",gf).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),cN=ot(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,hf).getRegex(),ac="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",vf=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,uN=ot("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",vf).replace("tag",ac).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),jy=ot(mf).replace("hr",Xi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ac).getRegex(),dN=ot(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",jy).getRegex(),yf={blockquote:dN,code:sN,def:lN,fences:rN,heading:oN,hr:Xi,html:uN,lheading:Ey,list:cN,newline:nN,paragraph:jy,table:Ri,text:aN},Jm=ot("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Xi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ac).getRegex(),fN={...yf,lheading:iN,table:Jm,paragraph:ot(mf).replace("hr",Xi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Jm).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ac).getRegex()},pN={...yf,html:ot(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",vf).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ri,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ot(mf).replace("hr",Xi).replace("heading",` *#{1,6} *[^
457
+ ]`).replace("lheading",Ey).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},hN=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,mN=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,_y=/^( {2,}|\\)\n(?!\s*$)/,gN=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,lc=/[\p{P}\p{S}]/u,xf=/[\s\p{P}\p{S}]/u,Ry=/[^\s\p{P}\p{S}]/u,vN=ot(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,xf).getRegex(),Ay=/(?!~)[\p{P}\p{S}]/u,yN=/(?!~)[\s\p{P}\p{S}]/u,xN=/(?:[^\s\p{P}\p{S}]|~)/u,wN=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Iy=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,kN=ot(Iy,"u").replace(/punct/g,lc).getRegex(),SN=ot(Iy,"u").replace(/punct/g,Ay).getRegex(),Dy="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",bN=ot(Dy,"gu").replace(/notPunctSpace/g,Ry).replace(/punctSpace/g,xf).replace(/punct/g,lc).getRegex(),NN=ot(Dy,"gu").replace(/notPunctSpace/g,xN).replace(/punctSpace/g,yN).replace(/punct/g,Ay).getRegex(),TN=ot("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ry).replace(/punctSpace/g,xf).replace(/punct/g,lc).getRegex(),CN=ot(/\\(punct)/,"gu").replace(/punct/g,lc).getRegex(),EN=ot(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),jN=ot(vf).replace("(?:-->|$)","-->").getRegex(),_N=ot("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",jN).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),zl=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,RN=ot(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",zl).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),My=ot(/^!?\[(label)\]\[(ref)\]/).replace("label",zl).replace("ref",gf).getRegex(),Ly=ot(/^!?\[(ref)\](?:\[\])?/).replace("ref",gf).getRegex(),AN=ot("reflink|nolink(?!\\()","g").replace("reflink",My).replace("nolink",Ly).getRegex(),wf={_backpedal:Ri,anyPunctuation:CN,autolink:EN,blockSkip:wN,br:_y,code:mN,del:Ri,emStrongLDelim:kN,emStrongRDelimAst:bN,emStrongRDelimUnd:TN,escape:hN,link:RN,nolink:Ly,punctuation:vN,reflink:My,reflinkSearch:AN,tag:_N,text:gN,url:Ri},IN={...wf,link:ot(/^!?\[(label)\]\((.*?)\)/).replace("label",zl).getRegex(),reflink:ot(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",zl).getRegex()},_d={...wf,emStrongRDelimAst:NN,emStrongLDelim:SN,url:ot(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},DN={..._d,br:ot(_y).replace("{2,}","*").getRegex(),text:ot(_d.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},al={normal:yf,gfm:fN,pedantic:pN},yi={normal:wf,gfm:_d,breaks:DN,pedantic:IN},MN={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},eg=e=>MN[e];function Ts(e,n){if(n){if(Nn.escapeTest.test(e))return e.replace(Nn.escapeReplace,eg)}else if(Nn.escapeTestNoEncode.test(e))return e.replace(Nn.escapeReplaceNoEncode,eg);return e}function tg(e){try{e=encodeURI(e).replace(Nn.percentDecode,"%")}catch{return null}return e}function ng(e,n){var c;const r=e.replace(Nn.findPipe,(d,f,h)=>{let m=!1,v=f;for(;--v>=0&&h[v]==="\\";)m=!m;return m?"|":" |"}),o=r.split(Nn.splitPipe);let l=0;if(o[0].trim()||o.shift(),o.length>0&&!((c=o.at(-1))!=null&&c.trim())&&o.pop(),n)if(o.length>n)o.splice(n);else for(;o.length<n;)o.push("");for(;l<o.length;l++)o[l]=o[l].trim().replace(Nn.slashPipe,"|");return o}function xi(e,n,r){const o=e.length;if(o===0)return"";let l=0;for(;l<o&&e.charAt(o-l-1)===n;)l++;return e.slice(0,o-l)}function LN(e,n){if(e.indexOf(n[1])===-1)return-1;let r=0;for(let o=0;o<e.length;o++)if(e[o]==="\\")o++;else if(e[o]===n[0])r++;else if(e[o]===n[1]&&(r--,r<0))return o;return r>0?-2:-1}function sg(e,n,r,o,l){const c=n.href,d=n.title||null,f=e[1].replace(l.other.outputLinkReplace,"$1");o.state.inLink=!0;const h={type:e[0].charAt(0)==="!"?"image":"link",raw:r,href:c,title:d,text:f,tokens:o.inlineTokens(f)};return o.state.inLink=!1,h}function ON(e,n,r){const o=e.match(r.other.indentCodeCompensation);if(o===null)return n;const l=o[1];return n.split(`
458
458
  `).map(c=>{const d=c.match(r.other.beginningSpace);if(d===null)return c;const[f]=d;return f.length>=l.length?c.slice(l.length):c}).join(`
459
- `)}var zl=class{constructor(e){at(this,"options");at(this,"rules");at(this,"lexer");this.options=e||Br}space(e){const n=this.rules.block.newline.exec(e);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(e){const n=this.rules.block.code.exec(e);if(n){const r=n[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?r:xi(r,`
460
- `)}}}fences(e){const n=this.rules.block.fences.exec(e);if(n){const r=n[0],o=LN(r,n[3]||"",this.rules);return{type:"code",raw:r,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:o}}}heading(e){const n=this.rules.block.heading.exec(e);if(n){let r=n[2].trim();if(this.rules.other.endingHash.test(r)){const o=xi(r,"#");(this.options.pedantic||!o||this.rules.other.endingSpaceChar.test(o))&&(r=o.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){const n=this.rules.block.hr.exec(e);if(n)return{type:"hr",raw:xi(n[0],`
459
+ `)}var Fl=class{constructor(e){at(this,"options");at(this,"rules");at(this,"lexer");this.options=e||Br}space(e){const n=this.rules.block.newline.exec(e);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(e){const n=this.rules.block.code.exec(e);if(n){const r=n[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?r:xi(r,`
460
+ `)}}}fences(e){const n=this.rules.block.fences.exec(e);if(n){const r=n[0],o=ON(r,n[3]||"",this.rules);return{type:"code",raw:r,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:o}}}heading(e){const n=this.rules.block.heading.exec(e);if(n){let r=n[2].trim();if(this.rules.other.endingHash.test(r)){const o=xi(r,"#");(this.options.pedantic||!o||this.rules.other.endingSpaceChar.test(o))&&(r=o.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){const n=this.rules.block.hr.exec(e);if(n)return{type:"hr",raw:xi(n[0],`
461
461
  `)}}blockquote(e){const n=this.rules.block.blockquote.exec(e);if(n){let r=xi(n[0],`
462
462
  `).split(`
463
463
  `),o="",l="";const c=[];for(;r.length>0;){let d=!1;const f=[];let h;for(h=0;h<r.length;h++)if(this.rules.other.blockquoteStart.test(r[h]))f.push(r[h]),d=!0;else if(!d)f.push(r[h]);else break;r=r.slice(h);const m=f.join(`
@@ -478,7 +478,7 @@ ${v}`:v;const k=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.block
478
478
  `+x}!S&&!x.trim()&&(S=!0),m+=G+`
479
479
  `,e=e.substring(G.length+1),k=z.slice(C)}}l.loose||(d?l.loose=!0:this.rules.other.doubleBlankLine.test(m)&&(d=!0));let T=null,E;this.options.gfm&&(T=this.rules.other.listIsTask.exec(v),T&&(E=T[0]!=="[ ] ",v=v.replace(this.rules.other.listReplaceTask,""))),l.items.push({type:"list_item",raw:m,task:!!T,checked:E,loose:!1,text:v,tokens:[]}),l.raw+=m}const f=l.items.at(-1);if(f)f.raw=f.raw.trimEnd(),f.text=f.text.trimEnd();else return;l.raw=l.raw.trimEnd();for(let h=0;h<l.items.length;h++)if(this.lexer.state.top=!1,l.items[h].tokens=this.lexer.blockTokens(l.items[h].text,[]),!l.loose){const m=l.items[h].tokens.filter(k=>k.type==="space"),v=m.length>0&&m.some(k=>this.rules.other.anyLine.test(k.raw));l.loose=v}if(l.loose)for(let h=0;h<l.items.length;h++)l.items[h].loose=!0;return l}}html(e){const n=this.rules.block.html.exec(e);if(n)return{type:"html",block:!0,raw:n[0],pre:n[1]==="pre"||n[1]==="script"||n[1]==="style",text:n[0]}}def(e){const n=this.rules.block.def.exec(e);if(n){const r=n[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),o=n[2]?n[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",l=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):n[3];return{type:"def",tag:r,raw:n[0],href:o,title:l}}}table(e){var d;const n=this.rules.block.table.exec(e);if(!n||!this.rules.other.tableDelimiter.test(n[2]))return;const r=ng(n[1]),o=n[2].replace(this.rules.other.tableAlignChars,"").split("|"),l=(d=n[3])!=null&&d.trim()?n[3].replace(this.rules.other.tableRowBlankLine,"").split(`
480
480
  `):[],c={type:"table",raw:n[0],header:[],align:[],rows:[]};if(r.length===o.length){for(const f of o)this.rules.other.tableAlignRight.test(f)?c.align.push("right"):this.rules.other.tableAlignCenter.test(f)?c.align.push("center"):this.rules.other.tableAlignLeft.test(f)?c.align.push("left"):c.align.push(null);for(let f=0;f<r.length;f++)c.header.push({text:r[f],tokens:this.lexer.inline(r[f]),header:!0,align:c.align[f]});for(const f of l)c.rows.push(ng(f,c.header.length).map((h,m)=>({text:h,tokens:this.lexer.inline(h),header:!1,align:c.align[m]})));return c}}lheading(e){const n=this.rules.block.lheading.exec(e);if(n)return{type:"heading",raw:n[0],depth:n[2].charAt(0)==="="?1:2,text:n[1],tokens:this.lexer.inline(n[1])}}paragraph(e){const n=this.rules.block.paragraph.exec(e);if(n){const r=n[1].charAt(n[1].length-1)===`
481
- `?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:r,tokens:this.lexer.inline(r)}}}text(e){const n=this.rules.block.text.exec(e);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(e){const n=this.rules.inline.escape.exec(e);if(n)return{type:"escape",raw:n[0],text:n[1]}}tag(e){const n=this.rules.inline.tag.exec(e);if(n)return!this.lexer.state.inLink&&this.rules.other.startATag.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(e){const n=this.rules.inline.link.exec(e);if(n){const r=n[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;const c=xi(r.slice(0,-1),"\\");if((r.length-c.length)%2===0)return}else{const c=MN(n[2],"()");if(c===-2)return;if(c>-1){const f=(n[0].indexOf("!")===0?5:4)+n[1].length+c;n[2]=n[2].substring(0,c),n[0]=n[0].substring(0,f).trim(),n[3]=""}}let o=n[2],l="";if(this.options.pedantic){const c=this.rules.other.pedanticHrefTitle.exec(o);c&&(o=c[1],l=c[3])}else l=n[3]?n[3].slice(1,-1):"";return o=o.trim(),this.rules.other.startAngleBracket.test(o)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?o=o.slice(1):o=o.slice(1,-1)),sg(n,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:l&&l.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer,this.rules)}}reflink(e,n){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){const o=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),l=n[o.toLowerCase()];if(!l){const c=r[0].charAt(0);return{type:"text",raw:c,text:c}}return sg(r,l,r[0],this.lexer,this.rules)}}emStrong(e,n,r=""){let o=this.rules.inline.emStrongLDelim.exec(e);if(!o||o[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(o[1]||o[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const c=[...o[0]].length-1;let d,f,h=c,m=0;const v=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(v.lastIndex=0,n=n.slice(-1*e.length+c);(o=v.exec(n))!=null;){if(d=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!d)continue;if(f=[...d].length,o[3]||o[4]){h+=f;continue}else if((o[5]||o[6])&&c%3&&!((c+f)%3)){m+=f;continue}if(h-=f,h>0)continue;f=Math.min(f,f+h+m);const k=[...o[0]][0].length,x=e.slice(0,c+o.index+k+f);if(Math.min(c,f)%2){const C=x.slice(1,-1);return{type:"em",raw:x,text:C,tokens:this.lexer.inlineTokens(C)}}const S=x.slice(2,-2);return{type:"strong",raw:x,text:S,tokens:this.lexer.inlineTokens(S)}}}}codespan(e){const n=this.rules.inline.code.exec(e);if(n){let r=n[2].replace(this.rules.other.newLineCharGlobal," ");const o=this.rules.other.nonSpaceChar.test(r),l=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return o&&l&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:n[0],text:r}}}br(e){const n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}}del(e){const n=this.rules.inline.del.exec(e);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(e){const n=this.rules.inline.autolink.exec(e);if(n){let r,o;return n[2]==="@"?(r=n[1],o="mailto:"+r):(r=n[1],o=r),{type:"link",raw:n[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}url(e){var r;let n;if(n=this.rules.inline.url.exec(e)){let o,l;if(n[2]==="@")o=n[0],l="mailto:"+o;else{let c;do c=n[0],n[0]=((r=this.rules.inline._backpedal.exec(n[0]))==null?void 0:r[0])??"";while(c!==n[0]);o=n[0],n[1]==="www."?l="http://"+n[0]:l=n[0]}return{type:"link",raw:n[0],text:o,href:l,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(e){const n=this.rules.inline.text.exec(e);if(n){const r=this.lexer.state.inRawBlock;return{type:"text",raw:n[0],text:n[0],escaped:r}}}},Ps=class _d{constructor(n){at(this,"tokens");at(this,"options");at(this,"state");at(this,"tokenizer");at(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=n||Br,this.options.tokenizer=this.options.tokenizer||new zl,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const r={other:Nn,block:al.normal,inline:yi.normal};this.options.pedantic?(r.block=al.pedantic,r.inline=yi.pedantic):this.options.gfm&&(r.block=al.gfm,this.options.breaks?r.inline=yi.breaks:r.inline=yi.gfm),this.tokenizer.rules=r}static get rules(){return{block:al,inline:yi}}static lex(n,r){return new _d(r).lex(n)}static lexInline(n,r){return new _d(r).inlineTokens(n)}lex(n){n=n.replace(Nn.carriageReturn,`
481
+ `?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:r,tokens:this.lexer.inline(r)}}}text(e){const n=this.rules.block.text.exec(e);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(e){const n=this.rules.inline.escape.exec(e);if(n)return{type:"escape",raw:n[0],text:n[1]}}tag(e){const n=this.rules.inline.tag.exec(e);if(n)return!this.lexer.state.inLink&&this.rules.other.startATag.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(e){const n=this.rules.inline.link.exec(e);if(n){const r=n[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;const c=xi(r.slice(0,-1),"\\");if((r.length-c.length)%2===0)return}else{const c=LN(n[2],"()");if(c===-2)return;if(c>-1){const f=(n[0].indexOf("!")===0?5:4)+n[1].length+c;n[2]=n[2].substring(0,c),n[0]=n[0].substring(0,f).trim(),n[3]=""}}let o=n[2],l="";if(this.options.pedantic){const c=this.rules.other.pedanticHrefTitle.exec(o);c&&(o=c[1],l=c[3])}else l=n[3]?n[3].slice(1,-1):"";return o=o.trim(),this.rules.other.startAngleBracket.test(o)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?o=o.slice(1):o=o.slice(1,-1)),sg(n,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:l&&l.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer,this.rules)}}reflink(e,n){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){const o=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),l=n[o.toLowerCase()];if(!l){const c=r[0].charAt(0);return{type:"text",raw:c,text:c}}return sg(r,l,r[0],this.lexer,this.rules)}}emStrong(e,n,r=""){let o=this.rules.inline.emStrongLDelim.exec(e);if(!o||o[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(o[1]||o[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const c=[...o[0]].length-1;let d,f,h=c,m=0;const v=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(v.lastIndex=0,n=n.slice(-1*e.length+c);(o=v.exec(n))!=null;){if(d=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!d)continue;if(f=[...d].length,o[3]||o[4]){h+=f;continue}else if((o[5]||o[6])&&c%3&&!((c+f)%3)){m+=f;continue}if(h-=f,h>0)continue;f=Math.min(f,f+h+m);const k=[...o[0]][0].length,x=e.slice(0,c+o.index+k+f);if(Math.min(c,f)%2){const C=x.slice(1,-1);return{type:"em",raw:x,text:C,tokens:this.lexer.inlineTokens(C)}}const S=x.slice(2,-2);return{type:"strong",raw:x,text:S,tokens:this.lexer.inlineTokens(S)}}}}codespan(e){const n=this.rules.inline.code.exec(e);if(n){let r=n[2].replace(this.rules.other.newLineCharGlobal," ");const o=this.rules.other.nonSpaceChar.test(r),l=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return o&&l&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:n[0],text:r}}}br(e){const n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}}del(e){const n=this.rules.inline.del.exec(e);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(e){const n=this.rules.inline.autolink.exec(e);if(n){let r,o;return n[2]==="@"?(r=n[1],o="mailto:"+r):(r=n[1],o=r),{type:"link",raw:n[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}url(e){var r;let n;if(n=this.rules.inline.url.exec(e)){let o,l;if(n[2]==="@")o=n[0],l="mailto:"+o;else{let c;do c=n[0],n[0]=((r=this.rules.inline._backpedal.exec(n[0]))==null?void 0:r[0])??"";while(c!==n[0]);o=n[0],n[1]==="www."?l="http://"+n[0]:l=n[0]}return{type:"link",raw:n[0],text:o,href:l,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(e){const n=this.rules.inline.text.exec(e);if(n){const r=this.lexer.state.inRawBlock;return{type:"text",raw:n[0],text:n[0],escaped:r}}}},Ps=class Rd{constructor(n){at(this,"tokens");at(this,"options");at(this,"state");at(this,"tokenizer");at(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=n||Br,this.options.tokenizer=this.options.tokenizer||new Fl,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const r={other:Nn,block:al.normal,inline:yi.normal};this.options.pedantic?(r.block=al.pedantic,r.inline=yi.pedantic):this.options.gfm&&(r.block=al.gfm,this.options.breaks?r.inline=yi.breaks:r.inline=yi.gfm),this.tokenizer.rules=r}static get rules(){return{block:al,inline:yi}}static lex(n,r){return new Rd(r).lex(n)}static lexInline(n,r){return new Rd(r).inlineTokens(n)}lex(n){n=n.replace(Nn.carriageReturn,`
482
482
  `),this.blockTokens(n,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){const o=this.inlineQueue[r];this.inlineTokens(o.src,o.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(n,r=[],o=!1){var l,c,d;for(this.options.pedantic&&(n=n.replace(Nn.tabCharGlobal," ").replace(Nn.spaceLine,""));n;){let f;if((c=(l=this.options.extensions)==null?void 0:l.block)!=null&&c.some(m=>(f=m.call({lexer:this},n,r))?(n=n.substring(f.raw.length),r.push(f),!0):!1))continue;if(f=this.tokenizer.space(n)){n=n.substring(f.raw.length);const m=r.at(-1);f.raw.length===1&&m!==void 0?m.raw+=`
483
483
  `:r.push(f);continue}if(f=this.tokenizer.code(n)){n=n.substring(f.raw.length);const m=r.at(-1);(m==null?void 0:m.type)==="paragraph"||(m==null?void 0:m.type)==="text"?(m.raw+=`
484
484
  `+f.raw,m.text+=`
@@ -488,16 +488,16 @@ ${v}`:v;const k=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.block
488
488
  `+f.raw,m.text+=`
489
489
  `+f.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):r.push(f),o=h.length!==n.length,n=n.substring(f.raw.length);continue}if(f=this.tokenizer.text(n)){n=n.substring(f.raw.length);const m=r.at(-1);(m==null?void 0:m.type)==="text"?(m.raw+=`
490
490
  `+f.raw,m.text+=`
491
- `+f.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):r.push(f);continue}if(n){const m="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return this.state.top=!0,r}inline(n,r=[]){return this.inlineQueue.push({src:n,tokens:r}),r}inlineTokens(n,r=[]){var f,h,m;let o=n,l=null;if(this.tokens.links){const v=Object.keys(this.tokens.links);if(v.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(o))!=null;)v.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(l=this.tokenizer.rules.inline.anyPunctuation.exec(o))!=null;)o=o.slice(0,l.index)+"++"+o.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(l=this.tokenizer.rules.inline.blockSkip.exec(o))!=null;)o=o.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let c=!1,d="";for(;n;){c||(d=""),c=!1;let v;if((h=(f=this.options.extensions)==null?void 0:f.inline)!=null&&h.some(x=>(v=x.call({lexer:this},n,r))?(n=n.substring(v.raw.length),r.push(v),!0):!1))continue;if(v=this.tokenizer.escape(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.tag(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.link(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(v.raw.length);const x=r.at(-1);v.type==="text"&&(x==null?void 0:x.type)==="text"?(x.raw+=v.raw,x.text+=v.text):r.push(v);continue}if(v=this.tokenizer.emStrong(n,o,d)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.codespan(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.br(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.del(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.autolink(n)){n=n.substring(v.raw.length),r.push(v);continue}if(!this.state.inLink&&(v=this.tokenizer.url(n))){n=n.substring(v.raw.length),r.push(v);continue}let k=n;if((m=this.options.extensions)!=null&&m.startInline){let x=1/0;const S=n.slice(1);let C;this.options.extensions.startInline.forEach(T=>{C=T.call({lexer:this},S),typeof C=="number"&&C>=0&&(x=Math.min(x,C))}),x<1/0&&x>=0&&(k=n.substring(0,x+1))}if(v=this.tokenizer.inlineText(k)){n=n.substring(v.raw.length),v.raw.slice(-1)!=="_"&&(d=v.raw.slice(-1)),c=!0;const x=r.at(-1);(x==null?void 0:x.type)==="text"?(x.raw+=v.raw,x.text+=v.text):r.push(v);continue}if(n){const x="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return r}},Fl=class{constructor(e){at(this,"options");at(this,"parser");this.options=e||Br}space(e){return""}code({text:e,lang:n,escaped:r}){var c;const o=(c=(n||"").match(Nn.notSpaceStart))==null?void 0:c[0],l=e.replace(Nn.endingNewline,"")+`
492
- `;return o?'<pre><code class="language-'+Ns(o)+'">'+(r?l:Ns(l,!0))+`</code></pre>
493
- `:"<pre><code>"+(r?l:Ns(l,!0))+`</code></pre>
491
+ `+f.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):r.push(f);continue}if(n){const m="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return this.state.top=!0,r}inline(n,r=[]){return this.inlineQueue.push({src:n,tokens:r}),r}inlineTokens(n,r=[]){var f,h,m;let o=n,l=null;if(this.tokens.links){const v=Object.keys(this.tokens.links);if(v.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(o))!=null;)v.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(l=this.tokenizer.rules.inline.anyPunctuation.exec(o))!=null;)o=o.slice(0,l.index)+"++"+o.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(l=this.tokenizer.rules.inline.blockSkip.exec(o))!=null;)o=o.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let c=!1,d="";for(;n;){c||(d=""),c=!1;let v;if((h=(f=this.options.extensions)==null?void 0:f.inline)!=null&&h.some(x=>(v=x.call({lexer:this},n,r))?(n=n.substring(v.raw.length),r.push(v),!0):!1))continue;if(v=this.tokenizer.escape(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.tag(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.link(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(v.raw.length);const x=r.at(-1);v.type==="text"&&(x==null?void 0:x.type)==="text"?(x.raw+=v.raw,x.text+=v.text):r.push(v);continue}if(v=this.tokenizer.emStrong(n,o,d)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.codespan(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.br(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.del(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.autolink(n)){n=n.substring(v.raw.length),r.push(v);continue}if(!this.state.inLink&&(v=this.tokenizer.url(n))){n=n.substring(v.raw.length),r.push(v);continue}let k=n;if((m=this.options.extensions)!=null&&m.startInline){let x=1/0;const S=n.slice(1);let C;this.options.extensions.startInline.forEach(T=>{C=T.call({lexer:this},S),typeof C=="number"&&C>=0&&(x=Math.min(x,C))}),x<1/0&&x>=0&&(k=n.substring(0,x+1))}if(v=this.tokenizer.inlineText(k)){n=n.substring(v.raw.length),v.raw.slice(-1)!=="_"&&(d=v.raw.slice(-1)),c=!0;const x=r.at(-1);(x==null?void 0:x.type)==="text"?(x.raw+=v.raw,x.text+=v.text):r.push(v);continue}if(n){const x="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return r}},Ul=class{constructor(e){at(this,"options");at(this,"parser");this.options=e||Br}space(e){return""}code({text:e,lang:n,escaped:r}){var c;const o=(c=(n||"").match(Nn.notSpaceStart))==null?void 0:c[0],l=e.replace(Nn.endingNewline,"")+`
492
+ `;return o?'<pre><code class="language-'+Ts(o)+'">'+(r?l:Ts(l,!0))+`</code></pre>
493
+ `:"<pre><code>"+(r?l:Ts(l,!0))+`</code></pre>
494
494
  `}blockquote({tokens:e}){return`<blockquote>
495
495
  ${this.parser.parse(e)}</blockquote>
496
496
  `}html({text:e}){return e}heading({tokens:e,depth:n}){return`<h${n}>${this.parser.parseInline(e)}</h${n}>
497
497
  `}hr(e){return`<hr>
498
498
  `}list(e){const n=e.ordered,r=e.start;let o="";for(let d=0;d<e.items.length;d++){const f=e.items[d];o+=this.listitem(f)}const l=n?"ol":"ul",c=n&&r!==1?' start="'+r+'"':"";return"<"+l+c+`>
499
499
  `+o+"</"+l+`>
500
- `}listitem(e){var r;let n="";if(e.task){const o=this.checkbox({checked:!!e.checked});e.loose?((r=e.tokens[0])==null?void 0:r.type)==="paragraph"?(e.tokens[0].text=o+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=o+" "+Ns(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:o+" ",text:o+" ",escaped:!0}):n+=o+" "}return n+=this.parser.parse(e.tokens,!!e.loose),`<li>${n}</li>
500
+ `}listitem(e){var r;let n="";if(e.task){const o=this.checkbox({checked:!!e.checked});e.loose?((r=e.tokens[0])==null?void 0:r.type)==="paragraph"?(e.tokens[0].text=o+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=o+" "+Ts(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:o+" ",text:o+" ",escaped:!0}):n+=o+" "}return n+=this.parser.parse(e.tokens,!!e.loose),`<li>${n}</li>
501
501
  `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
502
502
  `}table(e){let n="",r="";for(let l=0;l<e.header.length;l++)r+=this.tablecell(e.header[l]);n+=this.tablerow({text:r});let o="";for(let l=0;l<e.rows.length;l++){const c=e.rows[l];r="";for(let d=0;d<c.length;d++)r+=this.tablecell(c[d]);o+=this.tablerow({text:r})}return o&&(o=`<tbody>${o}</tbody>`),`<table>
503
503
  <thead>
@@ -506,19 +506,19 @@ ${this.parser.parse(e)}</blockquote>
506
506
  `}tablerow({text:e}){return`<tr>
507
507
  ${e}</tr>
508
508
  `}tablecell(e){const n=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+n+`</${r}>
509
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Ns(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:n,tokens:r}){const o=this.parser.parseInline(r),l=tg(e);if(l===null)return o;e=l;let c='<a href="'+e+'"';return n&&(c+=' title="'+Ns(n)+'"'),c+=">"+o+"</a>",c}image({href:e,title:n,text:r,tokens:o}){o&&(r=this.parser.parseInline(o,this.parser.textRenderer));const l=tg(e);if(l===null)return Ns(r);e=l;let c=`<img src="${e}" alt="${r}"`;return n&&(c+=` title="${Ns(n)}"`),c+=">",c}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Ns(e.text)}},kf=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},zs=class Rd{constructor(n){at(this,"options");at(this,"renderer");at(this,"textRenderer");this.options=n||Br,this.options.renderer=this.options.renderer||new Fl,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new kf}static parse(n,r){return new Rd(r).parse(n)}static parseInline(n,r){return new Rd(r).parseInline(n)}parse(n,r=!0){var l,c;let o="";for(let d=0;d<n.length;d++){const f=n[d];if((c=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&c[f.type]){const m=f,v=this.options.extensions.renderers[m.type].call({parser:this},m);if(v!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(m.type)){o+=v||"";continue}}const h=f;switch(h.type){case"space":{o+=this.renderer.space(h);continue}case"hr":{o+=this.renderer.hr(h);continue}case"heading":{o+=this.renderer.heading(h);continue}case"code":{o+=this.renderer.code(h);continue}case"table":{o+=this.renderer.table(h);continue}case"blockquote":{o+=this.renderer.blockquote(h);continue}case"list":{o+=this.renderer.list(h);continue}case"html":{o+=this.renderer.html(h);continue}case"paragraph":{o+=this.renderer.paragraph(h);continue}case"text":{let m=h,v=this.renderer.text(m);for(;d+1<n.length&&n[d+1].type==="text";)m=n[++d],v+=`
510
- `+this.renderer.text(m);r?o+=this.renderer.paragraph({type:"paragraph",raw:v,text:v,tokens:[{type:"text",raw:v,text:v,escaped:!0}]}):o+=v;continue}default:{const m='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}parseInline(n,r=this.renderer){var l,c;let o="";for(let d=0;d<n.length;d++){const f=n[d];if((c=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&c[f.type]){const m=this.options.extensions.renderers[f.type].call({parser:this},f);if(m!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(f.type)){o+=m||"";continue}}const h=f;switch(h.type){case"escape":{o+=r.text(h);break}case"html":{o+=r.html(h);break}case"link":{o+=r.link(h);break}case"image":{o+=r.image(h);break}case"strong":{o+=r.strong(h);break}case"em":{o+=r.em(h);break}case"codespan":{o+=r.codespan(h);break}case"br":{o+=r.br(h);break}case"del":{o+=r.del(h);break}case"text":{o+=r.text(h);break}default:{const m='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}},md,gl=(md=class{constructor(e){at(this,"options");at(this,"block");this.options=e||Br}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?Ps.lex:Ps.lexInline}provideParser(){return this.block?zs.parse:zs.parseInline}},at(md,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),md),ON=class{constructor(...e){at(this,"defaults",pf());at(this,"options",this.setOptions);at(this,"parse",this.parseMarkdown(!0));at(this,"parseInline",this.parseMarkdown(!1));at(this,"Parser",zs);at(this,"Renderer",Fl);at(this,"TextRenderer",kf);at(this,"Lexer",Ps);at(this,"Tokenizer",zl);at(this,"Hooks",gl);this.use(...e)}walkTokens(e,n){var o,l;let r=[];for(const c of e)switch(r=r.concat(n.call(this,c)),c.type){case"table":{const d=c;for(const f of d.header)r=r.concat(this.walkTokens(f.tokens,n));for(const f of d.rows)for(const h of f)r=r.concat(this.walkTokens(h.tokens,n));break}case"list":{const d=c;r=r.concat(this.walkTokens(d.items,n));break}default:{const d=c;(l=(o=this.defaults.extensions)==null?void 0:o.childTokens)!=null&&l[d.type]?this.defaults.extensions.childTokens[d.type].forEach(f=>{const h=d[f].flat(1/0);r=r.concat(this.walkTokens(h,n))}):d.tokens&&(r=r.concat(this.walkTokens(d.tokens,n)))}}return r}use(...e){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{const o={...r};if(o.async=this.defaults.async||o.async||!1,r.extensions&&(r.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){const c=n.renderers[l.name];c?n.renderers[l.name]=function(...d){let f=l.renderer.apply(this,d);return f===!1&&(f=c.apply(this,d)),f}:n.renderers[l.name]=l.renderer}if("tokenizer"in l){if(!l.level||l.level!=="block"&&l.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const c=n[l.level];c?c.unshift(l.tokenizer):n[l.level]=[l.tokenizer],l.start&&(l.level==="block"?n.startBlock?n.startBlock.push(l.start):n.startBlock=[l.start]:l.level==="inline"&&(n.startInline?n.startInline.push(l.start):n.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(n.childTokens[l.name]=l.childTokens)}),o.extensions=n),r.renderer){const l=this.defaults.renderer||new Fl(this.defaults);for(const c in r.renderer){if(!(c in l))throw new Error(`renderer '${c}' does not exist`);if(["options","parser"].includes(c))continue;const d=c,f=r.renderer[d],h=l[d];l[d]=(...m)=>{let v=f.apply(l,m);return v===!1&&(v=h.apply(l,m)),v||""}}o.renderer=l}if(r.tokenizer){const l=this.defaults.tokenizer||new zl(this.defaults);for(const c in r.tokenizer){if(!(c in l))throw new Error(`tokenizer '${c}' does not exist`);if(["options","rules","lexer"].includes(c))continue;const d=c,f=r.tokenizer[d],h=l[d];l[d]=(...m)=>{let v=f.apply(l,m);return v===!1&&(v=h.apply(l,m)),v}}o.tokenizer=l}if(r.hooks){const l=this.defaults.hooks||new gl;for(const c in r.hooks){if(!(c in l))throw new Error(`hook '${c}' does not exist`);if(["options","block"].includes(c))continue;const d=c,f=r.hooks[d],h=l[d];gl.passThroughHooks.has(c)?l[d]=m=>{if(this.defaults.async)return Promise.resolve(f.call(l,m)).then(k=>h.call(l,k));const v=f.call(l,m);return h.call(l,v)}:l[d]=(...m)=>{let v=f.apply(l,m);return v===!1&&(v=h.apply(l,m)),v}}o.hooks=l}if(r.walkTokens){const l=this.defaults.walkTokens,c=r.walkTokens;o.walkTokens=function(d){let f=[];return f.push(c.call(this,d)),l&&(f=f.concat(l.call(this,d))),f}}this.defaults={...this.defaults,...o}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,n){return Ps.lex(e,n??this.defaults)}parser(e,n){return zs.parse(e,n??this.defaults)}parseMarkdown(e){return(r,o)=>{const l={...o},c={...this.defaults,...l},d=this.onError(!!c.silent,!!c.async);if(this.defaults.async===!0&&l.async===!1)return d(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return d(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return d(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));c.hooks&&(c.hooks.options=c,c.hooks.block=e);const f=c.hooks?c.hooks.provideLexer():e?Ps.lex:Ps.lexInline,h=c.hooks?c.hooks.provideParser():e?zs.parse:zs.parseInline;if(c.async)return Promise.resolve(c.hooks?c.hooks.preprocess(r):r).then(m=>f(m,c)).then(m=>c.hooks?c.hooks.processAllTokens(m):m).then(m=>c.walkTokens?Promise.all(this.walkTokens(m,c.walkTokens)).then(()=>m):m).then(m=>h(m,c)).then(m=>c.hooks?c.hooks.postprocess(m):m).catch(d);try{c.hooks&&(r=c.hooks.preprocess(r));let m=f(r,c);c.hooks&&(m=c.hooks.processAllTokens(m)),c.walkTokens&&this.walkTokens(m,c.walkTokens);let v=h(m,c);return c.hooks&&(v=c.hooks.postprocess(v)),v}catch(m){return d(m)}}}onError(e,n){return r=>{if(r.message+=`
511
- Please report this to https://github.com/markedjs/marked.`,e){const o="<p>An error occurred:</p><pre>"+Ns(r.message+"",!0)+"</pre>";return n?Promise.resolve(o):o}if(n)return Promise.reject(r);throw r}}},Ur=new ON;function Ge(e,n){return Ur.parse(e,n)}Ge.options=Ge.setOptions=function(e){return Ur.setOptions(e),Ge.defaults=Ur.defaults,Ty(Ge.defaults),Ge};Ge.getDefaults=pf;Ge.defaults=Br;Ge.use=function(...e){return Ur.use(...e),Ge.defaults=Ur.defaults,Ty(Ge.defaults),Ge};Ge.walkTokens=function(e,n){return Ur.walkTokens(e,n)};Ge.parseInline=Ur.parseInline;Ge.Parser=zs;Ge.parser=zs.parse;Ge.Renderer=Fl;Ge.TextRenderer=kf;Ge.Lexer=Ps;Ge.lexer=Ps.lex;Ge.Tokenizer=zl;Ge.Hooks=gl;Ge.parse=Ge;Ge.options;Ge.setOptions;Ge.use;Ge.walkTokens;Ge.parseInline;zs.parse;Ps.lex;/*! @license DOMPurify 3.4.13 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.13/LICENSE */function rg(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=Array(n);r<n;r++)o[r]=e[r];return o}function $N(e){if(Array.isArray(e))return e}function PN(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,l,c,d,f=[],h=!0,m=!1;try{if(c=(r=r.call(e)).next,n!==0)for(;!(h=(o=c.call(r)).done)&&(f.push(o.value),f.length!==n);h=!0);}catch(v){m=!0,l=v}finally{try{if(!h&&r.return!=null&&(d=r.return(),Object(d)!==d))return}finally{if(m)throw l}}return f}}function zN(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
512
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function FN(e,n){return $N(e)||PN(e,n)||UN(e,n)||zN()}function UN(e,n){if(e){if(typeof e=="string")return rg(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?rg(e,n):void 0}}const Oy=Object.entries,og=Object.setPrototypeOf,BN=Object.isFrozen,WN=Object.getPrototypeOf,HN=Object.getOwnPropertyDescriptor;let rn=Object.freeze,on=Object.seal,ko=Object.create,$y=typeof Reflect<"u"&&Reflect,Ad=$y.apply,Id=$y.construct;rn||(rn=function(n){return n});on||(on=function(n){return n});Ad||(Ad=function(n,r){for(var o=arguments.length,l=new Array(o>2?o-2:0),c=2;c<o;c++)l[c-2]=arguments[c];return n.apply(r,l)});Id||(Id=function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];return new n(...o)});const go=zt(Array.prototype.forEach),VN=zt(Array.prototype.lastIndexOf),ig=zt(Array.prototype.pop),vo=zt(Array.prototype.push),KN=zt(Array.prototype.splice),fr=Array.isArray,Ti=zt(String.prototype.toLowerCase),id=zt(String.prototype.toString),ag=zt(String.prototype.match),wi=zt(String.prototype.replace),lg=zt(String.prototype.indexOf),GN=zt(String.prototype.trim),qN=zt(Number.prototype.toString),XN=zt(Boolean.prototype.toString),cg=typeof BigInt>"u"?null:zt(BigInt.prototype.toString),ug=typeof Symbol>"u"?null:zt(Symbol.prototype.toString),Jt=zt(Object.prototype.hasOwnProperty),ki=zt(Object.prototype.toString),Zt=zt(RegExp.prototype.test),$r=YN(TypeError);function zt(e){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];return Ad(e,n,o)}}function YN(e){return function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return Id(e,r)}}function Ke(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ti;if(og&&og(e,null),!fr(n))return e;let o=n.length;for(;o--;){let l=n[o];if(typeof l=="string"){const c=r(l);c!==l&&(BN(n)||(n[o]=c),l=c)}e[l]=!0}return e}function QN(e){for(let n=0;n<e.length;n++)Jt(e,n)||(e[n]=null);return e}function pn(e){const n=ko(null);for(const o of Oy(e)){var r=FN(o,2);const l=r[0],c=r[1];Jt(e,l)&&(fr(c)?n[l]=QN(c):c&&typeof c=="object"&&c.constructor===Object?n[l]=pn(c):n[l]=c)}return n}function ZN(e){switch(typeof e){case"string":return e;case"number":return qN(e);case"boolean":return XN(e);case"bigint":return cg?cg(e):"0";case"symbol":return ug?ug(e):"Symbol()";case"undefined":return ki(e);case"function":case"object":{if(e===null)return ki(e);const n=e,r=cs(n,"toString");if(typeof r=="function"){const o=r(n);return typeof o=="string"?o:ki(o)}return ki(e)}default:return ki(e)}}function cs(e,n){for(;e!==null;){const o=HN(e,n);if(o){if(o.get)return zt(o.get);if(typeof o.value=="function")return zt(o.value)}e=WN(e)}function r(){return null}return r}function JN(e){try{return Zt(e,""),!0}catch{return!1}}const dg=rn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ad=rn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ld=rn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),eT=rn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),cd=rn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),tT=rn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),fg=rn(["#text"]),pg=rn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),ud=rn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),hg=rn(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ll=rn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),nT=on(/{{[\w\W]*|^[\w\W]*}}/g),sT=on(/<%[\w\W]*|^[\w\W]*%>/g),rT=on(/\${[\w\W]*/g),oT=on(/^data-[\-\w.\u00B7-\uFFFF]+$/),iT=on(/^aria-[\-\w]+$/),mg=on(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),aT=on(/^(?:\w+script|data):/i),lT=on(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),cT=on(/^html$/i),uT=on(/^[a-z][.\w]*(-[.\w]+)+$/i),gg=on(/<[/\w!]/g),vg=on(/<[/\w]/g),dT=on(/<\/no(script|embed|frames)/i),fT=on(/\/>/i),Hn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},pT=function(){return typeof window>"u"?null:window},hT=function(n,r){if(typeof n!="object"||typeof n.createPolicy!="function")return null;let o=null;const l="data-tt-policy-suffix";r&&r.hasAttribute(l)&&(o=r.getAttribute(l));const c="dompurify"+(o?"#"+o:"");try{return n.createPolicy(c,{createHTML(d){return d},createScriptURL(d){return d}})}catch{return console.warn("TrustedTypes policy "+c+" could not be created."),null}},yg=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},ur=function(n,r,o,l){return Jt(n,r)&&fr(n[r])?Ke(l.base?pn(l.base):{},n[r],l.transform):o};function Py(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:pT();const n=de=>Py(de);if(n.version="3.4.13",n.removed=[],!e||!e.document||e.document.nodeType!==Hn.document||!e.Element)return n.isSupported=!1,n;let r=e.document;const o=r,l=o.currentScript;e.DocumentFragment;const c=e.HTMLTemplateElement,d=e.Node,f=e.Element,h=e.NodeFilter,m=e.NamedNodeMap;m===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const v=e.DOMParser,k=e.trustedTypes,x=f.prototype,S=cs(x,"cloneNode"),C=cs(x,"remove"),T=cs(x,"nextSibling"),E=cs(x,"childNodes"),b=cs(x,"parentNode"),j=cs(x,"shadowRoot"),P=cs(x,"attributes"),M=d&&d.prototype?cs(d.prototype,"nodeType"):null,L=d&&d.prototype?cs(d.prototype,"nodeName"):null,G=d&&d.prototype?cs(d.prototype,"ownerDocument"):null;if(typeof c=="function"){const de=r.createElement("template");de.content&&de.content.ownerDocument&&(r=de.content.ownerDocument)}let z,U="",Q,J=!1,oe=0;const me=function(){if(oe>0)throw $r('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Se=function(N){me(),oe++;try{return z.createHTML(N)}finally{oe--}},Me=function(N){me(),oe++;try{return z.createScriptURL(N)}finally{oe--}},ee=function(){return J||(Q=hT(k,l),J=!0),Q},ie=r,te=ie.implementation,F=ie.createNodeIterator,Z=ie.createDocumentFragment,q=ie.getElementsByTagName,I=o.importNode;let $=yg();n.isSupported=typeof Oy=="function"&&typeof b=="function"&&te&&te.createHTMLDocument!==void 0;const ue=nT,B=sT,X=rT,ce=oT,be=iT,_e=aT,Ae=lT,je=uT;let ge=mg,he=null;const Ve=Ke({},[...dg,...ad,...ld,...cd,...fg]);let Ie=null;const mt=Ke({},[...pg,...ud,...hg,...ll]);let Ue=Object.seal(ko(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Vt=null,tn=null;const St=Object.seal(ko(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let jt=!0,Ft=!0,Ot=!1,Y=!0,ve=!1,Be=!0,rt=!1,gt=!1,vt=null,_t=null,an=!1,dt=!1,Mn=!1,Ln=!1,hs=!0,ms=!1;const ns="user-content-";let On=!0,gn=!1,ln={},Kt=null;const vn=Ke({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Ze=null;const Rt=Ke({},["audio","video","img","source","image","track"]);let ft=null;const Gt=Ke({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),yt="http://www.w3.org/1998/Math/MathML",xt="http://www.w3.org/2000/svg",lt="http://www.w3.org/1999/xhtml";let qt=lt,it=!1,$t=null;const R=Ke({},[yt,xt,lt],id),pe=rn(["mi","mo","mn","ms","mtext"]);let le=Ke({},pe);const we=rn(["annotation-xml"]);let $e=Ke({},we);const qe=Ke({},["title","style","font","a","script"]);let Pe=null;const Ut=["application/xhtml+xml","text/html"],$n="text/html";let We=null,yn=null;const js=r.createElement("form"),Bs=function(N){return N instanceof RegExp||N instanceof Function},Pn=function(){let N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(yn&&yn===N)return;(!N||typeof N!="object")&&(N={}),N=pn(N),Pe=Ut.indexOf(N.PARSER_MEDIA_TYPE)===-1?$n:N.PARSER_MEDIA_TYPE,We=Pe==="application/xhtml+xml"?id:Ti,he=ur(N,"ALLOWED_TAGS",Ve,{transform:We}),Ie=ur(N,"ALLOWED_ATTR",mt,{transform:We}),$t=ur(N,"ALLOWED_NAMESPACES",R,{transform:id}),ft=ur(N,"ADD_URI_SAFE_ATTR",Gt,{transform:We,base:Gt}),Ze=ur(N,"ADD_DATA_URI_TAGS",Rt,{transform:We,base:Rt}),Kt=ur(N,"FORBID_CONTENTS",vn,{transform:We}),Vt=ur(N,"FORBID_TAGS",pn({}),{transform:We}),tn=ur(N,"FORBID_ATTR",pn({}),{transform:We}),ln=Jt(N,"USE_PROFILES")?N.USE_PROFILES&&typeof N.USE_PROFILES=="object"?pn(N.USE_PROFILES):N.USE_PROFILES:!1,jt=N.ALLOW_ARIA_ATTR!==!1,Ft=N.ALLOW_DATA_ATTR!==!1,Ot=N.ALLOW_UNKNOWN_PROTOCOLS||!1,Y=N.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ve=N.SAFE_FOR_TEMPLATES||!1,Be=N.SAFE_FOR_XML!==!1,rt=N.WHOLE_DOCUMENT||!1,dt=N.RETURN_DOM||!1,Mn=N.RETURN_DOM_FRAGMENT||!1,Ln=N.RETURN_TRUSTED_TYPE||!1,an=N.FORCE_BODY||!1,hs=N.SANITIZE_DOM!==!1,ms=N.SANITIZE_NAMED_PROPS||!1,On=N.KEEP_CONTENT!==!1,gn=N.IN_PLACE||!1,ge=JN(N.ALLOWED_URI_REGEXP)?N.ALLOWED_URI_REGEXP:mg,qt=typeof N.NAMESPACE=="string"?N.NAMESPACE:lt,le=Jt(N,"MATHML_TEXT_INTEGRATION_POINTS")&&N.MATHML_TEXT_INTEGRATION_POINTS&&typeof N.MATHML_TEXT_INTEGRATION_POINTS=="object"?pn(N.MATHML_TEXT_INTEGRATION_POINTS):Ke({},pe),$e=Jt(N,"HTML_INTEGRATION_POINTS")&&N.HTML_INTEGRATION_POINTS&&typeof N.HTML_INTEGRATION_POINTS=="object"?pn(N.HTML_INTEGRATION_POINTS):Ke({},we);const W=Jt(N,"CUSTOM_ELEMENT_HANDLING")&&N.CUSTOM_ELEMENT_HANDLING&&typeof N.CUSTOM_ELEMENT_HANDLING=="object"?pn(N.CUSTOM_ELEMENT_HANDLING):ko(null);if(Ue=ko(null),Jt(W,"tagNameCheck")&&Bs(W.tagNameCheck)&&(Ue.tagNameCheck=W.tagNameCheck),Jt(W,"attributeNameCheck")&&Bs(W.attributeNameCheck)&&(Ue.attributeNameCheck=W.attributeNameCheck),Jt(W,"allowCustomizedBuiltInElements")&&typeof W.allowCustomizedBuiltInElements=="boolean"&&(Ue.allowCustomizedBuiltInElements=W.allowCustomizedBuiltInElements),on(Ue),ve&&(Ft=!1),Mn&&(dt=!0),ln&&(he=Ke({},fg),Ie=ko(null),ln.html===!0&&(Ke(he,dg),Ke(Ie,pg)),ln.svg===!0&&(Ke(he,ad),Ke(Ie,ud),Ke(Ie,ll)),ln.svgFilters===!0&&(Ke(he,ld),Ke(Ie,ud),Ke(Ie,ll)),ln.mathMl===!0&&(Ke(he,cd),Ke(Ie,hg),Ke(Ie,ll))),St.tagCheck=null,St.attributeCheck=null,Jt(N,"ADD_TAGS")&&(typeof N.ADD_TAGS=="function"?St.tagCheck=N.ADD_TAGS:fr(N.ADD_TAGS)&&(he===Ve&&(he=pn(he)),Ke(he,N.ADD_TAGS,We))),Jt(N,"ADD_ATTR")&&(typeof N.ADD_ATTR=="function"?St.attributeCheck=N.ADD_ATTR:fr(N.ADD_ATTR)&&(Ie===mt&&(Ie=pn(Ie)),Ke(Ie,N.ADD_ATTR,We))),Jt(N,"ADD_URI_SAFE_ATTR")&&fr(N.ADD_URI_SAFE_ATTR)&&Ke(ft,N.ADD_URI_SAFE_ATTR,We),Jt(N,"FORBID_CONTENTS")&&fr(N.FORBID_CONTENTS)&&(Kt===vn&&(Kt=pn(Kt)),Ke(Kt,N.FORBID_CONTENTS,We)),Jt(N,"ADD_FORBID_CONTENTS")&&fr(N.ADD_FORBID_CONTENTS)&&(Kt===vn&&(Kt=pn(Kt)),Ke(Kt,N.ADD_FORBID_CONTENTS,We)),On&&(he["#text"]=!0),rt&&Ke(he,["html","head","body"]),he.table&&(Ke(he,["tbody"]),delete Vt.tbody),N.TRUSTED_TYPES_POLICY){if(typeof N.TRUSTED_TYPES_POLICY.createHTML!="function")throw $r('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof N.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw $r('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const ne=z;z=N.TRUSTED_TYPES_POLICY;try{U=Se("")}catch(Te){throw z=ne,Te}}else N.TRUSTED_TYPES_POLICY===null?(z=void 0,U=""):(z===void 0&&(z=ee()),z&&typeof U=="string"&&(U=Se("")));rn&&rn(N),yn=N},gs=Ke({},[...ad,...ld,...eT]),Je=Ke({},[...cd,...tT]),At=function(N,W,ne){return W.namespaceURI===lt?N==="svg":W.namespaceURI===yt?N==="svg"&&(ne==="annotation-xml"||le[ne]):!!gs[N]},vs=function(N,W,ne){return W.namespaceURI===lt?N==="math":W.namespaceURI===xt?N==="math"&&$e[ne]:!!Je[N]},cc=function(N,W,ne){return W.namespaceURI===xt&&!$e[ne]||W.namespaceURI===yt&&!le[ne]?!1:!Je[N]&&(qe[N]||!gs[N])},bt=function(N){let W=b(N);(!W||!W.tagName)&&(W={namespaceURI:qt,tagName:"template"});const ne=Ti(N.tagName),Te=Ti(W.tagName);return $t[N.namespaceURI]?N.namespaceURI===xt?At(ne,W,Te):N.namespaceURI===yt?vs(ne,W,Te):N.namespaceURI===lt?cc(ne,W,Te):!!(Pe==="application/xhtml+xml"&&$t[N.namespaceURI]):!1},ys=function(N){vo(n.removed,{element:N});try{b(N).removeChild(N)}catch{if(C(N),!b(N))throw $r("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Ws=function(N){xr(N);const W=E(N);if(W){const Te=[];go(W,Re=>{vo(Te,Re)}),go(Te,Re=>{try{C(Re)}catch{}})}const ne=P(N);if(ne)for(let Te=ne.length-1;Te>=0;--Te){const Re=ne[Te],Fe=Re&&Re.name;if(typeof Fe=="string")try{N.removeAttribute(Fe)}catch{}}},xs=function(N,W){try{vo(n.removed,{attribute:W.getAttributeNode(N),from:W})}catch{vo(n.removed,{attribute:null,from:W})}if(W.removeAttribute(N),N==="is")if(dt||Mn)try{ys(W)}catch{}else try{W.setAttribute(N,"")}catch{}},Wr=function(N){const W=P(N);if(W)for(let ne=W.length-1;ne>=0;--ne){const Te=W[ne],Re=Te&&Te.name;if(!(typeof Re!="string"||Ie[We(Re)]))try{N.removeAttribute(Re)}catch{}}},xr=function(N){const W=[N];for(;W.length>0;){const ne=W.pop();(M?M(ne):ne.nodeType)===Hn.element&&Wr(ne);const Re=E(ne);if(Re)for(let Fe=Re.length-1;Fe>=0;--Fe)W.push(Re[Fe])}},Yi=function(N){if(!Be)return;const W=[N];for(;W.length>0;){const ne=W.pop(),Te=M?M(ne):ne.nodeType;if(Te===Hn.processingInstruction||Te===Hn.comment&&Zt(vg,ne.data)){try{C(ne)}catch{}continue}if(Te===Hn.element){const Fe=ne,Ye=We(L?L(ne):ne.nodeName);try{Fe.hasAttribute&&Fe.hasAttribute("patchsrc")&&Fe.removeAttribute("patchsrc"),Fe.hasAttribute&&Fe.hasAttribute("for")&&Ye!=="label"&&Ye!=="output"&&Fe.removeAttribute("for")}catch{}}const Re=E(ne);if(Re)for(let Fe=Re.length-1;Fe>=0;--Fe)W.push(Re[Fe])}},wr=function(N){let W=null,ne=null;if(an)N="<remove></remove>"+N;else{const Fe=ag(N,/^[\r\n\t ]+/);ne=Fe&&Fe[0]}Pe==="application/xhtml+xml"&&qt===lt&&(N='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+N+"</body></html>");const Te=z?Se(N):N;if(qt===lt)try{W=new v().parseFromString(Te,Pe)}catch{}if(!W||!W.documentElement){W=te.createDocument(qt,"template",null);try{W.documentElement.innerHTML=it?U:Te}catch{}}const Re=W.body||W.documentElement;return N&&ne&&Re.insertBefore(r.createTextNode(ne),Re.childNodes[0]||null),qt===lt?q.call(W,rt?"html":"body")[0]:rt?W.documentElement:Re},zn=function(N){const W=G?G(N):N.ownerDocument;return F.call(W||N,N,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Hr=function(N){return N=wi(N,ue," "),N=wi(N,B," "),N=wi(N,X," "),N},xn=function(N){var W;N.normalize();const ne=G?G(N):N.ownerDocument,Te=F.call(ne||N,N,h.SHOW_TEXT|h.SHOW_COMMENT|h.SHOW_CDATA_SECTION|h.SHOW_PROCESSING_INSTRUCTION,null);let Re=Te.nextNode();for(;Re;)Re.data=Hr(Re.data),Re=Te.nextNode();const Fe=(W=N.querySelectorAll)===null||W===void 0?void 0:W.call(N,"template");Fe&&go(Fe,Ye=>{Hs(Ye.content)&&xn(Ye.content)})},Vr=function(N){const W=L?L(N):null;return typeof W!="string"||We(W)!=="form"?!1:typeof N.nodeName!="string"||typeof N.textContent!="string"||typeof N.removeChild!="function"||N.attributes!==P(N)||typeof N.removeAttribute!="function"||typeof N.setAttribute!="function"||typeof N.namespaceURI!="string"||typeof N.insertBefore!="function"||typeof N.hasChildNodes!="function"||N.nodeType!==M(N)||N.childNodes!==E(N)},Hs=function(N){if(!M||typeof N!="object"||N===null)return!1;try{return M(N)===Hn.documentFragment}catch{return!1}},kr=function(N){if(!M||typeof N!="object"||N===null)return!1;try{return typeof M(N)=="number"}catch{return!1}};function wn(de,N,W){de.length!==0&&go(de,ne=>{ne.call(n,N,W,yn)})}const Kr=function(N,W){return!!(Be&&N.hasChildNodes()&&!kr(N.firstElementChild)&&Zt(gg,N.textContent)&&Zt(gg,N.innerHTML)||Be&&N.namespaceURI===lt&&W==="style"&&kr(N.firstElementChild)||N.nodeType===Hn.processingInstruction||Be&&N.nodeType===Hn.comment&&Zt(vg,N.data))},Sr=function(N,W,ne){if(!Vt[W]&&Po(W)&&(Ue.tagNameCheck instanceof RegExp&&Zt(Ue.tagNameCheck,W)||Ue.tagNameCheck instanceof Function&&Ue.tagNameCheck(W)))return!1;if(On&&!Kt[W]){const Te=b(N),Re=E(N);if(Re&&Te){const Fe=Re.length;for(let Ye=Fe-1;Ye>=0;--Ye){const et=N===ne?S(Re[Ye],!0):Re[Ye];Te.insertBefore(et,T(N))}}}return ys(N),!0},br=function(N,W,ne,Te){return N.length===0?W:W===ne||W===Te?pn(W):W},Qi=function(N,W){if(wn($.beforeSanitizeElements,N,null),N!==W&&b(N)===null)return gn&&xr(N),!0;if(Vr(N))return ys(N),!0;const ne=We(L?L(N):N.nodeName);if(he=br($.uponSanitizeElement,he,Ve,vt),wn($.uponSanitizeElement,N,{tagName:ne,allowedTags:he}),N!==W&&b(N)===null)return gn&&xr(N),!0;if(Kr(N,ne))return ys(N),!0;if(Vt[ne]||!(St.tagCheck instanceof Function&&St.tagCheck(ne))&&!he[ne]){const Re=Sr(N,ne,W);return Re===!1&&wn($.afterSanitizeElements,N,null),Re}if((M?M(N):N.nodeType)===Hn.element&&!bt(N)||(ne==="noscript"||ne==="noembed"||ne==="noframes")&&Zt(dT,N.innerHTML))return ys(N),!0;if(ve&&N.nodeType===Hn.text){const Re=Hr(N.textContent);N.textContent!==Re&&(vo(n.removed,{element:N.cloneNode()}),N.textContent=Re)}return wn($.afterSanitizeElements,N,null),!1},Zi=function(N,W,ne){if(tn[W]||Be&&W==="patchsrc"||Be&&W==="for"&&N!=="label"&&N!=="output"||hs&&(W==="id"||W==="name")&&(ne in r||ne in js))return!1;const Te=Ie[W]||St.attributeCheck instanceof Function&&St.attributeCheck(W,N);if(!(Ft&&Zt(ce,W))){if(!(jt&&Zt(be,W))){if(Te){if(!ft[W]){if(!Zt(ge,wi(ne,Ae,""))){if(!((W==="src"||W==="xlink:href"||W==="href")&&N!=="script"&&lg(ne,"data:")===0&&Ze[N])){if(!(Ot&&!Zt(_e,wi(ne,Ae,"")))){if(ne)return!1}}}}}else if(!(Po(N)&&(Ue.tagNameCheck instanceof RegExp&&Zt(Ue.tagNameCheck,N)||Ue.tagNameCheck instanceof Function&&Ue.tagNameCheck(N))&&(Ue.attributeNameCheck instanceof RegExp&&Zt(Ue.attributeNameCheck,W)||Ue.attributeNameCheck instanceof Function&&Ue.attributeNameCheck(W,N))||W==="is"&&Ue.allowCustomizedBuiltInElements&&(Ue.tagNameCheck instanceof RegExp&&Zt(Ue.tagNameCheck,ne)||Ue.tagNameCheck instanceof Function&&Ue.tagNameCheck(ne))))return!1}}return!0},$o=Ke({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Po=function(N){return!$o[Ti(N)]&&Zt(je,N)},zo=function(N,W,ne,Te){if(z&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!ne)switch(k.getAttributeType(N,W)){case"TrustedHTML":return Se(Te);case"TrustedScriptURL":return Me(Te)}return Te},Nr=function(N,W,ne,Te){try{ne?N.setAttributeNS(ne,W,Te):N.setAttribute(W,Te),Vr(N)?ys(N):ig(n.removed)}catch{xs(W,N)}},Ji=function(N){wn($.beforeSanitizeAttributes,N,null);const W=N.attributes;if(!W||Vr(N))return;Ie=br($.uponSanitizeAttribute,Ie,mt,_t);const ne={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ie,forceKeepAttr:void 0};let Te=W.length;const Re=We(N.nodeName);for(;Te--;){const Fe=W[Te],Ye=Fe.name,et=Fe.namespaceURI,Nt=Fe.value,Tt=We(Ye),_s=Nt;let Dt=Ye==="value"?_s:GN(_s);if(ne.attrName=Tt,ne.attrValue=Dt,ne.keepAttr=!0,ne.forceKeepAttr=void 0,wn($.uponSanitizeAttribute,N,ne),Dt=ne.attrValue,ms&&(Tt==="id"||Tt==="name")&&lg(Dt,ns)!==0&&(xs(Ye,N),Dt=ns+Dt),Be&&Zt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Dt)){xs(Ye,N);continue}if(Tt==="attributename"&&ag(Dt,"href")){xs(Ye,N);continue}if(!ne.forceKeepAttr){if(!ne.keepAttr){xs(Ye,N);continue}if(!Y&&Zt(fT,Dt)){xs(Ye,N);continue}if(ve&&(Dt=Hr(Dt)),!Zi(Re,Tt,Dt)){xs(Ye,N);continue}Dt=zo(Re,Tt,et,Dt),Dt!==_s&&Nr(N,Ye,et,Dt)}}wn($.afterSanitizeAttributes,N,null)},Vs=function(N){let W=null;const ne=zn(N);for(wn($.beforeSanitizeShadowDOM,N,null);W=ne.nextNode();)if(wn($.uponSanitizeShadowNode,W,null),Qi(W,N),Ji(W),Hs(W.content)&&Vs(W.content),(M?M(W):W.nodeType)===Hn.element){const Re=j(W);Hs(Re)&&(Xe(Re),Vs(Re))}wn($.afterSanitizeShadowDOM,N,null)},Xe=function(N){const W=[{node:N,shadow:null}];for(;W.length>0;){const ne=W.pop();if(ne.shadow){Vs(ne.shadow);continue}const Te=ne.node,Fe=(M?M(Te):Te.nodeType)===Hn.element,Ye=E(Te);if(Ye)for(let et=Ye.length-1;et>=0;--et)W.push({node:Ye[et],shadow:null});if(Fe){const et=L?L(Te):null;if(typeof et=="string"&&We(et)==="template"){const Nt=Te.content;Hs(Nt)&&W.push({node:Nt,shadow:null})}}if(Fe){const et=j(Te);Hs(et)&&W.push({node:null,shadow:et},{node:et,shadow:null})}}};return n.sanitize=function(de){let N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},W=null,ne=null,Te=null,Re=null;if(it=!de,it&&(de="<!-->"),typeof de!="string"&&!kr(de)&&(de=ZN(de),typeof de!="string"))throw $r("dirty is not a string, aborting");if(!n.isSupported)return de;gt?(he=vt,Ie=_t):Pn(N),($.uponSanitizeElement.length>0||$.uponSanitizeAttribute.length>0)&&(he=pn(he)),$.uponSanitizeAttribute.length>0&&(Ie=pn(Ie)),n.removed=[];const Fe=gn&&typeof de!="string"&&kr(de);if(Fe){Yi(de);const Nt=L?L(de):de.nodeName;if(typeof Nt=="string"){const Tt=We(Nt);if(!he[Tt]||Vt[Tt])throw Ws(de),$r("root node is forbidden and cannot be sanitized in-place")}if(Vr(de))throw Ws(de),$r("root node is clobbered and cannot be sanitized in-place");try{Xe(de)}catch(Tt){throw Ws(de),Tt}}else if(kr(de))W=wr("<!---->"),ne=W.ownerDocument.importNode(de,!0),ne.nodeType===Hn.element&&ne.nodeName==="BODY"||ne.nodeName==="HTML"?W=ne:W.appendChild(ne),Xe(ne);else{if(!dt&&!ve&&!rt&&de.indexOf("<")===-1)return z&&Ln?Se(de):de;if(W=wr(de),!W)return dt?null:Ln?U:""}W&&an&&ys(W.firstChild);const Ye=Fe?de:W;try{const Nt=zn(Ye);for(;Te=Nt.nextNode();)Qi(Te,Ye),Ji(Te),Hs(Te.content)&&Vs(Te.content)}catch(Nt){throw Fe&&(Ws(de),go(n.removed,Tt=>{Tt.element&&xr(Tt.element)})),Nt}if(Fe)return go(n.removed,Nt=>{Nt.element&&xr(Nt.element)}),ve&&xn(de),de;if(dt){if(ve&&xn(W),Mn)for(Re=Z.call(W.ownerDocument);W.firstChild;)Re.appendChild(W.firstChild);else Re=W;return(Ie.shadowroot||Ie.shadowrootmode)&&(Re=I.call(o,Re,!0)),Re}let et=rt?W.outerHTML:W.innerHTML;return rt&&he["!doctype"]&&W.ownerDocument&&W.ownerDocument.doctype&&W.ownerDocument.doctype.name&&Zt(cT,W.ownerDocument.doctype.name)&&(et="<!DOCTYPE "+W.ownerDocument.doctype.name+`>
513
- `+et),ve&&(et=Hr(et)),z&&Ln?Se(et):et},n.setConfig=function(){let de=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Pn(de),gt=!0,vt=he,_t=Ie},n.clearConfig=function(){yn=null,gt=!1,vt=null,_t=null,z=Q,U=""},n.isValidAttribute=function(de,N,W){yn||Pn({});const ne=We(de),Te=We(N);return Zi(ne,Te,W)},n.addHook=function(de,N){typeof N=="function"&&Jt($,de)&&vo($[de],N)},n.removeHook=function(de,N){if(Jt($,de)){if(N!==void 0){const W=VN($[de],N);return W===-1?void 0:KN($[de],W,1)[0]}return ig($[de])}},n.removeHooks=function(de){Jt($,de)&&($[de]=[])},n.removeAllHooks=function(){$=yg()},n}var Sf=Py();const mT=new Set(["command_execution","file_change","mcp_tool_call","web_search"]),gT=100;function xg(e){return mT.has(e.type)}function vT({items:e,runtimeType:n,turn:r,threads:o=[]}){const[l,c]=y.useState(!1),[d,f]=y.useState(!1);if(e.length===0)return null;const h=e.length,m=d?0:Math.max(0,h-gT),v=m>0?e.slice(m):e;return a.jsxs("div",{className:"tool-calls",children:[a.jsxs("div",{className:"tool-calls-header",onClick:()=>c(k=>!k),children:[a.jsx("span",{className:"tool-calls-icon",children:a.jsx(Y1,{size:12})}),a.jsxs("span",{className:"tool-calls-summary",children:[h," tool call",h>1?"s":""]}),a.jsx(Li,{size:14,className:"tool-calls-chevron",style:{transform:l?"rotate(90deg)":"none"}})]}),l&&a.jsxs("div",{className:"tool-calls-body",children:[m>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>f(!0),children:["Show ",m," earlier tool call",m>1?"s":""]})}),v.map(k=>a.jsx(Pr,{item:k,runtimeType:n,turn:r,threads:o},k.id))]})]})}Ge.setOptions({breaks:!0,gfm:!0});function yT(e){const n=Ge.parse(e);return Sf.sanitize(n)}function wg(e,n){var l;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o=0;for(;r.nextNode();){const c=r.currentNode,d=((l=c.textContent)==null?void 0:l.length)??0;if(o+d>n)return{node:c,offset:n-o};o+=d}return null}function xT(e,n,r){const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),l=[];for(;o.nextNode();){const c=o.currentNode;if(!c.textContent||c.textContent.trim()==="")continue;const d=document.createRange();d.selectNodeContents(c),!(d.compareBoundaryPoints(Range.START_TO_END,n)<=0)&&(d.compareBoundaryPoints(Range.END_TO_START,n)>=0||l.push(c))}for(const c of l){const d=c.length;let f=0,h=d;if(c===n.startContainer&&(f=Math.min(n.startOffset,d)),c===n.endContainer&&(h=Math.min(n.endOffset,d)),f>=h)continue;h<d&&c.splitText(h);const m=f>0?c.splitText(f):c,v=r(),k=m.parentNode;k&&(k.insertBefore(v,m),v.appendChild(m))}}function wT(e,n){e.querySelectorAll("mark[data-thread-id]").forEach(r=>{const o=r.parentNode;if(!o)return;const l=document.createTextNode(r.textContent||"");o.replaceChild(l,r),o.normalize()});for(const r of n){if(r.start_offset===null||r.end_offset===null)continue;const o=wg(e,r.start_offset),l=wg(e,r.end_offset);if(!o||!l)continue;const c=document.createRange();c.setStart(o.node,o.offset),c.setEnd(l.node,l.offset),xT(e,c,()=>{const d=document.createElement("mark");return d.setAttribute("data-thread-id",r.id),r.status==="resolved"&&d.classList.add("thread-mark-resolved"),d})}}function kT(e){const n=window.getSelection();if(!n||n.rangeCount===0)return null;const r=n.getRangeAt(0);if(r.collapsed||!e.contains(r.commonAncestorContainer))return null;const o=document.createRange();o.setStart(e,0),o.setEnd(r.startContainer,r.startOffset);const l=o.toString().length,c=r.toString();return{start:l,end:l+c.length,text:c}}function ST({itemId:e,turnId:n,sessionId:r,content:o,threads:l}){const c=y.useRef(null),d=y.useRef(null),f=y.useRef(null),h=y.useRef(""),m=y.useRef(0),[v,k]=y.useState(!1),[x,S]=y.useState({x:0,y:0}),[C,T]=y.useState(!1),[E,b]=y.useState({x:0,y:0}),[j,P]=y.useState(""),[M,L]=y.useState(null),[G,z]=y.useState(!1),U=A(q=>q.createThread),Q=A(q=>q.switchRightTab),J=A(q=>Kl(q.sessionDetails[r])),oe=y.useCallback(async()=>{await Fi(o||""),z(!0),setTimeout(()=>z(!1),1500)},[o]),me=y.useCallback(()=>{var I;if(!M)return;const q=`
509
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Ts(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:n,tokens:r}){const o=this.parser.parseInline(r),l=tg(e);if(l===null)return o;e=l;let c='<a href="'+e+'"';return n&&(c+=' title="'+Ts(n)+'"'),c+=">"+o+"</a>",c}image({href:e,title:n,text:r,tokens:o}){o&&(r=this.parser.parseInline(o,this.parser.textRenderer));const l=tg(e);if(l===null)return Ts(r);e=l;let c=`<img src="${e}" alt="${r}"`;return n&&(c+=` title="${Ts(n)}"`),c+=">",c}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Ts(e.text)}},kf=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},zs=class Ad{constructor(n){at(this,"options");at(this,"renderer");at(this,"textRenderer");this.options=n||Br,this.options.renderer=this.options.renderer||new Ul,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new kf}static parse(n,r){return new Ad(r).parse(n)}static parseInline(n,r){return new Ad(r).parseInline(n)}parse(n,r=!0){var l,c;let o="";for(let d=0;d<n.length;d++){const f=n[d];if((c=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&c[f.type]){const m=f,v=this.options.extensions.renderers[m.type].call({parser:this},m);if(v!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(m.type)){o+=v||"";continue}}const h=f;switch(h.type){case"space":{o+=this.renderer.space(h);continue}case"hr":{o+=this.renderer.hr(h);continue}case"heading":{o+=this.renderer.heading(h);continue}case"code":{o+=this.renderer.code(h);continue}case"table":{o+=this.renderer.table(h);continue}case"blockquote":{o+=this.renderer.blockquote(h);continue}case"list":{o+=this.renderer.list(h);continue}case"html":{o+=this.renderer.html(h);continue}case"paragraph":{o+=this.renderer.paragraph(h);continue}case"text":{let m=h,v=this.renderer.text(m);for(;d+1<n.length&&n[d+1].type==="text";)m=n[++d],v+=`
510
+ `+this.renderer.text(m);r?o+=this.renderer.paragraph({type:"paragraph",raw:v,text:v,tokens:[{type:"text",raw:v,text:v,escaped:!0}]}):o+=v;continue}default:{const m='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}parseInline(n,r=this.renderer){var l,c;let o="";for(let d=0;d<n.length;d++){const f=n[d];if((c=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&c[f.type]){const m=this.options.extensions.renderers[f.type].call({parser:this},f);if(m!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(f.type)){o+=m||"";continue}}const h=f;switch(h.type){case"escape":{o+=r.text(h);break}case"html":{o+=r.html(h);break}case"link":{o+=r.link(h);break}case"image":{o+=r.image(h);break}case"strong":{o+=r.strong(h);break}case"em":{o+=r.em(h);break}case"codespan":{o+=r.codespan(h);break}case"br":{o+=r.br(h);break}case"del":{o+=r.del(h);break}case"text":{o+=r.text(h);break}default:{const m='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}},gd,gl=(gd=class{constructor(e){at(this,"options");at(this,"block");this.options=e||Br}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?Ps.lex:Ps.lexInline}provideParser(){return this.block?zs.parse:zs.parseInline}},at(gd,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),gd),$N=class{constructor(...e){at(this,"defaults",pf());at(this,"options",this.setOptions);at(this,"parse",this.parseMarkdown(!0));at(this,"parseInline",this.parseMarkdown(!1));at(this,"Parser",zs);at(this,"Renderer",Ul);at(this,"TextRenderer",kf);at(this,"Lexer",Ps);at(this,"Tokenizer",Fl);at(this,"Hooks",gl);this.use(...e)}walkTokens(e,n){var o,l;let r=[];for(const c of e)switch(r=r.concat(n.call(this,c)),c.type){case"table":{const d=c;for(const f of d.header)r=r.concat(this.walkTokens(f.tokens,n));for(const f of d.rows)for(const h of f)r=r.concat(this.walkTokens(h.tokens,n));break}case"list":{const d=c;r=r.concat(this.walkTokens(d.items,n));break}default:{const d=c;(l=(o=this.defaults.extensions)==null?void 0:o.childTokens)!=null&&l[d.type]?this.defaults.extensions.childTokens[d.type].forEach(f=>{const h=d[f].flat(1/0);r=r.concat(this.walkTokens(h,n))}):d.tokens&&(r=r.concat(this.walkTokens(d.tokens,n)))}}return r}use(...e){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{const o={...r};if(o.async=this.defaults.async||o.async||!1,r.extensions&&(r.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){const c=n.renderers[l.name];c?n.renderers[l.name]=function(...d){let f=l.renderer.apply(this,d);return f===!1&&(f=c.apply(this,d)),f}:n.renderers[l.name]=l.renderer}if("tokenizer"in l){if(!l.level||l.level!=="block"&&l.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const c=n[l.level];c?c.unshift(l.tokenizer):n[l.level]=[l.tokenizer],l.start&&(l.level==="block"?n.startBlock?n.startBlock.push(l.start):n.startBlock=[l.start]:l.level==="inline"&&(n.startInline?n.startInline.push(l.start):n.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(n.childTokens[l.name]=l.childTokens)}),o.extensions=n),r.renderer){const l=this.defaults.renderer||new Ul(this.defaults);for(const c in r.renderer){if(!(c in l))throw new Error(`renderer '${c}' does not exist`);if(["options","parser"].includes(c))continue;const d=c,f=r.renderer[d],h=l[d];l[d]=(...m)=>{let v=f.apply(l,m);return v===!1&&(v=h.apply(l,m)),v||""}}o.renderer=l}if(r.tokenizer){const l=this.defaults.tokenizer||new Fl(this.defaults);for(const c in r.tokenizer){if(!(c in l))throw new Error(`tokenizer '${c}' does not exist`);if(["options","rules","lexer"].includes(c))continue;const d=c,f=r.tokenizer[d],h=l[d];l[d]=(...m)=>{let v=f.apply(l,m);return v===!1&&(v=h.apply(l,m)),v}}o.tokenizer=l}if(r.hooks){const l=this.defaults.hooks||new gl;for(const c in r.hooks){if(!(c in l))throw new Error(`hook '${c}' does not exist`);if(["options","block"].includes(c))continue;const d=c,f=r.hooks[d],h=l[d];gl.passThroughHooks.has(c)?l[d]=m=>{if(this.defaults.async)return Promise.resolve(f.call(l,m)).then(k=>h.call(l,k));const v=f.call(l,m);return h.call(l,v)}:l[d]=(...m)=>{let v=f.apply(l,m);return v===!1&&(v=h.apply(l,m)),v}}o.hooks=l}if(r.walkTokens){const l=this.defaults.walkTokens,c=r.walkTokens;o.walkTokens=function(d){let f=[];return f.push(c.call(this,d)),l&&(f=f.concat(l.call(this,d))),f}}this.defaults={...this.defaults,...o}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,n){return Ps.lex(e,n??this.defaults)}parser(e,n){return zs.parse(e,n??this.defaults)}parseMarkdown(e){return(r,o)=>{const l={...o},c={...this.defaults,...l},d=this.onError(!!c.silent,!!c.async);if(this.defaults.async===!0&&l.async===!1)return d(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return d(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return d(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));c.hooks&&(c.hooks.options=c,c.hooks.block=e);const f=c.hooks?c.hooks.provideLexer():e?Ps.lex:Ps.lexInline,h=c.hooks?c.hooks.provideParser():e?zs.parse:zs.parseInline;if(c.async)return Promise.resolve(c.hooks?c.hooks.preprocess(r):r).then(m=>f(m,c)).then(m=>c.hooks?c.hooks.processAllTokens(m):m).then(m=>c.walkTokens?Promise.all(this.walkTokens(m,c.walkTokens)).then(()=>m):m).then(m=>h(m,c)).then(m=>c.hooks?c.hooks.postprocess(m):m).catch(d);try{c.hooks&&(r=c.hooks.preprocess(r));let m=f(r,c);c.hooks&&(m=c.hooks.processAllTokens(m)),c.walkTokens&&this.walkTokens(m,c.walkTokens);let v=h(m,c);return c.hooks&&(v=c.hooks.postprocess(v)),v}catch(m){return d(m)}}}onError(e,n){return r=>{if(r.message+=`
511
+ Please report this to https://github.com/markedjs/marked.`,e){const o="<p>An error occurred:</p><pre>"+Ts(r.message+"",!0)+"</pre>";return n?Promise.resolve(o):o}if(n)return Promise.reject(r);throw r}}},Ur=new $N;function Ge(e,n){return Ur.parse(e,n)}Ge.options=Ge.setOptions=function(e){return Ur.setOptions(e),Ge.defaults=Ur.defaults,Ty(Ge.defaults),Ge};Ge.getDefaults=pf;Ge.defaults=Br;Ge.use=function(...e){return Ur.use(...e),Ge.defaults=Ur.defaults,Ty(Ge.defaults),Ge};Ge.walkTokens=function(e,n){return Ur.walkTokens(e,n)};Ge.parseInline=Ur.parseInline;Ge.Parser=zs;Ge.parser=zs.parse;Ge.Renderer=Ul;Ge.TextRenderer=kf;Ge.Lexer=Ps;Ge.lexer=Ps.lex;Ge.Tokenizer=Fl;Ge.Hooks=gl;Ge.parse=Ge;Ge.options;Ge.setOptions;Ge.use;Ge.walkTokens;Ge.parseInline;zs.parse;Ps.lex;/*! @license DOMPurify 3.4.13 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.13/LICENSE */function rg(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=Array(n);r<n;r++)o[r]=e[r];return o}function PN(e){if(Array.isArray(e))return e}function zN(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,l,c,d,f=[],h=!0,m=!1;try{if(c=(r=r.call(e)).next,n!==0)for(;!(h=(o=c.call(r)).done)&&(f.push(o.value),f.length!==n);h=!0);}catch(v){m=!0,l=v}finally{try{if(!h&&r.return!=null&&(d=r.return(),Object(d)!==d))return}finally{if(m)throw l}}return f}}function FN(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
512
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UN(e,n){return PN(e)||zN(e,n)||BN(e,n)||FN()}function BN(e,n){if(e){if(typeof e=="string")return rg(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?rg(e,n):void 0}}const Oy=Object.entries,og=Object.setPrototypeOf,WN=Object.isFrozen,HN=Object.getPrototypeOf,VN=Object.getOwnPropertyDescriptor;let rn=Object.freeze,on=Object.seal,ko=Object.create,$y=typeof Reflect<"u"&&Reflect,Id=$y.apply,Dd=$y.construct;rn||(rn=function(n){return n});on||(on=function(n){return n});Id||(Id=function(n,r){for(var o=arguments.length,l=new Array(o>2?o-2:0),c=2;c<o;c++)l[c-2]=arguments[c];return n.apply(r,l)});Dd||(Dd=function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];return new n(...o)});const go=zt(Array.prototype.forEach),KN=zt(Array.prototype.lastIndexOf),ig=zt(Array.prototype.pop),vo=zt(Array.prototype.push),GN=zt(Array.prototype.splice),fr=Array.isArray,Ti=zt(String.prototype.toLowerCase),ad=zt(String.prototype.toString),ag=zt(String.prototype.match),wi=zt(String.prototype.replace),lg=zt(String.prototype.indexOf),qN=zt(String.prototype.trim),XN=zt(Number.prototype.toString),YN=zt(Boolean.prototype.toString),cg=typeof BigInt>"u"?null:zt(BigInt.prototype.toString),ug=typeof Symbol>"u"?null:zt(Symbol.prototype.toString),Jt=zt(Object.prototype.hasOwnProperty),ki=zt(Object.prototype.toString),Zt=zt(RegExp.prototype.test),$r=QN(TypeError);function zt(e){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];return Id(e,n,o)}}function QN(e){return function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return Dd(e,r)}}function Ke(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ti;if(og&&og(e,null),!fr(n))return e;let o=n.length;for(;o--;){let l=n[o];if(typeof l=="string"){const c=r(l);c!==l&&(WN(n)||(n[o]=c),l=c)}e[l]=!0}return e}function ZN(e){for(let n=0;n<e.length;n++)Jt(e,n)||(e[n]=null);return e}function pn(e){const n=ko(null);for(const o of Oy(e)){var r=UN(o,2);const l=r[0],c=r[1];Jt(e,l)&&(fr(c)?n[l]=ZN(c):c&&typeof c=="object"&&c.constructor===Object?n[l]=pn(c):n[l]=c)}return n}function JN(e){switch(typeof e){case"string":return e;case"number":return XN(e);case"boolean":return YN(e);case"bigint":return cg?cg(e):"0";case"symbol":return ug?ug(e):"Symbol()";case"undefined":return ki(e);case"function":case"object":{if(e===null)return ki(e);const n=e,r=cs(n,"toString");if(typeof r=="function"){const o=r(n);return typeof o=="string"?o:ki(o)}return ki(e)}default:return ki(e)}}function cs(e,n){for(;e!==null;){const o=VN(e,n);if(o){if(o.get)return zt(o.get);if(typeof o.value=="function")return zt(o.value)}e=HN(e)}function r(){return null}return r}function eT(e){try{return Zt(e,""),!0}catch{return!1}}const dg=rn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ld=rn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),cd=rn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),tT=rn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),ud=rn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),nT=rn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),fg=rn(["#text"]),pg=rn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),dd=rn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),hg=rn(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ll=rn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),sT=on(/{{[\w\W]*|^[\w\W]*}}/g),rT=on(/<%[\w\W]*|^[\w\W]*%>/g),oT=on(/\${[\w\W]*/g),iT=on(/^data-[\-\w.\u00B7-\uFFFF]+$/),aT=on(/^aria-[\-\w]+$/),mg=on(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),lT=on(/^(?:\w+script|data):/i),cT=on(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),uT=on(/^html$/i),dT=on(/^[a-z][.\w]*(-[.\w]+)+$/i),gg=on(/<[/\w!]/g),vg=on(/<[/\w]/g),fT=on(/<\/no(script|embed|frames)/i),pT=on(/\/>/i),Hn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},hT=function(){return typeof window>"u"?null:window},mT=function(n,r){if(typeof n!="object"||typeof n.createPolicy!="function")return null;let o=null;const l="data-tt-policy-suffix";r&&r.hasAttribute(l)&&(o=r.getAttribute(l));const c="dompurify"+(o?"#"+o:"");try{return n.createPolicy(c,{createHTML(d){return d},createScriptURL(d){return d}})}catch{return console.warn("TrustedTypes policy "+c+" could not be created."),null}},yg=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},ur=function(n,r,o,l){return Jt(n,r)&&fr(n[r])?Ke(l.base?pn(l.base):{},n[r],l.transform):o};function Py(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:hT();const n=de=>Py(de);if(n.version="3.4.13",n.removed=[],!e||!e.document||e.document.nodeType!==Hn.document||!e.Element)return n.isSupported=!1,n;let r=e.document;const o=r,l=o.currentScript;e.DocumentFragment;const c=e.HTMLTemplateElement,d=e.Node,f=e.Element,h=e.NodeFilter,m=e.NamedNodeMap;m===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const v=e.DOMParser,k=e.trustedTypes,x=f.prototype,S=cs(x,"cloneNode"),C=cs(x,"remove"),T=cs(x,"nextSibling"),E=cs(x,"childNodes"),b=cs(x,"parentNode"),j=cs(x,"shadowRoot"),P=cs(x,"attributes"),M=d&&d.prototype?cs(d.prototype,"nodeType"):null,L=d&&d.prototype?cs(d.prototype,"nodeName"):null,G=d&&d.prototype?cs(d.prototype,"ownerDocument"):null;if(typeof c=="function"){const de=r.createElement("template");de.content&&de.content.ownerDocument&&(r=de.content.ownerDocument)}let z,U="",Q,J=!1,oe=0;const me=function(){if(oe>0)throw $r('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Se=function(N){me(),oe++;try{return z.createHTML(N)}finally{oe--}},Me=function(N){me(),oe++;try{return z.createScriptURL(N)}finally{oe--}},ee=function(){return J||(Q=mT(k,l),J=!0),Q},ie=r,te=ie.implementation,F=ie.createNodeIterator,Z=ie.createDocumentFragment,q=ie.getElementsByTagName,I=o.importNode;let $=yg();n.isSupported=typeof Oy=="function"&&typeof b=="function"&&te&&te.createHTMLDocument!==void 0;const ue=sT,B=rT,X=oT,ce=iT,be=aT,_e=lT,Ae=cT,je=dT;let ge=mg,he=null;const Ve=Ke({},[...dg,...ld,...cd,...ud,...fg]);let Ie=null;const mt=Ke({},[...pg,...dd,...hg,...ll]);let Ue=Object.seal(ko(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Vt=null,tn=null;const St=Object.seal(ko(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let jt=!0,Ft=!0,Ot=!1,Y=!0,ve=!1,Be=!0,rt=!1,gt=!1,vt=null,_t=null,an=!1,dt=!1,Mn=!1,Ln=!1,ms=!0,gs=!1;const ns="user-content-";let On=!0,gn=!1,ln={},Kt=null;const vn=Ke({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Ze=null;const Rt=Ke({},["audio","video","img","source","image","track"]);let ft=null;const Gt=Ke({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),yt="http://www.w3.org/1998/Math/MathML",xt="http://www.w3.org/2000/svg",lt="http://www.w3.org/1999/xhtml";let qt=lt,it=!1,$t=null;const R=Ke({},[yt,xt,lt],ad),pe=rn(["mi","mo","mn","ms","mtext"]);let le=Ke({},pe);const we=rn(["annotation-xml"]);let $e=Ke({},we);const qe=Ke({},["title","style","font","a","script"]);let Pe=null;const Ut=["application/xhtml+xml","text/html"],$n="text/html";let We=null,yn=null;const js=r.createElement("form"),Bs=function(N){return N instanceof RegExp||N instanceof Function},Pn=function(){let N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(yn&&yn===N)return;(!N||typeof N!="object")&&(N={}),N=pn(N),Pe=Ut.indexOf(N.PARSER_MEDIA_TYPE)===-1?$n:N.PARSER_MEDIA_TYPE,We=Pe==="application/xhtml+xml"?ad:Ti,he=ur(N,"ALLOWED_TAGS",Ve,{transform:We}),Ie=ur(N,"ALLOWED_ATTR",mt,{transform:We}),$t=ur(N,"ALLOWED_NAMESPACES",R,{transform:ad}),ft=ur(N,"ADD_URI_SAFE_ATTR",Gt,{transform:We,base:Gt}),Ze=ur(N,"ADD_DATA_URI_TAGS",Rt,{transform:We,base:Rt}),Kt=ur(N,"FORBID_CONTENTS",vn,{transform:We}),Vt=ur(N,"FORBID_TAGS",pn({}),{transform:We}),tn=ur(N,"FORBID_ATTR",pn({}),{transform:We}),ln=Jt(N,"USE_PROFILES")?N.USE_PROFILES&&typeof N.USE_PROFILES=="object"?pn(N.USE_PROFILES):N.USE_PROFILES:!1,jt=N.ALLOW_ARIA_ATTR!==!1,Ft=N.ALLOW_DATA_ATTR!==!1,Ot=N.ALLOW_UNKNOWN_PROTOCOLS||!1,Y=N.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ve=N.SAFE_FOR_TEMPLATES||!1,Be=N.SAFE_FOR_XML!==!1,rt=N.WHOLE_DOCUMENT||!1,dt=N.RETURN_DOM||!1,Mn=N.RETURN_DOM_FRAGMENT||!1,Ln=N.RETURN_TRUSTED_TYPE||!1,an=N.FORCE_BODY||!1,ms=N.SANITIZE_DOM!==!1,gs=N.SANITIZE_NAMED_PROPS||!1,On=N.KEEP_CONTENT!==!1,gn=N.IN_PLACE||!1,ge=eT(N.ALLOWED_URI_REGEXP)?N.ALLOWED_URI_REGEXP:mg,qt=typeof N.NAMESPACE=="string"?N.NAMESPACE:lt,le=Jt(N,"MATHML_TEXT_INTEGRATION_POINTS")&&N.MATHML_TEXT_INTEGRATION_POINTS&&typeof N.MATHML_TEXT_INTEGRATION_POINTS=="object"?pn(N.MATHML_TEXT_INTEGRATION_POINTS):Ke({},pe),$e=Jt(N,"HTML_INTEGRATION_POINTS")&&N.HTML_INTEGRATION_POINTS&&typeof N.HTML_INTEGRATION_POINTS=="object"?pn(N.HTML_INTEGRATION_POINTS):Ke({},we);const W=Jt(N,"CUSTOM_ELEMENT_HANDLING")&&N.CUSTOM_ELEMENT_HANDLING&&typeof N.CUSTOM_ELEMENT_HANDLING=="object"?pn(N.CUSTOM_ELEMENT_HANDLING):ko(null);if(Ue=ko(null),Jt(W,"tagNameCheck")&&Bs(W.tagNameCheck)&&(Ue.tagNameCheck=W.tagNameCheck),Jt(W,"attributeNameCheck")&&Bs(W.attributeNameCheck)&&(Ue.attributeNameCheck=W.attributeNameCheck),Jt(W,"allowCustomizedBuiltInElements")&&typeof W.allowCustomizedBuiltInElements=="boolean"&&(Ue.allowCustomizedBuiltInElements=W.allowCustomizedBuiltInElements),on(Ue),ve&&(Ft=!1),Mn&&(dt=!0),ln&&(he=Ke({},fg),Ie=ko(null),ln.html===!0&&(Ke(he,dg),Ke(Ie,pg)),ln.svg===!0&&(Ke(he,ld),Ke(Ie,dd),Ke(Ie,ll)),ln.svgFilters===!0&&(Ke(he,cd),Ke(Ie,dd),Ke(Ie,ll)),ln.mathMl===!0&&(Ke(he,ud),Ke(Ie,hg),Ke(Ie,ll))),St.tagCheck=null,St.attributeCheck=null,Jt(N,"ADD_TAGS")&&(typeof N.ADD_TAGS=="function"?St.tagCheck=N.ADD_TAGS:fr(N.ADD_TAGS)&&(he===Ve&&(he=pn(he)),Ke(he,N.ADD_TAGS,We))),Jt(N,"ADD_ATTR")&&(typeof N.ADD_ATTR=="function"?St.attributeCheck=N.ADD_ATTR:fr(N.ADD_ATTR)&&(Ie===mt&&(Ie=pn(Ie)),Ke(Ie,N.ADD_ATTR,We))),Jt(N,"ADD_URI_SAFE_ATTR")&&fr(N.ADD_URI_SAFE_ATTR)&&Ke(ft,N.ADD_URI_SAFE_ATTR,We),Jt(N,"FORBID_CONTENTS")&&fr(N.FORBID_CONTENTS)&&(Kt===vn&&(Kt=pn(Kt)),Ke(Kt,N.FORBID_CONTENTS,We)),Jt(N,"ADD_FORBID_CONTENTS")&&fr(N.ADD_FORBID_CONTENTS)&&(Kt===vn&&(Kt=pn(Kt)),Ke(Kt,N.ADD_FORBID_CONTENTS,We)),On&&(he["#text"]=!0),rt&&Ke(he,["html","head","body"]),he.table&&(Ke(he,["tbody"]),delete Vt.tbody),N.TRUSTED_TYPES_POLICY){if(typeof N.TRUSTED_TYPES_POLICY.createHTML!="function")throw $r('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof N.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw $r('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const ne=z;z=N.TRUSTED_TYPES_POLICY;try{U=Se("")}catch(Te){throw z=ne,Te}}else N.TRUSTED_TYPES_POLICY===null?(z=void 0,U=""):(z===void 0&&(z=ee()),z&&typeof U=="string"&&(U=Se("")));rn&&rn(N),yn=N},vs=Ke({},[...ld,...cd,...tT]),Je=Ke({},[...ud,...nT]),At=function(N,W,ne){return W.namespaceURI===lt?N==="svg":W.namespaceURI===yt?N==="svg"&&(ne==="annotation-xml"||le[ne]):!!vs[N]},ys=function(N,W,ne){return W.namespaceURI===lt?N==="math":W.namespaceURI===xt?N==="math"&&$e[ne]:!!Je[N]},uc=function(N,W,ne){return W.namespaceURI===xt&&!$e[ne]||W.namespaceURI===yt&&!le[ne]?!1:!Je[N]&&(qe[N]||!vs[N])},bt=function(N){let W=b(N);(!W||!W.tagName)&&(W={namespaceURI:qt,tagName:"template"});const ne=Ti(N.tagName),Te=Ti(W.tagName);return $t[N.namespaceURI]?N.namespaceURI===xt?At(ne,W,Te):N.namespaceURI===yt?ys(ne,W,Te):N.namespaceURI===lt?uc(ne,W,Te):!!(Pe==="application/xhtml+xml"&&$t[N.namespaceURI]):!1},xs=function(N){vo(n.removed,{element:N});try{b(N).removeChild(N)}catch{if(C(N),!b(N))throw $r("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Ws=function(N){xr(N);const W=E(N);if(W){const Te=[];go(W,Re=>{vo(Te,Re)}),go(Te,Re=>{try{C(Re)}catch{}})}const ne=P(N);if(ne)for(let Te=ne.length-1;Te>=0;--Te){const Re=ne[Te],Fe=Re&&Re.name;if(typeof Fe=="string")try{N.removeAttribute(Fe)}catch{}}},ws=function(N,W){try{vo(n.removed,{attribute:W.getAttributeNode(N),from:W})}catch{vo(n.removed,{attribute:null,from:W})}if(W.removeAttribute(N),N==="is")if(dt||Mn)try{xs(W)}catch{}else try{W.setAttribute(N,"")}catch{}},Wr=function(N){const W=P(N);if(W)for(let ne=W.length-1;ne>=0;--ne){const Te=W[ne],Re=Te&&Te.name;if(!(typeof Re!="string"||Ie[We(Re)]))try{N.removeAttribute(Re)}catch{}}},xr=function(N){const W=[N];for(;W.length>0;){const ne=W.pop();(M?M(ne):ne.nodeType)===Hn.element&&Wr(ne);const Re=E(ne);if(Re)for(let Fe=Re.length-1;Fe>=0;--Fe)W.push(Re[Fe])}},Yi=function(N){if(!Be)return;const W=[N];for(;W.length>0;){const ne=W.pop(),Te=M?M(ne):ne.nodeType;if(Te===Hn.processingInstruction||Te===Hn.comment&&Zt(vg,ne.data)){try{C(ne)}catch{}continue}if(Te===Hn.element){const Fe=ne,Ye=We(L?L(ne):ne.nodeName);try{Fe.hasAttribute&&Fe.hasAttribute("patchsrc")&&Fe.removeAttribute("patchsrc"),Fe.hasAttribute&&Fe.hasAttribute("for")&&Ye!=="label"&&Ye!=="output"&&Fe.removeAttribute("for")}catch{}}const Re=E(ne);if(Re)for(let Fe=Re.length-1;Fe>=0;--Fe)W.push(Re[Fe])}},wr=function(N){let W=null,ne=null;if(an)N="<remove></remove>"+N;else{const Fe=ag(N,/^[\r\n\t ]+/);ne=Fe&&Fe[0]}Pe==="application/xhtml+xml"&&qt===lt&&(N='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+N+"</body></html>");const Te=z?Se(N):N;if(qt===lt)try{W=new v().parseFromString(Te,Pe)}catch{}if(!W||!W.documentElement){W=te.createDocument(qt,"template",null);try{W.documentElement.innerHTML=it?U:Te}catch{}}const Re=W.body||W.documentElement;return N&&ne&&Re.insertBefore(r.createTextNode(ne),Re.childNodes[0]||null),qt===lt?q.call(W,rt?"html":"body")[0]:rt?W.documentElement:Re},zn=function(N){const W=G?G(N):N.ownerDocument;return F.call(W||N,N,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Hr=function(N){return N=wi(N,ue," "),N=wi(N,B," "),N=wi(N,X," "),N},xn=function(N){var W;N.normalize();const ne=G?G(N):N.ownerDocument,Te=F.call(ne||N,N,h.SHOW_TEXT|h.SHOW_COMMENT|h.SHOW_CDATA_SECTION|h.SHOW_PROCESSING_INSTRUCTION,null);let Re=Te.nextNode();for(;Re;)Re.data=Hr(Re.data),Re=Te.nextNode();const Fe=(W=N.querySelectorAll)===null||W===void 0?void 0:W.call(N,"template");Fe&&go(Fe,Ye=>{Hs(Ye.content)&&xn(Ye.content)})},Vr=function(N){const W=L?L(N):null;return typeof W!="string"||We(W)!=="form"?!1:typeof N.nodeName!="string"||typeof N.textContent!="string"||typeof N.removeChild!="function"||N.attributes!==P(N)||typeof N.removeAttribute!="function"||typeof N.setAttribute!="function"||typeof N.namespaceURI!="string"||typeof N.insertBefore!="function"||typeof N.hasChildNodes!="function"||N.nodeType!==M(N)||N.childNodes!==E(N)},Hs=function(N){if(!M||typeof N!="object"||N===null)return!1;try{return M(N)===Hn.documentFragment}catch{return!1}},kr=function(N){if(!M||typeof N!="object"||N===null)return!1;try{return typeof M(N)=="number"}catch{return!1}};function wn(de,N,W){de.length!==0&&go(de,ne=>{ne.call(n,N,W,yn)})}const Kr=function(N,W){return!!(Be&&N.hasChildNodes()&&!kr(N.firstElementChild)&&Zt(gg,N.textContent)&&Zt(gg,N.innerHTML)||Be&&N.namespaceURI===lt&&W==="style"&&kr(N.firstElementChild)||N.nodeType===Hn.processingInstruction||Be&&N.nodeType===Hn.comment&&Zt(vg,N.data))},Sr=function(N,W,ne){if(!Vt[W]&&Po(W)&&(Ue.tagNameCheck instanceof RegExp&&Zt(Ue.tagNameCheck,W)||Ue.tagNameCheck instanceof Function&&Ue.tagNameCheck(W)))return!1;if(On&&!Kt[W]){const Te=b(N),Re=E(N);if(Re&&Te){const Fe=Re.length;for(let Ye=Fe-1;Ye>=0;--Ye){const et=N===ne?S(Re[Ye],!0):Re[Ye];Te.insertBefore(et,T(N))}}}return xs(N),!0},br=function(N,W,ne,Te){return N.length===0?W:W===ne||W===Te?pn(W):W},Qi=function(N,W){if(wn($.beforeSanitizeElements,N,null),N!==W&&b(N)===null)return gn&&xr(N),!0;if(Vr(N))return xs(N),!0;const ne=We(L?L(N):N.nodeName);if(he=br($.uponSanitizeElement,he,Ve,vt),wn($.uponSanitizeElement,N,{tagName:ne,allowedTags:he}),N!==W&&b(N)===null)return gn&&xr(N),!0;if(Kr(N,ne))return xs(N),!0;if(Vt[ne]||!(St.tagCheck instanceof Function&&St.tagCheck(ne))&&!he[ne]){const Re=Sr(N,ne,W);return Re===!1&&wn($.afterSanitizeElements,N,null),Re}if((M?M(N):N.nodeType)===Hn.element&&!bt(N)||(ne==="noscript"||ne==="noembed"||ne==="noframes")&&Zt(fT,N.innerHTML))return xs(N),!0;if(ve&&N.nodeType===Hn.text){const Re=Hr(N.textContent);N.textContent!==Re&&(vo(n.removed,{element:N.cloneNode()}),N.textContent=Re)}return wn($.afterSanitizeElements,N,null),!1},Zi=function(N,W,ne){if(tn[W]||Be&&W==="patchsrc"||Be&&W==="for"&&N!=="label"&&N!=="output"||ms&&(W==="id"||W==="name")&&(ne in r||ne in js))return!1;const Te=Ie[W]||St.attributeCheck instanceof Function&&St.attributeCheck(W,N);if(!(Ft&&Zt(ce,W))){if(!(jt&&Zt(be,W))){if(Te){if(!ft[W]){if(!Zt(ge,wi(ne,Ae,""))){if(!((W==="src"||W==="xlink:href"||W==="href")&&N!=="script"&&lg(ne,"data:")===0&&Ze[N])){if(!(Ot&&!Zt(_e,wi(ne,Ae,"")))){if(ne)return!1}}}}}else if(!(Po(N)&&(Ue.tagNameCheck instanceof RegExp&&Zt(Ue.tagNameCheck,N)||Ue.tagNameCheck instanceof Function&&Ue.tagNameCheck(N))&&(Ue.attributeNameCheck instanceof RegExp&&Zt(Ue.attributeNameCheck,W)||Ue.attributeNameCheck instanceof Function&&Ue.attributeNameCheck(W,N))||W==="is"&&Ue.allowCustomizedBuiltInElements&&(Ue.tagNameCheck instanceof RegExp&&Zt(Ue.tagNameCheck,ne)||Ue.tagNameCheck instanceof Function&&Ue.tagNameCheck(ne))))return!1}}return!0},$o=Ke({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Po=function(N){return!$o[Ti(N)]&&Zt(je,N)},zo=function(N,W,ne,Te){if(z&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!ne)switch(k.getAttributeType(N,W)){case"TrustedHTML":return Se(Te);case"TrustedScriptURL":return Me(Te)}return Te},Nr=function(N,W,ne,Te){try{ne?N.setAttributeNS(ne,W,Te):N.setAttribute(W,Te),Vr(N)?xs(N):ig(n.removed)}catch{ws(W,N)}},Ji=function(N){wn($.beforeSanitizeAttributes,N,null);const W=N.attributes;if(!W||Vr(N))return;Ie=br($.uponSanitizeAttribute,Ie,mt,_t);const ne={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ie,forceKeepAttr:void 0};let Te=W.length;const Re=We(N.nodeName);for(;Te--;){const Fe=W[Te],Ye=Fe.name,et=Fe.namespaceURI,Nt=Fe.value,Tt=We(Ye),_s=Nt;let Dt=Ye==="value"?_s:qN(_s);if(ne.attrName=Tt,ne.attrValue=Dt,ne.keepAttr=!0,ne.forceKeepAttr=void 0,wn($.uponSanitizeAttribute,N,ne),Dt=ne.attrValue,gs&&(Tt==="id"||Tt==="name")&&lg(Dt,ns)!==0&&(ws(Ye,N),Dt=ns+Dt),Be&&Zt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Dt)){ws(Ye,N);continue}if(Tt==="attributename"&&ag(Dt,"href")){ws(Ye,N);continue}if(!ne.forceKeepAttr){if(!ne.keepAttr){ws(Ye,N);continue}if(!Y&&Zt(pT,Dt)){ws(Ye,N);continue}if(ve&&(Dt=Hr(Dt)),!Zi(Re,Tt,Dt)){ws(Ye,N);continue}Dt=zo(Re,Tt,et,Dt),Dt!==_s&&Nr(N,Ye,et,Dt)}}wn($.afterSanitizeAttributes,N,null)},Vs=function(N){let W=null;const ne=zn(N);for(wn($.beforeSanitizeShadowDOM,N,null);W=ne.nextNode();)if(wn($.uponSanitizeShadowNode,W,null),Qi(W,N),Ji(W),Hs(W.content)&&Vs(W.content),(M?M(W):W.nodeType)===Hn.element){const Re=j(W);Hs(Re)&&(Xe(Re),Vs(Re))}wn($.afterSanitizeShadowDOM,N,null)},Xe=function(N){const W=[{node:N,shadow:null}];for(;W.length>0;){const ne=W.pop();if(ne.shadow){Vs(ne.shadow);continue}const Te=ne.node,Fe=(M?M(Te):Te.nodeType)===Hn.element,Ye=E(Te);if(Ye)for(let et=Ye.length-1;et>=0;--et)W.push({node:Ye[et],shadow:null});if(Fe){const et=L?L(Te):null;if(typeof et=="string"&&We(et)==="template"){const Nt=Te.content;Hs(Nt)&&W.push({node:Nt,shadow:null})}}if(Fe){const et=j(Te);Hs(et)&&W.push({node:null,shadow:et},{node:et,shadow:null})}}};return n.sanitize=function(de){let N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},W=null,ne=null,Te=null,Re=null;if(it=!de,it&&(de="<!-->"),typeof de!="string"&&!kr(de)&&(de=JN(de),typeof de!="string"))throw $r("dirty is not a string, aborting");if(!n.isSupported)return de;gt?(he=vt,Ie=_t):Pn(N),($.uponSanitizeElement.length>0||$.uponSanitizeAttribute.length>0)&&(he=pn(he)),$.uponSanitizeAttribute.length>0&&(Ie=pn(Ie)),n.removed=[];const Fe=gn&&typeof de!="string"&&kr(de);if(Fe){Yi(de);const Nt=L?L(de):de.nodeName;if(typeof Nt=="string"){const Tt=We(Nt);if(!he[Tt]||Vt[Tt])throw Ws(de),$r("root node is forbidden and cannot be sanitized in-place")}if(Vr(de))throw Ws(de),$r("root node is clobbered and cannot be sanitized in-place");try{Xe(de)}catch(Tt){throw Ws(de),Tt}}else if(kr(de))W=wr("<!---->"),ne=W.ownerDocument.importNode(de,!0),ne.nodeType===Hn.element&&ne.nodeName==="BODY"||ne.nodeName==="HTML"?W=ne:W.appendChild(ne),Xe(ne);else{if(!dt&&!ve&&!rt&&de.indexOf("<")===-1)return z&&Ln?Se(de):de;if(W=wr(de),!W)return dt?null:Ln?U:""}W&&an&&xs(W.firstChild);const Ye=Fe?de:W;try{const Nt=zn(Ye);for(;Te=Nt.nextNode();)Qi(Te,Ye),Ji(Te),Hs(Te.content)&&Vs(Te.content)}catch(Nt){throw Fe&&(Ws(de),go(n.removed,Tt=>{Tt.element&&xr(Tt.element)})),Nt}if(Fe)return go(n.removed,Nt=>{Nt.element&&xr(Nt.element)}),ve&&xn(de),de;if(dt){if(ve&&xn(W),Mn)for(Re=Z.call(W.ownerDocument);W.firstChild;)Re.appendChild(W.firstChild);else Re=W;return(Ie.shadowroot||Ie.shadowrootmode)&&(Re=I.call(o,Re,!0)),Re}let et=rt?W.outerHTML:W.innerHTML;return rt&&he["!doctype"]&&W.ownerDocument&&W.ownerDocument.doctype&&W.ownerDocument.doctype.name&&Zt(uT,W.ownerDocument.doctype.name)&&(et="<!DOCTYPE "+W.ownerDocument.doctype.name+`>
513
+ `+et),ve&&(et=Hr(et)),z&&Ln?Se(et):et},n.setConfig=function(){let de=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Pn(de),gt=!0,vt=he,_t=Ie},n.clearConfig=function(){yn=null,gt=!1,vt=null,_t=null,z=Q,U=""},n.isValidAttribute=function(de,N,W){yn||Pn({});const ne=We(de),Te=We(N);return Zi(ne,Te,W)},n.addHook=function(de,N){typeof N=="function"&&Jt($,de)&&vo($[de],N)},n.removeHook=function(de,N){if(Jt($,de)){if(N!==void 0){const W=KN($[de],N);return W===-1?void 0:GN($[de],W,1)[0]}return ig($[de])}},n.removeHooks=function(de){Jt($,de)&&($[de]=[])},n.removeAllHooks=function(){$=yg()},n}var Sf=Py();const gT=new Set(["command_execution","file_change","mcp_tool_call","web_search"]),vT=100;function xg(e){return gT.has(e.type)}function yT({items:e,runtimeType:n,turn:r,threads:o=[]}){const[l,c]=y.useState(!1),[d,f]=y.useState(!1);if(e.length===0)return null;const h=e.length,m=d?0:Math.max(0,h-vT),v=m>0?e.slice(m):e;return a.jsxs("div",{className:"tool-calls",children:[a.jsxs("div",{className:"tool-calls-header",onClick:()=>c(k=>!k),children:[a.jsx("span",{className:"tool-calls-icon",children:a.jsx(Q1,{size:12})}),a.jsxs("span",{className:"tool-calls-summary",children:[h," tool call",h>1?"s":""]}),a.jsx(Li,{size:14,className:"tool-calls-chevron",style:{transform:l?"rotate(90deg)":"none"}})]}),l&&a.jsxs("div",{className:"tool-calls-body",children:[m>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>f(!0),children:["Show ",m," earlier tool call",m>1?"s":""]})}),v.map(k=>a.jsx(Pr,{item:k,runtimeType:n,turn:r,threads:o},k.id))]})]})}Ge.setOptions({breaks:!0,gfm:!0});function xT(e){const n=Ge.parse(e);return Sf.sanitize(n)}function wg(e,n){var l;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o=0;for(;r.nextNode();){const c=r.currentNode,d=((l=c.textContent)==null?void 0:l.length)??0;if(o+d>n)return{node:c,offset:n-o};o+=d}return null}function wT(e,n,r){const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),l=[];for(;o.nextNode();){const c=o.currentNode;if(!c.textContent||c.textContent.trim()==="")continue;const d=document.createRange();d.selectNodeContents(c),!(d.compareBoundaryPoints(Range.START_TO_END,n)<=0)&&(d.compareBoundaryPoints(Range.END_TO_START,n)>=0||l.push(c))}for(const c of l){const d=c.length;let f=0,h=d;if(c===n.startContainer&&(f=Math.min(n.startOffset,d)),c===n.endContainer&&(h=Math.min(n.endOffset,d)),f>=h)continue;h<d&&c.splitText(h);const m=f>0?c.splitText(f):c,v=r(),k=m.parentNode;k&&(k.insertBefore(v,m),v.appendChild(m))}}function kT(e,n){e.querySelectorAll("mark[data-thread-id]").forEach(r=>{const o=r.parentNode;if(!o)return;const l=document.createTextNode(r.textContent||"");o.replaceChild(l,r),o.normalize()});for(const r of n){if(r.start_offset===null||r.end_offset===null)continue;const o=wg(e,r.start_offset),l=wg(e,r.end_offset);if(!o||!l)continue;const c=document.createRange();c.setStart(o.node,o.offset),c.setEnd(l.node,l.offset),wT(e,c,()=>{const d=document.createElement("mark");return d.setAttribute("data-thread-id",r.id),r.status==="resolved"&&d.classList.add("thread-mark-resolved"),d})}}function ST(e){const n=window.getSelection();if(!n||n.rangeCount===0)return null;const r=n.getRangeAt(0);if(r.collapsed||!e.contains(r.commonAncestorContainer))return null;const o=document.createRange();o.setStart(e,0),o.setEnd(r.startContainer,r.startOffset);const l=o.toString().length,c=r.toString();return{start:l,end:l+c.length,text:c}}function bT({itemId:e,turnId:n,sessionId:r,content:o,threads:l}){const c=y.useRef(null),d=y.useRef(null),f=y.useRef(null),h=y.useRef(""),m=y.useRef(0),[v,k]=y.useState(!1),[x,S]=y.useState({x:0,y:0}),[C,T]=y.useState(!1),[E,b]=y.useState({x:0,y:0}),[j,P]=y.useState(""),[M,L]=y.useState(null),[G,z]=y.useState(!1),U=A(q=>q.createThread),Q=A(q=>q.switchRightTab),J=A(q=>Gl(q.sessionDetails[r])),oe=y.useCallback(async()=>{await Fi(o||""),z(!0),setTimeout(()=>z(!1),1500)},[o]),me=y.useCallback(()=>{var I;if(!M)return;const q=`
514
514
  \`\`\`QUOTE
515
515
  ${M.text}
516
516
  \`\`\`
517
517
 
518
- `;A.setState({quotedText:q}),k(!1),L(null),(I=window.getSelection())==null||I.removeAllRanges()},[M]),Se=y.useMemo(()=>yT(o||"…"),[o]),Me=y.useMemo(()=>l.filter(q=>q.item_id===e),[l,e]);y.useEffect(()=>{c.current&&wT(c.current,Me)},[Se,Me]),y.useEffect(()=>{h.current=j},[j]),y.useEffect(()=>{function q(I){d.current&&!d.current.contains(I.target)&&(k(!1),h.current.trim()||T(!1))}return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[]);const ee=y.useCallback(()=>{k(!1),h.current.trim()||T(!1)},[]),ie=y.useCallback(()=>{const q=c.current;if(!q)return;const I=kT(q);if(I&&I.text.trim().length>0){const $=window.getSelection();if($&&$.rangeCount>0&&$.anchorNode&&$.focusNode){const B=$.getRangeAt(0).getBoundingClientRect(),X=28,ce=6,be=170;let _e=!1;try{const ge=document.createRange();ge.setStart($.focusNode,$.focusOffset),ge.setEnd($.focusNode,$.focusOffset);const he=document.createRange();he.setStart($.anchorNode,$.anchorOffset),he.setEnd($.anchorNode,$.anchorOffset),_e=he.compareBoundaryPoints(Range.START_TO_START,ge)>0}catch{_e=!1}let Ae=B.top-X-ce;Ae<8&&(Ae=B.bottom+ce);let je=_e?B.left-be:B.right;je=Math.max(8,Math.min(je,window.innerWidth-be-8)),S({x:je,y:Ae}),k(!0),L(I)}}else k(!1)},[]);y.useEffect(()=>{function q(I){const $=I.target;$&&($.closest(".selection-actions")||$.closest(".thread-create-popover"))||ie()}return document.addEventListener("mouseup",q),()=>document.removeEventListener("mouseup",q)},[ie]);const te=y.useCallback(()=>{k(!1),T(!0),b({x:x.x,y:x.y})},[x]);y.useLayoutEffect(()=>{if(!C)return;const q=f.current;if(!q)return;const I=q.offsetWidth,$=q.offsetHeight,ue=8;let B=x.x,X=x.y;B-I<ue&&(B=I+ue),B>window.innerWidth-ue&&(B=window.innerWidth-ue),X<ue&&(X=ue),X+$>window.innerHeight-ue&&(X=window.innerHeight-$-ue),b({x:B,y:X})},[C,x]);const F=y.useCallback(async()=>{var q;J||!M||!j.trim()||(await U(r,{itemId:e,turnId:n,startOffset:M.start,endOffset:M.end,selectedText:M.text,message:j.trim()}),P(""),T(!1),L(null),(q=window.getSelection())==null||q.removeAllRanges(),Q("threads"))},[M,j,U,r,e,n,Q,J]),Z=y.useCallback(q=>{const I=q.target;if(I.tagName==="MARK"&&I.hasAttribute("data-thread-id")){q.preventDefault(),Q("threads");const $=I.getAttribute("data-thread-id");setTimeout(()=>{const ue=document.getElementById(`thread-${$}`);ue&&(ue.scrollIntoView({behavior:"smooth",block:"center"}),ue.classList.add("thread-card-highlighted"),setTimeout(()=>ue.classList.remove("thread-card-highlighted"),1500))},100)}},[Q]);return a.jsxs("div",{className:"copy-text-wrapper",style:{position:"relative"},ref:d,children:[a.jsx("div",{ref:c,dangerouslySetInnerHTML:{__html:Se},onMouseDown:ee,onClick:Z}),a.jsx("button",{className:`copy-text-btn${G?" copied":""}`,onClick:oe,title:G?"Copied":"Copy message","aria-label":"Copy message text",children:G?a.jsx(Cs,{size:14}):a.jsx(Oi,{size:14})}),v&&!C&&a.jsxs("div",{className:"selection-actions",style:{left:x.x,top:x.y},children:[!J&&a.jsxs("button",{className:"discuss-button",onClick:te,title:"Start a discussion about this text",children:[a.jsx(M1,{size:14}),a.jsx("span",{children:"Discuss"})]}),a.jsxs("button",{className:"discuss-button",onClick:me,title:"Quote this text in your message",children:[a.jsx(Hv,{size:14}),a.jsx("span",{children:"Quote"})]})]}),C&&a.jsxs("div",{ref:f,className:"thread-create-popover",style:{left:E.x,top:E.y},children:[a.jsxs("div",{className:"thread-create-header",children:[a.jsxs("span",{className:"thread-create-quote",children:['"',M==null?void 0:M.text.slice(0,80),M&&M.text.length>80?"…":"",'"']}),a.jsx("button",{className:"thread-create-close",onClick:()=>{T(!1),L(null)},children:a.jsx(Tn,{size:14})})]}),a.jsx("textarea",{className:"thread-create-input",placeholder:"Ask about this text…",value:j,onChange:q=>P(q.target.value),autoFocus:!0,rows:2,onKeyDown:q=>{if(q.key==="Enter"&&(q.metaKey||q.ctrlKey)&&(q.preventDefault(),F()),q.key==="Escape")if(h.current.trim()){const I=Date.now();m.current&&I-m.current<400?(m.current=0,T(!1),L(null)):m.current=I}else T(!1),L(null)}}),a.jsxs("div",{className:"thread-create-footer",children:[a.jsx("span",{className:"thread-create-hint",children:"⌘↵ to send · Esc to cancel"}),a.jsxs("button",{className:"thread-create-send",onClick:F,disabled:!j.trim()||J,title:J?"Wait for the running turn to finish first":void 0,children:[a.jsx(Hi,{size:13}),a.jsx("span",{children:"Send"})]})]})]})]})}const kg=y.memo(ST),Ul=new Map,zy=new Set,Dd=new Set,Sg=new Map;function Fy(){Dd.forEach(e=>e())}function Uy(e,n){return`${e}:${n}`}function bT(e,n,r,o,l){var h;const c=Uy(n,r),d=Ul.get(e)??new Map,f=new Map(d);((h=f.get(c))==null?void 0:h.answer)===l?f.delete(c):f.set(c,{itemIndex:n,groupIndex:r,question:o,answer:l}),Ul.set(e,f),Fy()}function NT(e){Ul.delete(e),Fy()}function TT(e){zy.add(e),NT(e)}function CT(e){const n=y.useCallback(r=>(Dd.add(r),()=>{Dd.delete(r)}),[]);return y.useSyncExternalStore(n,()=>Ul.get(e)??Sg,()=>Sg)}function ET(e){return[...e].sort((n,r)=>n.itemIndex-r.itemIndex||n.groupIndex-r.groupIndex).map(n=>`> ${n.question}
518
+ `;A.setState({quotedText:q}),k(!1),L(null),(I=window.getSelection())==null||I.removeAllRanges()},[M]),Se=y.useMemo(()=>xT(o||"…"),[o]),Me=y.useMemo(()=>l.filter(q=>q.item_id===e),[l,e]);y.useEffect(()=>{c.current&&kT(c.current,Me)},[Se,Me]),y.useEffect(()=>{h.current=j},[j]),y.useEffect(()=>{function q(I){d.current&&!d.current.contains(I.target)&&(k(!1),h.current.trim()||T(!1))}return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[]);const ee=y.useCallback(()=>{k(!1),h.current.trim()||T(!1)},[]),ie=y.useCallback(()=>{const q=c.current;if(!q)return;const I=ST(q);if(I&&I.text.trim().length>0){const $=window.getSelection();if($&&$.rangeCount>0&&$.anchorNode&&$.focusNode){const B=$.getRangeAt(0).getBoundingClientRect(),X=28,ce=6,be=170;let _e=!1;try{const ge=document.createRange();ge.setStart($.focusNode,$.focusOffset),ge.setEnd($.focusNode,$.focusOffset);const he=document.createRange();he.setStart($.anchorNode,$.anchorOffset),he.setEnd($.anchorNode,$.anchorOffset),_e=he.compareBoundaryPoints(Range.START_TO_START,ge)>0}catch{_e=!1}let Ae=B.top-X-ce;Ae<8&&(Ae=B.bottom+ce);let je=_e?B.left-be:B.right;je=Math.max(8,Math.min(je,window.innerWidth-be-8)),S({x:je,y:Ae}),k(!0),L(I)}}else k(!1)},[]);y.useEffect(()=>{function q(I){const $=I.target;$&&($.closest(".selection-actions")||$.closest(".thread-create-popover"))||ie()}return document.addEventListener("mouseup",q),()=>document.removeEventListener("mouseup",q)},[ie]);const te=y.useCallback(()=>{k(!1),T(!0),b({x:x.x,y:x.y})},[x]);y.useLayoutEffect(()=>{if(!C)return;const q=f.current;if(!q)return;const I=q.offsetWidth,$=q.offsetHeight,ue=8;let B=x.x,X=x.y;B-I<ue&&(B=I+ue),B>window.innerWidth-ue&&(B=window.innerWidth-ue),X<ue&&(X=ue),X+$>window.innerHeight-ue&&(X=window.innerHeight-$-ue),b({x:B,y:X})},[C,x]);const F=y.useCallback(async()=>{var q;J||!M||!j.trim()||(await U(r,{itemId:e,turnId:n,startOffset:M.start,endOffset:M.end,selectedText:M.text,message:j.trim()}),P(""),T(!1),L(null),(q=window.getSelection())==null||q.removeAllRanges(),Q("threads"))},[M,j,U,r,e,n,Q,J]),Z=y.useCallback(q=>{const I=q.target;if(I.tagName==="MARK"&&I.hasAttribute("data-thread-id")){q.preventDefault(),Q("threads");const $=I.getAttribute("data-thread-id");setTimeout(()=>{const ue=document.getElementById(`thread-${$}`);ue&&(ue.scrollIntoView({behavior:"smooth",block:"center"}),ue.classList.add("thread-card-highlighted"),setTimeout(()=>ue.classList.remove("thread-card-highlighted"),1500))},100)}},[Q]);return a.jsxs("div",{className:"copy-text-wrapper",style:{position:"relative"},ref:d,children:[a.jsx("div",{ref:c,dangerouslySetInnerHTML:{__html:Se},onMouseDown:ee,onClick:Z}),a.jsx("button",{className:`copy-text-btn${G?" copied":""}`,onClick:oe,title:G?"Copied":"Copy message","aria-label":"Copy message text",children:G?a.jsx(Cs,{size:14}):a.jsx(Oi,{size:14})}),v&&!C&&a.jsxs("div",{className:"selection-actions",style:{left:x.x,top:x.y},children:[!J&&a.jsxs("button",{className:"discuss-button",onClick:te,title:"Start a discussion about this text",children:[a.jsx(L1,{size:14}),a.jsx("span",{children:"Discuss"})]}),a.jsxs("button",{className:"discuss-button",onClick:me,title:"Quote this text in your message",children:[a.jsx(Hv,{size:14}),a.jsx("span",{children:"Quote"})]})]}),C&&a.jsxs("div",{ref:f,className:"thread-create-popover",style:{left:E.x,top:E.y},children:[a.jsxs("div",{className:"thread-create-header",children:[a.jsxs("span",{className:"thread-create-quote",children:['"',M==null?void 0:M.text.slice(0,80),M&&M.text.length>80?"…":"",'"']}),a.jsx("button",{className:"thread-create-close",onClick:()=>{T(!1),L(null)},children:a.jsx(Tn,{size:14})})]}),a.jsx("textarea",{className:"thread-create-input",placeholder:"Ask about this text…",value:j,onChange:q=>P(q.target.value),autoFocus:!0,rows:2,onKeyDown:q=>{if(q.key==="Enter"&&(q.metaKey||q.ctrlKey)&&(q.preventDefault(),F()),q.key==="Escape")if(h.current.trim()){const I=Date.now();m.current&&I-m.current<400?(m.current=0,T(!1),L(null)):m.current=I}else T(!1),L(null)}}),a.jsxs("div",{className:"thread-create-footer",children:[a.jsx("span",{className:"thread-create-hint",children:"⌘↵ to send · Esc to cancel"}),a.jsxs("button",{className:"thread-create-send",onClick:F,disabled:!j.trim()||J,title:J?"Wait for the running turn to finish first":void 0,children:[a.jsx(Hi,{size:13}),a.jsx("span",{children:"Send"})]})]})]})]})}const kg=y.memo(bT),Bl=new Map,zy=new Set,Md=new Set,Sg=new Map;function Fy(){Md.forEach(e=>e())}function Uy(e,n){return`${e}:${n}`}function NT(e,n,r,o,l){var h;const c=Uy(n,r),d=Bl.get(e)??new Map,f=new Map(d);((h=f.get(c))==null?void 0:h.answer)===l?f.delete(c):f.set(c,{itemIndex:n,groupIndex:r,question:o,answer:l}),Bl.set(e,f),Fy()}function TT(e){Bl.delete(e),Fy()}function CT(e){zy.add(e),TT(e)}function ET(e){const n=y.useCallback(r=>(Md.add(r),()=>{Md.delete(r)}),[]);return y.useSyncExternalStore(n,()=>Bl.get(e)??Sg,()=>Sg)}function jT(e){return[...e].sort((n,r)=>n.itemIndex-r.itemIndex||n.groupIndex-r.groupIndex).map(n=>`> ${n.question}
519
519
  ${n.answer}`).join(`
520
520
 
521
- `)}function bg({item:e,turn:n}){var S;const r=e.data??{},o=y.useMemo(()=>Array.isArray(r.groups)?r.groups.filter(C=>!!C&&Array.isArray(C.selections)&&C.selections.length>0):[],[r.groups]),l=CT(n.id),c=A(C=>n.session_id?C.sessionDetails[n.session_id]:null),d=A(C=>C.activeSessionId),f=n.items.filter(C=>C.type==="ask_user"||C.type==="final_result").findIndex(C=>C.id===e.id),h=c?((S=c.turns[c.turns.length-1])==null?void 0:S.id)===n.id:!0,m=zy.has(n.id),v=m||mv(c)||!h||n.session_id!==d,k=(C,T,E)=>{v||bT(n.id,f,C,T,E)},x=()=>{const C=[...l.values()];if(C.length===0)return;const T=ET(C);TT(n.id),A.getState().submitPrompt(T)};return a.jsxs("div",{className:"render-content ask-user-card",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(x1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Question"}),m&&a.jsx("span",{className:"turn-header-meta",children:"answered"})]}),o.length>0?a.jsxs("div",{className:"ask-user-groups",children:[o.map((C,T)=>a.jsxs("div",{className:"ask-user-group",children:[C.question&&a.jsx("div",{className:"ask-user-question",children:C.question}),a.jsx("div",{className:"ask-user-options",children:C.selections.map(E=>{var j;const b=((j=l.get(Uy(f,T)))==null?void 0:j.answer)===E;return a.jsx("button",{type:"button",className:`ask-user-option ${b?"selected":""}`,disabled:v,onClick:()=>k(T,C.question,E),children:E},E)})})]},T)),v?m&&a.jsx("div",{className:"ask-user-submitted",children:"Answer sent"}):a.jsxs("button",{type:"button",className:"ask-user-send",disabled:l.size===0,onClick:x,children:[a.jsx(Hi,{size:12}),"Send"]})]}):r.question?a.jsx("p",{className:"user-message",children:r.question}):a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:"Waiting for user response"})]})}const jT={host_shutdown:"host shutdown",host_restart:"host restart",process_exit:"agent process stopped",network:"network error",auth:"signed out",usage_limit:"usage limit"};function vl(e){return e&&jT[e]||"interrupted"}function Bl(e){if(!e)return"";const n=new Date(e);return Number.isNaN(n.getTime())?"":n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function _T(e){switch(e.interrupt_reason){case"network":return"Interrupted — network error. Will resume when the connection is back.";case"auth":return"Interrupted — Claude is signed out. Sign in again from a terminal, then resume.";case"usage_limit":{const n=Bl(e.resume_at);return n?`Usage limit reached — resumes at ${n}.`:"Usage limit reached — resume once it is over."}case"process_exit":return"Interrupted — the agent process stopped. Resuming automatically…";case"host_shutdown":return"Interrupted — the agent host shut down. Resuming automatically…";default:return"Interrupted — the agent host restarted. Resuming automatically…"}}function RT(e){return e.items.filter(n=>n.type==="interruption").map(n=>n.data)}function AT({item:e}){const n=e.data,r=Bl(n.interrupted_at);let o="";switch(n.outcome){case"waiting":o="waiting to resume";break;case"resuming":o="resuming…";break;case"resumed":o=n.resumed_at?`resumed ${Bl(n.resumed_at)}`:"resumed";break;case"cancelled":o="stopped";break;case"unsupported":o="cannot be resumed";break;default:o="not resumed"}return a.jsx("div",{className:"interruption-marker",title:n.detail??void 0,children:a.jsxs("span",{children:["Interrupted",r?` ${r}`:""," (",vl(n.reason),") · ",o]})})}function IT({turn:e,label:n}){const[r,o]=y.useState(!1),l=A(d=>d.addToast),c=()=>{o(!0),yw(e.session_id,e.id).catch(d=>l("error",`Could not resume the turn — ${d.message}`)).finally(()=>o(!1))};return a.jsxs("button",{type:"button",className:"banner-action",onClick:c,disabled:r,children:[a.jsx(Vv,{size:12}),n]})}function DT({turn:e}){const n=e.resume_state;if(!n||n==="cancelled"||n==="resumed")return null;const r=e.interrupt_reason,o=RT(e),l=o[o.length-1],c=Bl(e.interrupted_at??(l==null?void 0:l.interrupted_at));let d,f=null,h=null;switch(n){case"waiting":{const m=r==="usage_limit"&&!e.resume_at;d=_T(e),f=m?(l==null?void 0:l.detail)??null:null,h=r==="auth"||m?"Resume":"Resume now";break}case"resuming":d=`Interrupted (${vl(r)}) — resuming from where it left off…`;break;case"gave_up":{const m=Math.max(o.length,1);d=`Interrupted ${m===1?"once":`${m} times`} — automatic resume stopped.`,f=e.error&&!e.error.startsWith("Automatic resume stopped")?e.error:null,h="Resume";break}case"skipped":d=`Interrupted${c?` ${c}`:""} (${vl(r)}) — too long ago to resume automatically.`,h="Resume";break;default:d=`Interrupted (${vl(r)}) — this turn cannot be resumed.`,f=e.error}return a.jsxs("div",{className:"interruption-banner","data-state":n,children:[a.jsx("span",{className:"banner-icon",children:r==="network"?a.jsx(qv,{size:12}):a.jsx(Ql,{size:12})}),a.jsxs("span",{className:"banner-text",children:[d,f&&a.jsx("span",{className:"banner-detail",children:f})]}),h&&a.jsx(IT,{turn:e,label:h})]})}function MT({turnId:e}){const n=A(o=>o.retryStates[e]);if(!n)return null;const r=n.errorStatus?`API error ${n.errorStatus}`:"Connection problem";return a.jsxs("div",{className:"retry-banner",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(qv,{size:12})}),a.jsxs("span",{className:"banner-text",children:[r," — retrying (attempt ",n.attempt," of ",n.maxRetries,")…"]})]})}const LT='(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):(global=global||self,global.morphdom=factory())})(this,function(){"use strict";var DOCUMENT_FRAGMENT_NODE=11;function morphAttrs(fromNode,toNode){var toNodeAttrs=toNode.attributes;var attr;var attrName;var attrNamespaceURI;var attrValue;var fromValue;if(toNode.nodeType===DOCUMENT_FRAGMENT_NODE||fromNode.nodeType===DOCUMENT_FRAGMENT_NODE){return}for(var i=toNodeAttrs.length-1;i>=0;i--){attr=toNodeAttrs[i];attrName=attr.name;attrNamespaceURI=attr.namespaceURI;attrValue=attr.value;if(attrNamespaceURI){attrName=attr.localName||attrName;fromValue=fromNode.getAttributeNS(attrNamespaceURI,attrName);if(fromValue!==attrValue){if(attr.prefix==="xmlns"){attrName=attr.name}fromNode.setAttributeNS(attrNamespaceURI,attrName,attrValue)}}else{fromValue=fromNode.getAttribute(attrName);if(fromValue!==attrValue){fromNode.setAttribute(attrName,attrValue)}}}var fromNodeAttrs=fromNode.attributes;for(var d=fromNodeAttrs.length-1;d>=0;d--){attr=fromNodeAttrs[d];attrName=attr.name;attrNamespaceURI=attr.namespaceURI;if(attrNamespaceURI){attrName=attr.localName||attrName;if(!toNode.hasAttributeNS(attrNamespaceURI,attrName)){fromNode.removeAttributeNS(attrNamespaceURI,attrName)}}else{if(!toNode.hasAttribute(attrName)){fromNode.removeAttribute(attrName)}}}}var range;var NS_XHTML="http://www.w3.org/1999/xhtml";var doc=typeof document==="undefined"?undefined:document;var HAS_TEMPLATE_SUPPORT=!!doc&&"content"in doc.createElement("template");var HAS_RANGE_SUPPORT=!!doc&&doc.createRange&&"createContextualFragment"in doc.createRange();function createFragmentFromTemplate(str){var template=doc.createElement("template");template.innerHTML=str;return template.content.childNodes[0]}function createFragmentFromRange(str){if(!range){range=doc.createRange();range.selectNode(doc.body)}var fragment=range.createContextualFragment(str);return fragment.childNodes[0]}function createFragmentFromWrap(str){var fragment=doc.createElement("body");fragment.innerHTML=str;return fragment.childNodes[0]}function toElement(str){str=str.trim();if(HAS_TEMPLATE_SUPPORT){return createFragmentFromTemplate(str)}else if(HAS_RANGE_SUPPORT){return createFragmentFromRange(str)}return createFragmentFromWrap(str)}function compareNodeNames(fromEl,toEl){var fromNodeName=fromEl.nodeName;var toNodeName=toEl.nodeName;var fromCodeStart,toCodeStart;if(fromNodeName===toNodeName){return true}fromCodeStart=fromNodeName.charCodeAt(0);toCodeStart=toNodeName.charCodeAt(0);if(fromCodeStart<=90&&toCodeStart>=97){return fromNodeName===toNodeName.toUpperCase()}else if(toCodeStart<=90&&fromCodeStart>=97){return toNodeName===fromNodeName.toUpperCase()}else{return false}}function createElementNS(name,namespaceURI){return!namespaceURI||namespaceURI===NS_XHTML?doc.createElement(name):doc.createElementNS(namespaceURI,name)}function moveChildren(fromEl,toEl){var curChild=fromEl.firstChild;while(curChild){var nextChild=curChild.nextSibling;toEl.appendChild(curChild);curChild=nextChild}return toEl}function syncBooleanAttrProp(fromEl,toEl,name){if(fromEl[name]!==toEl[name]){fromEl[name]=toEl[name];if(fromEl[name]){fromEl.setAttribute(name,"")}else{fromEl.removeAttribute(name)}}}var specialElHandlers={OPTION:function(fromEl,toEl){var parentNode=fromEl.parentNode;if(parentNode){var parentName=parentNode.nodeName.toUpperCase();if(parentName==="OPTGROUP"){parentNode=parentNode.parentNode;parentName=parentNode&&parentNode.nodeName.toUpperCase()}if(parentName==="SELECT"&&!parentNode.hasAttribute("multiple")){if(fromEl.hasAttribute("selected")&&!toEl.selected){fromEl.setAttribute("selected","selected");fromEl.removeAttribute("selected")}parentNode.selectedIndex=-1}}syncBooleanAttrProp(fromEl,toEl,"selected")},INPUT:function(fromEl,toEl){syncBooleanAttrProp(fromEl,toEl,"checked");syncBooleanAttrProp(fromEl,toEl,"disabled");if(fromEl.value!==toEl.value){fromEl.value=toEl.value}if(!toEl.hasAttribute("value")){fromEl.removeAttribute("value")}},TEXTAREA:function(fromEl,toEl){var newValue=toEl.value;if(fromEl.value!==newValue){fromEl.value=newValue}var firstChild=fromEl.firstChild;if(firstChild){var oldValue=firstChild.nodeValue;if(oldValue==newValue||!newValue&&oldValue==fromEl.placeholder){return}firstChild.nodeValue=newValue}},SELECT:function(fromEl,toEl){if(!toEl.hasAttribute("multiple")){var selectedIndex=-1;var i=0;var curChild=fromEl.firstChild;var optgroup;var nodeName;while(curChild){nodeName=curChild.nodeName&&curChild.nodeName.toUpperCase();if(nodeName==="OPTGROUP"){optgroup=curChild;curChild=optgroup.firstChild;if(!curChild){curChild=optgroup.nextSibling;optgroup=null}}else{if(nodeName==="OPTION"){if(curChild.hasAttribute("selected")){selectedIndex=i;break}i++}curChild=curChild.nextSibling;if(!curChild&&optgroup){curChild=optgroup.nextSibling;optgroup=null}}}fromEl.selectedIndex=selectedIndex}}};var ELEMENT_NODE=1;var DOCUMENT_FRAGMENT_NODE$1=11;var TEXT_NODE=3;var COMMENT_NODE=8;function noop(){}function defaultGetNodeKey(node){if(node){return node.getAttribute&&node.getAttribute("id")||node.id}}function morphdomFactory(morphAttrs){return function morphdom(fromNode,toNode,options){if(!options){options={}}if(typeof toNode==="string"){if(fromNode.nodeName==="#document"||fromNode.nodeName==="HTML"){var toNodeHtml=toNode;toNode=doc.createElement("html");toNode.innerHTML=toNodeHtml}else if(fromNode.nodeName==="BODY"){var toNodeBody=toNode;toNode=doc.createElement("html");toNode.innerHTML=toNodeBody;var bodyElement=toNode.querySelector("body");if(bodyElement){toNode=bodyElement}}else{toNode=toElement(toNode)}}else if(toNode.nodeType===DOCUMENT_FRAGMENT_NODE$1){toNode=toNode.firstElementChild}var getNodeKey=options.getNodeKey||defaultGetNodeKey;var onBeforeNodeAdded=options.onBeforeNodeAdded||noop;var onNodeAdded=options.onNodeAdded||noop;var onBeforeElUpdated=options.onBeforeElUpdated||noop;var onElUpdated=options.onElUpdated||noop;var onBeforeNodeDiscarded=options.onBeforeNodeDiscarded||noop;var onNodeDiscarded=options.onNodeDiscarded||noop;var onBeforeElChildrenUpdated=options.onBeforeElChildrenUpdated||noop;var skipFromChildren=options.skipFromChildren||noop;var addChild=options.addChild||function(parent,child){return parent.appendChild(child)};var childrenOnly=options.childrenOnly===true;var fromNodesLookup=Object.create(null);var keyedRemovalList=[];function addKeyedRemoval(key){keyedRemovalList.push(key)}function walkDiscardedChildNodes(node,skipKeyedNodes){if(node.nodeType===ELEMENT_NODE){var curChild=node.firstChild;while(curChild){var key=undefined;if(skipKeyedNodes&&(key=getNodeKey(curChild))){addKeyedRemoval(key)}else{onNodeDiscarded(curChild);if(curChild.firstChild){walkDiscardedChildNodes(curChild,skipKeyedNodes)}}curChild=curChild.nextSibling}}}function removeNode(node,parentNode,skipKeyedNodes){if(onBeforeNodeDiscarded(node)===false){return}if(parentNode){parentNode.removeChild(node)}onNodeDiscarded(node);walkDiscardedChildNodes(node,skipKeyedNodes)}function indexTree(node){if(node.nodeType===ELEMENT_NODE||node.nodeType===DOCUMENT_FRAGMENT_NODE$1){var curChild=node.firstChild;while(curChild){var key=getNodeKey(curChild);if(key){fromNodesLookup[key]=curChild}indexTree(curChild);curChild=curChild.nextSibling}}}indexTree(fromNode);function handleNodeAdded(el){onNodeAdded(el);var curChild=el.firstChild;while(curChild){var nextSibling=curChild.nextSibling;var key=getNodeKey(curChild);if(key){var unmatchedFromEl=fromNodesLookup[key];if(unmatchedFromEl&&compareNodeNames(curChild,unmatchedFromEl)){curChild.parentNode.replaceChild(unmatchedFromEl,curChild);morphEl(unmatchedFromEl,curChild)}else{handleNodeAdded(curChild)}}else{handleNodeAdded(curChild)}curChild=nextSibling}}function cleanupFromEl(fromEl,curFromNodeChild,curFromNodeKey){while(curFromNodeChild){var fromNextSibling=curFromNodeChild.nextSibling;if(curFromNodeKey=getNodeKey(curFromNodeChild)){addKeyedRemoval(curFromNodeKey)}else{removeNode(curFromNodeChild,fromEl,true)}curFromNodeChild=fromNextSibling}}function morphEl(fromEl,toEl,childrenOnly){var toElKey=getNodeKey(toEl);if(toElKey){delete fromNodesLookup[toElKey]}if(!childrenOnly){var beforeUpdateResult=onBeforeElUpdated(fromEl,toEl);if(beforeUpdateResult===false){return}else if(beforeUpdateResult instanceof HTMLElement){fromEl=beforeUpdateResult;indexTree(fromEl)}morphAttrs(fromEl,toEl);onElUpdated(fromEl);if(onBeforeElChildrenUpdated(fromEl,toEl)===false){return}}if(fromEl.nodeName!=="TEXTAREA"){morphChildren(fromEl,toEl)}else{specialElHandlers.TEXTAREA(fromEl,toEl)}}function morphChildren(fromEl,toEl){var skipFrom=skipFromChildren(fromEl,toEl);var curToNodeChild=toEl.firstChild;var curFromNodeChild=fromEl.firstChild;var curToNodeKey;var curFromNodeKey;var fromNextSibling;var toNextSibling;var matchingFromEl;outer:while(curToNodeChild){toNextSibling=curToNodeChild.nextSibling;curToNodeKey=getNodeKey(curToNodeChild);while(!skipFrom&&curFromNodeChild){fromNextSibling=curFromNodeChild.nextSibling;if(curToNodeChild.isSameNode&&curToNodeChild.isSameNode(curFromNodeChild)){curToNodeChild=toNextSibling;curFromNodeChild=fromNextSibling;continue outer}curFromNodeKey=getNodeKey(curFromNodeChild);var curFromNodeType=curFromNodeChild.nodeType;var isCompatible=undefined;if(curFromNodeType===curToNodeChild.nodeType){if(curFromNodeType===ELEMENT_NODE){if(curToNodeKey){if(curToNodeKey!==curFromNodeKey){if(matchingFromEl=fromNodesLookup[curToNodeKey]){if(fromNextSibling===matchingFromEl){isCompatible=false}else{fromEl.insertBefore(matchingFromEl,curFromNodeChild);if(curFromNodeKey){addKeyedRemoval(curFromNodeKey)}else{removeNode(curFromNodeChild,fromEl,true)}curFromNodeChild=matchingFromEl;curFromNodeKey=getNodeKey(curFromNodeChild)}}else{isCompatible=false}}}else if(curFromNodeKey){isCompatible=false}isCompatible=isCompatible!==false&&compareNodeNames(curFromNodeChild,curToNodeChild);if(isCompatible){morphEl(curFromNodeChild,curToNodeChild)}}else if(curFromNodeType===TEXT_NODE||curFromNodeType==COMMENT_NODE){isCompatible=true;if(curFromNodeChild.nodeValue!==curToNodeChild.nodeValue){curFromNodeChild.nodeValue=curToNodeChild.nodeValue}}}if(isCompatible){curToNodeChild=toNextSibling;curFromNodeChild=fromNextSibling;continue outer}if(curFromNodeKey){addKeyedRemoval(curFromNodeKey)}else{removeNode(curFromNodeChild,fromEl,true)}curFromNodeChild=fromNextSibling}if(curToNodeKey&&(matchingFromEl=fromNodesLookup[curToNodeKey])&&compareNodeNames(matchingFromEl,curToNodeChild)){if(!skipFrom){addChild(fromEl,matchingFromEl)}morphEl(matchingFromEl,curToNodeChild)}else{var onBeforeNodeAddedResult=onBeforeNodeAdded(curToNodeChild);if(onBeforeNodeAddedResult!==false){if(onBeforeNodeAddedResult){curToNodeChild=onBeforeNodeAddedResult}if(curToNodeChild.actualize){curToNodeChild=curToNodeChild.actualize(fromEl.ownerDocument||doc)}addChild(fromEl,curToNodeChild);handleNodeAdded(curToNodeChild)}}curToNodeChild=toNextSibling;curFromNodeChild=fromNextSibling}cleanupFromEl(fromEl,curFromNodeChild,curFromNodeKey);var specialElHandler=specialElHandlers[fromEl.nodeName];if(specialElHandler){specialElHandler(fromEl,toEl)}}var morphedNode=fromNode;var morphedNodeType=morphedNode.nodeType;var toNodeType=toNode.nodeType;if(!childrenOnly){if(morphedNodeType===ELEMENT_NODE){if(toNodeType===ELEMENT_NODE){if(!compareNodeNames(fromNode,toNode)){onNodeDiscarded(fromNode);morphedNode=moveChildren(fromNode,createElementNS(toNode.nodeName,toNode.namespaceURI))}}else{morphedNode=toNode}}else if(morphedNodeType===TEXT_NODE||morphedNodeType===COMMENT_NODE){if(toNodeType===morphedNodeType){if(morphedNode.nodeValue!==toNode.nodeValue){morphedNode.nodeValue=toNode.nodeValue}return morphedNode}else{morphedNode=toNode}}}if(morphedNode===toNode){onNodeDiscarded(fromNode)}else{if(toNode.isSameNode&&toNode.isSameNode(morphedNode)){return}morphEl(morphedNode,toNode,childrenOnly);if(keyedRemovalList){for(var i=0,len=keyedRemovalList.length;i<len;i++){var elToRemove=fromNodesLookup[keyedRemovalList[i]];if(elToRemove){removeNode(elToRemove,elToRemove.parentNode,false)}}}}if(!childrenOnly&&morphedNode!==fromNode&&fromNode.parentNode){if(morphedNode.actualize){morphedNode=morphedNode.actualize(fromNode.ownerDocument||doc)}fromNode.parentNode.replaceChild(morphedNode,fromNode)}return morphedNode}}var morphdom=morphdomFactory(morphAttrs);return morphdom});',OT=["https://cdnjs.cloudflare.com","https://cdn.jsdelivr.net","https://unpkg.com","https://esm.sh"],By="agentpane-widget",Wy="agentpane-pane",Hy="allow-scripts allow-popups allow-popups-to-escape-sandbox",Si=OT.join(" "),Vy=["default-src 'none'",`script-src 'unsafe-inline' 'unsafe-eval' ${Si}`,`style-src 'unsafe-inline' ${Si}`,`img-src data: blob: ${Si}`,`font-src data: ${Si}`,`connect-src ${Si}`,"media-src data: blob:","frame-src 'none'","form-action 'none'","base-uri 'none'"].join("; ");function Ky(){const e=typeof document<"u"?getComputedStyle(document.documentElement):null,n=(r,o)=>(e==null?void 0:e.getPropertyValue(r).trim())||o;return{"--color-text-primary":n("--text","#1c1b18"),"--color-text-secondary":n("--text-2","#54504a"),"--color-text-muted":n("--text-3","#78736c"),"--color-background-primary":n("--canvas","#fdfdfc"),"--color-background-secondary":n("--surface-0","#f8f7f5"),"--color-border":n("--border","#e2e0db"),"--color-accent":n("--accent","#d97706"),"--font-sans":n("--font-sans","'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"),"--font-mono":n("--font-mono","'JetBrains Mono', 'SF Mono', 'Fira Code', monospace"),"--radius":n("--r-lg","8px"),"--color-series-1":"#2a78d6","--color-series-2":"#eb6834","--color-series-3":"#1baf7a","--color-series-4":"#eda100","--color-series-5":"#e87ba4","--color-series-6":"#008300","--color-series-7":"#6250d6","--color-series-8":"#e34948","--color-good":"#0ca30c","--color-warning":"#fab219","--color-serious":"#ec835a","--color-critical":"#d03b3b"}}const Gy=`window.addEventListener('click', function (e) {
521
+ `)}function bg({item:e,turn:n}){var S;const r=e.data??{},o=y.useMemo(()=>Array.isArray(r.groups)?r.groups.filter(C=>!!C&&Array.isArray(C.selections)&&C.selections.length>0):[],[r.groups]),l=ET(n.id),c=A(C=>n.session_id?C.sessionDetails[n.session_id]:null),d=A(C=>C.activeSessionId),f=n.items.filter(C=>C.type==="ask_user"||C.type==="final_result").findIndex(C=>C.id===e.id),h=c?((S=c.turns[c.turns.length-1])==null?void 0:S.id)===n.id:!0,m=zy.has(n.id),v=m||mv(c)||!h||n.session_id!==d,k=(C,T,E)=>{v||NT(n.id,f,C,T,E)},x=()=>{const C=[...l.values()];if(C.length===0)return;const T=jT(C);CT(n.id),A.getState().submitPrompt(T)};return a.jsxs("div",{className:"render-content ask-user-card",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(w1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Question"}),m&&a.jsx("span",{className:"turn-header-meta",children:"answered"})]}),o.length>0?a.jsxs("div",{className:"ask-user-groups",children:[o.map((C,T)=>a.jsxs("div",{className:"ask-user-group",children:[C.question&&a.jsx("div",{className:"ask-user-question",children:C.question}),a.jsx("div",{className:"ask-user-options",children:C.selections.map(E=>{var j;const b=((j=l.get(Uy(f,T)))==null?void 0:j.answer)===E;return a.jsx("button",{type:"button",className:`ask-user-option ${b?"selected":""}`,disabled:v,onClick:()=>k(T,C.question,E),children:E},E)})})]},T)),v?m&&a.jsx("div",{className:"ask-user-submitted",children:"Answer sent"}):a.jsxs("button",{type:"button",className:"ask-user-send",disabled:l.size===0,onClick:x,children:[a.jsx(Hi,{size:12}),"Send"]})]}):r.question?a.jsx("p",{className:"user-message",children:r.question}):a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:"Waiting for user response"})]})}const _T={host_shutdown:"host shutdown",host_restart:"host restart",process_exit:"agent process stopped",network:"network error",auth:"signed out",usage_limit:"usage limit"};function vl(e){return e&&_T[e]||"interrupted"}function Wl(e){if(!e)return"";const n=new Date(e);return Number.isNaN(n.getTime())?"":n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function RT(e){switch(e.interrupt_reason){case"network":return"Interrupted — network error. Will resume when the connection is back.";case"auth":return"Interrupted — Claude is signed out. Sign in again from a terminal, then resume.";case"usage_limit":{const n=Wl(e.resume_at);return n?`Usage limit reached — resumes at ${n}.`:"Usage limit reached — resume once it is over."}case"process_exit":return"Interrupted — the agent process stopped. Resuming automatically…";case"host_shutdown":return"Interrupted — the agent host shut down. Resuming automatically…";default:return"Interrupted — the agent host restarted. Resuming automatically…"}}function AT(e){return e.items.filter(n=>n.type==="interruption").map(n=>n.data)}function IT({item:e}){const n=e.data,r=Wl(n.interrupted_at);let o="";switch(n.outcome){case"waiting":o="waiting to resume";break;case"resuming":o="resuming…";break;case"resumed":o=n.resumed_at?`resumed ${Wl(n.resumed_at)}`:"resumed";break;case"cancelled":o="stopped";break;case"unsupported":o="cannot be resumed";break;default:o="not resumed"}return a.jsx("div",{className:"interruption-marker",title:n.detail??void 0,children:a.jsxs("span",{children:["Interrupted",r?` ${r}`:""," (",vl(n.reason),") · ",o]})})}function DT({turn:e,label:n}){const[r,o]=y.useState(!1),l=A(d=>d.addToast),c=()=>{o(!0),xw(e.session_id,e.id).catch(d=>l("error",`Could not resume the turn — ${d.message}`)).finally(()=>o(!1))};return a.jsxs("button",{type:"button",className:"banner-action",onClick:c,disabled:r,children:[a.jsx(Vv,{size:12}),n]})}function MT({turn:e}){const n=e.resume_state;if(!n||n==="cancelled"||n==="resumed")return null;const r=e.interrupt_reason,o=AT(e),l=o[o.length-1],c=Wl(e.interrupted_at??(l==null?void 0:l.interrupted_at));let d,f=null,h=null;switch(n){case"waiting":{const m=r==="usage_limit"&&!e.resume_at;d=RT(e),f=m?(l==null?void 0:l.detail)??null:null,h=r==="auth"||m?"Resume":"Resume now";break}case"resuming":d=`Interrupted (${vl(r)}) — resuming from where it left off…`;break;case"gave_up":{const m=Math.max(o.length,1);d=`Interrupted ${m===1?"once":`${m} times`} — automatic resume stopped.`,f=e.error&&!e.error.startsWith("Automatic resume stopped")?e.error:null,h="Resume";break}case"skipped":d=`Interrupted${c?` ${c}`:""} (${vl(r)}) — too long ago to resume automatically.`,h="Resume";break;default:d=`Interrupted (${vl(r)}) — this turn cannot be resumed.`,f=e.error}return a.jsxs("div",{className:"interruption-banner","data-state":n,children:[a.jsx("span",{className:"banner-icon",children:r==="network"?a.jsx(qv,{size:12}):a.jsx(Zl,{size:12})}),a.jsxs("span",{className:"banner-text",children:[d,f&&a.jsx("span",{className:"banner-detail",children:f})]}),h&&a.jsx(DT,{turn:e,label:h})]})}function LT({turnId:e}){const n=A(o=>o.retryStates[e]);if(!n)return null;const r=n.errorStatus?`API error ${n.errorStatus}`:"Connection problem";return a.jsxs("div",{className:"retry-banner",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(qv,{size:12})}),a.jsxs("span",{className:"banner-text",children:[r," — retrying (attempt ",n.attempt," of ",n.maxRetries,")…"]})]})}const OT='(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):(global=global||self,global.morphdom=factory())})(this,function(){"use strict";var DOCUMENT_FRAGMENT_NODE=11;function morphAttrs(fromNode,toNode){var toNodeAttrs=toNode.attributes;var attr;var attrName;var attrNamespaceURI;var attrValue;var fromValue;if(toNode.nodeType===DOCUMENT_FRAGMENT_NODE||fromNode.nodeType===DOCUMENT_FRAGMENT_NODE){return}for(var i=toNodeAttrs.length-1;i>=0;i--){attr=toNodeAttrs[i];attrName=attr.name;attrNamespaceURI=attr.namespaceURI;attrValue=attr.value;if(attrNamespaceURI){attrName=attr.localName||attrName;fromValue=fromNode.getAttributeNS(attrNamespaceURI,attrName);if(fromValue!==attrValue){if(attr.prefix==="xmlns"){attrName=attr.name}fromNode.setAttributeNS(attrNamespaceURI,attrName,attrValue)}}else{fromValue=fromNode.getAttribute(attrName);if(fromValue!==attrValue){fromNode.setAttribute(attrName,attrValue)}}}var fromNodeAttrs=fromNode.attributes;for(var d=fromNodeAttrs.length-1;d>=0;d--){attr=fromNodeAttrs[d];attrName=attr.name;attrNamespaceURI=attr.namespaceURI;if(attrNamespaceURI){attrName=attr.localName||attrName;if(!toNode.hasAttributeNS(attrNamespaceURI,attrName)){fromNode.removeAttributeNS(attrNamespaceURI,attrName)}}else{if(!toNode.hasAttribute(attrName)){fromNode.removeAttribute(attrName)}}}}var range;var NS_XHTML="http://www.w3.org/1999/xhtml";var doc=typeof document==="undefined"?undefined:document;var HAS_TEMPLATE_SUPPORT=!!doc&&"content"in doc.createElement("template");var HAS_RANGE_SUPPORT=!!doc&&doc.createRange&&"createContextualFragment"in doc.createRange();function createFragmentFromTemplate(str){var template=doc.createElement("template");template.innerHTML=str;return template.content.childNodes[0]}function createFragmentFromRange(str){if(!range){range=doc.createRange();range.selectNode(doc.body)}var fragment=range.createContextualFragment(str);return fragment.childNodes[0]}function createFragmentFromWrap(str){var fragment=doc.createElement("body");fragment.innerHTML=str;return fragment.childNodes[0]}function toElement(str){str=str.trim();if(HAS_TEMPLATE_SUPPORT){return createFragmentFromTemplate(str)}else if(HAS_RANGE_SUPPORT){return createFragmentFromRange(str)}return createFragmentFromWrap(str)}function compareNodeNames(fromEl,toEl){var fromNodeName=fromEl.nodeName;var toNodeName=toEl.nodeName;var fromCodeStart,toCodeStart;if(fromNodeName===toNodeName){return true}fromCodeStart=fromNodeName.charCodeAt(0);toCodeStart=toNodeName.charCodeAt(0);if(fromCodeStart<=90&&toCodeStart>=97){return fromNodeName===toNodeName.toUpperCase()}else if(toCodeStart<=90&&fromCodeStart>=97){return toNodeName===fromNodeName.toUpperCase()}else{return false}}function createElementNS(name,namespaceURI){return!namespaceURI||namespaceURI===NS_XHTML?doc.createElement(name):doc.createElementNS(namespaceURI,name)}function moveChildren(fromEl,toEl){var curChild=fromEl.firstChild;while(curChild){var nextChild=curChild.nextSibling;toEl.appendChild(curChild);curChild=nextChild}return toEl}function syncBooleanAttrProp(fromEl,toEl,name){if(fromEl[name]!==toEl[name]){fromEl[name]=toEl[name];if(fromEl[name]){fromEl.setAttribute(name,"")}else{fromEl.removeAttribute(name)}}}var specialElHandlers={OPTION:function(fromEl,toEl){var parentNode=fromEl.parentNode;if(parentNode){var parentName=parentNode.nodeName.toUpperCase();if(parentName==="OPTGROUP"){parentNode=parentNode.parentNode;parentName=parentNode&&parentNode.nodeName.toUpperCase()}if(parentName==="SELECT"&&!parentNode.hasAttribute("multiple")){if(fromEl.hasAttribute("selected")&&!toEl.selected){fromEl.setAttribute("selected","selected");fromEl.removeAttribute("selected")}parentNode.selectedIndex=-1}}syncBooleanAttrProp(fromEl,toEl,"selected")},INPUT:function(fromEl,toEl){syncBooleanAttrProp(fromEl,toEl,"checked");syncBooleanAttrProp(fromEl,toEl,"disabled");if(fromEl.value!==toEl.value){fromEl.value=toEl.value}if(!toEl.hasAttribute("value")){fromEl.removeAttribute("value")}},TEXTAREA:function(fromEl,toEl){var newValue=toEl.value;if(fromEl.value!==newValue){fromEl.value=newValue}var firstChild=fromEl.firstChild;if(firstChild){var oldValue=firstChild.nodeValue;if(oldValue==newValue||!newValue&&oldValue==fromEl.placeholder){return}firstChild.nodeValue=newValue}},SELECT:function(fromEl,toEl){if(!toEl.hasAttribute("multiple")){var selectedIndex=-1;var i=0;var curChild=fromEl.firstChild;var optgroup;var nodeName;while(curChild){nodeName=curChild.nodeName&&curChild.nodeName.toUpperCase();if(nodeName==="OPTGROUP"){optgroup=curChild;curChild=optgroup.firstChild;if(!curChild){curChild=optgroup.nextSibling;optgroup=null}}else{if(nodeName==="OPTION"){if(curChild.hasAttribute("selected")){selectedIndex=i;break}i++}curChild=curChild.nextSibling;if(!curChild&&optgroup){curChild=optgroup.nextSibling;optgroup=null}}}fromEl.selectedIndex=selectedIndex}}};var ELEMENT_NODE=1;var DOCUMENT_FRAGMENT_NODE$1=11;var TEXT_NODE=3;var COMMENT_NODE=8;function noop(){}function defaultGetNodeKey(node){if(node){return node.getAttribute&&node.getAttribute("id")||node.id}}function morphdomFactory(morphAttrs){return function morphdom(fromNode,toNode,options){if(!options){options={}}if(typeof toNode==="string"){if(fromNode.nodeName==="#document"||fromNode.nodeName==="HTML"){var toNodeHtml=toNode;toNode=doc.createElement("html");toNode.innerHTML=toNodeHtml}else if(fromNode.nodeName==="BODY"){var toNodeBody=toNode;toNode=doc.createElement("html");toNode.innerHTML=toNodeBody;var bodyElement=toNode.querySelector("body");if(bodyElement){toNode=bodyElement}}else{toNode=toElement(toNode)}}else if(toNode.nodeType===DOCUMENT_FRAGMENT_NODE$1){toNode=toNode.firstElementChild}var getNodeKey=options.getNodeKey||defaultGetNodeKey;var onBeforeNodeAdded=options.onBeforeNodeAdded||noop;var onNodeAdded=options.onNodeAdded||noop;var onBeforeElUpdated=options.onBeforeElUpdated||noop;var onElUpdated=options.onElUpdated||noop;var onBeforeNodeDiscarded=options.onBeforeNodeDiscarded||noop;var onNodeDiscarded=options.onNodeDiscarded||noop;var onBeforeElChildrenUpdated=options.onBeforeElChildrenUpdated||noop;var skipFromChildren=options.skipFromChildren||noop;var addChild=options.addChild||function(parent,child){return parent.appendChild(child)};var childrenOnly=options.childrenOnly===true;var fromNodesLookup=Object.create(null);var keyedRemovalList=[];function addKeyedRemoval(key){keyedRemovalList.push(key)}function walkDiscardedChildNodes(node,skipKeyedNodes){if(node.nodeType===ELEMENT_NODE){var curChild=node.firstChild;while(curChild){var key=undefined;if(skipKeyedNodes&&(key=getNodeKey(curChild))){addKeyedRemoval(key)}else{onNodeDiscarded(curChild);if(curChild.firstChild){walkDiscardedChildNodes(curChild,skipKeyedNodes)}}curChild=curChild.nextSibling}}}function removeNode(node,parentNode,skipKeyedNodes){if(onBeforeNodeDiscarded(node)===false){return}if(parentNode){parentNode.removeChild(node)}onNodeDiscarded(node);walkDiscardedChildNodes(node,skipKeyedNodes)}function indexTree(node){if(node.nodeType===ELEMENT_NODE||node.nodeType===DOCUMENT_FRAGMENT_NODE$1){var curChild=node.firstChild;while(curChild){var key=getNodeKey(curChild);if(key){fromNodesLookup[key]=curChild}indexTree(curChild);curChild=curChild.nextSibling}}}indexTree(fromNode);function handleNodeAdded(el){onNodeAdded(el);var curChild=el.firstChild;while(curChild){var nextSibling=curChild.nextSibling;var key=getNodeKey(curChild);if(key){var unmatchedFromEl=fromNodesLookup[key];if(unmatchedFromEl&&compareNodeNames(curChild,unmatchedFromEl)){curChild.parentNode.replaceChild(unmatchedFromEl,curChild);morphEl(unmatchedFromEl,curChild)}else{handleNodeAdded(curChild)}}else{handleNodeAdded(curChild)}curChild=nextSibling}}function cleanupFromEl(fromEl,curFromNodeChild,curFromNodeKey){while(curFromNodeChild){var fromNextSibling=curFromNodeChild.nextSibling;if(curFromNodeKey=getNodeKey(curFromNodeChild)){addKeyedRemoval(curFromNodeKey)}else{removeNode(curFromNodeChild,fromEl,true)}curFromNodeChild=fromNextSibling}}function morphEl(fromEl,toEl,childrenOnly){var toElKey=getNodeKey(toEl);if(toElKey){delete fromNodesLookup[toElKey]}if(!childrenOnly){var beforeUpdateResult=onBeforeElUpdated(fromEl,toEl);if(beforeUpdateResult===false){return}else if(beforeUpdateResult instanceof HTMLElement){fromEl=beforeUpdateResult;indexTree(fromEl)}morphAttrs(fromEl,toEl);onElUpdated(fromEl);if(onBeforeElChildrenUpdated(fromEl,toEl)===false){return}}if(fromEl.nodeName!=="TEXTAREA"){morphChildren(fromEl,toEl)}else{specialElHandlers.TEXTAREA(fromEl,toEl)}}function morphChildren(fromEl,toEl){var skipFrom=skipFromChildren(fromEl,toEl);var curToNodeChild=toEl.firstChild;var curFromNodeChild=fromEl.firstChild;var curToNodeKey;var curFromNodeKey;var fromNextSibling;var toNextSibling;var matchingFromEl;outer:while(curToNodeChild){toNextSibling=curToNodeChild.nextSibling;curToNodeKey=getNodeKey(curToNodeChild);while(!skipFrom&&curFromNodeChild){fromNextSibling=curFromNodeChild.nextSibling;if(curToNodeChild.isSameNode&&curToNodeChild.isSameNode(curFromNodeChild)){curToNodeChild=toNextSibling;curFromNodeChild=fromNextSibling;continue outer}curFromNodeKey=getNodeKey(curFromNodeChild);var curFromNodeType=curFromNodeChild.nodeType;var isCompatible=undefined;if(curFromNodeType===curToNodeChild.nodeType){if(curFromNodeType===ELEMENT_NODE){if(curToNodeKey){if(curToNodeKey!==curFromNodeKey){if(matchingFromEl=fromNodesLookup[curToNodeKey]){if(fromNextSibling===matchingFromEl){isCompatible=false}else{fromEl.insertBefore(matchingFromEl,curFromNodeChild);if(curFromNodeKey){addKeyedRemoval(curFromNodeKey)}else{removeNode(curFromNodeChild,fromEl,true)}curFromNodeChild=matchingFromEl;curFromNodeKey=getNodeKey(curFromNodeChild)}}else{isCompatible=false}}}else if(curFromNodeKey){isCompatible=false}isCompatible=isCompatible!==false&&compareNodeNames(curFromNodeChild,curToNodeChild);if(isCompatible){morphEl(curFromNodeChild,curToNodeChild)}}else if(curFromNodeType===TEXT_NODE||curFromNodeType==COMMENT_NODE){isCompatible=true;if(curFromNodeChild.nodeValue!==curToNodeChild.nodeValue){curFromNodeChild.nodeValue=curToNodeChild.nodeValue}}}if(isCompatible){curToNodeChild=toNextSibling;curFromNodeChild=fromNextSibling;continue outer}if(curFromNodeKey){addKeyedRemoval(curFromNodeKey)}else{removeNode(curFromNodeChild,fromEl,true)}curFromNodeChild=fromNextSibling}if(curToNodeKey&&(matchingFromEl=fromNodesLookup[curToNodeKey])&&compareNodeNames(matchingFromEl,curToNodeChild)){if(!skipFrom){addChild(fromEl,matchingFromEl)}morphEl(matchingFromEl,curToNodeChild)}else{var onBeforeNodeAddedResult=onBeforeNodeAdded(curToNodeChild);if(onBeforeNodeAddedResult!==false){if(onBeforeNodeAddedResult){curToNodeChild=onBeforeNodeAddedResult}if(curToNodeChild.actualize){curToNodeChild=curToNodeChild.actualize(fromEl.ownerDocument||doc)}addChild(fromEl,curToNodeChild);handleNodeAdded(curToNodeChild)}}curToNodeChild=toNextSibling;curFromNodeChild=fromNextSibling}cleanupFromEl(fromEl,curFromNodeChild,curFromNodeKey);var specialElHandler=specialElHandlers[fromEl.nodeName];if(specialElHandler){specialElHandler(fromEl,toEl)}}var morphedNode=fromNode;var morphedNodeType=morphedNode.nodeType;var toNodeType=toNode.nodeType;if(!childrenOnly){if(morphedNodeType===ELEMENT_NODE){if(toNodeType===ELEMENT_NODE){if(!compareNodeNames(fromNode,toNode)){onNodeDiscarded(fromNode);morphedNode=moveChildren(fromNode,createElementNS(toNode.nodeName,toNode.namespaceURI))}}else{morphedNode=toNode}}else if(morphedNodeType===TEXT_NODE||morphedNodeType===COMMENT_NODE){if(toNodeType===morphedNodeType){if(morphedNode.nodeValue!==toNode.nodeValue){morphedNode.nodeValue=toNode.nodeValue}return morphedNode}else{morphedNode=toNode}}}if(morphedNode===toNode){onNodeDiscarded(fromNode)}else{if(toNode.isSameNode&&toNode.isSameNode(morphedNode)){return}morphEl(morphedNode,toNode,childrenOnly);if(keyedRemovalList){for(var i=0,len=keyedRemovalList.length;i<len;i++){var elToRemove=fromNodesLookup[keyedRemovalList[i]];if(elToRemove){removeNode(elToRemove,elToRemove.parentNode,false)}}}}if(!childrenOnly&&morphedNode!==fromNode&&fromNode.parentNode){if(morphedNode.actualize){morphedNode=morphedNode.actualize(fromNode.ownerDocument||doc)}fromNode.parentNode.replaceChild(morphedNode,fromNode)}return morphedNode}}var morphdom=morphdomFactory(morphAttrs);return morphdom});',$T=["https://cdnjs.cloudflare.com","https://cdn.jsdelivr.net","https://unpkg.com","https://esm.sh"],By="agentpane-widget",Wy="agentpane-pane",Hy="allow-scripts allow-popups allow-popups-to-escape-sandbox",Si=$T.join(" "),Vy=["default-src 'none'",`script-src 'unsafe-inline' 'unsafe-eval' ${Si}`,`style-src 'unsafe-inline' ${Si}`,`img-src data: blob: ${Si}`,`font-src data: ${Si}`,`connect-src ${Si}`,"media-src data: blob:","frame-src 'none'","form-action 'none'","base-uri 'none'"].join("; ");function Ky(){const e=typeof document<"u"?getComputedStyle(document.documentElement):null,n=(r,o)=>(e==null?void 0:e.getPropertyValue(r).trim())||o;return{"--color-text-primary":n("--text","#1c1b18"),"--color-text-secondary":n("--text-2","#54504a"),"--color-text-muted":n("--text-3","#78736c"),"--color-background-primary":n("--canvas","#fdfdfc"),"--color-background-secondary":n("--surface-0","#f8f7f5"),"--color-border":n("--border","#e2e0db"),"--color-accent":n("--accent","#d97706"),"--font-sans":n("--font-sans","'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"),"--font-mono":n("--font-mono","'JetBrains Mono', 'SF Mono', 'Fira Code', monospace"),"--radius":n("--r-lg","8px"),"--color-series-1":"#2a78d6","--color-series-2":"#eb6834","--color-series-3":"#1baf7a","--color-series-4":"#eda100","--color-series-5":"#e87ba4","--color-series-6":"#008300","--color-series-7":"#6250d6","--color-series-8":"#e34948","--color-good":"#0ca30c","--color-warning":"#fab219","--color-serious":"#ec835a","--color-critical":"#d03b3b"}}const Gy=`window.addEventListener('click', function (e) {
522
522
  if (e.defaultPrevented || e.button !== 0) return;
523
523
  var a = e.target && e.target.closest ? e.target.closest('a[href]') : null;
524
524
  if (!a) return;
@@ -529,7 +529,7 @@ ${n.answer}`).join(`
529
529
  try {
530
530
  window.open(new URL(href).href, '_blank', 'noopener,noreferrer');
531
531
  } catch (err) {}
532
- });`,$T=`(function () {
532
+ });`,PT=`(function () {
533
533
  var SELF = '${By}';
534
534
  var PANE = '${Wy}';
535
535
  var SCRIPT_TIMEOUT_MS = 15000;
@@ -670,21 +670,21 @@ ${n.answer}`).join(`
670
670
  }).observe(document.body, { childList: true });
671
671
  reportHeight();
672
672
  post({ type: 'ready' });
673
- })();`;function Md(e){return`<script>${e.replace(/<\/script/gi,"<\\/script")}<\/script>`}function PT(){const e=Object.entries(Ky()).map(([n,r])=>`${n}: ${r};`).join(" ");return["<!DOCTYPE html>","<html><head>",'<meta charset="utf-8">',`<meta http-equiv="Content-Security-Policy" content="${Vy}">`,"<style>",`:root { ${e} color-scheme: light; }`,"html, body { margin: 0; padding: 0; background: transparent; overflow: hidden; }","body { font: 14px/1.5 var(--font-sans); color: var(--color-text-primary); -webkit-font-smoothing: antialiased; }","#root { position: relative; display: flow-root; }","*, *::before, *::after { box-sizing: border-box; }","</style>",Md(LT),'</head><body><div id="root"></div>',Md($T),"</body></html>"].join(`
674
- `)}let Ng=null;function zT(){return Ng??(Ng=PT()),Ng}const FT=4e3,UT=3,So=new Map,BT=500;function WT(e,n){if(So.delete(e),So.set(e,n),So.size>BT){const r=So.keys().next().value;r!==void 0&&So.delete(r)}}function HT({widgetId:e,title:n,html:r,final:o,onError:l}){const c=y.useRef(null),[d,f]=y.useState(()=>So.get(e)??0),h=y.useRef({html:r,final:o});h.current={html:r,final:o};const m=y.useRef(l);m.current=l;const v=y.useRef(0),k=y.useRef(null),x=y.useCallback(()=>{var E;const S=(E=c.current)==null?void 0:E.contentWindow;if(!S||v.current===0||v.current>UT)return;const C=h.current,T=k.current;T&&(T.final||T.html===C.html&&T.final===C.final)||(k.current=C,S.postMessage({source:Wy,type:"content",html:C.html,final:C.final},"*"))},[]);return y.useEffect(()=>{function S(C){var b;const T=c.current;if(!T||C.source!==T.contentWindow)return;const E=C.data;if(!(!E||typeof E!="object"||E.source!==By))if(E.type==="ready")v.current+=1,k.current=null,x();else if(E.type==="height"&&typeof E.height=="number"&&Number.isFinite(E.height)){const j=Math.min(FT,Math.max(0,Math.ceil(E.height)));f(j),WT(e,j)}else E.type==="error"&&typeof E.message=="string"&&((b=m.current)==null||b.call(m,E.message.slice(0,500)))}return window.addEventListener("message",S),()=>window.removeEventListener("message",S)},[e,x]),y.useEffect(()=>{x()},[r,o,x]),a.jsx("iframe",{ref:c,className:"widget-frame",sandbox:Hy,srcDoc:zT(),title:n||"Widget",style:{height:`${d}px`}})}const VT=720,KT=20;function Ld(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function GT(e,n){const r=Object.entries(Ky()).map(([o,l])=>`${o}: ${l};`).join(" ");return["<!DOCTYPE html>","<html><head>",'<meta charset="utf-8">',`<meta http-equiv="Content-Security-Policy" content="${Vy}">`,'<meta name="viewport" content="width=device-width, initial-scale=1">',`<title>${Ld(e||"Widget")}</title>`,"<style>",`:root { ${r} color-scheme: light; }`,"html { background: var(--color-background-primary); }","body { margin: 0; padding: 32px 24px; font: 14px/1.5 var(--font-sans); color: var(--color-text-primary); -webkit-font-smoothing: antialiased; }",`#root { position: relative; display: flow-root; max-width: ${VT}px; margin: 0 auto; }`,"*, *::before, *::after { box-sizing: border-box; }","</style>",Md(Gy),'</head><body><div id="root">',n,"</div></body></html>"].join(`
675
- `)}function qT(e,n){const r=Ld(e||"Widget");return["<!DOCTYPE html>","<html><head>",'<meta charset="utf-8">','<meta name="viewport" content="width=device-width, initial-scale=1">',`<title>${r}</title>`,"<style>html, body { margin: 0; height: 100%; } iframe { display: block; width: 100%; height: 100%; border: 0; }</style>","</head><body>",`<iframe sandbox="${Hy}" title="${r}" srcdoc="${Ld(GT(e,n))}"></iframe>`,"</body></html>"].join(`
676
- `)}const yo=new Map;function XT(e,n,r){const o=qT(n,r);let l=yo.get(e);l&&l.doc!==o&&(URL.revokeObjectURL(l.url),l=void 0),l??(l={doc:o,url:URL.createObjectURL(new Blob([o],{type:"text/html;charset=utf-8"}))}),yo.delete(e),yo.set(e,l);for(const[d,f]of yo){if(yo.size<=KT)break;URL.revokeObjectURL(f.url),yo.delete(d)}const c=window.open(l.url,"_blank");c&&(c.opener=null)}function YT({item:e}){const[n,r]=y.useState(null),o=e.data??{},l=typeof o.title=="string"?o.title.trim():"",c=typeof o.html=="string"?o.html:"",d=o.partial===!0,f=typeof o.error=="string"&&o.error?o.error:null,h=e.external_item_id??e.id;return a.jsxs("div",{className:"render-content widget-card",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(V1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:l||"Visual"}),d&&a.jsx("span",{className:"turn-header-meta",children:"drawing…"}),f&&a.jsx("span",{className:"turn-header-meta",style:{color:"var(--red)"},children:"failed"}),!d&&c.trim()!==""&&a.jsx("button",{type:"button",className:"widget-open-btn",title:"Open in a new tab","aria-label":"Open in a new tab",onClick:()=>XT(h,l,c),children:a.jsx(Ov,{size:14})})]}),c.trim()?a.jsx(HT,{widgetId:h,title:l,html:c,final:!d,onError:r}):!f&&a.jsx("div",{className:"widget-placeholder",children:d?"Drawing…":"Nothing to show"}),f&&a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:f})}),n&&!f&&a.jsxs("div",{className:"widget-script-error",title:n,children:["Script error: ",n]})]})}function Wl(e){return`Message from ${(e==null?void 0:e.trim())||"another session"}`}function bf(e){return(e??[]).filter(n=>n.task_type!=="local_agent").length}function Nf(e){switch(e){case"local_agent":return"subagent";case"local_bash":return"monitor";case"background_terminal":return"command";default:return"task"}}function qy(e,n){switch(Nf(e)){case"subagent":return`Subagent${n?`: ${n}`:""}`;case"monitor":return"Monitor";case"command":return"Background command";default:return"Background Task"}}const QT={subagent:vr,monitor:Kv,command:Zl,task:Lv};Ge.setOptions({breaks:!0,gfm:!0});const ZT=10,JT=100;function Xy({name:e,body:n}){return a.jsxs("div",{className:"render-content peer-message",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--purple)",color:"#fff"},children:a.jsx(Wv,{size:14})}),a.jsx("span",{className:"turn-header-title",children:Wl(e)})]}),a.jsx("p",{className:"user-message",children:n})]})}function eC({attachments:e}){const[n,r]=y.useState(null);return y.useEffect(()=>{if(!n)return;function o(l){l.key==="Escape"&&r(null)}return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[n]),!Array.isArray(e)||e.length===0?null:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"attachment-pills",children:e.map((o,l)=>{const c=o.media_type.startsWith("image/"),d=`data:${o.media_type};base64,${o.data}`;return a.jsxs("span",{className:"attachment-pill",title:o.name,onClick:c?()=>r(d):void 0,style:c?{cursor:"pointer"}:void 0,children:[c?a.jsx("img",{src:d,alt:o.name,className:"attachment-pill-thumb"}):a.jsx($v,{size:12,className:"attachment-pill-icon"}),a.jsx("span",{className:"attachment-pill-name",children:o.name})]},l)})}),n&&a.jsx("div",{className:"image-preview-modal",onClick:()=>r(null),children:a.jsxs("div",{className:"image-preview-content",onClick:o=>o.stopPropagation(),children:[a.jsx("img",{src:n,alt:"preview"}),a.jsx("button",{className:"image-preview-close",onClick:()=>r(null),children:a.jsx(Tn,{size:20})})]})})]})}function tC(e){const n=Ge.parse(e);return Sf.sanitize(n)}function Tg(e){var n;return(n=e.data)!=null&&n.text?e.data.text:""}function nC(e){const n=e.match(/^\/bin\/\w+\s+-\w+\s+"(.*)"$/s);return n?n[1]:e}const Cg='<script>(function(){function report(){var h=Math.max(document.documentElement.scrollHeight,document.body?document.body.scrollHeight:0);if(h>0)parent.postMessage(Math.ceil(h),"*");}window.addEventListener("load",report);new ResizeObserver(report).observe(document.documentElement);report();})();<\/script>';function sC(e){return/<\/body>/i.test(e)?e.replace(/<\/body>/i,`${Cg}</body>`):e+Cg}function rC({html:e}){const[n,r]=y.useState(480),o=y.useRef(null);return y.useEffect(()=>{function l(c){var d;c.source===((d=o.current)==null?void 0:d.contentWindow)&&typeof c.data=="number"&&c.data>0&&r(c.data)}return window.addEventListener("message",l),()=>window.removeEventListener("message",l)},[]),a.jsx("iframe",{ref:o,sandbox:"allow-scripts",srcDoc:sC(e),title:"HTML content",style:{width:"100%",height:`${n}px`,border:"1px solid var(--border)",borderRadius:"var(--r-md)",background:"#fff",marginTop:"8px"}})}const Eg=1e4;function oC({item:e,runtimeType:n,turn:r,threads:o}){var f,h,m,v,k,x,S,C,T,E;const l=e.status==="in_progress",[c,d]=y.useState(!1);switch(e.type){case"agent_message":{const{iconClass:b,iconText:j}=kd(n??"codex");return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:`turn-header-icon ${b}`,children:j}),a.jsx("span",{className:"turn-header-title",children:"Agent"}),l&&a.jsx("span",{className:"turn-header-meta",children:"writing…"})]}),a.jsx(kg,{itemId:e.id,turnId:r.id,sessionId:r.session_id,content:Tg(e)||"…",threads:o,runtimeType:n})]})}case"reasoning":return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(v1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Reasoning"})]}),a.jsx("div",{dangerouslySetInnerHTML:{__html:tC(Tg(e))}})]});case"command_execution":{const b=e.data||{},j=nC(b.command||""),P=b.aggregated_output||"",M=b.exit_code,L=l?"running…":M!==null?`exit ${M}`:"",G=P.length>Eg,z=G&&!c?P.slice(0,Eg)+`
677
- … (truncated, click to expand)`:P;return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(Zl,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Command"}),L&&a.jsx("span",{className:"turn-header-meta",children:L})]}),a.jsx("pre",{className:"cmd-block",children:a.jsx("code",{children:j})}),P&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"cmd-output",children:a.jsx("code",{children:z})}),G&&a.jsx("button",{className:"cmd-output-toggle",onClick:()=>d(U=>!U),children:c?"Show less":`Show full output (${(P.length/1024).toFixed(0)}KB)`})]})]})}case"file_change":{const b=(f=e.data)==null?void 0:f.changes,j=Array.isArray(b)?b:[],P=`${j.length} file${j.length!==1?"s":""}`;return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(b1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"File Changes"}),a.jsx("span",{className:"turn-header-meta",children:P})]}),a.jsx("div",{className:"file-change-list",children:j.map((M,L)=>{const G=M.kind==="add"?"A":M.kind==="delete"?"D":"M",z=M.kind==="add"?"fc-add":M.kind==="delete"?"fc-del":"fc-mod";return a.jsxs("div",{className:"file-change",children:[a.jsx("span",{className:`fc-status ${z}`,children:G}),a.jsx("span",{className:"fc-name",children:M.path})]},L)})})]})}case"mcp_tool_call":{const b=e.data||{},j=b.tool||"mcp";if(j==="Agent"){const J=b.arguments,oe=(J==null?void 0:J.description)||(J==null?void 0:J.prompt)||"Subagent",me=e.status==="failed",Se=l?"running…":me?"failed":"done";return a.jsxs("div",{className:"agent-call-card",children:[a.jsx("span",{className:"agent-call-icon",children:a.jsx(vr,{size:14})}),a.jsx("span",{className:"agent-call-desc",children:oe}),a.jsx("span",{className:`agent-call-status ${l?"running":me?"failed":"done"}`,children:Se})]})}const P=b.server||"",M=b.arguments,L=b.result,G=b.error,z=e.status==="failed"||!!G,U=l?"running…":z?"failed":"done",Q=((h=L==null?void 0:L.content)==null?void 0:h.filter(J=>J.type==="text").map(J=>J.text))??[];return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(B1,{size:14})}),a.jsxs("span",{className:"turn-header-title",children:["MCP: ",j]}),P&&a.jsx("span",{className:"turn-header-meta",children:P}),a.jsx("span",{className:"turn-header-meta",style:z?{color:"var(--red)"}:void 0,children:U})]}),M&&Object.keys(M).length>0&&a.jsx("div",{className:"mcp-args",children:Object.entries(M).map(([J,oe])=>a.jsxs("div",{className:"mcp-arg",children:[a.jsx("span",{className:"mcp-arg-key",children:J}),J==="code"?a.jsx("pre",{className:"cmd-block",children:a.jsx("code",{children:String(oe)})}):a.jsx("span",{className:"mcp-arg-value",children:typeof oe=="string"?oe:JSON.stringify(oe,null,2)})]},J))}),Q.length>0&&Q.map((J,oe)=>a.jsx("pre",{className:"cmd-output",children:a.jsx("code",{children:J})},oe)),G&&a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:G})})]})}case"web_search":{const b=((m=e.data)==null?void 0:m.query)||"";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(H1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Web Search"})]}),a.jsx("p",{className:"user-message",children:b})]})}case"todo_list":{const b=((v=e.data)==null?void 0:v.items)||[];return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(A1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Todo List"})]}),a.jsx("ul",{className:"todo-list",children:b.map((j,P)=>a.jsxs("li",{className:j.completed?"todo-done":"todo-pending",children:[j.completed?a.jsx(Cs,{size:14}):a.jsx(yr,{size:14})," ",j.text]},P))})]})}case"ask_user":return a.jsx(bg,{item:e,turn:r});case"final_result":{const b=e.data??{},j=b.text||"",P=b.html||null,M=Array.isArray(b.groups)?b.groups.filter(z=>!!z&&Array.isArray(z.selections)&&z.selections.length>0):[],{iconClass:L,iconText:G}=kd(n??"codex");return a.jsxs(a.Fragment,{children:[(j||P)&&a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:`turn-header-icon ${L}`,children:G}),a.jsx("span",{className:"turn-header-title",children:"Agent"})]}),j&&a.jsx(kg,{itemId:e.id,turnId:r.id,sessionId:r.session_id,content:j,threads:o,runtimeType:n}),P&&a.jsx(rC,{html:P})]}),M.length>0&&a.jsx(bg,{item:e,turn:r})]})}case"background_task":{const b=e.data||{},j=b.task_type||"unknown",P=b.subagent_type||null,M=b.description||"",L=b.status||"running",G=b.last_tool_name||null,z=b.token_count||null,U=QT[Nf(j)],Q=qy(j,P),J=L==="running"?"running…":L==="completed"?"done":L==="failed"?"failed":L==="stopped"?"stopped":L,oe=e.status==="failed"||L==="failed";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(U,{size:14})}),a.jsx("span",{className:"turn-header-title",children:Q}),a.jsx("span",{className:"turn-header-meta",style:oe?{color:"var(--red)"}:void 0,children:J})]}),M&&a.jsx("p",{className:"user-message",style:{fontSize:"13px"},children:M}),G&&l&&a.jsxs("div",{className:"cmd-output",style:{color:"var(--text-3)",fontSize:"12px"},children:["last tool: ",G,z!=null&&` · ${z.toLocaleString()} tokens`]}),a.jsx("div",{className:"cmd-output",style:{color:"var(--text-muted)",fontSize:"11px"},children:"Output available in Tasks panel — click the status bar indicator or the Tasks tab."})]})}case"context_compaction":{const b=((k=e.data)==null?void 0:k.trigger)??"auto",j=typeof((x=e.data)==null?void 0:x.pre_tokens)=="number"?e.data.pre_tokens:null,P=typeof((S=e.data)==null?void 0:S.post_tokens)=="number"?e.data.post_tokens:null,M=b==="manual"?"Context compacted (/compact)":"Context auto-compacted",L=j!==null&&P!==null?`${j.toLocaleString()} → ${P.toLocaleString()} tokens (${j>0?Math.round((1-P/j)*100):0}% reduction)`:j!==null?`${j.toLocaleString()} tokens before`:P!==null?`${P.toLocaleString()} tokens after`:null;return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(L1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:M})]}),L&&a.jsx("div",{className:"cmd-output",style:{color:"var(--text-3)"},children:L})]})}case"interruption":return a.jsx(AT,{item:e});case"peer_message":return a.jsx(Xy,{name:(C=e.data)==null?void 0:C.name,body:((T=e.data)==null?void 0:T.body)??""});case"widget":return a.jsx(YT,{item:e});case"error":{const b=((E=e.data)==null?void 0:E.message)||"Unknown error";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--red)",color:"#fff"},children:a.jsx(Ql,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Error"})]}),a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:b})})]})}default:return null}}const Pr=y.memo(oC,(e,n)=>e.item===n.item&&e.runtimeType===n.runtimeType&&e.threads===n.threads&&e.turn.id===n.turn.id);function iC(e){return e.type==="widget"?`widget-${e.external_item_id??e.id}`:e.id}function aC({turn:e,runtimeType:n,threads:r=[]}){Lt.trackRender("TurnContent");const[o,l]=y.useState(!1),[c,d]=y.useState(!1),[f,h]=y.useState(!1),[m,v]=y.useState(!1),k=A(B=>B.loadDeferredItems),x=e.items.some(B=>B.type==="background_task"&&B.status==="in_progress");y.useEffect(()=>{e.status==="running"||e.status==="pending"?l(!0):e.status==="completed"&&!x&&l(!1)},[e.status,x]);const S=e.deferred_item_count??0,C=Fs(e),T=y.useRef(C);y.useEffect(()=>{const B=T.current&&!C&&e.status==="completed"&&!x;if(T.current=C,B||!o||S===0||m||C&&!c)return;let X=!1;return k(e.session_id,e.id).then(ce=>{!ce&&!X&&v(!0)}),()=>{X=!0}},[o,S,m,C,c,e.status,x,k,e.session_id,e.id]);let E=-1;for(let B=e.items.length-1;B>=0;B--)if(e.items[B].type==="agent_message"){E=B;break}const b=E>=0,j=b?e.items.slice(0,E):e.items,P=e.items.some(B=>B.type==="final_result"||B.type==="ask_user"),M=!b&&e.status==="completed"&&e.agent_response&&!P?{id:`response-${e.id}`,turn_id:e.id,external_item_id:`response-${e.id}`,type:"agent_message",data:{text:e.agent_response},status:"completed",created_at:e.created_at,updated_at:e.updated_at}:null,L=j.filter(B=>{var X;return!(B.type==="reasoning"&&(!((X=B.data)!=null&&X.text)||B.data.text===""))}),G=e.items.some(B=>{var X;return B.type==="interruption"&&((X=B.data)==null?void 0:X.reason)==="auth"}),z=e.items.some(B=>{var X;return B.type==="interruption"&&((X=B.data)==null?void 0:X.reason)==="usage_limit"}),U=L.filter(B=>{var X,ce;return!(B.type==="background_task"||B.type==="ask_user"||B.type==="final_result"||B.type==="widget"||B.type==="context_compaction"||B.type==="peer_message"||G&&B.type==="error"&&((X=B.data)==null?void 0:X.error)==="authentication_failed"||z&&B.type==="error"&&((ce=B.data)==null?void 0:ce.error)==="rate_limit")}),Q=c?0:Math.max(0,U.length-JT),J=Q>0?U.slice(Q):U,oe=[];let me=null;for(const B of J)B.type==="agent_message"?(me&&oe.push(me),me={agentMessage:B,toolItems:[],otherItems:[]}):B.type==="interruption"||B.type==="error"?(me&&oe.push(me),oe.push({agentMessage:null,toolItems:[],otherItems:[B]}),me=null):(me||(me={agentMessage:null,toolItems:[],otherItems:[]}),xg(B)?me.toolItems.push(B):me.otherItems.push(B));me&&oe.push(me);const Se=e.status==="running"||e.status==="pending",Me=B=>{var X;return B.type==="widget"&&(Se||((X=B.data)==null?void 0:X.partial)!==!0)},ee=b?e.items[E]:M,ie=[...j.filter(B=>Me(B)||B.type==="context_compaction"||B.type==="peer_message"),...ee?[ee]:[],...b?e.items.slice(E+1).filter(B=>B.type!=="ask_user"&&B.type!=="background_task"&&B.type!=="final_result"&&(B.type!=="widget"||Me(B))):[]],te=e.items.filter(B=>B.type==="background_task"),F=f?0:Math.max(0,te.length-ZT),Z=F>0?te.slice(F):te,q=U.filter(B=>xg(B)).length+(e.deferred_tool_calls??0),I=q>0||C&&(U.length>0||S>0),$=e.status==="pending"&&e.resume_state==="waiting",ue=e.resume_state==="gave_up"||e.resume_state==="skipped"||e.resume_state==="unsupported";return a.jsxs("div",{className:"turn-group",children:[e.origin==="peer"?a.jsx(Xy,{name:e.origin_name,body:e.user_prompt}):a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--amber)",color:"#fff"},children:"U"}),a.jsx("span",{className:"turn-header-title",children:"You"})]}),a.jsx("p",{className:"user-message",children:e.user_prompt}),Array.isArray(e.attachments)&&e.attachments.length>0&&a.jsx(eC,{attachments:e.attachments})]}),I&&a.jsxs("div",{className:"tool-calls",children:[a.jsxs("div",{className:"tool-calls-header",onClick:()=>l(B=>!B),children:[a.jsx("span",{className:"tool-calls-icon",children:a.jsx(j1,{size:12})}),a.jsx("span",{className:"tool-calls-summary",children:q>0?`${q} tool call${q>1?"s":""}`:$?"interrupted":"thinking…"}),a.jsx(Li,{size:14,className:"tool-calls-chevron",style:{transform:o?"rotate(90deg)":"none"}})]}),o&&a.jsxs("div",{className:"tool-calls-body",children:[S>0&&a.jsx("div",{className:"render-load-earlier",children:m?a.jsx("button",{className:"render-load-earlier-btn",onClick:()=>v(!1),children:"Couldn't load these steps. Try again"}):C&&!c?a.jsx("button",{className:"render-load-earlier-btn",onClick:()=>d(!0),children:"Show earlier steps"}):a.jsx("span",{className:"tool-calls-loading",children:"Loading steps…"})}),(S===0||C)&&a.jsxs(a.Fragment,{children:[S===0&&Q>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>d(!0),children:["Show ",Q," earlier step",Q>1?"s":""]})}),oe.map((B,X)=>a.jsxs("div",{className:"intermediate-segment",children:[B.agentMessage&&a.jsx(Pr,{item:B.agentMessage,runtimeType:n,turn:e,threads:r}),B.otherItems.map(ce=>a.jsx(Pr,{item:ce,runtimeType:n,turn:e,threads:r},ce.id)),B.toolItems.length>0&&a.jsx(vT,{items:B.toolItems,runtimeType:n,turn:e,threads:r})]},X))]})]})]}),F>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>h(!0),children:["Show ",F," earlier background task",F>1?"s":""]})}),Z.map(B=>a.jsx(Pr,{item:B,runtimeType:n,turn:e,threads:r},`task-${B.id}`)),ie.map(B=>a.jsx(Pr,{item:B,runtimeType:n,turn:e,threads:r},iC(B))),e.items.filter(B=>B.type==="final_result").map(B=>a.jsx(Pr,{item:B,runtimeType:n,turn:e,threads:r},`final-${B.id}`)),e.items.filter(B=>B.type==="ask_user").map(B=>a.jsx(Pr,{item:B,runtimeType:n,turn:e,threads:r},`ask-${B.id}`)),e.items.length===0&&!e.error&&(e.status==="pending"||e.status==="running")&&a.jsx("div",{className:"render-content",children:a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:e.status==="running"?"Agent is thinking…":"Waiting to start…"})}),e.error&&!ue&&a.jsx("div",{className:"render-content",children:a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:e.error})})}),e.status==="running"&&a.jsx(MT,{turnId:e.id}),a.jsx(DT,{turn:e}),e.status==="aborted"&&a.jsxs("div",{className:"aborted-banner",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(yr,{size:12})}),a.jsx("span",{className:"banner-text",children:"Turn stopped — work generated so far is kept."})]})]})}const lC=y.memo(aC),cC=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.userAgent)?"⌘K":"Ctrl+K";function uC(){const e=A(b=>b.workspaces),n=A(b=>b.loadPickerSupport),r=A(b=>b.pickAndAddWorkspace),o=A(b=>b.createSessionInWorkspace),l=A(b=>b.setImportSessionsWorkspace);y.useEffect(()=>{n()},[n]);const c=e.filter(b=>b.deleted===0),[d,f]=y.useState(null),h=c.find(b=>b.path===d)??c[c.length-1]??null,m=(h==null?void 0:h.path)??null,[v,k]=y.useState(null);y.useEffect(()=>{if(!m)return;let b=!1;return bv(m).then(({sessions:j})=>{b||k({path:m,runtimes:j.map(P=>P.runtime)})}),()=>{b=!0}},[m]);const x=v&&v.path===m?v.runtimes:[],S=x.length,[C,T]=y.useState(!1);async function E(b){T(!0);try{await o(b)}finally{T(!1)}}return a.jsx("div",{className:"render-scroll welcome-scroll",children:a.jsxs("main",{className:"welcome","aria-labelledby":"welcome-title",children:[a.jsx("h1",{className:"welcome-title",id:"welcome-title",children:"Welcome to Repoburg"}),a.jsx("p",{className:"welcome-lead",children:"Run Claude Code and Codex agents on your projects, side by side. Each session works in a workspace: one of your project folders."}),a.jsxs("ol",{className:"welcome-steps",children:[a.jsxs("li",{className:`welcome-step${h?" done":" current"}`,children:[a.jsx("span",{className:"welcome-step-mark","aria-hidden":"true",children:h?a.jsx(Cs,{size:13}):"1"}),a.jsxs("div",{className:"welcome-step-body",children:[a.jsx("h2",{className:"welcome-step-title",children:"Add a workspace"}),h?a.jsx("p",{className:"welcome-step-text",children:a.jsx("code",{title:h.path,children:h.path})}):a.jsxs("button",{className:"dialog-btn-create welcome-primary",onClick:()=>void r(),children:[a.jsx(T1,{size:14})," Open folder…"]})]})]}),a.jsxs("li",{className:`welcome-step${h?" current":" upcoming"}`,children:[a.jsx("span",{className:"welcome-step-mark","aria-hidden":"true",children:"2"}),a.jsxs("div",{className:"welcome-step-body",children:[a.jsx("h2",{className:"welcome-step-title",children:"Start your first session"}),h&&m?a.jsxs(a.Fragment,{children:[c.length>1&&a.jsxs("label",{className:"welcome-step-text welcome-target",children:["In",a.jsx("select",{className:"dialog-input dialog-select",value:m,onChange:b=>f(b.target.value),children:c.map(b=>a.jsx("option",{value:b.path,children:b.label||b.path},b.id))})]}),a.jsxs("div",{className:"welcome-actions",children:[a.jsxs("button",{className:"dialog-btn-create welcome-primary",disabled:C,onClick:()=>void E(m),children:[a.jsx(pr,{size:14})," New session"]}),S>0&&a.jsxs("button",{className:"dialog-btn-cancel",onClick:()=>l(m),children:[a.jsx(Fv,{size:14})," Import ",Sv(x)]})]}),S>0&&a.jsxs("p",{className:"welcome-step-text",children:["Sessions you started with ",a.jsx("code",{children:"claude"})," or ",a.jsx("code",{children:"codex"})," in this folder continue right where they left off."]})]}):a.jsx("p",{className:"welcome-step-text",children:"Then start an agent session in it."})]})]})]}),a.jsxs("p",{className:"welcome-tip",children:["Later: right-click a workspace to import its Claude Code and Codex sessions, and press"," ",a.jsx("kbd",{children:cC})," for the command palette."]})]})})}const dC=[],cl=50;function fC(){Lt.trackRender("RenderArea");const e=A(S=>S.activeSessionId),n=A(S=>S.activeSessionId?S.sessionDetails[S.activeSessionId]:null),r=A(S=>S.submittingPrompt),o=A(S=>S.loading),l=A(S=>!S.activeSessionId&&!Gb(S.workspaces,S.sessions,S.appsRootPath)),c=(n==null?void 0:n.turns)??[],d=(n==null?void 0:n.threads)??dC,f=y.useRef(null),[h,m]=y.useState(cl);y.useEffect(()=>{m(cl)},[e]);const v=c.filter(S=>!S.thread_id),k=Math.max(0,v.length-h),x=v.slice(k);return y.useEffect(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},[e,c.length]),o&&!n?a.jsx("div",{className:"render-scroll",children:a.jsxs("div",{className:"skeleton-bars",children:[a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"})]})}):n?a.jsxs("div",{className:"render-scroll",ref:f,children:[r&&a.jsx("div",{className:"turn-block",children:a.jsxs("div",{className:"turn-group",children:[a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--amber)",color:"#fff"},children:"U"}),a.jsx("span",{className:"turn-header-title",children:"You"})]}),a.jsx("p",{className:"user-message",children:r})]}),a.jsx("div",{className:"render-content",children:a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:"Sending…"})})]})}),c.length===0&&!r&&a.jsx("div",{className:"empty-state",children:"No turns yet. Send a message below to start."}),k>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>m(S=>S+cl),children:["Show ",Math.min(cl,k)," earlier turns (",k," hidden)"]})}),x.map((S,C)=>a.jsx("div",{id:`turn-${k+C}`,className:"turn-block",children:a.jsx(lC,{turn:S,runtimeType:n.runtime_type,threads:d})},S.id))]}):l?a.jsx(uC,{}):a.jsx("div",{className:"render-scroll",children:a.jsx("div",{className:"empty-state",children:"No session selected"})})}const pC=y.memo(fC),hC=[{id:"model",label:"/model",hint:"Change model",capability:"dynamicModels"},{id:"sandbox",label:"/sandbox",hint:"Sandbox mode",capability:"sandbox",subPopup:"sandbox"},{id:"websearch",label:"/websearch",hint:"Web search mode",capability:"webSearch",subPopup:"websearch"},{id:"network",label:"/network",hint:"Network access",capability:"networkAccess",subPopup:"network"},{id:"skills",label:"/skills",hint:"Browse skills",capability:"skills"},{id:"plugins",label:"/plugins",hint:"Browse plugins",capability:"plugins"},{id:"mcp",label:"/mcp",hint:"Browse MCP servers",capability:"mcpServers"}];function mC(e){return e.map(n=>({id:n.name,label:`/${n.name}`,hint:n.description,capability:null,insertAsText:!0}))}function gC(e,n,r=[]){const o=[...hC,...mC(r)],l=new Set;return o.filter(c=>!(l.has(c.label)||(l.add(c.label),c.capability&&!n[c.capability])||e&&!c.label.toLowerCase().includes(e.toLowerCase())))}function vC({commands:e,selectedIndex:n,onSelect:r,onHover:o}){return a.jsxs("div",{className:"slash-popup",children:[a.jsx("div",{className:"slash-popup-header",children:"Commands"}),e.length===0&&a.jsx("div",{className:"slash-popup-empty",children:"No matching commands"}),e.map((l,c)=>a.jsxs("div",{className:`slash-popup-item ${c===n?"selected":""}`,onMouseEnter:()=>o(c),onClick:()=>r(l),children:[a.jsx("span",{className:"slash-popup-label",children:l.label}),a.jsx("span",{className:"slash-popup-hint",children:l.hint})]},l.id))]})}function dd({title:e,options:n,currentValue:r,onSelect:o,onClose:l}){return a.jsxs("div",{className:"slash-popup",children:[a.jsxs("div",{className:"slash-popup-header",children:[a.jsx("button",{className:"slash-popup-back",onClick:l,children:"← Back"}),a.jsx("span",{children:e})]}),n.map(c=>a.jsxs("div",{className:`slash-popup-item ${c.value===r?"selected":""}`,onClick:()=>o(c.value),children:[a.jsxs("div",{className:"slash-popup-item-main",children:[a.jsx("span",{className:"slash-popup-label",children:c.label}),c.description&&a.jsx("span",{className:"slash-popup-hint",children:c.description})]}),c.value===r&&a.jsx("span",{className:"slash-popup-check",children:"✓"})]},c.value))]})}function yC(e){return kt("/skills")}function xC({filter:e,onSelect:n,onClose:r}){const[o,l]=y.useState([]),[c,d]=y.useState(!0),[f,h]=y.useState(0),m=y.useRef(null);y.useEffect(()=>{yC().then(l).catch(()=>l([])).finally(()=>d(!1))},[]);const v=o.filter(k=>k.name.toLowerCase().includes(e.toLowerCase())||k.description.toLowerCase().includes(e.toLowerCase()));return y.useEffect(()=>{h(0)},[e]),y.useEffect(()=>{function k(x){x.key==="ArrowDown"?(x.preventDefault(),h(S=>Math.min(S+1,v.length-1))):x.key==="ArrowUp"?(x.preventDefault(),h(S=>Math.max(S-1,0))):x.key==="Enter"?(x.preventDefault(),v[f]&&n(v[f])):x.key==="Escape"&&(x.preventDefault(),r())}return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[v,f,n,r]),a.jsxs("div",{className:"slash-popup",ref:m,children:[a.jsxs("div",{className:"slash-popup-header",children:[a.jsx("button",{className:"slash-popup-back",onClick:r,children:"← Back"}),a.jsx("span",{children:"Skills"})]}),c&&a.jsx("div",{className:"slash-popup-empty",children:"Loading skills…"}),!c&&v.length===0&&a.jsx("div",{className:"slash-popup-empty",children:"No matching skills"}),v.map((k,x)=>a.jsxs("div",{className:`slash-popup-item ${x===f?"selected":""}`,onMouseEnter:()=>h(x),onClick:()=>n(k),children:[a.jsxs("div",{className:"slash-popup-item-main",children:[a.jsx("span",{className:"slash-popup-label",children:k.name}),k.description&&a.jsx("span",{className:"slash-popup-hint",children:k.description})]}),!!k.metadata.isSystem&&a.jsx("span",{className:"slash-popup-hint",children:"system"})]},k.id))]})}function Yy(){return kt("/providers")}function wC(e,n){const r=n?`?cwd=${encodeURIComponent(n)}`:"";return kt(`/providers/${e}/commands${r}`)}const kC={dynamicModels:!1,skills:!1,plugins:!1,mcpServers:!1,imageAttachments:!1,sandbox:!1,webSearch:!1,networkAccess:!1,fileReferences:!1};function SC(e){const[n,r]=y.useState([]),[o,l]=y.useState(!0);y.useEffect(()=>{Yy().then(r).catch(()=>r([])).finally(()=>l(!1))},[]);const c=n.find(d=>d.id===e)??null;return{provider:c,capabilities:(c==null?void 0:c.capabilities)??kC,loading:o}}const xo=32,fd=200;function jg(e){if(!e)return{};try{return JSON.parse(e)}catch{return{}}}function _g(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}let Rg=0;function bC(){return Rg+=1,`att-${Date.now()}-${Rg}`}function NC(){Lt.trackRender("CommandInputBar");const[e,n]=y.useState(""),r=y.useRef(null),o=y.useRef(xo),l=y.useRef(null),{submitPrompt:c,cancelTurn:d,updateRuntimeConfig:f,setShowModelSelector:h}=A(),m=A(Y=>Y.activeSessionId),v=A(Y=>Y.activeSessionId?Y.sessionDetails[Y.activeSessionId]:null),k=A(Y=>Y.quotedText),x=mv(v),S=!!(v!=null&&v.turns.some(Y=>Y.status==="pending"&&Y.resume_state==="waiting")),C=!m,{capabilities:T}=SC(v==null?void 0:v.runtime_type),E=(v==null?void 0:v.runtime_type)??null,b=T.imageAttachments,[j,P]=y.useState([]),[M,L]=y.useState(!1),[G,z]=y.useState(null),[U,Q]=y.useState([]);y.useEffect(()=>{if(!E){Q([]);return}let Y=!1;return wC(E,(v==null?void 0:v.cwd)??void 0).then(ve=>{Y||Q(ve)}).catch(()=>{Y||Q([])}),()=>{Y=!0}},[E,v==null?void 0:v.cwd]);const[J,oe]=y.useState(!1),[me,Se]=y.useState(""),[Me,ee]=y.useState(0),[ie,te]=y.useState(void 0),[F,Z]=y.useState(!1),[q,I]=y.useState(""),[$,ue]=y.useState([]),B=J?gC(me,T,U):[];y.useEffect(()=>{k!==null&&(n(Y=>Y+k),setTimeout(()=>{if(r.current){he(),r.current.focus();const Y=r.current.value.length;r.current.setSelectionRange(Y,Y)}},0),A.setState({quotedText:null}))},[k]),y.useEffect(()=>{if(!x)return;function Y(ve){ve.key==="Escape"&&(ve.preventDefault(),d())}return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[x,d]),y.useEffect(()=>{oe(!1),te(void 0),Z(!1),ue([]),P(Y=>{for(const ve of Y)ve.previewUrl&&URL.revokeObjectURL(ve.previewUrl);return[]})},[m]),y.useEffect(()=>{if(!G)return;function Y(ve){ve.key==="Escape"&&(ve.preventDefault(),z(null))}return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[G]);const X=y.useCallback(Y=>{if(!Y)return;const ve=Array.from(Y);for(const Be of ve){const rt=new FileReader;rt.onload=()=>{const vt=rt.result.split(",")[1]??"",_t=Be.type.startsWith("image/")?URL.createObjectURL(Be):void 0;P(an=>[...an,{id:bC(),name:Be.name,media_type:Be.type||"application/octet-stream",data:vt,previewUrl:_t,size:Be.size}])},rt.readAsDataURL(Be)}},[]),ce=y.useCallback(Y=>{P(ve=>{const Be=ve.find(rt=>rt.id===Y);return Be!=null&&Be.previewUrl&&URL.revokeObjectURL(Be.previewUrl),ve.filter(rt=>rt.id!==Y)})},[]),be=y.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),!(!b||x)&&L(!0)},[b,x]),_e=y.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),L(!1)},[]),Ae=y.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),L(!1),!(!b||x)&&X(Y.dataTransfer.files)},[b,x,X]),je=y.useCallback(Y=>{var rt;if(!b)return;const ve=(rt=Y.clipboardData)==null?void 0:rt.items;if(!ve)return;const Be=[];for(let gt=0;gt<ve.length;gt++){const vt=ve[gt];if(vt.type.startsWith("image/")){const _t=vt.getAsFile();_t&&Be.push(_t)}}Be.length>0&&(Y.preventDefault(),X(Be))},[b,X]);function ge(Y){const ve=r.current;ve&&(ve.style.height=`${Y}px`,o.current=Y)}function he(){const Y=r.current;if(Y){if(Y.scrollHeight>Y.clientHeight){const ve=Math.min(Y.scrollHeight,fd);ve!==o.current&&ge(ve);return}o.current>xo&&(Y.style.height="auto",ge(Math.min(Y.scrollHeight,fd)))}}function Ve(){const Y=e.trim();if(!Y||x)return;let ve=Y;$.length>0&&(ve=`${$.map(gt=>`$${gt.name}`).join(" ")}
673
+ })();`;function Ld(e){return`<script>${e.replace(/<\/script/gi,"<\\/script")}<\/script>`}function zT(){const e=Object.entries(Ky()).map(([n,r])=>`${n}: ${r};`).join(" ");return["<!DOCTYPE html>","<html><head>",'<meta charset="utf-8">',`<meta http-equiv="Content-Security-Policy" content="${Vy}">`,"<style>",`:root { ${e} color-scheme: light; }`,"html, body { margin: 0; padding: 0; background: transparent; overflow: hidden; }","body { font: 14px/1.5 var(--font-sans); color: var(--color-text-primary); -webkit-font-smoothing: antialiased; }","#root { position: relative; display: flow-root; }","*, *::before, *::after { box-sizing: border-box; }","</style>",Ld(OT),'</head><body><div id="root"></div>',Ld(PT),"</body></html>"].join(`
674
+ `)}let Ng=null;function FT(){return Ng??(Ng=zT()),Ng}const UT=4e3,BT=3,So=new Map,WT=500;function HT(e,n){if(So.delete(e),So.set(e,n),So.size>WT){const r=So.keys().next().value;r!==void 0&&So.delete(r)}}function VT({widgetId:e,title:n,html:r,final:o,onError:l}){const c=y.useRef(null),[d,f]=y.useState(()=>So.get(e)??0),h=y.useRef({html:r,final:o});h.current={html:r,final:o};const m=y.useRef(l);m.current=l;const v=y.useRef(0),k=y.useRef(null),x=y.useCallback(()=>{var E;const S=(E=c.current)==null?void 0:E.contentWindow;if(!S||v.current===0||v.current>BT)return;const C=h.current,T=k.current;T&&(T.final||T.html===C.html&&T.final===C.final)||(k.current=C,S.postMessage({source:Wy,type:"content",html:C.html,final:C.final},"*"))},[]);return y.useEffect(()=>{function S(C){var b;const T=c.current;if(!T||C.source!==T.contentWindow)return;const E=C.data;if(!(!E||typeof E!="object"||E.source!==By))if(E.type==="ready")v.current+=1,k.current=null,x();else if(E.type==="height"&&typeof E.height=="number"&&Number.isFinite(E.height)){const j=Math.min(UT,Math.max(0,Math.ceil(E.height)));f(j),HT(e,j)}else E.type==="error"&&typeof E.message=="string"&&((b=m.current)==null||b.call(m,E.message.slice(0,500)))}return window.addEventListener("message",S),()=>window.removeEventListener("message",S)},[e,x]),y.useEffect(()=>{x()},[r,o,x]),a.jsx("iframe",{ref:c,className:"widget-frame",sandbox:Hy,srcDoc:FT(),title:n||"Widget",style:{height:`${d}px`}})}const KT=720,GT=20;function Od(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function qT(e,n){const r=Object.entries(Ky()).map(([o,l])=>`${o}: ${l};`).join(" ");return["<!DOCTYPE html>","<html><head>",'<meta charset="utf-8">',`<meta http-equiv="Content-Security-Policy" content="${Vy}">`,'<meta name="viewport" content="width=device-width, initial-scale=1">',`<title>${Od(e||"Widget")}</title>`,"<style>",`:root { ${r} color-scheme: light; }`,"html { background: var(--color-background-primary); }","body { margin: 0; padding: 32px 24px; font: 14px/1.5 var(--font-sans); color: var(--color-text-primary); -webkit-font-smoothing: antialiased; }",`#root { position: relative; display: flow-root; max-width: ${KT}px; margin: 0 auto; }`,"*, *::before, *::after { box-sizing: border-box; }","</style>",Ld(Gy),'</head><body><div id="root">',n,"</div></body></html>"].join(`
675
+ `)}function XT(e,n){const r=Od(e||"Widget");return["<!DOCTYPE html>","<html><head>",'<meta charset="utf-8">','<meta name="viewport" content="width=device-width, initial-scale=1">',`<title>${r}</title>`,"<style>html, body { margin: 0; height: 100%; } iframe { display: block; width: 100%; height: 100%; border: 0; }</style>","</head><body>",`<iframe sandbox="${Hy}" title="${r}" srcdoc="${Od(qT(e,n))}"></iframe>`,"</body></html>"].join(`
676
+ `)}const yo=new Map;function YT(e,n,r){const o=XT(n,r);let l=yo.get(e);l&&l.doc!==o&&(URL.revokeObjectURL(l.url),l=void 0),l??(l={doc:o,url:URL.createObjectURL(new Blob([o],{type:"text/html;charset=utf-8"}))}),yo.delete(e),yo.set(e,l);for(const[d,f]of yo){if(yo.size<=GT)break;URL.revokeObjectURL(f.url),yo.delete(d)}const c=window.open(l.url,"_blank");c&&(c.opener=null)}function QT({item:e}){const[n,r]=y.useState(null),o=e.data??{},l=typeof o.title=="string"?o.title.trim():"",c=typeof o.html=="string"?o.html:"",d=o.partial===!0,f=typeof o.error=="string"&&o.error?o.error:null,h=e.external_item_id??e.id;return a.jsxs("div",{className:"render-content widget-card",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(K1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:l||"Visual"}),d&&a.jsx("span",{className:"turn-header-meta",children:"drawing…"}),f&&a.jsx("span",{className:"turn-header-meta",style:{color:"var(--red)"},children:"failed"}),!d&&c.trim()!==""&&a.jsx("button",{type:"button",className:"widget-open-btn",title:"Open in a new tab","aria-label":"Open in a new tab",onClick:()=>YT(h,l,c),children:a.jsx(Ov,{size:14})})]}),c.trim()?a.jsx(VT,{widgetId:h,title:l,html:c,final:!d,onError:r}):!f&&a.jsx("div",{className:"widget-placeholder",children:d?"Drawing…":"Nothing to show"}),f&&a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:f})}),n&&!f&&a.jsxs("div",{className:"widget-script-error",title:n,children:["Script error: ",n]})]})}function Hl(e){return`Message from ${(e==null?void 0:e.trim())||"another session"}`}function bf(e){return(e??[]).filter(n=>n.task_type!=="local_agent").length}function Nf(e){switch(e){case"local_agent":return"subagent";case"local_bash":return"monitor";case"background_terminal":return"command";default:return"task"}}function qy(e,n){switch(Nf(e)){case"subagent":return`Subagent${n?`: ${n}`:""}`;case"monitor":return"Monitor";case"command":return"Background command";default:return"Background Task"}}const ZT={subagent:vr,monitor:Kv,command:Jl,task:Lv};Ge.setOptions({breaks:!0,gfm:!0});const JT=10,eC=100;function Xy({name:e,body:n}){return a.jsxs("div",{className:"render-content peer-message",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--purple)",color:"#fff"},children:a.jsx(Wv,{size:14})}),a.jsx("span",{className:"turn-header-title",children:Hl(e)})]}),a.jsx("p",{className:"user-message",children:n})]})}function tC({attachments:e}){const[n,r]=y.useState(null);return y.useEffect(()=>{if(!n)return;function o(l){l.key==="Escape"&&r(null)}return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[n]),!Array.isArray(e)||e.length===0?null:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"attachment-pills",children:e.map((o,l)=>{const c=o.media_type.startsWith("image/"),d=`data:${o.media_type};base64,${o.data}`;return a.jsxs("span",{className:"attachment-pill",title:o.name,onClick:c?()=>r(d):void 0,style:c?{cursor:"pointer"}:void 0,children:[c?a.jsx("img",{src:d,alt:o.name,className:"attachment-pill-thumb"}):a.jsx($v,{size:12,className:"attachment-pill-icon"}),a.jsx("span",{className:"attachment-pill-name",children:o.name})]},l)})}),n&&a.jsx("div",{className:"image-preview-modal",onClick:()=>r(null),children:a.jsxs("div",{className:"image-preview-content",onClick:o=>o.stopPropagation(),children:[a.jsx("img",{src:n,alt:"preview"}),a.jsx("button",{className:"image-preview-close",onClick:()=>r(null),children:a.jsx(Tn,{size:20})})]})})]})}function nC(e){const n=Ge.parse(e);return Sf.sanitize(n)}function Tg(e){var n;return(n=e.data)!=null&&n.text?e.data.text:""}function sC(e){const n=e.match(/^\/bin\/\w+\s+-\w+\s+"(.*)"$/s);return n?n[1]:e}const Cg='<script>(function(){function report(){var h=Math.max(document.documentElement.scrollHeight,document.body?document.body.scrollHeight:0);if(h>0)parent.postMessage(Math.ceil(h),"*");}window.addEventListener("load",report);new ResizeObserver(report).observe(document.documentElement);report();})();<\/script>';function rC(e){return/<\/body>/i.test(e)?e.replace(/<\/body>/i,`${Cg}</body>`):e+Cg}function oC({html:e}){const[n,r]=y.useState(480),o=y.useRef(null);return y.useEffect(()=>{function l(c){var d;c.source===((d=o.current)==null?void 0:d.contentWindow)&&typeof c.data=="number"&&c.data>0&&r(c.data)}return window.addEventListener("message",l),()=>window.removeEventListener("message",l)},[]),a.jsx("iframe",{ref:o,sandbox:"allow-scripts",srcDoc:rC(e),title:"HTML content",style:{width:"100%",height:`${n}px`,border:"1px solid var(--border)",borderRadius:"var(--r-md)",background:"#fff",marginTop:"8px"}})}const Eg=1e4;function iC({item:e,runtimeType:n,turn:r,threads:o}){var f,h,m,v,k,x,S,C,T,E;const l=e.status==="in_progress",[c,d]=y.useState(!1);switch(e.type){case"agent_message":{const{iconClass:b,iconText:j}=Sd(n??"codex");return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:`turn-header-icon ${b}`,children:j}),a.jsx("span",{className:"turn-header-title",children:"Agent"}),l&&a.jsx("span",{className:"turn-header-meta",children:"writing…"})]}),a.jsx(kg,{itemId:e.id,turnId:r.id,sessionId:r.session_id,content:Tg(e)||"…",threads:o,runtimeType:n})]})}case"reasoning":return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(y1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Reasoning"})]}),a.jsx("div",{dangerouslySetInnerHTML:{__html:nC(Tg(e))}})]});case"command_execution":{const b=e.data||{},j=sC(b.command||""),P=b.aggregated_output||"",M=b.exit_code,L=l?"running…":M!==null?`exit ${M}`:"",G=P.length>Eg,z=G&&!c?P.slice(0,Eg)+`
677
+ … (truncated, click to expand)`:P;return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(Jl,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Command"}),L&&a.jsx("span",{className:"turn-header-meta",children:L})]}),a.jsx("pre",{className:"cmd-block",children:a.jsx("code",{children:j})}),P&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"cmd-output",children:a.jsx("code",{children:z})}),G&&a.jsx("button",{className:"cmd-output-toggle",onClick:()=>d(U=>!U),children:c?"Show less":`Show full output (${(P.length/1024).toFixed(0)}KB)`})]})]})}case"file_change":{const b=(f=e.data)==null?void 0:f.changes,j=Array.isArray(b)?b:[],P=`${j.length} file${j.length!==1?"s":""}`;return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(N1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"File Changes"}),a.jsx("span",{className:"turn-header-meta",children:P})]}),a.jsx("div",{className:"file-change-list",children:j.map((M,L)=>{const G=M.kind==="add"?"A":M.kind==="delete"?"D":"M",z=M.kind==="add"?"fc-add":M.kind==="delete"?"fc-del":"fc-mod";return a.jsxs("div",{className:"file-change",children:[a.jsx("span",{className:`fc-status ${z}`,children:G}),a.jsx("span",{className:"fc-name",children:M.path})]},L)})})]})}case"mcp_tool_call":{const b=e.data||{},j=b.tool||"mcp";if(j==="Agent"){const J=b.arguments,oe=(J==null?void 0:J.description)||(J==null?void 0:J.prompt)||"Subagent",me=e.status==="failed",Se=l?"running…":me?"failed":"done";return a.jsxs("div",{className:"agent-call-card",children:[a.jsx("span",{className:"agent-call-icon",children:a.jsx(vr,{size:14})}),a.jsx("span",{className:"agent-call-desc",children:oe}),a.jsx("span",{className:`agent-call-status ${l?"running":me?"failed":"done"}`,children:Se})]})}const P=b.server||"",M=b.arguments,L=b.result,G=b.error,z=e.status==="failed"||!!G,U=l?"running…":z?"failed":"done",Q=((h=L==null?void 0:L.content)==null?void 0:h.filter(J=>J.type==="text").map(J=>J.text))??[];return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(W1,{size:14})}),a.jsxs("span",{className:"turn-header-title",children:["MCP: ",j]}),P&&a.jsx("span",{className:"turn-header-meta",children:P}),a.jsx("span",{className:"turn-header-meta",style:z?{color:"var(--red)"}:void 0,children:U})]}),M&&Object.keys(M).length>0&&a.jsx("div",{className:"mcp-args",children:Object.entries(M).map(([J,oe])=>a.jsxs("div",{className:"mcp-arg",children:[a.jsx("span",{className:"mcp-arg-key",children:J}),J==="code"?a.jsx("pre",{className:"cmd-block",children:a.jsx("code",{children:String(oe)})}):a.jsx("span",{className:"mcp-arg-value",children:typeof oe=="string"?oe:JSON.stringify(oe,null,2)})]},J))}),Q.length>0&&Q.map((J,oe)=>a.jsx("pre",{className:"cmd-output",children:a.jsx("code",{children:J})},oe)),G&&a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:G})})]})}case"web_search":{const b=((m=e.data)==null?void 0:m.query)||"";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(V1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Web Search"})]}),a.jsx("p",{className:"user-message",children:b})]})}case"todo_list":{const b=((v=e.data)==null?void 0:v.items)||[];return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(I1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Todo List"})]}),a.jsx("ul",{className:"todo-list",children:b.map((j,P)=>a.jsxs("li",{className:j.completed?"todo-done":"todo-pending",children:[j.completed?a.jsx(Cs,{size:14}):a.jsx(yr,{size:14})," ",j.text]},P))})]})}case"ask_user":return a.jsx(bg,{item:e,turn:r});case"final_result":{const b=e.data??{},j=b.text||"",P=b.html||null,M=Array.isArray(b.groups)?b.groups.filter(z=>!!z&&Array.isArray(z.selections)&&z.selections.length>0):[],{iconClass:L,iconText:G}=Sd(n??"codex");return a.jsxs(a.Fragment,{children:[(j||P)&&a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:`turn-header-icon ${L}`,children:G}),a.jsx("span",{className:"turn-header-title",children:"Agent"})]}),j&&a.jsx(kg,{itemId:e.id,turnId:r.id,sessionId:r.session_id,content:j,threads:o,runtimeType:n}),P&&a.jsx(oC,{html:P})]}),M.length>0&&a.jsx(bg,{item:e,turn:r})]})}case"background_task":{const b=e.data||{},j=b.task_type||"unknown",P=b.subagent_type||null,M=b.description||"",L=b.status||"running",G=b.last_tool_name||null,z=b.token_count||null,U=ZT[Nf(j)],Q=qy(j,P),J=L==="running"?"running…":L==="completed"?"done":L==="failed"?"failed":L==="stopped"?"stopped":L,oe=e.status==="failed"||L==="failed";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(U,{size:14})}),a.jsx("span",{className:"turn-header-title",children:Q}),a.jsx("span",{className:"turn-header-meta",style:oe?{color:"var(--red)"}:void 0,children:J})]}),M&&a.jsx("p",{className:"user-message",style:{fontSize:"13px"},children:M}),G&&l&&a.jsxs("div",{className:"cmd-output",style:{color:"var(--text-3)",fontSize:"12px"},children:["last tool: ",G,z!=null&&` · ${z.toLocaleString()} tokens`]}),a.jsx("div",{className:"cmd-output",style:{color:"var(--text-muted)",fontSize:"11px"},children:"Output available in Tasks panel — click the status bar indicator or the Tasks tab."})]})}case"context_compaction":{const b=((k=e.data)==null?void 0:k.trigger)??"auto",j=typeof((x=e.data)==null?void 0:x.pre_tokens)=="number"?e.data.pre_tokens:null,P=typeof((S=e.data)==null?void 0:S.post_tokens)=="number"?e.data.post_tokens:null,M=b==="manual"?"Context compacted (/compact)":"Context auto-compacted",L=j!==null&&P!==null?`${j.toLocaleString()} → ${P.toLocaleString()} tokens (${j>0?Math.round((1-P/j)*100):0}% reduction)`:j!==null?`${j.toLocaleString()} tokens before`:P!==null?`${P.toLocaleString()} tokens after`:null;return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(O1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:M})]}),L&&a.jsx("div",{className:"cmd-output",style:{color:"var(--text-3)"},children:L})]})}case"interruption":return a.jsx(IT,{item:e});case"peer_message":return a.jsx(Xy,{name:(C=e.data)==null?void 0:C.name,body:((T=e.data)==null?void 0:T.body)??""});case"widget":return a.jsx(QT,{item:e});case"error":{const b=((E=e.data)==null?void 0:E.message)||"Unknown error";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--red)",color:"#fff"},children:a.jsx(Zl,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Error"})]}),a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:b})})]})}default:return null}}const Pr=y.memo(iC,(e,n)=>e.item===n.item&&e.runtimeType===n.runtimeType&&e.threads===n.threads&&e.turn.id===n.turn.id);function aC(e){return e.type==="widget"?`widget-${e.external_item_id??e.id}`:e.id}function lC({turn:e,runtimeType:n,threads:r=[]}){Lt.trackRender("TurnContent");const[o,l]=y.useState(!1),[c,d]=y.useState(!1),[f,h]=y.useState(!1),[m,v]=y.useState(!1),k=A(B=>B.loadDeferredItems),x=e.items.some(B=>B.type==="background_task"&&B.status==="in_progress");y.useEffect(()=>{e.status==="running"||e.status==="pending"?l(!0):e.status==="completed"&&!x&&l(!1)},[e.status,x]);const S=e.deferred_item_count??0,C=Fs(e),T=y.useRef(C);y.useEffect(()=>{const B=T.current&&!C&&e.status==="completed"&&!x;if(T.current=C,B||!o||S===0||m||C&&!c)return;let X=!1;return k(e.session_id,e.id).then(ce=>{!ce&&!X&&v(!0)}),()=>{X=!0}},[o,S,m,C,c,e.status,x,k,e.session_id,e.id]);let E=-1;for(let B=e.items.length-1;B>=0;B--)if(e.items[B].type==="agent_message"){E=B;break}const b=E>=0,j=b?e.items.slice(0,E):e.items,P=e.items.some(B=>B.type==="final_result"||B.type==="ask_user"),M=!b&&e.status==="completed"&&e.agent_response&&!P?{id:`response-${e.id}`,turn_id:e.id,external_item_id:`response-${e.id}`,type:"agent_message",data:{text:e.agent_response},status:"completed",created_at:e.created_at,updated_at:e.updated_at}:null,L=j.filter(B=>{var X;return!(B.type==="reasoning"&&(!((X=B.data)!=null&&X.text)||B.data.text===""))}),G=e.items.some(B=>{var X;return B.type==="interruption"&&((X=B.data)==null?void 0:X.reason)==="auth"}),z=e.items.some(B=>{var X;return B.type==="interruption"&&((X=B.data)==null?void 0:X.reason)==="usage_limit"}),U=L.filter(B=>{var X,ce;return!(B.type==="background_task"||B.type==="ask_user"||B.type==="final_result"||B.type==="widget"||B.type==="context_compaction"||B.type==="peer_message"||G&&B.type==="error"&&((X=B.data)==null?void 0:X.error)==="authentication_failed"||z&&B.type==="error"&&((ce=B.data)==null?void 0:ce.error)==="rate_limit")}),Q=c?0:Math.max(0,U.length-eC),J=Q>0?U.slice(Q):U,oe=[];let me=null;for(const B of J)B.type==="agent_message"?(me&&oe.push(me),me={agentMessage:B,toolItems:[],otherItems:[]}):B.type==="interruption"||B.type==="error"?(me&&oe.push(me),oe.push({agentMessage:null,toolItems:[],otherItems:[B]}),me=null):(me||(me={agentMessage:null,toolItems:[],otherItems:[]}),xg(B)?me.toolItems.push(B):me.otherItems.push(B));me&&oe.push(me);const Se=e.status==="running"||e.status==="pending",Me=B=>{var X;return B.type==="widget"&&(Se||((X=B.data)==null?void 0:X.partial)!==!0)},ee=b?e.items[E]:M,ie=[...j.filter(B=>Me(B)||B.type==="context_compaction"||B.type==="peer_message"),...ee?[ee]:[],...b?e.items.slice(E+1).filter(B=>B.type!=="ask_user"&&B.type!=="background_task"&&B.type!=="final_result"&&(B.type!=="widget"||Me(B))):[]],te=e.items.filter(B=>B.type==="background_task"),F=f?0:Math.max(0,te.length-JT),Z=F>0?te.slice(F):te,q=U.filter(B=>xg(B)).length+(e.deferred_tool_calls??0),I=q>0||C&&(U.length>0||S>0),$=e.status==="pending"&&e.resume_state==="waiting",ue=e.resume_state==="gave_up"||e.resume_state==="skipped"||e.resume_state==="unsupported";return a.jsxs("div",{className:"turn-group",children:[e.origin==="peer"?a.jsx(Xy,{name:e.origin_name,body:e.user_prompt}):a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--amber)",color:"#fff"},children:"U"}),a.jsx("span",{className:"turn-header-title",children:"You"})]}),a.jsx("p",{className:"user-message",children:e.user_prompt}),Array.isArray(e.attachments)&&e.attachments.length>0&&a.jsx(tC,{attachments:e.attachments})]}),I&&a.jsxs("div",{className:"tool-calls",children:[a.jsxs("div",{className:"tool-calls-header",onClick:()=>l(B=>!B),children:[a.jsx("span",{className:"tool-calls-icon",children:a.jsx(_1,{size:12})}),a.jsx("span",{className:"tool-calls-summary",children:q>0?`${q} tool call${q>1?"s":""}`:$?"interrupted":"thinking…"}),a.jsx(Li,{size:14,className:"tool-calls-chevron",style:{transform:o?"rotate(90deg)":"none"}})]}),o&&a.jsxs("div",{className:"tool-calls-body",children:[S>0&&a.jsx("div",{className:"render-load-earlier",children:m?a.jsx("button",{className:"render-load-earlier-btn",onClick:()=>v(!1),children:"Couldn't load these steps. Try again"}):C&&!c?a.jsx("button",{className:"render-load-earlier-btn",onClick:()=>d(!0),children:"Show earlier steps"}):a.jsx("span",{className:"tool-calls-loading",children:"Loading steps…"})}),(S===0||C)&&a.jsxs(a.Fragment,{children:[S===0&&Q>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>d(!0),children:["Show ",Q," earlier step",Q>1?"s":""]})}),oe.map((B,X)=>a.jsxs("div",{className:"intermediate-segment",children:[B.agentMessage&&a.jsx(Pr,{item:B.agentMessage,runtimeType:n,turn:e,threads:r}),B.otherItems.map(ce=>a.jsx(Pr,{item:ce,runtimeType:n,turn:e,threads:r},ce.id)),B.toolItems.length>0&&a.jsx(yT,{items:B.toolItems,runtimeType:n,turn:e,threads:r})]},X))]})]})]}),F>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>h(!0),children:["Show ",F," earlier background task",F>1?"s":""]})}),Z.map(B=>a.jsx(Pr,{item:B,runtimeType:n,turn:e,threads:r},`task-${B.id}`)),ie.map(B=>a.jsx(Pr,{item:B,runtimeType:n,turn:e,threads:r},aC(B))),e.items.filter(B=>B.type==="final_result").map(B=>a.jsx(Pr,{item:B,runtimeType:n,turn:e,threads:r},`final-${B.id}`)),e.items.filter(B=>B.type==="ask_user").map(B=>a.jsx(Pr,{item:B,runtimeType:n,turn:e,threads:r},`ask-${B.id}`)),e.items.length===0&&!e.error&&(e.status==="pending"||e.status==="running")&&a.jsx("div",{className:"render-content",children:a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:e.status==="running"?"Agent is thinking…":"Waiting to start…"})}),e.error&&!ue&&a.jsx("div",{className:"render-content",children:a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:e.error})})}),e.status==="running"&&a.jsx(LT,{turnId:e.id}),a.jsx(MT,{turn:e}),e.status==="aborted"&&a.jsxs("div",{className:"aborted-banner",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(yr,{size:12})}),a.jsx("span",{className:"banner-text",children:"Turn stopped — work generated so far is kept."})]})]})}const cC=y.memo(lC),uC=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.userAgent)?"⌘K":"Ctrl+K";function dC(){const e=A(b=>b.workspaces),n=A(b=>b.loadPickerSupport),r=A(b=>b.pickAndAddWorkspace),o=A(b=>b.createSessionInWorkspace),l=A(b=>b.setImportSessionsWorkspace);y.useEffect(()=>{n()},[n]);const c=e.filter(b=>b.deleted===0),[d,f]=y.useState(null),h=c.find(b=>b.path===d)??c[c.length-1]??null,m=(h==null?void 0:h.path)??null,[v,k]=y.useState(null);y.useEffect(()=>{if(!m)return;let b=!1;return bv(m).then(({sessions:j})=>{b||k({path:m,runtimes:j.map(P=>P.runtime)})}),()=>{b=!0}},[m]);const x=v&&v.path===m?v.runtimes:[],S=x.length,[C,T]=y.useState(!1);async function E(b){T(!0);try{await o(b)}finally{T(!1)}}return a.jsx("div",{className:"render-scroll welcome-scroll",children:a.jsxs("main",{className:"welcome","aria-labelledby":"welcome-title",children:[a.jsx("h1",{className:"welcome-title",id:"welcome-title",children:"Welcome to Repoburg"}),a.jsx("p",{className:"welcome-lead",children:"Run Claude Code and Codex agents on your projects, side by side. Each session works in a workspace: one of your project folders."}),a.jsxs("ol",{className:"welcome-steps",children:[a.jsxs("li",{className:`welcome-step${h?" done":" current"}`,children:[a.jsx("span",{className:"welcome-step-mark","aria-hidden":"true",children:h?a.jsx(Cs,{size:13}):"1"}),a.jsxs("div",{className:"welcome-step-body",children:[a.jsx("h2",{className:"welcome-step-title",children:"Add a workspace"}),h?a.jsx("p",{className:"welcome-step-text",children:a.jsx("code",{title:h.path,children:h.path})}):a.jsxs("button",{className:"dialog-btn-create welcome-primary",onClick:()=>void r(),children:[a.jsx(C1,{size:14})," Open folder…"]})]})]}),a.jsxs("li",{className:`welcome-step${h?" current":" upcoming"}`,children:[a.jsx("span",{className:"welcome-step-mark","aria-hidden":"true",children:"2"}),a.jsxs("div",{className:"welcome-step-body",children:[a.jsx("h2",{className:"welcome-step-title",children:"Start your first session"}),h&&m?a.jsxs(a.Fragment,{children:[c.length>1&&a.jsxs("label",{className:"welcome-step-text welcome-target",children:["In",a.jsx("select",{className:"dialog-input dialog-select",value:m,onChange:b=>f(b.target.value),children:c.map(b=>a.jsx("option",{value:b.path,children:b.label||b.path},b.id))})]}),a.jsxs("div",{className:"welcome-actions",children:[a.jsxs("button",{className:"dialog-btn-create welcome-primary",disabled:C,onClick:()=>void E(m),children:[a.jsx(pr,{size:14})," New session"]}),S>0&&a.jsxs("button",{className:"dialog-btn-cancel",onClick:()=>l(m),children:[a.jsx(Fv,{size:14})," Import ",Sv(x)]})]}),S>0&&a.jsxs("p",{className:"welcome-step-text",children:["Sessions you started with ",a.jsx("code",{children:"claude"})," or ",a.jsx("code",{children:"codex"})," in this folder continue right where they left off."]})]}):a.jsx("p",{className:"welcome-step-text",children:"Then start an agent session in it."})]})]})]}),a.jsxs("p",{className:"welcome-tip",children:["Later: right-click a workspace to import its Claude Code and Codex sessions, and press"," ",a.jsx("kbd",{children:uC})," for the command palette."]})]})})}const fC=[],cl=50;function pC(){Lt.trackRender("RenderArea");const e=A(S=>S.activeSessionId),n=A(S=>S.activeSessionId?S.sessionDetails[S.activeSessionId]:null),r=A(S=>S.submittingPrompt),o=A(S=>S.loading),l=A(S=>!S.activeSessionId&&!qb(S.workspaces,S.sessions,S.appsRootPath)),c=(n==null?void 0:n.turns)??[],d=(n==null?void 0:n.threads)??fC,f=y.useRef(null),[h,m]=y.useState(cl);y.useEffect(()=>{m(cl)},[e]);const v=c.filter(S=>!S.thread_id),k=Math.max(0,v.length-h),x=v.slice(k);return y.useEffect(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},[e,c.length]),o&&!n?a.jsx("div",{className:"render-scroll",children:a.jsxs("div",{className:"skeleton-bars",children:[a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"})]})}):n?a.jsxs("div",{className:"render-scroll",ref:f,children:[r&&a.jsx("div",{className:"turn-block",children:a.jsxs("div",{className:"turn-group",children:[a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--amber)",color:"#fff"},children:"U"}),a.jsx("span",{className:"turn-header-title",children:"You"})]}),a.jsx("p",{className:"user-message",children:r})]}),a.jsx("div",{className:"render-content",children:a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:"Sending…"})})]})}),c.length===0&&!r&&a.jsx("div",{className:"empty-state",children:"No turns yet. Send a message below to start."}),k>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>m(S=>S+cl),children:["Show ",Math.min(cl,k)," earlier turns (",k," hidden)"]})}),x.map((S,C)=>a.jsx("div",{id:`turn-${k+C}`,className:"turn-block",children:a.jsx(cC,{turn:S,runtimeType:n.runtime_type,threads:d})},S.id))]}):l?a.jsx(dC,{}):a.jsx("div",{className:"render-scroll",children:a.jsx("div",{className:"empty-state",children:"No session selected"})})}const hC=y.memo(pC),mC=[{id:"model",label:"/model",hint:"Change model",capability:"dynamicModels"},{id:"sandbox",label:"/sandbox",hint:"Sandbox mode",capability:"sandbox",subPopup:"sandbox"},{id:"websearch",label:"/websearch",hint:"Web search mode",capability:"webSearch",subPopup:"websearch"},{id:"network",label:"/network",hint:"Network access",capability:"networkAccess",subPopup:"network"},{id:"skills",label:"/skills",hint:"Browse skills",capability:"skills"},{id:"plugins",label:"/plugins",hint:"Browse plugins",capability:"plugins"},{id:"mcp",label:"/mcp",hint:"Browse MCP servers",capability:"mcpServers"}];function gC(e){return e.map(n=>({id:n.name,label:`/${n.name}`,hint:n.description,capability:null,insertAsText:!0}))}function vC(e,n,r=[]){const o=[...mC,...gC(r)],l=new Set;return o.filter(c=>!(l.has(c.label)||(l.add(c.label),c.capability&&!n[c.capability])||e&&!c.label.toLowerCase().includes(e.toLowerCase())))}function yC({commands:e,selectedIndex:n,onSelect:r,onHover:o}){return a.jsxs("div",{className:"slash-popup",children:[a.jsx("div",{className:"slash-popup-header",children:"Commands"}),e.length===0&&a.jsx("div",{className:"slash-popup-empty",children:"No matching commands"}),e.map((l,c)=>a.jsxs("div",{className:`slash-popup-item ${c===n?"selected":""}`,onMouseEnter:()=>o(c),onClick:()=>r(l),children:[a.jsx("span",{className:"slash-popup-label",children:l.label}),a.jsx("span",{className:"slash-popup-hint",children:l.hint})]},l.id))]})}function fd({title:e,options:n,currentValue:r,onSelect:o,onClose:l}){return a.jsxs("div",{className:"slash-popup",children:[a.jsxs("div",{className:"slash-popup-header",children:[a.jsx("button",{className:"slash-popup-back",onClick:l,children:"← Back"}),a.jsx("span",{children:e})]}),n.map(c=>a.jsxs("div",{className:`slash-popup-item ${c.value===r?"selected":""}`,onClick:()=>o(c.value),children:[a.jsxs("div",{className:"slash-popup-item-main",children:[a.jsx("span",{className:"slash-popup-label",children:c.label}),c.description&&a.jsx("span",{className:"slash-popup-hint",children:c.description})]}),c.value===r&&a.jsx("span",{className:"slash-popup-check",children:"✓"})]},c.value))]})}function xC(e){return kt("/skills")}function wC({filter:e,onSelect:n,onClose:r}){const[o,l]=y.useState([]),[c,d]=y.useState(!0),[f,h]=y.useState(0),m=y.useRef(null);y.useEffect(()=>{xC().then(l).catch(()=>l([])).finally(()=>d(!1))},[]);const v=o.filter(k=>k.name.toLowerCase().includes(e.toLowerCase())||k.description.toLowerCase().includes(e.toLowerCase()));return y.useEffect(()=>{h(0)},[e]),y.useEffect(()=>{function k(x){x.key==="ArrowDown"?(x.preventDefault(),h(S=>Math.min(S+1,v.length-1))):x.key==="ArrowUp"?(x.preventDefault(),h(S=>Math.max(S-1,0))):x.key==="Enter"?(x.preventDefault(),v[f]&&n(v[f])):x.key==="Escape"&&(x.preventDefault(),r())}return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[v,f,n,r]),a.jsxs("div",{className:"slash-popup",ref:m,children:[a.jsxs("div",{className:"slash-popup-header",children:[a.jsx("button",{className:"slash-popup-back",onClick:r,children:"← Back"}),a.jsx("span",{children:"Skills"})]}),c&&a.jsx("div",{className:"slash-popup-empty",children:"Loading skills…"}),!c&&v.length===0&&a.jsx("div",{className:"slash-popup-empty",children:"No matching skills"}),v.map((k,x)=>a.jsxs("div",{className:`slash-popup-item ${x===f?"selected":""}`,onMouseEnter:()=>h(x),onClick:()=>n(k),children:[a.jsxs("div",{className:"slash-popup-item-main",children:[a.jsx("span",{className:"slash-popup-label",children:k.name}),k.description&&a.jsx("span",{className:"slash-popup-hint",children:k.description})]}),!!k.metadata.isSystem&&a.jsx("span",{className:"slash-popup-hint",children:"system"})]},k.id))]})}function Yy(){return kt("/providers")}function kC(e,n){const r=n?`?cwd=${encodeURIComponent(n)}`:"";return kt(`/providers/${e}/commands${r}`)}const SC={dynamicModels:!1,skills:!1,plugins:!1,mcpServers:!1,imageAttachments:!1,sandbox:!1,webSearch:!1,networkAccess:!1,fileReferences:!1};function bC(e){const[n,r]=y.useState([]),[o,l]=y.useState(!0);y.useEffect(()=>{Yy().then(r).catch(()=>r([])).finally(()=>l(!1))},[]);const c=n.find(d=>d.id===e)??null;return{provider:c,capabilities:(c==null?void 0:c.capabilities)??SC,loading:o}}const xo=32,pd=200;function jg(e){if(!e)return{};try{return JSON.parse(e)}catch{return{}}}function _g(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}let Rg=0;function NC(){return Rg+=1,`att-${Date.now()}-${Rg}`}function TC(){Lt.trackRender("CommandInputBar");const[e,n]=y.useState(""),r=y.useRef(null),o=y.useRef(xo),l=y.useRef(null),{submitPrompt:c,cancelTurn:d,updateRuntimeConfig:f,setShowModelSelector:h}=A(),m=A(Y=>Y.activeSessionId),v=A(Y=>Y.activeSessionId?Y.sessionDetails[Y.activeSessionId]:null),k=A(Y=>Y.quotedText),x=mv(v),S=!!(v!=null&&v.turns.some(Y=>Y.status==="pending"&&Y.resume_state==="waiting")),C=!m,{capabilities:T}=bC(v==null?void 0:v.runtime_type),E=(v==null?void 0:v.runtime_type)??null,b=T.imageAttachments,[j,P]=y.useState([]),[M,L]=y.useState(!1),[G,z]=y.useState(null),[U,Q]=y.useState([]);y.useEffect(()=>{if(!E){Q([]);return}let Y=!1;return kC(E,(v==null?void 0:v.cwd)??void 0).then(ve=>{Y||Q(ve)}).catch(()=>{Y||Q([])}),()=>{Y=!0}},[E,v==null?void 0:v.cwd]);const[J,oe]=y.useState(!1),[me,Se]=y.useState(""),[Me,ee]=y.useState(0),[ie,te]=y.useState(void 0),[F,Z]=y.useState(!1),[q,I]=y.useState(""),[$,ue]=y.useState([]),B=J?vC(me,T,U):[];y.useEffect(()=>{k!==null&&(n(Y=>Y+k),setTimeout(()=>{if(r.current){he(),r.current.focus();const Y=r.current.value.length;r.current.setSelectionRange(Y,Y)}},0),A.setState({quotedText:null}))},[k]),y.useEffect(()=>{if(!x)return;function Y(ve){ve.key==="Escape"&&(ve.preventDefault(),d())}return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[x,d]),y.useEffect(()=>{oe(!1),te(void 0),Z(!1),ue([]),P(Y=>{for(const ve of Y)ve.previewUrl&&URL.revokeObjectURL(ve.previewUrl);return[]})},[m]),y.useEffect(()=>{if(!G)return;function Y(ve){ve.key==="Escape"&&(ve.preventDefault(),z(null))}return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[G]);const X=y.useCallback(Y=>{if(!Y)return;const ve=Array.from(Y);for(const Be of ve){const rt=new FileReader;rt.onload=()=>{const vt=rt.result.split(",")[1]??"",_t=Be.type.startsWith("image/")?URL.createObjectURL(Be):void 0;P(an=>[...an,{id:NC(),name:Be.name,media_type:Be.type||"application/octet-stream",data:vt,previewUrl:_t,size:Be.size}])},rt.readAsDataURL(Be)}},[]),ce=y.useCallback(Y=>{P(ve=>{const Be=ve.find(rt=>rt.id===Y);return Be!=null&&Be.previewUrl&&URL.revokeObjectURL(Be.previewUrl),ve.filter(rt=>rt.id!==Y)})},[]),be=y.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),!(!b||x)&&L(!0)},[b,x]),_e=y.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),L(!1)},[]),Ae=y.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),L(!1),!(!b||x)&&X(Y.dataTransfer.files)},[b,x,X]),je=y.useCallback(Y=>{var rt;if(!b)return;const ve=(rt=Y.clipboardData)==null?void 0:rt.items;if(!ve)return;const Be=[];for(let gt=0;gt<ve.length;gt++){const vt=ve[gt];if(vt.type.startsWith("image/")){const _t=vt.getAsFile();_t&&Be.push(_t)}}Be.length>0&&(Y.preventDefault(),X(Be))},[b,X]);function ge(Y){const ve=r.current;ve&&(ve.style.height=`${Y}px`,o.current=Y)}function he(){const Y=r.current;if(Y){if(Y.scrollHeight>Y.clientHeight){const ve=Math.min(Y.scrollHeight,pd);ve!==o.current&&ge(ve);return}o.current>xo&&(Y.style.height="auto",ge(Math.min(Y.scrollHeight,pd)))}}function Ve(){const Y=e.trim();if(!Y||x)return;let ve=Y;$.length>0&&(ve=`${$.map(gt=>`$${gt.name}`).join(" ")}
678
678
 
679
- ${Y}`);const Be=j.map(({id:rt,previewUrl:gt,size:vt,..._t})=>_t);n(""),ue([]),ge(xo),oe(!1),te(void 0),Z(!1);for(const rt of j)rt.previewUrl&&URL.revokeObjectURL(rt.previewUrl);P([]),c(ve,Be.length>0?Be:void 0)}function Ie(Y){if(Y.insertAsText){const ve=`/${Y.id} `;n(ve),oe(!1),te(void 0),requestAnimationFrame(()=>{if(r.current){r.current.focus();const Be=ve.length;r.current.setSelectionRange(Be,Be),he()}});return}Y.subPopup?te(Y.subPopup):Y.id==="skills"?(Z(!0),I(""),oe(!1),n("")):Y.id==="model"?(h(!0),oe(!1),n("")):(oe(!1),n(""))}function mt(Y){ue(ve=>[...ve,Y]),Z(!1),n(""),ge(xo)}function Ue(Y){const ve=jg(v==null?void 0:v.runtime_config);ie==="sandbox"?ve.sandboxMode=Y:ie==="websearch"?ve.webSearchMode=Y:ie==="network"&&(ve.networkAccessEnabled=Y==="true"),f(ve),te(void 0),oe(!1),n(""),ge(xo)}function Vt(Y){if(Lt.markKeystroke(),J&&!ie){if(Y.key==="ArrowDown"){Y.preventDefault(),ee(ve=>Math.min(ve+1,B.length-1));return}if(Y.key==="ArrowUp"){Y.preventDefault(),ee(ve=>Math.max(ve-1,0));return}if(Y.key==="Enter"){Y.preventDefault(),B[Me]&&Ie(B[Me]);return}if(Y.key==="Escape"){Y.preventDefault(),oe(!1),n("");return}}if(ie&&Y.key==="Escape"){Y.preventDefault(),te(void 0);return}if(Y.key==="Enter"&&(Y.metaKey||Y.ctrlKey)&&!x){Y.preventDefault(),Ve();return}Y.key==="Escape"&&x&&(Y.preventDefault(),d())}function tn(Y){Lt.markInputChange();const ve=Y.target.value;n(ve),he(),ve.startsWith("/")&&!ve.includes(" ")&&!x?(oe(!0),Se(ve.slice(1)),ee(0)):(oe(!1),te(void 0)),ve.startsWith("$")&&!x?(Z(!0),I(ve.slice(1))):ve.startsWith("$")||Z(!1)}const St=jg(v==null?void 0:v.runtime_config),jt=[{value:"read-only",label:"Read Only",description:"Agent can only read files"},{value:"workspace-write",label:"Workspace Write",description:"Agent can read and write in workspace"},{value:"danger-full-access",label:"Danger Full Access",description:"Agent has unrestricted access"}],Ft=[{value:"disabled",label:"Disabled",description:"No web search"},{value:"cached",label:"Cached",description:"Use cached search results"},{value:"live",label:"Live",description:"Perform live web searches"}],Ot=[{value:"false",label:"Disabled",description:"No network access"},{value:"true",label:"Enabled",description:"Allow network access in sandbox"}];return a.jsxs("div",{className:`cmd-bar${M?" drag-over":""}`,onDragOver:be,onDragLeave:_e,onDrop:Ae,children:[J&&!ie&&a.jsx(vC,{commands:B,selectedIndex:Me,onSelect:Ie,onHover:ee}),J&&ie==="sandbox"&&a.jsx(dd,{title:"Sandbox Mode",options:jt,currentValue:St.sandboxMode,onSelect:Ue,onClose:()=>te(void 0)}),J&&ie==="websearch"&&a.jsx(dd,{title:"Web Search",options:Ft,currentValue:St.webSearchMode,onSelect:Ue,onClose:()=>te(void 0)}),J&&ie==="network"&&a.jsx(dd,{title:"Network Access",options:Ot,currentValue:St.networkAccessEnabled===!0?"true":"false",onSelect:Ue,onClose:()=>te(void 0)}),F&&a.jsx(xC,{filter:q,onSelect:mt,onClose:()=>{Z(!1),n("")}}),$.length>0&&a.jsx("div",{className:"skill-badges",children:$.map(Y=>a.jsxs("span",{className:"skill-badge",children:["$",Y.name,a.jsx("button",{className:"skill-badge-remove",onClick:()=>ue(ve=>ve.filter(Be=>Be.id!==Y.id)),children:"×"})]},Y.id))}),j.length>0&&a.jsx("div",{className:"attachment-preview-area",children:j.map(Y=>a.jsxs("div",{className:"attachment-chip",title:Y.name,children:[Y.previewUrl?a.jsx("img",{src:Y.previewUrl,alt:Y.name,className:"attachment-thumb",onClick:()=>z(Y),style:{cursor:"pointer"}}):a.jsx($v,{size:20,className:"attachment-file-icon"}),a.jsxs("div",{className:"attachment-info",children:[a.jsx("span",{className:"attachment-name",children:Y.name}),a.jsx("span",{className:"attachment-size",children:_g(Y.size)})]}),a.jsx("button",{className:"attachment-remove",onClick:()=>ce(Y.id),title:"Remove attachment",children:a.jsx(Tn,{size:14})})]},Y.id))}),b&&!x&&!C&&a.jsx("input",{ref:l,type:"file",multiple:!0,accept:"image/*,application/pdf,text/*,.ts,.js,.tsx,.jsx,.py,.go,.rs,.java,.c,.cpp,.h,.css,.html,.xml,.yml,.yaml,.toml,.ini,.sh,.sql",style:{display:"none"},onChange:Y=>{X(Y.target.files),Y.target.value=""}}),a.jsxs("div",{className:"cmd-input-row",children:[b&&!x&&!C&&a.jsx("button",{className:"attachment-clip-btn",onClick:()=>{var Y;return(Y=l.current)==null?void 0:Y.click()},title:"Attach files",disabled:x,children:a.jsx(F1,{size:16})}),a.jsx("textarea",{ref:r,className:"cmd-textarea",placeholder:C?"Select or create a session…":S?"Interrupted — waiting to resume…":x?"Agent is running…":"Type a message… Use / for commands",autoComplete:"off",value:e,disabled:x||C,rows:1,style:{minHeight:xo,maxHeight:fd},onChange:tn,onKeyDown:Vt,onPaste:je}),x?a.jsx("button",{className:"cmd-stop-btn",onClick:()=>d(),title:"Stop (Esc)",children:a.jsx(yr,{size:15})}):a.jsx("button",{className:"cmd-send-btn",onClick:Ve,disabled:!e.trim()||C,title:"Send (⌘↵)",children:a.jsx(Mv,{size:16})})]}),G&&a.jsx("div",{className:"image-preview-modal",onClick:()=>z(null),children:a.jsxs("div",{className:"image-preview-content",onClick:Y=>Y.stopPropagation(),children:[a.jsx("img",{src:G.previewUrl,alt:G.name}),a.jsxs("div",{className:"image-preview-info",children:[a.jsx("span",{children:G.name}),a.jsx("span",{children:_g(G.size)})]}),a.jsx("button",{className:"image-preview-close",onClick:()=>z(null),children:a.jsx(Tn,{size:20})})]})})]})}function TC(){const e=A(E=>E.activeSessionId),n=A(E=>E.activeSessionId?E.sessionDetails[E.activeSessionId]:null),r=A(E=>E.activeTurnIndex),o=A(E=>E.setActiveTurnIndex),l=A(E=>E.rewindToTurn),c=A(E=>E.restoreSession),d=A(E=>E.branchFromTurn),f=(n==null?void 0:n.turns)??[],h=Kl(n),m=!!(n!=null&&n.rewound_at_turn_id),v=(n==null?void 0:n.runtime_type)==="repoburg",k=v?"Rewind to this turn? Runtime history after this point is PERMANENTLY deleted and cannot be restored.":"Rewind to this turn? Hidden turns can be restored later.",[x,S]=y.useState(null),C=y.useRef(null);if(Wi(C,()=>S(null),!!x),Io(()=>S(null),!!x),f.length===0)return a.jsx("div",{className:"empty-state",children:"No turns yet"});function T(E){o(E),requestAnimationFrame(()=>{var b;(b=document.getElementById(`turn-${E}`))==null||b.scrollIntoView({behavior:"smooth",block:"start"})})}return a.jsxs("div",{className:"right-section",children:[a.jsx("div",{className:"right-section-title",children:"Conversation"}),f.map((E,b)=>{const j=b===r,P=E.user_prompt.length>50?E.user_prompt.slice(0,50)+"…":E.user_prompt,M=E.status==="running"||E.status==="pending";return a.jsx("div",{children:a.jsxs("div",{className:`turn-item ${j?"active":""}`,onClick:()=>T(b),onContextMenu:L=>{L.preventDefault(),S({x:L.clientX,y:L.clientY,turnId:E.id,turnIndex:b,isLast:b===f.length-1,isSlashCommand:E.user_prompt.trimStart().startsWith("/")})},children:[E.origin==="peer"?a.jsx("span",{className:"turn-item-icon",style:{background:"var(--purple)",color:"#fff"},title:Wl(E.origin_name),children:a.jsx(Wv,{size:12})}):a.jsx("span",{className:"turn-item-icon",style:{background:"var(--amber)",color:"#fff"},children:a.jsx(X1,{size:12})}),a.jsx("span",{className:"turn-item-label",children:P}),M&&a.jsx("span",{className:"turn-item-status",children:E.status==="pending"&&E.resume_state==="waiting"?"interrupted":"running…"})]})},E.id)}),x&&a.jsxs("div",{ref:C,className:"ctx-menu",style:{position:"fixed",left:x.x,top:x.y,zIndex:500},children:[a.jsxs("div",{className:`ctx-menu-item ${x.isLast||h||x.isSlashCommand?"ctx-disabled":""}`,onClick:()=>{x.isLast||h||x.isSlashCommand||(window.confirm(k)&&l(e,x.turnId),S(null))},children:[a.jsx(W1,{size:12})," Rewind to Here",x.isSlashCommand?" (slash command)":""]}),m&&!v&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{c(e),S(null)},children:[a.jsx($i,{size:12})," Restore Rewind"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{d(e,x.turnId),S(null)},children:[a.jsx(zv,{size:12})," Branch from Here"]})]})]})}const CC={subagent:vr,monitor:Kv,command:Zl,task:Lv},Ag=2e4;function EC(e){const n=[];return e.forEach((r,o)=>{var l;for(const c of r.items)if(c.type==="background_task"){if((((l=c.data)==null?void 0:l.task_type)||"unknown")==="local_agent")continue;n.push({item:c,turnIndex:o,turnPrompt:r.user_prompt})}}),n}function jC({entry:e,sessionId:n}){const{item:r,turnIndex:o,turnPrompt:l}=e,c=A(te=>te.addToast),[d,f]=y.useState(!1),h=r.data||{},m=h.task_type||"unknown",v=h.subagent_type||null,k=h.description||"",x=h.summary||null,S=h.last_tool_name||null,C=h.token_count||null,T=h.output||"",E=r.status==="in_progress",b=h.status||"running",j=!E&&b==="running"?"stopped":b,P=h.task_id||null,M=CC[Nf(m)],L=qy(m,v),G=j==="running"?"running…":j==="completed"?"done":j==="failed"?"failed":j==="stopped"?"stopped":j,z=j==="failed"||r.status==="failed"&&j!=="stopped",[U,Q]=y.useState(E),[J,oe]=y.useState(!1),me=y.useRef(null);y.useEffect(()=>{E&&Q(!0)},[E]),y.useEffect(()=>{U&&E&&me.current&&(me.current.scrollTop=me.current.scrollHeight)},[U,E,T]);const Se=T.length>Ag,Me=Se&&!J?T.slice(0,Ag)+`
680
- … (truncated, click to expand)`:T,ee=E?null:j==="completed"?a.jsx(Cs,{size:12}):z?a.jsx(Ql,{size:12}):a.jsx(yr,{size:12});async function ie(te){if(te.stopPropagation(),!(!n||!P||d)){f(!0);try{await vw(n,P)}catch(F){c("error",`Could not stop the task — ${F.message}`)}finally{f(!1)}}}return a.jsxs("div",{className:`task-card ${E?"task-running":""} ${z?"task-failed":""}`,children:[a.jsxs("div",{className:"task-card-header",onClick:()=>Q(te=>!te),style:{cursor:"pointer"},children:[a.jsx("span",{className:"task-card-icon",children:a.jsx(M,{size:14})}),a.jsx("span",{className:"task-card-type",children:L}),a.jsxs("span",{className:`task-card-status ${z?"task-status-failed":E?"task-status-running":"task-status-done"}`,children:[ee," ",G]}),E&&P&&n&&a.jsxs("button",{className:"task-card-stop",onClick:ie,disabled:d,title:"Stop this task","aria-label":"Stop task",children:[a.jsx(yr,{size:10})," ",d?"Stopping…":"Stop"]}),a.jsx(Li,{size:14,className:"task-card-chevron",style:{transform:U?"rotate(90deg)":"none",marginLeft:"auto"}})]}),k&&a.jsx("div",{className:"task-card-desc",children:k}),E&&S&&a.jsxs("div",{className:"task-card-meta",children:["last tool: ",S,C!=null&&` · ${C.toLocaleString()} tokens`]}),U&&a.jsxs("div",{className:"task-card-body",children:[T?a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"cmd-output task-output",ref:me,children:a.jsx("code",{children:Me})}),Se&&a.jsx("button",{className:"cmd-output-toggle",onClick:()=>oe(te=>!te),children:J?"Show less":`Show full output (${(T.length/1024).toFixed(0)}KB)`})]}):x?a.jsx("pre",{className:"cmd-output task-output",children:a.jsx("code",{children:x})}):E?a.jsx("div",{className:"task-card-placeholder",children:"Waiting for output…"}):a.jsx("div",{className:"task-card-placeholder",children:"No output captured."}),a.jsxs("div",{className:"task-card-context",title:l,children:["from turn ",o+1,": ",l.length>60?l.slice(0,60)+"…":l]})]})]})}const _C=y.memo(jC);function RC(){const e=A(f=>f.activeSessionId),n=A(f=>f.activeSessionId?f.sessionDetails[f.activeSessionId]:null),r=A(f=>f.activeSessionId?f.backgroundTasks[f.activeSessionId]:void 0),o=(n==null?void 0:n.turns)??[],l=EC(o),c=[...l].sort((f,h)=>{const m=f.item.status==="in_progress",v=h.item.status==="in_progress";return m&&!v?-1:!m&&v?1:h.turnIndex-f.turnIndex}),d=bf(r);return l.length===0?a.jsx("div",{className:"empty-state",children:"No background tasks yet"}):a.jsxs("div",{className:"right-section",children:[a.jsxs("div",{className:"right-section-title",children:["Background Tasks (",l.length,")",d>0&&a.jsxs("span",{className:"task-count-badge",style:{color:"var(--amber)"},children:[" ",d," running"]})]}),c.map(f=>a.jsx(_C,{entry:f,sessionId:e},f.item.id))]})}const AC=y.memo(RC),IC="Your job is to answer questions about this session:",Ig="Understand the user's question below, read the session file given above, and answer.",DC=new Set(["claude","codex"]);function MC(e){return DC.has(e)}function Tf(e){return e.kind==="sidecar"}function LC(e){const n=(e??[]).filter(Tf);return n.length?n[n.length-1]:null}function OC(e){if(!e.startsWith(IC))return e;const n=e.indexOf(Ig);return n<0?e:e.slice(n+Ig.length).replace(/^\n+/,"")}function $C({thread:e,onClose:n}){const{activeSessionId:r,resolveThread:o,shareThread:l}=A(),[c,d]=y.useState(""),[f,h]=y.useState(!1),[m,v]=y.useState(!1);async function k(){if(!r||f)return;h(!0),await l(r,e.id,c)?n():h(!1)}async function x(){!r||m||(v(!0),await o(r,e.id),n())}const S=f||m;return a.jsx("div",{className:"dialog-overlay",onClick:S?void 0:n,children:a.jsxs("div",{className:"dialog",onClick:C=>C.stopPropagation(),children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"Resolve thread"}),a.jsx("button",{className:"dialog-close",onClick:n,disabled:S,children:a.jsx(Tn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[a.jsx("div",{className:"dialog-hint",children:"Share this thread's findings with the main session? The discussion will be summarized and the summary is added to your input as a quote."}),a.jsxs("label",{className:"dialog-label",children:["Summarization directives (optional)",a.jsx("textarea",{className:"dialog-input share-directives-input",placeholder:"e.g. focus on the performance findings, keep file paths",value:c,onChange:C=>d(C.target.value),rows:3,disabled:S,autoFocus:!0})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:n,disabled:S,children:"Cancel"}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:x,disabled:S,title:"Resolve without sharing",children:[m?a.jsx(hn,{size:13,className:"spin"}):a.jsx(jl,{size:13}),"Resolve only"]}),a.jsxs("button",{className:"dialog-btn-create",onClick:k,disabled:S,children:[f?a.jsx(hn,{size:13,className:"spin"}):a.jsx(K1,{size:13}),f?"Summarizing…":"Share & Resolve"]})]})]})})}const Dg=[];Ge.setOptions({breaks:!0,gfm:!0});function PC(e){const n=Ge.parse(e);return Sf.sanitize(n)}function zC(e){var n,r,o;if(e.type==="agent_message"||e.type==="final_result"){const l=(n=e.data)==null?void 0:n.text;return typeof l=="string"&&l?l:null}if(e.type==="ask_user"){const l=Array.isArray((r=e.data)==null?void 0:r.groups)?e.data.groups:[],c=[(o=e.data)==null?void 0:o.question,...l.map(d=>d.question)].filter(d=>typeof d=="string"&&!!d);return c.length?c.join(`
679
+ ${Y}`);const Be=j.map(({id:rt,previewUrl:gt,size:vt,..._t})=>_t);n(""),ue([]),ge(xo),oe(!1),te(void 0),Z(!1);for(const rt of j)rt.previewUrl&&URL.revokeObjectURL(rt.previewUrl);P([]),c(ve,Be.length>0?Be:void 0)}function Ie(Y){if(Y.insertAsText){const ve=`/${Y.id} `;n(ve),oe(!1),te(void 0),requestAnimationFrame(()=>{if(r.current){r.current.focus();const Be=ve.length;r.current.setSelectionRange(Be,Be),he()}});return}Y.subPopup?te(Y.subPopup):Y.id==="skills"?(Z(!0),I(""),oe(!1),n("")):Y.id==="model"?(h(!0),oe(!1),n("")):(oe(!1),n(""))}function mt(Y){ue(ve=>[...ve,Y]),Z(!1),n(""),ge(xo)}function Ue(Y){const ve=jg(v==null?void 0:v.runtime_config);ie==="sandbox"?ve.sandboxMode=Y:ie==="websearch"?ve.webSearchMode=Y:ie==="network"&&(ve.networkAccessEnabled=Y==="true"),f(ve),te(void 0),oe(!1),n(""),ge(xo)}function Vt(Y){if(Lt.markKeystroke(),J&&!ie){if(Y.key==="ArrowDown"){Y.preventDefault(),ee(ve=>Math.min(ve+1,B.length-1));return}if(Y.key==="ArrowUp"){Y.preventDefault(),ee(ve=>Math.max(ve-1,0));return}if(Y.key==="Enter"){Y.preventDefault(),B[Me]&&Ie(B[Me]);return}if(Y.key==="Escape"){Y.preventDefault(),oe(!1),n("");return}}if(ie&&Y.key==="Escape"){Y.preventDefault(),te(void 0);return}if(Y.key==="Enter"&&(Y.metaKey||Y.ctrlKey)&&!x){Y.preventDefault(),Ve();return}Y.key==="Escape"&&x&&(Y.preventDefault(),d())}function tn(Y){Lt.markInputChange();const ve=Y.target.value;n(ve),he(),ve.startsWith("/")&&!ve.includes(" ")&&!x?(oe(!0),Se(ve.slice(1)),ee(0)):(oe(!1),te(void 0)),ve.startsWith("$")&&!x?(Z(!0),I(ve.slice(1))):ve.startsWith("$")||Z(!1)}const St=jg(v==null?void 0:v.runtime_config),jt=[{value:"read-only",label:"Read Only",description:"Agent can only read files"},{value:"workspace-write",label:"Workspace Write",description:"Agent can read and write in workspace"},{value:"danger-full-access",label:"Danger Full Access",description:"Agent has unrestricted access"}],Ft=[{value:"disabled",label:"Disabled",description:"No web search"},{value:"cached",label:"Cached",description:"Use cached search results"},{value:"live",label:"Live",description:"Perform live web searches"}],Ot=[{value:"false",label:"Disabled",description:"No network access"},{value:"true",label:"Enabled",description:"Allow network access in sandbox"}];return a.jsxs("div",{className:`cmd-bar${M?" drag-over":""}`,onDragOver:be,onDragLeave:_e,onDrop:Ae,children:[J&&!ie&&a.jsx(yC,{commands:B,selectedIndex:Me,onSelect:Ie,onHover:ee}),J&&ie==="sandbox"&&a.jsx(fd,{title:"Sandbox Mode",options:jt,currentValue:St.sandboxMode,onSelect:Ue,onClose:()=>te(void 0)}),J&&ie==="websearch"&&a.jsx(fd,{title:"Web Search",options:Ft,currentValue:St.webSearchMode,onSelect:Ue,onClose:()=>te(void 0)}),J&&ie==="network"&&a.jsx(fd,{title:"Network Access",options:Ot,currentValue:St.networkAccessEnabled===!0?"true":"false",onSelect:Ue,onClose:()=>te(void 0)}),F&&a.jsx(wC,{filter:q,onSelect:mt,onClose:()=>{Z(!1),n("")}}),$.length>0&&a.jsx("div",{className:"skill-badges",children:$.map(Y=>a.jsxs("span",{className:"skill-badge",children:["$",Y.name,a.jsx("button",{className:"skill-badge-remove",onClick:()=>ue(ve=>ve.filter(Be=>Be.id!==Y.id)),children:"×"})]},Y.id))}),j.length>0&&a.jsx("div",{className:"attachment-preview-area",children:j.map(Y=>a.jsxs("div",{className:"attachment-chip",title:Y.name,children:[Y.previewUrl?a.jsx("img",{src:Y.previewUrl,alt:Y.name,className:"attachment-thumb",onClick:()=>z(Y),style:{cursor:"pointer"}}):a.jsx($v,{size:20,className:"attachment-file-icon"}),a.jsxs("div",{className:"attachment-info",children:[a.jsx("span",{className:"attachment-name",children:Y.name}),a.jsx("span",{className:"attachment-size",children:_g(Y.size)})]}),a.jsx("button",{className:"attachment-remove",onClick:()=>ce(Y.id),title:"Remove attachment",children:a.jsx(Tn,{size:14})})]},Y.id))}),b&&!x&&!C&&a.jsx("input",{ref:l,type:"file",multiple:!0,accept:"image/*,application/pdf,text/*,.ts,.js,.tsx,.jsx,.py,.go,.rs,.java,.c,.cpp,.h,.css,.html,.xml,.yml,.yaml,.toml,.ini,.sh,.sql",style:{display:"none"},onChange:Y=>{X(Y.target.files),Y.target.value=""}}),a.jsxs("div",{className:"cmd-input-row",children:[b&&!x&&!C&&a.jsx("button",{className:"attachment-clip-btn",onClick:()=>{var Y;return(Y=l.current)==null?void 0:Y.click()},title:"Attach files",disabled:x,children:a.jsx(U1,{size:16})}),a.jsx("textarea",{ref:r,className:"cmd-textarea",placeholder:C?"Select or create a session…":S?"Interrupted — waiting to resume…":x?"Agent is running…":"Type a message… Use / for commands",autoComplete:"off",value:e,disabled:x||C,rows:1,style:{minHeight:xo,maxHeight:pd},onChange:tn,onKeyDown:Vt,onPaste:je}),x?a.jsx("button",{className:"cmd-stop-btn",onClick:()=>d(),title:"Stop (Esc)",children:a.jsx(yr,{size:15})}):a.jsx("button",{className:"cmd-send-btn",onClick:Ve,disabled:!e.trim()||C,title:"Send (⌘↵)",children:a.jsx(Mv,{size:16})})]}),G&&a.jsx("div",{className:"image-preview-modal",onClick:()=>z(null),children:a.jsxs("div",{className:"image-preview-content",onClick:Y=>Y.stopPropagation(),children:[a.jsx("img",{src:G.previewUrl,alt:G.name}),a.jsxs("div",{className:"image-preview-info",children:[a.jsx("span",{children:G.name}),a.jsx("span",{children:_g(G.size)})]}),a.jsx("button",{className:"image-preview-close",onClick:()=>z(null),children:a.jsx(Tn,{size:20})})]})})]})}function CC(){const e=A(E=>E.activeSessionId),n=A(E=>E.activeSessionId?E.sessionDetails[E.activeSessionId]:null),r=A(E=>E.activeTurnIndex),o=A(E=>E.setActiveTurnIndex),l=A(E=>E.rewindToTurn),c=A(E=>E.restoreSession),d=A(E=>E.branchFromTurn),f=(n==null?void 0:n.turns)??[],h=Gl(n),m=!!(n!=null&&n.rewound_at_turn_id),v=(n==null?void 0:n.runtime_type)==="repoburg",k=v?"Rewind to this turn? Runtime history after this point is PERMANENTLY deleted and cannot be restored.":"Rewind to this turn? Hidden turns can be restored later.",[x,S]=y.useState(null),C=y.useRef(null);if(Wi(C,()=>S(null),!!x),Io(()=>S(null),!!x),f.length===0)return a.jsx("div",{className:"empty-state",children:"No turns yet"});function T(E){o(E),requestAnimationFrame(()=>{var b;(b=document.getElementById(`turn-${E}`))==null||b.scrollIntoView({behavior:"smooth",block:"start"})})}return a.jsxs("div",{className:"right-section",children:[a.jsx("div",{className:"right-section-title",children:"Conversation"}),f.map((E,b)=>{const j=b===r,P=E.user_prompt.length>50?E.user_prompt.slice(0,50)+"…":E.user_prompt,M=E.status==="running"||E.status==="pending";return a.jsx("div",{children:a.jsxs("div",{className:`turn-item ${j?"active":""}`,onClick:()=>T(b),onContextMenu:L=>{L.preventDefault(),S({x:L.clientX,y:L.clientY,turnId:E.id,turnIndex:b,isLast:b===f.length-1,isSlashCommand:E.user_prompt.trimStart().startsWith("/")})},children:[E.origin==="peer"?a.jsx("span",{className:"turn-item-icon",style:{background:"var(--purple)",color:"#fff"},title:Hl(E.origin_name),children:a.jsx(Wv,{size:12})}):a.jsx("span",{className:"turn-item-icon",style:{background:"var(--amber)",color:"#fff"},children:a.jsx(Y1,{size:12})}),a.jsx("span",{className:"turn-item-label",children:P}),M&&a.jsx("span",{className:"turn-item-status",children:E.status==="pending"&&E.resume_state==="waiting"?"interrupted":"running…"})]})},E.id)}),x&&a.jsxs("div",{ref:C,className:"ctx-menu",style:{position:"fixed",left:x.x,top:x.y,zIndex:500},children:[a.jsxs("div",{className:`ctx-menu-item ${x.isLast||h||x.isSlashCommand?"ctx-disabled":""}`,onClick:()=>{x.isLast||h||x.isSlashCommand||(window.confirm(k)&&l(e,x.turnId),S(null))},children:[a.jsx(H1,{size:12})," Rewind to Here",x.isSlashCommand?" (slash command)":""]}),m&&!v&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{c(e),S(null)},children:[a.jsx($i,{size:12})," Restore Rewind"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{d(e,x.turnId),S(null)},children:[a.jsx(zv,{size:12})," Branch from Here"]})]})]})}const EC={subagent:vr,monitor:Kv,command:Jl,task:Lv},Ag=2e4;function jC(e){const n=[];return e.forEach((r,o)=>{var l;for(const c of r.items)if(c.type==="background_task"){if((((l=c.data)==null?void 0:l.task_type)||"unknown")==="local_agent")continue;n.push({item:c,turnIndex:o,turnPrompt:r.user_prompt})}}),n}function _C({entry:e,sessionId:n}){const{item:r,turnIndex:o,turnPrompt:l}=e,c=A(te=>te.addToast),[d,f]=y.useState(!1),h=r.data||{},m=h.task_type||"unknown",v=h.subagent_type||null,k=h.description||"",x=h.summary||null,S=h.last_tool_name||null,C=h.token_count||null,T=h.output||"",E=r.status==="in_progress",b=h.status||"running",j=!E&&b==="running"?"stopped":b,P=h.task_id||null,M=EC[Nf(m)],L=qy(m,v),G=j==="running"?"running…":j==="completed"?"done":j==="failed"?"failed":j==="stopped"?"stopped":j,z=j==="failed"||r.status==="failed"&&j!=="stopped",[U,Q]=y.useState(E),[J,oe]=y.useState(!1),me=y.useRef(null);y.useEffect(()=>{E&&Q(!0)},[E]),y.useEffect(()=>{U&&E&&me.current&&(me.current.scrollTop=me.current.scrollHeight)},[U,E,T]);const Se=T.length>Ag,Me=Se&&!J?T.slice(0,Ag)+`
680
+ … (truncated, click to expand)`:T,ee=E?null:j==="completed"?a.jsx(Cs,{size:12}):z?a.jsx(Zl,{size:12}):a.jsx(yr,{size:12});async function ie(te){if(te.stopPropagation(),!(!n||!P||d)){f(!0);try{await yw(n,P)}catch(F){c("error",`Could not stop the task — ${F.message}`)}finally{f(!1)}}}return a.jsxs("div",{className:`task-card ${E?"task-running":""} ${z?"task-failed":""}`,children:[a.jsxs("div",{className:"task-card-header",onClick:()=>Q(te=>!te),style:{cursor:"pointer"},children:[a.jsx("span",{className:"task-card-icon",children:a.jsx(M,{size:14})}),a.jsx("span",{className:"task-card-type",children:L}),a.jsxs("span",{className:`task-card-status ${z?"task-status-failed":E?"task-status-running":"task-status-done"}`,children:[ee," ",G]}),E&&P&&n&&a.jsxs("button",{className:"task-card-stop",onClick:ie,disabled:d,title:"Stop this task","aria-label":"Stop task",children:[a.jsx(yr,{size:10})," ",d?"Stopping…":"Stop"]}),a.jsx(Li,{size:14,className:"task-card-chevron",style:{transform:U?"rotate(90deg)":"none",marginLeft:"auto"}})]}),k&&a.jsx("div",{className:"task-card-desc",children:k}),E&&S&&a.jsxs("div",{className:"task-card-meta",children:["last tool: ",S,C!=null&&` · ${C.toLocaleString()} tokens`]}),U&&a.jsxs("div",{className:"task-card-body",children:[T?a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"cmd-output task-output",ref:me,children:a.jsx("code",{children:Me})}),Se&&a.jsx("button",{className:"cmd-output-toggle",onClick:()=>oe(te=>!te),children:J?"Show less":`Show full output (${(T.length/1024).toFixed(0)}KB)`})]}):x?a.jsx("pre",{className:"cmd-output task-output",children:a.jsx("code",{children:x})}):E?a.jsx("div",{className:"task-card-placeholder",children:"Waiting for output…"}):a.jsx("div",{className:"task-card-placeholder",children:"No output captured."}),a.jsxs("div",{className:"task-card-context",title:l,children:["from turn ",o+1,": ",l.length>60?l.slice(0,60)+"…":l]})]})]})}const RC=y.memo(_C);function AC(){const e=A(f=>f.activeSessionId),n=A(f=>f.activeSessionId?f.sessionDetails[f.activeSessionId]:null),r=A(f=>f.activeSessionId?f.backgroundTasks[f.activeSessionId]:void 0),o=(n==null?void 0:n.turns)??[],l=jC(o),c=[...l].sort((f,h)=>{const m=f.item.status==="in_progress",v=h.item.status==="in_progress";return m&&!v?-1:!m&&v?1:h.turnIndex-f.turnIndex}),d=bf(r);return l.length===0?a.jsx("div",{className:"empty-state",children:"No background tasks yet"}):a.jsxs("div",{className:"right-section",children:[a.jsxs("div",{className:"right-section-title",children:["Background Tasks (",l.length,")",d>0&&a.jsxs("span",{className:"task-count-badge",style:{color:"var(--amber)"},children:[" ",d," running"]})]}),c.map(f=>a.jsx(RC,{entry:f,sessionId:e},f.item.id))]})}const IC=y.memo(AC),DC="Your job is to answer questions about this session:",Ig="Understand the user's question below, read the session file given above, and answer.",MC=new Set(["claude","codex"]);function LC(e){return MC.has(e)}function Tf(e){return e.kind==="sidecar"}function OC(e){const n=(e??[]).filter(Tf);return n.length?n[n.length-1]:null}function $C(e){if(!e.startsWith(DC))return e;const n=e.indexOf(Ig);return n<0?e:e.slice(n+Ig.length).replace(/^\n+/,"")}function PC({thread:e,onClose:n}){const{activeSessionId:r,resolveThread:o,shareThread:l}=A(),[c,d]=y.useState(""),[f,h]=y.useState(!1),[m,v]=y.useState(!1);async function k(){if(!r||f)return;h(!0),await l(r,e.id,c)?n():h(!1)}async function x(){!r||m||(v(!0),await o(r,e.id),n())}const S=f||m;return a.jsx("div",{className:"dialog-overlay",onClick:S?void 0:n,children:a.jsxs("div",{className:"dialog",onClick:C=>C.stopPropagation(),children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"Resolve thread"}),a.jsx("button",{className:"dialog-close",onClick:n,disabled:S,children:a.jsx(Tn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[a.jsx("div",{className:"dialog-hint",children:"Share this thread's findings with the main session? The discussion will be summarized and the summary is added to your input as a quote."}),a.jsxs("label",{className:"dialog-label",children:["Summarization directives (optional)",a.jsx("textarea",{className:"dialog-input share-directives-input",placeholder:"e.g. focus on the performance findings, keep file paths",value:c,onChange:C=>d(C.target.value),rows:3,disabled:S,autoFocus:!0})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:n,disabled:S,children:"Cancel"}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:x,disabled:S,title:"Resolve without sharing",children:[m?a.jsx(hn,{size:13,className:"spin"}):a.jsx(_l,{size:13}),"Resolve only"]}),a.jsxs("button",{className:"dialog-btn-create",onClick:k,disabled:S,children:[f?a.jsx(hn,{size:13,className:"spin"}):a.jsx(G1,{size:13}),f?"Summarizing…":"Share & Resolve"]})]})]})})}const Dg=[];Ge.setOptions({breaks:!0,gfm:!0});function zC(e){const n=Ge.parse(e);return Sf.sanitize(n)}function FC(e){var n,r,o;if(e.type==="agent_message"||e.type==="final_result"){const l=(n=e.data)==null?void 0:n.text;return typeof l=="string"&&l?l:null}if(e.type==="ask_user"){const l=Array.isArray((r=e.data)==null?void 0:r.groups)?e.data.groups:[],c=[(o=e.data)==null?void 0:o.question,...l.map(d=>d.question)].filter(d=>typeof d=="string"&&!!d);return c.length?c.join(`
681
681
 
682
- `):null}return null}function FC(e){const n=e.match(/^\[Quoting from your previous response\]:\n> .*\n\n([\s\S]*)$/);return n?n[1]:e}function Qy({turn:e,formatPrompt:n=FC}){var d,f;const r=e.origin==="peer",o=r?e.user_prompt:n(e.user_prompt),l=[];for(const h of e.items){if(h.type==="peer_message"){const v=(d=h.data)==null?void 0:d.body;typeof v=="string"&&v&&l.push({peer:!0,text:v,name:(f=h.data)==null?void 0:f.name});continue}const m=zC(h);m!==null&&l.push({peer:!1,text:m})}const c=l.some(h=>!h.peer);return!c&&e.status==="completed"&&e.agent_response&&l.push({peer:!1,text:e.agent_response}),a.jsxs("div",{className:"thread-card-turn",children:[r?a.jsxs("div",{className:"thread-card-user-message thread-card-peer-message",children:[a.jsx("div",{className:"thread-card-peer-label",children:Wl(e.origin_name)}),o]}):a.jsx("div",{className:"thread-card-user-message",children:o}),l.map((h,m)=>h.peer?a.jsxs("div",{className:"thread-card-user-message thread-card-peer-message",children:[a.jsx("div",{className:"thread-card-peer-label",children:Wl(h.name)}),h.text]},m):a.jsx("div",{className:"thread-card-ai-response",dangerouslySetInnerHTML:{__html:PC(h.text)}},m)),!c&&(e.status==="pending"||e.status==="running")&&a.jsx("div",{className:"thread-card-pending",children:e.status==="running"?"AI is responding…":"Waiting…"}),e.status==="failed"&&a.jsx("div",{className:"thread-card-pending",children:e.error||"Turn failed"})]})}function UC({thread:e,threadTurns:n,onStop:r,onResolve:o,onReopen:l,onDelete:c,onFollowup:d,onLocate:f}){var Se,Me,ee;const[h,m]=y.useState(""),[v,k]=y.useState(!0),x=y.useRef(null),S=y.useRef(null),[C,T]=y.useState(!1),[E,b]=y.useState({x:0,y:0}),[j,P]=y.useState(""),M=n.some(Fs),L=28,G=120,z=y.useRef(L);y.useEffect(()=>{const ie=S.current;ie&&(ie.scrollTop=ie.scrollHeight)},[n.length,v]);function U(ie){const te=x.current;te&&(te.style.height=`${ie}px`,z.current=ie)}function Q(){const ie=x.current;if(ie){if(ie.scrollHeight>ie.clientHeight){const te=Math.min(ie.scrollHeight,G);te!==z.current&&U(te);return}z.current>L&&(ie.style.height="auto",U(Math.min(ie.scrollHeight,G)))}}const J=y.useCallback(()=>{T(!1)},[]),oe=y.useCallback(()=>{const ie=S.current;if(!ie)return;const te=window.getSelection();if(!te||te.rangeCount===0||te.isCollapsed){T(!1);return}const F=te.getRangeAt(0);if(!ie.contains(F.commonAncestorContainer)){T(!1);return}const Z=F.commonAncestorContainer.nodeType===Node.TEXT_NODE?F.commonAncestorContainer.parentElement:F.commonAncestorContainer;if(!(Z!=null&&Z.closest(".thread-card-ai-response"))){T(!1);return}const q=te.toString();if(!q.trim()){T(!1);return}const I=F.getBoundingClientRect(),$=28,ue=6,B=170;let X=!1;if(te.anchorNode&&te.focusNode)try{const _e=document.createRange();_e.setStart(te.focusNode,te.focusOffset),_e.setEnd(te.focusNode,te.focusOffset);const Ae=document.createRange();Ae.setStart(te.anchorNode,te.anchorOffset),Ae.setEnd(te.anchorNode,te.anchorOffset),X=Ae.compareBoundaryPoints(Range.START_TO_START,_e)>0}catch{X=!1}let ce=I.top-$-ue;ce<8&&(ce=I.bottom+ue);let be=X?I.left-B:I.right;be=Math.max(8,Math.min(be,window.innerWidth-B-8)),b({x:be,y:ce}),P(q),T(!0)},[]);y.useEffect(()=>{function ie(te){const F=te.target;F&&F.closest(".selection-actions")||oe()}return document.addEventListener("mouseup",ie),()=>document.removeEventListener("mouseup",ie)},[oe]);const me=y.useCallback(()=>{var te;const ie=`
682
+ `):null}return null}function UC(e){const n=e.match(/^\[Quoting from your previous response\]:\n> .*\n\n([\s\S]*)$/);return n?n[1]:e}function Qy({turn:e,formatPrompt:n=UC}){var d,f;const r=e.origin==="peer",o=r?e.user_prompt:n(e.user_prompt),l=[];for(const h of e.items){if(h.type==="peer_message"){const v=(d=h.data)==null?void 0:d.body;typeof v=="string"&&v&&l.push({peer:!0,text:v,name:(f=h.data)==null?void 0:f.name});continue}const m=FC(h);m!==null&&l.push({peer:!1,text:m})}const c=l.some(h=>!h.peer);return!c&&e.status==="completed"&&e.agent_response&&l.push({peer:!1,text:e.agent_response}),a.jsxs("div",{className:"thread-card-turn",children:[r?a.jsxs("div",{className:"thread-card-user-message thread-card-peer-message",children:[a.jsx("div",{className:"thread-card-peer-label",children:Hl(e.origin_name)}),o]}):a.jsx("div",{className:"thread-card-user-message",children:o}),l.map((h,m)=>h.peer?a.jsxs("div",{className:"thread-card-user-message thread-card-peer-message",children:[a.jsx("div",{className:"thread-card-peer-label",children:Hl(h.name)}),h.text]},m):a.jsx("div",{className:"thread-card-ai-response",dangerouslySetInnerHTML:{__html:zC(h.text)}},m)),!c&&(e.status==="pending"||e.status==="running")&&a.jsx("div",{className:"thread-card-pending",children:e.status==="running"?"AI is responding…":"Waiting…"}),e.status==="failed"&&a.jsx("div",{className:"thread-card-pending",children:e.error||"Turn failed"})]})}function BC({thread:e,threadTurns:n,onStop:r,onResolve:o,onReopen:l,onDelete:c,onFollowup:d,onLocate:f}){var Se,Me,ee;const[h,m]=y.useState(""),[v,k]=y.useState(!0),x=y.useRef(null),S=y.useRef(null),[C,T]=y.useState(!1),[E,b]=y.useState({x:0,y:0}),[j,P]=y.useState(""),M=n.some(Fs),L=28,G=120,z=y.useRef(L);y.useEffect(()=>{const ie=S.current;ie&&(ie.scrollTop=ie.scrollHeight)},[n.length,v]);function U(ie){const te=x.current;te&&(te.style.height=`${ie}px`,z.current=ie)}function Q(){const ie=x.current;if(ie){if(ie.scrollHeight>ie.clientHeight){const te=Math.min(ie.scrollHeight,G);te!==z.current&&U(te);return}z.current>L&&(ie.style.height="auto",U(Math.min(ie.scrollHeight,G)))}}const J=y.useCallback(()=>{T(!1)},[]),oe=y.useCallback(()=>{const ie=S.current;if(!ie)return;const te=window.getSelection();if(!te||te.rangeCount===0||te.isCollapsed){T(!1);return}const F=te.getRangeAt(0);if(!ie.contains(F.commonAncestorContainer)){T(!1);return}const Z=F.commonAncestorContainer.nodeType===Node.TEXT_NODE?F.commonAncestorContainer.parentElement:F.commonAncestorContainer;if(!(Z!=null&&Z.closest(".thread-card-ai-response"))){T(!1);return}const q=te.toString();if(!q.trim()){T(!1);return}const I=F.getBoundingClientRect(),$=28,ue=6,B=170;let X=!1;if(te.anchorNode&&te.focusNode)try{const _e=document.createRange();_e.setStart(te.focusNode,te.focusOffset),_e.setEnd(te.focusNode,te.focusOffset);const Ae=document.createRange();Ae.setStart(te.anchorNode,te.anchorOffset),Ae.setEnd(te.anchorNode,te.anchorOffset),X=Ae.compareBoundaryPoints(Range.START_TO_START,_e)>0}catch{X=!1}let ce=I.top-$-ue;ce<8&&(ce=I.bottom+ue);let be=X?I.left-B:I.right;be=Math.max(8,Math.min(be,window.innerWidth-B-8)),b({x:be,y:ce}),P(q),T(!0)},[]);y.useEffect(()=>{function ie(te){const F=te.target;F&&F.closest(".selection-actions")||oe()}return document.addEventListener("mouseup",ie),()=>document.removeEventListener("mouseup",ie)},[oe]);const me=y.useCallback(()=>{var te;const ie=`
683
683
  \`\`\`QUOTE
684
684
  ${j}
685
685
  \`\`\`
686
686
 
687
- `;m(F=>F+ie),T(!1),P(""),(te=window.getSelection())==null||te.removeAllRanges(),setTimeout(()=>{if(x.current){Q(),x.current.focus();const F=x.current.value.length;x.current.setSelectionRange(F,F)}},0)},[j]);return a.jsxs("div",{className:`thread-card ${e.status==="resolved"?"thread-resolved":""}`,id:`thread-${e.id}`,children:[a.jsxs("div",{className:"thread-card-header",onClick:()=>k(ie=>!ie),children:[a.jsx("div",{className:"thread-card-quote",children:e.selected_text===null?((ee=(Me=(Se=e.turns)==null?void 0:Se[0])==null?void 0:Me.user_prompt)==null?void 0:ee.slice(0,100))||"Quick question":`“${e.selected_text.slice(0,100)}${e.selected_text.length>100?"…":""}”`}),a.jsxs("div",{className:"thread-card-header-right",children:[e.selected_text!==null&&a.jsx("button",{className:"thread-locate-btn",onClick:ie=>{ie.stopPropagation(),f()},title:"Scroll to text",children:a.jsx(O1,{size:12})}),a.jsx("span",{className:`thread-status-badge ${e.status==="open"?"thread-status-open":"thread-status-resolved"}`,children:e.status==="open"?"Open":"Resolved"})]})]}),v&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"thread-card-conversation",ref:S,onMouseDown:J,children:[n.map(ie=>a.jsx(Qy,{turn:ie},ie.id)),n.length===0&&a.jsx("div",{className:"thread-card-placeholder",children:"No messages yet."})]}),C&&a.jsx("div",{className:"selection-actions",style:{left:E.x,top:E.y},children:a.jsxs("button",{className:"discuss-button",onClick:me,title:"Quote this text in your follow-up",children:[a.jsx(Hv,{size:14}),a.jsx("span",{children:"Quote"})]})}),e.status==="open"&&a.jsxs("div",{className:"thread-card-followup",children:[a.jsx("textarea",{ref:x,className:"thread-card-followup-input",placeholder:M?"Agent is running…":"Type a follow-up…",value:h,onChange:ie=>{Lt.markInputChange(),m(ie.target.value),Q()},disabled:M,rows:1,style:{minHeight:L,maxHeight:G},onKeyDown:ie=>{Lt.markKeystroke(),ie.key==="Enter"&&(ie.metaKey||ie.ctrlKey)&&!M&&h.trim()&&(ie.preventDefault(),d(h.trim()),m(""),U(L))}}),a.jsx("button",{className:"thread-card-followup-send",disabled:M||!h.trim(),onClick:()=>{d(h.trim()),m("")},children:a.jsx(Hi,{size:13})}),M&&a.jsx("button",{className:"thread-card-followup-stop",onClick:r,title:"Stop this thread's turn (Esc)",children:a.jsx(yr,{size:13})})]}),a.jsxs("div",{className:"thread-card-actions",children:[e.status==="open"?a.jsxs("button",{className:"thread-action-btn",onClick:o,title:"Resolve thread",children:[a.jsx(jl,{size:13})," Resolve"]}):a.jsxs("button",{className:"thread-action-btn",onClick:l,title:"Reopen thread",children:[a.jsx($i,{size:13})," Reopen"]}),a.jsxs("button",{className:"thread-action-btn thread-action-danger",onClick:c,title:"Delete thread",children:[a.jsx(us,{size:13})," Delete"]})]})]})]})}function BC(){Lt.trackRender("ThreadsPanel");const e=A(b=>b.activeSessionId),n=A(b=>{var j;return b.activeSessionId?((j=b.sessionDetails[b.activeSessionId])==null?void 0:j.threads)??Dg:Dg}),r=y.useMemo(()=>n.filter(b=>!Tf(b)),[n]),o=A(b=>b.followupThread),l=A(b=>b.cancelThreadTurn),c=A(b=>b.reopenThread),d=A(b=>b.deleteThread),f=A(b=>b.deepLinkThreadId),h=A(b=>b.setDeepLinkThreadId),[m,v]=y.useState("open"),[k,x]=y.useState(null);y.useEffect(()=>{if(!f)return;const b=f;h(null),v(P=>r.some(M=>M.id===b&&M.status==="open")?P:"all");const j=setTimeout(()=>{const P=document.getElementById(`thread-${b}`);P&&(P.scrollIntoView({behavior:"smooth",block:"center"}),P.classList.add("thread-card-highlighted"),setTimeout(()=>P.classList.remove("thread-card-highlighted"),1500))},100);return()=>clearTimeout(j)},[f,h,r]);const S=r.filter(b=>m==="open"?b.status==="open":m==="resolved"?b.status==="resolved":!0),C=r.filter(b=>b.status==="open").length,T=r.filter(b=>b.status==="resolved").length;function E(b){setTimeout(()=>{const j=document.querySelector(`mark[data-thread-id="${b}"]`);j&&(j.scrollIntoView({behavior:"smooth",block:"center"}),j.classList.add("thread-mark-flash"),setTimeout(()=>j.classList.remove("thread-mark-flash"),1500))},50)}return e?r.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx(Bv,{size:24,style:{opacity:.3,marginBottom:8}}),a.jsx("div",{children:"No threads yet."}),a.jsx("div",{style:{fontSize:"11px",marginTop:"4px"},children:"Select text in an agent response to start a discussion."})]}):a.jsxs("div",{children:[a.jsxs("div",{className:"thread-filter-tabs",children:[a.jsxs("button",{className:`thread-filter-tab ${m==="open"?"active":""}`,onClick:()=>v("open"),children:["Open (",C,")"]}),a.jsxs("button",{className:`thread-filter-tab ${m==="resolved"?"active":""}`,onClick:()=>v("resolved"),children:["Resolved (",T,")"]}),a.jsxs("button",{className:`thread-filter-tab ${m==="all"?"active":""}`,onClick:()=>v("all"),children:["All (",r.length,")"]})]}),S.length===0?a.jsxs("div",{className:"empty-state",style:{padding:"20px 0"},children:["No ",m," threads."]}):S.map(b=>a.jsx(UC,{thread:b,threadTurns:b.turns??[],onStop:()=>l(e,b.id),onResolve:()=>x(b),onReopen:()=>c(e,b.id),onDelete:()=>d(e,b.id),onFollowup:j=>o(e,b.id,j),onLocate:()=>E(b.id)},b.id)),k&&a.jsx($C,{thread:k,onClose:()=>x(null)})]}):a.jsx("div",{className:"empty-state",children:"No session selected"})}function WC(){const e=A(d=>d.apps),n=A(d=>d.activeAppTabId),r=A(d=>d.openAppTab),o=A(d=>d.startAppEdit),l=A(d=>d.toggleAppPin),c=A(d=>d.deleteApp);return e.length===0?a.jsx("div",{className:"empty-state",style:{padding:"16px"},children:"No mini apps yet. Add one with the + button in the sidebar Apps section."}):a.jsx("div",{className:"apps-panel",children:e.map(d=>a.jsxs("div",{className:`apps-panel-row${n===d.id?" active":""}`,onClick:()=>r(d.id),title:d.description??void 0,children:[a.jsx(Do,{iconNode:d.iconNode,size:14,className:"sidebar-app-icon"}),a.jsxs("div",{className:"apps-panel-info",children:[a.jsx("span",{className:"apps-panel-title",children:d.title}),d.description&&a.jsx("span",{className:"apps-panel-desc",children:d.description})]}),a.jsx("button",{className:"apps-panel-action",title:"Edit app with the agent",onClick:f=>{f.stopPropagation(),o(d.id)},children:a.jsx(hl,{size:12})}),a.jsx("button",{className:`apps-panel-action${d.pinned?" pinned":""}`,title:d.pinned?"Unpin app":"Pin app (sorts first)",onClick:f=>{f.stopPropagation(),l(d.id)},children:a.jsx(Rl,{size:12,fill:d.pinned?"currentColor":"none"})}),a.jsx("button",{className:"apps-panel-action apps-panel-danger",title:"Delete app",onClick:f=>{f.stopPropagation(),c(d.id)},children:a.jsx(us,{size:12})})]},d.id))})}const HC=24;function VC(){Lt.trackRender("SidecarPanel");const e=A(b=>b.activeSessionId),n=A(b=>{var j;return b.activeSessionId?(j=b.sessionDetails[b.activeSessionId])==null?void 0:j.runtime_type:void 0}),r=A(b=>{var j;return b.activeSessionId?LC((j=b.sessionDetails[b.activeSessionId])==null?void 0:j.threads):null}),o=A(b=>b.askSidecar),l=A(b=>b.cancelThreadTurn),c=A(b=>b.deleteThread),[d,f]=y.useState(""),[h,m]=y.useState(!1),v=y.useRef(null),k=y.useRef(!0),x=(r==null?void 0:r.turns)??[],S=x[x.length-1],C=x.some(Fs);if(y.useEffect(()=>{k.current=!0},[e,x.length]),y.useEffect(()=>{const b=v.current;b&&k.current&&(b.scrollTop=b.scrollHeight)},[e,x.length,S==null?void 0:S.items.length,S==null?void 0:S.status]),!e||!n)return a.jsx("div",{className:"empty-state",children:"No session selected"});if(!MC(n))return a.jsxs("div",{className:"empty-state",children:[a.jsx(vr,{size:24,style:{opacity:.3,marginBottom:8}}),a.jsxs("div",{children:["The sidecar is not available for ",n," sessions yet."]})]});const T=!C&&!h&&d.trim().length>0;async function E(){if(!e||!T)return;m(!0);const b=await o(e,d.trim());m(!1),b&&f("")}return a.jsxs("div",{className:"sidecar-panel",children:[a.jsx("div",{ref:v,className:"sidecar-conversation",onScroll:b=>{const j=b.currentTarget;k.current=j.scrollHeight-j.scrollTop-j.clientHeight<=HC},children:x.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx(vr,{size:24,style:{opacity:.3,marginBottom:8}}),a.jsx("div",{children:"Ask about this session."}),a.jsx("div",{className:"sidecar-hint",children:"Where does it stand? Is it stuck? When will it finish? What is done and what is left?"})]}):x.map(b=>a.jsx(Qy,{turn:b,formatPrompt:OC},b.id))}),a.jsxs("div",{className:"sidecar-footer",children:[a.jsxs("div",{className:"thread-card-followup",children:[a.jsx("textarea",{className:"thread-card-followup-input","aria-label":"Ask the sidecar",placeholder:C?"Sidecar is answering…":"Ask about this session… (⌘/Ctrl+Enter)",value:d,rows:2,disabled:C,onChange:b=>{Lt.markInputChange(),f(b.target.value)},onKeyDown:b=>{Lt.markKeystroke(),b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),E())}}),C&&r?a.jsx("button",{className:"thread-card-followup-stop",title:"Stop the answer","aria-label":"Stop the answer",onClick:()=>l(e,r.id),children:a.jsx(yr,{size:13})}):a.jsx("button",{className:"thread-card-followup-send",title:"Ask","aria-label":"Ask",disabled:!T,onClick:()=>void E(),children:a.jsx(Hi,{size:13})})]}),r&&a.jsx("div",{className:"thread-card-actions",children:a.jsxs("button",{className:"thread-action-btn thread-action-danger",title:"Clear the sidecar conversation",disabled:C,onClick:()=>c(e,r.id),children:[a.jsx(us,{size:13})," Clear"]})})]})]})}function KC(){var h;Lt.trackRender("RightPanel");const e=A(m=>m.activeRightTab),n=A(m=>m.switchRightTab),r=A(m=>m.rightPanelCollapsed),o=A(m=>m.toggleRightPanel),l=A(m=>m.activeSessionId?m.sessionDetails[m.activeSessionId]:null),c=A(m=>m.activeSessionId?bf(m.backgroundTasks[m.activeSessionId]):0),d=((h=l==null?void 0:l.threads)==null?void 0:h.filter(m=>m.status==="open"&&!Tf(m)).length)??0,f=[{id:"turns",label:"Turns",icon:R1},{id:"sidecar",label:"Sidecar",icon:vr},{id:"tasks",label:"Tasks",icon:_1,badge:c||void 0},{id:"threads",label:"Threads",icon:Bv,badge:d||void 0},{id:"apps",label:"Apps",icon:Uv}];return r?a.jsxs("div",{className:"ide-right collapsed",children:[a.jsx("button",{type:"button",className:"right-icon-btn",title:"Expand panel","aria-label":"Expand panel","aria-expanded":!1,onClick:o,children:a.jsx(P1,{size:15})}),a.jsx("div",{className:"right-rail-divider"}),f.map(m=>{const v=m.icon,k=m.badge?`${m.label} (${m.badge})`:m.label;return a.jsxs("button",{type:"button",className:`right-icon-btn right-rail-tab ${e===m.id?"active":""}`,title:k,"aria-label":k,onClick:()=>n(m.id),children:[a.jsx(v,{size:15}),m.badge?a.jsx("span",{className:"right-tab-badge",children:m.badge}):null]},m.id)})]}):a.jsxs("div",{className:"ide-right",children:[a.jsxs("div",{className:"right-header",children:[a.jsx("div",{className:"right-tabs",children:f.map(m=>a.jsxs("div",{className:`right-tab ${e===m.id?"active":""}`,onClick:()=>n(m.id),children:[m.label,m.badge?a.jsx("span",{className:"right-tab-badge",children:m.badge}):null]},m.id))}),a.jsx("button",{type:"button",className:"right-icon-btn right-collapse-btn",title:"Collapse panel","aria-label":"Collapse panel","aria-expanded":!0,onClick:o,children:a.jsx($1,{size:14})})]}),a.jsxs("div",{className:"right-content",children:[e==="turns"&&a.jsx(TC,{}),e==="sidecar"&&a.jsx(VC,{}),e==="tasks"&&a.jsx(AC,{}),e==="threads"&&a.jsx(BC,{}),e==="apps"&&a.jsx(WC,{})]})]})}const De={low:{effort:"low",label:"Low"},medium:{effort:"medium",label:"Medium"},high:{effort:"high",label:"High"},xhigh:{effort:"xhigh",label:"Extra High"},max:{effort:"max",label:"Max"},ultra:{effort:"ultra",label:"Ultra"}},Od=[{id:"codex",label:"Codex",available:!0,models:[{slug:"gpt-5.6-sol",displayName:"GPT-5.6-Sol",description:"Flagship — complex, open-ended work",defaultReasoning:"low",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max,De.ultra]},{slug:"gpt-5.6-terra",displayName:"GPT-5.6-Terra",description:"Balanced all-rounder for everyday work",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max,De.ultra]},{slug:"gpt-5.6-luna",displayName:"GPT-5.6-Luna",description:"Fast, affordable — clear, repeatable tasks",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max]},{slug:"gpt-5.5",displayName:"GPT-5.5",description:"Previous-gen frontier model",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh]}]},{id:"claude",label:"Claude",available:!0,models:[{slug:"claude-sonnet-5-5",displayName:"Claude Sonnet 5.5",description:"Best combination of speed and intelligence",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max]},{slug:"claude-sonnet-5",displayName:"Claude Sonnet 5",description:"Previous-gen balanced all-rounder",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max]},{slug:"claude-opus-5",displayName:"Claude Opus 5",description:"Deep reasoning for complex tasks",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max]},{slug:"claude-fable-5",displayName:"Claude Fable 5",description:"Fast and efficient for simple tasks",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max]}]},{id:"repoburg",label:"Repoburg",available:!0,models:[{slug:"ollama/glm-5.3:cloud",displayName:"GLM-5.3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high]},{slug:"ollama/glm-5.3-flash:cloud",displayName:"GLM-5.3 Flash",description:"Ollama Cloud — fast",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high]},{slug:"ollama/minimax-m3:cloud",displayName:"MiniMax M3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high]},{slug:"ollama/deepseek-v4-pro:cloud",displayName:"DeepSeek V4 Pro",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high]}]}];function GC(e){return Od.find(n=>n.id===e)}function Cf(e){const n=GC(e);return(n==null?void 0:n.models)??[]}function Zy(e,n){return Cf(e).find(r=>r.slug===n)}function $d(e,n){var r;return((r=Zy(e,n))==null?void 0:r.reasoningLevels)??[]}function Pd(e,n){var r;return(r=Zy(e,n))==null?void 0:r.defaultReasoning}function qC(){const{activeSessionId:e,sessions:n,updateModelConfig:r}=A(),o=A(ee=>ee.showModelSelector),l=A(ee=>ee.setShowModelSelector),c=n.find(ee=>ee.id===e),d=A(ee=>ee.models),f=A(ee=>ee.modelsLoading),h=A(ee=>ee.loadModels),[m,v]=y.useState(!1),k=y.useRef(null);if(Wi(k,()=>v(!1),m),Io(()=>v(!1),m),y.useEffect(()=>{o&&(v(!0),l(!1))},[o,l]),y.useEffect(()=>{c!=null&&c.runtime_type&&h(c.runtime_type,c.cwd??void 0)},[c==null?void 0:c.runtime_type,c==null?void 0:c.cwd,h]),!c)return null;const x=c.runtime_type,S=c.model??"",C=c.model_reasoning_effort??"",T=d.length>0?d:[],E=Cf(x),j=[...T.length>0?T:E];if(S&&!j.some(ee=>ee.slug===S)){const ee=E[0];j.unshift({slug:S,displayName:S,description:"Custom model",defaultReasoning:(ee==null?void 0:ee.defaultReasoning)??"medium",reasoningLevels:(ee==null?void 0:ee.reasoningLevels)??[]})}function P(ee){return j.find(ie=>ie.slug===ee)}function M(ee){var ie;return T.length>0?((ie=P(ee))==null?void 0:ie.reasoningLevels)??[]:$d(x,ee)}function L(ee){var ie;return T.length>0?(ie=P(ee))==null?void 0:ie.defaultReasoning:Pd(x,ee)}const G=Od.find(ee=>ee.id===x),z=P(S),U=S?M(S):[],Q=(G==null?void 0:G.label)??x,J=(z==null?void 0:z.displayName)??(S||"Default"),oe=U.find(ee=>ee.effort===C),me=(oe==null?void 0:oe.label)??(C||"Default");function Se(ee){var Z;const ie=M(ee),F=ie.some(q=>q.effort===C)?C:L(ee)??((Z=ie[0])==null?void 0:Z.effort)??"";r(ee,F),v(!1)}function Me(ee){r(S,ee),v(!1)}return a.jsxs("div",{className:"model-selector",ref:k,children:[a.jsxs("button",{className:"model-selector-btn",onClick:()=>v(!m),title:"Change model and thinking level",children:[a.jsx("span",{className:"model-selector-provider",children:Q}),a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-model",children:J}),me!=="Default"&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-reasoning",children:me})]}),a.jsx(_o,{size:12,className:"model-selector-chevron"})]}),m&&a.jsxs("div",{className:"model-selector-popover",children:[a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Provider"}),Od.map(ee=>a.jsxs("div",{className:`model-selector-item ${ee.id===x?"selected":""} ${ee.available?"":"disabled"}`,onClick:()=>{if(ee.available){if(ee.id===x){v(!1);return}r("","",ee.id)}},children:[a.jsx("span",{children:ee.label}),!ee.available&&a.jsxs("span",{className:"model-selector-coming-soon",children:[a.jsx(D1,{size:10})," Soon"]}),ee.id===x&&a.jsx(Cs,{size:12})]},ee.id))]}),a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Model"}),f&&a.jsx("div",{className:"model-selector-empty",children:"Loading models…"}),!f&&j.length===0&&a.jsx("div",{className:"model-selector-empty",children:"No models available"}),j.map(ee=>a.jsxs("div",{className:`model-selector-item ${ee.slug===S?"selected":""}`,onClick:()=>Se(ee.slug),children:[a.jsxs("div",{className:"model-selector-item-main",children:[a.jsx("span",{className:"model-selector-item-name",children:ee.displayName}),a.jsx("span",{className:"model-selector-item-desc",children:ee.description})]}),ee.slug===S&&a.jsx(Cs,{size:12})]},ee.slug))]}),a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Thinking"}),U.length===0&&a.jsx("div",{className:"model-selector-empty",children:"Select a model first"}),U.map(ee=>a.jsxs("div",{className:`model-selector-item ${ee.effort===C?"selected":""}`,onClick:()=>Me(ee.effort),children:[a.jsx("span",{children:ee.label}),ee.effort===C&&a.jsx(Cs,{size:12})]},ee.effort))]})]})]})}function bi(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6===0?0:1)}M`:e>=1e3?`${Math.round(e/1e3)}K`:String(e)}function Mg(){const e=A(r=>r.canGoBack),n=A(r=>r.canGoForward);return a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"sb-item sb-btn",title:"Back","aria-label":"Back",disabled:!e,onClick:()=>window.history.back(),children:a.jsx(h1,{size:14})}),a.jsx("button",{className:"sb-item sb-btn",title:"Forward","aria-label":"Forward",disabled:!n,onClick:()=>window.history.forward(),children:a.jsx(m1,{size:14})})]})}function Lg(){const e=A(n=>n.setShowRemoteModal);return a.jsxs("div",{className:"sb-item",style:{cursor:"pointer"},title:"Remote access — make this machine remote",onClick:()=>e(!0),children:[a.jsx(Q1,{size:14})," Repoburg"]})}function Og(){const e=A(r=>r.usageViewOpen),n=A(r=>r.toggleUsageView);return a.jsxs("button",{className:`sb-item sb-btn${e?" sb-item-active":""}`,title:e?"Back to the agent view":"Usage Center",onClick:n,children:[a.jsx(Pv,{size:14})," Usage"]})}function $g(){const e=A(r=>r.vscodeViewOpen),n=A(r=>r.toggleVscodeView);return a.jsxs("button",{className:`sb-item sb-btn${e?" sb-item-active":""}`,title:e?"Back to the agent view":"Open VS Code",onClick:n,children:[a.jsx(k1,{size:14})," Code"]})}function Pg(){const e=A(r=>r.terminalViewOpen),n=A(r=>r.toggleTerminalView);return a.jsxs("button",{className:`sb-item sb-btn${e?" sb-item-active":""}`,title:e?"Back to the agent view":"Open a terminal",onClick:n,children:[a.jsx(Gv,{size:14})," Terminal"]})}function XC(){Lt.trackRender("StatusBar");const e=A(v=>v.activeSessionId),n=A(v=>e?v.sessions.find(k=>k.id===e)??null:null),r=A(v=>e?v.sessionDetails[e]??null:null),o=A(v=>e?v.backgroundTasks[e]:void 0),l=A(v=>v.wsConnected),c=A(v=>v.switchRightTab),d=(r==null?void 0:r.contextUsage)??null;if(!n)return a.jsxs("div",{className:"ide-statusbar",children:[a.jsx(Mg,{}),a.jsx(Lg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx($g,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Pg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Og,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx("div",{className:"sb-item",title:l?"WebSocket connected":"WebSocket disconnected",children:l?"Live":"Offline"}),a.jsx("div",{className:"sb-spacer"}),a.jsxs("div",{className:"sb-item",children:[a.jsx(Im,{size:14})," K"]})]});const f=o??[],h=Yl(n,f.length),m=bf(f);return a.jsxs("div",{className:"ide-statusbar",children:[a.jsx(Mg,{}),a.jsx(Lg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx($g,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Pg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Og,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(qC,{}),m>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sb-divider",children:"|"}),a.jsxs("div",{className:"sb-item",style:{color:"var(--amber)",cursor:"pointer"},title:`${m} Monitor task${m>1?"s":""} running — click to view`,onClick:()=>c("tasks"),children:[a.jsx(Zl,{size:14})," ",m]})]}),a.jsx("div",{className:"sb-spacer"}),a.jsx("div",{className:"sb-item",title:l?"WebSocket connected":"WebSocket disconnected",children:l?"Live":"Offline"}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx("div",{className:"sb-item",style:h.dot==="background"?{color:"var(--purple)"}:n.status==="failed"?{color:"var(--red)"}:void 0,title:h.dot==="background"?h.dotTitle:void 0,children:h.label}),d&&a.jsx(YC,{usage:d}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsxs("div",{className:"sb-item",children:[a.jsx(Im,{size:14})," K"]})]})}function YC({usage:e}){const n=e.percentage>=85?"var(--red)":e.percentage>=60?"var(--amber)":"var(--green)",r=`${bi(e.totalTokens)} / ${bi(e.contextWindow)} tokens`+(e.autoCompactThreshold?` · auto-compacts at ${bi(e.autoCompactThreshold)}`:"");return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx("div",{className:"sb-context",title:r,children:a.jsxs("span",{className:"sb-context-text",style:{color:n},children:[Math.round(e.percentage),"% / ",bi(e.totalTokens)," / ",bi(e.contextWindow)]})})]})}function zg(e){return kt(`/vscode-web/status?folder=${encodeURIComponent(e??"")}`)}function QC(e){return st("/vscode-web/start",{folder:e})}function ZC(e){return st("/vscode-web/heartbeat",{id:e})}const JC=1e3,eE=5*6e4;function Fg({children:e}){const n=A(r=>r.toggleVscodeView);return a.jsxs("div",{className:"vscode-view vscode-view--loading",children:[e,a.jsx("button",{className:"dialog-close vscode-view-close",title:"Close VS Code view","aria-label":"Close VS Code view",onClick:n,children:a.jsx(Tn,{size:16})})]})}function tE(){const e=A(C=>C.vscodeState),n=A(C=>C.vscodeId),r=A(C=>C.vscodeToken),o=A(C=>C.setVscodeView),l=A(C=>{var E;const T=C.activeSessionId?C.sessions.find(b=>b.id===C.activeSessionId):null;return T!=null&&T.cwd?T.cwd:((E=C.workspaces.find(b=>b.deleted===0))==null?void 0:E.path)??null}),[c,d]=y.useState(!1),[f,h]=y.useState(0),m=y.useRef(null),v=mn(),k=v===""||v===window.location.origin,x=`${v}/vscode/${n??""}/?tkn=${r??""}${l?`&folder=${encodeURIComponent(l)}`:""}`;y.useEffect(()=>{let C=!1;function T(){m.current&&(clearInterval(m.current),m.current=null)}async function E(){try{let j=await zg(l);if((j.state==="stopped"||j.state==="error")&&(j=await QC(l)),C||(o(j.state,j.id,j.token),j.state==="running"||j.state==="error"))return;m.current=setInterval(async()=>{const P=await zg(l);C||(o(P.state,P.id,P.token),(P.state==="running"||P.state==="error"||P.state==="stopped")&&T())},JC)}catch{C||o("error",null,null)}}E();const b=setInterval(()=>{const j=A.getState().vscodeId;j&&ZC(j).catch(()=>{})},eE);return()=>{C=!0,T(),clearInterval(b)}},[f,l,o]);function S(){d(!1),o("starting",null,null),h(C=>C+1)}return e!=="running"||!r||!n?a.jsx(Fg,{children:e==="error"?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"VS Code could not start."}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:S,children:[a.jsx($i,{size:14})," Retry"]})]}):a.jsxs("span",{className:"vscode-view-hint",children:[a.jsx(hn,{size:16,className:"spin"})," Starting VS Code — first start downloads the server component (~20 s)."]})}):k?a.jsxs("div",{className:"vscode-view",children:[!c&&a.jsxs("div",{className:"vscode-view-overlay",children:[a.jsx(hn,{size:16,className:"spin"})," Loading VS Code…"]}),a.jsx("iframe",{src:x,title:"VS Code",className:"vscode-view-frame",onLoad:()=>d(!0)},n)]}):a.jsxs(Fg,{children:[a.jsx("span",{children:"VS Code cannot be embedded on this host — serve-web allows same-origin frames only."}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:()=>window.open(x,"_blank","noopener"),children:[a.jsx(Ov,{size:14})," Open VS Code in a new tab"]})]})}function nE(e){const n=new URLSearchParams;return e.since&&n.set("since",e.since),e.until&&n.set("until",e.until),n.set("tz",e.timezone),e.fresh&&n.set("fresh","1"),kt(`/usage/report?${n.toString()}`)}const sE=[{id:"today",label:"Today"},{id:"7d",label:"7 days"},{id:"30d",label:"30 days"},{id:"month",label:"This month"},{id:"all",label:"All"}];function bo(e){return Math.round(e).toLocaleString("en-US")}function ts(e){return`$${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function No(e){return new Intl.NumberFormat("en-US",{notation:"compact",maximumSignificantDigits:3}).format(e)}function Ef(e){const n=e.startsWith("anthropic/claude-")?e.slice(17):e.startsWith("claude-")?e.slice(7):e,r=n.split("-");return r.length>=3&&r[r.length-1].length===8?r.slice(0,-1).join("-"):n}const rE={claude:"Claude",codex:"Codex",repoburg:"Repoburg",opencode:"OpenCode",amp:"Amp",droid:"Droid",gemini:"Gemini",copilot:"Copilot",pi:"pi",kimi:"Kimi",qwen:"Qwen"};function yl(e){return rE[e]??e.charAt(0).toUpperCase()+e.slice(1)}const Hl=e=>String(e).padStart(2,"0");function lc(e){return`${e.getFullYear()}-${Hl(e.getMonth()+1)}-${Hl(e.getDate())}`}function oE(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:`${lc(n)} ${Hl(n.getHours())}:${Hl(n.getMinutes())}`}function Ug(e,n=new Date){if(e==="all")return{since:null,until:null};const r=new Date(n.getFullYear(),n.getMonth(),n.getDate());return e==="7d"?r.setDate(r.getDate()-6):e==="30d"?r.setDate(r.getDate()-29):e==="month"&&r.setDate(1),{since:lc(r),until:null}}function Bg(e){const n=new Date(`${e}T00:00:00Z`);return n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+6)%7),n.toISOString().slice(0,10)}function jf(e,n){const r=[],o=new Date(`${e}T00:00:00Z`),l=new Date(`${n}T00:00:00Z`);for(;o<=l&&r.length<3700;)r.push(o.toISOString().slice(0,10)),o.setUTCDate(o.getUTCDate()+1);return r}const iE=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function zd(e){const n=/^(\d{4})-(\d{2})(?:-(\d{2}))?$/.exec(e);if(!n)return e;const r=iE[Number(n[2])-1]??n[2];return n[3]?`${r} ${Number(n[3])}`:`${r} ${n[1]}`}function aE(e,n=Date.now()){const r=Math.max(0,Math.round((n-Date.parse(e))/1e3));if(r<45)return"just now";const o=Math.round(r/60);if(o<60)return`${o} min ago`;const l=Math.round(o/60);return l<24?`${l} h ago`:lc(new Date(e))}const zr=7,lE=92;function Jy(e,n){const r=n.indexOf(e);return r>=0&&r<zr?r:zr}function xl(e){return e<zr?`var(--usage-series-${e+1})`:"var(--usage-series-other)"}function cE(e,n){return jf(Bg(e),Bg(n)).filter((r,o)=>o%7===0)}function uE(e,n){const{daily:r}=e;if(r.length===0)return null;const o=e.window.since??r[0].period,l=r[r.length-1].period,c=e.window.until??(n>l?n:l),d=jf(o,c);if(d.length<2)return null;const f=d.length>lE,h=new Map((f?e.weekly:r).map(x=>[x.period,x])),m=new Map,v=(f?cE(o,c):d).map(x=>{const S=h.get(x),C=new Map;let T=0;for(const j of(S==null?void 0:S.breakdown)??[]){if(j.cost_usd<=0)continue;const P=Jy(j.model,e.model_order),M=C.get(P)??{slot:P,label:P<zr?Ef(j.model):"Other",cost:0};M.cost+=j.cost_usd,T+=j.cost_usd,C.set(P,M)}const E=((S==null?void 0:S.cost_usd)??0)-T;if(E>.005){const j=C.get(zr)??{slot:zr,label:"Other",cost:0};j.cost+=E,C.set(zr,j)}const b=[...C.values()].sort((j,P)=>j.slot-P.slot);for(const j of b)m.set(j.slot,j.label);return{period:x,label:f?`Week of ${zd(x)}`:zd(x),total:b.reduce((j,P)=>j+P.cost,0),segments:b}});if(!v.some(x=>x.total>0))return null;const k=[...m.entries()].sort((x,S)=>x[0]-S[0]).map(([x,S])=>({slot:x,label:S}));return{unit:f?"week":"day",columns:v,series:k}}function dE(e){if(!(e>0))return[0,1];if(e<.01)return[0,.01];const n=e/4,r=10**Math.floor(Math.log10(n)),o=n/r,l=(o<=1?1:o<=2?2:o<=2.5?2.5:o<=5?5:10)*r,c=[];for(let d=0;d*l<e+l*1e-9||c.length<2;d++)c.push(d*l);return c[c.length-1]<e&&c.push(c.length*l),c}function fE(e,n){if(e>=1e4)return`$${No(e)}`;let r=0;for(;r<3&&Math.abs(Math.round(n*10**r)-n*10**r)>1e-9;)r++;return`$${e.toLocaleString("en-US",{minimumFractionDigits:r,maximumFractionDigits:r})}`}const wo=e=>`${e}%`;function pE({data:e}){const{columns:n,series:r,unit:o}=e,[l,c]=y.useState(null),d=y.useMemo(()=>dE(Math.max(...n.map(T=>T.total))),[n]),f=d[d.length-1],h=d[1]-d[0],m=n.reduce((T,E,b)=>E.total>n[T].total?b:T,0),v=Math.max(1,Math.ceil(n.length/8)),k=n.length,x=T=>{const E={ArrowLeft:-1,ArrowRight:1,Home:-k,End:k};T.key in E&&(T.preventDefault(),c(b=>Math.min(k-1,Math.max(0,(b??k-1)+E[T.key]))))},S=l===null?null:n[l],C=l===null?0:(l+.5)/k*100;return a.jsxs("div",{className:"usage-chart",children:[a.jsxs("div",{className:"usage-chart-head",children:[a.jsx("div",{className:"usage-section-title",children:o==="week"?"Weekly cost (USD)":"Daily cost (USD)"}),r.length>=2&&a.jsx("ul",{className:"usage-legend","aria-label":"Models",children:r.map(T=>a.jsxs("li",{className:"usage-legend-item",children:[a.jsx("span",{className:"usage-swatch",style:{background:xl(T.slot)}}),T.label]},T.slot))})]}),a.jsxs("div",{className:"usage-plot-wrap",children:[a.jsx("div",{className:"usage-yaxis","aria-hidden":"true",children:d.map(T=>a.jsx("span",{className:"usage-ytick",style:{bottom:wo(T/f*100)},children:fE(T,h)},T))}),a.jsxs("div",{className:"usage-plot",role:"group",tabIndex:0,"aria-label":`${o==="week"?"Weekly":"Daily"} cost chart. Arrow keys move between ${o}s.`,onKeyDown:x,onFocus:()=>c(T=>T??k-1),onBlur:()=>c(null),onMouseLeave:()=>c(null),children:[d.map(T=>a.jsx("div",{className:`usage-gridline${T===0?" usage-gridline-base":""}`,style:{bottom:wo(T/f*100)}},T)),a.jsx("div",{className:"usage-cols",children:n.map((T,E)=>a.jsxs("div",{className:`usage-col${l===E?" usage-col-active":""}`,"data-period":T.period,onMouseEnter:()=>c(E),children:[E===m&&T.total>0&&l!==E&&a.jsx("span",{className:"usage-peak",style:{bottom:`calc(${wo(T.total/f*100)} + 3px)`},children:ts(T.total)}),T.total>0&&a.jsx("div",{className:"usage-bar",style:{height:wo(T.total/f*100)},children:T.segments.map(b=>a.jsx("div",{className:"usage-seg",style:{flexGrow:b.cost,background:xl(b.slot)}},b.slot))})]},T.period))}),S&&a.jsxs("div",{className:"usage-tooltip",role:"status",style:{left:wo(C),transform:C<20?"translateX(-12px)":C>80?"translateX(calc(-100% + 12px))":"translateX(-50%)"},children:[a.jsxs("div",{className:"usage-tooltip-head",children:[a.jsx("span",{children:S.label}),a.jsx("strong",{children:ts(S.total)})]}),S.segments.length===0&&a.jsx("div",{className:"usage-tooltip-empty",children:"No usage"}),[...S.segments].sort((T,E)=>E.cost-T.cost).map(T=>a.jsxs("div",{className:"usage-tooltip-line",children:[a.jsx("span",{className:"usage-swatch",style:{background:xl(T.slot)}}),a.jsx("span",{className:"usage-tooltip-model",children:T.label}),a.jsx("span",{children:ts(T.cost)})]},T.slot))]})]}),a.jsx("div",{}),a.jsx("div",{className:"usage-xaxis","aria-hidden":"true",children:n.map((T,E)=>(k-1-E)%v===0?a.jsx("span",{className:"usage-xtick",style:{left:wo((E+.5)/k*100),transform:E===0&&k>1?"translateX(-30%)":E===k-1?"translateX(-70%)":"translateX(-50%)"},children:zd(T.period)},T.period):null)})]})]})}const Wg=[{id:"daily",label:"Daily",column:"Date"},{id:"weekly",label:"Weekly",column:"Week"},{id:"monthly",label:"Monthly",column:"Month"},{id:"session",label:"Session",column:"Session"}],hE={weekly:"Weeks start on Monday.",session:"Sessions last active in this range, with their whole usage."},pd=50,mE={input_tokens:0,output_tokens:0,cache_creation_tokens:0,cache_read_tokens:0,total_tokens:0,cost_usd:0};function gE(e){return e.reduce((n,r)=>({input_tokens:n.input_tokens+r.input_tokens,output_tokens:n.output_tokens+r.output_tokens,cache_creation_tokens:n.cache_creation_tokens+r.cache_creation_tokens,cache_read_tokens:n.cache_read_tokens+r.cache_read_tokens,total_tokens:n.total_tokens+r.total_tokens,cost_usd:n.cost_usd+r.cost_usd}),mE)}function hd({t:e}){return a.jsxs(a.Fragment,{children:[a.jsx("td",{className:"usage-num",children:bo(e.input_tokens)}),a.jsx("td",{className:"usage-num",children:bo(e.output_tokens)}),a.jsx("td",{className:"usage-num",children:bo(e.cache_creation_tokens)}),a.jsx("td",{className:"usage-num",children:bo(e.cache_read_tokens)}),a.jsx("td",{className:"usage-num",children:bo(e.total_tokens)}),a.jsx("td",{className:"usage-num usage-cost",children:ts(e.cost_usd)})]})}function vE({models:e,order:n}){return a.jsx("span",{className:"usage-models",children:e.map(r=>a.jsxs("span",{className:"usage-model",title:r,children:[a.jsx("span",{className:"usage-swatch",style:{background:xl(Jy(r,n))}}),Ef(r)]},r))})}function yE({row:e,onOpen:n}){const r=e.pane_session;if(!r)return a.jsx("span",{className:"usage-session-id usage-session-id-main",title:e.period,children:e.period});const o=r.title||"Untitled session";return a.jsxs("span",{className:"usage-session",children:[a.jsxs("span",{className:"usage-session-title",children:[a.jsx("button",{className:"usage-session-link",title:`Open "${o}"`,onClick:()=>n(r.id),children:o}),r.kind==="discussion"&&a.jsx("span",{className:"usage-tag",children:"discussion"})]}),a.jsx("span",{className:"usage-session-id",title:e.period,children:e.period})]})}function xE({report:e,onOpenSession:n}){var C;const[r,o]=y.useState("daily"),[l,c]=y.useState(!1),[d,f]=y.useState(!1),h=r==="session",m=h?e.sessions:e[r],v=h&&!d?m.slice(0,pd):m,k=h?gE(e.sessions):e.totals,x=h?10:9,S=hE[r];return a.jsxs("div",{className:"usage-table-wrap",children:[a.jsxs("div",{className:"usage-table-head",children:[a.jsx("div",{className:"usage-tabs",role:"tablist","aria-label":"Report",children:Wg.map(T=>a.jsx("button",{role:"tab","aria-selected":r===T.id,className:`usage-tab${r===T.id?" usage-tab-active":""}`,onClick:()=>o(T.id),children:T.label},T.id))}),S&&a.jsx("span",{className:"usage-table-note",children:S}),a.jsxs("label",{className:"usage-check",title:"One line per agent and model, like ccusage --breakdown",children:[a.jsx("input",{type:"checkbox",checked:l,onChange:T=>c(T.target.checked)}),"Breakdown"]})]}),a.jsx("div",{className:"usage-table-scroll",role:"tabpanel",children:a.jsxs("table",{className:"usage-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:(C=Wg.find(T=>T.id===r))==null?void 0:C.column}),a.jsx("th",{children:"Agent"}),a.jsx("th",{children:"Models"}),a.jsx("th",{className:"usage-num",children:"Input"}),a.jsx("th",{className:"usage-num",children:"Output"}),a.jsx("th",{className:"usage-num",children:"Cache Create"}),a.jsx("th",{className:"usage-num",children:"Cache Read"}),a.jsx("th",{className:"usage-num",children:"Total Tokens"}),a.jsx("th",{className:"usage-num",children:"Cost (USD)"}),h&&a.jsx("th",{children:"Last Activity"})]})}),a.jsxs("tbody",{children:[m.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:x,className:"usage-empty",children:"No usage in this range."})}),v.map(T=>{const E=h?T:null;return a.jsxs(y.Fragment,{children:[a.jsxs("tr",{className:"usage-row",children:[a.jsx("td",{className:"usage-period",children:E?a.jsx(yE,{row:E,onOpen:n}):T.period}),a.jsx("td",{children:E?yl(E.agent):T.agents.map(yl).join(", ")}),a.jsx("td",{children:a.jsx(vE,{models:T.models,order:e.model_order})}),a.jsx(hd,{t:T}),E&&a.jsx("td",{className:"usage-when",children:E.last_activity?oE(E.last_activity):"—"})]}),l&&T.breakdown.map(b=>a.jsxs("tr",{className:"usage-sub",children:[a.jsx("td",{}),a.jsx("td",{children:yl(b.agent)}),a.jsxs("td",{title:b.model,children:[a.jsx("span",{className:"usage-branch",children:"└─"})," ",Ef(b.model)]}),a.jsx(hd,{t:b}),E&&a.jsx("td",{})]},`${b.agent}\0${b.model}`))]},T.period)})]}),m.length>0&&a.jsx("tfoot",{children:a.jsxs("tr",{className:"usage-total",children:[a.jsx("td",{children:"Total"}),a.jsx("td",{}),a.jsx("td",{}),a.jsx(hd,{t:k}),h&&a.jsx("td",{})]})})]})}),h&&m.length>pd&&a.jsx("button",{className:"usage-more",onClick:()=>f(T=>!T),children:d?`Show the top ${pd}`:`Show all ${m.length} sessions`})]})}const ex="agentpane:usage-budget",wE=6e4;function kE(){try{const e=Number(localStorage.getItem(ex));return Number.isFinite(e)&&e>0?e:0}catch{return 0}}function SE(e){try{localStorage.setItem(ex,String(e))}catch{}}function bE(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function wl({label:e,value:n,title:r,children:o}){return a.jsxs("div",{className:"usage-kpi",children:[a.jsx("div",{className:"usage-kpi-label",children:e}),a.jsx("div",{className:"usage-kpi-value",title:r,children:n}),o]})}function NE({spent:e}){const[n,r]=y.useState(kE),o=n>0?e/n:0,l=o>=1?"over":o>=.8?"near":"ok",c=d=>{const f=Number(d.replace(",",".")),h=Number.isFinite(f)&&f>0?f:0;r(h),SE(h)};return a.jsxs(wl,{label:"This month",value:ts(e),children:[n>0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:`usage-meter usage-meter-${l}`,role:"meter","aria-label":"Monthly budget used","aria-valuemin":0,"aria-valuemax":n,"aria-valuenow":Math.min(e,n),children:a.jsx("div",{className:"usage-meter-fill",style:{width:`${Math.min(100,o*100)}%`}})}),a.jsx("div",{className:`usage-kpi-sub${l==="over"?" usage-over":""}`,children:l==="over"?a.jsxs(a.Fragment,{children:[a.jsx(Jl,{size:11})," ",ts(e-n)," over the ",ts(n)," budget"]}):`${ts(n-e)} left of ${ts(n)}`})]}):a.jsx("div",{className:"usage-kpi-sub",children:"No monthly budget set"}),a.jsxs("div",{className:"usage-budget",children:[a.jsx("label",{htmlFor:"usage-budget-input",children:"Monthly budget (USD)"}),a.jsx("input",{id:"usage-budget-input",type:"number",min:"0",step:"1",defaultValue:n>0?n:"",placeholder:"none",onBlur:d=>c(d.target.value),onKeyDown:d=>{d.key==="Enter"&&c(d.currentTarget.value)}})]})]})}const TE=(e,n)=>e.since===n.since&&e.until===n.until;function CE(){const e=A(P=>P.toggleUsageView),n=A(P=>P.selectSession),[r,o]=y.useState("30d"),[l,c]=y.useState(null),[d,f]=y.useState(null),[h,m]=y.useState(!1),v=y.useMemo(bE,[]),k=y.useRef(0),x=y.useCallback(P=>{const M=++k.current,{since:L,until:G}=Ug(r),z=async U=>{const Q=await nE({since:L,until:G,timezone:v,fresh:U});M===k.current&&(c(Q),f(null),!U&&Q.generated_at&&Date.now()-Date.parse(Q.generated_at)>wE&&await z(!0))};m(!0),z(P).catch(U=>{M===k.current&&f(U.message)}).finally(()=>{M===k.current&&m(!1)})},[r,v]);y.useEffect(()=>{x(!1)},[x]),y.useEffect(()=>()=>{k.current++},[]);const S=P=>{e(),n(P)},C=lc(new Date),T=y.useMemo(()=>l?uE(l,C):null,[l,C]),E=h&&l!==null&&!TE(l.window,Ug(r)),b=l==null?void 0:l.totals,j=l&&l.daily.length>0?jf(l.window.since??l.daily[0].period,l.window.until??C).length:0;return a.jsxs("div",{className:"usage-view",children:[a.jsxs("div",{className:"usage-header",children:[a.jsxs("div",{className:"usage-title",children:[a.jsx(Pv,{size:18})," Usage Center"]}),a.jsxs("div",{className:"usage-controls",children:[sE.map(P=>a.jsx("button",{className:`usage-range-btn${r===P.id?" usage-range-btn-active":""}`,"aria-pressed":r===P.id,onClick:()=>o(P.id),children:P.label},P.id)),a.jsx("button",{className:"usage-range-btn usage-refresh",onClick:()=>x(!0),title:"Read the logs again (runs ccusage)","aria-label":"Refresh",children:a.jsx(Mm,{size:13,className:h?"spin":void 0})}),a.jsx("button",{className:"dialog-close",title:"Close usage view","aria-label":"Close usage view",onClick:e,children:a.jsx(Tn,{size:16})})]})]}),d&&a.jsxs("div",{className:"usage-error",children:["Could not load usage data: ",d]}),!l&&!d&&a.jsxs("div",{className:"usage-loading",children:[a.jsx(Mm,{size:14,className:"spin"})," Reading the Claude Code and Codex logs with ccusage…"]}),l&&b&&a.jsxs("div",{className:`usage-body${E?" usage-body-stale":""}`,"aria-busy":h,children:[l.source.ccusage_error&&a.jsxs("div",{className:"usage-warning",role:"alert",children:[a.jsx(Jl,{size:13}),a.jsxs("span",{children:["ccusage could not read the Claude Code and Codex logs, so only Repoburg calls are counted:"," ",l.source.ccusage_error]})]}),a.jsxs("div",{className:"usage-kpis",children:[a.jsx(wl,{label:"Cost (USD)",value:ts(b.cost_usd),children:a.jsx("div",{className:"usage-kpi-sub",children:l.by_agent.length===0?"No usage in this range":l.by_agent.map(P=>`${yl(P.agent)} ${ts(P.cost_usd)}`).join(" · ")})}),a.jsx(NE,{spent:l.month_to_date_cost_usd}),a.jsxs(wl,{label:"Total tokens",value:No(b.total_tokens),title:`${bo(b.total_tokens)} tokens`,children:[a.jsxs("div",{className:"usage-kpi-sub",children:["Input ",No(b.input_tokens)," · Output ",No(b.output_tokens)]}),a.jsxs("div",{className:"usage-kpi-sub",children:["Cache Create ",No(b.cache_creation_tokens)," · Cache Read"," ",No(b.cache_read_tokens)]})]}),a.jsx(wl,{label:"Daily average",value:j>0?ts(b.cost_usd/j):"—",children:a.jsx("div",{className:"usage-kpi-sub",children:j>0?`over ${j} ${j===1?"day":"days"} · ${l.daily.length} with usage`:"No usage in this range"})})]}),T&&a.jsx(pE,{data:T}),a.jsx(xE,{report:l,onOpenSession:S}),l.unpriced_models.length>0&&a.jsxs("div",{className:"usage-note",children:["No price for these Repoburg models, counted as $0: ",l.unpriced_models.join(", ")]}),a.jsxs("div",{className:"usage-source",children:["Claude Code and Codex costs by"," ",a.jsx("a",{href:"https://github.com/ryoppippi/ccusage",target:"_blank",rel:"noreferrer",children:"ccusage"}),l.source.ccusage_version?` ${l.source.ccusage_version}`:""," with LiteLLM prices · Repoburg calls priced by AgentPane · days in ",l.timezone,l.generated_at&&` · logs read ${aE(l.generated_at)}`]})]})]})}const Hg="claude auth login";function EE(){const e=A(f=>Object.keys(f.signedOutTurns).length),n=A(f=>f.terminalViewOpen),r=A(f=>f.toggleTerminalView),o=A(f=>f.addToast),[l,c]=y.useState(!1);if(e===0)return null;const d=()=>{c(!0),xw().catch(f=>o("error",`Could not resume the turns — ${hr(f)}`)).finally(()=>c(!1))};return a.jsxs("div",{className:"signed-out-band",role:"status",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(E1,{size:12})}),a.jsxs("span",{className:"banner-text",children:["Claude is signed out — ",e===1?"1 turn is":`${e} turns are`," waiting. Run"," ",a.jsx("code",{children:Hg})," in a terminal, then resume."]}),a.jsxs("button",{type:"button",className:"banner-action",onClick:()=>void Fi(Hg),children:[a.jsx(Oi,{size:12}),"Copy"]}),!n&&a.jsxs("button",{type:"button",className:"banner-action",onClick:r,children:[a.jsx(Gv,{size:12}),"Open terminal"]}),a.jsxs("button",{type:"button",className:"banner-action",onClick:d,disabled:l,children:[a.jsx(Vv,{size:12}),e===1?"Resume turn":"Resume turns"]})]})}const Vg=/^[a-f0-9]{64}\.(?:png|jpg|gif|webp)$/,jE=/^(?:https?:\/\/[^/?#]+)?\/api\/apps\/([^/?#]+)\/files\/([^/?#]+)$/i,_E={png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp"};function tx(){return mn()||window.location.origin}function nx(e,n){let r=n;if(r&&typeof r=="object"){const d=r;r=typeof d.id=="string"?d.id:d.url}if(typeof r!="string")return null;const o=r.trim();if(Vg.test(o))return o;const l=jE.exec(o);if(!l)return null;let c;try{c=decodeURIComponent(l[1])}catch{return null}return c===e&&Vg.test(l[2])?l[2]:null}function Kg(e){return/^https?:\/\//i.test(e.url)?e:{...e,url:`${tx()}${e.url}`}}function RE(e){return _E[e.slice(e.lastIndexOf(".")+1)]??"application/octet-stream"}function sx(e){return new Promise((n,r)=>{const o=new FileReader;o.onload=()=>{const l=String(o.result??"");n(l.slice(l.indexOf(",")+1))},o.onerror=()=>r(o.error??new Error("Could not read the file")),o.readAsDataURL(e)})}function AE(e,n){const r=/^data:([^;,]*)(?:;[^;,]*)*;base64,/i.exec(e);return r?{type:n||r[1]||void 0,data:e.slice(r[0].length)}:{type:n,data:e}}async function rx(e){if(e instanceof Blob){const n=e.name;return{name:typeof n=="string"&&n?n:void 0,type:e.type||void 0,data:await sx(e)}}if(e&&typeof e=="object"&&typeof e.data=="string"){const n=e;return{name:typeof n.name=="string"&&n.name?n.name:void 0,type:typeof n.type=="string"&&n.type?n.type:void 0,data:n.data}}return null}async function IE(e){const n=await rx(e);if(!n)throw new Error("uploadFile: expected a Blob/File or { name, type, data }");return n}async function DE(e,n,r){if(n==null)return[];if(!Array.isArray(n))throw new Error("submitTurn: attachments must be an array");const o=[];for(let l=0;l<n.length;l++){const c=n[l],d=await rx(c);if(d){const{type:m,data:v}=AE(d.data,d.type);if(!m)throw new Error(`submitTurn: attachment ${l+1} has no type`);o.push({name:d.name??`attachment-${l+1}`,media_type:m,data:v});continue}const f=nx(e,c);if(!f)throw new Error(`submitTurn: attachment ${l+1} is not a file of this app`);const h=await r(f);o.push({name:f,media_type:RE(f),data:await sx(h)})}return o}const ME=`function (config) {
687
+ `;m(F=>F+ie),T(!1),P(""),(te=window.getSelection())==null||te.removeAllRanges(),setTimeout(()=>{if(x.current){Q(),x.current.focus();const F=x.current.value.length;x.current.setSelectionRange(F,F)}},0)},[j]);return a.jsxs("div",{className:`thread-card ${e.status==="resolved"?"thread-resolved":""}`,id:`thread-${e.id}`,children:[a.jsxs("div",{className:"thread-card-header",onClick:()=>k(ie=>!ie),children:[a.jsx("div",{className:"thread-card-quote",children:e.selected_text===null?((ee=(Me=(Se=e.turns)==null?void 0:Se[0])==null?void 0:Me.user_prompt)==null?void 0:ee.slice(0,100))||"Quick question":`“${e.selected_text.slice(0,100)}${e.selected_text.length>100?"…":""}”`}),a.jsxs("div",{className:"thread-card-header-right",children:[e.selected_text!==null&&a.jsx("button",{className:"thread-locate-btn",onClick:ie=>{ie.stopPropagation(),f()},title:"Scroll to text",children:a.jsx($1,{size:12})}),a.jsx("span",{className:`thread-status-badge ${e.status==="open"?"thread-status-open":"thread-status-resolved"}`,children:e.status==="open"?"Open":"Resolved"})]})]}),v&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"thread-card-conversation",ref:S,onMouseDown:J,children:[n.map(ie=>a.jsx(Qy,{turn:ie},ie.id)),n.length===0&&a.jsx("div",{className:"thread-card-placeholder",children:"No messages yet."})]}),C&&a.jsx("div",{className:"selection-actions",style:{left:E.x,top:E.y},children:a.jsxs("button",{className:"discuss-button",onClick:me,title:"Quote this text in your follow-up",children:[a.jsx(Hv,{size:14}),a.jsx("span",{children:"Quote"})]})}),e.status==="open"&&a.jsxs("div",{className:"thread-card-followup",children:[a.jsx("textarea",{ref:x,className:"thread-card-followup-input",placeholder:M?"Agent is running…":"Type a follow-up…",value:h,onChange:ie=>{Lt.markInputChange(),m(ie.target.value),Q()},disabled:M,rows:1,style:{minHeight:L,maxHeight:G},onKeyDown:ie=>{Lt.markKeystroke(),ie.key==="Enter"&&(ie.metaKey||ie.ctrlKey)&&!M&&h.trim()&&(ie.preventDefault(),d(h.trim()),m(""),U(L))}}),a.jsx("button",{className:"thread-card-followup-send",disabled:M||!h.trim(),onClick:()=>{d(h.trim()),m("")},children:a.jsx(Hi,{size:13})}),M&&a.jsx("button",{className:"thread-card-followup-stop",onClick:r,title:"Stop this thread's turn (Esc)",children:a.jsx(yr,{size:13})})]}),a.jsxs("div",{className:"thread-card-actions",children:[e.status==="open"?a.jsxs("button",{className:"thread-action-btn",onClick:o,title:"Resolve thread",children:[a.jsx(_l,{size:13})," Resolve"]}):a.jsxs("button",{className:"thread-action-btn",onClick:l,title:"Reopen thread",children:[a.jsx($i,{size:13})," Reopen"]}),a.jsxs("button",{className:"thread-action-btn thread-action-danger",onClick:c,title:"Delete thread",children:[a.jsx(us,{size:13})," Delete"]})]})]})]})}function WC(){Lt.trackRender("ThreadsPanel");const e=A(b=>b.activeSessionId),n=A(b=>{var j;return b.activeSessionId?((j=b.sessionDetails[b.activeSessionId])==null?void 0:j.threads)??Dg:Dg}),r=y.useMemo(()=>n.filter(b=>!Tf(b)),[n]),o=A(b=>b.followupThread),l=A(b=>b.cancelThreadTurn),c=A(b=>b.reopenThread),d=A(b=>b.deleteThread),f=A(b=>b.deepLinkThreadId),h=A(b=>b.setDeepLinkThreadId),[m,v]=y.useState("open"),[k,x]=y.useState(null);y.useEffect(()=>{if(!f)return;const b=f;h(null),v(P=>r.some(M=>M.id===b&&M.status==="open")?P:"all");const j=setTimeout(()=>{const P=document.getElementById(`thread-${b}`);P&&(P.scrollIntoView({behavior:"smooth",block:"center"}),P.classList.add("thread-card-highlighted"),setTimeout(()=>P.classList.remove("thread-card-highlighted"),1500))},100);return()=>clearTimeout(j)},[f,h,r]);const S=r.filter(b=>m==="open"?b.status==="open":m==="resolved"?b.status==="resolved":!0),C=r.filter(b=>b.status==="open").length,T=r.filter(b=>b.status==="resolved").length;function E(b){setTimeout(()=>{const j=document.querySelector(`mark[data-thread-id="${b}"]`);j&&(j.scrollIntoView({behavior:"smooth",block:"center"}),j.classList.add("thread-mark-flash"),setTimeout(()=>j.classList.remove("thread-mark-flash"),1500))},50)}return e?r.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx(Bv,{size:24,style:{opacity:.3,marginBottom:8}}),a.jsx("div",{children:"No threads yet."}),a.jsx("div",{style:{fontSize:"11px",marginTop:"4px"},children:"Select text in an agent response to start a discussion."})]}):a.jsxs("div",{children:[a.jsxs("div",{className:"thread-filter-tabs",children:[a.jsxs("button",{className:`thread-filter-tab ${m==="open"?"active":""}`,onClick:()=>v("open"),children:["Open (",C,")"]}),a.jsxs("button",{className:`thread-filter-tab ${m==="resolved"?"active":""}`,onClick:()=>v("resolved"),children:["Resolved (",T,")"]}),a.jsxs("button",{className:`thread-filter-tab ${m==="all"?"active":""}`,onClick:()=>v("all"),children:["All (",r.length,")"]})]}),S.length===0?a.jsxs("div",{className:"empty-state",style:{padding:"20px 0"},children:["No ",m," threads."]}):S.map(b=>a.jsx(BC,{thread:b,threadTurns:b.turns??[],onStop:()=>l(e,b.id),onResolve:()=>x(b),onReopen:()=>c(e,b.id),onDelete:()=>d(e,b.id),onFollowup:j=>o(e,b.id,j),onLocate:()=>E(b.id)},b.id)),k&&a.jsx(PC,{thread:k,onClose:()=>x(null)})]}):a.jsx("div",{className:"empty-state",children:"No session selected"})}function HC(){const e=A(d=>d.apps),n=A(d=>d.activeAppTabId),r=A(d=>d.openAppTab),o=A(d=>d.startAppEdit),l=A(d=>d.toggleAppPin),c=A(d=>d.deleteApp);return e.length===0?a.jsx("div",{className:"empty-state",style:{padding:"16px"},children:"No mini apps yet. Add one with the + button in the sidebar Apps section."}):a.jsx("div",{className:"apps-panel",children:e.map(d=>a.jsxs("div",{className:`apps-panel-row${n===d.id?" active":""}`,onClick:()=>r(d.id),title:d.description??void 0,children:[a.jsx(Do,{iconNode:d.iconNode,size:14,className:"sidebar-app-icon"}),a.jsxs("div",{className:"apps-panel-info",children:[a.jsx("span",{className:"apps-panel-title",children:d.title}),d.description&&a.jsx("span",{className:"apps-panel-desc",children:d.description})]}),a.jsx("button",{className:"apps-panel-action",title:"Edit app with the agent",onClick:f=>{f.stopPropagation(),o(d.id)},children:a.jsx(hl,{size:12})}),a.jsx("button",{className:`apps-panel-action${d.pinned?" pinned":""}`,title:d.pinned?"Unpin app":"Pin app (sorts first)",onClick:f=>{f.stopPropagation(),l(d.id)},children:a.jsx(Al,{size:12,fill:d.pinned?"currentColor":"none"})}),a.jsx("button",{className:"apps-panel-action apps-panel-danger",title:"Delete app",onClick:f=>{f.stopPropagation(),c(d.id)},children:a.jsx(us,{size:12})})]},d.id))})}const VC=24;function KC(){Lt.trackRender("SidecarPanel");const e=A(b=>b.activeSessionId),n=A(b=>{var j;return b.activeSessionId?(j=b.sessionDetails[b.activeSessionId])==null?void 0:j.runtime_type:void 0}),r=A(b=>{var j;return b.activeSessionId?OC((j=b.sessionDetails[b.activeSessionId])==null?void 0:j.threads):null}),o=A(b=>b.askSidecar),l=A(b=>b.cancelThreadTurn),c=A(b=>b.deleteThread),[d,f]=y.useState(""),[h,m]=y.useState(!1),v=y.useRef(null),k=y.useRef(!0),x=(r==null?void 0:r.turns)??[],S=x[x.length-1],C=x.some(Fs);if(y.useEffect(()=>{k.current=!0},[e,x.length]),y.useEffect(()=>{const b=v.current;b&&k.current&&(b.scrollTop=b.scrollHeight)},[e,x.length,S==null?void 0:S.items.length,S==null?void 0:S.status]),!e||!n)return a.jsx("div",{className:"empty-state",children:"No session selected"});if(!LC(n))return a.jsxs("div",{className:"empty-state",children:[a.jsx(vr,{size:24,style:{opacity:.3,marginBottom:8}}),a.jsxs("div",{children:["The sidecar is not available for ",n," sessions yet."]})]});const T=!C&&!h&&d.trim().length>0;async function E(){if(!e||!T)return;m(!0);const b=await o(e,d.trim());m(!1),b&&f("")}return a.jsxs("div",{className:"sidecar-panel",children:[a.jsx("div",{ref:v,className:"sidecar-conversation",onScroll:b=>{const j=b.currentTarget;k.current=j.scrollHeight-j.scrollTop-j.clientHeight<=VC},children:x.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx(vr,{size:24,style:{opacity:.3,marginBottom:8}}),a.jsx("div",{children:"Ask about this session."}),a.jsx("div",{className:"sidecar-hint",children:"Where does it stand? Is it stuck? When will it finish? What is done and what is left?"})]}):x.map(b=>a.jsx(Qy,{turn:b,formatPrompt:$C},b.id))}),a.jsxs("div",{className:"sidecar-footer",children:[a.jsxs("div",{className:"thread-card-followup",children:[a.jsx("textarea",{className:"thread-card-followup-input","aria-label":"Ask the sidecar",placeholder:C?"Sidecar is answering…":"Ask about this session… (⌘/Ctrl+Enter)",value:d,rows:2,disabled:C,onChange:b=>{Lt.markInputChange(),f(b.target.value)},onKeyDown:b=>{Lt.markKeystroke(),b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),E())}}),C&&r?a.jsx("button",{className:"thread-card-followup-stop",title:"Stop the answer","aria-label":"Stop the answer",onClick:()=>l(e,r.id),children:a.jsx(yr,{size:13})}):a.jsx("button",{className:"thread-card-followup-send",title:"Ask","aria-label":"Ask",disabled:!T,onClick:()=>void E(),children:a.jsx(Hi,{size:13})})]}),r&&a.jsx("div",{className:"thread-card-actions",children:a.jsxs("button",{className:"thread-action-btn thread-action-danger",title:"Clear the sidecar conversation",disabled:C,onClick:()=>c(e,r.id),children:[a.jsx(us,{size:13})," Clear"]})})]})]})}function GC(){var h;Lt.trackRender("RightPanel");const e=A(m=>m.activeRightTab),n=A(m=>m.switchRightTab),r=A(m=>m.rightPanelCollapsed),o=A(m=>m.toggleRightPanel),l=A(m=>m.activeSessionId?m.sessionDetails[m.activeSessionId]:null),c=A(m=>m.activeSessionId?bf(m.backgroundTasks[m.activeSessionId]):0),d=((h=l==null?void 0:l.threads)==null?void 0:h.filter(m=>m.status==="open"&&!Tf(m)).length)??0,f=[{id:"turns",label:"Turns",icon:A1},{id:"sidecar",label:"Sidecar",icon:vr},{id:"tasks",label:"Tasks",icon:R1,badge:c||void 0},{id:"threads",label:"Threads",icon:Bv,badge:d||void 0},{id:"apps",label:"Apps",icon:Uv}];return r?a.jsxs("div",{className:"ide-right collapsed",children:[a.jsx("button",{type:"button",className:"right-icon-btn",title:"Expand panel","aria-label":"Expand panel","aria-expanded":!1,onClick:o,children:a.jsx(z1,{size:15})}),a.jsx("div",{className:"right-rail-divider"}),f.map(m=>{const v=m.icon,k=m.badge?`${m.label} (${m.badge})`:m.label;return a.jsxs("button",{type:"button",className:`right-icon-btn right-rail-tab ${e===m.id?"active":""}`,title:k,"aria-label":k,onClick:()=>n(m.id),children:[a.jsx(v,{size:15}),m.badge?a.jsx("span",{className:"right-tab-badge",children:m.badge}):null]},m.id)})]}):a.jsxs("div",{className:"ide-right",children:[a.jsxs("div",{className:"right-header",children:[a.jsx("div",{className:"right-tabs",children:f.map(m=>a.jsxs("div",{className:`right-tab ${e===m.id?"active":""}`,onClick:()=>n(m.id),children:[m.label,m.badge?a.jsx("span",{className:"right-tab-badge",children:m.badge}):null]},m.id))}),a.jsx("button",{type:"button",className:"right-icon-btn right-collapse-btn",title:"Collapse panel","aria-label":"Collapse panel","aria-expanded":!0,onClick:o,children:a.jsx(P1,{size:14})})]}),a.jsxs("div",{className:"right-content",children:[e==="turns"&&a.jsx(CC,{}),e==="sidecar"&&a.jsx(KC,{}),e==="tasks"&&a.jsx(IC,{}),e==="threads"&&a.jsx(WC,{}),e==="apps"&&a.jsx(HC,{})]})]})}const De={low:{effort:"low",label:"Low"},medium:{effort:"medium",label:"Medium"},high:{effort:"high",label:"High"},xhigh:{effort:"xhigh",label:"Extra High"},max:{effort:"max",label:"Max"},ultra:{effort:"ultra",label:"Ultra"}},$d=[{id:"codex",label:"Codex",available:!0,models:[{slug:"gpt-5.6-sol",displayName:"GPT-5.6-Sol",description:"Flagship — complex, open-ended work",defaultReasoning:"low",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max,De.ultra]},{slug:"gpt-5.6-terra",displayName:"GPT-5.6-Terra",description:"Balanced all-rounder for everyday work",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max,De.ultra]},{slug:"gpt-5.6-luna",displayName:"GPT-5.6-Luna",description:"Fast, affordable — clear, repeatable tasks",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max]},{slug:"gpt-5.5",displayName:"GPT-5.5",description:"Previous-gen frontier model",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh]}]},{id:"claude",label:"Claude",available:!0,models:[{slug:"claude-sonnet-5-5",displayName:"Claude Sonnet 5.5",description:"Best combination of speed and intelligence",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max]},{slug:"claude-sonnet-5",displayName:"Claude Sonnet 5",description:"Previous-gen balanced all-rounder",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max]},{slug:"claude-opus-5",displayName:"Claude Opus 5",description:"Deep reasoning for complex tasks",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max]},{slug:"claude-fable-5",displayName:"Claude Fable 5",description:"Fast and efficient for simple tasks",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max]}]},{id:"repoburg",label:"Repoburg",available:!0,models:[{slug:"ollama/glm-5.3:cloud",displayName:"GLM-5.3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high]},{slug:"ollama/glm-5.3-flash:cloud",displayName:"GLM-5.3 Flash",description:"Ollama Cloud — fast",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high]},{slug:"ollama/minimax-m3:cloud",displayName:"MiniMax M3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high]},{slug:"ollama/deepseek-v4-pro:cloud",displayName:"DeepSeek V4 Pro",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high]}]}];function qC(e){return $d.find(n=>n.id===e)}function Cf(e){const n=qC(e);return(n==null?void 0:n.models)??[]}function Zy(e,n){return Cf(e).find(r=>r.slug===n)}function Pd(e,n){var r;return((r=Zy(e,n))==null?void 0:r.reasoningLevels)??[]}function zd(e,n){var r;return(r=Zy(e,n))==null?void 0:r.defaultReasoning}function XC(){const{activeSessionId:e,sessions:n,updateModelConfig:r}=A(),o=A(ee=>ee.showModelSelector),l=A(ee=>ee.setShowModelSelector),c=n.find(ee=>ee.id===e),d=A(ee=>ee.models),f=A(ee=>ee.modelsLoading),h=A(ee=>ee.loadModels),[m,v]=y.useState(!1),k=y.useRef(null);if(Wi(k,()=>v(!1),m),Io(()=>v(!1),m),y.useEffect(()=>{o&&(v(!0),l(!1))},[o,l]),y.useEffect(()=>{c!=null&&c.runtime_type&&h(c.runtime_type,c.cwd??void 0)},[c==null?void 0:c.runtime_type,c==null?void 0:c.cwd,h]),!c)return null;const x=c.runtime_type,S=c.model??"",C=c.model_reasoning_effort??"",T=d.length>0?d:[],E=Cf(x),j=[...T.length>0?T:E];if(S&&!j.some(ee=>ee.slug===S)){const ee=E[0];j.unshift({slug:S,displayName:S,description:"Custom model",defaultReasoning:(ee==null?void 0:ee.defaultReasoning)??"medium",reasoningLevels:(ee==null?void 0:ee.reasoningLevels)??[]})}function P(ee){return j.find(ie=>ie.slug===ee)}function M(ee){var ie;return T.length>0?((ie=P(ee))==null?void 0:ie.reasoningLevels)??[]:Pd(x,ee)}function L(ee){var ie;return T.length>0?(ie=P(ee))==null?void 0:ie.defaultReasoning:zd(x,ee)}const G=$d.find(ee=>ee.id===x),z=P(S),U=S?M(S):[],Q=(G==null?void 0:G.label)??x,J=(z==null?void 0:z.displayName)??(S||"Default"),oe=U.find(ee=>ee.effort===C),me=(oe==null?void 0:oe.label)??(C||"Default");function Se(ee){var Z;const ie=M(ee),F=ie.some(q=>q.effort===C)?C:L(ee)??((Z=ie[0])==null?void 0:Z.effort)??"";r(ee,F),v(!1)}function Me(ee){r(S,ee),v(!1)}return a.jsxs("div",{className:"model-selector",ref:k,children:[a.jsxs("button",{className:"model-selector-btn",onClick:()=>v(!m),title:"Change model and thinking level",children:[a.jsx("span",{className:"model-selector-provider",children:Q}),a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-model",children:J}),me!=="Default"&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-reasoning",children:me})]}),a.jsx(_o,{size:12,className:"model-selector-chevron"})]}),m&&a.jsxs("div",{className:"model-selector-popover",children:[a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Provider"}),$d.map(ee=>a.jsxs("div",{className:`model-selector-item ${ee.id===x?"selected":""} ${ee.available?"":"disabled"}`,onClick:()=>{if(ee.available){if(ee.id===x){v(!1);return}r("","",ee.id)}},children:[a.jsx("span",{children:ee.label}),!ee.available&&a.jsxs("span",{className:"model-selector-coming-soon",children:[a.jsx(M1,{size:10})," Soon"]}),ee.id===x&&a.jsx(Cs,{size:12})]},ee.id))]}),a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Model"}),f&&a.jsx("div",{className:"model-selector-empty",children:"Loading models…"}),!f&&j.length===0&&a.jsx("div",{className:"model-selector-empty",children:"No models available"}),j.map(ee=>a.jsxs("div",{className:`model-selector-item ${ee.slug===S?"selected":""}`,onClick:()=>Se(ee.slug),children:[a.jsxs("div",{className:"model-selector-item-main",children:[a.jsx("span",{className:"model-selector-item-name",children:ee.displayName}),a.jsx("span",{className:"model-selector-item-desc",children:ee.description})]}),ee.slug===S&&a.jsx(Cs,{size:12})]},ee.slug))]}),a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Thinking"}),U.length===0&&a.jsx("div",{className:"model-selector-empty",children:"Select a model first"}),U.map(ee=>a.jsxs("div",{className:`model-selector-item ${ee.effort===C?"selected":""}`,onClick:()=>Me(ee.effort),children:[a.jsx("span",{children:ee.label}),ee.effort===C&&a.jsx(Cs,{size:12})]},ee.effort))]})]})]})}function bi(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6===0?0:1)}M`:e>=1e3?`${Math.round(e/1e3)}K`:String(e)}function Mg(){const e=A(r=>r.canGoBack),n=A(r=>r.canGoForward);return a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"sb-item sb-btn",title:"Back","aria-label":"Back",disabled:!e,onClick:()=>window.history.back(),children:a.jsx(m1,{size:14})}),a.jsx("button",{className:"sb-item sb-btn",title:"Forward","aria-label":"Forward",disabled:!n,onClick:()=>window.history.forward(),children:a.jsx(g1,{size:14})})]})}function Lg(){const e=A(n=>n.setShowRemoteModal);return a.jsxs("div",{className:"sb-item",style:{cursor:"pointer"},title:"Remote access — make this machine remote",onClick:()=>e(!0),children:[a.jsx(Z1,{size:14})," Repoburg"]})}function Og(){const e=A(r=>r.usageViewOpen),n=A(r=>r.toggleUsageView);return a.jsxs("button",{className:`sb-item sb-btn${e?" sb-item-active":""}`,title:e?"Back to the agent view":"Usage Center",onClick:n,children:[a.jsx(Pv,{size:14})," Usage"]})}function $g(){const e=A(r=>r.vscodeViewOpen),n=A(r=>r.toggleVscodeView);return a.jsxs("button",{className:`sb-item sb-btn${e?" sb-item-active":""}`,title:e?"Back to the agent view":"Open VS Code",onClick:n,children:[a.jsx(S1,{size:14})," Code"]})}function Pg(){const e=A(r=>r.terminalViewOpen),n=A(r=>r.toggleTerminalView);return a.jsxs("button",{className:`sb-item sb-btn${e?" sb-item-active":""}`,title:e?"Back to the agent view":"Open a terminal",onClick:n,children:[a.jsx(Gv,{size:14})," Terminal"]})}function YC(){Lt.trackRender("StatusBar");const e=A(v=>v.activeSessionId),n=A(v=>e?v.sessions.find(k=>k.id===e)??null:null),r=A(v=>e?v.sessionDetails[e]??null:null),o=A(v=>e?v.backgroundTasks[e]:void 0),l=A(v=>v.wsConnected),c=A(v=>v.switchRightTab),d=(r==null?void 0:r.contextUsage)??null;if(!n)return a.jsxs("div",{className:"ide-statusbar",children:[a.jsx(Mg,{}),a.jsx(Lg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx($g,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Pg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Og,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx("div",{className:"sb-item",title:l?"WebSocket connected":"WebSocket disconnected",children:l?"Live":"Offline"}),a.jsx("div",{className:"sb-spacer"}),a.jsxs("div",{className:"sb-item",children:[a.jsx(Im,{size:14})," K"]})]});const f=o??[],h=Ql(n,f.length),m=bf(f);return a.jsxs("div",{className:"ide-statusbar",children:[a.jsx(Mg,{}),a.jsx(Lg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx($g,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Pg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Og,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(XC,{}),m>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sb-divider",children:"|"}),a.jsxs("div",{className:"sb-item",style:{color:"var(--amber)",cursor:"pointer"},title:`${m} Monitor task${m>1?"s":""} running — click to view`,onClick:()=>c("tasks"),children:[a.jsx(Jl,{size:14})," ",m]})]}),a.jsx("div",{className:"sb-spacer"}),a.jsx("div",{className:"sb-item",title:l?"WebSocket connected":"WebSocket disconnected",children:l?"Live":"Offline"}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx("div",{className:"sb-item",style:h.dot==="background"?{color:"var(--purple)"}:n.status==="failed"?{color:"var(--red)"}:void 0,title:h.dot==="background"?h.dotTitle:void 0,children:h.label}),d&&a.jsx(QC,{usage:d}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsxs("div",{className:"sb-item",children:[a.jsx(Im,{size:14})," K"]})]})}function QC({usage:e}){const n=e.percentage>=85?"var(--red)":e.percentage>=60?"var(--amber)":"var(--green)",r=`${bi(e.totalTokens)} / ${bi(e.contextWindow)} tokens`+(e.autoCompactThreshold?` · auto-compacts at ${bi(e.autoCompactThreshold)}`:"");return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx("div",{className:"sb-context",title:r,children:a.jsxs("span",{className:"sb-context-text",style:{color:n},children:[Math.round(e.percentage),"% / ",bi(e.totalTokens)," / ",bi(e.contextWindow)]})})]})}function zg(e){return kt(`/vscode-web/status?folder=${encodeURIComponent(e??"")}`)}function ZC(e){return st("/vscode-web/start",{folder:e})}function JC(e){return st("/vscode-web/heartbeat",{id:e})}const eE=1e3,tE=5*6e4;function Fg({children:e}){const n=A(r=>r.toggleVscodeView);return a.jsxs("div",{className:"vscode-view vscode-view--loading",children:[e,a.jsx("button",{className:"dialog-close vscode-view-close",title:"Close VS Code view","aria-label":"Close VS Code view",onClick:n,children:a.jsx(Tn,{size:16})})]})}function nE(){const e=A(C=>C.vscodeState),n=A(C=>C.vscodeId),r=A(C=>C.vscodeToken),o=A(C=>C.setVscodeView),l=A(C=>{var E;const T=C.activeSessionId?C.sessions.find(b=>b.id===C.activeSessionId):null;return T!=null&&T.cwd?T.cwd:((E=C.workspaces.find(b=>b.deleted===0))==null?void 0:E.path)??null}),[c,d]=y.useState(!1),[f,h]=y.useState(0),m=y.useRef(null),v=mn(),k=v===""||v===window.location.origin,x=`${v}/vscode/${n??""}/?tkn=${r??""}${l?`&folder=${encodeURIComponent(l)}`:""}`;y.useEffect(()=>{let C=!1;function T(){m.current&&(clearInterval(m.current),m.current=null)}async function E(){try{let j=await zg(l);if((j.state==="stopped"||j.state==="error")&&(j=await ZC(l)),C||(o(j.state,j.id,j.token),j.state==="running"||j.state==="error"))return;m.current=setInterval(async()=>{const P=await zg(l);C||(o(P.state,P.id,P.token),(P.state==="running"||P.state==="error"||P.state==="stopped")&&T())},eE)}catch{C||o("error",null,null)}}E();const b=setInterval(()=>{const j=A.getState().vscodeId;j&&JC(j).catch(()=>{})},tE);return()=>{C=!0,T(),clearInterval(b)}},[f,l,o]);function S(){d(!1),o("starting",null,null),h(C=>C+1)}return e!=="running"||!r||!n?a.jsx(Fg,{children:e==="error"?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"VS Code could not start."}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:S,children:[a.jsx($i,{size:14})," Retry"]})]}):a.jsxs("span",{className:"vscode-view-hint",children:[a.jsx(hn,{size:16,className:"spin"})," Starting VS Code — first start downloads the server component (~20 s)."]})}):k?a.jsxs("div",{className:"vscode-view",children:[!c&&a.jsxs("div",{className:"vscode-view-overlay",children:[a.jsx(hn,{size:16,className:"spin"})," Loading VS Code…"]}),a.jsx("iframe",{src:x,title:"VS Code",className:"vscode-view-frame",onLoad:()=>d(!0)},n)]}):a.jsxs(Fg,{children:[a.jsx("span",{children:"VS Code cannot be embedded on this host — serve-web allows same-origin frames only."}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:()=>window.open(x,"_blank","noopener"),children:[a.jsx(Ov,{size:14})," Open VS Code in a new tab"]})]})}function sE(e){const n=new URLSearchParams;return e.since&&n.set("since",e.since),e.until&&n.set("until",e.until),n.set("tz",e.timezone),e.fresh&&n.set("fresh","1"),kt(`/usage/report?${n.toString()}`)}const rE=[{id:"today",label:"Today"},{id:"7d",label:"7 days"},{id:"30d",label:"30 days"},{id:"month",label:"This month"},{id:"all",label:"All"}];function bo(e){return Math.round(e).toLocaleString("en-US")}function ts(e){return`$${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function No(e){return new Intl.NumberFormat("en-US",{notation:"compact",maximumSignificantDigits:3}).format(e)}function Ef(e){const n=e.startsWith("anthropic/claude-")?e.slice(17):e.startsWith("claude-")?e.slice(7):e,r=n.split("-");return r.length>=3&&r[r.length-1].length===8?r.slice(0,-1).join("-"):n}const oE={claude:"Claude",codex:"Codex",repoburg:"Repoburg",opencode:"OpenCode",amp:"Amp",droid:"Droid",gemini:"Gemini",copilot:"Copilot",pi:"pi",kimi:"Kimi",qwen:"Qwen"};function yl(e){return oE[e]??e.charAt(0).toUpperCase()+e.slice(1)}const Vl=e=>String(e).padStart(2,"0");function cc(e){return`${e.getFullYear()}-${Vl(e.getMonth()+1)}-${Vl(e.getDate())}`}function iE(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:`${cc(n)} ${Vl(n.getHours())}:${Vl(n.getMinutes())}`}function Ug(e,n=new Date){if(e==="all")return{since:null,until:null};const r=new Date(n.getFullYear(),n.getMonth(),n.getDate());return e==="7d"?r.setDate(r.getDate()-6):e==="30d"?r.setDate(r.getDate()-29):e==="month"&&r.setDate(1),{since:cc(r),until:null}}function Bg(e){const n=new Date(`${e}T00:00:00Z`);return n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+6)%7),n.toISOString().slice(0,10)}function jf(e,n){const r=[],o=new Date(`${e}T00:00:00Z`),l=new Date(`${n}T00:00:00Z`);for(;o<=l&&r.length<3700;)r.push(o.toISOString().slice(0,10)),o.setUTCDate(o.getUTCDate()+1);return r}const aE=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Fd(e){const n=/^(\d{4})-(\d{2})(?:-(\d{2}))?$/.exec(e);if(!n)return e;const r=aE[Number(n[2])-1]??n[2];return n[3]?`${r} ${Number(n[3])}`:`${r} ${n[1]}`}function lE(e,n=Date.now()){const r=Math.max(0,Math.round((n-Date.parse(e))/1e3));if(r<45)return"just now";const o=Math.round(r/60);if(o<60)return`${o} min ago`;const l=Math.round(o/60);return l<24?`${l} h ago`:cc(new Date(e))}const zr=7,cE=92;function Jy(e,n){const r=n.indexOf(e);return r>=0&&r<zr?r:zr}function xl(e){return e<zr?`var(--usage-series-${e+1})`:"var(--usage-series-other)"}function uE(e,n){return jf(Bg(e),Bg(n)).filter((r,o)=>o%7===0)}function dE(e,n){const{daily:r}=e;if(r.length===0)return null;const o=e.window.since??r[0].period,l=r[r.length-1].period,c=e.window.until??(n>l?n:l),d=jf(o,c);if(d.length<2)return null;const f=d.length>cE,h=new Map((f?e.weekly:r).map(x=>[x.period,x])),m=new Map,v=(f?uE(o,c):d).map(x=>{const S=h.get(x),C=new Map;let T=0;for(const j of(S==null?void 0:S.breakdown)??[]){if(j.cost_usd<=0)continue;const P=Jy(j.model,e.model_order),M=C.get(P)??{slot:P,label:P<zr?Ef(j.model):"Other",cost:0};M.cost+=j.cost_usd,T+=j.cost_usd,C.set(P,M)}const E=((S==null?void 0:S.cost_usd)??0)-T;if(E>.005){const j=C.get(zr)??{slot:zr,label:"Other",cost:0};j.cost+=E,C.set(zr,j)}const b=[...C.values()].sort((j,P)=>j.slot-P.slot);for(const j of b)m.set(j.slot,j.label);return{period:x,label:f?`Week of ${Fd(x)}`:Fd(x),total:b.reduce((j,P)=>j+P.cost,0),segments:b}});if(!v.some(x=>x.total>0))return null;const k=[...m.entries()].sort((x,S)=>x[0]-S[0]).map(([x,S])=>({slot:x,label:S}));return{unit:f?"week":"day",columns:v,series:k}}function fE(e){if(!(e>0))return[0,1];if(e<.01)return[0,.01];const n=e/4,r=10**Math.floor(Math.log10(n)),o=n/r,l=(o<=1?1:o<=2?2:o<=2.5?2.5:o<=5?5:10)*r,c=[];for(let d=0;d*l<e+l*1e-9||c.length<2;d++)c.push(d*l);return c[c.length-1]<e&&c.push(c.length*l),c}function pE(e,n){if(e>=1e4)return`$${No(e)}`;let r=0;for(;r<3&&Math.abs(Math.round(n*10**r)-n*10**r)>1e-9;)r++;return`$${e.toLocaleString("en-US",{minimumFractionDigits:r,maximumFractionDigits:r})}`}const wo=e=>`${e}%`;function hE({data:e}){const{columns:n,series:r,unit:o}=e,[l,c]=y.useState(null),d=y.useMemo(()=>fE(Math.max(...n.map(T=>T.total))),[n]),f=d[d.length-1],h=d[1]-d[0],m=n.reduce((T,E,b)=>E.total>n[T].total?b:T,0),v=Math.max(1,Math.ceil(n.length/8)),k=n.length,x=T=>{const E={ArrowLeft:-1,ArrowRight:1,Home:-k,End:k};T.key in E&&(T.preventDefault(),c(b=>Math.min(k-1,Math.max(0,(b??k-1)+E[T.key]))))},S=l===null?null:n[l],C=l===null?0:(l+.5)/k*100;return a.jsxs("div",{className:"usage-chart",children:[a.jsxs("div",{className:"usage-chart-head",children:[a.jsx("div",{className:"usage-section-title",children:o==="week"?"Weekly cost (USD)":"Daily cost (USD)"}),r.length>=2&&a.jsx("ul",{className:"usage-legend","aria-label":"Models",children:r.map(T=>a.jsxs("li",{className:"usage-legend-item",children:[a.jsx("span",{className:"usage-swatch",style:{background:xl(T.slot)}}),T.label]},T.slot))})]}),a.jsxs("div",{className:"usage-plot-wrap",children:[a.jsx("div",{className:"usage-yaxis","aria-hidden":"true",children:d.map(T=>a.jsx("span",{className:"usage-ytick",style:{bottom:wo(T/f*100)},children:pE(T,h)},T))}),a.jsxs("div",{className:"usage-plot",role:"group",tabIndex:0,"aria-label":`${o==="week"?"Weekly":"Daily"} cost chart. Arrow keys move between ${o}s.`,onKeyDown:x,onFocus:()=>c(T=>T??k-1),onBlur:()=>c(null),onMouseLeave:()=>c(null),children:[d.map(T=>a.jsx("div",{className:`usage-gridline${T===0?" usage-gridline-base":""}`,style:{bottom:wo(T/f*100)}},T)),a.jsx("div",{className:"usage-cols",children:n.map((T,E)=>a.jsxs("div",{className:`usage-col${l===E?" usage-col-active":""}`,"data-period":T.period,onMouseEnter:()=>c(E),children:[E===m&&T.total>0&&l!==E&&a.jsx("span",{className:"usage-peak",style:{bottom:`calc(${wo(T.total/f*100)} + 3px)`},children:ts(T.total)}),T.total>0&&a.jsx("div",{className:"usage-bar",style:{height:wo(T.total/f*100)},children:T.segments.map(b=>a.jsx("div",{className:"usage-seg",style:{flexGrow:b.cost,background:xl(b.slot)}},b.slot))})]},T.period))}),S&&a.jsxs("div",{className:"usage-tooltip",role:"status",style:{left:wo(C),transform:C<20?"translateX(-12px)":C>80?"translateX(calc(-100% + 12px))":"translateX(-50%)"},children:[a.jsxs("div",{className:"usage-tooltip-head",children:[a.jsx("span",{children:S.label}),a.jsx("strong",{children:ts(S.total)})]}),S.segments.length===0&&a.jsx("div",{className:"usage-tooltip-empty",children:"No usage"}),[...S.segments].sort((T,E)=>E.cost-T.cost).map(T=>a.jsxs("div",{className:"usage-tooltip-line",children:[a.jsx("span",{className:"usage-swatch",style:{background:xl(T.slot)}}),a.jsx("span",{className:"usage-tooltip-model",children:T.label}),a.jsx("span",{children:ts(T.cost)})]},T.slot))]})]}),a.jsx("div",{}),a.jsx("div",{className:"usage-xaxis","aria-hidden":"true",children:n.map((T,E)=>(k-1-E)%v===0?a.jsx("span",{className:"usage-xtick",style:{left:wo((E+.5)/k*100),transform:E===0&&k>1?"translateX(-30%)":E===k-1?"translateX(-70%)":"translateX(-50%)"},children:Fd(T.period)},T.period):null)})]})]})}const Wg=[{id:"daily",label:"Daily",column:"Date"},{id:"weekly",label:"Weekly",column:"Week"},{id:"monthly",label:"Monthly",column:"Month"},{id:"session",label:"Session",column:"Session"}],mE={weekly:"Weeks start on Monday.",session:"Sessions last active in this range, with their whole usage."},hd=50,gE={input_tokens:0,output_tokens:0,cache_creation_tokens:0,cache_read_tokens:0,total_tokens:0,cost_usd:0};function vE(e){return e.reduce((n,r)=>({input_tokens:n.input_tokens+r.input_tokens,output_tokens:n.output_tokens+r.output_tokens,cache_creation_tokens:n.cache_creation_tokens+r.cache_creation_tokens,cache_read_tokens:n.cache_read_tokens+r.cache_read_tokens,total_tokens:n.total_tokens+r.total_tokens,cost_usd:n.cost_usd+r.cost_usd}),gE)}function md({t:e}){return a.jsxs(a.Fragment,{children:[a.jsx("td",{className:"usage-num",children:bo(e.input_tokens)}),a.jsx("td",{className:"usage-num",children:bo(e.output_tokens)}),a.jsx("td",{className:"usage-num",children:bo(e.cache_creation_tokens)}),a.jsx("td",{className:"usage-num",children:bo(e.cache_read_tokens)}),a.jsx("td",{className:"usage-num",children:bo(e.total_tokens)}),a.jsx("td",{className:"usage-num usage-cost",children:ts(e.cost_usd)})]})}function yE({models:e,order:n}){return a.jsx("span",{className:"usage-models",children:e.map(r=>a.jsxs("span",{className:"usage-model",title:r,children:[a.jsx("span",{className:"usage-swatch",style:{background:xl(Jy(r,n))}}),Ef(r)]},r))})}function xE({row:e,onOpen:n}){const r=e.pane_session;if(!r)return a.jsx("span",{className:"usage-session-id usage-session-id-main",title:e.period,children:e.period});const o=r.title||"Untitled session";return a.jsxs("span",{className:"usage-session",children:[a.jsxs("span",{className:"usage-session-title",children:[a.jsx("button",{className:"usage-session-link",title:`Open "${o}"`,onClick:()=>n(r.id),children:o}),r.kind==="discussion"&&a.jsx("span",{className:"usage-tag",children:"discussion"})]}),a.jsx("span",{className:"usage-session-id",title:e.period,children:e.period})]})}function wE({report:e,onOpenSession:n}){var C;const[r,o]=y.useState("daily"),[l,c]=y.useState(!1),[d,f]=y.useState(!1),h=r==="session",m=h?e.sessions:e[r],v=h&&!d?m.slice(0,hd):m,k=h?vE(e.sessions):e.totals,x=h?10:9,S=mE[r];return a.jsxs("div",{className:"usage-table-wrap",children:[a.jsxs("div",{className:"usage-table-head",children:[a.jsx("div",{className:"usage-tabs",role:"tablist","aria-label":"Report",children:Wg.map(T=>a.jsx("button",{role:"tab","aria-selected":r===T.id,className:`usage-tab${r===T.id?" usage-tab-active":""}`,onClick:()=>o(T.id),children:T.label},T.id))}),S&&a.jsx("span",{className:"usage-table-note",children:S}),a.jsxs("label",{className:"usage-check",title:"One line per agent and model, like ccusage --breakdown",children:[a.jsx("input",{type:"checkbox",checked:l,onChange:T=>c(T.target.checked)}),"Breakdown"]})]}),a.jsx("div",{className:"usage-table-scroll",role:"tabpanel",children:a.jsxs("table",{className:"usage-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:(C=Wg.find(T=>T.id===r))==null?void 0:C.column}),a.jsx("th",{children:"Agent"}),a.jsx("th",{children:"Models"}),a.jsx("th",{className:"usage-num",children:"Input"}),a.jsx("th",{className:"usage-num",children:"Output"}),a.jsx("th",{className:"usage-num",children:"Cache Create"}),a.jsx("th",{className:"usage-num",children:"Cache Read"}),a.jsx("th",{className:"usage-num",children:"Total Tokens"}),a.jsx("th",{className:"usage-num",children:"Cost (USD)"}),h&&a.jsx("th",{children:"Last Activity"})]})}),a.jsxs("tbody",{children:[m.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:x,className:"usage-empty",children:"No usage in this range."})}),v.map(T=>{const E=h?T:null;return a.jsxs(y.Fragment,{children:[a.jsxs("tr",{className:"usage-row",children:[a.jsx("td",{className:"usage-period",children:E?a.jsx(xE,{row:E,onOpen:n}):T.period}),a.jsx("td",{children:E?yl(E.agent):T.agents.map(yl).join(", ")}),a.jsx("td",{children:a.jsx(yE,{models:T.models,order:e.model_order})}),a.jsx(md,{t:T}),E&&a.jsx("td",{className:"usage-when",children:E.last_activity?iE(E.last_activity):"—"})]}),l&&T.breakdown.map(b=>a.jsxs("tr",{className:"usage-sub",children:[a.jsx("td",{}),a.jsx("td",{children:yl(b.agent)}),a.jsxs("td",{title:b.model,children:[a.jsx("span",{className:"usage-branch",children:"└─"})," ",Ef(b.model)]}),a.jsx(md,{t:b}),E&&a.jsx("td",{})]},`${b.agent}\0${b.model}`))]},T.period)})]}),m.length>0&&a.jsx("tfoot",{children:a.jsxs("tr",{className:"usage-total",children:[a.jsx("td",{children:"Total"}),a.jsx("td",{}),a.jsx("td",{}),a.jsx(md,{t:k}),h&&a.jsx("td",{})]})})]})}),h&&m.length>hd&&a.jsx("button",{className:"usage-more",onClick:()=>f(T=>!T),children:d?`Show the top ${hd}`:`Show all ${m.length} sessions`})]})}const ex="agentpane:usage-budget",kE=6e4;function SE(){try{const e=Number(localStorage.getItem(ex));return Number.isFinite(e)&&e>0?e:0}catch{return 0}}function bE(e){try{localStorage.setItem(ex,String(e))}catch{}}function NE(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function wl({label:e,value:n,title:r,children:o}){return a.jsxs("div",{className:"usage-kpi",children:[a.jsx("div",{className:"usage-kpi-label",children:e}),a.jsx("div",{className:"usage-kpi-value",title:r,children:n}),o]})}function TE({spent:e}){const[n,r]=y.useState(SE),o=n>0?e/n:0,l=o>=1?"over":o>=.8?"near":"ok",c=d=>{const f=Number(d.replace(",",".")),h=Number.isFinite(f)&&f>0?f:0;r(h),bE(h)};return a.jsxs(wl,{label:"This month",value:ts(e),children:[n>0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:`usage-meter usage-meter-${l}`,role:"meter","aria-label":"Monthly budget used","aria-valuemin":0,"aria-valuemax":n,"aria-valuenow":Math.min(e,n),children:a.jsx("div",{className:"usage-meter-fill",style:{width:`${Math.min(100,o*100)}%`}})}),a.jsx("div",{className:`usage-kpi-sub${l==="over"?" usage-over":""}`,children:l==="over"?a.jsxs(a.Fragment,{children:[a.jsx(ec,{size:11})," ",ts(e-n)," over the ",ts(n)," budget"]}):`${ts(n-e)} left of ${ts(n)}`})]}):a.jsx("div",{className:"usage-kpi-sub",children:"No monthly budget set"}),a.jsxs("div",{className:"usage-budget",children:[a.jsx("label",{htmlFor:"usage-budget-input",children:"Monthly budget (USD)"}),a.jsx("input",{id:"usage-budget-input",type:"number",min:"0",step:"1",defaultValue:n>0?n:"",placeholder:"none",onBlur:d=>c(d.target.value),onKeyDown:d=>{d.key==="Enter"&&c(d.currentTarget.value)}})]})]})}const CE=(e,n)=>e.since===n.since&&e.until===n.until;function EE(){const e=A(P=>P.toggleUsageView),n=A(P=>P.selectSession),[r,o]=y.useState("30d"),[l,c]=y.useState(null),[d,f]=y.useState(null),[h,m]=y.useState(!1),v=y.useMemo(NE,[]),k=y.useRef(0),x=y.useCallback(P=>{const M=++k.current,{since:L,until:G}=Ug(r),z=async U=>{const Q=await sE({since:L,until:G,timezone:v,fresh:U});M===k.current&&(c(Q),f(null),!U&&Q.generated_at&&Date.now()-Date.parse(Q.generated_at)>kE&&await z(!0))};m(!0),z(P).catch(U=>{M===k.current&&f(U.message)}).finally(()=>{M===k.current&&m(!1)})},[r,v]);y.useEffect(()=>{x(!1)},[x]),y.useEffect(()=>()=>{k.current++},[]);const S=P=>{e(),n(P)},C=cc(new Date),T=y.useMemo(()=>l?dE(l,C):null,[l,C]),E=h&&l!==null&&!CE(l.window,Ug(r)),b=l==null?void 0:l.totals,j=l&&l.daily.length>0?jf(l.window.since??l.daily[0].period,l.window.until??C).length:0;return a.jsxs("div",{className:"usage-view",children:[a.jsxs("div",{className:"usage-header",children:[a.jsxs("div",{className:"usage-title",children:[a.jsx(Pv,{size:18})," Usage Center"]}),a.jsxs("div",{className:"usage-controls",children:[rE.map(P=>a.jsx("button",{className:`usage-range-btn${r===P.id?" usage-range-btn-active":""}`,"aria-pressed":r===P.id,onClick:()=>o(P.id),children:P.label},P.id)),a.jsx("button",{className:"usage-range-btn usage-refresh",onClick:()=>x(!0),title:"Read the logs again (runs ccusage)","aria-label":"Refresh",children:a.jsx(Mm,{size:13,className:h?"spin":void 0})}),a.jsx("button",{className:"dialog-close",title:"Close usage view","aria-label":"Close usage view",onClick:e,children:a.jsx(Tn,{size:16})})]})]}),d&&a.jsxs("div",{className:"usage-error",children:["Could not load usage data: ",d]}),!l&&!d&&a.jsxs("div",{className:"usage-loading",children:[a.jsx(Mm,{size:14,className:"spin"})," Reading the Claude Code and Codex logs with ccusage…"]}),l&&b&&a.jsxs("div",{className:`usage-body${E?" usage-body-stale":""}`,"aria-busy":h,children:[l.source.ccusage_error&&a.jsxs("div",{className:"usage-warning",role:"alert",children:[a.jsx(ec,{size:13}),a.jsxs("span",{children:["ccusage could not read the Claude Code and Codex logs, so only Repoburg calls are counted:"," ",l.source.ccusage_error]})]}),a.jsxs("div",{className:"usage-kpis",children:[a.jsx(wl,{label:"Cost (USD)",value:ts(b.cost_usd),children:a.jsx("div",{className:"usage-kpi-sub",children:l.by_agent.length===0?"No usage in this range":l.by_agent.map(P=>`${yl(P.agent)} ${ts(P.cost_usd)}`).join(" · ")})}),a.jsx(TE,{spent:l.month_to_date_cost_usd}),a.jsxs(wl,{label:"Total tokens",value:No(b.total_tokens),title:`${bo(b.total_tokens)} tokens`,children:[a.jsxs("div",{className:"usage-kpi-sub",children:["Input ",No(b.input_tokens)," · Output ",No(b.output_tokens)]}),a.jsxs("div",{className:"usage-kpi-sub",children:["Cache Create ",No(b.cache_creation_tokens)," · Cache Read"," ",No(b.cache_read_tokens)]})]}),a.jsx(wl,{label:"Daily average",value:j>0?ts(b.cost_usd/j):"—",children:a.jsx("div",{className:"usage-kpi-sub",children:j>0?`over ${j} ${j===1?"day":"days"} · ${l.daily.length} with usage`:"No usage in this range"})})]}),T&&a.jsx(hE,{data:T}),a.jsx(wE,{report:l,onOpenSession:S}),l.unpriced_models.length>0&&a.jsxs("div",{className:"usage-note",children:["No price for these Repoburg models, counted as $0: ",l.unpriced_models.join(", ")]}),a.jsxs("div",{className:"usage-source",children:["Claude Code and Codex costs by"," ",a.jsx("a",{href:"https://github.com/ryoppippi/ccusage",target:"_blank",rel:"noreferrer",children:"ccusage"}),l.source.ccusage_version?` ${l.source.ccusage_version}`:""," with LiteLLM prices · Repoburg calls priced by AgentPane · days in ",l.timezone,l.generated_at&&` · logs read ${lE(l.generated_at)}`]})]})]})}const Hg="claude auth login";function jE(){const e=A(f=>Object.keys(f.signedOutTurns).length),n=A(f=>f.terminalViewOpen),r=A(f=>f.toggleTerminalView),o=A(f=>f.addToast),[l,c]=y.useState(!1);if(e===0)return null;const d=()=>{c(!0),ww().catch(f=>o("error",`Could not resume the turns — ${hr(f)}`)).finally(()=>c(!1))};return a.jsxs("div",{className:"signed-out-band",role:"status",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(j1,{size:12})}),a.jsxs("span",{className:"banner-text",children:["Claude is signed out — ",e===1?"1 turn is":`${e} turns are`," waiting. Run"," ",a.jsx("code",{children:Hg})," in a terminal, then resume."]}),a.jsxs("button",{type:"button",className:"banner-action",onClick:()=>void Fi(Hg),children:[a.jsx(Oi,{size:12}),"Copy"]}),!n&&a.jsxs("button",{type:"button",className:"banner-action",onClick:r,children:[a.jsx(Gv,{size:12}),"Open terminal"]}),a.jsxs("button",{type:"button",className:"banner-action",onClick:d,disabled:l,children:[a.jsx(Vv,{size:12}),e===1?"Resume turn":"Resume turns"]})]})}const Vg=/^[a-f0-9]{64}\.(?:png|jpg|gif|webp)$/,_E=/^(?:https?:\/\/[^/?#]+)?\/api\/apps\/([^/?#]+)\/files\/([^/?#]+)$/i,RE={png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp"};function tx(){return mn()||window.location.origin}function nx(e,n){let r=n;if(r&&typeof r=="object"){const d=r;r=typeof d.id=="string"?d.id:d.url}if(typeof r!="string")return null;const o=r.trim();if(Vg.test(o))return o;const l=_E.exec(o);if(!l)return null;let c;try{c=decodeURIComponent(l[1])}catch{return null}return c===e&&Vg.test(l[2])?l[2]:null}function Kg(e){return/^https?:\/\//i.test(e.url)?e:{...e,url:`${tx()}${e.url}`}}function AE(e){return RE[e.slice(e.lastIndexOf(".")+1)]??"application/octet-stream"}function sx(e){return new Promise((n,r)=>{const o=new FileReader;o.onload=()=>{const l=String(o.result??"");n(l.slice(l.indexOf(",")+1))},o.onerror=()=>r(o.error??new Error("Could not read the file")),o.readAsDataURL(e)})}function IE(e,n){const r=/^data:([^;,]*)(?:;[^;,]*)*;base64,/i.exec(e);return r?{type:n||r[1]||void 0,data:e.slice(r[0].length)}:{type:n,data:e}}async function rx(e){if(e instanceof Blob){const n=e.name;return{name:typeof n=="string"&&n?n:void 0,type:e.type||void 0,data:await sx(e)}}if(e&&typeof e=="object"&&typeof e.data=="string"){const n=e;return{name:typeof n.name=="string"&&n.name?n.name:void 0,type:typeof n.type=="string"&&n.type?n.type:void 0,data:n.data}}return null}async function DE(e){const n=await rx(e);if(!n)throw new Error("uploadFile: expected a Blob/File or { name, type, data }");return n}async function ME(e,n,r){if(n==null)return[];if(!Array.isArray(n))throw new Error("submitTurn: attachments must be an array");const o=[];for(let l=0;l<n.length;l++){const c=n[l],d=await rx(c);if(d){const{type:m,data:v}=IE(d.data,d.type);if(!m)throw new Error(`submitTurn: attachment ${l+1} has no type`);o.push({name:d.name??`attachment-${l+1}`,media_type:m,data:v});continue}const f=nx(e,c);if(!f)throw new Error(`submitTurn: attachment ${l+1} is not a file of this app`);const h=await r(f);o.push({name:f,media_type:AE(f),data:await sx(h)})}return o}const LE=`function (config) {
688
688
  var nextId = 1;
689
689
  var pending = new Map();
690
690
  var listeners = [];
@@ -833,9 +833,9 @@ ${j}
833
833
  stack: (r && r.stack) || '', line: 0, col: 0
834
834
  }, '*');
835
835
  });
836
- }`;function LE(e){return`(${ME})(${JSON.stringify(e)});`}function Gg(e){return e.replace(/<\/script/gi,"<\\/script")}function OE(e,n){const r=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(r,"gi");let l=-1,c;for(;(c=o.exec(e))!==null;)l=c.index;return l}function qg(e,n,r){const o=OE(e,n);return o===-1?e+r:e.slice(0,o)+r+e.slice(o)}function $E(e,n,r){let o=e;const l=`<script>${Gg(n)}<\/script>`;if(/<\/head>/i.test(o)?o=qg(o,"</head>",l):/<html[^>]*>/i.test(o)?o=o.replace(/(<html[^>]*>)/i,`$1<head>${l}</head>`):o=`${l}${o}`,r){const c=`<script>${Gg(r)}<\/script>`;o=qg(o,"</body>",c)}return o}function PE(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?`tab-${e.randomUUID()}`:`tab-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function zE(e){var r;if(!(e instanceof Ui)||e.status!==409)return null;const n=(r=e.body)==null?void 0:r.state;return n&&typeof n=="object"?n:null}function FE({appId:e,workspace:n=""}){const r=y.useRef(null),o=y.useRef({pinned:!1,data:null}),[l,c]=y.useState(null),[d,f]=y.useState(null),[h,m]=y.useState([]);y.useEffect(()=>{let S=!0;const C=PE(),T=b=>{const j=o.current.version;typeof b.version=="number"&&typeof j=="number"&&b.version<j||(o.current=b)};Fw(e,b=>{var j,P;return(P=(j=r.current)==null?void 0:j.contentWindow)==null?void 0:P.postMessage(b,"*")},n);const E=async b=>{var z,U,Q,J,oe,me,Se,Me,ee,ie,te,F,Z,q,I,$,ue,B,X,ce,be,_e,Ae,je;if(b.source!==((z=r.current)==null?void 0:z.contentWindow))return;const j=b.data;if(!j||j.source!=="agentpane-app")return;if(j.report==="error"){const ge={message:String(j.message??"Unknown error"),stack:String(j.stack??"")};m(he=>{const Ve=he[he.length-1];return Ve&&Ve.message===ge.message?he:[...he,ge].slice(-20)});return}if(typeof j.method!="string")return;let P=!0,M,L,G=null;try{switch(j.method){case"getApp":M={id:e,workspace:n};break;case"getState":try{const ge=await Cm(e,n);T(ge),M=ge}catch{M=o.current}break;case"setState":{const ge=((U=j.params)==null?void 0:U.data)??null,he=(Q=j.params)==null?void 0:Q.ifVersion,Ve={data:ge,writer:C};typeof he=="number"&&(Ve.ifVersion=he);try{const Ie=await Cv(e,Ve,n);T(Ie),M=Ie}catch(Ie){if(G=zE(Ie),!G)throw Ie;T(G);const mt=Ie.body;throw new Error(typeof(mt==null?void 0:mt.error)=="string"?mt.error:"App state changed since that version")}break}case"createSession":{const ge=j.params??{},he=await Kd({title:typeof ge.title=="string"?ge.title:void 0,runtime_type:typeof ge.runtime_type=="string"?ge.runtime_type:void 0,model:typeof ge.model=="string"?ge.model:void 0,model_reasoning_effort:typeof ge.model_reasoning_effort=="string"?ge.model_reasoning_effort:void 0,cwd:typeof ge.cwd=="string"?ge.cwd:void 0,origin_app_id:e,origin_app_workspace:n});dl(he.id,e),A.getState().addSession(he),M=he;break}case"submitTurn":{const ge=String(((J=j.params)==null?void 0:J.sessionId)??"");if(!await Em(e,ge))throw new Error(`submitTurn: ${ge} is not a session of this app`);const he=String(((oe=j.params)==null?void 0:oe.prompt)??""),Ve=await DE(e,(me=j.params)==null?void 0:me.attachments,mt=>Kk(e,mt)),Ie=await dv(ge,he,Ve.length?Ve:void 0,{originAppId:e});dl(ge,e),M=Ie;break}case"getSession":{M=await Em(e,String(((Se=j.params)==null?void 0:Se.sessionId)??""));break}case"listSessions":{const ge=(Me=j.params)==null?void 0:Me.lifecycle,he=(ee=j.params)==null?void 0:ee.running;M=await Dk(e,n,{lifecycle:ge==="working"||ge==="finished"?ge:void 0,running:typeof he=="boolean"?he:void 0});break}case"getSessionInfo":{M=await Mk(e,n,String(((ie=j.params)==null?void 0:ie.sessionId)??""));break}case"cancelTurn":{M=await Lk(e,String(((te=j.params)==null?void 0:te.sessionId)??""));break}case"setSessionLifecycle":{M=await Ok(e,String(((F=j.params)==null?void 0:F.sessionId)??""),String(((Z=j.params)==null?void 0:Z.lifecycle)??""));break}case"callTool":{const ge=(q=j.params)==null?void 0:q.args;M=await $k(e,n,String(((I=j.params)==null?void 0:I.tool)??""),ge&&typeof ge=="object"?ge:{});break}case"listProviders":{M=await Yy();break}case"listModels":{const ge=typeof(($=j.params)==null?void 0:$.runtime)=="string"?j.params.runtime.trim():"";if(!ge)throw new Error("listModels: runtime is required");const he=(ue=j.params)==null?void 0:ue.cwd;M=await Nv(ge,typeof he=="string"&&he?he:void 0);break}case"pickDirectory":{if(A.getState().activeAppTabId!==e)throw new Error("pickDirectory: the app is not on screen — call it from a click in the app");M=await pv();break}case"resolveToolCall":{const ge=String(((B=j.params)==null?void 0:B.callId)??""),he=(X=j.params)==null?void 0:X.result;await Bk(ge,he),M={ok:!0};break}case"openSession":{if(A.getState().activeAppTabId!==e)throw new Error("openSession: the app is not on screen — call it from a click in the app");const ge=typeof((ce=j.params)==null?void 0:ce.sessionId)=="string"?j.params.sessionId.trim():"";if(!ge)throw new Error("openSession: sessionId is required");try{await A.getState().revealSession(ge)}catch(he){throw new Error(`openSession: ${he instanceof Error?he.message:String(he)}`)}M={ok:!0};break}case"uploadFile":{const ge=await IE((be=j.params)==null?void 0:be.file);try{M=Kg(await Hk(e,ge))}catch(he){throw new Error(`uploadFile: ${he instanceof Error?he.message:String(he)}`)}break}case"getFile":{const ge=nx(e,(_e=j.params)==null?void 0:_e.ref),he=ge?await Vk(e,ge):null;M=he?Kg(he):null;break}default:throw new Error(`Unknown bridge method: ${j.method}`)}}catch(ge){P=!1,L=ge instanceof Error?ge.message:String(ge)}(je=(Ae=r.current)==null?void 0:Ae.contentWindow)==null||je.postMessage(G?{source:"agentpane-host",id:j.id,ok:P,error:L,code:"conflict",state:G}:{source:"agentpane-host",id:j.id,ok:P,result:M,error:L},"*")};return window.addEventListener("message",E),Gw(e,b=>{var j,P;typeof b.workspace=="string"&&b.workspace!==n||b.writer!==C&&((P=(j=r.current)==null?void 0:j.contentWindow)==null||P.postMessage({source:"agentpane-host",event:"state_changed",payload:typeof b.version=="number"?{version:b.version}:{}},"*"))}),Vw(e,()=>{Tm(e).then(b=>{S&&(c(b),m([]))}).catch(()=>{})}),(async()=>{try{const[b,j,P]=await Promise.all([Tm(e),Cm(e,n),Ik(e).catch(()=>[])]);if(!S)return;o.current=j,P.forEach(M=>dl(M.id,e)),c(b)}catch(b){S&&f(b instanceof Error?b.message:String(b))}})(),()=>{S=!1,Uw(e),Kw(e),qw(e),window.removeEventListener("message",E)}},[e,n]),y.useEffect(()=>{l&&Bw(e,l.manifest.headlessSessions===!0)},[e,l]);const v=y.useMemo(()=>l?$E(l.html,LE({appId:e,apiOrigin:tx()}),l.js):"",[l,e]);if(d)return a.jsxs("div",{className:"empty-state",style:{padding:"24px"},children:["Mini app failed to load: ",d]});if(!v)return a.jsx("div",{className:"empty-state",style:{padding:"24px"},children:"Loading mini app…"});const k=(l==null?void 0:l.diagnostics)??[],x=k.some(S=>S.severity==="error");return a.jsxs("div",{className:"miniapp-runtime",children:[k.length>0&&a.jsxs("div",{className:`miniapp-diagnostics${x?"":" miniapp-diagnostics-warn"}`,"data-testid":"miniapp-diagnostics",children:[a.jsx("div",{className:"miniapp-diagnostics-title",children:x?`Compile errors in ${(l==null?void 0:l.sourceFile)??"the app logic"} — the pane serves the last code that parsed:`:"Warnings — the app runs, but fix these:"}),k.map((S,C)=>a.jsxs("div",{className:"miniapp-diag",children:[S.file,":",S.line,":",S.column," — ",S.message]},C))]}),a.jsx("iframe",{ref:r,className:"miniapp-frame",sandbox:"allow-scripts allow-popups allow-popups-to-escape-sandbox",allow:"loopback-network; local-network; local-network-access",title:`Mini app: ${e}`,srcDoc:v}),h.length>0&&a.jsx("div",{className:"miniapp-rt-errors","data-testid":"miniapp-rt-errors",children:h.map((S,C)=>a.jsxs("div",{className:"miniapp-rt-error",children:[a.jsx("div",{className:"miniapp-rt-error-message",children:S.message}),S.stack&&a.jsx("pre",{className:"miniapp-rt-error-stack",children:S.stack})]},C))})]})}function UE({appId:e,active:n}){const r=A(x=>x.apps),o=A(x=>x.workspaces),l=A(x=>x.appWorkspaces),c=A(x=>x.setAppWorkspace),d=A(x=>x.setActiveAppTab),f=A(x=>x.startAppEdit),h=r.find(x=>x.id===e),m=l[e]??"",v=o.filter(x=>x.deleted!==1),k=m!==""&&!v.some(x=>x.path===m)?m:null;return a.jsxs("div",{className:`miniapp-view ${n?"":"miniapp-view-hidden"}`,children:[a.jsxs("div",{className:"miniapp-header",children:[a.jsx(Do,{iconNode:h==null?void 0:h.iconNode,size:14,className:"miniapp-header-icon"}),a.jsx("span",{className:"miniapp-header-title",children:(h==null?void 0:h.title)??e}),a.jsxs("select",{className:"miniapp-workspace-select",title:"Workspace this app instance is bound to (state and pinning are scoped per workspace)",value:m,onChange:x=>c(e,x.target.value),children:[a.jsx("option",{value:"",children:"All workspaces (global)"}),v.map(x=>a.jsx("option",{value:x.path,children:x.label||x.path.split("/").pop()||x.path},x.path)),k&&a.jsx("option",{value:k,children:`${k} (unknown workspace)`})]}),a.jsxs("button",{className:"miniapp-header-btn",title:"Edit this app with the agent (opens an edit session on the app folder)",onClick:()=>void f(e),children:[a.jsx(U1,{size:13}),"Edit"]}),a.jsx("button",{className:"miniapp-header-close",title:"Close app",onClick:()=>d(null),children:a.jsx(Tn,{size:14})})]}),a.jsx("div",{className:"miniapp-body",children:a.jsx(FE,{appId:e,workspace:m},`${e}:${m}`)})]})}function BE({side:e,minWidth:n,maxWidth:r,getWidth:o,setWidth:l}){const[c,d]=y.useState(!1),f=y.useRef(0),h=y.useRef(0),m=y.useCallback(x=>{const S=x.clientX-f.current,C=e==="left"?h.current+S:h.current-S,T=Math.min(r,Math.max(n,C));l(T)},[e,n,r,l]),v=y.useCallback(()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",v),document.body.classList.remove("is-resizing"),d(!1)},[m]);return{onPointerDown:y.useCallback(x=>{var S,C;x.preventDefault(),x.stopPropagation();try{(C=(S=x.currentTarget)==null?void 0:S.setPointerCapture)==null||C.call(S,x.pointerId)}catch{}f.current=x.clientX,h.current=o(),d(!0),document.body.classList.add("is-resizing"),window.addEventListener("pointermove",m),window.addEventListener("pointerup",v)},[o,m,v]),dragging:c}}function Xg({side:e,minWidth:n,maxWidth:r,getWidth:o,setWidth:l}){const{onPointerDown:c,dragging:d}=BE({side:e,minWidth:n,maxWidth:r,getWidth:o,setWidth:l});return a.jsx("div",{className:`resize-handle ${e}${d?" dragging":""}`,onPointerDown:c,role:"separator","aria-orientation":"vertical","aria-label":`Resize ${e} panel`,"data-resizing":d?"":void 0})}const WE=y.lazy(()=>c1(()=>import("./TerminalView-DPvOhRXU.js"),__vite__mapDeps([0,1])));function HE(){Lt.trackRender("IdeWorkspace");const e=A(S=>S.sidebarWidth),n=A(S=>S.rightPanelWidth),r=A(S=>S.setSidebarWidth),o=A(S=>S.setRightPanelWidth),l=A(S=>S.rightPanelCollapsed),c=A(S=>S.vscodeViewOpen),d=A(S=>S.usageViewOpen),f=A(S=>S.terminalViewOpen),[h,m]=y.useState(!1);f&&!h&&m(!0);const v=A(S=>S.activeAppTabId),k=A(S=>S.openAppTabs);y.useEffect(()=>{const S=()=>{const C=bl(),{rightPanelWidth:T,setRightPanelWidth:E}=A.getState();T>C&&E(C)};return window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const x=l?`${e}px 6px 1fr ${Tk}px`:`${e}px 6px 1fr 6px ${n}px`;return a.jsxs("div",{className:"ide-root",children:[a.jsx(EE,{}),a.jsxs("div",{className:`ide-layout ${c||d||f?"ide-hidden":""}`,style:{gridTemplateColumns:x},children:[a.jsx(Qb,{}),a.jsx(Xg,{side:"left",minWidth:yd,maxWidth:xd,getWidth:()=>A.getState().sidebarWidth,setWidth:r}),a.jsxs("div",{className:"ide-center",children:[a.jsx(eN,{}),a.jsxs("div",{className:"ide-render",children:[k.map(S=>a.jsx(UE,{appId:S,active:v===S},S)),v==null&&a.jsx(pC,{})]}),a.jsx(NC,{})]}),!l&&a.jsx(Xg,{side:"right",minWidth:Sl,maxWidth:bl(),getWidth:()=>A.getState().rightPanelWidth,setWidth:o}),a.jsx(KC,{})]}),c&&a.jsx(tE,{}),d&&a.jsx(CE,{}),h&&a.jsx(y.Suspense,{fallback:null,children:a.jsx(WE,{visible:f})}),a.jsx(XC,{})]})}function VE(){const{showNewSessionDialog:e,setShowNewSessionDialog:n,createSession:r,lastModelConfig:o}=A(),l=(o==null?void 0:o.provider)??"codex",c=(o==null?void 0:o.model)??"",d=(o==null?void 0:o.reasoning)??"",[f,h]=y.useState(""),[m,v]=y.useState(c),[k,x]=y.useState(d),[S,C]=y.useState("");if(!e)return null;const T=Cf(l),E=m?$d(l,m):[];function b(){r({title:f.trim()||void 0,model:m||void 0,model_reasoning_effort:k||void 0,cwd:S.trim()||void 0,runtime_type:l}),h(""),C("")}function j(M){M.key==="Escape"&&n(!1)}function P(M){var z;v(M);const L=$d(l,M);L.some(U=>U.effort===k)||x(Pd(l,M)??((z=L[0])==null?void 0:z.effort)??"")}return a.jsx("div",{className:"dialog-overlay",onClick:()=>n(!1),children:a.jsxs("div",{className:"dialog",onClick:M=>M.stopPropagation(),onKeyDown:j,children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"New Session"}),a.jsx("button",{className:"dialog-close",onClick:()=>n(!1),children:a.jsx(Tn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[a.jsxs("label",{className:"dialog-label",children:["Title (optional)",a.jsx("input",{className:"dialog-input",type:"text",value:f,onChange:M=>h(M.target.value),placeholder:"e.g. refactor auth module",autoFocus:!0})]}),a.jsxs("label",{className:"dialog-label",children:["Model",a.jsxs("select",{className:"dialog-input dialog-select",value:m,onChange:M=>P(M.target.value),children:[a.jsx("option",{value:"",children:"Default (Codex picks)"}),T.map(M=>a.jsxs("option",{value:M.slug,children:[M.displayName," — ",M.description]},M.slug))]})]}),E.length>0&&a.jsxs("label",{className:"dialog-label",children:["Thinking Level",a.jsxs("select",{className:"dialog-input dialog-select",value:k,onChange:M=>x(M.target.value),children:[a.jsxs("option",{value:"",children:["Default (",Pd(l,m),")"]}),E.map(M=>a.jsx("option",{value:M.effort,children:M.label},M.effort))]})]}),a.jsxs("label",{className:"dialog-label",children:["Working Directory (optional)",a.jsx("input",{className:"dialog-input",type:"text",value:S,onChange:M=>C(M.target.value),placeholder:"e.g. /Users/me/projects/my-app"})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:()=>n(!1),children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:b,children:"Create"})]})]})})}function KE(e,n){const r=n!==""&&(e===n||e.startsWith(`${n}/`)),o=[r?{label:"~",path:n}:{label:"/",path:"/"}],l=e.slice(r?n.length:0);let c=o[0].path;for(const d of l.split("/").filter(Boolean))c=c==="/"?`/${d}`:`${c}/${d}`,o.push({label:d,path:c});return o}function GE(e){const n=e.filter(l=>l.deleted===0).at(-1);if(!n)return;const r=gr(n.path),o=r.lastIndexOf("/");return o>0?r.slice(0,o):void 0}function qE(){return A(n=>n.showAddWorkspaceDialog)?a.jsx(XE,{}):null}function XE(){var z;const e=A(U=>U.setShowAddWorkspaceDialog),n=A(U=>U.workspaces),r=A(U=>U.createWorkspaceAt),o=A(U=>U.addToast),[l,c]=y.useState(null),[d,f]=y.useState(!0),[h,m]=y.useState(null),[v,k]=y.useState(!1),x=y.useRef(0),[S]=y.useState(()=>GE(A.getState().workspaces)),C=y.useRef(null),T=y.useCallback(()=>{v||e(!1)},[v,e]);Io(T);const E=y.useCallback(async(U,Q=!1)=>{const J=++x.current;f(!0);let oe=null,me=null;try{oe=await am(U)}catch(Se){if(me=hr(Se),Q&&U)try{oe=await am(),me=null}catch(Me){me=hr(Me)}}J===x.current&&(oe&&c(oe),m(me),f(!1))},[]);y.useEffect(()=>{E(S,!0)},[E,S]);const b=l==null?void 0:l.path;y.useEffect(()=>{C.current&&(C.current.scrollTop=0)},[b]);const j=new Set(n.filter(U=>U.deleted===0).map(U=>gr(U.path)));async function P(U){if(!v){k(!0),m(null);try{const Q=await r(U);e(!1),o("success",`Workspace added — ${Q.path}`)}catch(Q){m(hr(Q)),k(!1)}}}const M=l?KE(l.path,l.home):[],L=((z=M.at(-1))==null?void 0:z.label)??"",G=l!==null&&j.has(gr(l.path));return a.jsx("div",{className:"dialog-overlay",onClick:T,children:a.jsxs("div",{className:"dialog folder-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"folder-dialog-title",onClick:U=>U.stopPropagation(),children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",id:"folder-dialog-title",children:"Add workspace"}),a.jsx("button",{className:"dialog-close",onClick:T,"aria-label":"Close",disabled:v,children:a.jsx(Tn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[a.jsxs("p",{className:"dialog-hint",children:["Choose a project folder",l&&a.jsxs(a.Fragment,{children:[" ","on ",a.jsx("strong",{children:l.hostname})]}),"."]}),a.jsxs("div",{className:"folder-nav",children:[a.jsx("button",{className:"folder-up",onClick:()=>(l==null?void 0:l.parent)&&void E(l.parent),disabled:!(l!=null&&l.parent),"aria-label":"Parent folder",title:"Parent folder",children:a.jsx(Mv,{size:14})}),a.jsx("nav",{className:"folder-crumbs","aria-label":"Folder path",children:M.map((U,Q)=>a.jsxs(y.Fragment,{children:[Q>0&&a.jsx(Li,{size:12,className:"folder-crumb-sep","aria-hidden":"true"}),Q===M.length-1?a.jsx("span",{className:"folder-crumb current","aria-current":"location",title:U.path,children:U.label}):a.jsx("button",{className:"folder-crumb",onClick:()=>void E(U.path),title:U.path,children:U.label})]},U.path))}),d&&l&&a.jsx(hn,{size:14,className:"spin folder-spinner","aria-label":"Loading"})]}),a.jsx("ul",{ref:C,className:`folder-list${d&&l?" loading":""}`,"aria-label":"Folders",children:l?l.folders.length===0?a.jsx("li",{className:"folder-empty",children:"No folders here."}):l.folders.map(U=>a.jsxs("li",{className:"folder-item",children:[a.jsxs("button",{className:"folder-row",onClick:()=>void E(U.path),title:U.path,"aria-label":U.git?`${U.name} (git repository)`:U.name,children:[U.git?a.jsx(N1,{size:15,className:"folder-icon git","aria-hidden":"true"}):a.jsx(_l,{size:15,className:"folder-icon","aria-hidden":"true"}),a.jsx("span",{className:"folder-name",children:U.name}),a.jsx(Li,{size:13,className:"folder-chevron","aria-hidden":"true"})]}),j.has(gr(U.path))?a.jsx("span",{className:"folder-tag",children:"Added"}):a.jsx("button",{className:"folder-add",onClick:()=>void P(U.path),disabled:v,"aria-label":`Add ${U.name}`,children:"Add"})]},U.path)):d&&a.jsxs("li",{className:"folder-empty",role:"status",children:[a.jsx(hn,{size:14,className:"spin"})," Loading folders…"]})}),(l==null?void 0:l.truncated)&&a.jsxs("p",{className:"folder-note",children:["Showing the first ",l.folders.length," folders."]}),h&&a.jsx("p",{className:"folder-error",role:"alert",children:h})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:T,disabled:v,children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:()=>l&&void P(l.path),disabled:!l||d||v||G,children:v?"Adding…":G?"Already added":`Add “${L}”`})]})]})})}const Fd=6e4,Ud=60*Fd,ul=24*Ud;function YE(e,n=Date.now()){const r=Date.parse(e);if(Number.isNaN(r))return"";const o=Math.max(0,n-r);return o<Fd?"just now":o<Ud?`${Math.floor(o/Fd)} min ago`:o<ul?`${Math.floor(o/Ud)} h ago`:o<2*ul?"yesterday":o<7*ul?`${Math.floor(o/ul)} days ago`:new Date(r).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function QE(){const e=A(n=>n.importSessionsWorkspace);return e?a.jsx(ZE,{workspace:e},e):null}function ZE({workspace:e}){const n=A(z=>z.setImportSessionsWorkspace),r=A(z=>z.importSessions),[o,l]=y.useState(null),[c,d]=y.useState(null),[f,h]=y.useState({}),[m,v]=y.useState(new Set),[k,x]=y.useState(!1),[S,C]=y.useState(new Map),T=y.useCallback(()=>{k||n(null)},[k,n]);Io(T),y.useEffect(()=>{let z=!1;return bv(e).then(({sessions:U,errors:Q})=>{if(z)return;const J=Object.values(Q);if(J.length===vd.length){d([...new Set(J)].join("; "));return}l(U),h(Q)}).catch(U=>{z||d(hr(U))}),()=>{z=!0}},[e]);function E(z){v(U=>{const Q=new Set(U);return Q.has(z)?Q.delete(z):Q.add(z),Q})}const b=o??[],j=z=>Xu({runtime:z.runtime,id:z.session_id}),P=b.length>0&&b.every(z=>m.has(j(z)));async function M(){const z=b.filter(J=>m.has(j(J))).map(J=>({runtime:J.runtime,id:J.session_id}));if(z.length===0)return;x(!0);const{failed:U}=await r(e,z);if(x(!1),U.length===0){n(null);return}const Q=new Set(U.map(Xu));l(J=>(J??[]).filter(oe=>!m.has(j(oe))||Q.has(j(oe)))),v(Q),C(new Map(U.map(J=>[Xu(J),J.error])))}const L=e.split("/").pop()||e,G=m.size;return a.jsx("div",{className:"dialog-overlay",onClick:T,children:a.jsxs("div",{className:"dialog import-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"import-dialog-title",onClick:z=>z.stopPropagation(),children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",id:"import-dialog-title",children:"Import sessions"}),a.jsx("button",{className:"dialog-close",onClick:T,"aria-label":"Close",disabled:k,children:a.jsx(Tn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[a.jsxs("p",{className:"dialog-hint",children:["Sessions you started with ",a.jsx("code",{children:"claude"})," or ",a.jsx("code",{children:"codex"})," in"," ",a.jsx("strong",{title:e,children:L}),", in a terminal or an IDE. An imported session keeps its history and continues the same conversation."]}),c?a.jsxs("p",{className:"import-error",role:"alert",children:["Could not list the sessions — ",c]}):o===null?a.jsxs("div",{className:"import-loading",role:"status",children:[a.jsx(hn,{size:14,className:"spin"})," Looking for sessions…"]}):o.length===0?a.jsxs("div",{className:"import-empty",children:["No Claude Code or Codex sessions to import here. Sessions you start with ",a.jsx("code",{children:"claude"})," or"," ",a.jsx("code",{children:"codex"})," in this folder will show up here.",a.jsx(Yg,{errors:f})]}):a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"import-select-all",children:[a.jsx("input",{type:"checkbox",checked:P,disabled:k,onChange:()=>v(P?new Set:new Set(b.map(j)))}),"Select all (",o.length,")"]}),a.jsx("ul",{className:"import-list",children:o.map(z=>{const U=j(z),Q=S.get(U);return a.jsx("li",{children:a.jsxs("label",{className:`import-row${m.has(U)?" selected":""}`,children:[a.jsx("input",{type:"checkbox",checked:m.has(U),disabled:k,onChange:()=>E(U)}),a.jsxs("span",{className:"import-row-main",children:[a.jsx("span",{className:"import-row-title",title:z.title,children:z.title}),a.jsxs("span",{className:"import-row-meta",children:[a.jsx("span",{className:`import-row-runtime ${z.runtime}`,children:Xl[z.runtime]}),a.jsx("span",{title:new Date(z.last_modified).toLocaleString(),children:YE(z.last_modified)}),z.git_branch&&a.jsxs("span",{className:"import-row-branch",title:"Git branch",children:[a.jsx(zv,{size:10})," ",z.git_branch]})]}),z.recently_active&&a.jsxs("span",{className:"import-row-warn",children:[a.jsx(Jl,{size:11})," Active in the last few minutes. If it is still open in a terminal, close it there first: both would write to the same session."]}),Q&&a.jsx("span",{className:"import-row-error",role:"alert",children:Q})]})]})},U)})}),a.jsx(Yg,{errors:f})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:T,disabled:k,children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:()=>void M(),disabled:G===0||k,children:k?a.jsxs(a.Fragment,{children:[a.jsx(hn,{size:12,className:"spin"})," Importing…"]}):G>1?`Import ${G} sessions`:"Import"})]})]})})}function Yg({errors:e}){const n=Object.entries(e);return n.length===0?null:a.jsx(a.Fragment,{children:n.map(([r,o])=>a.jsxs("p",{className:"import-note",children:["Could not list the ",Xl[r]," sessions — ",o]},r))})}const JE=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,ej=512*1024;function tj(e){const n=e.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"");return/^[a-z0-9]/.test(n)?n:""}function nj(){const{appCatalogOpen:e,closeAppCatalog:n,apps:r,installExampleApp:o,createSkeletonApp:l,importAppFolder:c}=A(),[d,f]=y.useState("examples"),[h,m]=y.useState(null),[v,k]=y.useState(null),[x,S]=y.useState(!1),[C,T]=y.useState(""),[E,b]=y.useState(""),[j,P]=y.useState(""),[M,L]=y.useState(""),[G,z]=y.useState(null),[U,Q]=y.useState(""),J=y.useRef(null);if(y.useEffect(()=>{e&&(m(null),Pk().then(m).catch(()=>m([])))},[e]),y.useEffect(()=>{J.current&&(J.current.webkitdirectory=!0)},[d]),!e)return null;const oe=new Set(r.map(F=>F.id));async function me(F){k(F);try{await o(F)&&n()}finally{k(null)}}async function Se(){if(x)return;const F=C.trim(),Z=E.trim();if(!(!F||!Z)){S(!0);try{await l({id:F,title:Z,description:j.trim()||void 0,icon:M.trim()||void 0})&&(T(""),b(""),P(""),L(""),n())}finally{S(!1)}}}async function Me(F){const Z=Array.from(F.target.files??[]),q={};let I="";for(const $ of Z){const B=($.webkitRelativePath??"").split("/");!I&&B.length>1&&(I=B[0]);const X=B[B.length-1];if(!(!X||!JE.test(X))&&!($.size>ej))try{q[X]=await $.text()}catch{}}z(Object.keys(q).length>0?q:null),Q(tj(I))}async function ee(){if(!(x||!G||!U.trim())){S(!0);try{await c(U.trim(),G)&&(z(null),Q(""),n())}finally{S(!1)}}}function ie(F){F.key==="Escape"&&n()}const te=[{key:"examples",label:"Examples"},{key:"new",label:"New App"},{key:"upload",label:"Upload"}];return a.jsx("div",{className:"dialog-overlay",onClick:n,children:a.jsxs("div",{className:"dialog app-catalog",onClick:F=>F.stopPropagation(),onKeyDown:ie,children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"Add Mini App"}),a.jsx("button",{className:"dialog-close",onClick:n,children:"✕"})]}),a.jsx("div",{className:"catalog-tabs",children:te.map(F=>a.jsx("button",{className:`catalog-tab${d===F.key?" active":""}`,onClick:()=>f(F.key),children:F.label},F.key))}),a.jsxs("div",{className:"dialog-body catalog-body",children:[d==="examples"&&a.jsx("div",{className:"catalog-examples",children:h===null?a.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"Loading examples…"}):h.length===0?a.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"No example apps available."}):h.map(F=>{const Z=oe.has(F.id);return a.jsxs("div",{className:"example-row",children:[a.jsx(Do,{iconNode:F.iconNode,size:14,className:"sidebar-app-icon"}),a.jsxs("div",{className:"example-info",children:[a.jsx("span",{className:"example-title",children:F.title}),F.description&&a.jsx("span",{className:"example-desc",children:F.description})]}),a.jsx("button",{className:"example-install",disabled:Z||v===F.id,onClick:()=>me(F.id),title:Z?"Already installed":"Install this example",children:Z?"Installed":v===F.id?"Installing…":"Install"})]},F.id)})}),d==="new"&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["App id (folder name)",a.jsx("input",{className:"dialog-input",type:"text",value:C,onChange:F=>T(F.target.value),placeholder:"e.g. todo-list",autoFocus:!0})]}),a.jsxs("label",{className:"dialog-label",children:["Title",a.jsx("input",{className:"dialog-input",type:"text",value:E,onChange:F=>b(F.target.value),placeholder:"e.g. Todo List"})]}),a.jsxs("label",{className:"dialog-label",children:["Description (optional)",a.jsx("input",{className:"dialog-input",type:"text",value:j,onChange:F=>P(F.target.value),placeholder:"What does this app do?"})]}),a.jsxs("label",{className:"dialog-label",children:[a.jsxs("span",{children:["Icon (optional, a"," ",a.jsx("a",{href:"https://lucide.dev/icons",target:"_blank",rel:"noreferrer",children:"Lucide icon"})," ","name)"]}),a.jsx("input",{className:"dialog-input",type:"text",value:M,onChange:F=>L(F.target.value),placeholder:"e.g. notebook-pen",spellCheck:!1,autoCapitalize:"off"})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:x||!C.trim()||!E.trim(),onClick:Se,children:[a.jsx(pr,{size:13})," Create App"]})]}),d==="upload"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"catalog-upload-hint",children:"Select an app folder from disk. Text files only (manifest.json, index.html, app.ts (or legacy app.js), …). A missing manifest.json is generated from the folder name."}),a.jsx("input",{ref:J,type:"file",multiple:!0,onChange:Me}),G&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["App id",a.jsx("input",{className:"dialog-input",type:"text",value:U,onChange:F=>Q(F.target.value)})]}),a.jsxs("div",{className:"catalog-upload-summary",children:[Object.keys(G).length," file(s):"," ",Object.keys(G).slice(0,6).join(", "),Object.keys(G).length>6?", …":""]})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:x||!G||!U.trim(),onClick:ee,children:[a.jsx(q1,{size:13})," Import App"]})]})]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:n,children:"Close"})})]})})}function sj(){const e=A(k=>k.showCommandPalette),n=A(k=>k.setShowCommandPalette),r=A(),[o,l]=y.useState(""),[c,d]=y.useState(0),f=y.useRef(null),h=y.useMemo(()=>{const k=r.activeSessionId?r.sessionDetails[r.activeSessionId]:null,x=Kl(k);return[{id:"new-session",label:"New Session",hint:"Create a new Codex session",icon:pr,action:()=>r.setShowNewSessionDialog(!0),available:!0},{id:"delete-session",label:"Delete Session",hint:"Delete the active session",icon:us,action:()=>{r.activeSessionId&&r.deleteSession(r.activeSessionId)},available:!!r.activeSessionId},{id:"send-message",label:"Send Message",hint:"Focus the message input",icon:Hi,action:()=>{const S=document.querySelector(".cmd-input");S==null||S.focus()},available:!!r.activeSessionId&&!x},{id:"cancel-turn",label:"Cancel Turn",hint:"Cancel the running turn",icon:yr,action:()=>r.cancelTurn(),available:x},{id:"tab-turns",label:"Switch to Turns Tab",hint:"View conversation timeline",icon:I1,action:()=>r.switchRightTab("turns"),available:!!r.activeSessionId},{id:"tab-sidecar",label:"Ask Sidecar",hint:"Ask about this session — status, blockers, what is left",icon:vr,action:()=>r.switchRightTab("sidecar"),available:!!r.activeSessionId},{id:"toggle-right-panel",label:"Toggle Right Panel",hint:r.rightPanelCollapsed?"Expand the right panel":"Collapse the right panel to its icon rail",icon:z1,action:()=>r.toggleRightPanel(),available:!0},{id:"close-tab",label:"Close Tab",hint:"Close the active session tab",icon:Tn,action:()=>{r.activeSessionId&&r.closeTab(r.activeSessionId)},available:!!r.activeSessionId}]},[r]),m=y.useMemo(()=>{const k=o.toLowerCase().trim(),x=h.filter(S=>S.available);return k?x.filter(S=>S.label.toLowerCase().includes(k)||S.hint.toLowerCase().includes(k)):x},[h,o]);y.useEffect(()=>{e&&(l(""),d(0),setTimeout(()=>{var k;return(k=f.current)==null?void 0:k.focus()},50))},[e]);function v(k){if(k.key==="ArrowDown")k.preventDefault(),d(x=>Math.min(x+1,m.length-1));else if(k.key==="ArrowUp")k.preventDefault(),d(x=>Math.max(x-1,0));else if(k.key==="Enter"){k.preventDefault();const x=m[c];x&&(x.action(),n(!1))}else k.key==="Escape"&&n(!1)}return e?a.jsx("div",{className:"palette-overlay",onClick:()=>n(!1),children:a.jsxs("div",{className:"palette",onClick:k=>k.stopPropagation(),children:[a.jsxs("div",{className:"palette-search",children:[a.jsx("input",{ref:f,type:"text",placeholder:"Type a command…",value:o,onChange:k=>{l(k.target.value),d(0)},onKeyDown:v}),a.jsx("span",{className:"palette-esc",children:"ESC"})]}),m.length===0?a.jsx("div",{className:"palette-empty",children:"No matching commands"}):a.jsx("div",{className:"palette-list",children:m.map((k,x)=>{const S=k.icon;return a.jsxs("div",{className:`palette-item ${x===c?"selected":""}`,onClick:()=>{k.action(),n(!1)},onMouseEnter:()=>d(x),children:[a.jsx("span",{className:"palette-item-icon",children:a.jsx(S,{size:16})}),a.jsx("span",{className:"palette-item-label",children:k.label}),a.jsx("span",{className:"palette-item-hint",children:k.hint}),x===c&&a.jsx(S1,{size:12,className:"palette-item-enter"})]},k.id)})}),a.jsxs("div",{className:"palette-footer",children:[a.jsxs("span",{className:"palette-footer-hint",children:[a.jsx("span",{className:"kbd",children:"↑"}),a.jsx("span",{className:"kbd",children:"↓"})," Navigate"]}),a.jsxs("span",{className:"palette-footer-hint",children:[a.jsx("span",{className:"kbd",children:"↵"})," Select"]}),a.jsxs("span",{className:"palette-footer-hint",children:[a.jsx("span",{className:"kbd",children:"Esc"})," Close"]})]})]})}):null}const Qg=/^[a-z][a-z0-9-]{1,30}$/,rj=2e3;function oj(){const{showRemoteModal:e,setShowRemoteModal:n,selectSession:r}=A(),[o,l]=y.useState(null),[c,d]=y.useState(null),[f,h]=y.useState(!1),[m,v]=y.useState(!1),[k,x]=y.useState(!1),[S,C]=y.useState(!1),[T,E]=y.useState("main"),[b,j]=y.useState(""),[P,M]=y.useState(!1),[L,G]=y.useState(null),z=y.useRef(null);Wi(z,()=>C(!1),S);const U=m||k,Q=y.useCallback(async()=>{h(!0),d(null);try{const F=await fetch(`${mn()}/remote/status`,{headers:{Accept:"application/json"}});if(!F.ok)throw new Error(`status ${F.status}`);l(await F.json())}catch{l(null),d("Machine management is only available from this machine's local pane.")}finally{h(!1)}},[]);y.useEffect(()=>{e&&(E("main"),G(null),Q())},[e,Q]);const J=L!==null&&L.state==="running";if(y.useEffect(()=>{if(!J)return;const F=setInterval(async()=>{try{const Z=await fetch(`${mn()}/remote/enable`,{headers:{Accept:"application/json"}});Z.ok&&G(await Z.json())}catch{}},rj);return()=>clearInterval(F)},[J]),!e)return null;const oe=!!(o!=null&&o.tunnel.provisioned)&&!!(o!=null&&o.service.running)&&!!(o!=null&&o.connection.ok);function me(F){F.key==="Escape"&&n(!1)}async function Se(F){if(Qg.test(F)){M(!0);try{const Z=await fetch(`${mn()}/remote/enable`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mahlas:F})});if(!Z.ok)throw new Error(`enable ${Z.status}`);G(await Z.json()),E("setup")}catch{d("Could not start the setup — check the daemon logs.")}finally{M(!1)}}}function Me(){L!=null&&L.troubleshootingSessionId&&(r(L.troubleshootingSessionId),n(!1))}async function ee(){v(!0);try{await fetch(`${mn()}/remote/disable`,{method:"POST"}),await Q()}catch{d("Could not stop the tunnel service — check the service logs.")}finally{v(!1)}}async function ie(){if(C(!1),!!window.confirm(`Remove the tunnel completely?
836
+ }`;function OE(e){return`(${LE})(${JSON.stringify(e)});`}function Gg(e){return e.replace(/<\/script/gi,"<\\/script")}function $E(e,n){const r=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(r,"gi");let l=-1,c;for(;(c=o.exec(e))!==null;)l=c.index;return l}function qg(e,n,r){const o=$E(e,n);return o===-1?e+r:e.slice(0,o)+r+e.slice(o)}function PE(e,n,r){let o=e;const l=`<script>${Gg(n)}<\/script>`;if(/<\/head>/i.test(o)?o=qg(o,"</head>",l):/<html[^>]*>/i.test(o)?o=o.replace(/(<html[^>]*>)/i,`$1<head>${l}</head>`):o=`${l}${o}`,r){const c=`<script>${Gg(r)}<\/script>`;o=qg(o,"</body>",c)}return o}function zE(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?`tab-${e.randomUUID()}`:`tab-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function FE(e){var r;if(!(e instanceof Ui)||e.status!==409)return null;const n=(r=e.body)==null?void 0:r.state;return n&&typeof n=="object"?n:null}function UE({appId:e,workspace:n=""}){const r=y.useRef(null),o=y.useRef({pinned:!1,data:null}),[l,c]=y.useState(null),[d,f]=y.useState(null),[h,m]=y.useState([]);y.useEffect(()=>{let S=!0;const C=zE(),T=b=>{const j=o.current.version;typeof b.version=="number"&&typeof j=="number"&&b.version<j||(o.current=b)};Uw(e,b=>{var j,P;return(P=(j=r.current)==null?void 0:j.contentWindow)==null?void 0:P.postMessage(b,"*")},n);const E=async b=>{var z,U,Q,J,oe,me,Se,Me,ee,ie,te,F,Z,q,I,$,ue,B,X,ce,be,_e,Ae,je;if(b.source!==((z=r.current)==null?void 0:z.contentWindow))return;const j=b.data;if(!j||j.source!=="agentpane-app")return;if(j.report==="error"){const ge={message:String(j.message??"Unknown error"),stack:String(j.stack??"")};m(he=>{const Ve=he[he.length-1];return Ve&&Ve.message===ge.message?he:[...he,ge].slice(-20)});return}if(typeof j.method!="string")return;let P=!0,M,L,G=null;try{switch(j.method){case"getApp":M={id:e,workspace:n};break;case"getState":try{const ge=await Cm(e,n);T(ge),M=ge}catch{M=o.current}break;case"setState":{const ge=((U=j.params)==null?void 0:U.data)??null,he=(Q=j.params)==null?void 0:Q.ifVersion,Ve={data:ge,writer:C};typeof he=="number"&&(Ve.ifVersion=he);try{const Ie=await Cv(e,Ve,n);T(Ie),M=Ie}catch(Ie){if(G=FE(Ie),!G)throw Ie;T(G);const mt=Ie.body;throw new Error(typeof(mt==null?void 0:mt.error)=="string"?mt.error:"App state changed since that version")}break}case"createSession":{const ge=j.params??{},he=await Kd({title:typeof ge.title=="string"?ge.title:void 0,runtime_type:typeof ge.runtime_type=="string"?ge.runtime_type:void 0,model:typeof ge.model=="string"?ge.model:void 0,model_reasoning_effort:typeof ge.model_reasoning_effort=="string"?ge.model_reasoning_effort:void 0,cwd:typeof ge.cwd=="string"?ge.cwd:void 0,origin_app_id:e,origin_app_workspace:n});dl(he.id,e),A.getState().addSession(he),M=he;break}case"submitTurn":{const ge=String(((J=j.params)==null?void 0:J.sessionId)??"");if(!await Em(e,ge))throw new Error(`submitTurn: ${ge} is not a session of this app`);const he=String(((oe=j.params)==null?void 0:oe.prompt)??""),Ve=await ME(e,(me=j.params)==null?void 0:me.attachments,mt=>Gk(e,mt)),Ie=await dv(ge,he,Ve.length?Ve:void 0,{originAppId:e});dl(ge,e),M=Ie;break}case"getSession":{M=await Em(e,String(((Se=j.params)==null?void 0:Se.sessionId)??""));break}case"listSessions":{const ge=(Me=j.params)==null?void 0:Me.lifecycle,he=(ee=j.params)==null?void 0:ee.running;M=await Mk(e,n,{lifecycle:ge==="working"||ge==="finished"?ge:void 0,running:typeof he=="boolean"?he:void 0});break}case"getSessionInfo":{M=await Lk(e,n,String(((ie=j.params)==null?void 0:ie.sessionId)??""));break}case"cancelTurn":{M=await Ok(e,String(((te=j.params)==null?void 0:te.sessionId)??""));break}case"setSessionLifecycle":{M=await $k(e,String(((F=j.params)==null?void 0:F.sessionId)??""),String(((Z=j.params)==null?void 0:Z.lifecycle)??""));break}case"callTool":{const ge=(q=j.params)==null?void 0:q.args;M=await Pk(e,n,String(((I=j.params)==null?void 0:I.tool)??""),ge&&typeof ge=="object"?ge:{});break}case"listProviders":{M=await Yy();break}case"listModels":{const ge=typeof(($=j.params)==null?void 0:$.runtime)=="string"?j.params.runtime.trim():"";if(!ge)throw new Error("listModels: runtime is required");const he=(ue=j.params)==null?void 0:ue.cwd;M=await Nv(ge,typeof he=="string"&&he?he:void 0);break}case"pickDirectory":{if(A.getState().activeAppTabId!==e)throw new Error("pickDirectory: the app is not on screen — call it from a click in the app");M=await pv();break}case"resolveToolCall":{const ge=String(((B=j.params)==null?void 0:B.callId)??""),he=(X=j.params)==null?void 0:X.result;await Wk(ge,he),M={ok:!0};break}case"openSession":{if(A.getState().activeAppTabId!==e)throw new Error("openSession: the app is not on screen — call it from a click in the app");const ge=typeof((ce=j.params)==null?void 0:ce.sessionId)=="string"?j.params.sessionId.trim():"";if(!ge)throw new Error("openSession: sessionId is required");try{await A.getState().revealSession(ge)}catch(he){throw new Error(`openSession: ${he instanceof Error?he.message:String(he)}`)}M={ok:!0};break}case"uploadFile":{const ge=await DE((be=j.params)==null?void 0:be.file);try{M=Kg(await Vk(e,ge))}catch(he){throw new Error(`uploadFile: ${he instanceof Error?he.message:String(he)}`)}break}case"getFile":{const ge=nx(e,(_e=j.params)==null?void 0:_e.ref),he=ge?await Kk(e,ge):null;M=he?Kg(he):null;break}default:throw new Error(`Unknown bridge method: ${j.method}`)}}catch(ge){P=!1,L=ge instanceof Error?ge.message:String(ge)}(je=(Ae=r.current)==null?void 0:Ae.contentWindow)==null||je.postMessage(G?{source:"agentpane-host",id:j.id,ok:P,error:L,code:"conflict",state:G}:{source:"agentpane-host",id:j.id,ok:P,result:M,error:L},"*")};return window.addEventListener("message",E),qw(e,b=>{var j,P;typeof b.workspace=="string"&&b.workspace!==n||b.writer!==C&&((P=(j=r.current)==null?void 0:j.contentWindow)==null||P.postMessage({source:"agentpane-host",event:"state_changed",payload:typeof b.version=="number"?{version:b.version}:{}},"*"))}),Kw(e,()=>{Tm(e).then(b=>{S&&(c(b),m([]))}).catch(()=>{})}),(async()=>{try{const[b,j,P]=await Promise.all([Tm(e),Cm(e,n),Dk(e).catch(()=>[])]);if(!S)return;o.current=j,P.forEach(M=>dl(M.id,e)),c(b)}catch(b){S&&f(b instanceof Error?b.message:String(b))}})(),()=>{S=!1,Bw(e),Gw(e),Xw(e),window.removeEventListener("message",E)}},[e,n]),y.useEffect(()=>{l&&Ww(e,l.manifest.headlessSessions===!0)},[e,l]);const v=y.useMemo(()=>l?PE(l.html,OE({appId:e,apiOrigin:tx()}),l.js):"",[l,e]);if(d)return a.jsxs("div",{className:"empty-state",style:{padding:"24px"},children:["Mini app failed to load: ",d]});if(!v)return a.jsx("div",{className:"empty-state",style:{padding:"24px"},children:"Loading mini app…"});const k=(l==null?void 0:l.diagnostics)??[],x=k.some(S=>S.severity==="error");return a.jsxs("div",{className:"miniapp-runtime",children:[k.length>0&&a.jsxs("div",{className:`miniapp-diagnostics${x?"":" miniapp-diagnostics-warn"}`,"data-testid":"miniapp-diagnostics",children:[a.jsx("div",{className:"miniapp-diagnostics-title",children:x?`Compile errors in ${(l==null?void 0:l.sourceFile)??"the app logic"} — the pane serves the last code that parsed:`:"Warnings — the app runs, but fix these:"}),k.map((S,C)=>a.jsxs("div",{className:"miniapp-diag",children:[S.file,":",S.line,":",S.column," — ",S.message]},C))]}),a.jsx("iframe",{ref:r,className:"miniapp-frame",sandbox:"allow-scripts allow-popups allow-popups-to-escape-sandbox",allow:"loopback-network; local-network; local-network-access",title:`Mini app: ${e}`,srcDoc:v}),h.length>0&&a.jsx("div",{className:"miniapp-rt-errors","data-testid":"miniapp-rt-errors",children:h.map((S,C)=>a.jsxs("div",{className:"miniapp-rt-error",children:[a.jsx("div",{className:"miniapp-rt-error-message",children:S.message}),S.stack&&a.jsx("pre",{className:"miniapp-rt-error-stack",children:S.stack})]},C))})]})}function BE({appId:e,active:n}){const r=A(x=>x.apps),o=A(x=>x.workspaces),l=A(x=>x.appWorkspaces),c=A(x=>x.setAppWorkspace),d=A(x=>x.setActiveAppTab),f=A(x=>x.startAppEdit),h=r.find(x=>x.id===e),m=l[e]??"",v=o.filter(x=>x.deleted!==1),k=m!==""&&!v.some(x=>x.path===m)?m:null;return a.jsxs("div",{className:`miniapp-view ${n?"":"miniapp-view-hidden"}`,children:[a.jsxs("div",{className:"miniapp-header",children:[a.jsx(Do,{iconNode:h==null?void 0:h.iconNode,size:14,className:"miniapp-header-icon"}),a.jsx("span",{className:"miniapp-header-title",children:(h==null?void 0:h.title)??e}),a.jsxs("select",{className:"miniapp-workspace-select",title:"Workspace this app instance is bound to (state and pinning are scoped per workspace)",value:m,onChange:x=>c(e,x.target.value),children:[a.jsx("option",{value:"",children:"All workspaces (global)"}),v.map(x=>a.jsx("option",{value:x.path,children:x.label||x.path.split("/").pop()||x.path},x.path)),k&&a.jsx("option",{value:k,children:`${k} (unknown workspace)`})]}),a.jsxs("button",{className:"miniapp-header-btn",title:"Edit this app with the agent (opens an edit session on the app folder)",onClick:()=>void f(e),children:[a.jsx(B1,{size:13}),"Edit"]}),a.jsx("button",{className:"miniapp-header-close",title:"Close app",onClick:()=>d(null),children:a.jsx(Tn,{size:14})})]}),a.jsx("div",{className:"miniapp-body",children:a.jsx(UE,{appId:e,workspace:m},`${e}:${m}`)})]})}function WE({side:e,minWidth:n,maxWidth:r,getWidth:o,setWidth:l}){const[c,d]=y.useState(!1),f=y.useRef(0),h=y.useRef(0),m=y.useCallback(x=>{const S=x.clientX-f.current,C=e==="left"?h.current+S:h.current-S,T=Math.min(r,Math.max(n,C));l(T)},[e,n,r,l]),v=y.useCallback(()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",v),document.body.classList.remove("is-resizing"),d(!1)},[m]);return{onPointerDown:y.useCallback(x=>{var S,C;x.preventDefault(),x.stopPropagation();try{(C=(S=x.currentTarget)==null?void 0:S.setPointerCapture)==null||C.call(S,x.pointerId)}catch{}f.current=x.clientX,h.current=o(),d(!0),document.body.classList.add("is-resizing"),window.addEventListener("pointermove",m),window.addEventListener("pointerup",v)},[o,m,v]),dragging:c}}function Xg({side:e,minWidth:n,maxWidth:r,getWidth:o,setWidth:l}){const{onPointerDown:c,dragging:d}=WE({side:e,minWidth:n,maxWidth:r,getWidth:o,setWidth:l});return a.jsx("div",{className:`resize-handle ${e}${d?" dragging":""}`,onPointerDown:c,role:"separator","aria-orientation":"vertical","aria-label":`Resize ${e} panel`,"data-resizing":d?"":void 0})}const HE=y.lazy(()=>u1(()=>import("./TerminalView-CldV8OPX.js"),__vite__mapDeps([0,1])));function VE(){Lt.trackRender("IdeWorkspace");const e=A(S=>S.sidebarWidth),n=A(S=>S.rightPanelWidth),r=A(S=>S.setSidebarWidth),o=A(S=>S.setRightPanelWidth),l=A(S=>S.rightPanelCollapsed),c=A(S=>S.vscodeViewOpen),d=A(S=>S.usageViewOpen),f=A(S=>S.terminalViewOpen),[h,m]=y.useState(!1);f&&!h&&m(!0);const v=A(S=>S.activeAppTabId),k=A(S=>S.openAppTabs);y.useEffect(()=>{const S=()=>{const C=Nl(),{rightPanelWidth:T,setRightPanelWidth:E}=A.getState();T>C&&E(C)};return window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const x=l?`${e}px 6px 1fr ${Ck}px`:`${e}px 6px 1fr 6px ${n}px`;return a.jsxs("div",{className:"ide-root",children:[a.jsx(jE,{}),a.jsxs("div",{className:`ide-layout ${c||d||f?"ide-hidden":""}`,style:{gridTemplateColumns:x},children:[a.jsx(Zb,{}),a.jsx(Xg,{side:"left",minWidth:xd,maxWidth:wd,getWidth:()=>A.getState().sidebarWidth,setWidth:r}),a.jsxs("div",{className:"ide-center",children:[a.jsx(tN,{}),a.jsxs("div",{className:"ide-render",children:[k.map(S=>a.jsx(BE,{appId:S,active:v===S},S)),v==null&&a.jsx(hC,{})]}),a.jsx(TC,{})]}),!l&&a.jsx(Xg,{side:"right",minWidth:bl,maxWidth:Nl(),getWidth:()=>A.getState().rightPanelWidth,setWidth:o}),a.jsx(GC,{})]}),c&&a.jsx(nE,{}),d&&a.jsx(EE,{}),h&&a.jsx(y.Suspense,{fallback:null,children:a.jsx(HE,{visible:f})}),a.jsx(YC,{})]})}function KE(){const{showNewSessionDialog:e,setShowNewSessionDialog:n,createSession:r,lastModelConfig:o}=A(),l=(o==null?void 0:o.provider)??"codex",c=(o==null?void 0:o.model)??"",d=(o==null?void 0:o.reasoning)??"",[f,h]=y.useState(""),[m,v]=y.useState(c),[k,x]=y.useState(d),[S,C]=y.useState("");if(!e)return null;const T=Cf(l),E=m?Pd(l,m):[];function b(){r({title:f.trim()||void 0,model:m||void 0,model_reasoning_effort:k||void 0,cwd:S.trim()||void 0,runtime_type:l}),h(""),C("")}function j(M){M.key==="Escape"&&n(!1)}function P(M){var z;v(M);const L=Pd(l,M);L.some(U=>U.effort===k)||x(zd(l,M)??((z=L[0])==null?void 0:z.effort)??"")}return a.jsx("div",{className:"dialog-overlay",onClick:()=>n(!1),children:a.jsxs("div",{className:"dialog",onClick:M=>M.stopPropagation(),onKeyDown:j,children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"New Session"}),a.jsx("button",{className:"dialog-close",onClick:()=>n(!1),children:a.jsx(Tn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[a.jsxs("label",{className:"dialog-label",children:["Title (optional)",a.jsx("input",{className:"dialog-input",type:"text",value:f,onChange:M=>h(M.target.value),placeholder:"e.g. refactor auth module",autoFocus:!0})]}),a.jsxs("label",{className:"dialog-label",children:["Model",a.jsxs("select",{className:"dialog-input dialog-select",value:m,onChange:M=>P(M.target.value),children:[a.jsx("option",{value:"",children:"Default (Codex picks)"}),T.map(M=>a.jsxs("option",{value:M.slug,children:[M.displayName," — ",M.description]},M.slug))]})]}),E.length>0&&a.jsxs("label",{className:"dialog-label",children:["Thinking Level",a.jsxs("select",{className:"dialog-input dialog-select",value:k,onChange:M=>x(M.target.value),children:[a.jsxs("option",{value:"",children:["Default (",zd(l,m),")"]}),E.map(M=>a.jsx("option",{value:M.effort,children:M.label},M.effort))]})]}),a.jsxs("label",{className:"dialog-label",children:["Working Directory (optional)",a.jsx("input",{className:"dialog-input",type:"text",value:S,onChange:M=>C(M.target.value),placeholder:"e.g. /Users/me/projects/my-app"})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:()=>n(!1),children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:b,children:"Create"})]})]})})}function GE(e,n){const r=n!==""&&(e===n||e.startsWith(`${n}/`)),o=[r?{label:"~",path:n}:{label:"/",path:"/"}],l=e.slice(r?n.length:0);let c=o[0].path;for(const d of l.split("/").filter(Boolean))c=c==="/"?`/${d}`:`${c}/${d}`,o.push({label:d,path:c});return o}function qE(e){const n=e.filter(l=>l.deleted===0).at(-1);if(!n)return;const r=gr(n.path),o=r.lastIndexOf("/");return o>0?r.slice(0,o):void 0}function XE(){return A(n=>n.showAddWorkspaceDialog)?a.jsx(YE,{}):null}function YE(){var z;const e=A(U=>U.setShowAddWorkspaceDialog),n=A(U=>U.workspaces),r=A(U=>U.createWorkspaceAt),o=A(U=>U.addToast),[l,c]=y.useState(null),[d,f]=y.useState(!0),[h,m]=y.useState(null),[v,k]=y.useState(!1),x=y.useRef(0),[S]=y.useState(()=>qE(A.getState().workspaces)),C=y.useRef(null),T=y.useCallback(()=>{v||e(!1)},[v,e]);Io(T);const E=y.useCallback(async(U,Q=!1)=>{const J=++x.current;f(!0);let oe=null,me=null;try{oe=await am(U)}catch(Se){if(me=hr(Se),Q&&U)try{oe=await am(),me=null}catch(Me){me=hr(Me)}}J===x.current&&(oe&&c(oe),m(me),f(!1))},[]);y.useEffect(()=>{E(S,!0)},[E,S]);const b=l==null?void 0:l.path;y.useEffect(()=>{C.current&&(C.current.scrollTop=0)},[b]);const j=new Set(n.filter(U=>U.deleted===0).map(U=>gr(U.path)));async function P(U){if(!v){k(!0),m(null);try{const Q=await r(U);e(!1),o("success",`Workspace added — ${Q.path}`)}catch(Q){m(hr(Q)),k(!1)}}}const M=l?GE(l.path,l.home):[],L=((z=M.at(-1))==null?void 0:z.label)??"",G=l!==null&&j.has(gr(l.path));return a.jsx("div",{className:"dialog-overlay",onClick:T,children:a.jsxs("div",{className:"dialog folder-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"folder-dialog-title",onClick:U=>U.stopPropagation(),children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",id:"folder-dialog-title",children:"Add workspace"}),a.jsx("button",{className:"dialog-close",onClick:T,"aria-label":"Close",disabled:v,children:a.jsx(Tn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[a.jsxs("p",{className:"dialog-hint",children:["Choose a project folder",l&&a.jsxs(a.Fragment,{children:[" ","on ",a.jsx("strong",{children:l.hostname})]}),"."]}),a.jsxs("div",{className:"folder-nav",children:[a.jsx("button",{className:"folder-up",onClick:()=>(l==null?void 0:l.parent)&&void E(l.parent),disabled:!(l!=null&&l.parent),"aria-label":"Parent folder",title:"Parent folder",children:a.jsx(Mv,{size:14})}),a.jsx("nav",{className:"folder-crumbs","aria-label":"Folder path",children:M.map((U,Q)=>a.jsxs(y.Fragment,{children:[Q>0&&a.jsx(Li,{size:12,className:"folder-crumb-sep","aria-hidden":"true"}),Q===M.length-1?a.jsx("span",{className:"folder-crumb current","aria-current":"location",title:U.path,children:U.label}):a.jsx("button",{className:"folder-crumb",onClick:()=>void E(U.path),title:U.path,children:U.label})]},U.path))}),d&&l&&a.jsx(hn,{size:14,className:"spin folder-spinner","aria-label":"Loading"})]}),a.jsx("ul",{ref:C,className:`folder-list${d&&l?" loading":""}`,"aria-label":"Folders",children:l?l.folders.length===0?a.jsx("li",{className:"folder-empty",children:"No folders here."}):l.folders.map(U=>a.jsxs("li",{className:"folder-item",children:[a.jsxs("button",{className:"folder-row",onClick:()=>void E(U.path),title:U.path,"aria-label":U.git?`${U.name} (git repository)`:U.name,children:[U.git?a.jsx(T1,{size:15,className:"folder-icon git","aria-hidden":"true"}):a.jsx(Rl,{size:15,className:"folder-icon","aria-hidden":"true"}),a.jsx("span",{className:"folder-name",children:U.name}),a.jsx(Li,{size:13,className:"folder-chevron","aria-hidden":"true"})]}),j.has(gr(U.path))?a.jsx("span",{className:"folder-tag",children:"Added"}):a.jsx("button",{className:"folder-add",onClick:()=>void P(U.path),disabled:v,"aria-label":`Add ${U.name}`,children:"Add"})]},U.path)):d&&a.jsxs("li",{className:"folder-empty",role:"status",children:[a.jsx(hn,{size:14,className:"spin"})," Loading folders…"]})}),(l==null?void 0:l.truncated)&&a.jsxs("p",{className:"folder-note",children:["Showing the first ",l.folders.length," folders."]}),h&&a.jsx("p",{className:"folder-error",role:"alert",children:h})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:T,disabled:v,children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:()=>l&&void P(l.path),disabled:!l||d||v||G,children:v?"Adding…":G?"Already added":`Add “${L}”`})]})]})})}const Ud=6e4,Bd=60*Ud,ul=24*Bd;function QE(e,n=Date.now()){const r=Date.parse(e);if(Number.isNaN(r))return"";const o=Math.max(0,n-r);return o<Ud?"just now":o<Bd?`${Math.floor(o/Ud)} min ago`:o<ul?`${Math.floor(o/Bd)} h ago`:o<2*ul?"yesterday":o<7*ul?`${Math.floor(o/ul)} days ago`:new Date(r).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function ZE(){const e=A(n=>n.importSessionsWorkspace);return e?a.jsx(JE,{workspace:e},e):null}function JE({workspace:e}){const n=A(z=>z.setImportSessionsWorkspace),r=A(z=>z.importSessions),[o,l]=y.useState(null),[c,d]=y.useState(null),[f,h]=y.useState({}),[m,v]=y.useState(new Set),[k,x]=y.useState(!1),[S,C]=y.useState(new Map),T=y.useCallback(()=>{k||n(null)},[k,n]);Io(T),y.useEffect(()=>{let z=!1;return bv(e).then(({sessions:U,errors:Q})=>{if(z)return;const J=Object.values(Q);if(J.length===yd.length){d([...new Set(J)].join("; "));return}l(U),h(Q)}).catch(U=>{z||d(hr(U))}),()=>{z=!0}},[e]);function E(z){v(U=>{const Q=new Set(U);return Q.has(z)?Q.delete(z):Q.add(z),Q})}const b=o??[],j=z=>Yu({runtime:z.runtime,id:z.session_id}),P=b.length>0&&b.every(z=>m.has(j(z)));async function M(){const z=b.filter(J=>m.has(j(J))).map(J=>({runtime:J.runtime,id:J.session_id}));if(z.length===0)return;x(!0);const{failed:U}=await r(e,z);if(x(!1),U.length===0){n(null);return}const Q=new Set(U.map(Yu));l(J=>(J??[]).filter(oe=>!m.has(j(oe))||Q.has(j(oe)))),v(Q),C(new Map(U.map(J=>[Yu(J),J.error])))}const L=e.split("/").pop()||e,G=m.size;return a.jsx("div",{className:"dialog-overlay",onClick:T,children:a.jsxs("div",{className:"dialog import-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"import-dialog-title",onClick:z=>z.stopPropagation(),children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",id:"import-dialog-title",children:"Import sessions"}),a.jsx("button",{className:"dialog-close",onClick:T,"aria-label":"Close",disabled:k,children:a.jsx(Tn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[a.jsxs("p",{className:"dialog-hint",children:["Sessions you started with ",a.jsx("code",{children:"claude"})," or ",a.jsx("code",{children:"codex"})," in"," ",a.jsx("strong",{title:e,children:L}),", in a terminal or an IDE. An imported session keeps its history and continues the same conversation."]}),c?a.jsxs("p",{className:"import-error",role:"alert",children:["Could not list the sessions — ",c]}):o===null?a.jsxs("div",{className:"import-loading",role:"status",children:[a.jsx(hn,{size:14,className:"spin"})," Looking for sessions…"]}):o.length===0?a.jsxs("div",{className:"import-empty",children:["No Claude Code or Codex sessions to import here. Sessions you start with ",a.jsx("code",{children:"claude"})," or"," ",a.jsx("code",{children:"codex"})," in this folder will show up here.",a.jsx(Yg,{errors:f})]}):a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"import-select-all",children:[a.jsx("input",{type:"checkbox",checked:P,disabled:k,onChange:()=>v(P?new Set:new Set(b.map(j)))}),"Select all (",o.length,")"]}),a.jsx("ul",{className:"import-list",children:o.map(z=>{const U=j(z),Q=S.get(U);return a.jsx("li",{children:a.jsxs("label",{className:`import-row${m.has(U)?" selected":""}`,children:[a.jsx("input",{type:"checkbox",checked:m.has(U),disabled:k,onChange:()=>E(U)}),a.jsxs("span",{className:"import-row-main",children:[a.jsx("span",{className:"import-row-title",title:z.title,children:z.title}),a.jsxs("span",{className:"import-row-meta",children:[a.jsx("span",{className:`import-row-runtime ${z.runtime}`,children:Yl[z.runtime]}),a.jsx("span",{title:new Date(z.last_modified).toLocaleString(),children:QE(z.last_modified)}),z.git_branch&&a.jsxs("span",{className:"import-row-branch",title:"Git branch",children:[a.jsx(zv,{size:10})," ",z.git_branch]})]}),z.recently_active&&a.jsxs("span",{className:"import-row-warn",children:[a.jsx(ec,{size:11})," Active in the last few minutes. If it is still open in a terminal, close it there first: both would write to the same session."]}),Q&&a.jsx("span",{className:"import-row-error",role:"alert",children:Q})]})]})},U)})}),a.jsx(Yg,{errors:f})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:T,disabled:k,children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:()=>void M(),disabled:G===0||k,children:k?a.jsxs(a.Fragment,{children:[a.jsx(hn,{size:12,className:"spin"})," Importing…"]}):G>1?`Import ${G} sessions`:"Import"})]})]})})}function Yg({errors:e}){const n=Object.entries(e);return n.length===0?null:a.jsx(a.Fragment,{children:n.map(([r,o])=>a.jsxs("p",{className:"import-note",children:["Could not list the ",Yl[r]," sessions — ",o]},r))})}const ej=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,tj=512*1024;function nj(e){const n=e.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"");return/^[a-z0-9]/.test(n)?n:""}function sj(){const{appCatalogOpen:e,closeAppCatalog:n,apps:r,installExampleApp:o,createSkeletonApp:l,importAppFolder:c}=A(),[d,f]=y.useState("examples"),[h,m]=y.useState(null),[v,k]=y.useState(null),[x,S]=y.useState(!1),[C,T]=y.useState(""),[E,b]=y.useState(""),[j,P]=y.useState(""),[M,L]=y.useState(""),[G,z]=y.useState(null),[U,Q]=y.useState(""),J=y.useRef(null);if(y.useEffect(()=>{e&&(m(null),zk().then(m).catch(()=>m([])))},[e]),y.useEffect(()=>{J.current&&(J.current.webkitdirectory=!0)},[d]),!e)return null;const oe=new Set(r.map(F=>F.id));async function me(F){k(F);try{await o(F)&&n()}finally{k(null)}}async function Se(){if(x)return;const F=C.trim(),Z=E.trim();if(!(!F||!Z)){S(!0);try{await l({id:F,title:Z,description:j.trim()||void 0,icon:M.trim()||void 0})&&(T(""),b(""),P(""),L(""),n())}finally{S(!1)}}}async function Me(F){const Z=Array.from(F.target.files??[]),q={};let I="";for(const $ of Z){const B=($.webkitRelativePath??"").split("/");!I&&B.length>1&&(I=B[0]);const X=B[B.length-1];if(!(!X||!ej.test(X))&&!($.size>tj))try{q[X]=await $.text()}catch{}}z(Object.keys(q).length>0?q:null),Q(nj(I))}async function ee(){if(!(x||!G||!U.trim())){S(!0);try{await c(U.trim(),G)&&(z(null),Q(""),n())}finally{S(!1)}}}function ie(F){F.key==="Escape"&&n()}const te=[{key:"examples",label:"Examples"},{key:"new",label:"New App"},{key:"upload",label:"Upload"}];return a.jsx("div",{className:"dialog-overlay",onClick:n,children:a.jsxs("div",{className:"dialog app-catalog",onClick:F=>F.stopPropagation(),onKeyDown:ie,children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"Add Mini App"}),a.jsx("button",{className:"dialog-close",onClick:n,children:"✕"})]}),a.jsx("div",{className:"catalog-tabs",children:te.map(F=>a.jsx("button",{className:`catalog-tab${d===F.key?" active":""}`,onClick:()=>f(F.key),children:F.label},F.key))}),a.jsxs("div",{className:"dialog-body catalog-body",children:[d==="examples"&&a.jsx("div",{className:"catalog-examples",children:h===null?a.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"Loading examples…"}):h.length===0?a.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"No example apps available."}):h.map(F=>{const Z=oe.has(F.id);return a.jsxs("div",{className:"example-row",children:[a.jsx(Do,{iconNode:F.iconNode,size:14,className:"sidebar-app-icon"}),a.jsxs("div",{className:"example-info",children:[a.jsx("span",{className:"example-title",children:F.title}),F.description&&a.jsx("span",{className:"example-desc",children:F.description})]}),a.jsx("button",{className:"example-install",disabled:Z||v===F.id,onClick:()=>me(F.id),title:Z?"Already installed":"Install this example",children:Z?"Installed":v===F.id?"Installing…":"Install"})]},F.id)})}),d==="new"&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["App id (folder name)",a.jsx("input",{className:"dialog-input",type:"text",value:C,onChange:F=>T(F.target.value),placeholder:"e.g. todo-list",autoFocus:!0})]}),a.jsxs("label",{className:"dialog-label",children:["Title",a.jsx("input",{className:"dialog-input",type:"text",value:E,onChange:F=>b(F.target.value),placeholder:"e.g. Todo List"})]}),a.jsxs("label",{className:"dialog-label",children:["Description (optional)",a.jsx("input",{className:"dialog-input",type:"text",value:j,onChange:F=>P(F.target.value),placeholder:"What does this app do?"})]}),a.jsxs("label",{className:"dialog-label",children:[a.jsxs("span",{children:["Icon (optional, a"," ",a.jsx("a",{href:"https://lucide.dev/icons",target:"_blank",rel:"noreferrer",children:"Lucide icon"})," ","name)"]}),a.jsx("input",{className:"dialog-input",type:"text",value:M,onChange:F=>L(F.target.value),placeholder:"e.g. notebook-pen",spellCheck:!1,autoCapitalize:"off"})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:x||!C.trim()||!E.trim(),onClick:Se,children:[a.jsx(pr,{size:13})," Create App"]})]}),d==="upload"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"catalog-upload-hint",children:"Select an app folder from disk. Text files only (manifest.json, index.html, app.ts (or legacy app.js), …). A missing manifest.json is generated from the folder name."}),a.jsx("input",{ref:J,type:"file",multiple:!0,onChange:Me}),G&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["App id",a.jsx("input",{className:"dialog-input",type:"text",value:U,onChange:F=>Q(F.target.value)})]}),a.jsxs("div",{className:"catalog-upload-summary",children:[Object.keys(G).length," file(s):"," ",Object.keys(G).slice(0,6).join(", "),Object.keys(G).length>6?", …":""]})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:x||!G||!U.trim(),onClick:ee,children:[a.jsx(X1,{size:13})," Import App"]})]})]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:n,children:"Close"})})]})})}function rj(){const e=A(k=>k.showCommandPalette),n=A(k=>k.setShowCommandPalette),r=A(),[o,l]=y.useState(""),[c,d]=y.useState(0),f=y.useRef(null),h=y.useMemo(()=>{const k=r.activeSessionId?r.sessionDetails[r.activeSessionId]:null,x=Gl(k);return[{id:"new-session",label:"New Session",hint:"Create a new Codex session",icon:pr,action:()=>r.setShowNewSessionDialog(!0),available:!0},{id:"delete-session",label:"Delete Session",hint:"Delete the active session",icon:us,action:()=>{r.activeSessionId&&r.deleteSession(r.activeSessionId)},available:!!r.activeSessionId},{id:"send-message",label:"Send Message",hint:"Focus the message input",icon:Hi,action:()=>{const S=document.querySelector(".cmd-input");S==null||S.focus()},available:!!r.activeSessionId&&!x},{id:"cancel-turn",label:"Cancel Turn",hint:"Cancel the running turn",icon:yr,action:()=>r.cancelTurn(),available:x},{id:"tab-turns",label:"Switch to Turns Tab",hint:"View conversation timeline",icon:D1,action:()=>r.switchRightTab("turns"),available:!!r.activeSessionId},{id:"tab-sidecar",label:"Ask Sidecar",hint:"Ask about this session — status, blockers, what is left",icon:vr,action:()=>r.switchRightTab("sidecar"),available:!!r.activeSessionId},{id:"toggle-right-panel",label:"Toggle Right Panel",hint:r.rightPanelCollapsed?"Expand the right panel":"Collapse the right panel to its icon rail",icon:F1,action:()=>r.toggleRightPanel(),available:!0},{id:"close-tab",label:"Close Tab",hint:"Close the active session tab",icon:Tn,action:()=>{r.activeSessionId&&r.closeTab(r.activeSessionId)},available:!!r.activeSessionId}]},[r]),m=y.useMemo(()=>{const k=o.toLowerCase().trim(),x=h.filter(S=>S.available);return k?x.filter(S=>S.label.toLowerCase().includes(k)||S.hint.toLowerCase().includes(k)):x},[h,o]);y.useEffect(()=>{e&&(l(""),d(0),setTimeout(()=>{var k;return(k=f.current)==null?void 0:k.focus()},50))},[e]);function v(k){if(k.key==="ArrowDown")k.preventDefault(),d(x=>Math.min(x+1,m.length-1));else if(k.key==="ArrowUp")k.preventDefault(),d(x=>Math.max(x-1,0));else if(k.key==="Enter"){k.preventDefault();const x=m[c];x&&(x.action(),n(!1))}else k.key==="Escape"&&n(!1)}return e?a.jsx("div",{className:"palette-overlay",onClick:()=>n(!1),children:a.jsxs("div",{className:"palette",onClick:k=>k.stopPropagation(),children:[a.jsxs("div",{className:"palette-search",children:[a.jsx("input",{ref:f,type:"text",placeholder:"Type a command…",value:o,onChange:k=>{l(k.target.value),d(0)},onKeyDown:v}),a.jsx("span",{className:"palette-esc",children:"ESC"})]}),m.length===0?a.jsx("div",{className:"palette-empty",children:"No matching commands"}):a.jsx("div",{className:"palette-list",children:m.map((k,x)=>{const S=k.icon;return a.jsxs("div",{className:`palette-item ${x===c?"selected":""}`,onClick:()=>{k.action(),n(!1)},onMouseEnter:()=>d(x),children:[a.jsx("span",{className:"palette-item-icon",children:a.jsx(S,{size:16})}),a.jsx("span",{className:"palette-item-label",children:k.label}),a.jsx("span",{className:"palette-item-hint",children:k.hint}),x===c&&a.jsx(b1,{size:12,className:"palette-item-enter"})]},k.id)})}),a.jsxs("div",{className:"palette-footer",children:[a.jsxs("span",{className:"palette-footer-hint",children:[a.jsx("span",{className:"kbd",children:"↑"}),a.jsx("span",{className:"kbd",children:"↓"})," Navigate"]}),a.jsxs("span",{className:"palette-footer-hint",children:[a.jsx("span",{className:"kbd",children:"↵"})," Select"]}),a.jsxs("span",{className:"palette-footer-hint",children:[a.jsx("span",{className:"kbd",children:"Esc"})," Close"]})]})]})}):null}const Qg=/^[a-z][a-z0-9-]{1,30}$/,oj=2e3;function ij(){const{showRemoteModal:e,setShowRemoteModal:n,selectSession:r}=A(),[o,l]=y.useState(null),[c,d]=y.useState(null),[f,h]=y.useState(!1),[m,v]=y.useState(!1),[k,x]=y.useState(!1),[S,C]=y.useState(!1),[T,E]=y.useState("main"),[b,j]=y.useState(""),[P,M]=y.useState(!1),[L,G]=y.useState(null),z=y.useRef(null);Wi(z,()=>C(!1),S);const U=m||k,Q=y.useCallback(async()=>{h(!0),d(null);try{const F=await fetch(`${mn()}/remote/status`,{headers:{Accept:"application/json"}});if(!F.ok)throw new Error(`status ${F.status}`);l(await F.json())}catch{l(null),d("Machine management is only available from this machine's local pane.")}finally{h(!1)}},[]);y.useEffect(()=>{e&&(E("main"),G(null),Q())},[e,Q]);const J=L!==null&&L.state==="running";if(y.useEffect(()=>{if(!J)return;const F=setInterval(async()=>{try{const Z=await fetch(`${mn()}/remote/enable`,{headers:{Accept:"application/json"}});Z.ok&&G(await Z.json())}catch{}},oj);return()=>clearInterval(F)},[J]),!e)return null;const oe=!!(o!=null&&o.tunnel.provisioned)&&!!(o!=null&&o.service.running)&&!!(o!=null&&o.connection.ok);function me(F){F.key==="Escape"&&n(!1)}async function Se(F){if(Qg.test(F)){M(!0);try{const Z=await fetch(`${mn()}/remote/enable`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mahlas:F})});if(!Z.ok)throw new Error(`enable ${Z.status}`);G(await Z.json()),E("setup")}catch{d("Could not start the setup — check the daemon logs.")}finally{M(!1)}}}function Me(){L!=null&&L.troubleshootingSessionId&&(r(L.troubleshootingSessionId),n(!1))}async function ee(){v(!0);try{await fetch(`${mn()}/remote/disable`,{method:"POST"}),await Q()}catch{d("Could not stop the tunnel service — check the service logs.")}finally{v(!1)}}async function ie(){if(C(!1),!!window.confirm(`Remove the tunnel completely?
837
837
 
838
838
  This deletes the Cloudflare tunnel, its DNS record and Access app, and this machine's remote state. The mahlas is released.
839
839
 
840
- This cannot be undone.`)){x(!0);try{const Z=await fetch(`${mn()}/remote/uninstall`,{method:"DELETE"});if(!Z.ok)throw new Error(`uninstall ${Z.status}`);await Q()}catch{d("Could not remove the tunnel — check the daemon logs.")}finally{x(!1)}}}function te(){if(!L)return a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["Machine name (mahlas)",a.jsx("input",{className:"dialog-input",value:b,onChange:I=>j(I.target.value.toLowerCase()),placeholder:"my-macbook",autoFocus:!0})]}),a.jsx("div",{className:"dialog-label",style:{opacity:.7,marginTop:-4},children:"The machine will be reachable at https://<name>.repoburg.com"}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:()=>E("main"),children:"Back"}),a.jsxs("button",{className:"dialog-btn-create",disabled:!Qg.test(b)||P,onClick:()=>void Se(b),children:[P?a.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Start setup"]})]})]});const F=["detect","provision","install","verify","ready"],Z=F.indexOf(L.step),q=L.state==="ready";return a.jsxs(a.Fragment,{children:[L.state==="running"&&a.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(hn,{size:14,className:"spin"})," Setting up the remote tunnel…"]}),L.state==="ready"&&a.jsxs("div",{className:"dialog-label",style:{color:"var(--green)",display:"flex",alignItems:"center",gap:6},children:[a.jsx(Cs,{size:14})," Setup complete — you can close this window."]}),L.state==="ready"&&L.hostname&&a.jsxs("div",{className:"dialog-label",children:["This machine is accessible at"," ",a.jsx("a",{href:`https://${L.hostname}`,target:"_blank",rel:"noreferrer",children:L.hostname})]}),a.jsx("ol",{className:"dialog-label",style:{margin:"4px 0",paddingLeft:0,listStyle:"none"},children:F.map((I,$)=>{const ue=q||Z>-1&&$<Z,B=!q&&$===Z&&L.state==="running";return a.jsxs("li",{style:{display:"flex",alignItems:"center",gap:6,opacity:ue||B?1:.4,color:ue?"var(--green)":void 0},children:[ue?a.jsx(Cs,{size:13}):B?a.jsx(hn,{size:13,className:"spin"}):a.jsx(w1,{size:9,style:{marginLeft:2,marginRight:2}}),I]},I)})}),L.logs.length>0&&a.jsx("div",{className:"dialog-label",style:{opacity:.7,fontSize:12,whiteSpace:"pre-wrap"},children:L.logs.slice(-3).map(I=>I.message).join(`
841
- `)}),L.state==="troubleshooting"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"dialog-label",style:{color:"var(--red)"},children:"Setup failed — a troubleshooting session is open and the agent is working on the fix in the background."}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-create",onClick:Me,children:"Open troubleshooting session"})})]}),L.state==="failed"&&a.jsxs("div",{className:"dialog-label",style:{color:"var(--red)"},children:["Setup failed: ",L.error]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:()=>void Q(),children:"Refresh status"})})]})}return a.jsx("div",{className:"dialog-overlay",onClick:()=>n(!1),children:a.jsxs("div",{className:"dialog",onClick:F=>F.stopPropagation(),onKeyDown:me,children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"Remote Access"}),a.jsx("button",{className:"dialog-close",onClick:()=>n(!1),children:a.jsx(Tn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[f&&a.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(hn,{size:14,className:"spin"})," Loading machine status…"]}),c&&a.jsx("div",{className:"dialog-label",style:{color:"var(--red)"},children:c}),T==="setup"?te():a.jsxs(a.Fragment,{children:[oe&&(o==null?void 0:o.tunnel.hostname)&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"dialog-label",children:["This machine is reachable at"," ",a.jsx("a",{href:`https://${o.tunnel.hostname}`,target:"_blank",rel:"noreferrer",children:o.tunnel.hostname})]}),a.jsxs("div",{style:{position:"relative",display:"flex",marginTop:8},children:[a.jsxs("button",{className:"dialog-btn-cancel",style:{flex:1,borderTopRightRadius:0,borderBottomRightRadius:0},onClick:()=>void ee(),disabled:U,children:[m?a.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Stop tunnel connection"]}),a.jsx("button",{className:"dialog-btn-cancel",style:{width:30,borderLeft:"none",borderTopLeftRadius:0,borderBottomLeftRadius:0,display:"inline-flex",alignItems:"center",justifyContent:"center"},onClick:()=>C(F=>!F),disabled:U,"aria-label":"More tunnel actions","aria-haspopup":"menu","aria-expanded":S,children:k?a.jsx(hn,{size:14,className:"spin"}):a.jsx(_o,{size:14})}),S&&a.jsx("div",{ref:z,className:"ctx-menu",role:"menu",style:{position:"absolute",right:0,top:"calc(100% + 4px)",zIndex:10},children:a.jsxs("div",{className:"ctx-menu-item ctx-danger",role:"menuitem",onClick:()=>void ie(),children:[a.jsx(us,{size:12})," Remove tunnel"]})})]})]}),!oe&&a.jsx(a.Fragment,{children:o!=null&&o.tunnel.provisioned&&o.tunnel.mahlas&&o.tunnel.hostname?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"dialog-label",children:["Tunnel exists as"," ",a.jsx("a",{href:`https://${o.tunnel.hostname}`,target:"_blank",rel:"noreferrer",children:o.tunnel.hostname})," ","but the connection is stopped."]}),a.jsxs("button",{className:"dialog-btn-create",style:{width:"100%"},onClick:()=>void Se(o.tunnel.mahlas),disabled:P,children:[P?a.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):a.jsx(Dm,{size:16,style:{verticalAlign:"middle",marginRight:6}}),"Resume tunnel connection"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:"dialog-btn-create",style:{width:"100%"},onClick:()=>E("setup"),children:[a.jsx(Dm,{size:16,style:{verticalAlign:"middle",marginRight:6}}),"Make this machine remote"]}),a.jsx("div",{className:"dialog-label",style:{opacity:.7,marginTop:-4},children:"The daemon sets everything up and shows the progress here."})]})})]})]})]})})}const ij={success:y1,error:Ql,info:C1,warn:Jl},aj=4e3;function lj({toast:e}){const n=A(d=>d.removeToast),r=ij[e.type],o=y.useRef(null);y.useEffect(()=>{function d(){o.current=setTimeout(()=>n(e.id),aj)}return d(),()=>{o.current&&clearTimeout(o.current)}},[e.id,n]);function l(){o.current&&(clearTimeout(o.current),o.current=null)}function c(){o.current=setTimeout(()=>n(e.id),2e3)}return a.jsxs("div",{className:`toast toast-${e.type}`,onMouseEnter:l,onMouseLeave:c,children:[a.jsx(r,{size:16}),a.jsx("span",{className:"toast-message",children:e.message}),e.undoAction&&a.jsxs("button",{className:"toast-undo",onClick:()=>{var d;(d=e.undoAction)==null||d.call(e),n(e.id)},children:[a.jsx(G1,{size:12})," ",e.undoLabel||"Undo"]}),a.jsx("button",{className:"toast-close",onClick:()=>n(e.id),children:a.jsx(Tn,{size:14})})]})}function cj(){const e=A(n=>n.toasts);return e.length===0?null:a.jsx("div",{className:"toast-container",children:e.map(n=>a.jsx(lj,{toast:n},n.id))})}function uj(){const[e]=y.useState(xk),[n,r]=y.useState(!1),[o,l]=y.useState(!1),c=y.useRef(void 0);y.useEffect(()=>()=>clearTimeout(c.current),[]);async function d(){await Fi(ym)&&(r(!0),l(!0),clearTimeout(c.current),c.current=setTimeout(()=>r(!1),1500))}return a.jsxs("main",{className:"daemon-download",children:[a.jsx("h1",{className:"daemon-download-title",children:"Repoburg"}),e&&a.jsx("p",{className:"daemon-download-text",children:"Open the Repoburg app to continue."}),a.jsxs("div",{className:"daemon-download-install",children:[e&&a.jsx("p",{className:"daemon-download-label",children:"Not installed? Run this in Terminal:"}),a.jsxs("div",{className:"daemon-download-cmd",onCopy:()=>l(!0),children:[a.jsx("span",{className:"daemon-download-prompt","aria-hidden":"true",children:"$"}),a.jsx("code",{children:ym}),a.jsx("button",{type:"button",className:`daemon-download-copy${n?" copied":""}`,onClick:()=>void d(),"aria-label":"Copy the install command",title:n?"Copied":"Copy",children:n?a.jsx(Cs,{size:15}):a.jsx(Oi,{size:15})})]}),!e&&a.jsx("p",{className:"daemon-download-meta",children:"Apple Silicon · macOS 13+"})]}),o&&a.jsx("p",{className:"daemon-download-hint",children:"Paste it into Terminal and press Return. Repoburg installs and opens in your menu bar."}),(e||o)&&a.jsxs("p",{className:"daemon-download-waiting",role:"status",children:[a.jsx(hn,{size:13,className:"spin"}),"Waiting for Repoburg to start…"]})]})}let Jn=null,Ao=null,Ai=1e3;const dj=1e4;function Bd(){Jn&&(Jn.readyState===WebSocket.OPEN||Jn.readyState===WebSocket.CONNECTING)||(Jn=new WebSocket(lw("/ws")),Jn.onopen=()=>{const e=Ai>1e3;if(Ai=1e3,A.getState().setWsConnected(!0),A.getState().addLogEntry("INFO","WebSocket connected"),e){Xw();const n=A.getState();n.activeSessionId&&(n.refreshActiveSession(),n.addToast("info","WebSocket reconnected — session state reconciled"))}},Jn.onclose=()=>{A.getState().setWsConnected(!1),A.getState().addLogEntry("WARN","WebSocket disconnected"),A.getState().addToast("warn","WebSocket disconnected — reconnecting…"),pj()},Jn.onerror=()=>{},Jn.onmessage=e=>{try{const n=JSON.parse(e.data);Lt.trackWsEvent(typeof n.event=="string"?n.event:"unknown",typeof e.data=="string"?e.data.length:0);const r=hj[n.event];r&&r(n.data)}catch{}})}function fj(){Ao&&(clearTimeout(Ao),Ao=null),Jn&&(Jn.onclose=null,Jn.close(),Jn=null),A.getState().setWsConnected(!1)}function pj(){Ao||(Ao=window.setTimeout(()=>{Ao=null,Bd()},Ai),Ai=Math.min(Ai*2,dj))}const hj={"turn:created":e=>{const n=e;A.getState().onTurnCreated(n.sessionId,n.turn)},"turn:started":e=>{const n=e;Lt.note(`turn:started — ${n.turnId.slice(0,8)}`),A.getState().onTurnStarted(n.sessionId,n.turnId)},"item:started":e=>{const n=e;Wu(n.sessionId,n.turnId,n.item),A.getState().onItemStarted(n.sessionId,n.turnId,n.item)},"item:updated":e=>{const n=e;Wu(n.sessionId,n.turnId,n.item),A.getState().onItemUpdated(n.sessionId,n.turnId,n.item)},"item:completed":e=>{const n=e;Wu(n.sessionId,n.turnId,n.item),A.getState().onItemCompleted(n.sessionId,n.turnId,n.item)},"item:delta":e=>{const n=e,r=dw(n.sessionId,n.turnId,n.itemId,n.delta);A.getState().onItemDelta(n.sessionId,n.turnId,n.itemId,n.delta,r)},"streams:snapshot":e=>{const n=e,r=A.getState();for(const o of fw(n.sessionId??null,Array.isArray(n.streams)?n.streams:[]))r.onItemText(o.sessionId,o.turnId,o.itemId,o.text)},"widget:delta":e=>{const n=e;typeof n.itemId!="string"||typeof n.html!="string"||A.getState().onWidgetDelta(n.sessionId,n.turnId,n.itemId,typeof n.title=="string"?n.title:"",n.html)},"turn:completed":e=>{const n=e;Lt.note(`turn:completed — ${n.turnId.slice(0,8)}`),gi(n.sessionId,n.turnId),A.getState().onTurnCompleted(n.sessionId,n.turnId,n.usage,n.hasUnreviewed,n.response??void 0)},"turn:tokenUsage":e=>{const n=e;A.getState().onTokenUsageUpdated(n.sessionId,n.turnId,n.usage)},"turn:contextUsage":e=>{const n=e,r={totalTokens:n.totalTokens,contextWindow:n.contextWindow,percentage:n.percentage,...n.autoCompactThreshold?{autoCompactThreshold:n.autoCompactThreshold}:{}};A.getState().onContextUsageUpdated(n.sessionId,r)},"turn:failed":e=>{const n=e;gi(n.sessionId,n.turnId),A.getState().onTurnFailed(n.sessionId,n.turnId,n.error,n.resumeState)},"turn:interrupted":e=>{const n=e;Lt.note(`turn:interrupted — ${n.turnId.slice(0,8)} (${n.reason})`),gi(n.sessionId,n.turnId),A.getState().onTurnInterrupted(n.sessionId,n.turnId,{reason:n.reason,interruptedAt:n.interruptedAt,attempts:n.attempts,detail:n.detail??null,resumeAt:n.resumeAt??null})},"turn:resuming":e=>{const n=e;gi(n.sessionId,n.turnId),A.getState().onTurnResuming(n.sessionId,n.turnId,n.attempt)},"turn:resumed":e=>{const n=e;A.getState().onTurnResumed(n.sessionId,n.turnId)},"turn:retrying":e=>{const n=e;A.getState().onTurnRetrying(n.sessionId,n.turnId,{attempt:n.attempt,maxRetries:n.maxRetries,retryDelayMs:n.retryDelayMs,errorStatus:n.errorStatus??null,error:n.error??null})},"turn:cancelled":e=>{const n=e;gi(n.sessionId,n.turnId),A.getState().onTurnCancelled(n.sessionId,n.turnId)},"session:title":e=>{const n=e;A.getState().onSessionTitle(n.sessionId,n.title)},"session:touched":e=>{const n=e;A.getState().onSessionTouched(n.sessionId)},"session:created":e=>{const{session:n}=e;n.origin_app_id&&dl(n.id,n.origin_app_id),A.getState().addSession(n)},"session:resync":e=>{const n=e,r=A.getState();r.activeSessionId===n.sessionId&&r.refreshActiveSession()},"session:updated":e=>{const n=e;A.getState().onSessionUpdated(n.session)},background_tasks:e=>{const n=e;Lt.note(`background_tasks — ${n.tasks.length} live (${n.tasks.map(r=>r.task_type).join(", ")||"none"})`),A.getState().onBackgroundTasksChanged(n.sessionId,n.tasks)},"background_tasks:snapshot":e=>{const n=e;A.getState().onBackgroundTasksSnapshot(n.sessions??{})},"signed_out_turns:snapshot":e=>{const n=e;A.getState().onSignedOutTurnsSnapshot(n.turns??[])},"thread:created":e=>{const n=e;A.getState().onThreadCreated(n.sessionId,n.thread,n.turn)},"thread:followup":e=>{const n=e;A.getState().onThreadFollowup(n.sessionId,n.threadId,n.turn)},"thread:resolved":e=>{const n=e;A.getState().onThreadResolved(n.sessionId,n.threadId,n.status)},"thread:deleted":e=>{const n=e;A.getState().onThreadDeleted(n.sessionId,n.threadId)},"app:tool_call":e=>{const n=e;Ww(n.appId,n.callId,n.tool,n.args??{},n.workspace,n.caller)},"app:source:updated":e=>{Yw(e.appId),A.getState().refreshApps()},"app:state_changed":e=>{const{appId:n,...r}=e;kv(n,r)}};function mj(){const e=A(n=>n.init);return y.useEffect(()=>{iw();function n(){e(),Bd()}const{daemonStatus:r,setDaemonStatus:o}=A.getState();let l=null;r==="ready"?n():l=kk({onMissing:()=>o("missing"),onReady:()=>{o("ready"),n()}});function c(){if(document.visibilityState!=="visible")return;const d=A.getState(),f=d.activeSessionId;if(!f)return;const h=d.sessionDetails[f];d.wsConnected||Bd(),h&&h.is_running===1&&(d.refreshActiveSession(),d.addLogEntry("INFO","Tab returned — reconciling session state"))}return document.addEventListener("visibilitychange",c),()=>{l==null||l(),fj(),document.removeEventListener("visibilitychange",c)}},[e]),null}const ox="agentpaneView";function Wd(e){return{tab:Gd(e),vscode:e.vscodeViewOpen,usage:e.usageViewOpen,terminal:e.terminalViewOpen}}function ix(e,n){return e.tab===n.tab&&e.vscode===n.vscode&&e.usage===n.usage&&e.terminal===n.terminal}function Zg(e){return e.tab===null&&!e.vscode&&!e.usage&&!e.terminal}function Jg(e,n){return n.tab!==null&&!e.tabOrder.includes(n.tab)?!1:!ix(n,Wd(e))}function ev(e){const n=e==null?void 0:e[ox];return typeof(n==null?void 0:n.index)!="number"?null:{...n,view:{...n.view,terminal:!!n.view.terminal}}}function gj(e,n){e.getState().vscodeViewOpen!==n.vscode&&e.getState().toggleVscodeView(),e.getState().usageViewOpen!==n.usage&&e.getState().toggleUsageView(),e.getState().terminalViewOpen!==n.terminal&&e.getState().toggleTerminalView();const r=e.getState();if(n.tab===null)return;const{kind:o,id:l}=mr(n.tab);o==="app"?r.openAppTab(l):r.activeSessionId===l?r.setActiveAppTab(null):r.selectSession(l)}function vj(e){let n=ev(window.history.state)??{index:0,newest:0,view:Wd(e.getState())},r=n.newest,o=!1;const l=new Map([[n.index,n.view]]),c=x=>{const S=e.getState();for(let C=n.index+x;C>=0&&C<=r;C+=x){const T=l.get(C);if(!T||Jg(S,T))return!0}return!1},d=()=>{const x=c(-1),S=c(1),C=e.getState();(C.canGoBack!==x||C.canGoForward!==S)&&e.setState({canGoBack:x,canGoForward:S})},f=()=>({[ox]:{...n,newest:r}}),h=()=>{window.history.replaceState({...window.history.state,...f()},"")},m=x=>{if(l.set(n.index,n.view),Zg(n.view))n={...n,view:x},h();else{n={index:n.index+1,newest:n.index+1,view:x},r=n.index;for(const S of l.keys())S>r&&l.delete(S);window.history.pushState(f(),"")}l.set(n.index,x)},v=x=>{const S=ev(x.state);if(!S)return;l.set(S.index,S.view),r=Math.max(r,S.index);const C=e.getState(),T=Math.sign(S.index-n.index);if(T!==0&&!Jg(C,S.view)){const E=S.index+T;window.history.go(E<0||E>r?n.index-S.index:T);return}n=S,h(),o=!0;try{gj(e,S.view)}finally{o=!1}d()};h(),d(),window.addEventListener("popstate",v);const k=e.subscribe((x,S)=>{const C=x.activeSessionId!==S.activeSessionId||x.activeAppTabId!==S.activeAppTabId||x.vscodeViewOpen!==S.vscodeViewOpen||x.usageViewOpen!==S.usageViewOpen||x.terminalViewOpen!==S.terminalViewOpen;if(!(!C&&x.tabOrder===S.tabOrder)){if(C&&!o){const T=Wd(x);!Zg(T)&&!ix(T,n.view)&&m(T)}d()}});return()=>{k(),window.removeEventListener("popstate",v)}}function yj(){const e=A(c=>c.loading),n=A(c=>c.error),r=A(c=>c.sessions),o=A(c=>c.daemonStatus),l=A(c=>c.setShowCommandPalette);return y.useEffect(()=>Lt.start(),[]),y.useEffect(()=>vj(A),[]),y.useEffect(()=>{function c(d){(d.metaKey||d.ctrlKey)&&d.key==="k"&&(d.preventDefault(),l(!0))}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[l]),a.jsxs(a.Fragment,{children:[a.jsx(mj,{}),o==="missing"?a.jsx(uj,{}):o==="checking"||e&&r.length===0?a.jsx("div",{className:"empty-state",children:"Loading sessions…"}):n&&r.length===0?a.jsxs("div",{className:"empty-state",children:["Error: ",n]}):a.jsxs(a.Fragment,{children:[a.jsx(HE,{}),a.jsx(VE,{}),a.jsx(qE,{}),a.jsx(QE,{}),a.jsx(nj,{}),a.jsx(oj,{}),a.jsx(sj,{}),a.jsx(cj,{})]})]})}X0.createRoot(document.getElementById("root")).render(a.jsx(ct.StrictMode,{children:a.jsx(yj,{})}));export{$i as R,Tn as X,lw as b,ye as c,a as j,y as r,A as u};
840
+ This cannot be undone.`)){x(!0);try{const Z=await fetch(`${mn()}/remote/uninstall`,{method:"DELETE"});if(!Z.ok)throw new Error(`uninstall ${Z.status}`);await Q()}catch{d("Could not remove the tunnel — check the daemon logs.")}finally{x(!1)}}}function te(){if(!L)return a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["Machine name (mahlas)",a.jsx("input",{className:"dialog-input",value:b,onChange:I=>j(I.target.value.toLowerCase()),placeholder:"my-macbook",autoFocus:!0})]}),a.jsx("div",{className:"dialog-label",style:{opacity:.7,marginTop:-4},children:"The machine will be reachable at https://<name>.repoburg.com"}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:()=>E("main"),children:"Back"}),a.jsxs("button",{className:"dialog-btn-create",disabled:!Qg.test(b)||P,onClick:()=>void Se(b),children:[P?a.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Start setup"]})]})]});const F=["detect","provision","install","verify","ready"],Z=F.indexOf(L.step),q=L.state==="ready";return a.jsxs(a.Fragment,{children:[L.state==="running"&&a.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(hn,{size:14,className:"spin"})," Setting up the remote tunnel…"]}),L.state==="ready"&&a.jsxs("div",{className:"dialog-label",style:{color:"var(--green)",display:"flex",alignItems:"center",gap:6},children:[a.jsx(Cs,{size:14})," Setup complete — you can close this window."]}),L.state==="ready"&&L.hostname&&a.jsxs("div",{className:"dialog-label",children:["This machine is accessible at"," ",a.jsx("a",{href:`https://${L.hostname}`,target:"_blank",rel:"noreferrer",children:L.hostname})]}),a.jsx("ol",{className:"dialog-label",style:{margin:"4px 0",paddingLeft:0,listStyle:"none"},children:F.map((I,$)=>{const ue=q||Z>-1&&$<Z,B=!q&&$===Z&&L.state==="running";return a.jsxs("li",{style:{display:"flex",alignItems:"center",gap:6,opacity:ue||B?1:.4,color:ue?"var(--green)":void 0},children:[ue?a.jsx(Cs,{size:13}):B?a.jsx(hn,{size:13,className:"spin"}):a.jsx(k1,{size:9,style:{marginLeft:2,marginRight:2}}),I]},I)})}),L.logs.length>0&&a.jsx("div",{className:"dialog-label",style:{opacity:.7,fontSize:12,whiteSpace:"pre-wrap"},children:L.logs.slice(-3).map(I=>I.message).join(`
841
+ `)}),L.state==="troubleshooting"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"dialog-label",style:{color:"var(--red)"},children:"Setup failed — a troubleshooting session is open and the agent is working on the fix in the background."}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-create",onClick:Me,children:"Open troubleshooting session"})})]}),L.state==="failed"&&a.jsxs("div",{className:"dialog-label",style:{color:"var(--red)"},children:["Setup failed: ",L.error]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:()=>void Q(),children:"Refresh status"})})]})}return a.jsx("div",{className:"dialog-overlay",onClick:()=>n(!1),children:a.jsxs("div",{className:"dialog",onClick:F=>F.stopPropagation(),onKeyDown:me,children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"Remote Access"}),a.jsx("button",{className:"dialog-close",onClick:()=>n(!1),children:a.jsx(Tn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[f&&a.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(hn,{size:14,className:"spin"})," Loading machine status…"]}),c&&a.jsx("div",{className:"dialog-label",style:{color:"var(--red)"},children:c}),T==="setup"?te():a.jsxs(a.Fragment,{children:[oe&&(o==null?void 0:o.tunnel.hostname)&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"dialog-label",children:["This machine is reachable at"," ",a.jsx("a",{href:`https://${o.tunnel.hostname}`,target:"_blank",rel:"noreferrer",children:o.tunnel.hostname})]}),a.jsxs("div",{style:{position:"relative",display:"flex",marginTop:8},children:[a.jsxs("button",{className:"dialog-btn-cancel",style:{flex:1,borderTopRightRadius:0,borderBottomRightRadius:0},onClick:()=>void ee(),disabled:U,children:[m?a.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Stop tunnel connection"]}),a.jsx("button",{className:"dialog-btn-cancel",style:{width:30,borderLeft:"none",borderTopLeftRadius:0,borderBottomLeftRadius:0,display:"inline-flex",alignItems:"center",justifyContent:"center"},onClick:()=>C(F=>!F),disabled:U,"aria-label":"More tunnel actions","aria-haspopup":"menu","aria-expanded":S,children:k?a.jsx(hn,{size:14,className:"spin"}):a.jsx(_o,{size:14})}),S&&a.jsx("div",{ref:z,className:"ctx-menu",role:"menu",style:{position:"absolute",right:0,top:"calc(100% + 4px)",zIndex:10},children:a.jsxs("div",{className:"ctx-menu-item ctx-danger",role:"menuitem",onClick:()=>void ie(),children:[a.jsx(us,{size:12})," Remove tunnel"]})})]})]}),!oe&&a.jsx(a.Fragment,{children:o!=null&&o.tunnel.provisioned&&o.tunnel.mahlas&&o.tunnel.hostname?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"dialog-label",children:["Tunnel exists as"," ",a.jsx("a",{href:`https://${o.tunnel.hostname}`,target:"_blank",rel:"noreferrer",children:o.tunnel.hostname})," ","but the connection is stopped."]}),a.jsxs("button",{className:"dialog-btn-create",style:{width:"100%"},onClick:()=>void Se(o.tunnel.mahlas),disabled:P,children:[P?a.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):a.jsx(Dm,{size:16,style:{verticalAlign:"middle",marginRight:6}}),"Resume tunnel connection"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:"dialog-btn-create",style:{width:"100%"},onClick:()=>E("setup"),children:[a.jsx(Dm,{size:16,style:{verticalAlign:"middle",marginRight:6}}),"Make this machine remote"]}),a.jsx("div",{className:"dialog-label",style:{opacity:.7,marginTop:-4},children:"The daemon sets everything up and shows the progress here."})]})})]})]})]})})}const aj={success:x1,error:Zl,info:E1,warn:ec},lj=4e3;function cj({toast:e}){const n=A(d=>d.removeToast),r=aj[e.type],o=y.useRef(null);y.useEffect(()=>{function d(){o.current=setTimeout(()=>n(e.id),lj)}return d(),()=>{o.current&&clearTimeout(o.current)}},[e.id,n]);function l(){o.current&&(clearTimeout(o.current),o.current=null)}function c(){o.current=setTimeout(()=>n(e.id),2e3)}return a.jsxs("div",{className:`toast toast-${e.type}`,onMouseEnter:l,onMouseLeave:c,children:[a.jsx(r,{size:16}),a.jsx("span",{className:"toast-message",children:e.message}),e.undoAction&&a.jsxs("button",{className:"toast-undo",onClick:()=>{var d;(d=e.undoAction)==null||d.call(e),n(e.id)},children:[a.jsx(q1,{size:12})," ",e.undoLabel||"Undo"]}),a.jsx("button",{className:"toast-close",onClick:()=>n(e.id),children:a.jsx(Tn,{size:14})})]})}function uj(){const e=A(n=>n.toasts);return e.length===0?null:a.jsx("div",{className:"toast-container",children:e.map(n=>a.jsx(cj,{toast:n},n.id))})}function dj(){const[e]=y.useState(wk),[n,r]=y.useState(!1),[o,l]=y.useState(!1),c=y.useRef(void 0);y.useEffect(()=>()=>clearTimeout(c.current),[]);async function d(){await Fi(ym)&&(r(!0),l(!0),clearTimeout(c.current),c.current=setTimeout(()=>r(!1),1500))}return a.jsxs("main",{className:"daemon-download",children:[a.jsx("h1",{className:"daemon-download-title",children:"Repoburg"}),e&&a.jsx("p",{className:"daemon-download-text",children:"Open the Repoburg app to continue."}),a.jsxs("div",{className:"daemon-download-install",children:[e&&a.jsx("p",{className:"daemon-download-label",children:"Not installed? Run this in Terminal:"}),a.jsxs("div",{className:"daemon-download-cmd",onCopy:()=>l(!0),children:[a.jsx("span",{className:"daemon-download-prompt","aria-hidden":"true",children:"$"}),a.jsx("code",{children:ym}),a.jsx("button",{type:"button",className:`daemon-download-copy${n?" copied":""}`,onClick:()=>void d(),"aria-label":"Copy the install command",title:n?"Copied":"Copy",children:n?a.jsx(Cs,{size:15}):a.jsx(Oi,{size:15})})]}),!e&&a.jsx("p",{className:"daemon-download-meta",children:"Apple Silicon · macOS 13+"})]}),o&&a.jsx("p",{className:"daemon-download-hint",children:"Paste it into Terminal and press Return. Repoburg installs and opens in your menu bar."}),(e||o)&&a.jsxs("p",{className:"daemon-download-waiting",role:"status",children:[a.jsx(hn,{size:13,className:"spin"}),"Waiting for Repoburg to start…"]})]})}let Jn=null,Ao=null,Ai=1e3;const fj=1e4;function Wd(){Jn&&(Jn.readyState===WebSocket.OPEN||Jn.readyState===WebSocket.CONNECTING)||(Jn=new WebSocket(lw("/ws")),Jn.onopen=()=>{const e=Ai>1e3;if(Ai=1e3,A.getState().setWsConnected(!0),A.getState().addLogEntry("INFO","WebSocket connected"),e){Yw();const n=A.getState();n.activeSessionId&&(n.refreshActiveSession(),n.addToast("info","WebSocket reconnected — session state reconciled"))}},Jn.onclose=()=>{A.getState().setWsConnected(!1),A.getState().addLogEntry("WARN","WebSocket disconnected"),A.getState().addToast("warn","WebSocket disconnected — reconnecting…"),hj()},Jn.onerror=()=>{},Jn.onmessage=e=>{try{const n=JSON.parse(e.data);Lt.trackWsEvent(typeof n.event=="string"?n.event:"unknown",typeof e.data=="string"?e.data.length:0);const r=mj[n.event];r&&r(n.data)}catch{}})}function pj(){Ao&&(clearTimeout(Ao),Ao=null),Jn&&(Jn.onclose=null,Jn.close(),Jn=null),A.getState().setWsConnected(!1)}function hj(){Ao||(Ao=window.setTimeout(()=>{Ao=null,Wd()},Ai),Ai=Math.min(Ai*2,fj))}const mj={"turn:created":e=>{const n=e;A.getState().onTurnCreated(n.sessionId,n.turn)},"turn:started":e=>{const n=e;Lt.note(`turn:started — ${n.turnId.slice(0,8)}`),A.getState().onTurnStarted(n.sessionId,n.turnId)},"item:started":e=>{const n=e;Hu(n.sessionId,n.turnId,n.item),A.getState().onItemStarted(n.sessionId,n.turnId,n.item)},"item:updated":e=>{const n=e;Hu(n.sessionId,n.turnId,n.item),A.getState().onItemUpdated(n.sessionId,n.turnId,n.item)},"item:completed":e=>{const n=e;Hu(n.sessionId,n.turnId,n.item),A.getState().onItemCompleted(n.sessionId,n.turnId,n.item)},"item:delta":e=>{const n=e,r=fw(n.sessionId,n.turnId,n.itemId,n.delta);A.getState().onItemDelta(n.sessionId,n.turnId,n.itemId,n.delta,r)},"streams:snapshot":e=>{const n=e,r=A.getState();for(const o of pw(n.sessionId??null,Array.isArray(n.streams)?n.streams:[]))r.onItemText(o.sessionId,o.turnId,o.itemId,o.text)},"widget:delta":e=>{const n=e;typeof n.itemId!="string"||typeof n.html!="string"||A.getState().onWidgetDelta(n.sessionId,n.turnId,n.itemId,typeof n.title=="string"?n.title:"",n.html)},"turn:completed":e=>{const n=e;Lt.note(`turn:completed — ${n.turnId.slice(0,8)}`),gi(n.sessionId,n.turnId),A.getState().onTurnCompleted(n.sessionId,n.turnId,n.usage,n.hasUnreviewed,n.response??void 0)},"turn:tokenUsage":e=>{const n=e;A.getState().onTokenUsageUpdated(n.sessionId,n.turnId,n.usage)},"turn:contextUsage":e=>{const n=e,r={totalTokens:n.totalTokens,contextWindow:n.contextWindow,percentage:n.percentage,...n.autoCompactThreshold?{autoCompactThreshold:n.autoCompactThreshold}:{}};A.getState().onContextUsageUpdated(n.sessionId,r)},"turn:failed":e=>{const n=e;gi(n.sessionId,n.turnId),A.getState().onTurnFailed(n.sessionId,n.turnId,n.error,n.resumeState)},"turn:interrupted":e=>{const n=e;Lt.note(`turn:interrupted — ${n.turnId.slice(0,8)} (${n.reason})`),gi(n.sessionId,n.turnId),A.getState().onTurnInterrupted(n.sessionId,n.turnId,{reason:n.reason,interruptedAt:n.interruptedAt,attempts:n.attempts,detail:n.detail??null,resumeAt:n.resumeAt??null})},"turn:resuming":e=>{const n=e;gi(n.sessionId,n.turnId),A.getState().onTurnResuming(n.sessionId,n.turnId,n.attempt)},"turn:resumed":e=>{const n=e;A.getState().onTurnResumed(n.sessionId,n.turnId)},"turn:retrying":e=>{const n=e;A.getState().onTurnRetrying(n.sessionId,n.turnId,{attempt:n.attempt,maxRetries:n.maxRetries,retryDelayMs:n.retryDelayMs,errorStatus:n.errorStatus??null,error:n.error??null})},"turn:cancelled":e=>{const n=e;gi(n.sessionId,n.turnId),A.getState().onTurnCancelled(n.sessionId,n.turnId)},"session:title":e=>{const n=e;A.getState().onSessionTitle(n.sessionId,n.title)},"session:touched":e=>{const n=e;A.getState().onSessionTouched(n.sessionId)},"session:created":e=>{const{session:n}=e;n.origin_app_id&&dl(n.id,n.origin_app_id),A.getState().addSession(n)},"session:resync":e=>{const n=e,r=A.getState();r.activeSessionId===n.sessionId&&r.refreshActiveSession()},"session:updated":e=>{const n=e;A.getState().onSessionUpdated(n.session)},background_tasks:e=>{const n=e;Lt.note(`background_tasks — ${n.tasks.length} live (${n.tasks.map(r=>r.task_type).join(", ")||"none"})`),A.getState().onBackgroundTasksChanged(n.sessionId,n.tasks)},"background_tasks:snapshot":e=>{const n=e;A.getState().onBackgroundTasksSnapshot(n.sessions??{})},"signed_out_turns:snapshot":e=>{const n=e;A.getState().onSignedOutTurnsSnapshot(n.turns??[])},"thread:created":e=>{const n=e;A.getState().onThreadCreated(n.sessionId,n.thread,n.turn)},"thread:followup":e=>{const n=e;A.getState().onThreadFollowup(n.sessionId,n.threadId,n.turn)},"thread:resolved":e=>{const n=e;A.getState().onThreadResolved(n.sessionId,n.threadId,n.status)},"thread:deleted":e=>{const n=e;A.getState().onThreadDeleted(n.sessionId,n.threadId)},"app:tool_call":e=>{const n=e;Hw(n.appId,n.callId,n.tool,n.args??{},n.workspace,n.caller)},"app:source:updated":e=>{Qw(e.appId),A.getState().refreshApps()},"app:state_changed":e=>{const{appId:n,...r}=e;kv(n,r)}};function gj(){const e=A(n=>n.init);return y.useEffect(()=>{iw();function n(){e(),Wd()}const{daemonStatus:r,setDaemonStatus:o}=A.getState();let l=null;r==="ready"?n():l=Sk({onMissing:()=>o("missing"),onReady:()=>{o("ready"),n()}});function c(){if(document.visibilityState!=="visible")return;const d=A.getState(),f=d.activeSessionId;if(!f)return;const h=d.sessionDetails[f];d.wsConnected||Wd(),h&&h.is_running===1&&(d.refreshActiveSession(),d.addLogEntry("INFO","Tab returned — reconciling session state"))}return document.addEventListener("visibilitychange",c),()=>{l==null||l(),pj(),document.removeEventListener("visibilitychange",c)}},[e]),null}const ox="agentpaneView";function Hd(e){return{tab:Gd(e),vscode:e.vscodeViewOpen,usage:e.usageViewOpen,terminal:e.terminalViewOpen}}function ix(e,n){return e.tab===n.tab&&e.vscode===n.vscode&&e.usage===n.usage&&e.terminal===n.terminal}function Zg(e){return e.tab===null&&!e.vscode&&!e.usage&&!e.terminal}function Jg(e,n){return n.tab!==null&&!e.tabOrder.includes(n.tab)?!1:!ix(n,Hd(e))}function ev(e){const n=e==null?void 0:e[ox];return typeof(n==null?void 0:n.index)!="number"?null:{...n,view:{...n.view,terminal:!!n.view.terminal}}}function vj(e,n){e.getState().vscodeViewOpen!==n.vscode&&e.getState().toggleVscodeView(),e.getState().usageViewOpen!==n.usage&&e.getState().toggleUsageView(),e.getState().terminalViewOpen!==n.terminal&&e.getState().toggleTerminalView();const r=e.getState();if(n.tab===null)return;const{kind:o,id:l}=mr(n.tab);o==="app"?r.openAppTab(l):r.activeSessionId===l?r.setActiveAppTab(null):r.selectSession(l)}function yj(e){let n=ev(window.history.state)??{index:0,newest:0,view:Hd(e.getState())},r=n.newest,o=!1;const l=new Map([[n.index,n.view]]),c=x=>{const S=e.getState();for(let C=n.index+x;C>=0&&C<=r;C+=x){const T=l.get(C);if(!T||Jg(S,T))return!0}return!1},d=()=>{const x=c(-1),S=c(1),C=e.getState();(C.canGoBack!==x||C.canGoForward!==S)&&e.setState({canGoBack:x,canGoForward:S})},f=()=>({[ox]:{...n,newest:r}}),h=()=>{window.history.replaceState({...window.history.state,...f()},"")},m=x=>{if(l.set(n.index,n.view),Zg(n.view))n={...n,view:x},h();else{n={index:n.index+1,newest:n.index+1,view:x},r=n.index;for(const S of l.keys())S>r&&l.delete(S);window.history.pushState(f(),"")}l.set(n.index,x)},v=x=>{const S=ev(x.state);if(!S)return;l.set(S.index,S.view),r=Math.max(r,S.index);const C=e.getState(),T=Math.sign(S.index-n.index);if(T!==0&&!Jg(C,S.view)){const E=S.index+T;window.history.go(E<0||E>r?n.index-S.index:T);return}n=S,h(),o=!0;try{vj(e,S.view)}finally{o=!1}d()};h(),d(),window.addEventListener("popstate",v);const k=e.subscribe((x,S)=>{const C=x.activeSessionId!==S.activeSessionId||x.activeAppTabId!==S.activeAppTabId||x.vscodeViewOpen!==S.vscodeViewOpen||x.usageViewOpen!==S.usageViewOpen||x.terminalViewOpen!==S.terminalViewOpen;if(!(!C&&x.tabOrder===S.tabOrder)){if(C&&!o){const T=Hd(x);!Zg(T)&&!ix(T,n.view)&&m(T)}d()}});return()=>{k(),window.removeEventListener("popstate",v)}}function xj(){const e=A(c=>c.loading),n=A(c=>c.error),r=A(c=>c.sessions),o=A(c=>c.daemonStatus),l=A(c=>c.setShowCommandPalette);return y.useEffect(()=>Lt.start(),[]),y.useEffect(()=>yj(A),[]),y.useEffect(()=>{function c(d){(d.metaKey||d.ctrlKey)&&d.key==="k"&&(d.preventDefault(),l(!0))}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[l]),a.jsxs(a.Fragment,{children:[a.jsx(gj,{}),o==="missing"?a.jsx(dj,{}):o==="checking"||e&&r.length===0?a.jsx("div",{className:"empty-state",children:"Loading sessions…"}):n&&r.length===0?a.jsxs("div",{className:"empty-state",children:["Error: ",n]}):a.jsxs(a.Fragment,{children:[a.jsx(VE,{}),a.jsx(KE,{}),a.jsx(XE,{}),a.jsx(ZE,{}),a.jsx(sj,{}),a.jsx(ij,{}),a.jsx(rj,{}),a.jsx(uj,{})]})]})}X0.createRoot(document.getElementById("root")).render(a.jsx(ct.StrictMode,{children:a.jsx(xj,{})}));export{$i as R,Tn as X,lw as b,ye as c,a as j,y as r,A as u};