repoburg 1.3.294 → 1.3.296

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,667 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalView-DLqkILpD.js","assets/TerminalView-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
2
- var qx=Object.defineProperty;var Yx=(t,s,r)=>s in t?qx(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r;var it=(t,s,r)=>Yx(t,typeof s!="symbol"?s+"":s,r);(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.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 wg(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Su={exports:{}},lo={},bu={exports:{}},We={};/**
3
- * @license React
4
- * react.production.min.js
5
- *
6
- * Copyright (c) Facebook, Inc. and its affiliates.
7
- *
8
- * This source code is licensed under the MIT license found in the
9
- * LICENSE file in the root directory of this source tree.
10
- */var vh;function Xx(){if(vh)return We;vh=1;var t=Symbol.for("react.element"),s=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"),p=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),k=Symbol.iterator;function y(R){return R===null||typeof R!="object"?null:(R=k&&R[k]||R["@@iterator"],typeof R=="function"?R:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,E={};function N(R,$,le){this.props=R,this.context=$,this.refs=E,this.updater=le||S}N.prototype.isReactComponent={},N.prototype.setState=function(R,$){if(typeof R!="object"&&typeof R!="function"&&R!=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,R,$,"setState")},N.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function C(){}C.prototype=N.prototype;function _(R,$,le){this.props=R,this.context=$,this.refs=E,this.updater=le||S}var H=_.prototype=new C;H.constructor=_,T(H,N.prototype),H.isPureReactComponent=!0;var D=Array.isArray,O=Object.prototype.hasOwnProperty,K={current:null},G={key:!0,ref:!0,__self:!0,__source:!0};function z(R,$,le){var me,Y={},fe=null,Te=null;if($!=null)for(me in $.ref!==void 0&&(Te=$.ref),$.key!==void 0&&(fe=""+$.key),$)O.call($,me)&&!G.hasOwnProperty(me)&&(Y[me]=$[me]);var se=arguments.length-2;if(se===1)Y.children=le;else if(1<se){for(var pe=Array(se),be=0;be<se;be++)pe[be]=arguments[be+2];Y.children=pe}if(R&&R.defaultProps)for(me in se=R.defaultProps,se)Y[me]===void 0&&(Y[me]=se[me]);return{$$typeof:t,type:R,key:fe,ref:Te,props:Y,_owner:K.current}}function J(R,$){return{$$typeof:t,type:R.type,key:$,ref:R.ref,props:R.props,_owner:R._owner}}function he(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function ae(R){var $={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(le){return $[le]})}var ve=/\/+/g;function we(R,$){return typeof R=="object"&&R!==null&&R.key!=null?ae(""+R.key):$.toString(36)}function Ae(R,$,le,me,Y){var fe=typeof R;(fe==="undefined"||fe==="boolean")&&(R=null);var Te=!1;if(R===null)Te=!0;else switch(fe){case"string":case"number":Te=!0;break;case"object":switch(R.$$typeof){case t:case s:Te=!0}}if(Te)return Te=R,Y=Y(Te),R=me===""?"."+we(Te,0):me,D(Y)?(le="",R!=null&&(le=R.replace(ve,"$&/")+"/"),Ae(Y,$,le,"",function(be){return be})):Y!=null&&(he(Y)&&(Y=J(Y,le+(!Y.key||Te&&Te.key===Y.key?"":(""+Y.key).replace(ve,"$&/")+"/")+R)),$.push(Y)),1;if(Te=0,me=me===""?".":me+":",D(R))for(var se=0;se<R.length;se++){fe=R[se];var pe=me+we(fe,se);Te+=Ae(fe,$,le,pe,Y)}else if(pe=y(R),typeof pe=="function")for(R=pe.call(R),se=0;!(fe=R.next()).done;)fe=fe.value,pe=me+we(fe,se++),Te+=Ae(fe,$,le,pe,Y);else if(fe==="object")throw $=String(R),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.");return Te}function ee(R,$,le){if(R==null)return R;var me=[],Y=0;return Ae(R,me,"","",function(fe){return $.call(le,fe,Y++)}),me}function ne(R){if(R._status===-1){var $=R._result;$=$(),$.then(function(le){(R._status===0||R._status===-1)&&(R._status=1,R._result=le)},function(le){(R._status===0||R._status===-1)&&(R._status=2,R._result=le)}),R._status===-1&&(R._status=0,R._result=$)}if(R._status===1)return R._result.default;throw R._result}var oe={current:null},F={transition:null},X={ReactCurrentDispatcher:oe,ReactCurrentBatchConfig:F,ReactCurrentOwner:K};function L(){throw Error("act(...) is not supported in production builds of React.")}return We.Children={map:ee,forEach:function(R,$,le){ee(R,function(){$.apply(this,arguments)},le)},count:function(R){var $=0;return ee(R,function(){$++}),$},toArray:function(R){return ee(R,function($){return $})||[]},only:function(R){if(!he(R))throw Error("React.Children.only expected to receive a single React element child.");return R}},We.Component=N,We.Fragment=r,We.Profiler=l,We.PureComponent=_,We.StrictMode=o,We.Suspense=g,We.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=X,We.act=L,We.cloneElement=function(R,$,le){if(R==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+R+".");var me=T({},R.props),Y=R.key,fe=R.ref,Te=R._owner;if($!=null){if($.ref!==void 0&&(fe=$.ref,Te=K.current),$.key!==void 0&&(Y=""+$.key),R.type&&R.type.defaultProps)var se=R.type.defaultProps;for(pe in $)O.call($,pe)&&!G.hasOwnProperty(pe)&&(me[pe]=$[pe]===void 0&&se!==void 0?se[pe]:$[pe])}var pe=arguments.length-2;if(pe===1)me.children=le;else if(1<pe){se=Array(pe);for(var be=0;be<pe;be++)se[be]=arguments[be+2];me.children=se}return{$$typeof:t,type:R.type,key:Y,ref:fe,props:me,_owner:Te}},We.createContext=function(R){return R={$$typeof:d,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},R.Provider={$$typeof:c,_context:R},R.Consumer=R},We.createElement=z,We.createFactory=function(R){var $=z.bind(null,R);return $.type=R,$},We.createRef=function(){return{current:null}},We.forwardRef=function(R){return{$$typeof:p,render:R}},We.isValidElement=he,We.lazy=function(R){return{$$typeof:v,_payload:{_status:-1,_result:R},_init:ne}},We.memo=function(R,$){return{$$typeof:m,type:R,compare:$===void 0?null:$}},We.startTransition=function(R){var $=F.transition;F.transition={};try{R()}finally{F.transition=$}},We.unstable_act=L,We.useCallback=function(R,$){return oe.current.useCallback(R,$)},We.useContext=function(R){return oe.current.useContext(R)},We.useDebugValue=function(){},We.useDeferredValue=function(R){return oe.current.useDeferredValue(R)},We.useEffect=function(R,$){return oe.current.useEffect(R,$)},We.useId=function(){return oe.current.useId()},We.useImperativeHandle=function(R,$,le){return oe.current.useImperativeHandle(R,$,le)},We.useInsertionEffect=function(R,$){return oe.current.useInsertionEffect(R,$)},We.useLayoutEffect=function(R,$){return oe.current.useLayoutEffect(R,$)},We.useMemo=function(R,$){return oe.current.useMemo(R,$)},We.useReducer=function(R,$,le){return oe.current.useReducer(R,$,le)},We.useRef=function(R){return oe.current.useRef(R)},We.useState=function(R){return oe.current.useState(R)},We.useSyncExternalStore=function(R,$,le){return oe.current.useSyncExternalStore(R,$,le)},We.useTransition=function(){return oe.current.useTransition()},We.version="18.3.1",We}var yh;function wd(){return yh||(yh=1,bu.exports=Xx()),bu.exports}/**
11
- * @license React
12
- * react-jsx-runtime.production.min.js
13
- *
14
- * Copyright (c) Facebook, Inc. and its affiliates.
15
- *
16
- * This source code is licensed under the MIT license found in the
17
- * LICENSE file in the root directory of this source tree.
18
- */var xh;function Qx(){if(xh)return lo;xh=1;var t=wd(),s=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,l=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function d(p,g,m){var v,k={},y=null,S=null;m!==void 0&&(y=""+m),g.key!==void 0&&(y=""+g.key),g.ref!==void 0&&(S=g.ref);for(v in g)o.call(g,v)&&!c.hasOwnProperty(v)&&(k[v]=g[v]);if(p&&p.defaultProps)for(v in g=p.defaultProps,g)k[v]===void 0&&(k[v]=g[v]);return{$$typeof:s,type:p,key:y,ref:S,props:k,_owner:l.current}}return lo.Fragment=r,lo.jsx=d,lo.jsxs=d,lo}var wh;function Zx(){return wh||(wh=1,Su.exports=Qx()),Su.exports}var a=Zx(),x=wd();const lt=wg(x);var Ha={},Tu={exports:{}},An={},Nu={exports:{}},ju={};/**
19
- * @license React
20
- * scheduler.production.min.js
21
- *
22
- * Copyright (c) Facebook, Inc. and its affiliates.
23
- *
24
- * This source code is licensed under the MIT license found in the
25
- * LICENSE file in the root directory of this source tree.
26
- */var kh;function Jx(){return kh||(kh=1,(function(t){function s(F,X){var L=F.length;F.push(X);e:for(;0<L;){var R=L-1>>>1,$=F[R];if(0<l($,X))F[R]=X,F[L]=$,L=R;else break e}}function r(F){return F.length===0?null:F[0]}function o(F){if(F.length===0)return null;var X=F[0],L=F.pop();if(L!==X){F[0]=L;e:for(var R=0,$=F.length,le=$>>>1;R<le;){var me=2*(R+1)-1,Y=F[me],fe=me+1,Te=F[fe];if(0>l(Y,L))fe<$&&0>l(Te,Y)?(F[R]=Te,F[fe]=L,R=fe):(F[R]=Y,F[me]=L,R=me);else if(fe<$&&0>l(Te,L))F[R]=Te,F[fe]=L,R=fe;else break e}}return X}function l(F,X){var L=F.sortIndex-X.sortIndex;return L!==0?L:F.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;t.unstable_now=function(){return c.now()}}else{var d=Date,p=d.now();t.unstable_now=function(){return d.now()-p}}var g=[],m=[],v=1,k=null,y=3,S=!1,T=!1,E=!1,N=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function H(F){for(var X=r(m);X!==null;){if(X.callback===null)o(m);else if(X.startTime<=F)o(m),X.sortIndex=X.expirationTime,s(g,X);else break;X=r(m)}}function D(F){if(E=!1,H(F),!T)if(r(g)!==null)T=!0,ne(O);else{var X=r(m);X!==null&&oe(D,X.startTime-F)}}function O(F,X){T=!1,E&&(E=!1,C(z),z=-1),S=!0;var L=y;try{for(H(X),k=r(g);k!==null&&(!(k.expirationTime>X)||F&&!ae());){var R=k.callback;if(typeof R=="function"){k.callback=null,y=k.priorityLevel;var $=R(k.expirationTime<=X);X=t.unstable_now(),typeof $=="function"?k.callback=$:k===r(g)&&o(g),H(X)}else o(g);k=r(g)}if(k!==null)var le=!0;else{var me=r(m);me!==null&&oe(D,me.startTime-X),le=!1}return le}finally{k=null,y=L,S=!1}}var K=!1,G=null,z=-1,J=5,he=-1;function ae(){return!(t.unstable_now()-he<J)}function ve(){if(G!==null){var F=t.unstable_now();he=F;var X=!0;try{X=G(!0,F)}finally{X?we():(K=!1,G=null)}}else K=!1}var we;if(typeof _=="function")we=function(){_(ve)};else if(typeof MessageChannel<"u"){var Ae=new MessageChannel,ee=Ae.port2;Ae.port1.onmessage=ve,we=function(){ee.postMessage(null)}}else we=function(){N(ve,0)};function ne(F){G=F,K||(K=!0,we())}function oe(F,X){z=N(function(){F(t.unstable_now())},X)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(F){F.callback=null},t.unstable_continueExecution=function(){T||S||(T=!0,ne(O))},t.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"):J=0<F?Math.floor(1e3/F):5},t.unstable_getCurrentPriorityLevel=function(){return y},t.unstable_getFirstCallbackNode=function(){return r(g)},t.unstable_next=function(F){switch(y){case 1:case 2:case 3:var X=3;break;default:X=y}var L=y;y=X;try{return F()}finally{y=L}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(F,X){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var L=y;y=F;try{return X()}finally{y=L}},t.unstable_scheduleCallback=function(F,X,L){var R=t.unstable_now();switch(typeof L=="object"&&L!==null?(L=L.delay,L=typeof L=="number"&&0<L?R+L:R):L=R,F){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=L+$,F={id:v++,callback:X,priorityLevel:F,startTime:L,expirationTime:$,sortIndex:-1},L>R?(F.sortIndex=L,s(m,F),r(g)===null&&F===r(m)&&(E?(C(z),z=-1):E=!0,oe(D,L-R))):(F.sortIndex=$,s(g,F),T||S||(T=!0,ne(O))),F},t.unstable_shouldYield=ae,t.unstable_wrapCallback=function(F){var X=y;return function(){var L=y;y=X;try{return F.apply(this,arguments)}finally{y=L}}}})(ju)),ju}var Sh;function e0(){return Sh||(Sh=1,Nu.exports=Jx()),Nu.exports}/**
27
- * @license React
28
- * react-dom.production.min.js
29
- *
30
- * Copyright (c) Facebook, Inc. and its affiliates.
31
- *
32
- * This source code is licensed under the MIT license found in the
33
- * LICENSE file in the root directory of this source tree.
34
- */var bh;function t0(){if(bh)return An;bh=1;var t=wd(),s=e0();function r(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i<arguments.length;i++)n+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+e+"; visit "+n+" 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(e,n){d(e,n),d(e+"Capture",n)}function d(e,n){for(l[e]=n,e=0;e<n.length;e++)o.add(n[e])}var p=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),g=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 y(e){return g.call(k,e)?!0:g.call(v,e)?!1:m.test(e)?k[e]=!0:(v[e]=!0,!1)}function S(e,n,i,u){if(i!==null&&i.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return u?!1:i!==null?!i.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function T(e,n,i,u){if(n===null||typeof n>"u"||S(e,n,i,u))return!0;if(u)return!1;if(i!==null)switch(i.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function E(e,n,i,u,f,h,w){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=u,this.attributeNamespace=f,this.mustUseProperty=i,this.propertyName=e,this.type=n,this.sanitizeURL=h,this.removeEmptyString=w}var N={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){N[e]=new E(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];N[n]=new E(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){N[e]=new E(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){N[e]=new E(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){N[e]=new E(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){N[e]=new E(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){N[e]=new E(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){N[e]=new E(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){N[e]=new E(e,5,!1,e.toLowerCase(),null,!1,!1)});var C=/[\-:]([a-z])/g;function _(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var n=e.replace(C,_);N[n]=new E(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(C,_);N[n]=new E(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(C,_);N[n]=new E(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){N[e]=new E(e,1,!1,e.toLowerCase(),null,!1,!1)}),N.xlinkHref=new E("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){N[e]=new E(e,1,!1,e.toLowerCase(),null,!0,!0)});function H(e,n,i,u){var f=N.hasOwnProperty(n)?N[n]:null;(f!==null?f.type!==0:u||!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(T(n,i,f,u)&&(i=null),u||f===null?y(n)&&(i===null?e.removeAttribute(n):e.setAttribute(n,""+i)):f.mustUseProperty?e[f.propertyName]=i===null?f.type===3?!1:"":i:(n=f.attributeName,u=f.attributeNamespace,i===null?e.removeAttribute(n):(f=f.type,i=f===3||f===4&&i===!0?"":""+i,u?e.setAttributeNS(u,n,i):e.setAttribute(n,i))))}var D=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,O=Symbol.for("react.element"),K=Symbol.for("react.portal"),G=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),J=Symbol.for("react.profiler"),he=Symbol.for("react.provider"),ae=Symbol.for("react.context"),ve=Symbol.for("react.forward_ref"),we=Symbol.for("react.suspense"),Ae=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),ne=Symbol.for("react.lazy"),oe=Symbol.for("react.offscreen"),F=Symbol.iterator;function X(e){return e===null||typeof e!="object"?null:(e=F&&e[F]||e["@@iterator"],typeof e=="function"?e:null)}var L=Object.assign,R;function $(e){if(R===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);R=n&&n[1]||""}return`
35
- `+R+e}var le=!1;function me(e,n){if(!e||le)return"";le=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(n)if(n=function(){throw Error()},Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(n,[])}catch(V){var u=V}Reflect.construct(e,[],n)}else{try{n.call()}catch(V){u=V}e.call(n.prototype)}else{try{throw Error()}catch(V){u=V}e()}}catch(V){if(V&&u&&typeof V.stack=="string"){for(var f=V.stack.split(`
36
- `),h=u.stack.split(`
37
- `),w=f.length-1,j=h.length-1;1<=w&&0<=j&&f[w]!==h[j];)j--;for(;1<=w&&0<=j;w--,j--)if(f[w]!==h[j]){if(w!==1||j!==1)do if(w--,j--,0>j||f[w]!==h[j]){var M=`
38
- `+f[w].replace(" at new "," at ");return e.displayName&&M.includes("<anonymous>")&&(M=M.replace("<anonymous>",e.displayName)),M}while(1<=w&&0<=j);break}}}finally{le=!1,Error.prepareStackTrace=i}return(e=e?e.displayName||e.name:"")?$(e):""}function Y(e){switch(e.tag){case 5:return $(e.type);case 16:return $("Lazy");case 13:return $("Suspense");case 19:return $("SuspenseList");case 0:case 2:case 15:return e=me(e.type,!1),e;case 11:return e=me(e.type.render,!1),e;case 1:return e=me(e.type,!0),e;default:return""}}function fe(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case G:return"Fragment";case K:return"Portal";case J:return"Profiler";case z:return"StrictMode";case we:return"Suspense";case Ae:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ae:return(e.displayName||"Context")+".Consumer";case he:return(e._context.displayName||"Context")+".Provider";case ve:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ee:return n=e.displayName||null,n!==null?n:fe(e.type)||"Memo";case ne:n=e._payload,e=e._init;try{return fe(e(n))}catch{}}return null}function Te(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return fe(n);case 8:return n===z?"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 n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function se(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function pe(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function be(e){var n=pe(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),u=""+e[n];if(!e.hasOwnProperty(n)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var f=i.get,h=i.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(w){u=""+w,h.call(this,w)}}),Object.defineProperty(e,n,{enumerable:i.enumerable}),{getValue:function(){return u},setValue:function(w){u=""+w},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function He(e){e._valueTracker||(e._valueTracker=be(e))}function Ee(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var i=n.getValue(),u="";return e&&(u=pe(e)?e.checked?"true":"false":e.value),e=u,e!==i?(n.setValue(e),!0):!1}function ct(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function $e(e,n){var i=n.checked;return L({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??e._wrapperState.initialChecked})}function en(e,n){var i=n.defaultValue==null?"":n.defaultValue,u=n.checked!=null?n.checked:n.defaultChecked;i=se(n.value!=null?n.value:i),e._wrapperState={initialChecked:u,initialValue:i,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Fe(e,n){n=n.checked,n!=null&&H(e,"checked",n,!1)}function Ht(e,n){Fe(e,n);var i=se(n.value),u=n.type;if(i!=null)u==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if(u==="submit"||u==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?wt(e,n.type,i):n.hasOwnProperty("defaultValue")&&wt(e,n.type,se(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function tn(e,n,i){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var u=n.type;if(!(u!=="submit"&&u!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,i||n===e.value||(e.value=n),e.defaultValue=n}i=e.name,i!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,i!==""&&(e.name=i)}function wt(e,n,i){(n!=="number"||ct(e.ownerDocument)!==e)&&(i==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}var jt=Array.isArray;function zt(e,n,i,u){if(e=e.options,n){n={};for(var f=0;f<i.length;f++)n["$"+i[f]]=!0;for(i=0;i<e.length;i++)f=n.hasOwnProperty("$"+e[i].value),e[i].selected!==f&&(e[i].selected=f),f&&u&&(e[i].defaultSelected=!0)}else{for(i=""+se(i),n=null,f=0;f<e.length;f++){if(e[f].value===i){e[f].selected=!0,u&&(e[f].defaultSelected=!0);return}n!==null||e[f].disabled||(n=e[f])}n!==null&&(n.selected=!0)}}function Lt(e,n){if(n.dangerouslySetInnerHTML!=null)throw Error(r(91));return L({},n,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function q(e,n){var i=n.value;if(i==null){if(i=n.children,n=n.defaultValue,i!=null){if(n!=null)throw Error(r(92));if(jt(i)){if(1<i.length)throw Error(r(93));i=i[0]}n=i}n==null&&(n=""),i=n}e._wrapperState={initialValue:se(i)}}function ge(e,n){var i=se(n.value),u=se(n.defaultValue);i!=null&&(i=""+i,i!==e.value&&(e.value=i),n.defaultValue==null&&e.defaultValue!==i&&(e.defaultValue=i)),u!=null&&(e.defaultValue=""+u)}function Ue(e){var n=e.textContent;n===e._wrapperState.initialValue&&n!==""&&n!==null&&(e.value=n)}function nt(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function mt(e,n){return e==null||e==="http://www.w3.org/1999/xhtml"?nt(n):e==="http://www.w3.org/2000/svg"&&n==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var gt,Ct=(function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(n,i,u,f){MSApp.execUnsafeLocalFunction(function(){return e(n,i,u,f)})}:e})(function(e,n){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=n;else{for(gt=gt||document.createElement("div"),gt.innerHTML="<svg>"+n.valueOf().toString()+"</svg>",n=gt.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function an(e,n){if(n){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=n;return}}e.textContent=n}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},Dn=["Webkit","ms","Moz","O"];Object.keys(dt).forEach(function(e){Dn.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),dt[n]=dt[e]})});function Mn(e,n,i){return n==null||typeof n=="boolean"||n===""?"":i||typeof n!="number"||n===0||dt.hasOwnProperty(e)&&dt[e]?(""+n).trim():n+"px"}function hs(e,n){e=e.style;for(var i in n)if(n.hasOwnProperty(i)){var u=i.indexOf("--")===0,f=Mn(i,n[i],u);i==="float"&&(i="cssFloat"),u?e.setProperty(i,f):e[i]=f}}var ms=L({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 ts(e,n){if(n){if(ms[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(r(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(r(61))}if(n.style!=null&&typeof n.style!="object")throw Error(r(62))}}function Ln(e,n){if(e.indexOf("-")===-1)return typeof n.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var gn=null;function ln(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Vt=null,vn=null,Qe=null;function _t(e){if(e=Ki(e)){if(typeof Vt!="function")throw Error(r(280));var n=e.stateNode;n&&(n=ia(n),Vt(e.stateNode,e.type,n))}}function ft(e){vn?Qe?Qe.push(e):Qe=[e]:vn=e}function Gt(){if(vn){var e=vn,n=Qe;if(Qe=vn=null,_t(e),n)for(e=0;e<n.length;e++)_t(n[e])}}function vt(e,n){return e(n)}function yt(){}var at=!1;function Kt(e,n,i){if(at)return e(n,i);at=!0;try{return vt(e,n,i)}finally{at=!1,(vn!==null||Qe!==null)&&(yt(),Gt())}}function rt(e,n){var i=e.stateNode;if(i===null)return null;var u=ia(i);if(u===null)return null;i=u[n];e:switch(n){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)||(e=e.type,u=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!u;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(r(231,n,typeof i));return i}var Ot=!1;if(p)try{var A={};Object.defineProperty(A,"passive",{get:function(){Ot=!0}}),window.addEventListener("test",A,A),window.removeEventListener("test",A,A)}catch{Ot=!1}function de(e,n,i,u,f,h,w,j,M){var V=Array.prototype.slice.call(arguments,3);try{n.apply(i,V)}catch(te){this.onError(te)}}var ie=!1,ke=null,Le=!1,Ke=null,Oe={onError:function(e){ie=!0,ke=e}};function Ft(e,n,i,u,f,h,w,j,M){ie=!1,ke=null,de.apply(Oe,arguments)}function On(e,n,i,u,f,h,w,j,M){if(Ft.apply(this,arguments),ie){if(ie){var V=ke;ie=!1,ke=null}else throw Error(r(198));Le||(Le=!0,Ke=V)}}function Be(e){var n=e,i=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(i=n.return),e=n.return;while(e)}return n.tag===3?i:null}function yn(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function Cs(e){if(Be(e)!==e)throw Error(r(188))}function Bs(e){var n=e.alternate;if(!n){if(n=Be(e),n===null)throw Error(r(188));return n!==e?null:e}for(var i=e,u=n;;){var f=i.return;if(f===null)break;var h=f.alternate;if(h===null){if(u=f.return,u!==null){i=u;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===i)return Cs(f),e;if(h===u)return Cs(f),n;h=h.sibling}throw Error(r(188))}if(i.return!==u.return)i=f,u=h;else{for(var w=!1,j=f.child;j;){if(j===i){w=!0,i=f,u=h;break}if(j===u){w=!0,u=f,i=h;break}j=j.sibling}if(!w){for(j=h.child;j;){if(j===i){w=!0,i=h,u=f;break}if(j===u){w=!0,u=h,i=f;break}j=j.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?e:n}function Pn(e){return e=Bs(e),e!==null?gs(e):null}function gs(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var n=gs(e);if(n!==null)return n;e=e.sibling}return null}var Ze=s.unstable_scheduleCallback,Et=s.unstable_cancelCallback,vs=s.unstable_shouldYield,Kl=s.unstable_requestPaint,kt=s.unstable_now,ys=s.unstable_getCurrentPriorityLevel,Ws=s.unstable_ImmediatePriority,xs=s.unstable_UserBlockingPriority,Br=s.unstable_NormalPriority,gr=s.unstable_LowPriority,Uo=s.unstable_IdlePriority,vr=null,$n=null;function Wr(e){if($n&&typeof $n.onCommitFiberRoot=="function")try{$n.onCommitFiberRoot(vr,e,void 0,(e.current.flags&128)===128)}catch{}}var xn=Math.clz32?Math.clz32:yr,Hr=Math.log,Hs=Math.LN2;function yr(e){return e>>>=0,e===0?32:31-(Hr(e)/Hs|0)|0}var wn=64,Vr=4194304;function xr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function wr(e,n){var i=e.pendingLanes;if(i===0)return 0;var u=0,f=e.suspendedLanes,h=e.pingedLanes,w=i&268435455;if(w!==0){var j=w&~f;j!==0?u=xr(j):(h&=w,h!==0&&(u=xr(h)))}else w=i&~f,w!==0?u=xr(w):h!==0&&(u=xr(h));if(u===0)return 0;if(n!==0&&n!==u&&(n&f)===0&&(f=u&-u,h=n&-n,f>=h||f===16&&(h&4194240)!==0))return n;if((u&4)!==0&&(u|=i&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=u;0<n;)i=31-xn(n),f=1<<i,u|=e[i],n&=~f;return u}function Bo(e,n){switch(e){case 1:case 2:case 4:return n+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 n+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 Wo(e,n){for(var i=e.suspendedLanes,u=e.pingedLanes,f=e.expirationTimes,h=e.pendingLanes;0<h;){var w=31-xn(h),j=1<<w,M=f[w];M===-1?((j&i)===0||(j&u)!==0)&&(f[w]=Bo(j,n)):M<=n&&(e.expiredLanes|=j),h&=~j}}function Ri(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Ai(){var e=wn;return wn<<=1,(wn&4194240)===0&&(wn=64),e}function Ii(e){for(var n=[],i=0;31>i;i++)n.push(e);return n}function kr(e,n,i){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-xn(n),e[n]=i}function Ho(e,n){var i=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var u=e.eventTimes;for(e=e.expirationTimes;0<i;){var f=31-xn(i),h=1<<f;n[f]=0,u[f]=-1,e[f]=-1,i&=~h}}function Vs(e,n){var i=e.entangledLanes|=n;for(e=e.entanglements;i;){var u=31-xn(i),f=1<<u;f&n|e[u]&n&&(e[u]|=n),i&=~f}}var qe=0;function ce(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var b,U,Q,je,Re,ze=!1,Ye=[],Je=null,St=null,bt=null,_s=new Map,At=new Map,Gs=[],gy="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 Jd(e,n){switch(e){case"focusin":case"focusout":Je=null;break;case"dragenter":case"dragleave":St=null;break;case"mouseover":case"mouseout":bt=null;break;case"pointerover":case"pointerout":_s.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":At.delete(n.pointerId)}}function Di(e,n,i,u,f,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:i,eventSystemFlags:u,nativeEvent:h,targetContainers:[f]},n!==null&&(n=Ki(n),n!==null&&U(n)),e):(e.eventSystemFlags|=u,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function vy(e,n,i,u,f){switch(n){case"focusin":return Je=Di(Je,e,n,i,u,f),!0;case"dragenter":return St=Di(St,e,n,i,u,f),!0;case"mouseover":return bt=Di(bt,e,n,i,u,f),!0;case"pointerover":var h=f.pointerId;return _s.set(h,Di(_s.get(h)||null,e,n,i,u,f)),!0;case"gotpointercapture":return h=f.pointerId,At.set(h,Di(At.get(h)||null,e,n,i,u,f)),!0}return!1}function ef(e){var n=Sr(e.target);if(n!==null){var i=Be(n);if(i!==null){if(n=i.tag,n===13){if(n=yn(i),n!==null){e.blockedOn=n,Re(e.priority,function(){Q(i)});return}}else if(n===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Vo(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var i=Yl(e.domEventName,e.eventSystemFlags,n[0],e.nativeEvent);if(i===null){i=e.nativeEvent;var u=new i.constructor(i.type,i);gn=u,i.target.dispatchEvent(u),gn=null}else return n=Ki(i),n!==null&&U(n),e.blockedOn=i,!1;n.shift()}return!0}function tf(e,n,i){Vo(e)&&i.delete(n)}function yy(){ze=!1,Je!==null&&Vo(Je)&&(Je=null),St!==null&&Vo(St)&&(St=null),bt!==null&&Vo(bt)&&(bt=null),_s.forEach(tf),At.forEach(tf)}function Mi(e,n){e.blockedOn===n&&(e.blockedOn=null,ze||(ze=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,yy)))}function Li(e){function n(f){return Mi(f,e)}if(0<Ye.length){Mi(Ye[0],e);for(var i=1;i<Ye.length;i++){var u=Ye[i];u.blockedOn===e&&(u.blockedOn=null)}}for(Je!==null&&Mi(Je,e),St!==null&&Mi(St,e),bt!==null&&Mi(bt,e),_s.forEach(n),At.forEach(n),i=0;i<Gs.length;i++)u=Gs[i],u.blockedOn===e&&(u.blockedOn=null);for(;0<Gs.length&&(i=Gs[0],i.blockedOn===null);)ef(i),i.blockedOn===null&&Gs.shift()}var Gr=D.ReactCurrentBatchConfig,Go=!0;function xy(e,n,i,u){var f=qe,h=Gr.transition;Gr.transition=null;try{qe=1,ql(e,n,i,u)}finally{qe=f,Gr.transition=h}}function wy(e,n,i,u){var f=qe,h=Gr.transition;Gr.transition=null;try{qe=4,ql(e,n,i,u)}finally{qe=f,Gr.transition=h}}function ql(e,n,i,u){if(Go){var f=Yl(e,n,i,u);if(f===null)fc(e,n,u,Ko,i),Jd(e,u);else if(vy(f,e,n,i,u))u.stopPropagation();else if(Jd(e,u),n&4&&-1<gy.indexOf(e)){for(;f!==null;){var h=Ki(f);if(h!==null&&b(h),h=Yl(e,n,i,u),h===null&&fc(e,n,u,Ko,i),h===f)break;f=h}f!==null&&u.stopPropagation()}else fc(e,n,u,null,i)}}var Ko=null;function Yl(e,n,i,u){if(Ko=null,e=ln(u),e=Sr(e),e!==null)if(n=Be(e),n===null)e=null;else if(i=n.tag,i===13){if(e=yn(n),e!==null)return e;e=null}else if(i===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null);return Ko=e,null}function nf(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(ys()){case Ws:return 1;case xs:return 4;case Br:case gr:return 16;case Uo:return 536870912;default:return 16}default:return 16}}var Ks=null,Xl=null,qo=null;function sf(){if(qo)return qo;var e,n=Xl,i=n.length,u,f="value"in Ks?Ks.value:Ks.textContent,h=f.length;for(e=0;e<i&&n[e]===f[e];e++);var w=i-e;for(u=1;u<=w&&n[i-u]===f[h-u];u++);return qo=f.slice(e,1<u?1-u:void 0)}function Yo(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function Xo(){return!0}function rf(){return!1}function zn(e){function n(i,u,f,h,w){this._reactName=i,this._targetInst=f,this.type=u,this.nativeEvent=h,this.target=w,this.currentTarget=null;for(var j in e)e.hasOwnProperty(j)&&(i=e[j],this[j]=i?i(h):h[j]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?Xo:rf,this.isPropagationStopped=rf,this}return L(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Xo)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Xo)},persist:function(){},isPersistent:Xo}),n}var Kr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ql=zn(Kr),Oi=L({},Kr,{view:0,detail:0}),ky=zn(Oi),Zl,Jl,Pi,Qo=L({},Oi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:tc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Pi&&(Pi&&e.type==="mousemove"?(Zl=e.screenX-Pi.screenX,Jl=e.screenY-Pi.screenY):Jl=Zl=0,Pi=e),Zl)},movementY:function(e){return"movementY"in e?e.movementY:Jl}}),of=zn(Qo),Sy=L({},Qo,{dataTransfer:0}),by=zn(Sy),Ty=L({},Oi,{relatedTarget:0}),ec=zn(Ty),Ny=L({},Kr,{animationName:0,elapsedTime:0,pseudoElement:0}),jy=zn(Ny),Cy=L({},Kr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),_y=zn(Cy),Ey=L({},Kr,{data:0}),af=zn(Ey),Ry={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ay={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"},Iy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Dy(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Iy[e])?!!n[e]:!1}function tc(){return Dy}var My=L({},Oi,{key:function(e){if(e.key){var n=Ry[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Yo(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ay[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:tc,charCode:function(e){return e.type==="keypress"?Yo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Yo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ly=zn(My),Oy=L({},Qo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),lf=zn(Oy),Py=L({},Oi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:tc}),$y=zn(Py),zy=L({},Kr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Fy=zn(zy),Uy=L({},Qo,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),By=zn(Uy),Wy=[9,13,27,32],nc=p&&"CompositionEvent"in window,$i=null;p&&"documentMode"in document&&($i=document.documentMode);var Hy=p&&"TextEvent"in window&&!$i,cf=p&&(!nc||$i&&8<$i&&11>=$i),uf=" ",df=!1;function ff(e,n){switch(e){case"keyup":return Wy.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function pf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var qr=!1;function Vy(e,n){switch(e){case"compositionend":return pf(n);case"keypress":return n.which!==32?null:(df=!0,uf);case"textInput":return e=n.data,e===uf&&df?null:e;default:return null}}function Gy(e,n){if(qr)return e==="compositionend"||!nc&&ff(e,n)?(e=sf(),qo=Xl=Ks=null,qr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return cf&&n.locale!=="ko"?null:n.data;default:return null}}var Ky={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 hf(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Ky[e.type]:n==="textarea"}function mf(e,n,i,u){ft(u),n=na(n,"onChange"),0<n.length&&(i=new Ql("onChange","change",null,i,u),e.push({event:i,listeners:n}))}var zi=null,Fi=null;function qy(e){Df(e,0)}function Zo(e){var n=Jr(e);if(Ee(n))return e}function Yy(e,n){if(e==="change")return n}var gf=!1;if(p){var sc;if(p){var rc="oninput"in document;if(!rc){var vf=document.createElement("div");vf.setAttribute("oninput","return;"),rc=typeof vf.oninput=="function"}sc=rc}else sc=!1;gf=sc&&(!document.documentMode||9<document.documentMode)}function yf(){zi&&(zi.detachEvent("onpropertychange",xf),Fi=zi=null)}function xf(e){if(e.propertyName==="value"&&Zo(Fi)){var n=[];mf(n,Fi,e,ln(e)),Kt(qy,n)}}function Xy(e,n,i){e==="focusin"?(yf(),zi=n,Fi=i,zi.attachEvent("onpropertychange",xf)):e==="focusout"&&yf()}function Qy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Zo(Fi)}function Zy(e,n){if(e==="click")return Zo(n)}function Jy(e,n){if(e==="input"||e==="change")return Zo(n)}function ex(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var ns=typeof Object.is=="function"?Object.is:ex;function Ui(e,n){if(ns(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var i=Object.keys(e),u=Object.keys(n);if(i.length!==u.length)return!1;for(u=0;u<i.length;u++){var f=i[u];if(!g.call(n,f)||!ns(e[f],n[f]))return!1}return!0}function wf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function kf(e,n){var i=wf(e);e=0;for(var u;i;){if(i.nodeType===3){if(u=e+i.textContent.length,e<=n&&u>=n)return{node:i,offset:n-e};e=u}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=wf(i)}}function Sf(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Sf(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function bf(){for(var e=window,n=ct();n instanceof e.HTMLIFrameElement;){try{var i=typeof n.contentWindow.location.href=="string"}catch{i=!1}if(i)e=n.contentWindow;else break;n=ct(e.document)}return n}function ic(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function tx(e){var n=bf(),i=e.focusedElem,u=e.selectionRange;if(n!==i&&i&&i.ownerDocument&&Sf(i.ownerDocument.documentElement,i)){if(u!==null&&ic(i)){if(n=u.start,e=u.end,e===void 0&&(e=n),"selectionStart"in i)i.selectionStart=n,i.selectionEnd=Math.min(e,i.value.length);else if(e=(n=i.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var f=i.textContent.length,h=Math.min(u.start,f);u=u.end===void 0?h:Math.min(u.end,f),!e.extend&&h>u&&(f=u,u=h,h=f),f=kf(i,h);var w=kf(i,u);f&&w&&(e.rangeCount!==1||e.anchorNode!==f.node||e.anchorOffset!==f.offset||e.focusNode!==w.node||e.focusOffset!==w.offset)&&(n=n.createRange(),n.setStart(f.node,f.offset),e.removeAllRanges(),h>u?(e.addRange(n),e.extend(w.node,w.offset)):(n.setEnd(w.node,w.offset),e.addRange(n)))}}for(n=[],e=i;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<n.length;i++)e=n[i],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var nx=p&&"documentMode"in document&&11>=document.documentMode,Yr=null,oc=null,Bi=null,ac=!1;function Tf(e,n,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;ac||Yr==null||Yr!==ct(u)||(u=Yr,"selectionStart"in u&&ic(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}),Bi&&Ui(Bi,u)||(Bi=u,u=na(oc,"onSelect"),0<u.length&&(n=new Ql("onSelect","select",null,n,i),e.push({event:n,listeners:u}),n.target=Yr)))}function Jo(e,n){var i={};return i[e.toLowerCase()]=n.toLowerCase(),i["Webkit"+e]="webkit"+n,i["Moz"+e]="moz"+n,i}var Xr={animationend:Jo("Animation","AnimationEnd"),animationiteration:Jo("Animation","AnimationIteration"),animationstart:Jo("Animation","AnimationStart"),transitionend:Jo("Transition","TransitionEnd")},lc={},Nf={};p&&(Nf=document.createElement("div").style,"AnimationEvent"in window||(delete Xr.animationend.animation,delete Xr.animationiteration.animation,delete Xr.animationstart.animation),"TransitionEvent"in window||delete Xr.transitionend.transition);function ea(e){if(lc[e])return lc[e];if(!Xr[e])return e;var n=Xr[e],i;for(i in n)if(n.hasOwnProperty(i)&&i in Nf)return lc[e]=n[i];return e}var jf=ea("animationend"),Cf=ea("animationiteration"),_f=ea("animationstart"),Ef=ea("transitionend"),Rf=new Map,Af="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(e,n){Rf.set(e,n),c(n,[e])}for(var cc=0;cc<Af.length;cc++){var uc=Af[cc],sx=uc.toLowerCase(),rx=uc[0].toUpperCase()+uc.slice(1);qs(sx,"on"+rx)}qs(jf,"onAnimationEnd"),qs(Cf,"onAnimationIteration"),qs(_f,"onAnimationStart"),qs("dblclick","onDoubleClick"),qs("focusin","onFocus"),qs("focusout","onBlur"),qs(Ef,"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 Wi="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(" "),ix=new Set("cancel close invalid load scroll toggle".split(" ").concat(Wi));function If(e,n,i){var u=e.type||"unknown-event";e.currentTarget=i,On(u,n,void 0,e),e.currentTarget=null}function Df(e,n){n=(n&4)!==0;for(var i=0;i<e.length;i++){var u=e[i],f=u.event;u=u.listeners;e:{var h=void 0;if(n)for(var w=u.length-1;0<=w;w--){var j=u[w],M=j.instance,V=j.currentTarget;if(j=j.listener,M!==h&&f.isPropagationStopped())break e;If(f,j,V),h=M}else for(w=0;w<u.length;w++){if(j=u[w],M=j.instance,V=j.currentTarget,j=j.listener,M!==h&&f.isPropagationStopped())break e;If(f,j,V),h=M}}}if(Le)throw e=Ke,Le=!1,Ke=null,e}function pt(e,n){var i=n[yc];i===void 0&&(i=n[yc]=new Set);var u=e+"__bubble";i.has(u)||(Mf(n,e,2,!1),i.add(u))}function dc(e,n,i){var u=0;n&&(u|=4),Mf(i,e,u,n)}var ta="_reactListening"+Math.random().toString(36).slice(2);function Hi(e){if(!e[ta]){e[ta]=!0,o.forEach(function(i){i!=="selectionchange"&&(ix.has(i)||dc(i,!1,e),dc(i,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[ta]||(n[ta]=!0,dc("selectionchange",!1,n))}}function Mf(e,n,i,u){switch(nf(n)){case 1:var f=xy;break;case 4:f=wy;break;default:f=ql}i=f.bind(null,n,i,e),f=void 0,!Ot||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),u?f!==void 0?e.addEventListener(n,i,{capture:!0,passive:f}):e.addEventListener(n,i,!0):f!==void 0?e.addEventListener(n,i,{passive:f}):e.addEventListener(n,i,!1)}function fc(e,n,i,u,f){var h=u;if((n&1)===0&&(n&2)===0&&u!==null)e:for(;;){if(u===null)return;var w=u.tag;if(w===3||w===4){var j=u.stateNode.containerInfo;if(j===f||j.nodeType===8&&j.parentNode===f)break;if(w===4)for(w=u.return;w!==null;){var M=w.tag;if((M===3||M===4)&&(M=w.stateNode.containerInfo,M===f||M.nodeType===8&&M.parentNode===f))return;w=w.return}for(;j!==null;){if(w=Sr(j),w===null)return;if(M=w.tag,M===5||M===6){u=h=w;continue e}j=j.parentNode}}u=u.return}Kt(function(){var V=h,te=ln(i),re=[];e:{var Z=Rf.get(e);if(Z!==void 0){var xe=Ql,Ne=e;switch(e){case"keypress":if(Yo(i)===0)break e;case"keydown":case"keyup":xe=Ly;break;case"focusin":Ne="focus",xe=ec;break;case"focusout":Ne="blur",xe=ec;break;case"beforeblur":case"afterblur":xe=ec;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=of;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":xe=by;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":xe=$y;break;case jf:case Cf:case _f:xe=jy;break;case Ef:xe=Fy;break;case"scroll":xe=ky;break;case"wheel":xe=By;break;case"copy":case"cut":case"paste":xe=_y;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":xe=lf}var Ce=(n&4)!==0,It=!Ce&&e==="scroll",B=Ce?Z!==null?Z+"Capture":null:Z;Ce=[];for(var P=V,W;P!==null;){W=P;var ue=W.stateNode;if(W.tag===5&&ue!==null&&(W=ue,B!==null&&(ue=rt(P,B),ue!=null&&Ce.push(Vi(P,ue,W)))),It)break;P=P.return}0<Ce.length&&(Z=new xe(Z,Ne,null,i,te),re.push({event:Z,listeners:Ce}))}}if((n&7)===0){e:{if(Z=e==="mouseover"||e==="pointerover",xe=e==="mouseout"||e==="pointerout",Z&&i!==gn&&(Ne=i.relatedTarget||i.fromElement)&&(Sr(Ne)||Ne[Es]))break e;if((xe||Z)&&(Z=te.window===te?te:(Z=te.ownerDocument)?Z.defaultView||Z.parentWindow:window,xe?(Ne=i.relatedTarget||i.toElement,xe=V,Ne=Ne?Sr(Ne):null,Ne!==null&&(It=Be(Ne),Ne!==It||Ne.tag!==5&&Ne.tag!==6)&&(Ne=null)):(xe=null,Ne=V),xe!==Ne)){if(Ce=of,ue="onMouseLeave",B="onMouseEnter",P="mouse",(e==="pointerout"||e==="pointerover")&&(Ce=lf,ue="onPointerLeave",B="onPointerEnter",P="pointer"),It=xe==null?Z:Jr(xe),W=Ne==null?Z:Jr(Ne),Z=new Ce(ue,P+"leave",xe,i,te),Z.target=It,Z.relatedTarget=W,ue=null,Sr(te)===V&&(Ce=new Ce(B,P+"enter",Ne,i,te),Ce.target=W,Ce.relatedTarget=It,ue=Ce),It=ue,xe&&Ne)t:{for(Ce=xe,B=Ne,P=0,W=Ce;W;W=Qr(W))P++;for(W=0,ue=B;ue;ue=Qr(ue))W++;for(;0<P-W;)Ce=Qr(Ce),P--;for(;0<W-P;)B=Qr(B),W--;for(;P--;){if(Ce===B||B!==null&&Ce===B.alternate)break t;Ce=Qr(Ce),B=Qr(B)}Ce=null}else Ce=null;xe!==null&&Lf(re,Z,xe,Ce,!1),Ne!==null&&It!==null&&Lf(re,It,Ne,Ce,!0)}}e:{if(Z=V?Jr(V):window,xe=Z.nodeName&&Z.nodeName.toLowerCase(),xe==="select"||xe==="input"&&Z.type==="file")var _e=Yy;else if(hf(Z))if(gf)_e=Jy;else{_e=Qy;var De=Xy}else(xe=Z.nodeName)&&xe.toLowerCase()==="input"&&(Z.type==="checkbox"||Z.type==="radio")&&(_e=Zy);if(_e&&(_e=_e(e,V))){mf(re,_e,i,te);break e}De&&De(e,Z,V),e==="focusout"&&(De=Z._wrapperState)&&De.controlled&&Z.type==="number"&&wt(Z,"number",Z.value)}switch(De=V?Jr(V):window,e){case"focusin":(hf(De)||De.contentEditable==="true")&&(Yr=De,oc=V,Bi=null);break;case"focusout":Bi=oc=Yr=null;break;case"mousedown":ac=!0;break;case"contextmenu":case"mouseup":case"dragend":ac=!1,Tf(re,i,te);break;case"selectionchange":if(nx)break;case"keydown":case"keyup":Tf(re,i,te)}var Me;if(nc)e:{switch(e){case"compositionstart":var Pe="onCompositionStart";break e;case"compositionend":Pe="onCompositionEnd";break e;case"compositionupdate":Pe="onCompositionUpdate";break e}Pe=void 0}else qr?ff(e,i)&&(Pe="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(Pe="onCompositionStart");Pe&&(cf&&i.locale!=="ko"&&(qr||Pe!=="onCompositionStart"?Pe==="onCompositionEnd"&&qr&&(Me=sf()):(Ks=te,Xl="value"in Ks?Ks.value:Ks.textContent,qr=!0)),De=na(V,Pe),0<De.length&&(Pe=new af(Pe,e,null,i,te),re.push({event:Pe,listeners:De}),Me?Pe.data=Me:(Me=pf(i),Me!==null&&(Pe.data=Me)))),(Me=Hy?Vy(e,i):Gy(e,i))&&(V=na(V,"onBeforeInput"),0<V.length&&(te=new af("onBeforeInput","beforeinput",null,i,te),re.push({event:te,listeners:V}),te.data=Me))}Df(re,n)})}function Vi(e,n,i){return{instance:e,listener:n,currentTarget:i}}function na(e,n){for(var i=n+"Capture",u=[];e!==null;){var f=e,h=f.stateNode;f.tag===5&&h!==null&&(f=h,h=rt(e,i),h!=null&&u.unshift(Vi(e,h,f)),h=rt(e,n),h!=null&&u.push(Vi(e,h,f))),e=e.return}return u}function Qr(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Lf(e,n,i,u,f){for(var h=n._reactName,w=[];i!==null&&i!==u;){var j=i,M=j.alternate,V=j.stateNode;if(M!==null&&M===u)break;j.tag===5&&V!==null&&(j=V,f?(M=rt(i,h),M!=null&&w.unshift(Vi(i,M,j))):f||(M=rt(i,h),M!=null&&w.push(Vi(i,M,j)))),i=i.return}w.length!==0&&e.push({event:n,listeners:w})}var ox=/\r\n?/g,ax=/\u0000|\uFFFD/g;function Of(e){return(typeof e=="string"?e:""+e).replace(ox,`
39
- `).replace(ax,"")}function sa(e,n,i){if(n=Of(n),Of(e)!==n&&i)throw Error(r(425))}function ra(){}var pc=null,hc=null;function mc(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var gc=typeof setTimeout=="function"?setTimeout:void 0,lx=typeof clearTimeout=="function"?clearTimeout:void 0,Pf=typeof Promise=="function"?Promise:void 0,cx=typeof queueMicrotask=="function"?queueMicrotask:typeof Pf<"u"?function(e){return Pf.resolve(null).then(e).catch(ux)}:gc;function ux(e){setTimeout(function(){throw e})}function vc(e,n){var i=n,u=0;do{var f=i.nextSibling;if(e.removeChild(i),f&&f.nodeType===8)if(i=f.data,i==="/$"){if(u===0){e.removeChild(f),Li(n);return}u--}else i!=="$"&&i!=="$?"&&i!=="$!"||u++;i=f}while(i);Li(n)}function Ys(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?")break;if(n==="/$")return null}}return e}function $f(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"){if(n===0)return e;n--}else i==="/$"&&n++}e=e.previousSibling}return null}var Zr=Math.random().toString(36).slice(2),ws="__reactFiber$"+Zr,Gi="__reactProps$"+Zr,Es="__reactContainer$"+Zr,yc="__reactEvents$"+Zr,dx="__reactListeners$"+Zr,fx="__reactHandles$"+Zr;function Sr(e){var n=e[ws];if(n)return n;for(var i=e.parentNode;i;){if(n=i[Es]||i[ws]){if(i=n.alternate,n.child!==null||i!==null&&i.child!==null)for(e=$f(e);e!==null;){if(i=e[ws])return i;e=$f(e)}return n}e=i,i=e.parentNode}return null}function Ki(e){return e=e[ws]||e[Es],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Jr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function ia(e){return e[Gi]||null}var xc=[],ei=-1;function Xs(e){return{current:e}}function ht(e){0>ei||(e.current=xc[ei],xc[ei]=null,ei--)}function ut(e,n){ei++,xc[ei]=e.current,e.current=n}var Qs={},cn=Xs(Qs),jn=Xs(!1),br=Qs;function ti(e,n){var i=e.type.contextTypes;if(!i)return Qs;var u=e.stateNode;if(u&&u.__reactInternalMemoizedUnmaskedChildContext===n)return u.__reactInternalMemoizedMaskedChildContext;var f={},h;for(h in i)f[h]=n[h];return u&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=f),f}function Cn(e){return e=e.childContextTypes,e!=null}function oa(){ht(jn),ht(cn)}function zf(e,n,i){if(cn.current!==Qs)throw Error(r(168));ut(cn,n),ut(jn,i)}function Ff(e,n,i){var u=e.stateNode;if(n=n.childContextTypes,typeof u.getChildContext!="function")return i;u=u.getChildContext();for(var f in u)if(!(f in n))throw Error(r(108,Te(e)||"Unknown",f));return L({},i,u)}function aa(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Qs,br=cn.current,ut(cn,e),ut(jn,jn.current),!0}function Uf(e,n,i){var u=e.stateNode;if(!u)throw Error(r(169));i?(e=Ff(e,n,br),u.__reactInternalMemoizedMergedChildContext=e,ht(jn),ht(cn),ut(cn,e)):ht(jn),ut(jn,i)}var Rs=null,la=!1,wc=!1;function Bf(e){Rs===null?Rs=[e]:Rs.push(e)}function px(e){la=!0,Bf(e)}function Zs(){if(!wc&&Rs!==null){wc=!0;var e=0,n=qe;try{var i=Rs;for(qe=1;e<i.length;e++){var u=i[e];do u=u(!0);while(u!==null)}Rs=null,la=!1}catch(f){throw Rs!==null&&(Rs=Rs.slice(e+1)),Ze(Ws,Zs),f}finally{qe=n,wc=!1}}return null}var ni=[],si=0,ca=null,ua=0,Kn=[],qn=0,Tr=null,As=1,Is="";function Nr(e,n){ni[si++]=ua,ni[si++]=ca,ca=e,ua=n}function Wf(e,n,i){Kn[qn++]=As,Kn[qn++]=Is,Kn[qn++]=Tr,Tr=e;var u=As;e=Is;var f=32-xn(u)-1;u&=~(1<<f),i+=1;var h=32-xn(n)+f;if(30<h){var w=f-f%5;h=(u&(1<<w)-1).toString(32),u>>=w,f-=w,As=1<<32-xn(n)+f|i<<f|u,Is=h+e}else As=1<<h|i<<f|u,Is=e}function kc(e){e.return!==null&&(Nr(e,1),Wf(e,1,0))}function Sc(e){for(;e===ca;)ca=ni[--si],ni[si]=null,ua=ni[--si],ni[si]=null;for(;e===Tr;)Tr=Kn[--qn],Kn[qn]=null,Is=Kn[--qn],Kn[qn]=null,As=Kn[--qn],Kn[qn]=null}var Fn=null,Un=null,xt=!1,ss=null;function Hf(e,n){var i=Zn(5,null,null,0);i.elementType="DELETED",i.stateNode=n,i.return=e,n=e.deletions,n===null?(e.deletions=[i],e.flags|=16):n.push(i)}function Vf(e,n){switch(e.tag){case 5:var i=e.type;return n=n.nodeType!==1||i.toLowerCase()!==n.nodeName.toLowerCase()?null:n,n!==null?(e.stateNode=n,Fn=e,Un=Ys(n.firstChild),!0):!1;case 6:return n=e.pendingProps===""||n.nodeType!==3?null:n,n!==null?(e.stateNode=n,Fn=e,Un=null,!0):!1;case 13:return n=n.nodeType!==8?null:n,n!==null?(i=Tr!==null?{id:As,overflow:Is}:null,e.memoizedState={dehydrated:n,treeContext:i,retryLane:1073741824},i=Zn(18,null,null,0),i.stateNode=n,i.return=e,e.child=i,Fn=e,Un=null,!0):!1;default:return!1}}function bc(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Tc(e){if(xt){var n=Un;if(n){var i=n;if(!Vf(e,n)){if(bc(e))throw Error(r(418));n=Ys(i.nextSibling);var u=Fn;n&&Vf(e,n)?Hf(u,i):(e.flags=e.flags&-4097|2,xt=!1,Fn=e)}}else{if(bc(e))throw Error(r(418));e.flags=e.flags&-4097|2,xt=!1,Fn=e}}}function Gf(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Fn=e}function da(e){if(e!==Fn)return!1;if(!xt)return Gf(e),xt=!0,!1;var n;if((n=e.tag!==3)&&!(n=e.tag!==5)&&(n=e.type,n=n!=="head"&&n!=="body"&&!mc(e.type,e.memoizedProps)),n&&(n=Un)){if(bc(e))throw Kf(),Error(r(418));for(;n;)Hf(e,n),n=Ys(n.nextSibling)}if(Gf(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));e:{for(e=e.nextSibling,n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"){if(n===0){Un=Ys(e.nextSibling);break e}n--}else i!=="$"&&i!=="$!"&&i!=="$?"||n++}e=e.nextSibling}Un=null}}else Un=Fn?Ys(e.stateNode.nextSibling):null;return!0}function Kf(){for(var e=Un;e;)e=Ys(e.nextSibling)}function ri(){Un=Fn=null,xt=!1}function Nc(e){ss===null?ss=[e]:ss.push(e)}var hx=D.ReactCurrentBatchConfig;function qi(e,n,i){if(e=i.ref,e!==null&&typeof e!="function"&&typeof e!="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,e));var f=u,h=""+e;return n!==null&&n.ref!==null&&typeof n.ref=="function"&&n.ref._stringRef===h?n.ref:(n=function(w){var j=f.refs;w===null?delete j[h]:j[h]=w},n._stringRef=h,n)}if(typeof e!="string")throw Error(r(284));if(!i._owner)throw Error(r(290,e))}return e}function fa(e,n){throw e=Object.prototype.toString.call(n),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e))}function qf(e){var n=e._init;return n(e._payload)}function Yf(e){function n(B,P){if(e){var W=B.deletions;W===null?(B.deletions=[P],B.flags|=16):W.push(P)}}function i(B,P){if(!e)return null;for(;P!==null;)n(B,P),P=P.sibling;return null}function u(B,P){for(B=new Map;P!==null;)P.key!==null?B.set(P.key,P):B.set(P.index,P),P=P.sibling;return B}function f(B,P){return B=or(B,P),B.index=0,B.sibling=null,B}function h(B,P,W){return B.index=W,e?(W=B.alternate,W!==null?(W=W.index,W<P?(B.flags|=2,P):W):(B.flags|=2,P)):(B.flags|=1048576,P)}function w(B){return e&&B.alternate===null&&(B.flags|=2),B}function j(B,P,W,ue){return P===null||P.tag!==6?(P=gu(W,B.mode,ue),P.return=B,P):(P=f(P,W),P.return=B,P)}function M(B,P,W,ue){var _e=W.type;return _e===G?te(B,P,W.props.children,ue,W.key):P!==null&&(P.elementType===_e||typeof _e=="object"&&_e!==null&&_e.$$typeof===ne&&qf(_e)===P.type)?(ue=f(P,W.props),ue.ref=qi(B,P,W),ue.return=B,ue):(ue=Oa(W.type,W.key,W.props,null,B.mode,ue),ue.ref=qi(B,P,W),ue.return=B,ue)}function V(B,P,W,ue){return P===null||P.tag!==4||P.stateNode.containerInfo!==W.containerInfo||P.stateNode.implementation!==W.implementation?(P=vu(W,B.mode,ue),P.return=B,P):(P=f(P,W.children||[]),P.return=B,P)}function te(B,P,W,ue,_e){return P===null||P.tag!==7?(P=Dr(W,B.mode,ue,_e),P.return=B,P):(P=f(P,W),P.return=B,P)}function re(B,P,W){if(typeof P=="string"&&P!==""||typeof P=="number")return P=gu(""+P,B.mode,W),P.return=B,P;if(typeof P=="object"&&P!==null){switch(P.$$typeof){case O:return W=Oa(P.type,P.key,P.props,null,B.mode,W),W.ref=qi(B,null,P),W.return=B,W;case K:return P=vu(P,B.mode,W),P.return=B,P;case ne:var ue=P._init;return re(B,ue(P._payload),W)}if(jt(P)||X(P))return P=Dr(P,B.mode,W,null),P.return=B,P;fa(B,P)}return null}function Z(B,P,W,ue){var _e=P!==null?P.key:null;if(typeof W=="string"&&W!==""||typeof W=="number")return _e!==null?null:j(B,P,""+W,ue);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case O:return W.key===_e?M(B,P,W,ue):null;case K:return W.key===_e?V(B,P,W,ue):null;case ne:return _e=W._init,Z(B,P,_e(W._payload),ue)}if(jt(W)||X(W))return _e!==null?null:te(B,P,W,ue,null);fa(B,W)}return null}function xe(B,P,W,ue,_e){if(typeof ue=="string"&&ue!==""||typeof ue=="number")return B=B.get(W)||null,j(P,B,""+ue,_e);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case O:return B=B.get(ue.key===null?W:ue.key)||null,M(P,B,ue,_e);case K:return B=B.get(ue.key===null?W:ue.key)||null,V(P,B,ue,_e);case ne:var De=ue._init;return xe(B,P,W,De(ue._payload),_e)}if(jt(ue)||X(ue))return B=B.get(W)||null,te(P,B,ue,_e,null);fa(P,ue)}return null}function Ne(B,P,W,ue){for(var _e=null,De=null,Me=P,Pe=P=0,Xt=null;Me!==null&&Pe<W.length;Pe++){Me.index>Pe?(Xt=Me,Me=null):Xt=Me.sibling;var et=Z(B,Me,W[Pe],ue);if(et===null){Me===null&&(Me=Xt);break}e&&Me&&et.alternate===null&&n(B,Me),P=h(et,P,Pe),De===null?_e=et:De.sibling=et,De=et,Me=Xt}if(Pe===W.length)return i(B,Me),xt&&Nr(B,Pe),_e;if(Me===null){for(;Pe<W.length;Pe++)Me=re(B,W[Pe],ue),Me!==null&&(P=h(Me,P,Pe),De===null?_e=Me:De.sibling=Me,De=Me);return xt&&Nr(B,Pe),_e}for(Me=u(B,Me);Pe<W.length;Pe++)Xt=xe(Me,B,Pe,W[Pe],ue),Xt!==null&&(e&&Xt.alternate!==null&&Me.delete(Xt.key===null?Pe:Xt.key),P=h(Xt,P,Pe),De===null?_e=Xt:De.sibling=Xt,De=Xt);return e&&Me.forEach(function(ar){return n(B,ar)}),xt&&Nr(B,Pe),_e}function Ce(B,P,W,ue){var _e=X(W);if(typeof _e!="function")throw Error(r(150));if(W=_e.call(W),W==null)throw Error(r(151));for(var De=_e=null,Me=P,Pe=P=0,Xt=null,et=W.next();Me!==null&&!et.done;Pe++,et=W.next()){Me.index>Pe?(Xt=Me,Me=null):Xt=Me.sibling;var ar=Z(B,Me,et.value,ue);if(ar===null){Me===null&&(Me=Xt);break}e&&Me&&ar.alternate===null&&n(B,Me),P=h(ar,P,Pe),De===null?_e=ar:De.sibling=ar,De=ar,Me=Xt}if(et.done)return i(B,Me),xt&&Nr(B,Pe),_e;if(Me===null){for(;!et.done;Pe++,et=W.next())et=re(B,et.value,ue),et!==null&&(P=h(et,P,Pe),De===null?_e=et:De.sibling=et,De=et);return xt&&Nr(B,Pe),_e}for(Me=u(B,Me);!et.done;Pe++,et=W.next())et=xe(Me,B,Pe,et.value,ue),et!==null&&(e&&et.alternate!==null&&Me.delete(et.key===null?Pe:et.key),P=h(et,P,Pe),De===null?_e=et:De.sibling=et,De=et);return e&&Me.forEach(function(Kx){return n(B,Kx)}),xt&&Nr(B,Pe),_e}function It(B,P,W,ue){if(typeof W=="object"&&W!==null&&W.type===G&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case O:e:{for(var _e=W.key,De=P;De!==null;){if(De.key===_e){if(_e=W.type,_e===G){if(De.tag===7){i(B,De.sibling),P=f(De,W.props.children),P.return=B,B=P;break e}}else if(De.elementType===_e||typeof _e=="object"&&_e!==null&&_e.$$typeof===ne&&qf(_e)===De.type){i(B,De.sibling),P=f(De,W.props),P.ref=qi(B,De,W),P.return=B,B=P;break e}i(B,De);break}else n(B,De);De=De.sibling}W.type===G?(P=Dr(W.props.children,B.mode,ue,W.key),P.return=B,B=P):(ue=Oa(W.type,W.key,W.props,null,B.mode,ue),ue.ref=qi(B,P,W),ue.return=B,B=ue)}return w(B);case K:e:{for(De=W.key;P!==null;){if(P.key===De)if(P.tag===4&&P.stateNode.containerInfo===W.containerInfo&&P.stateNode.implementation===W.implementation){i(B,P.sibling),P=f(P,W.children||[]),P.return=B,B=P;break e}else{i(B,P);break}else n(B,P);P=P.sibling}P=vu(W,B.mode,ue),P.return=B,B=P}return w(B);case ne:return De=W._init,It(B,P,De(W._payload),ue)}if(jt(W))return Ne(B,P,W,ue);if(X(W))return Ce(B,P,W,ue);fa(B,W)}return typeof W=="string"&&W!==""||typeof W=="number"?(W=""+W,P!==null&&P.tag===6?(i(B,P.sibling),P=f(P,W),P.return=B,B=P):(i(B,P),P=gu(W,B.mode,ue),P.return=B,B=P),w(B)):i(B,P)}return It}var ii=Yf(!0),Xf=Yf(!1),pa=Xs(null),ha=null,oi=null,jc=null;function Cc(){jc=oi=ha=null}function _c(e){var n=pa.current;ht(pa),e._currentValue=n}function Ec(e,n,i){for(;e!==null;){var u=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,u!==null&&(u.childLanes|=n)):u!==null&&(u.childLanes&n)!==n&&(u.childLanes|=n),e===i)break;e=e.return}}function ai(e,n){ha=e,jc=oi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&n)!==0&&(_n=!0),e.firstContext=null)}function Yn(e){var n=e._currentValue;if(jc!==e)if(e={context:e,memoizedValue:n,next:null},oi===null){if(ha===null)throw Error(r(308));oi=e,ha.dependencies={lanes:0,firstContext:e}}else oi=oi.next=e;return n}var jr=null;function Rc(e){jr===null?jr=[e]:jr.push(e)}function Qf(e,n,i,u){var f=n.interleaved;return f===null?(i.next=i,Rc(n)):(i.next=f.next,f.next=i),n.interleaved=i,Ds(e,u)}function Ds(e,n){e.lanes|=n;var i=e.alternate;for(i!==null&&(i.lanes|=n),i=e,e=e.return;e!==null;)e.childLanes|=n,i=e.alternate,i!==null&&(i.childLanes|=n),i=e,e=e.return;return i.tag===3?i.stateNode:null}var Js=!1;function Ac(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Zf(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ms(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function er(e,n,i){var u=e.updateQueue;if(u===null)return null;if(u=u.shared,(Xe&2)!==0){var f=u.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),u.pending=n,Ds(e,i)}return f=u.interleaved,f===null?(n.next=n,Rc(u)):(n.next=f.next,f.next=n),u.interleaved=n,Ds(e,i)}function ma(e,n,i){if(n=n.updateQueue,n!==null&&(n=n.shared,(i&4194240)!==0)){var u=n.lanes;u&=e.pendingLanes,i|=u,n.lanes=i,Vs(e,i)}}function Jf(e,n){var i=e.updateQueue,u=e.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var f=null,h=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};h===null?f=h=w:h=h.next=w,i=i.next}while(i!==null);h===null?f=h=n:h=h.next=n}else f=h=n;i={baseState:u.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:u.shared,effects:u.effects},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=n:e.next=n,i.lastBaseUpdate=n}function ga(e,n,i,u){var f=e.updateQueue;Js=!1;var h=f.firstBaseUpdate,w=f.lastBaseUpdate,j=f.shared.pending;if(j!==null){f.shared.pending=null;var M=j,V=M.next;M.next=null,w===null?h=V:w.next=V,w=M;var te=e.alternate;te!==null&&(te=te.updateQueue,j=te.lastBaseUpdate,j!==w&&(j===null?te.firstBaseUpdate=V:j.next=V,te.lastBaseUpdate=M))}if(h!==null){var re=f.baseState;w=0,te=V=M=null,j=h;do{var Z=j.lane,xe=j.eventTime;if((u&Z)===Z){te!==null&&(te=te.next={eventTime:xe,lane:0,tag:j.tag,payload:j.payload,callback:j.callback,next:null});e:{var Ne=e,Ce=j;switch(Z=n,xe=i,Ce.tag){case 1:if(Ne=Ce.payload,typeof Ne=="function"){re=Ne.call(xe,re,Z);break e}re=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Ce.payload,Z=typeof Ne=="function"?Ne.call(xe,re,Z):Ne,Z==null)break e;re=L({},re,Z);break e;case 2:Js=!0}}j.callback!==null&&j.lane!==0&&(e.flags|=64,Z=f.effects,Z===null?f.effects=[j]:Z.push(j))}else xe={eventTime:xe,lane:Z,tag:j.tag,payload:j.payload,callback:j.callback,next:null},te===null?(V=te=xe,M=re):te=te.next=xe,w|=Z;if(j=j.next,j===null){if(j=f.shared.pending,j===null)break;Z=j,j=Z.next,Z.next=null,f.lastBaseUpdate=Z,f.shared.pending=null}}while(!0);if(te===null&&(M=re),f.baseState=M,f.firstBaseUpdate=V,f.lastBaseUpdate=te,n=f.shared.interleaved,n!==null){f=n;do w|=f.lane,f=f.next;while(f!==n)}else h===null&&(f.shared.lanes=0);Er|=w,e.lanes=w,e.memoizedState=re}}function ep(e,n,i){if(e=n.effects,n.effects=null,e!==null)for(n=0;n<e.length;n++){var u=e[n],f=u.callback;if(f!==null){if(u.callback=null,u=i,typeof f!="function")throw Error(r(191,f));f.call(u)}}}var Yi={},ks=Xs(Yi),Xi=Xs(Yi),Qi=Xs(Yi);function Cr(e){if(e===Yi)throw Error(r(174));return e}function Ic(e,n){switch(ut(Qi,n),ut(Xi,e),ut(ks,Yi),e=n.nodeType,e){case 9:case 11:n=(n=n.documentElement)?n.namespaceURI:mt(null,"");break;default:e=e===8?n.parentNode:n,n=e.namespaceURI||null,e=e.tagName,n=mt(n,e)}ht(ks),ut(ks,n)}function li(){ht(ks),ht(Xi),ht(Qi)}function tp(e){Cr(Qi.current);var n=Cr(ks.current),i=mt(n,e.type);n!==i&&(ut(Xi,e),ut(ks,i))}function Dc(e){Xi.current===e&&(ht(ks),ht(Xi))}var Tt=Xs(0);function va(e){for(var n=e;n!==null;){if(n.tag===13){var i=n.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.data==="$!"))return n}else if(n.tag===19&&n.memoizedProps.revealOrder!==void 0){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Mc=[];function Lc(){for(var e=0;e<Mc.length;e++)Mc[e]._workInProgressVersionPrimary=null;Mc.length=0}var ya=D.ReactCurrentDispatcher,Oc=D.ReactCurrentBatchConfig,_r=0,Nt=null,Ut=null,qt=null,xa=!1,Zi=!1,Ji=0,mx=0;function un(){throw Error(r(321))}function Pc(e,n){if(n===null)return!1;for(var i=0;i<n.length&&i<e.length;i++)if(!ns(e[i],n[i]))return!1;return!0}function $c(e,n,i,u,f,h){if(_r=h,Nt=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,ya.current=e===null||e.memoizedState===null?xx:wx,e=i(u,f),Zi){h=0;do{if(Zi=!1,Ji=0,25<=h)throw Error(r(301));h+=1,qt=Ut=null,n.updateQueue=null,ya.current=kx,e=i(u,f)}while(Zi)}if(ya.current=Sa,n=Ut!==null&&Ut.next!==null,_r=0,qt=Ut=Nt=null,xa=!1,n)throw Error(r(300));return e}function zc(){var e=Ji!==0;return Ji=0,e}function Ss(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qt===null?Nt.memoizedState=qt=e:qt=qt.next=e,qt}function Xn(){if(Ut===null){var e=Nt.alternate;e=e!==null?e.memoizedState:null}else e=Ut.next;var n=qt===null?Nt.memoizedState:qt.next;if(n!==null)qt=n,Ut=e;else{if(e===null)throw Error(r(310));Ut=e,e={memoizedState:Ut.memoizedState,baseState:Ut.baseState,baseQueue:Ut.baseQueue,queue:Ut.queue,next:null},qt===null?Nt.memoizedState=qt=e:qt=qt.next=e}return qt}function eo(e,n){return typeof n=="function"?n(e):n}function Fc(e){var n=Xn(),i=n.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=e;var u=Ut,f=u.baseQueue,h=i.pending;if(h!==null){if(f!==null){var w=f.next;f.next=h.next,h.next=w}u.baseQueue=f=h,i.pending=null}if(f!==null){h=f.next,u=u.baseState;var j=w=null,M=null,V=h;do{var te=V.lane;if((_r&te)===te)M!==null&&(M=M.next={lane:0,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),u=V.hasEagerState?V.eagerState:e(u,V.action);else{var re={lane:te,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null};M===null?(j=M=re,w=u):M=M.next=re,Nt.lanes|=te,Er|=te}V=V.next}while(V!==null&&V!==h);M===null?w=u:M.next=j,ns(u,n.memoizedState)||(_n=!0),n.memoizedState=u,n.baseState=w,n.baseQueue=M,i.lastRenderedState=u}if(e=i.interleaved,e!==null){f=e;do h=f.lane,Nt.lanes|=h,Er|=h,f=f.next;while(f!==e)}else f===null&&(i.lanes=0);return[n.memoizedState,i.dispatch]}function Uc(e){var n=Xn(),i=n.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=e;var u=i.dispatch,f=i.pending,h=n.memoizedState;if(f!==null){i.pending=null;var w=f=f.next;do h=e(h,w.action),w=w.next;while(w!==f);ns(h,n.memoizedState)||(_n=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),i.lastRenderedState=h}return[h,u]}function np(){}function sp(e,n){var i=Nt,u=Xn(),f=n(),h=!ns(u.memoizedState,f);if(h&&(u.memoizedState=f,_n=!0),u=u.queue,Bc(op.bind(null,i,u,e),[e]),u.getSnapshot!==n||h||qt!==null&&qt.memoizedState.tag&1){if(i.flags|=2048,to(9,ip.bind(null,i,u,f,n),void 0,null),Yt===null)throw Error(r(349));(_r&30)!==0||rp(i,n,f)}return f}function rp(e,n,i){e.flags|=16384,e={getSnapshot:n,value:i},n=Nt.updateQueue,n===null?(n={lastEffect:null,stores:null},Nt.updateQueue=n,n.stores=[e]):(i=n.stores,i===null?n.stores=[e]:i.push(e))}function ip(e,n,i,u){n.value=i,n.getSnapshot=u,ap(n)&&lp(e)}function op(e,n,i){return i(function(){ap(n)&&lp(e)})}function ap(e){var n=e.getSnapshot;e=e.value;try{var i=n();return!ns(e,i)}catch{return!0}}function lp(e){var n=Ds(e,1);n!==null&&as(n,e,1,-1)}function cp(e){var n=Ss();return typeof e=="function"&&(e=e()),n.memoizedState=n.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:eo,lastRenderedState:e},n.queue=e,e=e.dispatch=yx.bind(null,Nt,e),[n.memoizedState,e]}function to(e,n,i,u){return e={tag:e,create:n,destroy:i,deps:u,next:null},n=Nt.updateQueue,n===null?(n={lastEffect:null,stores:null},Nt.updateQueue=n,n.lastEffect=e.next=e):(i=n.lastEffect,i===null?n.lastEffect=e.next=e:(u=i.next,i.next=e,e.next=u,n.lastEffect=e)),e}function up(){return Xn().memoizedState}function wa(e,n,i,u){var f=Ss();Nt.flags|=e,f.memoizedState=to(1|n,i,void 0,u===void 0?null:u)}function ka(e,n,i,u){var f=Xn();u=u===void 0?null:u;var h=void 0;if(Ut!==null){var w=Ut.memoizedState;if(h=w.destroy,u!==null&&Pc(u,w.deps)){f.memoizedState=to(n,i,h,u);return}}Nt.flags|=e,f.memoizedState=to(1|n,i,h,u)}function dp(e,n){return wa(8390656,8,e,n)}function Bc(e,n){return ka(2048,8,e,n)}function fp(e,n){return ka(4,2,e,n)}function pp(e,n){return ka(4,4,e,n)}function hp(e,n){if(typeof n=="function")return e=e(),n(e),function(){n(null)};if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function mp(e,n,i){return i=i!=null?i.concat([e]):null,ka(4,4,hp.bind(null,n,e),i)}function Wc(){}function gp(e,n){var i=Xn();n=n===void 0?null:n;var u=i.memoizedState;return u!==null&&n!==null&&Pc(n,u[1])?u[0]:(i.memoizedState=[e,n],e)}function vp(e,n){var i=Xn();n=n===void 0?null:n;var u=i.memoizedState;return u!==null&&n!==null&&Pc(n,u[1])?u[0]:(e=e(),i.memoizedState=[e,n],e)}function yp(e,n,i){return(_r&21)===0?(e.baseState&&(e.baseState=!1,_n=!0),e.memoizedState=i):(ns(i,n)||(i=Ai(),Nt.lanes|=i,Er|=i,e.baseState=!0),n)}function gx(e,n){var i=qe;qe=i!==0&&4>i?i:4,e(!0);var u=Oc.transition;Oc.transition={};try{e(!1),n()}finally{qe=i,Oc.transition=u}}function xp(){return Xn().memoizedState}function vx(e,n,i){var u=rr(e);if(i={lane:u,action:i,hasEagerState:!1,eagerState:null,next:null},wp(e))kp(n,i);else if(i=Qf(e,n,i,u),i!==null){var f=Sn();as(i,e,u,f),Sp(i,n,u)}}function yx(e,n,i){var u=rr(e),f={lane:u,action:i,hasEagerState:!1,eagerState:null,next:null};if(wp(e))kp(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var w=n.lastRenderedState,j=h(w,i);if(f.hasEagerState=!0,f.eagerState=j,ns(j,w)){var M=n.interleaved;M===null?(f.next=f,Rc(n)):(f.next=M.next,M.next=f),n.interleaved=f;return}}catch{}finally{}i=Qf(e,n,f,u),i!==null&&(f=Sn(),as(i,e,u,f),Sp(i,n,u))}}function wp(e){var n=e.alternate;return e===Nt||n!==null&&n===Nt}function kp(e,n){Zi=xa=!0;var i=e.pending;i===null?n.next=n:(n.next=i.next,i.next=n),e.pending=n}function Sp(e,n,i){if((i&4194240)!==0){var u=n.lanes;u&=e.pendingLanes,i|=u,n.lanes=i,Vs(e,i)}}var Sa={readContext:Yn,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},xx={readContext:Yn,useCallback:function(e,n){return Ss().memoizedState=[e,n===void 0?null:n],e},useContext:Yn,useEffect:dp,useImperativeHandle:function(e,n,i){return i=i!=null?i.concat([e]):null,wa(4194308,4,hp.bind(null,n,e),i)},useLayoutEffect:function(e,n){return wa(4194308,4,e,n)},useInsertionEffect:function(e,n){return wa(4,2,e,n)},useMemo:function(e,n){var i=Ss();return n=n===void 0?null:n,e=e(),i.memoizedState=[e,n],e},useReducer:function(e,n,i){var u=Ss();return n=i!==void 0?i(n):n,u.memoizedState=u.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},u.queue=e,e=e.dispatch=vx.bind(null,Nt,e),[u.memoizedState,e]},useRef:function(e){var n=Ss();return e={current:e},n.memoizedState=e},useState:cp,useDebugValue:Wc,useDeferredValue:function(e){return Ss().memoizedState=e},useTransition:function(){var e=cp(!1),n=e[0];return e=gx.bind(null,e[1]),Ss().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,i){var u=Nt,f=Ss();if(xt){if(i===void 0)throw Error(r(407));i=i()}else{if(i=n(),Yt===null)throw Error(r(349));(_r&30)!==0||rp(u,n,i)}f.memoizedState=i;var h={value:i,getSnapshot:n};return f.queue=h,dp(op.bind(null,u,h,e),[e]),u.flags|=2048,to(9,ip.bind(null,u,h,i,n),void 0,null),i},useId:function(){var e=Ss(),n=Yt.identifierPrefix;if(xt){var i=Is,u=As;i=(u&~(1<<32-xn(u)-1)).toString(32)+i,n=":"+n+"R"+i,i=Ji++,0<i&&(n+="H"+i.toString(32)),n+=":"}else i=mx++,n=":"+n+"r"+i.toString(32)+":";return e.memoizedState=n},unstable_isNewReconciler:!1},wx={readContext:Yn,useCallback:gp,useContext:Yn,useEffect:Bc,useImperativeHandle:mp,useInsertionEffect:fp,useLayoutEffect:pp,useMemo:vp,useReducer:Fc,useRef:up,useState:function(){return Fc(eo)},useDebugValue:Wc,useDeferredValue:function(e){var n=Xn();return yp(n,Ut.memoizedState,e)},useTransition:function(){var e=Fc(eo)[0],n=Xn().memoizedState;return[e,n]},useMutableSource:np,useSyncExternalStore:sp,useId:xp,unstable_isNewReconciler:!1},kx={readContext:Yn,useCallback:gp,useContext:Yn,useEffect:Bc,useImperativeHandle:mp,useInsertionEffect:fp,useLayoutEffect:pp,useMemo:vp,useReducer:Uc,useRef:up,useState:function(){return Uc(eo)},useDebugValue:Wc,useDeferredValue:function(e){var n=Xn();return Ut===null?n.memoizedState=e:yp(n,Ut.memoizedState,e)},useTransition:function(){var e=Uc(eo)[0],n=Xn().memoizedState;return[e,n]},useMutableSource:np,useSyncExternalStore:sp,useId:xp,unstable_isNewReconciler:!1};function rs(e,n){if(e&&e.defaultProps){n=L({},n),e=e.defaultProps;for(var i in e)n[i]===void 0&&(n[i]=e[i]);return n}return n}function Hc(e,n,i,u){n=e.memoizedState,i=i(u,n),i=i==null?n:L({},n,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var ba={isMounted:function(e){return(e=e._reactInternals)?Be(e)===e:!1},enqueueSetState:function(e,n,i){e=e._reactInternals;var u=Sn(),f=rr(e),h=Ms(u,f);h.payload=n,i!=null&&(h.callback=i),n=er(e,h,f),n!==null&&(as(n,e,f,u),ma(n,e,f))},enqueueReplaceState:function(e,n,i){e=e._reactInternals;var u=Sn(),f=rr(e),h=Ms(u,f);h.tag=1,h.payload=n,i!=null&&(h.callback=i),n=er(e,h,f),n!==null&&(as(n,e,f,u),ma(n,e,f))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var i=Sn(),u=rr(e),f=Ms(i,u);f.tag=2,n!=null&&(f.callback=n),n=er(e,f,u),n!==null&&(as(n,e,u,i),ma(n,e,u))}};function bp(e,n,i,u,f,h,w){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(u,h,w):n.prototype&&n.prototype.isPureReactComponent?!Ui(i,u)||!Ui(f,h):!0}function Tp(e,n,i){var u=!1,f=Qs,h=n.contextType;return typeof h=="object"&&h!==null?h=Yn(h):(f=Cn(n)?br:cn.current,u=n.contextTypes,h=(u=u!=null)?ti(e,f):Qs),n=new n(i,h),e.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,n.updater=ba,e.stateNode=n,n._reactInternals=e,u&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=f,e.__reactInternalMemoizedMaskedChildContext=h),n}function Np(e,n,i,u){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(i,u),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(i,u),n.state!==e&&ba.enqueueReplaceState(n,n.state,null)}function Vc(e,n,i,u){var f=e.stateNode;f.props=i,f.state=e.memoizedState,f.refs={},Ac(e);var h=n.contextType;typeof h=="object"&&h!==null?f.context=Yn(h):(h=Cn(n)?br:cn.current,f.context=ti(e,h)),f.state=e.memoizedState,h=n.getDerivedStateFromProps,typeof h=="function"&&(Hc(e,n,h,i),f.state=e.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(n=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),n!==f.state&&ba.enqueueReplaceState(f,f.state,null),ga(e,i,f,u),f.state=e.memoizedState),typeof f.componentDidMount=="function"&&(e.flags|=4194308)}function ci(e,n){try{var i="",u=n;do i+=Y(u),u=u.return;while(u);var f=i}catch(h){f=`
40
- Error generating stack: `+h.message+`
41
- `+h.stack}return{value:e,source:n,stack:f,digest:null}}function Gc(e,n,i){return{value:e,source:null,stack:i??null,digest:n??null}}function Kc(e,n){try{console.error(n.value)}catch(i){setTimeout(function(){throw i})}}var Sx=typeof WeakMap=="function"?WeakMap:Map;function jp(e,n,i){i=Ms(-1,i),i.tag=3,i.payload={element:null};var u=n.value;return i.callback=function(){Ra||(Ra=!0,lu=u),Kc(e,n)},i}function Cp(e,n,i){i=Ms(-1,i),i.tag=3;var u=e.type.getDerivedStateFromError;if(typeof u=="function"){var f=n.value;i.payload=function(){return u(f)},i.callback=function(){Kc(e,n)}}var h=e.stateNode;return h!==null&&typeof h.componentDidCatch=="function"&&(i.callback=function(){Kc(e,n),typeof u!="function"&&(nr===null?nr=new Set([this]):nr.add(this));var w=n.stack;this.componentDidCatch(n.value,{componentStack:w!==null?w:""})}),i}function _p(e,n,i){var u=e.pingCache;if(u===null){u=e.pingCache=new Sx;var f=new Set;u.set(n,f)}else f=u.get(n),f===void 0&&(f=new Set,u.set(n,f));f.has(i)||(f.add(i),e=Ox.bind(null,e,n,i),n.then(e,e))}function Ep(e){do{var n;if((n=e.tag===13)&&(n=e.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return e;e=e.return}while(e!==null);return null}function Rp(e,n,i,u,f){return(e.mode&1)===0?(e===n?e.flags|=65536:(e.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(n=Ms(-1,1),n.tag=2,er(i,n,1))),i.lanes|=1),e):(e.flags|=65536,e.lanes=f,e)}var bx=D.ReactCurrentOwner,_n=!1;function kn(e,n,i,u){n.child=e===null?Xf(n,null,i,u):ii(n,e.child,i,u)}function Ap(e,n,i,u,f){i=i.render;var h=n.ref;return ai(n,f),u=$c(e,n,i,u,h,f),i=zc(),e!==null&&!_n?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~f,Ls(e,n,f)):(xt&&i&&kc(n),n.flags|=1,kn(e,n,u,f),n.child)}function Ip(e,n,i,u,f){if(e===null){var h=i.type;return typeof h=="function"&&!mu(h)&&h.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(n.tag=15,n.type=h,Dp(e,n,h,u,f)):(e=Oa(i.type,null,u,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,(e.lanes&f)===0){var w=h.memoizedProps;if(i=i.compare,i=i!==null?i:Ui,i(w,u)&&e.ref===n.ref)return Ls(e,n,f)}return n.flags|=1,e=or(h,u),e.ref=n.ref,e.return=n,n.child=e}function Dp(e,n,i,u,f){if(e!==null){var h=e.memoizedProps;if(Ui(h,u)&&e.ref===n.ref)if(_n=!1,n.pendingProps=u=h,(e.lanes&f)!==0)(e.flags&131072)!==0&&(_n=!0);else return n.lanes=e.lanes,Ls(e,n,f)}return qc(e,n,i,u,f)}function Mp(e,n,i){var u=n.pendingProps,f=u.children,h=e!==null?e.memoizedState:null;if(u.mode==="hidden")if((n.mode&1)===0)n.memoizedState={baseLanes:0,cachePool:null,transitions:null},ut(di,Bn),Bn|=i;else{if((i&1073741824)===0)return e=h!==null?h.baseLanes|i:i,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:e,cachePool:null,transitions:null},n.updateQueue=null,ut(di,Bn),Bn|=e,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},u=h!==null?h.baseLanes:i,ut(di,Bn),Bn|=u}else h!==null?(u=h.baseLanes|i,n.memoizedState=null):u=i,ut(di,Bn),Bn|=u;return kn(e,n,f,i),n.child}function Lp(e,n){var i=n.ref;(e===null&&i!==null||e!==null&&e.ref!==i)&&(n.flags|=512,n.flags|=2097152)}function qc(e,n,i,u,f){var h=Cn(i)?br:cn.current;return h=ti(n,h),ai(n,f),i=$c(e,n,i,u,h,f),u=zc(),e!==null&&!_n?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~f,Ls(e,n,f)):(xt&&u&&kc(n),n.flags|=1,kn(e,n,i,f),n.child)}function Op(e,n,i,u,f){if(Cn(i)){var h=!0;aa(n)}else h=!1;if(ai(n,f),n.stateNode===null)Na(e,n),Tp(n,i,u),Vc(n,i,u,f),u=!0;else if(e===null){var w=n.stateNode,j=n.memoizedProps;w.props=j;var M=w.context,V=i.contextType;typeof V=="object"&&V!==null?V=Yn(V):(V=Cn(i)?br:cn.current,V=ti(n,V));var te=i.getDerivedStateFromProps,re=typeof te=="function"||typeof w.getSnapshotBeforeUpdate=="function";re||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(j!==u||M!==V)&&Np(n,w,u,V),Js=!1;var Z=n.memoizedState;w.state=Z,ga(n,u,w,f),M=n.memoizedState,j!==u||Z!==M||jn.current||Js?(typeof te=="function"&&(Hc(n,i,te,u),M=n.memoizedState),(j=Js||bp(n,i,j,u,Z,M,V))?(re||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"&&(n.flags|=4194308)):(typeof w.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=u,n.memoizedState=M),w.props=u,w.state=M,w.context=V,u=j):(typeof w.componentDidMount=="function"&&(n.flags|=4194308),u=!1)}else{w=n.stateNode,Zf(e,n),j=n.memoizedProps,V=n.type===n.elementType?j:rs(n.type,j),w.props=V,re=n.pendingProps,Z=w.context,M=i.contextType,typeof M=="object"&&M!==null?M=Yn(M):(M=Cn(i)?br:cn.current,M=ti(n,M));var xe=i.getDerivedStateFromProps;(te=typeof xe=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(j!==re||Z!==M)&&Np(n,w,u,M),Js=!1,Z=n.memoizedState,w.state=Z,ga(n,u,w,f);var Ne=n.memoizedState;j!==re||Z!==Ne||jn.current||Js?(typeof xe=="function"&&(Hc(n,i,xe,u),Ne=n.memoizedState),(V=Js||bp(n,i,V,u,Z,Ne,M)||!1)?(te||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(u,Ne,M),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(u,Ne,M)),typeof w.componentDidUpdate=="function"&&(n.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof w.componentDidUpdate!="function"||j===e.memoizedProps&&Z===e.memoizedState||(n.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||j===e.memoizedProps&&Z===e.memoizedState||(n.flags|=1024),n.memoizedProps=u,n.memoizedState=Ne),w.props=u,w.state=Ne,w.context=M,u=V):(typeof w.componentDidUpdate!="function"||j===e.memoizedProps&&Z===e.memoizedState||(n.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||j===e.memoizedProps&&Z===e.memoizedState||(n.flags|=1024),u=!1)}return Yc(e,n,i,u,h,f)}function Yc(e,n,i,u,f,h){Lp(e,n);var w=(n.flags&128)!==0;if(!u&&!w)return f&&Uf(n,i,!1),Ls(e,n,h);u=n.stateNode,bx.current=n;var j=w&&typeof i.getDerivedStateFromError!="function"?null:u.render();return n.flags|=1,e!==null&&w?(n.child=ii(n,e.child,null,h),n.child=ii(n,null,j,h)):kn(e,n,j,h),n.memoizedState=u.state,f&&Uf(n,i,!0),n.child}function Pp(e){var n=e.stateNode;n.pendingContext?zf(e,n.pendingContext,n.pendingContext!==n.context):n.context&&zf(e,n.context,!1),Ic(e,n.containerInfo)}function $p(e,n,i,u,f){return ri(),Nc(f),n.flags|=256,kn(e,n,i,u),n.child}var Xc={dehydrated:null,treeContext:null,retryLane:0};function Qc(e){return{baseLanes:e,cachePool:null,transitions:null}}function zp(e,n,i){var u=n.pendingProps,f=Tt.current,h=!1,w=(n.flags&128)!==0,j;if((j=w)||(j=e!==null&&e.memoizedState===null?!1:(f&2)!==0),j?(h=!0,n.flags&=-129):(e===null||e.memoizedState!==null)&&(f|=1),ut(Tt,f&1),e===null)return Tc(n),e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((n.mode&1)===0?n.lanes=1:e.data==="$!"?n.lanes=8:n.lanes=1073741824,null):(w=u.children,e=u.fallback,h?(u=n.mode,h=n.child,w={mode:"hidden",children:w},(u&1)===0&&h!==null?(h.childLanes=0,h.pendingProps=w):h=Pa(w,u,0,null),e=Dr(e,u,i,null),h.return=n,e.return=n,h.sibling=e,n.child=h,n.child.memoizedState=Qc(i),n.memoizedState=Xc,e):Zc(n,w));if(f=e.memoizedState,f!==null&&(j=f.dehydrated,j!==null))return Tx(e,n,w,u,j,f,i);if(h){h=u.fallback,w=n.mode,f=e.child,j=f.sibling;var M={mode:"hidden",children:u.children};return(w&1)===0&&n.child!==f?(u=n.child,u.childLanes=0,u.pendingProps=M,n.deletions=null):(u=or(f,M),u.subtreeFlags=f.subtreeFlags&14680064),j!==null?h=or(j,h):(h=Dr(h,w,i,null),h.flags|=2),h.return=n,u.return=n,u.sibling=h,n.child=u,u=h,h=n.child,w=e.child.memoizedState,w=w===null?Qc(i):{baseLanes:w.baseLanes|i,cachePool:null,transitions:w.transitions},h.memoizedState=w,h.childLanes=e.childLanes&~i,n.memoizedState=Xc,u}return h=e.child,e=h.sibling,u=or(h,{mode:"visible",children:u.children}),(n.mode&1)===0&&(u.lanes=i),u.return=n,u.sibling=null,e!==null&&(i=n.deletions,i===null?(n.deletions=[e],n.flags|=16):i.push(e)),n.child=u,n.memoizedState=null,u}function Zc(e,n){return n=Pa({mode:"visible",children:n},e.mode,0,null),n.return=e,e.child=n}function Ta(e,n,i,u){return u!==null&&Nc(u),ii(n,e.child,null,i),e=Zc(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Tx(e,n,i,u,f,h,w){if(i)return n.flags&256?(n.flags&=-257,u=Gc(Error(r(422))),Ta(e,n,w,u)):n.memoizedState!==null?(n.child=e.child,n.flags|=128,null):(h=u.fallback,f=n.mode,u=Pa({mode:"visible",children:u.children},f,0,null),h=Dr(h,f,w,null),h.flags|=2,u.return=n,h.return=n,u.sibling=h,n.child=u,(n.mode&1)!==0&&ii(n,e.child,null,w),n.child.memoizedState=Qc(w),n.memoizedState=Xc,h);if((n.mode&1)===0)return Ta(e,n,w,null);if(f.data==="$!"){if(u=f.nextSibling&&f.nextSibling.dataset,u)var j=u.dgst;return u=j,h=Error(r(419)),u=Gc(h,u,void 0),Ta(e,n,w,u)}if(j=(w&e.childLanes)!==0,_n||j){if(u=Yt,u!==null){switch(w&-w){case 4:f=2;break;case 16:f=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:f=32;break;case 536870912:f=268435456;break;default:f=0}f=(f&(u.suspendedLanes|w))!==0?0:f,f!==0&&f!==h.retryLane&&(h.retryLane=f,Ds(e,f),as(u,e,f,-1))}return hu(),u=Gc(Error(r(421))),Ta(e,n,w,u)}return f.data==="$?"?(n.flags|=128,n.child=e.child,n=Px.bind(null,e),f._reactRetry=n,null):(e=h.treeContext,Un=Ys(f.nextSibling),Fn=n,xt=!0,ss=null,e!==null&&(Kn[qn++]=As,Kn[qn++]=Is,Kn[qn++]=Tr,As=e.id,Is=e.overflow,Tr=n),n=Zc(n,u.children),n.flags|=4096,n)}function Fp(e,n,i){e.lanes|=n;var u=e.alternate;u!==null&&(u.lanes|=n),Ec(e.return,n,i)}function Jc(e,n,i,u,f){var h=e.memoizedState;h===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:u,tail:i,tailMode:f}:(h.isBackwards=n,h.rendering=null,h.renderingStartTime=0,h.last=u,h.tail=i,h.tailMode=f)}function Up(e,n,i){var u=n.pendingProps,f=u.revealOrder,h=u.tail;if(kn(e,n,u.children,i),u=Tt.current,(u&2)!==0)u=u&1|2,n.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Fp(e,i,n);else if(e.tag===19)Fp(e,i,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}u&=1}if(ut(Tt,u),(n.mode&1)===0)n.memoizedState=null;else switch(f){case"forwards":for(i=n.child,f=null;i!==null;)e=i.alternate,e!==null&&va(e)===null&&(f=i),i=i.sibling;i=f,i===null?(f=n.child,n.child=null):(f=i.sibling,i.sibling=null),Jc(n,!1,f,i,h);break;case"backwards":for(i=null,f=n.child,n.child=null;f!==null;){if(e=f.alternate,e!==null&&va(e)===null){n.child=f;break}e=f.sibling,f.sibling=i,i=f,f=e}Jc(n,!0,i,null,h);break;case"together":Jc(n,!1,null,null,void 0);break;default:n.memoizedState=null}return n.child}function Na(e,n){(n.mode&1)===0&&e!==null&&(e.alternate=null,n.alternate=null,n.flags|=2)}function Ls(e,n,i){if(e!==null&&(n.dependencies=e.dependencies),Er|=n.lanes,(i&n.childLanes)===0)return null;if(e!==null&&n.child!==e.child)throw Error(r(153));if(n.child!==null){for(e=n.child,i=or(e,e.pendingProps),n.child=i,i.return=n;e.sibling!==null;)e=e.sibling,i=i.sibling=or(e,e.pendingProps),i.return=n;i.sibling=null}return n.child}function Nx(e,n,i){switch(n.tag){case 3:Pp(n),ri();break;case 5:tp(n);break;case 1:Cn(n.type)&&aa(n);break;case 4:Ic(n,n.stateNode.containerInfo);break;case 10:var u=n.type._context,f=n.memoizedProps.value;ut(pa,u._currentValue),u._currentValue=f;break;case 13:if(u=n.memoizedState,u!==null)return u.dehydrated!==null?(ut(Tt,Tt.current&1),n.flags|=128,null):(i&n.child.childLanes)!==0?zp(e,n,i):(ut(Tt,Tt.current&1),e=Ls(e,n,i),e!==null?e.sibling:null);ut(Tt,Tt.current&1);break;case 19:if(u=(i&n.childLanes)!==0,(e.flags&128)!==0){if(u)return Up(e,n,i);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),ut(Tt,Tt.current),u)break;return null;case 22:case 23:return n.lanes=0,Mp(e,n,i)}return Ls(e,n,i)}var Bp,eu,Wp,Hp;Bp=function(e,n){for(var i=n.child;i!==null;){if(i.tag===5||i.tag===6)e.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===n)break;for(;i.sibling===null;){if(i.return===null||i.return===n)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},eu=function(){},Wp=function(e,n,i,u){var f=e.memoizedProps;if(f!==u){e=n.stateNode,Cr(ks.current);var h=null;switch(i){case"input":f=$e(e,f),u=$e(e,u),h=[];break;case"select":f=L({},f,{value:void 0}),u=L({},u,{value:void 0}),h=[];break;case"textarea":f=Lt(e,f),u=Lt(e,u),h=[];break;default:typeof f.onClick!="function"&&typeof u.onClick=="function"&&(e.onclick=ra)}ts(i,u);var w;i=null;for(V in f)if(!u.hasOwnProperty(V)&&f.hasOwnProperty(V)&&f[V]!=null)if(V==="style"){var j=f[V];for(w in j)j.hasOwnProperty(w)&&(i||(i={}),i[w]="")}else V!=="dangerouslySetInnerHTML"&&V!=="children"&&V!=="suppressContentEditableWarning"&&V!=="suppressHydrationWarning"&&V!=="autoFocus"&&(l.hasOwnProperty(V)?h||(h=[]):(h=h||[]).push(V,null));for(V in u){var M=u[V];if(j=f!=null?f[V]:void 0,u.hasOwnProperty(V)&&M!==j&&(M!=null||j!=null))if(V==="style")if(j){for(w in j)!j.hasOwnProperty(w)||M&&M.hasOwnProperty(w)||(i||(i={}),i[w]="");for(w in M)M.hasOwnProperty(w)&&j[w]!==M[w]&&(i||(i={}),i[w]=M[w])}else i||(h||(h=[]),h.push(V,i)),i=M;else V==="dangerouslySetInnerHTML"?(M=M?M.__html:void 0,j=j?j.__html:void 0,M!=null&&j!==M&&(h=h||[]).push(V,M)):V==="children"?typeof M!="string"&&typeof M!="number"||(h=h||[]).push(V,""+M):V!=="suppressContentEditableWarning"&&V!=="suppressHydrationWarning"&&(l.hasOwnProperty(V)?(M!=null&&V==="onScroll"&&pt("scroll",e),h||j===M||(h=[])):(h=h||[]).push(V,M))}i&&(h=h||[]).push("style",i);var V=h;(n.updateQueue=V)&&(n.flags|=4)}},Hp=function(e,n,i,u){i!==u&&(n.flags|=4)};function no(e,n){if(!xt)switch(e.tailMode){case"hidden":n=e.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var u=null;i!==null;)i.alternate!==null&&(u=i),i=i.sibling;u===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:u.sibling=null}}function dn(e){var n=e.alternate!==null&&e.alternate.child===e.child,i=0,u=0;if(n)for(var f=e.child;f!==null;)i|=f.lanes|f.childLanes,u|=f.subtreeFlags&14680064,u|=f.flags&14680064,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)i|=f.lanes|f.childLanes,u|=f.subtreeFlags,u|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=u,e.childLanes=i,n}function jx(e,n,i){var u=n.pendingProps;switch(Sc(n),n.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dn(n),null;case 1:return Cn(n.type)&&oa(),dn(n),null;case 3:return u=n.stateNode,li(),ht(jn),ht(cn),Lc(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(e===null||e.child===null)&&(da(n)?n.flags|=4:e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,ss!==null&&(du(ss),ss=null))),eu(e,n),dn(n),null;case 5:Dc(n);var f=Cr(Qi.current);if(i=n.type,e!==null&&n.stateNode!=null)Wp(e,n,i,u,f),e.ref!==n.ref&&(n.flags|=512,n.flags|=2097152);else{if(!u){if(n.stateNode===null)throw Error(r(166));return dn(n),null}if(e=Cr(ks.current),da(n)){u=n.stateNode,i=n.type;var h=n.memoizedProps;switch(u[ws]=n,u[Gi]=h,e=(n.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(f=0;f<Wi.length;f++)pt(Wi[f],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":en(u,h),pt("invalid",u);break;case"select":u._wrapperState={wasMultiple:!!h.multiple},pt("invalid",u);break;case"textarea":q(u,h),pt("invalid",u)}ts(i,h),f=null;for(var w in h)if(h.hasOwnProperty(w)){var j=h[w];w==="children"?typeof j=="string"?u.textContent!==j&&(h.suppressHydrationWarning!==!0&&sa(u.textContent,j,e),f=["children",j]):typeof j=="number"&&u.textContent!==""+j&&(h.suppressHydrationWarning!==!0&&sa(u.textContent,j,e),f=["children",""+j]):l.hasOwnProperty(w)&&j!=null&&w==="onScroll"&&pt("scroll",u)}switch(i){case"input":He(u),tn(u,h,!0);break;case"textarea":He(u),Ue(u);break;case"select":case"option":break;default:typeof h.onClick=="function"&&(u.onclick=ra)}u=f,n.updateQueue=u,u!==null&&(n.flags|=4)}else{w=f.nodeType===9?f:f.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=nt(i)),e==="http://www.w3.org/1999/xhtml"?i==="script"?(e=w.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof u.is=="string"?e=w.createElement(i,{is:u.is}):(e=w.createElement(i),i==="select"&&(w=e,u.multiple?w.multiple=!0:u.size&&(w.size=u.size))):e=w.createElementNS(e,i),e[ws]=n,e[Gi]=u,Bp(e,n,!1,!1),n.stateNode=e;e:{switch(w=Ln(i,u),i){case"dialog":pt("cancel",e),pt("close",e),f=u;break;case"iframe":case"object":case"embed":pt("load",e),f=u;break;case"video":case"audio":for(f=0;f<Wi.length;f++)pt(Wi[f],e);f=u;break;case"source":pt("error",e),f=u;break;case"img":case"image":case"link":pt("error",e),pt("load",e),f=u;break;case"details":pt("toggle",e),f=u;break;case"input":en(e,u),f=$e(e,u),pt("invalid",e);break;case"option":f=u;break;case"select":e._wrapperState={wasMultiple:!!u.multiple},f=L({},u,{value:void 0}),pt("invalid",e);break;case"textarea":q(e,u),f=Lt(e,u),pt("invalid",e);break;default:f=u}ts(i,f),j=f;for(h in j)if(j.hasOwnProperty(h)){var M=j[h];h==="style"?hs(e,M):h==="dangerouslySetInnerHTML"?(M=M?M.__html:void 0,M!=null&&Ct(e,M)):h==="children"?typeof M=="string"?(i!=="textarea"||M!=="")&&an(e,M):typeof M=="number"&&an(e,""+M):h!=="suppressContentEditableWarning"&&h!=="suppressHydrationWarning"&&h!=="autoFocus"&&(l.hasOwnProperty(h)?M!=null&&h==="onScroll"&&pt("scroll",e):M!=null&&H(e,h,M,w))}switch(i){case"input":He(e),tn(e,u,!1);break;case"textarea":He(e),Ue(e);break;case"option":u.value!=null&&e.setAttribute("value",""+se(u.value));break;case"select":e.multiple=!!u.multiple,h=u.value,h!=null?zt(e,!!u.multiple,h,!1):u.defaultValue!=null&&zt(e,!!u.multiple,u.defaultValue,!0);break;default:typeof f.onClick=="function"&&(e.onclick=ra)}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&&(n.flags|=4)}n.ref!==null&&(n.flags|=512,n.flags|=2097152)}return dn(n),null;case 6:if(e&&n.stateNode!=null)Hp(e,n,e.memoizedProps,u);else{if(typeof u!="string"&&n.stateNode===null)throw Error(r(166));if(i=Cr(Qi.current),Cr(ks.current),da(n)){if(u=n.stateNode,i=n.memoizedProps,u[ws]=n,(h=u.nodeValue!==i)&&(e=Fn,e!==null))switch(e.tag){case 3:sa(u.nodeValue,i,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&sa(u.nodeValue,i,(e.mode&1)!==0)}h&&(n.flags|=4)}else u=(i.nodeType===9?i:i.ownerDocument).createTextNode(u),u[ws]=n,n.stateNode=u}return dn(n),null;case 13:if(ht(Tt),u=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(xt&&Un!==null&&(n.mode&1)!==0&&(n.flags&128)===0)Kf(),ri(),n.flags|=98560,h=!1;else if(h=da(n),u!==null&&u.dehydrated!==null){if(e===null){if(!h)throw Error(r(318));if(h=n.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(r(317));h[ws]=n}else ri(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;dn(n),h=!1}else ss!==null&&(du(ss),ss=null),h=!0;if(!h)return n.flags&65536?n:null}return(n.flags&128)!==0?(n.lanes=i,n):(u=u!==null,u!==(e!==null&&e.memoizedState!==null)&&u&&(n.child.flags|=8192,(n.mode&1)!==0&&(e===null||(Tt.current&1)!==0?Bt===0&&(Bt=3):hu())),n.updateQueue!==null&&(n.flags|=4),dn(n),null);case 4:return li(),eu(e,n),e===null&&Hi(n.stateNode.containerInfo),dn(n),null;case 10:return _c(n.type._context),dn(n),null;case 17:return Cn(n.type)&&oa(),dn(n),null;case 19:if(ht(Tt),h=n.memoizedState,h===null)return dn(n),null;if(u=(n.flags&128)!==0,w=h.rendering,w===null)if(u)no(h,!1);else{if(Bt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(w=va(e),w!==null){for(n.flags|=128,no(h,!1),u=w.updateQueue,u!==null&&(n.updateQueue=u,n.flags|=4),n.subtreeFlags=0,u=i,i=n.child;i!==null;)h=i,e=u,h.flags&=14680066,w=h.alternate,w===null?(h.childLanes=0,h.lanes=e,h.child=null,h.subtreeFlags=0,h.memoizedProps=null,h.memoizedState=null,h.updateQueue=null,h.dependencies=null,h.stateNode=null):(h.childLanes=w.childLanes,h.lanes=w.lanes,h.child=w.child,h.subtreeFlags=0,h.deletions=null,h.memoizedProps=w.memoizedProps,h.memoizedState=w.memoizedState,h.updateQueue=w.updateQueue,h.type=w.type,e=w.dependencies,h.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),i=i.sibling;return ut(Tt,Tt.current&1|2),n.child}e=e.sibling}h.tail!==null&&kt()>fi&&(n.flags|=128,u=!0,no(h,!1),n.lanes=4194304)}else{if(!u)if(e=va(w),e!==null){if(n.flags|=128,u=!0,i=e.updateQueue,i!==null&&(n.updateQueue=i,n.flags|=4),no(h,!0),h.tail===null&&h.tailMode==="hidden"&&!w.alternate&&!xt)return dn(n),null}else 2*kt()-h.renderingStartTime>fi&&i!==1073741824&&(n.flags|=128,u=!0,no(h,!1),n.lanes=4194304);h.isBackwards?(w.sibling=n.child,n.child=w):(i=h.last,i!==null?i.sibling=w:n.child=w,h.last=w)}return h.tail!==null?(n=h.tail,h.rendering=n,h.tail=n.sibling,h.renderingStartTime=kt(),n.sibling=null,i=Tt.current,ut(Tt,u?i&1|2:i&1),n):(dn(n),null);case 22:case 23:return pu(),u=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==u&&(n.flags|=8192),u&&(n.mode&1)!==0?(Bn&1073741824)!==0&&(dn(n),n.subtreeFlags&6&&(n.flags|=8192)):dn(n),null;case 24:return null;case 25:return null}throw Error(r(156,n.tag))}function Cx(e,n){switch(Sc(n),n.tag){case 1:return Cn(n.type)&&oa(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return li(),ht(jn),ht(cn),Lc(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 5:return Dc(n),null;case 13:if(ht(Tt),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));ri()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return ht(Tt),null;case 4:return li(),null;case 10:return _c(n.type._context),null;case 22:case 23:return pu(),null;case 24:return null;default:return null}}var ja=!1,fn=!1,_x=typeof WeakSet=="function"?WeakSet:Set,Se=null;function ui(e,n){var i=e.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(u){Rt(e,n,u)}else i.current=null}function tu(e,n,i){try{i()}catch(u){Rt(e,n,u)}}var Vp=!1;function Ex(e,n){if(pc=Go,e=bf(),ic(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var u=i.getSelection&&i.getSelection();if(u&&u.rangeCount!==0){i=u.anchorNode;var f=u.anchorOffset,h=u.focusNode;u=u.focusOffset;try{i.nodeType,h.nodeType}catch{i=null;break e}var w=0,j=-1,M=-1,V=0,te=0,re=e,Z=null;t:for(;;){for(var xe;re!==i||f!==0&&re.nodeType!==3||(j=w+f),re!==h||u!==0&&re.nodeType!==3||(M=w+u),re.nodeType===3&&(w+=re.nodeValue.length),(xe=re.firstChild)!==null;)Z=re,re=xe;for(;;){if(re===e)break t;if(Z===i&&++V===f&&(j=w),Z===h&&++te===u&&(M=w),(xe=re.nextSibling)!==null)break;re=Z,Z=re.parentNode}re=xe}i=j===-1||M===-1?null:{start:j,end:M}}else i=null}i=i||{start:0,end:0}}else i=null;for(hc={focusedElem:e,selectionRange:i},Go=!1,Se=n;Se!==null;)if(n=Se,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Se=e;else for(;Se!==null;){n=Se;try{var Ne=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(Ne!==null){var Ce=Ne.memoizedProps,It=Ne.memoizedState,B=n.stateNode,P=B.getSnapshotBeforeUpdate(n.elementType===n.type?Ce:rs(n.type,Ce),It);B.__reactInternalSnapshotBeforeUpdate=P}break;case 3:var W=n.stateNode.containerInfo;W.nodeType===1?W.textContent="":W.nodeType===9&&W.documentElement&&W.removeChild(W.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ue){Rt(n,n.return,ue)}if(e=n.sibling,e!==null){e.return=n.return,Se=e;break}Se=n.return}return Ne=Vp,Vp=!1,Ne}function so(e,n,i){var u=n.updateQueue;if(u=u!==null?u.lastEffect:null,u!==null){var f=u=u.next;do{if((f.tag&e)===e){var h=f.destroy;f.destroy=void 0,h!==void 0&&tu(n,i,h)}f=f.next}while(f!==u)}}function Ca(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&e)===e){var u=i.create;i.destroy=u()}i=i.next}while(i!==n)}}function nu(e){var n=e.ref;if(n!==null){var i=e.stateNode;switch(e.tag){case 5:e=i;break;default:e=i}typeof n=="function"?n(e):n.current=e}}function Gp(e){var n=e.alternate;n!==null&&(e.alternate=null,Gp(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[ws],delete n[Gi],delete n[yc],delete n[dx],delete n[fx])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Kp(e){return e.tag===5||e.tag===3||e.tag===4}function qp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Kp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function su(e,n,i){var u=e.tag;if(u===5||u===6)e=e.stateNode,n?i.nodeType===8?i.parentNode.insertBefore(e,n):i.insertBefore(e,n):(i.nodeType===8?(n=i.parentNode,n.insertBefore(e,i)):(n=i,n.appendChild(e)),i=i._reactRootContainer,i!=null||n.onclick!==null||(n.onclick=ra));else if(u!==4&&(e=e.child,e!==null))for(su(e,n,i),e=e.sibling;e!==null;)su(e,n,i),e=e.sibling}function ru(e,n,i){var u=e.tag;if(u===5||u===6)e=e.stateNode,n?i.insertBefore(e,n):i.appendChild(e);else if(u!==4&&(e=e.child,e!==null))for(ru(e,n,i),e=e.sibling;e!==null;)ru(e,n,i),e=e.sibling}var nn=null,is=!1;function tr(e,n,i){for(i=i.child;i!==null;)Yp(e,n,i),i=i.sibling}function Yp(e,n,i){if($n&&typeof $n.onCommitFiberUnmount=="function")try{$n.onCommitFiberUnmount(vr,i)}catch{}switch(i.tag){case 5:fn||ui(i,n);case 6:var u=nn,f=is;nn=null,tr(e,n,i),nn=u,is=f,nn!==null&&(is?(e=nn,i=i.stateNode,e.nodeType===8?e.parentNode.removeChild(i):e.removeChild(i)):nn.removeChild(i.stateNode));break;case 18:nn!==null&&(is?(e=nn,i=i.stateNode,e.nodeType===8?vc(e.parentNode,i):e.nodeType===1&&vc(e,i),Li(e)):vc(nn,i.stateNode));break;case 4:u=nn,f=is,nn=i.stateNode.containerInfo,is=!0,tr(e,n,i),nn=u,is=f;break;case 0:case 11:case 14:case 15:if(!fn&&(u=i.updateQueue,u!==null&&(u=u.lastEffect,u!==null))){f=u=u.next;do{var h=f,w=h.destroy;h=h.tag,w!==void 0&&((h&2)!==0||(h&4)!==0)&&tu(i,n,w),f=f.next}while(f!==u)}tr(e,n,i);break;case 1:if(!fn&&(ui(i,n),u=i.stateNode,typeof u.componentWillUnmount=="function"))try{u.props=i.memoizedProps,u.state=i.memoizedState,u.componentWillUnmount()}catch(j){Rt(i,n,j)}tr(e,n,i);break;case 21:tr(e,n,i);break;case 22:i.mode&1?(fn=(u=fn)||i.memoizedState!==null,tr(e,n,i),fn=u):tr(e,n,i);break;default:tr(e,n,i)}}function Xp(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var i=e.stateNode;i===null&&(i=e.stateNode=new _x),n.forEach(function(u){var f=$x.bind(null,e,u);i.has(u)||(i.add(u),u.then(f,f))})}}function os(e,n){var i=n.deletions;if(i!==null)for(var u=0;u<i.length;u++){var f=i[u];try{var h=e,w=n,j=w;e:for(;j!==null;){switch(j.tag){case 5:nn=j.stateNode,is=!1;break e;case 3:nn=j.stateNode.containerInfo,is=!0;break e;case 4:nn=j.stateNode.containerInfo,is=!0;break e}j=j.return}if(nn===null)throw Error(r(160));Yp(h,w,f),nn=null,is=!1;var M=f.alternate;M!==null&&(M.return=null),f.return=null}catch(V){Rt(f,n,V)}}if(n.subtreeFlags&12854)for(n=n.child;n!==null;)Qp(n,e),n=n.sibling}function Qp(e,n){var i=e.alternate,u=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(os(n,e),bs(e),u&4){try{so(3,e,e.return),Ca(3,e)}catch(Ce){Rt(e,e.return,Ce)}try{so(5,e,e.return)}catch(Ce){Rt(e,e.return,Ce)}}break;case 1:os(n,e),bs(e),u&512&&i!==null&&ui(i,i.return);break;case 5:if(os(n,e),bs(e),u&512&&i!==null&&ui(i,i.return),e.flags&32){var f=e.stateNode;try{an(f,"")}catch(Ce){Rt(e,e.return,Ce)}}if(u&4&&(f=e.stateNode,f!=null)){var h=e.memoizedProps,w=i!==null?i.memoizedProps:h,j=e.type,M=e.updateQueue;if(e.updateQueue=null,M!==null)try{j==="input"&&h.type==="radio"&&h.name!=null&&Fe(f,h),Ln(j,w);var V=Ln(j,h);for(w=0;w<M.length;w+=2){var te=M[w],re=M[w+1];te==="style"?hs(f,re):te==="dangerouslySetInnerHTML"?Ct(f,re):te==="children"?an(f,re):H(f,te,re,V)}switch(j){case"input":Ht(f,h);break;case"textarea":ge(f,h);break;case"select":var Z=f._wrapperState.wasMultiple;f._wrapperState.wasMultiple=!!h.multiple;var xe=h.value;xe!=null?zt(f,!!h.multiple,xe,!1):Z!==!!h.multiple&&(h.defaultValue!=null?zt(f,!!h.multiple,h.defaultValue,!0):zt(f,!!h.multiple,h.multiple?[]:"",!1))}f[Gi]=h}catch(Ce){Rt(e,e.return,Ce)}}break;case 6:if(os(n,e),bs(e),u&4){if(e.stateNode===null)throw Error(r(162));f=e.stateNode,h=e.memoizedProps;try{f.nodeValue=h}catch(Ce){Rt(e,e.return,Ce)}}break;case 3:if(os(n,e),bs(e),u&4&&i!==null&&i.memoizedState.isDehydrated)try{Li(n.containerInfo)}catch(Ce){Rt(e,e.return,Ce)}break;case 4:os(n,e),bs(e);break;case 13:os(n,e),bs(e),f=e.child,f.flags&8192&&(h=f.memoizedState!==null,f.stateNode.isHidden=h,!h||f.alternate!==null&&f.alternate.memoizedState!==null||(au=kt())),u&4&&Xp(e);break;case 22:if(te=i!==null&&i.memoizedState!==null,e.mode&1?(fn=(V=fn)||te,os(n,e),fn=V):os(n,e),bs(e),u&8192){if(V=e.memoizedState!==null,(e.stateNode.isHidden=V)&&!te&&(e.mode&1)!==0)for(Se=e,te=e.child;te!==null;){for(re=Se=te;Se!==null;){switch(Z=Se,xe=Z.child,Z.tag){case 0:case 11:case 14:case 15:so(4,Z,Z.return);break;case 1:ui(Z,Z.return);var Ne=Z.stateNode;if(typeof Ne.componentWillUnmount=="function"){u=Z,i=Z.return;try{n=u,Ne.props=n.memoizedProps,Ne.state=n.memoizedState,Ne.componentWillUnmount()}catch(Ce){Rt(u,i,Ce)}}break;case 5:ui(Z,Z.return);break;case 22:if(Z.memoizedState!==null){eh(re);continue}}xe!==null?(xe.return=Z,Se=xe):eh(re)}te=te.sibling}e:for(te=null,re=e;;){if(re.tag===5){if(te===null){te=re;try{f=re.stateNode,V?(h=f.style,typeof h.setProperty=="function"?h.setProperty("display","none","important"):h.display="none"):(j=re.stateNode,M=re.memoizedProps.style,w=M!=null&&M.hasOwnProperty("display")?M.display:null,j.style.display=Mn("display",w))}catch(Ce){Rt(e,e.return,Ce)}}}else if(re.tag===6){if(te===null)try{re.stateNode.nodeValue=V?"":re.memoizedProps}catch(Ce){Rt(e,e.return,Ce)}}else if((re.tag!==22&&re.tag!==23||re.memoizedState===null||re===e)&&re.child!==null){re.child.return=re,re=re.child;continue}if(re===e)break e;for(;re.sibling===null;){if(re.return===null||re.return===e)break e;te===re&&(te=null),re=re.return}te===re&&(te=null),re.sibling.return=re.return,re=re.sibling}}break;case 19:os(n,e),bs(e),u&4&&Xp(e);break;case 21:break;default:os(n,e),bs(e)}}function bs(e){var n=e.flags;if(n&2){try{e:{for(var i=e.return;i!==null;){if(Kp(i)){var u=i;break e}i=i.return}throw Error(r(160))}switch(u.tag){case 5:var f=u.stateNode;u.flags&32&&(an(f,""),u.flags&=-33);var h=qp(e);ru(e,h,f);break;case 3:case 4:var w=u.stateNode.containerInfo,j=qp(e);su(e,j,w);break;default:throw Error(r(161))}}catch(M){Rt(e,e.return,M)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Rx(e,n,i){Se=e,Zp(e)}function Zp(e,n,i){for(var u=(e.mode&1)!==0;Se!==null;){var f=Se,h=f.child;if(f.tag===22&&u){var w=f.memoizedState!==null||ja;if(!w){var j=f.alternate,M=j!==null&&j.memoizedState!==null||fn;j=ja;var V=fn;if(ja=w,(fn=M)&&!V)for(Se=f;Se!==null;)w=Se,M=w.child,w.tag===22&&w.memoizedState!==null?th(f):M!==null?(M.return=w,Se=M):th(f);for(;h!==null;)Se=h,Zp(h),h=h.sibling;Se=f,ja=j,fn=V}Jp(e)}else(f.subtreeFlags&8772)!==0&&h!==null?(h.return=f,Se=h):Jp(e)}}function Jp(e){for(;Se!==null;){var n=Se;if((n.flags&8772)!==0){var i=n.alternate;try{if((n.flags&8772)!==0)switch(n.tag){case 0:case 11:case 15:fn||Ca(5,n);break;case 1:var u=n.stateNode;if(n.flags&4&&!fn)if(i===null)u.componentDidMount();else{var f=n.elementType===n.type?i.memoizedProps:rs(n.type,i.memoizedProps);u.componentDidUpdate(f,i.memoizedState,u.__reactInternalSnapshotBeforeUpdate)}var h=n.updateQueue;h!==null&&ep(n,h,u);break;case 3:var w=n.updateQueue;if(w!==null){if(i=null,n.child!==null)switch(n.child.tag){case 5:i=n.child.stateNode;break;case 1:i=n.child.stateNode}ep(n,w,i)}break;case 5:var j=n.stateNode;if(i===null&&n.flags&4){i=j;var M=n.memoizedProps;switch(n.type){case"button":case"input":case"select":case"textarea":M.autoFocus&&i.focus();break;case"img":M.src&&(i.src=M.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(n.memoizedState===null){var V=n.alternate;if(V!==null){var te=V.memoizedState;if(te!==null){var re=te.dehydrated;re!==null&&Li(re)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}fn||n.flags&512&&nu(n)}catch(Z){Rt(n,n.return,Z)}}if(n===e){Se=null;break}if(i=n.sibling,i!==null){i.return=n.return,Se=i;break}Se=n.return}}function eh(e){for(;Se!==null;){var n=Se;if(n===e){Se=null;break}var i=n.sibling;if(i!==null){i.return=n.return,Se=i;break}Se=n.return}}function th(e){for(;Se!==null;){var n=Se;try{switch(n.tag){case 0:case 11:case 15:var i=n.return;try{Ca(4,n)}catch(M){Rt(n,i,M)}break;case 1:var u=n.stateNode;if(typeof u.componentDidMount=="function"){var f=n.return;try{u.componentDidMount()}catch(M){Rt(n,f,M)}}var h=n.return;try{nu(n)}catch(M){Rt(n,h,M)}break;case 5:var w=n.return;try{nu(n)}catch(M){Rt(n,w,M)}}}catch(M){Rt(n,n.return,M)}if(n===e){Se=null;break}var j=n.sibling;if(j!==null){j.return=n.return,Se=j;break}Se=n.return}}var Ax=Math.ceil,_a=D.ReactCurrentDispatcher,iu=D.ReactCurrentOwner,Qn=D.ReactCurrentBatchConfig,Xe=0,Yt=null,Pt=null,sn=0,Bn=0,di=Xs(0),Bt=0,ro=null,Er=0,Ea=0,ou=0,io=null,En=null,au=0,fi=1/0,Os=null,Ra=!1,lu=null,nr=null,Aa=!1,sr=null,Ia=0,oo=0,cu=null,Da=-1,Ma=0;function Sn(){return(Xe&6)!==0?kt():Da!==-1?Da:Da=kt()}function rr(e){return(e.mode&1)===0?1:(Xe&2)!==0&&sn!==0?sn&-sn:hx.transition!==null?(Ma===0&&(Ma=Ai()),Ma):(e=qe,e!==0||(e=window.event,e=e===void 0?16:nf(e.type)),e)}function as(e,n,i,u){if(50<oo)throw oo=0,cu=null,Error(r(185));kr(e,i,u),((Xe&2)===0||e!==Yt)&&(e===Yt&&((Xe&2)===0&&(Ea|=i),Bt===4&&ir(e,sn)),Rn(e,u),i===1&&Xe===0&&(n.mode&1)===0&&(fi=kt()+500,la&&Zs()))}function Rn(e,n){var i=e.callbackNode;Wo(e,n);var u=wr(e,e===Yt?sn:0);if(u===0)i!==null&&Et(i),e.callbackNode=null,e.callbackPriority=0;else if(n=u&-u,e.callbackPriority!==n){if(i!=null&&Et(i),n===1)e.tag===0?px(sh.bind(null,e)):Bf(sh.bind(null,e)),cx(function(){(Xe&6)===0&&Zs()}),i=null;else{switch(ce(u)){case 1:i=Ws;break;case 4:i=xs;break;case 16:i=Br;break;case 536870912:i=Uo;break;default:i=Br}i=dh(i,nh.bind(null,e))}e.callbackPriority=n,e.callbackNode=i}}function nh(e,n){if(Da=-1,Ma=0,(Xe&6)!==0)throw Error(r(327));var i=e.callbackNode;if(pi()&&e.callbackNode!==i)return null;var u=wr(e,e===Yt?sn:0);if(u===0)return null;if((u&30)!==0||(u&e.expiredLanes)!==0||n)n=La(e,u);else{n=u;var f=Xe;Xe|=2;var h=ih();(Yt!==e||sn!==n)&&(Os=null,fi=kt()+500,Ar(e,n));do try{Mx();break}catch(j){rh(e,j)}while(!0);Cc(),_a.current=h,Xe=f,Pt!==null?n=0:(Yt=null,sn=0,n=Bt)}if(n!==0){if(n===2&&(f=Ri(e),f!==0&&(u=f,n=uu(e,f))),n===1)throw i=ro,Ar(e,0),ir(e,u),Rn(e,kt()),i;if(n===6)ir(e,u);else{if(f=e.current.alternate,(u&30)===0&&!Ix(f)&&(n=La(e,u),n===2&&(h=Ri(e),h!==0&&(u=h,n=uu(e,h))),n===1))throw i=ro,Ar(e,0),ir(e,u),Rn(e,kt()),i;switch(e.finishedWork=f,e.finishedLanes=u,n){case 0:case 1:throw Error(r(345));case 2:Ir(e,En,Os);break;case 3:if(ir(e,u),(u&130023424)===u&&(n=au+500-kt(),10<n)){if(wr(e,0)!==0)break;if(f=e.suspendedLanes,(f&u)!==u){Sn(),e.pingedLanes|=e.suspendedLanes&f;break}e.timeoutHandle=gc(Ir.bind(null,e,En,Os),n);break}Ir(e,En,Os);break;case 4:if(ir(e,u),(u&4194240)===u)break;for(n=e.eventTimes,f=-1;0<u;){var w=31-xn(u);h=1<<w,w=n[w],w>f&&(f=w),u&=~h}if(u=f,u=kt()-u,u=(120>u?120:480>u?480:1080>u?1080:1920>u?1920:3e3>u?3e3:4320>u?4320:1960*Ax(u/1960))-u,10<u){e.timeoutHandle=gc(Ir.bind(null,e,En,Os),u);break}Ir(e,En,Os);break;case 5:Ir(e,En,Os);break;default:throw Error(r(329))}}}return Rn(e,kt()),e.callbackNode===i?nh.bind(null,e):null}function uu(e,n){var i=io;return e.current.memoizedState.isDehydrated&&(Ar(e,n).flags|=256),e=La(e,n),e!==2&&(n=En,En=i,n!==null&&du(n)),e}function du(e){En===null?En=e:En.push.apply(En,e)}function Ix(e){for(var n=e;;){if(n.flags&16384){var i=n.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var u=0;u<i.length;u++){var f=i[u],h=f.getSnapshot;f=f.value;try{if(!ns(h(),f))return!1}catch{return!1}}}if(i=n.child,n.subtreeFlags&16384&&i!==null)i.return=n,n=i;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function ir(e,n){for(n&=~ou,n&=~Ea,e.suspendedLanes|=n,e.pingedLanes&=~n,e=e.expirationTimes;0<n;){var i=31-xn(n),u=1<<i;e[i]=-1,n&=~u}}function sh(e){if((Xe&6)!==0)throw Error(r(327));pi();var n=wr(e,0);if((n&1)===0)return Rn(e,kt()),null;var i=La(e,n);if(e.tag!==0&&i===2){var u=Ri(e);u!==0&&(n=u,i=uu(e,u))}if(i===1)throw i=ro,Ar(e,0),ir(e,n),Rn(e,kt()),i;if(i===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=n,Ir(e,En,Os),Rn(e,kt()),null}function fu(e,n){var i=Xe;Xe|=1;try{return e(n)}finally{Xe=i,Xe===0&&(fi=kt()+500,la&&Zs())}}function Rr(e){sr!==null&&sr.tag===0&&(Xe&6)===0&&pi();var n=Xe;Xe|=1;var i=Qn.transition,u=qe;try{if(Qn.transition=null,qe=1,e)return e()}finally{qe=u,Qn.transition=i,Xe=n,(Xe&6)===0&&Zs()}}function pu(){Bn=di.current,ht(di)}function Ar(e,n){e.finishedWork=null,e.finishedLanes=0;var i=e.timeoutHandle;if(i!==-1&&(e.timeoutHandle=-1,lx(i)),Pt!==null)for(i=Pt.return;i!==null;){var u=i;switch(Sc(u),u.tag){case 1:u=u.type.childContextTypes,u!=null&&oa();break;case 3:li(),ht(jn),ht(cn),Lc();break;case 5:Dc(u);break;case 4:li();break;case 13:ht(Tt);break;case 19:ht(Tt);break;case 10:_c(u.type._context);break;case 22:case 23:pu()}i=i.return}if(Yt=e,Pt=e=or(e.current,null),sn=Bn=n,Bt=0,ro=null,ou=Ea=Er=0,En=io=null,jr!==null){for(n=0;n<jr.length;n++)if(i=jr[n],u=i.interleaved,u!==null){i.interleaved=null;var f=u.next,h=i.pending;if(h!==null){var w=h.next;h.next=f,u.next=w}i.pending=u}jr=null}return e}function rh(e,n){do{var i=Pt;try{if(Cc(),ya.current=Sa,xa){for(var u=Nt.memoizedState;u!==null;){var f=u.queue;f!==null&&(f.pending=null),u=u.next}xa=!1}if(_r=0,qt=Ut=Nt=null,Zi=!1,Ji=0,iu.current=null,i===null||i.return===null){Bt=1,ro=n,Pt=null;break}e:{var h=e,w=i.return,j=i,M=n;if(n=sn,j.flags|=32768,M!==null&&typeof M=="object"&&typeof M.then=="function"){var V=M,te=j,re=te.tag;if((te.mode&1)===0&&(re===0||re===11||re===15)){var Z=te.alternate;Z?(te.updateQueue=Z.updateQueue,te.memoizedState=Z.memoizedState,te.lanes=Z.lanes):(te.updateQueue=null,te.memoizedState=null)}var xe=Ep(w);if(xe!==null){xe.flags&=-257,Rp(xe,w,j,h,n),xe.mode&1&&_p(h,V,n),n=xe,M=V;var Ne=n.updateQueue;if(Ne===null){var Ce=new Set;Ce.add(M),n.updateQueue=Ce}else Ne.add(M);break e}else{if((n&1)===0){_p(h,V,n),hu();break e}M=Error(r(426))}}else if(xt&&j.mode&1){var It=Ep(w);if(It!==null){(It.flags&65536)===0&&(It.flags|=256),Rp(It,w,j,h,n),Nc(ci(M,j));break e}}h=M=ci(M,j),Bt!==4&&(Bt=2),io===null?io=[h]:io.push(h),h=w;do{switch(h.tag){case 3:h.flags|=65536,n&=-n,h.lanes|=n;var B=jp(h,M,n);Jf(h,B);break e;case 1:j=M;var P=h.type,W=h.stateNode;if((h.flags&128)===0&&(typeof P.getDerivedStateFromError=="function"||W!==null&&typeof W.componentDidCatch=="function"&&(nr===null||!nr.has(W)))){h.flags|=65536,n&=-n,h.lanes|=n;var ue=Cp(h,j,n);Jf(h,ue);break e}}h=h.return}while(h!==null)}ah(i)}catch(_e){n=_e,Pt===i&&i!==null&&(Pt=i=i.return);continue}break}while(!0)}function ih(){var e=_a.current;return _a.current=Sa,e===null?Sa:e}function hu(){(Bt===0||Bt===3||Bt===2)&&(Bt=4),Yt===null||(Er&268435455)===0&&(Ea&268435455)===0||ir(Yt,sn)}function La(e,n){var i=Xe;Xe|=2;var u=ih();(Yt!==e||sn!==n)&&(Os=null,Ar(e,n));do try{Dx();break}catch(f){rh(e,f)}while(!0);if(Cc(),Xe=i,_a.current=u,Pt!==null)throw Error(r(261));return Yt=null,sn=0,Bt}function Dx(){for(;Pt!==null;)oh(Pt)}function Mx(){for(;Pt!==null&&!vs();)oh(Pt)}function oh(e){var n=uh(e.alternate,e,Bn);e.memoizedProps=e.pendingProps,n===null?ah(e):Pt=n,iu.current=null}function ah(e){var n=e;do{var i=n.alternate;if(e=n.return,(n.flags&32768)===0){if(i=jx(i,n,Bn),i!==null){Pt=i;return}}else{if(i=Cx(i,n),i!==null){i.flags&=32767,Pt=i;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Bt=6,Pt=null;return}}if(n=n.sibling,n!==null){Pt=n;return}Pt=n=e}while(n!==null);Bt===0&&(Bt=5)}function Ir(e,n,i){var u=qe,f=Qn.transition;try{Qn.transition=null,qe=1,Lx(e,n,i,u)}finally{Qn.transition=f,qe=u}return null}function Lx(e,n,i,u){do pi();while(sr!==null);if((Xe&6)!==0)throw Error(r(327));i=e.finishedWork;var f=e.finishedLanes;if(i===null)return null;if(e.finishedWork=null,e.finishedLanes=0,i===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var h=i.lanes|i.childLanes;if(Ho(e,h),e===Yt&&(Pt=Yt=null,sn=0),(i.subtreeFlags&2064)===0&&(i.flags&2064)===0||Aa||(Aa=!0,dh(Br,function(){return pi(),null})),h=(i.flags&15990)!==0,(i.subtreeFlags&15990)!==0||h){h=Qn.transition,Qn.transition=null;var w=qe;qe=1;var j=Xe;Xe|=4,iu.current=null,Ex(e,i),Qp(i,e),tx(hc),Go=!!pc,hc=pc=null,e.current=i,Rx(i),Kl(),Xe=j,qe=w,Qn.transition=h}else e.current=i;if(Aa&&(Aa=!1,sr=e,Ia=f),h=e.pendingLanes,h===0&&(nr=null),Wr(i.stateNode),Rn(e,kt()),n!==null)for(u=e.onRecoverableError,i=0;i<n.length;i++)f=n[i],u(f.value,{componentStack:f.stack,digest:f.digest});if(Ra)throw Ra=!1,e=lu,lu=null,e;return(Ia&1)!==0&&e.tag!==0&&pi(),h=e.pendingLanes,(h&1)!==0?e===cu?oo++:(oo=0,cu=e):oo=0,Zs(),null}function pi(){if(sr!==null){var e=ce(Ia),n=Qn.transition,i=qe;try{if(Qn.transition=null,qe=16>e?16:e,sr===null)var u=!1;else{if(e=sr,sr=null,Ia=0,(Xe&6)!==0)throw Error(r(331));var f=Xe;for(Xe|=4,Se=e.current;Se!==null;){var h=Se,w=h.child;if((Se.flags&16)!==0){var j=h.deletions;if(j!==null){for(var M=0;M<j.length;M++){var V=j[M];for(Se=V;Se!==null;){var te=Se;switch(te.tag){case 0:case 11:case 15:so(8,te,h)}var re=te.child;if(re!==null)re.return=te,Se=re;else for(;Se!==null;){te=Se;var Z=te.sibling,xe=te.return;if(Gp(te),te===V){Se=null;break}if(Z!==null){Z.return=xe,Se=Z;break}Se=xe}}}var Ne=h.alternate;if(Ne!==null){var Ce=Ne.child;if(Ce!==null){Ne.child=null;do{var It=Ce.sibling;Ce.sibling=null,Ce=It}while(Ce!==null)}}Se=h}}if((h.subtreeFlags&2064)!==0&&w!==null)w.return=h,Se=w;else e:for(;Se!==null;){if(h=Se,(h.flags&2048)!==0)switch(h.tag){case 0:case 11:case 15:so(9,h,h.return)}var B=h.sibling;if(B!==null){B.return=h.return,Se=B;break e}Se=h.return}}var P=e.current;for(Se=P;Se!==null;){w=Se;var W=w.child;if((w.subtreeFlags&2064)!==0&&W!==null)W.return=w,Se=W;else e:for(w=P;Se!==null;){if(j=Se,(j.flags&2048)!==0)try{switch(j.tag){case 0:case 11:case 15:Ca(9,j)}}catch(_e){Rt(j,j.return,_e)}if(j===w){Se=null;break e}var ue=j.sibling;if(ue!==null){ue.return=j.return,Se=ue;break e}Se=j.return}}if(Xe=f,Zs(),$n&&typeof $n.onPostCommitFiberRoot=="function")try{$n.onPostCommitFiberRoot(vr,e)}catch{}u=!0}return u}finally{qe=i,Qn.transition=n}}return!1}function lh(e,n,i){n=ci(i,n),n=jp(e,n,1),e=er(e,n,1),n=Sn(),e!==null&&(kr(e,1,n),Rn(e,n))}function Rt(e,n,i){if(e.tag===3)lh(e,e,i);else for(;n!==null;){if(n.tag===3){lh(n,e,i);break}else if(n.tag===1){var u=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(nr===null||!nr.has(u))){e=ci(i,e),e=Cp(n,e,1),n=er(n,e,1),e=Sn(),n!==null&&(kr(n,1,e),Rn(n,e));break}}n=n.return}}function Ox(e,n,i){var u=e.pingCache;u!==null&&u.delete(n),n=Sn(),e.pingedLanes|=e.suspendedLanes&i,Yt===e&&(sn&i)===i&&(Bt===4||Bt===3&&(sn&130023424)===sn&&500>kt()-au?Ar(e,0):ou|=i),Rn(e,n)}function ch(e,n){n===0&&((e.mode&1)===0?n=1:(n=Vr,Vr<<=1,(Vr&130023424)===0&&(Vr=4194304)));var i=Sn();e=Ds(e,n),e!==null&&(kr(e,n,i),Rn(e,i))}function Px(e){var n=e.memoizedState,i=0;n!==null&&(i=n.retryLane),ch(e,i)}function $x(e,n){var i=0;switch(e.tag){case 13:var u=e.stateNode,f=e.memoizedState;f!==null&&(i=f.retryLane);break;case 19:u=e.stateNode;break;default:throw Error(r(314))}u!==null&&u.delete(n),ch(e,i)}var uh;uh=function(e,n,i){if(e!==null)if(e.memoizedProps!==n.pendingProps||jn.current)_n=!0;else{if((e.lanes&i)===0&&(n.flags&128)===0)return _n=!1,Nx(e,n,i);_n=(e.flags&131072)!==0}else _n=!1,xt&&(n.flags&1048576)!==0&&Wf(n,ua,n.index);switch(n.lanes=0,n.tag){case 2:var u=n.type;Na(e,n),e=n.pendingProps;var f=ti(n,cn.current);ai(n,i),f=$c(null,n,u,e,f,i);var h=zc();return n.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,Cn(u)?(h=!0,aa(n)):h=!1,n.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,Ac(n),f.updater=ba,n.stateNode=f,f._reactInternals=n,Vc(n,u,e,i),n=Yc(null,n,u,!0,h,i)):(n.tag=0,xt&&h&&kc(n),kn(null,n,f,i),n=n.child),n;case 16:u=n.elementType;e:{switch(Na(e,n),e=n.pendingProps,f=u._init,u=f(u._payload),n.type=u,f=n.tag=Fx(u),e=rs(u,e),f){case 0:n=qc(null,n,u,e,i);break e;case 1:n=Op(null,n,u,e,i);break e;case 11:n=Ap(null,n,u,e,i);break e;case 14:n=Ip(null,n,u,rs(u.type,e),i);break e}throw Error(r(306,u,""))}return n;case 0:return u=n.type,f=n.pendingProps,f=n.elementType===u?f:rs(u,f),qc(e,n,u,f,i);case 1:return u=n.type,f=n.pendingProps,f=n.elementType===u?f:rs(u,f),Op(e,n,u,f,i);case 3:e:{if(Pp(n),e===null)throw Error(r(387));u=n.pendingProps,h=n.memoizedState,f=h.element,Zf(e,n),ga(n,u,null,i);var w=n.memoizedState;if(u=w.element,h.isDehydrated)if(h={element:u,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){f=ci(Error(r(423)),n),n=$p(e,n,u,i,f);break e}else if(u!==f){f=ci(Error(r(424)),n),n=$p(e,n,u,i,f);break e}else for(Un=Ys(n.stateNode.containerInfo.firstChild),Fn=n,xt=!0,ss=null,i=Xf(n,null,u,i),n.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(ri(),u===f){n=Ls(e,n,i);break e}kn(e,n,u,i)}n=n.child}return n;case 5:return tp(n),e===null&&Tc(n),u=n.type,f=n.pendingProps,h=e!==null?e.memoizedProps:null,w=f.children,mc(u,f)?w=null:h!==null&&mc(u,h)&&(n.flags|=32),Lp(e,n),kn(e,n,w,i),n.child;case 6:return e===null&&Tc(n),null;case 13:return zp(e,n,i);case 4:return Ic(n,n.stateNode.containerInfo),u=n.pendingProps,e===null?n.child=ii(n,null,u,i):kn(e,n,u,i),n.child;case 11:return u=n.type,f=n.pendingProps,f=n.elementType===u?f:rs(u,f),Ap(e,n,u,f,i);case 7:return kn(e,n,n.pendingProps,i),n.child;case 8:return kn(e,n,n.pendingProps.children,i),n.child;case 12:return kn(e,n,n.pendingProps.children,i),n.child;case 10:e:{if(u=n.type._context,f=n.pendingProps,h=n.memoizedProps,w=f.value,ut(pa,u._currentValue),u._currentValue=w,h!==null)if(ns(h.value,w)){if(h.children===f.children&&!jn.current){n=Ls(e,n,i);break e}}else for(h=n.child,h!==null&&(h.return=n);h!==null;){var j=h.dependencies;if(j!==null){w=h.child;for(var M=j.firstContext;M!==null;){if(M.context===u){if(h.tag===1){M=Ms(-1,i&-i),M.tag=2;var V=h.updateQueue;if(V!==null){V=V.shared;var te=V.pending;te===null?M.next=M:(M.next=te.next,te.next=M),V.pending=M}}h.lanes|=i,M=h.alternate,M!==null&&(M.lanes|=i),Ec(h.return,i,n),j.lanes|=i;break}M=M.next}}else if(h.tag===10)w=h.type===n.type?null:h.child;else if(h.tag===18){if(w=h.return,w===null)throw Error(r(341));w.lanes|=i,j=w.alternate,j!==null&&(j.lanes|=i),Ec(w,i,n),w=h.sibling}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===n){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}kn(e,n,f.children,i),n=n.child}return n;case 9:return f=n.type,u=n.pendingProps.children,ai(n,i),f=Yn(f),u=u(f),n.flags|=1,kn(e,n,u,i),n.child;case 14:return u=n.type,f=rs(u,n.pendingProps),f=rs(u.type,f),Ip(e,n,u,f,i);case 15:return Dp(e,n,n.type,n.pendingProps,i);case 17:return u=n.type,f=n.pendingProps,f=n.elementType===u?f:rs(u,f),Na(e,n),n.tag=1,Cn(u)?(e=!0,aa(n)):e=!1,ai(n,i),Tp(n,u,f),Vc(n,u,f,i),Yc(null,n,u,!0,e,i);case 19:return Up(e,n,i);case 22:return Mp(e,n,i)}throw Error(r(156,n.tag))};function dh(e,n){return Ze(e,n)}function zx(e,n,i,u){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,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(e,n,i,u){return new zx(e,n,i,u)}function mu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Fx(e){if(typeof e=="function")return mu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ve)return 11;if(e===ee)return 14}return 2}function or(e,n){var i=e.alternate;return i===null?(i=Zn(e.tag,n,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=n,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&14680064,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,n=e.dependencies,i.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function Oa(e,n,i,u,f,h){var w=2;if(u=e,typeof e=="function")mu(e)&&(w=1);else if(typeof e=="string")w=5;else e:switch(e){case G:return Dr(i.children,f,h,n);case z:w=8,f|=8;break;case J:return e=Zn(12,i,n,f|2),e.elementType=J,e.lanes=h,e;case we:return e=Zn(13,i,n,f),e.elementType=we,e.lanes=h,e;case Ae:return e=Zn(19,i,n,f),e.elementType=Ae,e.lanes=h,e;case oe:return Pa(i,f,h,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case he:w=10;break e;case ae:w=9;break e;case ve:w=11;break e;case ee:w=14;break e;case ne:w=16,u=null;break e}throw Error(r(130,e==null?e:typeof e,""))}return n=Zn(w,i,n,f),n.elementType=e,n.type=u,n.lanes=h,n}function Dr(e,n,i,u){return e=Zn(7,e,u,n),e.lanes=i,e}function Pa(e,n,i,u){return e=Zn(22,e,u,n),e.elementType=oe,e.lanes=i,e.stateNode={isHidden:!1},e}function gu(e,n,i){return e=Zn(6,e,null,n),e.lanes=i,e}function vu(e,n,i){return n=Zn(4,e.children!==null?e.children:[],e.key,n),n.lanes=i,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function Ux(e,n,i,u,f){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ii(0),this.expirationTimes=Ii(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ii(0),this.identifierPrefix=u,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function yu(e,n,i,u,f,h,w,j,M){return e=new Ux(e,n,i,j,M),n===1?(n=1,h===!0&&(n|=8)):n=0,h=Zn(3,null,null,n),e.current=h,h.stateNode=e,h.memoizedState={element:u,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ac(h),e}function Bx(e,n,i){var u=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:K,key:u==null?null:""+u,children:e,containerInfo:n,implementation:i}}function fh(e){if(!e)return Qs;e=e._reactInternals;e:{if(Be(e)!==e||e.tag!==1)throw Error(r(170));var n=e;do{switch(n.tag){case 3:n=n.stateNode.context;break e;case 1:if(Cn(n.type)){n=n.stateNode.__reactInternalMemoizedMergedChildContext;break e}}n=n.return}while(n!==null);throw Error(r(171))}if(e.tag===1){var i=e.type;if(Cn(i))return Ff(e,i,n)}return n}function ph(e,n,i,u,f,h,w,j,M){return e=yu(i,u,!0,e,f,h,w,j,M),e.context=fh(null),i=e.current,u=Sn(),f=rr(i),h=Ms(u,f),h.callback=n??null,er(i,h,f),e.current.lanes=f,kr(e,f,u),Rn(e,u),e}function $a(e,n,i,u){var f=n.current,h=Sn(),w=rr(f);return i=fh(i),n.context===null?n.context=i:n.pendingContext=i,n=Ms(h,w),n.payload={element:e},u=u===void 0?null:u,u!==null&&(n.callback=u),e=er(f,n,w),e!==null&&(as(e,f,w,h),ma(e,f,w)),w}function za(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function hh(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<n?i:n}}function xu(e,n){hh(e,n),(e=e.alternate)&&hh(e,n)}function Wx(){return null}var mh=typeof reportError=="function"?reportError:function(e){console.error(e)};function wu(e){this._internalRoot=e}Fa.prototype.render=wu.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));$a(e,n,null,null)},Fa.prototype.unmount=wu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Rr(function(){$a(null,e,null,null)}),n[Es]=null}};function Fa(e){this._internalRoot=e}Fa.prototype.unstable_scheduleHydration=function(e){if(e){var n=je();e={blockedOn:null,target:e,priority:n};for(var i=0;i<Gs.length&&n!==0&&n<Gs[i].priority;i++);Gs.splice(i,0,e),i===0&&ef(e)}};function ku(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ua(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function gh(){}function Hx(e,n,i,u,f){if(f){if(typeof u=="function"){var h=u;u=function(){var V=za(w);h.call(V)}}var w=ph(n,u,e,0,null,!1,!1,"",gh);return e._reactRootContainer=w,e[Es]=w.current,Hi(e.nodeType===8?e.parentNode:e),Rr(),w}for(;f=e.lastChild;)e.removeChild(f);if(typeof u=="function"){var j=u;u=function(){var V=za(M);j.call(V)}}var M=yu(e,0,!1,null,null,!1,!1,"",gh);return e._reactRootContainer=M,e[Es]=M.current,Hi(e.nodeType===8?e.parentNode:e),Rr(function(){$a(n,M,i,u)}),M}function Ba(e,n,i,u,f){var h=i._reactRootContainer;if(h){var w=h;if(typeof f=="function"){var j=f;f=function(){var M=za(w);j.call(M)}}$a(n,w,e,f)}else w=Hx(i,n,e,f,u);return za(w)}b=function(e){switch(e.tag){case 3:var n=e.stateNode;if(n.current.memoizedState.isDehydrated){var i=xr(n.pendingLanes);i!==0&&(Vs(n,i|1),Rn(n,kt()),(Xe&6)===0&&(fi=kt()+500,Zs()))}break;case 13:Rr(function(){var u=Ds(e,1);if(u!==null){var f=Sn();as(u,e,1,f)}}),xu(e,1)}},U=function(e){if(e.tag===13){var n=Ds(e,134217728);if(n!==null){var i=Sn();as(n,e,134217728,i)}xu(e,134217728)}},Q=function(e){if(e.tag===13){var n=rr(e),i=Ds(e,n);if(i!==null){var u=Sn();as(i,e,n,u)}xu(e,n)}},je=function(){return qe},Re=function(e,n){var i=qe;try{return qe=e,n()}finally{qe=i}},Vt=function(e,n,i){switch(n){case"input":if(Ht(e,i),n=i.name,i.type==="radio"&&n!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+n)+'][type="radio"]'),n=0;n<i.length;n++){var u=i[n];if(u!==e&&u.form===e.form){var f=ia(u);if(!f)throw Error(r(90));Ee(u),Ht(u,f)}}}break;case"textarea":ge(e,i);break;case"select":n=i.value,n!=null&&zt(e,!!i.multiple,n,!1)}},vt=fu,yt=Rr;var Vx={usingClientEntryPoint:!1,Events:[Ki,Jr,ia,ft,Gt,fu]},ao={findFiberByHostInstance:Sr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Gx={bundleType:ao.bundleType,version:ao.version,rendererPackageName:ao.rendererPackageName,rendererConfig:ao.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:D.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Pn(e),e===null?null:e.stateNode},findFiberByHostInstance:ao.findFiberByHostInstance||Wx,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 Wa=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wa.isDisabled&&Wa.supportsFiber)try{vr=Wa.inject(Gx),$n=Wa}catch{}}return An.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Vx,An.createPortal=function(e,n){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ku(n))throw Error(r(200));return Bx(e,n,null,i)},An.createRoot=function(e,n){if(!ku(e))throw Error(r(299));var i=!1,u="",f=mh;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(u=n.identifierPrefix),n.onRecoverableError!==void 0&&(f=n.onRecoverableError)),n=yu(e,1,!1,null,null,i,!1,u,f),e[Es]=n.current,Hi(e.nodeType===8?e.parentNode:e),new wu(n)},An.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=Pn(n),e=e===null?null:e.stateNode,e},An.flushSync=function(e){return Rr(e)},An.hydrate=function(e,n,i){if(!Ua(n))throw Error(r(200));return Ba(null,e,n,!0,i)},An.hydrateRoot=function(e,n,i){if(!ku(e))throw Error(r(405));var u=i!=null&&i.hydratedSources||null,f=!1,h="",w=mh;if(i!=null&&(i.unstable_strictMode===!0&&(f=!0),i.identifierPrefix!==void 0&&(h=i.identifierPrefix),i.onRecoverableError!==void 0&&(w=i.onRecoverableError)),n=ph(n,null,e,1,i??null,f,!1,h,w),e[Es]=n.current,Hi(e),u)for(e=0;e<u.length;e++)i=u[e],f=i._getVersion,f=f(i._source),n.mutableSourceEagerHydrationData==null?n.mutableSourceEagerHydrationData=[i,f]:n.mutableSourceEagerHydrationData.push(i,f);return new Fa(n)},An.render=function(e,n,i){if(!Ua(n))throw Error(r(200));return Ba(null,e,n,!1,i)},An.unmountComponentAtNode=function(e){if(!Ua(e))throw Error(r(40));return e._reactRootContainer?(Rr(function(){Ba(null,null,e,!1,function(){e._reactRootContainer=null,e[Es]=null})}),!0):!1},An.unstable_batchedUpdates=fu,An.unstable_renderSubtreeIntoContainer=function(e,n,i,u){if(!Ua(i))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return Ba(e,n,i,!1,u)},An.version="18.3.1-next-f1338f8080-20240426",An}var Th;function kg(){if(Th)return Tu.exports;Th=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(s){console.error(s)}}return t(),Tu.exports=t0(),Tu.exports}var Nh;function n0(){if(Nh)return Ha;Nh=1;var t=kg();return Ha.createRoot=t.createRoot,Ha.hydrateRoot=t.hydrateRoot,Ha}var s0=n0();const r0=wg(s0),jh=t=>{let s;const r=new Set,o=(m,v)=>{const k=typeof m=="function"?m(s):m;if(!Object.is(k,s)){const y=s;s=v??(typeof k!="object"||k===null)?k:Object.assign({},s,k),r.forEach(S=>S(s,y))}},l=()=>s,p={setState:o,getState:l,getInitialState:()=>g,subscribe:m=>(r.add(m),()=>r.delete(m))},g=s=t(o,l,p);return p},i0=(t=>t?jh(t):jh),o0=t=>t;function a0(t,s=o0){const r=lt.useSyncExternalStore(t.subscribe,lt.useCallback(()=>s(t.getState()),[t,s]),lt.useCallback(()=>s(t.getInitialState()),[t,s]));return lt.useDebugValue(r),r}const l0=t=>{const s=i0(t),r=o=>a0(s,o);return Object.assign(r,s),r},c0=(t=>l0),Sg="agentpane:machines",bg="agentpane:active-machine";function u0(t){return/^[a-z][a-z0-9-]{1,30}$/.test(t)}function Tg(t){return`${t}.repoburg.com`}function Ng(t){const s=/^([a-z][a-z0-9-]{1,30})\.repoburg\.com$/.exec(t);return s?s[1]:null}function jg(t,s){try{const r=localStorage.getItem(t);return r==null?s:JSON.parse(r)}catch{return s}}function Cg(t,s){try{localStorage.setItem(t,JSON.stringify(s))}catch{}}function d0(t){const{mahlas:s,hostname:r}=t??{};return typeof s=="string"&&u0(s)&&r===Tg(s)}function _g(){const t=jg(Sg,[]);return Array.isArray(t)?t.filter(d0):[]}function f0(t){const s={mahlas:t,hostname:Tg(t),lastConnectedAt:new Date().toISOString()},r=_g(),o=[s,...r.filter(l=>l.mahlas!==t)];return Cg(Sg,o),s}function p0(){const t=jg(bg,null);return t?_g().find(s=>s.mahlas===t)??null:null}function h0(t){Cg(bg,t)}function m0(){if(typeof window>"u")return;const t=new URLSearchParams(window.location.search).get("host");if(!t)return;const s=Ng(t);s&&(f0(s),h0(s))}const Ch="http://localhost:9998",g0=["agent.repoburg.com"];function mn(){if(typeof window>"u")return"";const t=new URLSearchParams(window.location.search),s=t.get("bport");if(s)return`http://localhost:${s}`;const r=t.get("host");if(r)return`https://${r}`;const o=window.location.hostname;if(g0.includes(o))return Ch;if(Ng(o))return"";const l=p0();return l?`https://${l.hostname}`:o==="localhost"||o==="127.0.0.1"||o==="0.0.0.0"?"":Ch}function v0(t){const s=mn();return s?`${s.replace(/^http/,"ws")}${t}`:`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${t}`}const y0="/api";class Il extends Error{constructor(r,o,l){super(r);it(this,"status");it(this,"body");this.name="ApiError",this.status=o,this.body=l}}function Pr(t){var s;if(t instanceof Il){const r=(s=t.body)==null?void 0:s.error;if(typeof r=="string"&&r)return r}return t instanceof Error?t.message:String(t)}async function Do(t,s,r){const o=await fetch(`${mn()}${y0}${s}`,{method:t,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 Il(`${t} ${s} failed: ${l}`,o.status,c)}return o.json()}function Mt(t){return Do("GET",t)}function ot(t,s){return Do("POST",t,s)}function Dl(t){return Do("DELETE",t)}function ds(t,s){return Do("PATCH",t,s)}function x0(t,s){return Do("PUT",t,s)}function w0(){return Mt("/sessions")}function co(t){return Mt(`/sessions/${t}?items=summary`)}function k0(t,s){return Mt(`/sessions/${t}/turns/${s}`)}function kd(t){return ot("/sessions",t)}function _h(t){return Dl(`/sessions/${t}`)}function Eg(t,s,r,o){return ot(`/sessions/${t}/turns`,{user_prompt:s,...r!=null&&r.length?{attachments:r}:{},...o!=null&&o.originAppId?{origin_app_id:o.originAppId}:{}})}function S0(t){return ot(`/sessions/${t}/cancel`)}function b0(t,s){return ot(`/sessions/${t}/turns/${s}/resume`)}function T0(){return ot("/turns/resume-signed-out")}function N0(t,s){return ds(`/sessions/${t}`,{title:s})}function Eh(t){return ds(`/sessions/${t}`,{lifecycle:"finished"})}function Rh(t){return ds(`/sessions/${t}`,{lifecycle:"working"})}function j0(t,s){return ds(`/sessions/${t}`,{starred:s})}function Ah(t){return ds(`/sessions/${t}`,{has_unreviewed:0})}function C0(t,s,r,o){const l={model:s,model_reasoning_effort:r};return o!==void 0&&(l.runtime_type=o),ds(`/sessions/${t}`,l)}function _0(t,s){return ds(`/sessions/${t}`,{runtime_config:s})}function E0(t,s){return ot(`/sessions/${t}/rewind`,{turn_id:s})}function R0(t){return ot(`/sessions/${t}/restore`,{})}function A0(t,s,r){return ot(`/sessions/${t}/branch`,{turn_id:s,title:r})}function Rg(){return Mt("/workspaces")}function I0(t,s){return ot("/workspaces",{path:t,label:s})}function D0(t){return ot("/workspaces/hide",{path:t})}function M0(){return Mt("/workspaces/picker")}function Ih(t){return Mt(t?`/workspaces/browse?path=${encodeURIComponent(t)}`:"/workspaces/browse")}async function Ag(){const t=await fetch(`${mn()}/api/pick-directory`);if(t.status===204)return{cancelled:!0};if(!t.ok)throw new Error(`GET /api/pick-directory failed: ${t.status} ${t.statusText}`);return t.json()}function Ig(){return Mt("/folders")}function L0(t,s){return ot("/folders",{workspace_path:t,name:s})}function Dh(t,s){return ds(`/folders/${t}`,s)}function O0(t){return Dl(`/folders/${t}`)}function P0(t){return ot("/sessions/reorder",{moves:t})}function Fs(t){return t.status==="pending"||t.status==="running"}function Dg(t){return!!(t!=null&&t.turns.some(Fs))}function Ml(t){return t?t.turns.some(Fs)||(t.threads??[]).some(s=>(s.turns??[]).some(Fs)):!1}const $0="s:",Xu="a:",$r=t=>`${$0}${t}`,To=t=>`${Xu}${t}`;function pr(t){return{kind:t.startsWith(Xu)?"app":"session",id:t.slice(Xu.length)}}function Sd(t){return t.activeAppTabId!==null?To(t.activeAppTabId):t.activeSessionId===null?null:$r(t.activeSessionId)}function Mg(t,s,r){const o=[...s.map($r),...r.map(To)],l=new Set(o),c=t.filter(g=>l.has(g)),d=new Set(c),p=o.filter(g=>!d.has(g));return p.length===0&&c.length===t.length?t:[...c,...p]}function z0(t){return t.subscribe((s,r)=>{if(s.openTabs===r.openTabs&&s.openAppTabs===r.openAppTabs)return;const o=Mg(s.tabOrder,s.openTabs,s.openAppTabs);o!==s.tabOrder&&t.setState({tabOrder:o})})}function Mh(t,s,r){const o=t.indexOf(s);return t.slice(o+1).find(r)??t.slice(0,Math.max(o,0)).reverse().find(r)??null}function bd(t,s){const r=d=>!s.has(d),o=Sd(t);let{activeSessionId:l,activeAppTabId:c}=t;if(o!==null&&s.has(o)){const d=Mh(t.tabOrder,o,r),p=d===null?null:pr(d);c=(p==null?void 0:p.kind)==="app"?p.id:null,(p==null?void 0:p.kind)==="session"&&(l=p.id)}if(l!==null&&s.has($r(l))){const d=g=>r(g)&&pr(g).kind==="session",p=Mh(t.tabOrder,$r(l),d);l=p===null?null:pr(p).id}return{activeSessionId:l,activeAppTabId:c}}function Lg(t,s){if(t.tabOrder.includes(s))return!1;const{kind:r,id:o}=pr(s);return(r==="app"?t.apps:t.sessions).some(c=>c.id===o)}const Og=1;function Pg(){let t="";try{t=mn()}catch{}return`agentpane:tabs:${t||window.location.origin}`}function Cu(t){return Array.isArray(t)&&t.every(s=>typeof s=="string")}function Lh(t){return t===null||typeof t=="string"}function F0(t){if(t==null)return null;let s;try{s=JSON.parse(t)}catch{return null}if(typeof s!="object"||s===null)return null;const r=s;return r.v!==Og||!Cu(r.openTabs)||!Lh(r.activeSessionId)||!Cu(r.openAppTabs)||!Lh(r.activeAppTabId)?null:{openTabs:r.openTabs,activeSessionId:r.activeSessionId,openAppTabs:r.openAppTabs,activeAppTabId:r.activeAppTabId,tabOrder:Cu(r.tabOrder)?r.tabOrder:[]}}const $g=[()=>window.sessionStorage,()=>window.localStorage];function U0(){const t=Pg();for(const s of $g)try{const r=F0(s().getItem(t));if(r)return r}catch{}return null}function B0(t){const s=Pg(),r=JSON.stringify({v:Og,openTabs:t.openTabs,activeSessionId:t.activeSessionId,openAppTabs:t.openAppTabs,activeAppTabId:t.activeAppTabId,tabOrder:t.tabOrder});for(const o of $g)try{o().setItem(s,r)}catch{}}function W0(t){return t.subscribe((s,r)=>{(s.openTabs!==r.openTabs||s.activeSessionId!==r.activeSessionId||s.openAppTabs!==r.openAppTabs||s.activeAppTabId!==r.activeAppTabId||s.tabOrder!==r.tabOrder)&&B0(s)})}function yo(t){return[...new Set(t)]}function H0(t,s,r,o){const l=v=>r===null||r.has(v),c=yo(((t==null?void 0:t.openTabs)??[]).filter(v=>s.has(v))),d=yo(((t==null?void 0:t.openAppTabs)??[]).filter(l));let p=(t==null?void 0:t.activeSessionId)??null;p!==null&&!s.has(p)&&(p=null),p!==null&&!c.includes(p)&&c.push(p),p??(p=c.at(-1)??null);let g=(t==null?void 0:t.activeAppTabId)??null;g!==null&&!l(g)&&(g=null),g!==null&&!d.includes(g)&&d.push(g),o!==null&&s.has(o)&&(c.includes(o)||c.push(o),p=o,g=null);const m=Mg(yo((t==null?void 0:t.tabOrder)??[]),c,d);return{openTabs:c,activeSessionId:p,openAppTabs:d,activeAppTabId:g,tabOrder:m}}const Us=new Map,Td=new Map,Ll=new Map,ul=new Set,Nd=new Map,Ol=new Map;function V0(t,s,r=""){Us.set(t,s),Td.set(t,r)}function G0(t){Us.delete(t),Td.delete(t)}function sl(t,s){Ll.set(t,s)}function K0(t,s){s?ul.add(t):ul.delete(t)}function Oh(t,s,r){const o=Ll.get(t);if(!o||ul.has(o))return;const l=Us.get(o);l&&l({source:"agentpane-host",event:s,payload:r})}function Ph(t,s){const r=Ll.get(t);if(!r||ul.has(r))return;const o=Us.get(r);o&&o({source:"agentpane-host",event:"background_tasks",payload:{sessionId:t,tasks:s}})}function q0(t,s,r,o,l,c=null){if(typeof l=="string"&&l!==Td.get(t))return;const d=Us.get(t);d&&d({source:"agentpane-host",event:"tool_call",payload:{callId:s,tool:r,name:r,args:o,caller:c}})}function Y0(t,s,r,o){const l=Ll.get(t);if(!l)return;const c=Us.get(l);c&&c({source:"agentpane-host",event:"turn:delta",payload:{sessionId:t,turnId:s,itemId:r,delta:o}})}function X0(t,s){Nd.set(t,s)}function Q0(t){Nd.delete(t)}function Z0(t,s){Ol.set(t,s)}function J0(t){Ol.delete(t)}function zg(t,s={}){const r=Ol.get(t);if(r){r(s);return}const o=Us.get(t);o&&o({source:"agentpane-host",event:"state_changed",payload:{}})}function ew(){for(const t of new Set([...Us.keys(),...Ol.keys()]))zg(t)}function tw(t){var r;const s=Us.get(t);s&&s({source:"agentpane-host",event:"source:updated",payload:{}}),(r=Nd.get(t))==null||r()}const nw=(t,s)=>({wsConnected:!1,backgroundTasks:{},retryStates:{},signedOutTurns:{},setWsConnected:r=>t({wsConnected:r}),onTurnCreated:(r,o)=>{t(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)=>{s().addLogEntry("DEBUG",`turn:started — ${o.slice(0,8)}`),t(l=>{const c=lr(l.sessions,r,()=>({is_running:1,status:"running"})),d=l.sessionDetails[r];if(!d)return{sessions:c};const p=d.turns.findIndex(g=>g.id===o);return{sessionDetails:{...l.sessionDetails,[r]:{...Hn(d,o,g=>({...g,status:"running"})),is_running:1,status:"running"}},sessions:c,activeTurnIndex:l.activeSessionId===r&&p>=0?p:l.activeTurnIndex}})},onItemStarted:(r,o,l)=>{s().addLogEntry("DEBUG",`item:started — ${l.type}`),t(c=>{const d=$h(l)?Mr(c.retryStates,o):c.retryStates,p=c.sessionDetails[r];return p?{sessionDetails:{...c.sessionDetails,[r]:Hn(p,o,g=>Eu(g,l))},retryStates:d}:{retryStates:d}})},onItemUpdated:(r,o,l)=>{t(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:Hn(d,o,p=>Eu(p,l))}}:{}})},onItemCompleted:(r,o,l)=>{if(s().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",p=c.description||"background task",m=d==="local_agent"?"Subagent":d==="local_bash"?"Monitor":"Task";l.status==="completed"?s().addToast("success",`${m} completed: ${p}`):c.status!=="stopped"&&s().addToast("error",`${m} failed: ${p}`)}t(c=>{const d=$h(l)?Mr(c.retryStates,o):c.retryStates,p=c.sessionDetails[r];return p?{retryStates:d,sessionDetails:{...c.sessionDetails,[r]:Hn(p,o,g=>{var v,k;let m=Eu(g,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 y=m.thoughts?m.thoughts+`
42
- `+l.data.text:l.data.text;m={...m,thoughts:y}}return m})}}:{retryStates:d}})},onItemDelta:(r,o,l,c)=>{Y0(r,o,l,c),t(d=>{const p=Mr(d.retryStates,o),g=d.sessionDetails[r];return g?{sessionDetails:{...d.sessionDetails,[r]:Hn(g,o,m=>iw(m,l,c))},retryStates:p}:{retryStates:p}})},onTurnCompleted:(r,o,l,c,d)=>{s().dropSignedOutTurn(o);const p=(l==null?void 0:l.input_tokens)??0,g=(l==null?void 0:l.output_tokens)??0;s().addLogEntry("INFO",`turn:completed — ${p} in / ${g} out`),Oh(r,"turn:completed",{sessionId:r,turnId:o,response:d??null}),s().refreshApps(),t(m=>{const v=m.sessionDetails[r],k=v?Hn(v,o,N=>({...N,status:"completed",token_usage:l??N.token_usage??null,...d&&!N.agent_response?{agent_response:d}:{}})):null,y=_u(k),S=y&&k?Va(k):"active",T=lr(m.sessions,r,N=>({is_running:y,status:S,has_unreviewed:c?1:N.has_unreviewed})),E=Mr(m.retryStates,o);return k?{sessionDetails:{...m.sessionDetails,[r]:{...k,is_running:y,status:S,has_unreviewed:c?1:k.has_unreviewed}},sessions:T,retryStates:E}:{sessions:T,retryStates:E}})},onTokenUsageUpdated:(r,o,l)=>{t(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:Hn(d,o,p=>({...p,token_usage:l}))}}:{}})},onContextUsageUpdated:(r,o)=>{t(l=>{const c=l.sessionDetails[r];return c?{sessionDetails:{...l.sessionDetails,[r]:{...c,contextUsage:o}}}:{}})},onTurnFailed:(r,o,l,c)=>{s().dropSignedOutTurn(o),s().addLogEntry("ERROR",`turn:failed — ${l}`),s().addToast("error",`Turn failed — ${l}`),Oh(r,"turn:failed",{sessionId:r,turnId:o,error:l}),t(d=>{const p=d.sessionDetails[r],g=l.includes("cancelled")||l.includes("aborted"),m=g?"aborted":"failed",v=p?Hn(p,o,E=>({...E,status:m,error:l,...c?{resume_state:c}:{},items:E.items.map(N=>N.status==="in_progress"?{...N,status:"failed"}:N)})):null,k=_u(v),y=k&&v?Va(v):g?"active":"failed",S=lr(d.sessions,r,()=>({is_running:k,status:y})),T=Mr(d.retryStates,o);return v?{sessionDetails:{...d.sessionDetails,[r]:{...v,is_running:k,status:y}},sessions:S,retryStates:T}:{sessions:S,retryStates:T}})},onTurnCancelled:(r,o)=>{s().dropSignedOutTurn(o),t(l=>{const c=l.sessionDetails[r],d=c?Hn(c,o,k=>({...k,status:"aborted",...k.resume_state==="waiting"||k.resume_state==="resuming"?{resume_state:"cancelled"}:{},items:k.items.map(y=>y.status==="in_progress"?{...y,status:"completed"}:y)})):null,p=_u(d),g=p&&d?Va(d):"active",m=lr(l.sessions,r,()=>({is_running:p,status:g})),v=Mr(l.retryStates,o);return d?{sessionDetails:{...l.sessionDetails,[r]:{...d,is_running:p,status:g}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnInterrupted:(r,o,l)=>{s().addLogEntry("WARN",`turn:interrupted — ${l.reason}${l.detail?` (${l.detail})`:""}`),s().addToast("warn",sw(l.reason)),l.reason==="auth"?t(c=>({signedOutTurns:{...c.signedOutTurns,[o]:r}})):s().dropSignedOutTurn(o),t(c=>{const d=c.sessionDetails[r],p=d?Hn(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,g=p?Va(p):"interrupted",m=lr(c.sessions,r,()=>({is_running:1,status:g})),v=Mr(c.retryStates,o);return p?{sessionDetails:{...c.sessionDetails,[r]:{...p,is_running:1,status:g}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnResuming:(r,o,l)=>{s().dropSignedOutTurn(o),s().addLogEntry("INFO",`turn:resuming — ${o.slice(0,8)} (attempt ${l})`),t(c=>{const d=lr(c.sessions,r,()=>({is_running:1,status:"running"})),p=c.sessionDetails[r];return p?{sessionDetails:{...c.sessionDetails,[r]:{...Hn(p,o,g=>({...g,status:"running",error:null,resume_state:"resuming",resume_attempts:l})),is_running:1,status:"running"}},sessions:d}:{sessions:d}})},onTurnResumed:(r,o)=>{s().addLogEntry("INFO",`turn:resumed — ${o.slice(0,8)}`),s().addToast("success","Interrupted turn resumed"),t(l=>{const c=l.sessionDetails[r];return c?{sessionDetails:{...l.sessionDetails,[r]:Hn(c,o,d=>({...d,resume_state:"resumed"}))}}:{}})},onTurnRetrying:(r,o,l)=>{s().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}`:""})`),t(c=>({retryStates:{...c.retryStates,[o]:l}}))},onSessionTitle:(r,o)=>{t(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=>{t(o=>{const l=o.sessionDetails[r];return{sessions:lr(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,t(l=>{const c=l.sessionDetails[r.id];return{sessions:lr(l.sessions,r.id,()=>o),sessionDetails:c?{...l.sessionDetails,[r.id]:{...c,...o}}:l.sessionDetails}})},onBackgroundTasksChanged:(r,o)=>{Ph(r,o),t(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=>t({signedOutTurns:Object.fromEntries(r.map(o=>[o.turnId,o.sessionId]))}),dropSignedOutTurn:r=>{if(!(r in s().signedOutTurns))return;const o={...s().signedOutTurns};delete o[r],t({signedOutTurns:o})},onBackgroundTasksSnapshot:r=>{for(const[l,c]of Object.entries(r))Ph(l,c);const o={};for(const[l,c]of Object.entries(r))c.length>0&&(o[l]=c);t({backgroundTasks:o})}});function sw(t){switch(t){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 Va(t){const s=[...t.turns,...(t.threads??[]).flatMap(r=>r.turns??[])].filter(Fs);return s.length>0&&s.every(r=>r.status==="pending"&&r.resume_state==="waiting")?"interrupted":"running"}function $h(t){return t.type!=="background_task"&&t.type!=="error"&&t.type!=="interruption"}function Mr(t,s){if(!(s in t))return t;const r={...t};return delete r[s],r}function _u(t){return t&&(t.turns.some(Fs)||(t.threads??[]).some(r=>(r.turns??[]).some(Fs)))?1:0}function lr(t,s,r){return t.some(o=>o.id===s)?t.map(o=>o.id===s?{...o,...r(o)}:o):t}function Hn(t,s,r){const o=(t.threads??[]).map(l=>(l.turns??[]).some(c=>c.id===s)?{...l,turns:(l.turns??[]).map(c=>c.id===s?r(c):c)}:l);return{...t,turns:t.turns.map(l=>l.id===s?r(l):l),threads:o}}function Fg(t,s){for(let r=t.length-1;r>=0;r--)if(t[r].external_item_id===s)return r;return-1}function Eu(t,s){const r=Fg(t.items,s.external_item_id);if(r>=0){const c=[...t.items];return c[r]=s,{...t,items:c}}if(s.type==="agent_message"){const c=t.items.filter(d=>!(d.type==="agent_message"&&d.id.startsWith("delta-")));return{...t,items:[...c,s]}}const o=t.items;let l=o.length;if(t.deferred_item_count)for(;l>0&&o[l-1].created_at>s.created_at;)l--;return{...t,items:[...o.slice(0,l),s,...o.slice(l)]}}function rw(t,s){const r=c=>c.external_item_id??c.id,o=new Map(t.items.map(c=>[r(c),c])),l=s.map(c=>{const d=o.get(r(c));return o.delete(r(c)),d&&d.updated_at>c.updated_at?d:c});return{...t,items:[...l,...o.values()],deferred_item_count:0,deferred_tool_calls:0}}function iw(t,s,r){var c;const o=Fg(t.items,s);if(o>=0){const d=t.items[o],g=(((c=d.data)==null?void 0:c.text)??"")+r,m=[...t.items];return m[o]={...d,data:{...d.data,text:g}},{...t,items:m,agent_response:g}}const l={id:`delta-${s}`,turn_id:t.id,external_item_id:s,type:"agent_message",data:{text:r},status:"in_progress",created_at:new Date().toISOString(),updated_at:new Date().toISOString()};return{...t,items:[...t.items,l],agent_response:r}}function ow(){const t=new URLSearchParams(window.location.search);return{session:t.get("session"),thread:t.get("thread")}}function aw(){const t=new URL(window.location.href);!t.searchParams.has("session")&&!t.searchParams.has("thread")||(t.searchParams.delete("session"),t.searchParams.delete("thread"),window.history.replaceState(window.history.state,"",t))}let Ru=0;function zh(t){return t==="sidecar"?"sidecar":"turns"}async function lw(t,s){const r=await Promise.allSettled(t.map(c=>s(c))),o=new Map;let l=null;return r.forEach((c,d)=>{var p;c.status==="fulfilled"?o.set(t[d],c.value):l===null&&(l=((p=c.reason)==null?void 0:p.message)??"Request failed")}),{updated:o,firstError:l}}function cw(t,s){const r={...t.sessionDetails};s.forEach(g=>delete r[g]);const o={...t.backgroundTasks};s.forEach(g=>delete o[g]);const l=Object.fromEntries(Object.entries(t.signedOutTurns).filter(([,g])=>!s.has(g))),c=t.openTabs.filter(g=>!s.has(g)),d=bd(t,new Set([...s].map($r)));let p=t.activeTurnIndex;if(d.activeSessionId!==t.activeSessionId){const g=d.activeSessionId?r[d.activeSessionId]:null;p=g&&g.turns.length>0?g.turns.length-1:0}return{sessions:t.sessions.filter(g=>!s.has(g.id)),sessionDetails:r,backgroundTasks:o,signedOutTurns:l,openTabs:c,...d,activeTurnIndex:p}}function uw(t){const s={...t};return delete s.turns,delete s.threads,delete s.contextUsage,s}function Fh(t,s,r){const o=s().activeSessionId;t(c=>cw(c,r));const l=s().activeSessionId;l&&l!==o&&s().selectSession(l,{keepAppView:!0})}async function Uh(t,s,r,o,l){if(r.length===0)return;t({error:null});const{updated:c,firstError:d}=await lw(r,o);c.size>0&&t(g=>({sessions:g.sessions.map(m=>c.get(m.id)??m)}));const p=r.length-c.size;if(p===0)s().addToast("info",`${r.length} session${r.length===1?"":"s"} ${l}`);else{t({error:d});const g=l[0].toUpperCase()+l.slice(1);s().addToast(p===r.length?"error":"warn",`${g} ${c.size} of ${r.length} — ${p} failed`)}}const Au=new Map,dw=(t,s)=>({sessions:[],sessionDetails:{},activeSessionId:null,openTabs:[],activeTurnIndex:0,submittingPrompt:null,quotedText:null,init:async()=>{const r=ow(),o=U0();try{const l=localStorage.getItem("agentpane:last-model-config");l&&t({lastModelConfig:JSON.parse(l)})}catch{}t({loading:!0,error:null});try{const l=s().loadApps(),[c,d,p]=await Promise.all([w0(),Rg(),Ig()]);t({sessions:c,workspaces:d,folders:p,loading:!1}),aw();const g=await l,m=H0(o,new Set(c.map(v=>v.id)),g?new Set(s().apps.map(v=>v.id)):null,r.session);t(v=>{const k=v.activeSessionId!==null||v.activeAppTabId!==null;return{openTabs:yo([...m.openTabs,...v.openTabs]),openAppTabs:yo([...m.openAppTabs,...v.openAppTabs]),tabOrder:m.tabOrder,activeAppTabId:k?v.activeAppTabId:m.activeAppTabId}}),m.activeSessionId&&!s().activeSessionId&&await s().selectSession(m.activeSessionId,{keepAppView:!0}),r.thread&&(t({deepLinkThreadId:r.thread}),s().switchRightTab("threads"))}catch(l){t({loading:!1,error:l.message})}},selectSession:async(r,o)=>{const l=++Ru,c=o!=null&&o.keepAppView?{}:{activeAppTabId:null},d=p=>p.includes(r)?p:[...p,r];if(s().sessionDetails[r]){const p=s().sessionDetails[r];t({activeSessionId:r,activeTurnIndex:p.turns.length>0?p.turns.length-1:0,activeRightTab:zh(s().activeRightTab),...c,openTabs:d(s().openTabs)}),p.has_unreviewed===1&&(Ah(r).catch(()=>{}),t(g=>({sessions:g.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...g.sessionDetails,[r]:{...p,has_unreviewed:0}}})));return}t({loading:!0,error:null});try{const p=await co(r);if(l!==Ru){t(g=>({sessionDetails:{...g.sessionDetails,[r]:p},openTabs:d(g.openTabs),loading:!1}));return}t(g=>({sessionDetails:{...g.sessionDetails,[r]:p},activeSessionId:r,activeTurnIndex:p.turns.length>0?p.turns.length-1:0,activeRightTab:zh(g.activeRightTab),...c,openTabs:d(g.openTabs),loading:!1})),p.has_unreviewed===1&&(Ah(r).catch(()=>{}),t(g=>({sessions:g.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...g.sessionDetails,[r]:{...p,has_unreviewed:0}}})))}catch(p){t(l===Ru?{loading:!1,error:p.message}:{loading:!1})}},closeTab:r=>s().closeTabs([$r(r)]),updateModelConfig:async(r,o,l)=>{const c=s().activeSessionId;if(c){t({error:null});try{const d=await C0(c,r,o,l),p={provider:d.runtime_type,model:d.model??"",reasoning:d.model_reasoning_effort??""};t({lastModelConfig:p}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(p)),t(g=>({sessions:g.sessions.map(m=>m.id===c?d:m),sessionDetails:g.sessionDetails[c]?{...g.sessionDetails,[c]:{...g.sessionDetails[c],model:d.model,model_reasoning_effort:d.model_reasoning_effort,external_thread_id:d.external_thread_id}}:g.sessionDetails})),await s().refreshActiveSession()}catch(d){t({error:d.message}),s().addToast("error",`Failed to update model — ${d.message}`)}}},createSession:async r=>{t({error:null});try{const o=await kd(r);t(c=>({sessions:[o,...c.sessions],showNewSessionDialog:!1}));const l={provider:o.runtime_type,model:o.model??"",reasoning:o.model_reasoning_effort??""};t({lastModelConfig:l}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(l)),await s().selectSession(o.id),s().addLogEntry("INFO",`Session created — ${o.id.slice(0,8)}`),s().addToast("success",`Session created — ${o.title||o.id.slice(0,8)}`)}catch(o){t({error:o.message}),s().addToast("error",`Failed to create session — ${o.message}`)}},addSession:r=>{t(o=>({sessions:o.sessions.some(l=>l.id===r.id)?o.sessions:[r,...o.sessions]}))},revealSession:async r=>{let o=s().sessionDetails[r];if(!o){const l=await co(r);t(c=>({sessionDetails:{...c.sessionDetails,[r]:l}})),o=l}s().sessions.some(l=>l.id===r)||s().addSession(uw(o)),await s().selectSession(r)},deleteSession:async r=>{var l;t({error:null});const o=(l=s().sessions.find(c=>c.id===r))==null?void 0:l.title;try{await _h(r),Fh(t,s,new Set([r])),s().addLogEntry("INFO",`Session deleted — ${r.slice(0,8)}`),s().addToast("info",`Session "${o||r.slice(0,8)}" deleted`)}catch(c){t({error:c.message}),s().addToast("error",`Failed to delete session — ${c.message}`)}},renameSession:async(r,o)=>{t({error:null});try{const l=await N0(r,o.trim());t(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){t({error:l.message}),s().addToast("error",`Failed to rename session — ${l.message}`)}},markFinished:async r=>{t({error:null});try{const o=await Eh(r);t(l=>({sessions:l.sessions.map(c=>c.id===r?o:c)})),s().addToast("info","Session marked as finished")}catch(o){t({error:o.message}),s().addToast("error",`Failed to mark as finished — ${o.message}`)}},markFinishedMany:async r=>{await Uh(t,s,r,Eh,"marked as finished")},toggleStar:async r=>{const o=s().sessions.find(l=>l.id===r);if(o){t({error:null});try{const l=await j0(r,o.starred?0:1);t(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){t({error:l.message}),s().addToast("error",`Failed to star session — ${l.message}`)}}},reopenSession:async r=>{t({error:null});try{const o=await Rh(r);t(l=>({sessions:l.sessions.map(c=>c.id===r?o:c)})),s().addToast("info","Session reopened")}catch(o){t({error:o.message}),s().addToast("error",`Failed to reopen session — ${o.message}`)}},reopenSessionMany:async r=>{await Uh(t,s,r,Rh,"reopened")},deleteSessionMany:async r=>{if(r.length===0)return;t({error:null});const o=await Promise.allSettled(r.map(d=>_h(d))),l=new Set;if(o.forEach((d,p)=>{d.status==="fulfilled"&&l.add(r[p])}),l.size===0){t({error:"Failed to delete sessions"}),s().addToast("error","Failed to delete sessions");return}Fh(t,s,l),s().addLogEntry("INFO",`${l.size} session${l.size===1?"":"s"} deleted`);const c=r.length-l.size;c===0?s().addToast("info",`${l.size} session${l.size===1?"":"s"} deleted`):(t({error:"One or more sessions failed to delete"}),s().addToast("warn",`Deleted ${l.size} of ${r.length} — ${c} failed`))},submitPrompt:async(r,o)=>{const l=s().activeSessionId;if(l){t({error:null,submittingPrompt:r}),t(c=>{const d=c.sessionDetails[l];return d?{sessionDetails:{...c.sessionDetails,[l]:{...d,is_running:1,status:"running"}},sessions:c.sessions.map(p=>p.id===l?{...p,is_running:1,status:"running"}:p)}:{}});try{const c=await Eg(l,r,o);s().addLogEntry("INFO",`Turn submitted — "${r.slice(0,40)}"`),t(d=>{const p=d.sessionDetails[l];if(!p)return{submittingPrompt:null};const g=p.turns.findIndex(v=>v.id===c.id);if(g>=0)return{submittingPrompt:null,activeTurnIndex:g};const m={...c,items:[]};return{submittingPrompt:null,sessionDetails:{...d.sessionDetails,[l]:{...p,turns:[...p.turns,m]}},activeTurnIndex:p.turns.length}})}catch(c){t({submittingPrompt:null,error:c.message}),s().addLogEntry("ERROR",`Turn failed — ${c.message}`),s().addToast("error",`Failed to send prompt — ${c.message}`),t(d=>{const p=d.sessionDetails[l];if(!p)return{};const g=Ml(p)?1:0;return{sessionDetails:{...d.sessionDetails,[l]:{...p,is_running:g,status:g?"running":"active"}},sessions:d.sessions.map(m=>m.id===l?{...m,is_running:g,status:g?"running":"active"}:m)}})}}},cancelTurn:async()=>{const r=s().activeSessionId;if(r)try{await S0(r)}catch(o){t({error:o.message})}},rewindToTurn:async(r,o)=>{t({error:null});try{const l=await E0(r,o),c=await co(r);t(d=>({sessionDetails:{...d.sessionDetails,[r]:c},sessions:d.sessions.map(p=>p.id===r?{...p,external_thread_id:l.external_thread_id,is_running:0,status:"active"}:p),activeTurnIndex:c.turns.length>0?c.turns.length-1:0})),s().addToast("info","Rewound to selected turn")}catch(l){t({error:l.message}),s().addToast("error",`Failed to rewind — ${l.message}`)}},restoreSession:async r=>{t({error:null});try{const o=await R0(r),l=await co(r);t(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})),s().addToast("info","Restored rewound session")}catch(o){t({error:o.message}),s().addToast("error",`Failed to restore — ${o.message}`)}},branchFromTurn:async(r,o,l)=>{t({error:null});try{const c=await A0(r,o,l);t(d=>({sessions:[c,...d.sessions]})),await s().selectSession(c.id),s().addToast("success","Branched from selected turn")}catch(c){t({error:c.message}),s().addToast("error",`Failed to branch — ${c.message}`)}},updateRuntimeConfig:async r=>{const o=s().activeSessionId;if(o){t({error:null});try{const l=await _0(o,JSON.stringify(r));t(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){t({error:l.message}),s().addToast("error",`Failed to update config — ${l.message}`)}}},refreshActiveSession:async()=>{const r=s().activeSessionId;if(r)try{const o=await co(r);t(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){t({error:o.message})}},loadDeferredItems:(r,o)=>{const l=Au.get(o);if(l)return l;const c=k0(r,o).then(({items:d})=>(t(p=>{const g=p.sessionDetails[r];return g?{sessionDetails:{...p.sessionDetails,[r]:Hn(g,o,m=>rw(m,d))}}:{}}),!0)).catch(d=>(s().addToast("error",`Failed to load tool calls — ${d.message}`),!1)).finally(()=>Au.delete(o));return Au.set(o,c),c}});async function Ug(t){const{sessions:s}=await Mt(`/claude-sessions?workspace=${encodeURIComponent(t)}`);return s}function fw(t,s){return ot(`/claude-sessions/${encodeURIComponent(t)}/import`,{workspace:s})}const Bh={available:!0,reason:null};let Iu=null;const pw=(t,s)=>({workspaces:[],pickerSupport:null,loadPickerSupport:()=>{const r=s().pickerSupport;return r?Promise.resolve(r):(Iu??(Iu=M0().then(o=>typeof(o==null?void 0:o.available)!="boolean"?Bh:(t({pickerSupport:o}),o)).catch(()=>Bh).finally(()=>{Iu=null})),Iu)},createWorkspaceAt:async r=>{const o=await I0(r.trim());return t(l=>({workspaces:[...l.workspaces.filter(c=>c.id!==o.id),o]})),o},addWorkspace:async r=>{t({error:null});try{const o=await s().createWorkspaceAt(r);return s().addToast("success",`Workspace added — ${o.path}`),o}catch(o){return s().addToast("error",`Failed to add workspace — ${Pr(o)}`),null}},removeWorkspace:async r=>{t({error:null});try{await D0(r);const o=await Rg();t({workspaces:o}),s().addToast("info","Workspace hidden")}catch(o){s().addToast("error",`Failed to hide workspace — ${o.message}`)}},createSessionInWorkspace:async r=>{t({error:null});try{const o=s().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});t(c=>({sessions:[l,...c.sessions]})),await s().selectSession(l.id),s().addLogEntry("INFO",`Session created in ${r} — ${l.id.slice(0,8)}`),s().addToast("success",`Session created in ${r.split("/").pop()||r}`)}catch(o){t({error:o.message}),s().addToast("error",`Failed to create session — ${o.message}`)}},pickAndAddWorkspace:async()=>{if(!(await s().loadPickerSupport()).available){s().setShowAddWorkspaceDialog(!0);return}try{const o=await Ag();if(o.cancelled||!o.path)return;await s().addWorkspace(o.path)}catch(o){s().addToast("error",`Failed to pick directory — ${o.message}`)}},importClaudeSessions:async(r,o)=>{const l=[],c=[];for(const d of[...o].reverse())try{l.unshift(await fw(d,r))}catch(p){c.unshift({id:d,error:Pr(p)})}return l.length>0&&(t(d=>({sessions:[...l,...d.sessions]})),await s().selectSession(l[0].id),s().addLogEntry("INFO",`Imported ${l.length} Claude Code session(s) into ${r}`),s().addToast("success",l.length===1?`Imported — ${l[0].title||"Claude Code session"}`:`Imported ${l.length} Claude Code sessions`)),{imported:l,failed:c}}});function Bg(t,s){const r=s?`?cwd=${encodeURIComponent(s)}`:"";return Mt(`/providers/${encodeURIComponent(t)}/models${r}`)}const Wh="curl -fsSL https://repoburg.com/install.sh | bash",hw=2e3,Wg="agentpane:daemon-seen";function mw(t=mn()){if(!t)return!1;try{const s=new URL(t);return s.protocol==="http:"&&(s.hostname==="localhost"||s.hostname==="127.0.0.1")}catch{return!1}}async function gw(t=mn()){try{return await fetch(`${t}/health`,{mode:"no-cors",cache:"no-store"}),!0}catch{return!1}}function vw(){try{return localStorage.getItem(Wg)==="true"}catch{return!1}}function yw(){try{localStorage.setItem(Wg,"true")}catch{}}function xw(t){let s=!1,r=!1,o=!1,l=null;function c(){l!==null&&(clearTimeout(l),l=null)}async function d(){if(s||r)return;c(),r=!0;const m=await gw();if(r=!1,!s){if(m){yw(),g(),t.onReady();return}o||(o=!0,t.onMissing()),l=setTimeout(()=>void d(),hw)}}function p(){document.visibilityState==="visible"&&d()}function g(){s=!0,c(),window.removeEventListener("focus",p),document.removeEventListener("visibilitychange",p)}return window.addEventListener("focus",p),document.addEventListener("visibilitychange",p),d(),g}const Qu=160,Zu=480,ww=240,dl=220,kw=300,Sw=600,bw=36;function fl(){return typeof window>"u"?Sw:Math.max(dl,Math.round(window.innerWidth*.7))}const Hh="agentpane:sidebar-width",Vh="agentpane:right-panel-width",Du="agentpane:right-panel-collapsed";function Gh(t,s,r,o){try{const l=localStorage.getItem(t);if(l==null)return o;const c=Number(l);return Number.isFinite(c)?Math.min(r,Math.max(s,c)):o}catch{return o}}function Tw(t){try{return localStorage.getItem(t)==="true"}catch{return!1}}function Kh(t,s){try{localStorage.setItem(t,String(s))}catch{}}const qh=200,Nw=(t,s)=>({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:Gh(Hh,Qu,Zu,ww),rightPanelWidth:Gh(Vh,dl,fl(),kw),rightPanelCollapsed:Tw(Du),deepLinkThreadId:null,vscodeViewOpen:!1,vscodeState:"stopped",vscodeId:null,vscodeToken:null,usageViewOpen:!1,terminalViewOpen:!1,canGoBack:!1,canGoForward:!1,daemonStatus:mw()?"checking":"ready",setActiveTurnIndex:r=>t({activeTurnIndex:r}),switchRightTab:r=>{s().rightPanelCollapsed&&Kh(Du,!1),t({activeRightTab:r,rightPanelCollapsed:!1})},setShowNewSessionDialog:r=>t({showNewSessionDialog:r}),setShowAddWorkspaceDialog:r=>t({showAddWorkspaceDialog:r}),setImportSessionsWorkspace:r=>t({importSessionsWorkspace:r}),setShowRemoteModal:r=>t({showRemoteModal:r}),setShowCommandPalette:r=>t({showCommandPalette:r}),setShowModelSelector:r=>t({showModelSelector:r}),setDeepLinkThreadId:r=>t({deepLinkThreadId:r}),setSidebarWidth:r=>{const o=Math.min(Zu,Math.max(Qu,Math.round(r)));t({sidebarWidth:o});try{localStorage.setItem(Hh,String(o))}catch{}},setRightPanelWidth:r=>{const o=Math.min(fl(),Math.max(dl,Math.round(r)));t({rightPanelWidth:o});try{localStorage.setItem(Vh,String(o))}catch{}},setRightPanelCollapsed:r=>{t({rightPanelCollapsed:r}),Kh(Du,r)},toggleRightPanel:()=>s().setRightPanelCollapsed(!s().rightPanelCollapsed),toggleVscodeView:()=>{if(s().vscodeViewOpen){t({vscodeViewOpen:!1});return}t({vscodeViewOpen:!0,terminalViewOpen:!1,vscodeState:"starting",vscodeId:null,vscodeToken:null})},setVscodeView:(r,o,l)=>t({vscodeState:r,vscodeId:o,vscodeToken:l}),toggleUsageView:()=>t({usageViewOpen:!s().usageViewOpen,terminalViewOpen:!1}),toggleTerminalView:()=>t(s().terminalViewOpen?{terminalViewOpen:!1}:{terminalViewOpen:!0,vscodeViewOpen:!1,usageViewOpen:!1}),setDaemonStatus:r=>t({daemonStatus:r}),addToast:(r,o,l,c)=>{const d=Math.random().toString(36).slice(2,9);t(p=>({toasts:[...p.toasts,{id:d,type:r,message:o,undoAction:l,undoLabel:c}]}))},removeToast:r=>{t(o=>({toasts:o.toasts.filter(l=>l.id!==r)}))},addLogEntry:(r,o)=>{const l=new Date().toLocaleTimeString("en-GB",{hour12:!1});t(c=>{const d=[...c.eventLog,{time:l,level:r,message:o}];return d.length>qh&&d.splice(0,d.length-qh),{eventLog:d}})},loadModels:async(r,o)=>{if(!s().modelsLoading){t({modelsLoading:!0,models:[]});try{const l=await Bg(r,o);t({models:l,modelsLoading:!1})}catch{t({modelsLoading:!1})}}}}),jw=(t,s)=>({createThread:async(r,o)=>{try{await ot(`/sessions/${r}/threads`,o),s().addLogEntry("INFO",`Thread created — "${o.message.slice(0,40)}"`)}catch(l){s().addToast("error",`Failed to create thread — ${l.message}`)}},followupThread:async(r,o,l)=>{try{await ot(`/sessions/${r}/threads/${o}/followup`,{message:l}),s().addLogEntry("INFO",`Thread follow-up — "${l.slice(0,40)}"`)}catch(c){s().addToast("error",`Failed to send follow-up — ${c.message}`)}},cancelThreadTurn:async(r,o)=>{try{await ot(`/sessions/${r}/cancel?threadId=${encodeURIComponent(o)}`),s().addLogEntry("INFO","Thread turn cancelled")}catch(l){s().addToast("error",`Failed to cancel thread turn — ${l.message}`)}},resolveThread:async(r,o)=>{try{await ds(`/sessions/${r}/threads/${o}`,{status:"resolved"})}catch(l){s().addToast("error",`Failed to resolve thread — ${l.message}`)}},reopenThread:async(r,o)=>{try{await ds(`/sessions/${r}/threads/${o}`,{status:"open"})}catch(l){s().addToast("error",`Failed to reopen thread — ${l.message}`)}},shareThread:async(r,o,l)=>{try{const c=await ot(`/sessions/${r}/threads/${o}/summarize`,{directives:l}),d=`
43
- [Shared from a resolved discussion thread — summary of its findings]
44
-
45
- \`\`\`QUOTE
46
- ${c.summary}
47
- \`\`\`
48
-
49
- `;return t({quotedText:d}),s().addLogEntry("INFO",`Thread shared to main session — "${c.summary.slice(0,40)}"`),s().addToast("success","Thread summary added to your input"),!0}catch(c){return s().addToast("error",`Failed to share thread — ${c.message}`),!1}},deleteThread:async(r,o)=>{try{await Dl(`/sessions/${r}/threads/${o}`)}catch(l){s().addToast("error",`Failed to delete thread — ${l.message}`)}},askSidecar:async(r,o)=>{try{return await ot(`/sessions/${r}/sidecar`,{message:o}),s().addLogEntry("INFO",`Sidecar asked — "${o.slice(0,40)}"`),!0}catch(l){return s().addToast("error",`Failed to ask the sidecar — ${l.message}`),!1}},onThreadCreated:(r,o,l)=>{t(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:[...d.threads??[],{...o,turns:[{...l,items:[]}]}]}}}:{}})},onThreadFollowup:(r,o,l)=>{t(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:(d.threads??[]).map(p=>p.id===o?{...p,turns:[...p.turns??[],{...l,items:[]}]}:p)}}}:{}})},onThreadResolved:(r,o,l)=>{t(c=>{const d=c.sessionDetails[r];if(!d)return{};const p=(d.threads??[]).map(g=>g.id===o?{...g,status:l,resolved_at:l==="resolved"?new Date().toISOString():null}:g);return{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:p}}}})},onThreadDeleted:(r,o)=>{t(l=>{const c=l.sessionDetails[r];return c?{sessionDetails:{...l.sessionDetails,[r]:{...c,threads:(c.threads??[]).filter(d=>d.id!==o)}}}:{}})}}),Cw=(t,s)=>({folders:[],loadFolders:async()=>{const r=await Ig();t({folders:r})},createSidebarFolder:async(r,o)=>{try{const l=await L0(r,o);return t(c=>({folders:[...c.folders,l]})),l}catch(l){return s().addToast("error",`Failed to create folder — ${l.message}`),null}},renameFolder:async(r,o)=>{try{const l=await Dh(r,{name:o});t(c=>({folders:c.folders.map(d=>d.id===r?l:d)}))}catch(l){s().addToast("error",`Failed to rename folder — ${l.message}`)}},deleteFolder:async r=>{const o=s().folders,l=s().sessions;t(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 O0(r)}catch(c){t({folders:o,sessions:l}),s().addToast("error",`Failed to delete folder — ${c.message}`)}},applyMoves:async r=>{if(r.length===0)return;const o=s().sessions,l=new Map(r.map(c=>[c.id,c]));t(c=>({sessions:c.sessions.map(d=>{const p=l.get(d.id);return p?{...d,folder_id:p.folder_id,sort_order:p.sort_order}:d})}));try{await P0(r)}catch(c){t({sessions:o}),s().addToast("error",`Failed to save session order — ${c.message}`)}},reorderFolders:async r=>{const o=s().folders,l=new Map(r.map((c,d)=>[c,d]));t(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)=>Dh(c,{sort_order:d})))}catch(c){t({folders:o}),s().addToast("error",`Failed to save folder order — ${c.message}`)}}});function Yh(){return Mt("/apps")}function _w(){return Mt("/apps/root")}function Xh(t){return Mt(`/apps/${t}/source`)}function Qh(t,s=""){return Mt(`/apps/${t}/state?workspace=${encodeURIComponent(s)}`)}function Hg(t,s,r=""){return x0(`/apps/${t}/state?workspace=${encodeURIComponent(r)}`,s)}function Ew(t){return Dl(`/apps/${t}`)}function Rw(t){return Mt(`/apps/${t}/sessions`)}async function Aw(t,s){try{return await Mt(`/apps/${t}/sessions/${encodeURIComponent(s)}`)}catch(r){if(r instanceof Il&&r.status===404)return null;throw r}}function Iw(t,s){return ot(`/apps/${t}/sessions/${encodeURIComponent(s)}/cancel`)}function Dw(t,s,r){return ds(`/apps/${t}/sessions/${encodeURIComponent(s)}`,{lifecycle:r})}async function Mw(t,s,r,o){const l=await ot("/apps/mcp/call",{tool:`${t}__${r}`,args:o,workspace:s});if(!l.ok)throw new Error(l.error||`callTool: ${r} failed`);return l.result}function Lw(){return Mt("/apps/examples")}function Ow(t){return ot(`/apps/examples/${t}/install`,{})}function Pw(t){return ot("/apps",t)}function $w(t,s){return ot("/apps/import",{id:t,files:s})}function zw(t,s,r){return ot(`/apps/mcp/calls/${t}/result`,{result:s,error:null})}function Fw(t,s){return ot(`/apps/${t}/edit-session`,s)}function Uw(t,s){return ot(`/apps/${t}/files`,s)}async function Bw(t,s){const r=await fetch(`${mn()}/api/apps/${t}/files/${encodeURIComponent(s)}/meta`);if(r.status===404)return null;if(!r.ok)throw new Error(`GET /apps/${t}/files/${s}/meta failed: ${r.status} ${r.statusText}`);return await r.json()}async function Ww(t,s){const r=await fetch(`${mn()}/api/apps/${t}/files/${encodeURIComponent(s)}`);if(!r.ok)throw new Error(`GET /apps/${t}/files/${s} failed: ${r.status} ${r.statusText}`);return r.blob()}const rl=new Set;async function Mu(t,s){rl.add(s),await t().loadApps();const r=t().apps.find(o=>o.id===s);t().openAppTab(s),t().addToast("success",`Mini app added: ${(r==null?void 0:r.title)??s}`)}const Ju="agentpane:app-workspaces";function Hw(){try{const t=JSON.parse(localStorage.getItem(Ju)??"{}");return t&&typeof t=="object"?t:{}}catch{return{}}}const Vw=(t,s)=>({apps:[],appsRootPath:null,openAppTabs:[],activeAppTabId:null,appCatalogOpen:!1,appWorkspaces:Hw(),loadApps:async()=>{try{const[r,o]=await Promise.all([Yh(),_w().catch(()=>null)]);return r.forEach(l=>rl.add(l.id)),t(o?{apps:r,appsRootPath:o.root}:{apps:r}),!0}catch{return!1}},refreshApps:async()=>{try{const r=await Yh();for(const o of r)rl.has(o.id)||(rl.add(o.id),s().addToast("success",`New mini app discovered: ${o.title}`));t({apps:r})}catch{}},openAppTab:r=>{t(o=>({activeAppTabId:r,openAppTabs:o.openAppTabs.includes(r)?o.openAppTabs:[...o.openAppTabs,r]}))},closeAppTab:r=>s().closeTabs([To(r)]),setActiveAppTab:r=>t({activeAppTabId:r}),openAppCatalog:()=>t({appCatalogOpen:!0}),closeAppCatalog:()=>t({appCatalogOpen:!1}),setAppWorkspace:(r,o)=>{t(l=>{const c={...l.appWorkspaces,[r]:o};try{localStorage.setItem(Ju,JSON.stringify(c))}catch{}return{appWorkspaces:c}})},installExampleApp:async r=>{try{return await Ow(r),await Mu(s,r),!0}catch(o){return s().addToast("error",`Failed to install app — ${o.message}`),!1}},createSkeletonApp:async r=>{try{return await Pw(r),await Mu(s,r.id),!0}catch(o){return s().addToast("error",`Failed to create app — ${o.message}`),!1}},importAppFolder:async(r,o)=>{try{return await $w(r,o),await Mu(s,r),!0}catch(l){return s().addToast("error",`Failed to import app — ${l.message}`),!1}},startAppEdit:async r=>{try{const o=s().lastModelConfig,l=await Fw(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});s().sessions.some(c=>c.id===l.id)||t(c=>({sessions:[l,...c.sessions]})),await s().selectSession(l.id),s().addLogEntry("INFO",`App edit session opened for ${r}`)}catch(o){s().addToast("error",`Failed to open app edit session — ${o.message}`)}},toggleAppPin:async r=>{const o=s().apps.find(l=>l.id===r);if(o)try{await Hg(r,{pinned:!o.pinned}),await s().loadApps()}catch(l){s().addToast("error",`Failed to pin app — ${l.message}`)}},deleteApp:async r=>{try{await Ew(r);const o=s().activeSessionId;t(c=>{const d={...c.appWorkspaces};delete d[r];try{localStorage.setItem(Ju,JSON.stringify(d))}catch{}return{apps:c.apps.filter(p=>p.id!==r),openAppTabs:c.openAppTabs.filter(p=>p!==r),...bd(c,new Set([To(r)])),appWorkspaces:d}});const l=s().activeSessionId;l&&l!==o&&s().selectSession(l,{keepAppView:!0}),s().addToast("success",`Mini app deleted: ${r}`)}catch(o){s().addToast("error",`Failed to delete app — ${o.message}`)}}}),Gw=(t,s)=>({tabOrder:[],closedTabs:[],moveTab:(r,o)=>{const l=[...s().tabOrder],c=l.indexOf(r),d=l.indexOf(o);c===-1||d===-1||c===d||(l.splice(d,0,...l.splice(c,1)),t({tabOrder:l}))},closeTabs:r=>{const o=s(),l=new Set(r.filter(g=>o.tabOrder.includes(g)));if(l.size===0)return;const c=bd(o,l),d=o.tabOrder.map((g,m)=>({key:g,index:m})).filter(g=>l.has(g.key)).reverse();t({...c,openTabs:o.openTabs.filter(g=>!l.has($r(g))),openAppTabs:o.openAppTabs.filter(g=>!l.has(To(g))),tabOrder:o.tabOrder.filter(g=>!l.has(g)),closedTabs:[...o.closedTabs,...d].slice(-20)});const p=c.activeSessionId;p!==null&&p!==o.activeSessionId&&s().selectSession(p,{keepAppView:!0})},reopenClosedTab:()=>{const r=s(),o=[...r.closedTabs];let l=o.pop();for(;l&&!Lg(r,l.key);)l=o.pop();if(!l){t({closedTabs:[]});return}const c=[...r.tabOrder];c.splice(l.index,0,l.key);const{kind:d,id:p}=pr(l.key);d==="app"?(t({closedTabs:o,tabOrder:c,openAppTabs:[...r.openAppTabs,p]}),s().openAppTab(p)):(t({closedTabs:o,tabOrder:c,openTabs:[...r.openTabs,p]}),s().selectSession(p))}}),Zh=3e3,Vn={lagMs:100,longtaskBufferMs:50,longtaskLogMs:100,eventBufferMs:50,eventLogMs:100,keypressMs:100,wsPerSecLog:15,storePerSecLog:15,renderPerSecLog:6,frameGapMs:150},Gn=[];let pl=0,jd=0,hl=0,Cd=0,ml=0,_d=0,Ed=0;const No=new Map,jo=new Map;let wi=new Map,yi=0,ki=new Map,Lu=!1;function gl(t,s,r){if(Gn.push({t:Date.now(),cat:t,msg:s,ms:r}),Gn.length>Zh){const o=Gn.length-Zh;Gn.splice(0,o),In=Math.max(0,In-o)}}function xi(t,s,r){gl(t,s,r),console.log(`[perf:${t}] ${s}`)}function Vg(t){xi("note",t)}function Gg(t){return t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}function Kw(t,s){let r=wi.get(t);r||wi.set(t,r={n:0,bytes:0}),r.n++,r.bytes+=s;let o=No.get(t);o||No.set(t,o={n:0,bytes:0}),o.n++,o.bytes+=s}function qw(){yi++,Ed++}function Yw(t){ki.set(t,(ki.get(t)??0)+1),jo.set(t,(jo.get(t)??0)+1)}let il=0;function Xw(){il=performance.now()}function Qw(){const t=performance.now(),s=il?t-il:null;il=0,requestAnimationFrame(()=>{if(s===null)return;const r=performance.now()-t+s;r>Vn.keypressMs&&xi("input",`keystroke→paint ${Math.round(r)}ms (keydown→change ${Math.round(s)}ms, change→paint ${Math.round(performance.now()-t)}ms)`)})}const Zw=5e3,Kg=500,Jh=2e3;let In=0,Ou=!1;function Jw(t){return ot("/perf-log",{entries:t}).then(()=>{In+=t.length})}function e1(){if(Ou||In>=Gn.length)return;const t=Gn.slice(In,In+Kg);t.length!==0&&(Ou=!0,Jw(t).catch(()=>{Gn.length-In>Jh&&(In=Math.max(In,Gn.length-Jh))}).finally(()=>{Ou=!1}))}function em(){if(typeof navigator>"u"||typeof navigator.sendBeacon!="function"||In>=Gn.length)return;const t=Gn.slice(In,In+Kg);if(t.length!==0)try{const s=new Blob([JSON.stringify({entries:t})],{type:"application/json"});navigator.sendBeacon(`${mn()}/api/perf-log`,s),In+=t.length}catch{}}function t1(){let t=0;for(const o of wi.values())t+=o.n;const s=[];if(t>0){const o=[...wi.entries()].sort((l,c)=>c[1].n-l[1].n).map(([l,c])=>`${l}×${c.n}(${Gg(c.bytes)})`).join(", ");s.push(`ws ${t}/s [${o}]`)}yi>0&&s.push(`store ${yi}/s`);const r=[...ki.entries()].sort((o,l)=>l[1]-o[1]).map(([o,l])=>`${o}×${l}`);if(r.length>0&&s.push(`renders ${r.join(" ")}`),s.length>0){const o=s.join(" · ");gl("stat",o);const l=[...ki.values()].some(c=>c>Vn.renderPerSecLog);(t>Vn.wsPerSecLog||yi>Vn.storePerSecLog||l)&&console.log(`[perf:stat] ${o}`)}wi=new Map,yi=0,ki=new Map}function n1(t){if(t instanceof Element){const s=t.id?`#${t.id}`:"",r=typeof t.className=="string"&&t.className?`.${t.className.trim().split(/\s+/)[0]}`:"";return`${t.tagName.toLowerCase()}${s}${r}`}return t?"window":"unknown"}function s1(){if(Lu||typeof window>"u")return()=>{};Lu=!0,pl=Date.now();const t=[];let s=performance.now()+250;const r=window.setInterval(()=>{const c=performance.now(),d=c-s;s=c+250,d>Vn.lagMs&&(jd++,hl=Math.max(hl,d),xi("lag",`event loop blocked ${Math.round(d)}ms`))},250);if(t.push(()=>window.clearInterval(r)),typeof window.requestAnimationFrame=="function"){let c=performance.now(),d=0;const p=g=>{const m=g-c;c=g,m>Vn.frameGapMs&&xi("lag",`frame gap ${Math.round(m)}ms`),d=window.requestAnimationFrame(p)};d=window.requestAnimationFrame(p),t.push(()=>window.cancelAnimationFrame(d))}if(typeof PerformanceObserver<"u"){try{const c=new PerformanceObserver(d=>{var p;for(const g of d.getEntries()){const m=g.duration;if(m<Vn.longtaskBufferMs)continue;Cd++,ml=Math.max(ml,m);const v=(p=g.attribution)==null?void 0:p[0],k=(v==null?void 0:v.containerName)||(v==null?void 0:v.name)||"unknown",y=`long task ${Math.round(m)}ms (${k})`;m>=Vn.longtaskLogMs?xi("longtask",y,m):gl("longtask",y,m)}});c.observe({type:"longtask",buffered:!1}),t.push(()=>c.disconnect())}catch{}try{const c=new PerformanceObserver(d=>{for(const p of d.getEntries()){const g=p.duration,m=p.processingStart-p.startTime;_d++;const v=`${p.name} ${Math.round(g)}ms (input delay ${Math.round(m)}ms) on ${n1(p.target)}`;g>=Vn.eventLogMs?xi("input",v,g):gl("input",v,g)}});c.observe({type:"event",durationThreshold:Vn.eventBufferMs}),t.push(()=>c.disconnect())}catch{}}const o=window.setInterval(t1,1e3);t.push(()=>window.clearInterval(o)),Vg("perf logger session started");const l=window.setInterval(e1,Zw);return t.push(()=>window.clearInterval(l)),window.addEventListener("beforeunload",em),t.push(()=>window.removeEventListener("beforeunload",em)),window.__agentPanePerf={dump:qg,reset:Yg},()=>{t.forEach(c=>c()),Lu=!1}}function qg(){const t=[],s=pl?Math.round((Date.now()-pl)/1e3):0;if(t.push("=== agent-pane perf report ==="),t.push(`uptime ${s}s · ${Gn.length} buffered entries`),t.push(`event-loop lag: ${jd} blocks >${Vn.lagMs}ms (max ${Math.round(hl)}ms)`),t.push(`long tasks: ${Cd} ≥${Vn.longtaskBufferMs}ms (max ${Math.round(ml)}ms)`),t.push(`slow input events (≥${Vn.eventBufferMs}ms): ${_d}`),t.push(`store updates: ${Ed} total`),No.size>0){t.push("ws messages by type (top 15):");for(const[r,o]of[...No.entries()].sort((l,c)=>c[1].n-l[1].n).slice(0,15))t.push(` ${r}: ${o.n} msgs, ${Gg(o.bytes)}`)}if(jo.size>0){t.push("render counts by component:");for(const[r,o]of[...jo.entries()].sort((l,c)=>c[1]-l[1]))t.push(` ${r}: ${o}`)}t.push("--- last 200 entries ---");for(const r of Gn.slice(-200))t.push(`${new Date(r.t).toISOString().slice(11,23)} [${r.cat}] ${r.msg}`);return t.join(`
50
- `)}function Yg(){Gn.length=0,In=0,pl=Date.now(),jd=0,hl=0,Cd=0,ml=0,_d=0,Ed=0,No.clear(),jo.clear(),wi=new Map,yi=0,ki=new Map}const Dt={start:s1,note:Vg,trackWsEvent:Kw,trackStoreUpdate:qw,trackRender:Yw,markKeystroke:Xw,markInputChange:Qw,dump:qg,reset:Yg},I=c0()((...t)=>({...dw(...t),...pw(...t),...nw(...t),...Nw(...t),...jw(...t),...Cw(...t),...Vw(...t),...Gw(...t)}));typeof window<"u"&&(I.subscribe(()=>Dt.trackStoreUpdate()),z0(I),W0(I));const r1="modulepreload",i1=function(t){return"/"+t},tm={},o1=function(s,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 p=document.querySelector("meta[property=csp-nonce]"),g=(p==null?void 0:p.nonce)||(p==null?void 0:p.getAttribute("nonce"));l=d(r.map(m=>{if(m=i1(m),m in tm)return;tm[m]=!0;const v=m.endsWith(".css"),k=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${k}`))return;const y=document.createElement("link");if(y.rel=v?"stylesheet":r1,v||(y.as="script"),y.crossOrigin="",y.href=m,g&&y.setAttribute("nonce",g),document.head.appendChild(y),v)return new Promise((S,T)=>{y.addEventListener("load",S),y.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(d){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=d,window.dispatchEvent(p),!p.defaultPrevented)throw d}return l.then(d=>{for(const p of d||[])p.status==="rejected"&&c(p.reason);return s().catch(c)})};function ed(t){switch(t){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 a1(t,s,r=!1,o="working",l=0){if(o==="finished")return"";if(t==="interrupted")return"interrupted";if(s)return"running";if(l>0)return"background";if(r&&t!=="failed")return"queued";switch(t){case"failed":return"error";case"aborted":return"paused";default:return"paused"}}function l1(t,s,r=!1,o="working",l=0){if(o==="finished")return"Finished";if(t==="interrupted")return"Interrupted";if(s)return"Running";if(l>0)return"Background";if(r&&t!=="failed")return"Review Pending";switch(t){case"failed":return"Failed";case"aborted":return"Aborted";case"active":return"Idle";case"completed":return"Completed";case"running":return"Running";default:return t}}function Pl(t,s=0){const r=t.is_running===1,o=t.lifecycle==="finished",l=ed(t.runtime_type),c=a1(t.status,r,t.has_unreviewed===1,t.lifecycle,s),d=l1(t.status,r,t.has_unreviewed===1,t.lifecycle,s);return{dot:c,label:d,dotTitle:c==="background"?`${s} background task${s===1?"":"s"} running`:d,iconClass:l.iconClass,iconText:l.iconText,isRunning:r,isFinished:o,backgroundTaskCount:s}}function Mo(t,s,r=!0){x.useEffect(()=>{if(!r)return;function o(l){t.current&&!t.current.contains(l.target)&&s()}return document.addEventListener("mousedown",o),document.addEventListener("touchstart",o),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("touchstart",o)}},[t,s,r])}function Ni(t,s=!0){x.useEffect(()=>{if(!s)return;function r(o){o.key==="Escape"&&t()}return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t,s])}function Rd({status:t,size:s=6,title:r}){return a.jsx("span",{className:`status-dot ${t}`,style:s!==6?{width:s,height:s}:void 0,title:r})}function Ad({iconClass:t,iconText:s,size:r=20}){return a.jsx("span",{className:`runtime-icon ${t}`,style:r!==20?{width:r,height:r,fontSize:r*.45}:void 0,children:s})}/**
51
- * @license lucide-react v0.469.0 - ISC
52
- *
53
- * This source code is licensed under the ISC license.
54
- * See the LICENSE file in the root directory of this source tree.
55
- */const c1=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Xg=(...t)=>t.filter((s,r,o)=>!!s&&s.trim()!==""&&o.indexOf(s)===r).join(" ").trim();/**
56
- * @license lucide-react v0.469.0 - ISC
57
- *
58
- * This source code is licensed under the ISC license.
59
- * See the LICENSE file in the root directory of this source tree.
60
- */var u1={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"};/**
61
- * @license lucide-react v0.469.0 - ISC
62
- *
63
- * This source code is licensed under the ISC license.
64
- * See the LICENSE file in the root directory of this source tree.
65
- */const Qg=x.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:l="",children:c,iconNode:d,...p},g)=>x.createElement("svg",{ref:g,...u1,width:s,height:s,stroke:t,strokeWidth:o?Number(r)*24/Number(s):r,className:Xg("lucide",l),...p},[...d.map(([m,v])=>x.createElement(m,v)),...Array.isArray(c)?c:[c]]));/**
66
- * @license lucide-react v0.469.0 - ISC
67
- *
68
- * This source code is licensed under the ISC license.
69
- * See the LICENSE file in the root directory of this source tree.
70
- */const ye=(t,s)=>{const r=x.forwardRef(({className:o,...l},c)=>x.createElement(Qg,{ref:c,iconNode:s,className:Xg(`lucide-${c1(t)}`,o),...l}));return r.displayName=`${t}`,r};/**
71
- * @license lucide-react v0.469.0 - ISC
72
- *
73
- * This source code is licensed under the ISC license.
74
- * See the LICENSE file in the root directory of this source tree.
75
- */const d1=ye("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
76
- * @license lucide-react v0.469.0 - ISC
77
- *
78
- * This source code is licensed under the ISC license.
79
- * See the LICENSE file in the root directory of this source tree.
80
- */const f1=ye("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
81
- * @license lucide-react v0.469.0 - ISC
82
- *
83
- * This source code is licensed under the ISC license.
84
- * See the LICENSE file in the root directory of this source tree.
85
- */const Zg=ye("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
86
- * @license lucide-react v0.469.0 - ISC
87
- *
88
- * This source code is licensed under the ISC license.
89
- * See the LICENSE file in the root directory of this source tree.
90
- */const p1=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"}]]);/**
91
- * @license lucide-react v0.469.0 - ISC
92
- *
93
- * This source code is licensed under the ISC license.
94
- * See the LICENSE file in the root directory of this source tree.
95
- */const mr=ye("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
96
- * @license lucide-react v0.469.0 - ISC
97
- *
98
- * This source code is licensed under the ISC license.
99
- * See the LICENSE file in the root directory of this source tree.
100
- */const h1=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"}]]);/**
101
- * @license lucide-react v0.469.0 - ISC
102
- *
103
- * This source code is licensed under the ISC license.
104
- * See the LICENSE file in the root directory of this source tree.
105
- */const Ns=ye("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
106
- * @license lucide-react v0.469.0 - ISC
107
- *
108
- * This source code is licensed under the ISC license.
109
- * See the LICENSE file in the root directory of this source tree.
110
- */const Si=ye("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
111
- * @license lucide-react v0.469.0 - ISC
112
- *
113
- * This source code is licensed under the ISC license.
114
- * See the LICENSE file in the root directory of this source tree.
115
- */const Co=ye("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
116
- * @license lucide-react v0.469.0 - ISC
117
- *
118
- * This source code is licensed under the ISC license.
119
- * See the LICENSE file in the root directory of this source tree.
120
- */const $l=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"}]]);/**
121
- * @license lucide-react v0.469.0 - ISC
122
- *
123
- * This source code is licensed under the ISC license.
124
- * See the LICENSE file in the root directory of this source tree.
125
- */const m1=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"}]]);/**
126
- * @license lucide-react v0.469.0 - ISC
127
- *
128
- * This source code is licensed under the ISC license.
129
- * See the LICENSE file in the root directory of this source tree.
130
- */const vl=ye("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
131
- * @license lucide-react v0.469.0 - ISC
132
- *
133
- * This source code is licensed under the ISC license.
134
- * See the LICENSE file in the root directory of this source tree.
135
- */const g1=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"}]]);/**
136
- * @license lucide-react v0.469.0 - ISC
137
- *
138
- * This source code is licensed under the ISC license.
139
- * See the LICENSE file in the root directory of this source tree.
140
- */const v1=ye("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
141
- * @license lucide-react v0.469.0 - ISC
142
- *
143
- * This source code is licensed under the ISC license.
144
- * See the LICENSE file in the root directory of this source tree.
145
- */const y1=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"}]]);/**
146
- * @license lucide-react v0.469.0 - ISC
147
- *
148
- * This source code is licensed under the ISC license.
149
- * See the LICENSE file in the root directory of this source tree.
150
- */const Jg=ye("Cog",[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]]);/**
151
- * @license lucide-react v0.469.0 - ISC
152
- *
153
- * This source code is licensed under the ISC license.
154
- * See the LICENSE file in the root directory of this source tree.
155
- */const nm=ye("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/**
156
- * @license lucide-react v0.469.0 - ISC
157
- *
158
- * This source code is licensed under the ISC license.
159
- * See the LICENSE file in the root directory of this source tree.
160
- */const _o=ye("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
161
- * @license lucide-react v0.469.0 - ISC
162
- *
163
- * This source code is licensed under the ISC license.
164
- * See the LICENSE file in the root directory of this source tree.
165
- */const x1=ye("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
166
- * @license lucide-react v0.469.0 - ISC
167
- *
168
- * This source code is licensed under the ISC license.
169
- * See the LICENSE file in the root directory of this source tree.
170
- */const w1=ye("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
171
- * @license lucide-react v0.469.0 - ISC
172
- *
173
- * This source code is licensed under the ISC license.
174
- * See the LICENSE file in the root directory of this source tree.
175
- */const k1=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"}]]);/**
176
- * @license lucide-react v0.469.0 - ISC
177
- *
178
- * This source code is licensed under the ISC license.
179
- * See the LICENSE file in the root directory of this source tree.
180
- */const ev=ye("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
181
- * @license lucide-react v0.469.0 - ISC
182
- *
183
- * This source code is licensed under the ISC license.
184
- * See the LICENSE file in the root directory of this source tree.
185
- */const S1=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"}]]);/**
186
- * @license lucide-react v0.469.0 - ISC
187
- *
188
- * This source code is licensed under the ISC license.
189
- * See the LICENSE file in the root directory of this source tree.
190
- */const b1=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"}]]);/**
191
- * @license lucide-react v0.469.0 - ISC
192
- *
193
- * This source code is licensed under the ISC license.
194
- * See the LICENSE file in the root directory of this source tree.
195
- */const Pu=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"}]]);/**
196
- * @license lucide-react v0.469.0 - ISC
197
- *
198
- * This source code is licensed under the ISC license.
199
- * See the LICENSE file in the root directory of this source tree.
200
- */const yl=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"}]]);/**
201
- * @license lucide-react v0.469.0 - ISC
202
- *
203
- * This source code is licensed under the ISC license.
204
- * See the LICENSE file in the root directory of this source tree.
205
- */const tv=ye("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
206
- * @license lucide-react v0.469.0 - ISC
207
- *
208
- * This source code is licensed under the ISC license.
209
- * See the LICENSE file in the root directory of this source tree.
210
- */const nv=ye("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
211
- * @license lucide-react v0.469.0 - ISC
212
- *
213
- * This source code is licensed under the ISC license.
214
- * See the LICENSE file in the root directory of this source tree.
215
- */const sv=ye("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);/**
216
- * @license lucide-react v0.469.0 - ISC
217
- *
218
- * This source code is licensed under the ISC license.
219
- * See the LICENSE file in the root directory of this source tree.
220
- */const T1=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"}]]);/**
221
- * @license lucide-react v0.469.0 - ISC
222
- *
223
- * This source code is licensed under the ISC license.
224
- * See the LICENSE file in the root directory of this source tree.
225
- */const N1=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"}]]);/**
226
- * @license lucide-react v0.469.0 - ISC
227
- *
228
- * This source code is licensed under the ISC license.
229
- * See the LICENSE file in the root directory of this source tree.
230
- */const 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"}]]);/**
231
- * @license lucide-react v0.469.0 - ISC
232
- *
233
- * This source code is licensed under the ISC license.
234
- * See the LICENSE file in the root directory of this source tree.
235
- */const rv=ye("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
236
- * @license lucide-react v0.469.0 - ISC
237
- *
238
- * This source code is licensed under the ISC license.
239
- * See the LICENSE file in the root directory of this source tree.
240
- */const C1=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"}]]);/**
241
- * @license lucide-react v0.469.0 - ISC
242
- *
243
- * This source code is licensed under the ISC license.
244
- * See the LICENSE file in the root directory of this source tree.
245
- */const _1=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"}]]);/**
246
- * @license lucide-react v0.469.0 - ISC
247
- *
248
- * This source code is licensed under the ISC license.
249
- * See the LICENSE file in the root directory of this source tree.
250
- */const E1=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"}]]);/**
251
- * @license lucide-react v0.469.0 - ISC
252
- *
253
- * This source code is licensed under the ISC license.
254
- * See the LICENSE file in the root directory of this source tree.
255
- */const R1=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"}]]);/**
256
- * @license lucide-react v0.469.0 - ISC
257
- *
258
- * This source code is licensed under the ISC license.
259
- * See the LICENSE file in the root directory of this source tree.
260
- */const hn=ye("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
261
- * @license lucide-react v0.469.0 - ISC
262
- *
263
- * This source code is licensed under the ISC license.
264
- * See the LICENSE file in the root directory of this source tree.
265
- */const A1=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"}]]);/**
266
- * @license lucide-react v0.469.0 - ISC
267
- *
268
- * This source code is licensed under the ISC license.
269
- * See the LICENSE file in the root directory of this source tree.
270
- */const I1=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"}]]);/**
271
- * @license lucide-react v0.469.0 - ISC
272
- *
273
- * This source code is licensed under the ISC license.
274
- * See the LICENSE file in the root directory of this source tree.
275
- */const iv=ye("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
276
- * @license lucide-react v0.469.0 - ISC
277
- *
278
- * This source code is licensed under the ISC license.
279
- * See the LICENSE file in the root directory of this source tree.
280
- */const D1=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"}]]);/**
281
- * @license lucide-react v0.469.0 - ISC
282
- *
283
- * This source code is licensed under the ISC license.
284
- * See the LICENSE file in the root directory of this source tree.
285
- */const sm=ye("MonitorSmartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]);/**
286
- * @license lucide-react v0.469.0 - ISC
287
- *
288
- * This source code is licensed under the ISC license.
289
- * See the LICENSE file in the root directory of this source tree.
290
- */const M1=ye("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/**
291
- * @license lucide-react v0.469.0 - ISC
292
- *
293
- * This source code is licensed under the ISC license.
294
- * See the LICENSE file in the root directory of this source tree.
295
- */const L1=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"}]]);/**
296
- * @license lucide-react v0.469.0 - ISC
297
- *
298
- * This source code is licensed under the ISC license.
299
- * See the LICENSE file in the root directory of this source tree.
300
- */const O1=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"}]]);/**
301
- * @license lucide-react v0.469.0 - ISC
302
- *
303
- * This source code is licensed under the ISC license.
304
- * See the LICENSE file in the root directory of this source tree.
305
- */const P1=ye("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
306
- * @license lucide-react v0.469.0 - ISC
307
- *
308
- * This source code is licensed under the ISC license.
309
- * See the LICENSE file in the root directory of this source tree.
310
- */const $1=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"}]]);/**
311
- * @license lucide-react v0.469.0 - ISC
312
- *
313
- * This source code is licensed under the ISC license.
314
- * See the LICENSE file in the root directory of this source tree.
315
- */const ol=ye("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
316
- * @license lucide-react v0.469.0 - ISC
317
- *
318
- * This source code is licensed under the ISC license.
319
- * See the LICENSE file in the root directory of this source tree.
320
- */const z1=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"}]]);/**
321
- * @license lucide-react v0.469.0 - ISC
322
- *
323
- * This source code is licensed under the ISC license.
324
- * See the LICENSE file in the root directory of this source tree.
325
- */const F1=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"}]]);/**
326
- * @license lucide-react v0.469.0 - ISC
327
- *
328
- * This source code is licensed under the ISC license.
329
- * See the LICENSE file in the root directory of this source tree.
330
- */const fr=ye("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
331
- * @license lucide-react v0.469.0 - ISC
332
- *
333
- * This source code is licensed under the ISC license.
334
- * See the LICENSE file in the root directory of this source tree.
335
- */const ov=ye("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/**
336
- * @license lucide-react v0.469.0 - ISC
337
- *
338
- * This source code is licensed under the ISC license.
339
- * See the LICENSE file in the root directory of this source tree.
340
- */const U1=ye("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
341
- * @license lucide-react v0.469.0 - ISC
342
- *
343
- * This source code is licensed under the ISC license.
344
- * See the LICENSE file in the root directory of this source tree.
345
- */const B1=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"}]]);/**
346
- * @license lucide-react v0.469.0 - ISC
347
- *
348
- * This source code is licensed under the ISC license.
349
- * See the LICENSE file in the root directory of this source tree.
350
- */const Eo=ye("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
351
- * @license lucide-react v0.469.0 - ISC
352
- *
353
- * This source code is licensed under the ISC license.
354
- * See the LICENSE file in the root directory of this source tree.
355
- */const av=ye("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
356
- * @license lucide-react v0.469.0 - ISC
357
- *
358
- * This source code is licensed under the ISC license.
359
- * See the LICENSE file in the root directory of this source tree.
360
- */const lv=ye("SatelliteDish",[["path",{d:"M4 10a7.31 7.31 0 0 0 10 10Z",key:"1fzpp3"}],["path",{d:"m9 15 3-3",key:"88sc13"}],["path",{d:"M17 13a6 6 0 0 0-6-6",key:"15cc6u"}],["path",{d:"M21 13A10 10 0 0 0 11 3",key:"11nf8s"}]]);/**
361
- * @license lucide-react v0.469.0 - ISC
362
- *
363
- * This source code is licensed under the ISC license.
364
- * See the LICENSE file in the root directory of this source tree.
365
- */const W1=ye("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
366
- * @license lucide-react v0.469.0 - ISC
367
- *
368
- * This source code is licensed under the ISC license.
369
- * See the LICENSE file in the root directory of this source tree.
370
- */const Lo=ye("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
371
- * @license lucide-react v0.469.0 - ISC
372
- *
373
- * This source code is licensed under the ISC license.
374
- * See the LICENSE file in the root directory of this source tree.
375
- */const H1=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"}]]);/**
376
- * @license lucide-react v0.469.0 - ISC
377
- *
378
- * This source code is licensed under the ISC license.
379
- * See the LICENSE file in the root directory of this source tree.
380
- */const cv=ye("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/**
381
- * @license lucide-react v0.469.0 - ISC
382
- *
383
- * This source code is licensed under the ISC license.
384
- * See the LICENSE file in the root directory of this source tree.
385
- */const Fr=ye("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
386
- * @license lucide-react v0.469.0 - ISC
387
- *
388
- * This source code is licensed under the ISC license.
389
- * See the LICENSE file in the root directory of this source tree.
390
- */const xl=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"}]]);/**
391
- * @license lucide-react v0.469.0 - ISC
392
- *
393
- * This source code is licensed under the ISC license.
394
- * See the LICENSE file in the root directory of this source tree.
395
- */const uv=ye("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
396
- * @license lucide-react v0.469.0 - ISC
397
- *
398
- * This source code is licensed under the ISC license.
399
- * See the LICENSE file in the root directory of this source tree.
400
- */const us=ye("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
401
- * @license lucide-react v0.469.0 - ISC
402
- *
403
- * This source code is licensed under the ISC license.
404
- * See the LICENSE file in the root directory of this source tree.
405
- */const dv=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"}]]);/**
406
- * @license lucide-react v0.469.0 - ISC
407
- *
408
- * This source code is licensed under the ISC license.
409
- * See the LICENSE file in the root directory of this source tree.
410
- */const V1=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"}]]);/**
411
- * @license lucide-react v0.469.0 - ISC
412
- *
413
- * This source code is licensed under the ISC license.
414
- * See the LICENSE file in the root directory of this source tree.
415
- */const G1=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"}]]);/**
416
- * @license lucide-react v0.469.0 - ISC
417
- *
418
- * This source code is licensed under the ISC license.
419
- * See the LICENSE file in the root directory of this source tree.
420
- */const K1=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"}]]);/**
421
- * @license lucide-react v0.469.0 - ISC
422
- *
423
- * This source code is licensed under the ISC license.
424
- * See the LICENSE file in the root directory of this source tree.
425
- */const fv=ye("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
426
- * @license lucide-react v0.469.0 - ISC
427
- *
428
- * This source code is licensed under the ISC license.
429
- * See the LICENSE file in the root directory of this source tree.
430
- */const 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"}]]);/**
431
- * @license lucide-react v0.469.0 - ISC
432
- *
433
- * This source code is licensed under the ISC license.
434
- * See the LICENSE file in the root directory of this source tree.
435
- */const Tn=ye("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
436
- * @license lucide-react v0.469.0 - ISC
437
- *
438
- * This source code is licensed under the ISC license.
439
- * See the LICENSE file in the root directory of this source tree.
440
- */const Y1=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"}]]),X1=new Set(["path","circle","rect","line","ellipse","polyline","polygon"]),Q1=new Set("d cx cy r rx ry x y width height x1 x2 y1 y2 points fill".split(" "));function Z1(t){return t.filter(([s])=>X1.has(s)).map(([s,r],o)=>[s,{...Object.fromEntries(Object.entries(r).filter(([l])=>Q1.has(l))),key:String(o)}])}function ji({iconNode:t,size:s=14,className:r}){const o=x.useMemo(()=>t?Z1(t):[],[t]);return o.length===0?a.jsx(rv,{size:s,className:r,"aria-hidden":"true","data-testid":"app-icon-default"}):a.jsx(Qg,{iconNode:o,size:s,className:r,"aria-hidden":"true","data-testid":"app-icon"})}var go=kg();function J1(){for(var t=arguments.length,s=new Array(t),r=0;r<t;r++)s[r]=arguments[r];return x.useMemo(()=>o=>{s.forEach(l=>l(o))},s)}const zl=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ci(t){const s=Object.prototype.toString.call(t);return s==="[object Window]"||s==="[object global]"}function Id(t){return"nodeType"in t}function Nn(t){var s,r;return t?Ci(t)?t:Id(t)&&(s=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?s:window:window}function Dd(t){const{Document:s}=Nn(t);return t instanceof s}function Oo(t){return Ci(t)?!1:t instanceof Nn(t).HTMLElement}function pv(t){return t instanceof Nn(t).SVGElement}function _i(t){return t?Ci(t)?t.document:Id(t)?Dd(t)?t:Oo(t)||pv(t)?t.ownerDocument:document:document:document}const fs=zl?x.useLayoutEffect:x.useEffect;function Fl(t){const s=x.useRef(t);return fs(()=>{s.current=t}),x.useCallback(function(){for(var r=arguments.length,o=new Array(r),l=0;l<r;l++)o[l]=arguments[l];return s.current==null?void 0:s.current(...o)},[])}function ek(){const t=x.useRef(null),s=x.useCallback((o,l)=>{t.current=setInterval(o,l)},[]),r=x.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[s,r]}function Ro(t,s){s===void 0&&(s=[t]);const r=x.useRef(t);return fs(()=>{r.current!==t&&(r.current=t)},s),r}function Po(t,s){const r=x.useRef();return x.useMemo(()=>{const o=t(r.current);return r.current=o,o},[...s])}function wl(t){const s=Fl(t),r=x.useRef(null),o=x.useCallback(l=>{l!==r.current&&(s==null||s(l,r.current)),r.current=l},[]);return[r,o]}function kl(t){const s=x.useRef();return x.useEffect(()=>{s.current=t},[t]),s.current}let $u={};function $o(t,s){return x.useMemo(()=>{if(s)return s;const r=$u[t]==null?0:$u[t]+1;return $u[t]=r,t+"-"+r},[t,s])}function hv(t){return function(s){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 p=Object.entries(d);for(const[g,m]of p){const v=c[g];v!=null&&(c[g]=v+t*m)}return c},{...s})}}const bi=hv(1),Sl=hv(-1);function tk(t){return"clientX"in t&&"clientY"in t}function Ul(t){if(!t)return!1;const{KeyboardEvent:s}=Nn(t.target);return s&&t instanceof s}function nk(t){if(!t)return!1;const{TouchEvent:s}=Nn(t.target);return s&&t instanceof s}function bl(t){if(nk(t)){if(t.touches&&t.touches.length){const{clientX:s,clientY:r}=t.touches[0];return{x:s,y:r}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:s,clientY:r}=t.changedTouches[0];return{x:s,y:r}}}return tk(t)?{x:t.clientX,y:t.clientY}:null}const js=Object.freeze({Translate:{toString(t){if(!t)return;const{x:s,y:r}=t;return"translate3d("+(s?Math.round(s):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:s,scaleY:r}=t;return"scaleX("+s+") scaleY("+r+")"}},Transform:{toString(t){if(t)return[js.Translate.toString(t),js.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:s,duration:r,easing:o}=t;return s+" "+r+"ms "+o}}}),rm="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function sk(t){return t.matches(rm)?t:t.querySelector(rm)}const rk={display:"none"};function ik(t){let{id:s,value:r}=t;return lt.createElement("div",{id:s,style:rk},r)}function ok(t){let{id:s,announcement:r,ariaLiveType:o="assertive"}=t;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 lt.createElement("div",{id:s,style:l,role:"status","aria-live":o,"aria-atomic":!0},r)}function ak(){const[t,s]=x.useState("");return{announce:x.useCallback(o=>{o!=null&&s(o)},[]),announcement:t}}const mv=x.createContext(null);function lk(t){const s=x.useContext(mv);x.useEffect(()=>{if(!s)throw new Error("useDndMonitor must be used within a children of <DndContext>");return s(t)},[t,s])}function ck(){const[t]=x.useState(()=>new Set),s=x.useCallback(o=>(t.add(o),()=>t.delete(o)),[t]);return[x.useCallback(o=>{let{type:l,event:c}=o;t.forEach(d=>{var p;return(p=d[l])==null?void 0:p.call(d,c)})},[t]),s]}const uk={draggable:`
441
- To pick up a draggable item, press the space bar.
442
- While dragging, use the arrow keys to move the item.
443
- Press space again to drop the item in its new position, or press escape to cancel.
444
- `},dk={onDragStart(t){let{active:s}=t;return"Picked up draggable item "+s.id+"."},onDragOver(t){let{active:s,over:r}=t;return r?"Draggable item "+s.id+" was moved over droppable area "+r.id+".":"Draggable item "+s.id+" is no longer over a droppable area."},onDragEnd(t){let{active:s,over:r}=t;return r?"Draggable item "+s.id+" was dropped over droppable area "+r.id:"Draggable item "+s.id+" was dropped."},onDragCancel(t){let{active:s}=t;return"Dragging was cancelled. Draggable item "+s.id+" was dropped."}};function fk(t){let{announcements:s=dk,container:r,hiddenTextDescribedById:o,screenReaderInstructions:l=uk}=t;const{announce:c,announcement:d}=ak(),p=$o("DndLiveRegion"),[g,m]=x.useState(!1);if(x.useEffect(()=>{m(!0)},[]),lk(x.useMemo(()=>({onDragStart(k){let{active:y}=k;c(s.onDragStart({active:y}))},onDragMove(k){let{active:y,over:S}=k;s.onDragMove&&c(s.onDragMove({active:y,over:S}))},onDragOver(k){let{active:y,over:S}=k;c(s.onDragOver({active:y,over:S}))},onDragEnd(k){let{active:y,over:S}=k;c(s.onDragEnd({active:y,over:S}))},onDragCancel(k){let{active:y,over:S}=k;c(s.onDragCancel({active:y,over:S}))}}),[c,s])),!g)return null;const v=lt.createElement(lt.Fragment,null,lt.createElement(ik,{id:o,value:l.draggable}),lt.createElement(ok,{id:p,announcement:d}));return r?go.createPortal(v,r):v}var Wt;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Wt||(Wt={}));function Tl(){}function gv(t,s){return x.useMemo(()=>({sensor:t,options:s??{}}),[t,s])}function vv(){for(var t=arguments.length,s=new Array(t),r=0;r<t;r++)s[r]=arguments[r];return x.useMemo(()=>[...s].filter(o=>o!=null),[...s])}const ps=Object.freeze({x:0,y:0});function pk(t,s){return Math.sqrt(Math.pow(t.x-s.x,2)+Math.pow(t.y-s.y,2))}function hk(t,s){const r=bl(t);if(!r)return"0 0";const o={x:(r.x-s.left)/s.width*100,y:(r.y-s.top)/s.height*100};return o.x+"% "+o.y+"%"}function mk(t,s){let{data:{value:r}}=t,{data:{value:o}}=s;return r-o}function gk(t,s){let{data:{value:r}}=t,{data:{value:o}}=s;return o-r}function vk(t,s){if(!t||t.length===0)return null;const[r]=t;return r[s]}function im(t,s,r){return s===void 0&&(s=t.left),r===void 0&&(r=t.top),{x:s+t.width*.5,y:r+t.height*.5}}const yv=t=>{let{collisionRect:s,droppableRects:r,droppableContainers:o}=t;const l=im(s,s.left,s.top),c=[];for(const d of o){const{id:p}=d,g=r.get(p);if(g){const m=pk(im(g),l);c.push({id:p,data:{droppableContainer:d,value:m}})}}return c.sort(mk)};function yk(t,s){const r=Math.max(s.top,t.top),o=Math.max(s.left,t.left),l=Math.min(s.left+s.width,t.left+t.width),c=Math.min(s.top+s.height,t.top+t.height),d=l-o,p=c-r;if(o<l&&r<c){const g=s.width*s.height,m=t.width*t.height,v=d*p,k=v/(g+m-v);return Number(k.toFixed(4))}return 0}const xk=t=>{let{collisionRect:s,droppableRects:r,droppableContainers:o}=t;const l=[];for(const c of o){const{id:d}=c,p=r.get(d);if(p){const g=yk(p,s);g>0&&l.push({id:d,data:{droppableContainer:c,value:g}})}}return l.sort(gk)};function wk(t,s,r){return{...t,scaleX:s&&r?s.width/r.width:1,scaleY:s&&r?s.height/r.height:1}}function xv(t,s){return t&&s?{x:t.left-s.left,y:t.top-s.top}:ps}function kk(t){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,p)=>({...d,top:d.top+t*p.y,bottom:d.bottom+t*p.y,left:d.left+t*p.x,right:d.right+t*p.x}),{...r})}}const Sk=kk(1);function wv(t){if(t.startsWith("matrix3d(")){const s=t.slice(9,-1).split(/, /);return{x:+s[12],y:+s[13],scaleX:+s[0],scaleY:+s[5]}}else if(t.startsWith("matrix(")){const s=t.slice(7,-1).split(/, /);return{x:+s[4],y:+s[5],scaleX:+s[0],scaleY:+s[3]}}return null}function bk(t,s,r){const o=wv(s);if(!o)return t;const{scaleX:l,scaleY:c,x:d,y:p}=o,g=t.left-d-(1-l)*parseFloat(r),m=t.top-p-(1-c)*parseFloat(r.slice(r.indexOf(" ")+1)),v=l?t.width/l:t.width,k=c?t.height/c:t.height;return{width:v,height:k,top:m,right:g+v,bottom:m+k,left:g}}const Tk={ignoreTransform:!1};function Ei(t,s){s===void 0&&(s=Tk);let r=t.getBoundingClientRect();if(s.ignoreTransform){const{transform:m,transformOrigin:v}=Nn(t).getComputedStyle(t);m&&(r=bk(r,m,v))}const{top:o,left:l,width:c,height:d,bottom:p,right:g}=r;return{top:o,left:l,width:c,height:d,bottom:p,right:g}}function om(t){return Ei(t,{ignoreTransform:!0})}function Nk(t){const s=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:s,bottom:r,width:s,height:r}}function jk(t,s){return s===void 0&&(s=Nn(t).getComputedStyle(t)),s.position==="fixed"}function Ck(t,s){s===void 0&&(s=Nn(t).getComputedStyle(t));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(l=>{const c=s[l];return typeof c=="string"?r.test(c):!1})}function Md(t,s){const r=[];function o(l){if(s!=null&&r.length>=s||!l)return r;if(Dd(l)&&l.scrollingElement!=null&&!r.includes(l.scrollingElement))return r.push(l.scrollingElement),r;if(!Oo(l)||pv(l)||r.includes(l))return r;const c=Nn(t).getComputedStyle(l);return l!==t&&Ck(l,c)&&r.push(l),jk(l,c)?r:o(l.parentNode)}return t?o(t):r}function kv(t){const[s]=Md(t,1);return s??null}function zu(t){return!zl||!t?null:Ci(t)?t:Id(t)?Dd(t)||t===_i(t).scrollingElement?window:Oo(t)?t:null:null}function Sv(t){return Ci(t)?t.scrollX:t.scrollLeft}function bv(t){return Ci(t)?t.scrollY:t.scrollTop}function td(t){return{x:Sv(t),y:bv(t)}}var Jt;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Jt||(Jt={}));function Tv(t){return!zl||!t?!1:t===document.scrollingElement}function Nv(t){const s={x:0,y:0},r=Tv(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},o={x:t.scrollWidth-r.width,y:t.scrollHeight-r.height},l=t.scrollTop<=s.y,c=t.scrollLeft<=s.x,d=t.scrollTop>=o.y,p=t.scrollLeft>=o.x;return{isTop:l,isLeft:c,isBottom:d,isRight:p,maxScroll:o,minScroll:s}}const _k={x:.2,y:.2};function Ek(t,s,r,o,l){let{top:c,left:d,right:p,bottom:g}=r;o===void 0&&(o=10),l===void 0&&(l=_k);const{isTop:m,isBottom:v,isLeft:k,isRight:y}=Nv(t),S={x:0,y:0},T={x:0,y:0},E={height:s.height*l.y,width:s.width*l.x};return!m&&c<=s.top+E.height?(S.y=Jt.Backward,T.y=o*Math.abs((s.top+E.height-c)/E.height)):!v&&g>=s.bottom-E.height&&(S.y=Jt.Forward,T.y=o*Math.abs((s.bottom-E.height-g)/E.height)),!y&&p>=s.right-E.width?(S.x=Jt.Forward,T.x=o*Math.abs((s.right-E.width-p)/E.width)):!k&&d<=s.left+E.width&&(S.x=Jt.Backward,T.x=o*Math.abs((s.left+E.width-d)/E.width)),{direction:S,speed:T}}function Rk(t){if(t===document.scrollingElement){const{innerWidth:c,innerHeight:d}=window;return{top:0,left:0,right:c,bottom:d,width:c,height:d}}const{top:s,left:r,right:o,bottom:l}=t.getBoundingClientRect();return{top:s,left:r,right:o,bottom:l,width:t.clientWidth,height:t.clientHeight}}function jv(t){return t.reduce((s,r)=>bi(s,td(r)),ps)}function Ak(t){return t.reduce((s,r)=>s+Sv(r),0)}function Ik(t){return t.reduce((s,r)=>s+bv(r),0)}function Cv(t,s){if(s===void 0&&(s=Ei),!t)return;const{top:r,left:o,bottom:l,right:c}=s(t);kv(t)&&(l<=0||c<=0||r>=window.innerHeight||o>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const Dk=[["x",["left","right"],Ak],["y",["top","bottom"],Ik]];class Ld{constructor(s,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=Md(r),l=jv(o);this.rect={...s},this.width=s.width,this.height=s.height;for(const[c,d,p]of Dk)for(const g of d)Object.defineProperty(this,g,{get:()=>{const m=p(o),v=l[c]-m;return this.rect[g]+v},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class xo{constructor(s){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=s}add(s,r,o){var l;(l=this.target)==null||l.addEventListener(s,r,o),this.listeners.push([s,r,o])}}function Mk(t){const{EventTarget:s}=Nn(t);return t instanceof s?t:_i(t)}function Fu(t,s){const r=Math.abs(t.x),o=Math.abs(t.y);return typeof s=="number"?Math.sqrt(r**2+o**2)>s:"x"in s&&"y"in s?r>s.x&&o>s.y:"x"in s?r>s.x:"y"in s?o>s.y:!1}var es;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(es||(es={}));function am(t){t.preventDefault()}function Lk(t){t.stopPropagation()}var tt;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(tt||(tt={}));const _v={start:[tt.Space,tt.Enter],cancel:[tt.Esc],end:[tt.Space,tt.Enter,tt.Tab]},Ok=(t,s)=>{let{currentCoordinates:r}=s;switch(t.code){case tt.Right:return{...r,x:r.x+25};case tt.Left:return{...r,x:r.x-25};case tt.Down:return{...r,y:r.y+25};case tt.Up:return{...r,y:r.y-25}}};class Ev{constructor(s){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=s;const{event:{target:r}}=s;this.props=s,this.listeners=new xo(_i(r)),this.windowListeners=new xo(Nn(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:s,onStart:r}=this.props,o=s.node.current;o&&Cv(o),r(ps)}handleKeyDown(s){if(Ul(s)){const{active:r,context:o,options:l}=this.props,{keyboardCodes:c=_v,coordinateGetter:d=Ok,scrollBehavior:p="smooth"}=l,{code:g}=s;if(c.end.includes(g)){this.handleEnd(s);return}if(c.cancel.includes(g)){this.handleCancel(s);return}const{collisionRect:m}=o.current,v=m?{x:m.left,y:m.top}:ps;this.referenceCoordinates||(this.referenceCoordinates=v);const k=d(s,{active:r,context:o.current,currentCoordinates:v});if(k){const y=Sl(k,v),S={x:0,y:0},{scrollableAncestors:T}=o.current;for(const E of T){const N=s.code,{isTop:C,isRight:_,isLeft:H,isBottom:D,maxScroll:O,minScroll:K}=Nv(E),G=Rk(E),z={x:Math.min(N===tt.Right?G.right-G.width/2:G.right,Math.max(N===tt.Right?G.left:G.left+G.width/2,k.x)),y:Math.min(N===tt.Down?G.bottom-G.height/2:G.bottom,Math.max(N===tt.Down?G.top:G.top+G.height/2,k.y))},J=N===tt.Right&&!_||N===tt.Left&&!H,he=N===tt.Down&&!D||N===tt.Up&&!C;if(J&&z.x!==k.x){const ae=E.scrollLeft+y.x,ve=N===tt.Right&&ae<=O.x||N===tt.Left&&ae>=K.x;if(ve&&!y.y){E.scrollTo({left:ae,behavior:p});return}ve?S.x=E.scrollLeft-ae:S.x=N===tt.Right?E.scrollLeft-O.x:E.scrollLeft-K.x,S.x&&E.scrollBy({left:-S.x,behavior:p});break}else if(he&&z.y!==k.y){const ae=E.scrollTop+y.y,ve=N===tt.Down&&ae<=O.y||N===tt.Up&&ae>=K.y;if(ve&&!y.x){E.scrollTo({top:ae,behavior:p});return}ve?S.y=E.scrollTop-ae:S.y=N===tt.Down?E.scrollTop-O.y:E.scrollTop-K.y,S.y&&E.scrollBy({top:-S.y,behavior:p});break}}this.handleMove(s,bi(Sl(k,this.referenceCoordinates),S))}}}handleMove(s,r){const{onMove:o}=this.props;s.preventDefault(),o(r)}handleEnd(s){const{onEnd:r}=this.props;s.preventDefault(),this.detach(),r()}handleCancel(s){const{onCancel:r}=this.props;s.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Ev.activators=[{eventName:"onKeyDown",handler:(t,s,r)=>{let{keyboardCodes:o=_v,onActivation:l}=s,{active:c}=r;const{code:d}=t.nativeEvent;if(o.start.includes(d)){const p=c.activatorNode.current;return p&&t.target!==p?!1:(t.preventDefault(),l==null||l({event:t.nativeEvent}),!0)}return!1}}];function lm(t){return!!(t&&"distance"in t)}function cm(t){return!!(t&&"delay"in t)}class Od{constructor(s,r,o){var l;o===void 0&&(o=Mk(s.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=s,this.events=r;const{event:c}=s,{target:d}=c;this.props=s,this.events=r,this.document=_i(d),this.documentListeners=new xo(this.document),this.listeners=new xo(o),this.windowListeners=new xo(Nn(d)),this.initialCoordinates=(l=bl(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:s,props:{options:{activationConstraint:r,bypassActivationConstraint:o}}}=this;if(this.listeners.add(s.move.name,this.handleMove,{passive:!1}),this.listeners.add(s.end.name,this.handleEnd),s.cancel&&this.listeners.add(s.cancel.name,this.handleCancel),this.windowListeners.add(es.Resize,this.handleCancel),this.windowListeners.add(es.DragStart,am),this.windowListeners.add(es.VisibilityChange,this.handleCancel),this.windowListeners.add(es.ContextMenu,am),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(cm(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(lm(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(s,r){const{active:o,onPending:l}=this.props;l(o,s,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:s}=this,{onStart:r}=this.props;s&&(this.activated=!0,this.documentListeners.add(es.Click,Lk,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(es.SelectionChange,this.removeTextSelection),r(s))}handleMove(s){var r;const{activated:o,initialCoordinates:l,props:c}=this,{onMove:d,options:{activationConstraint:p}}=c;if(!l)return;const g=(r=bl(s))!=null?r:ps,m=Sl(l,g);if(!o&&p){if(lm(p)){if(p.tolerance!=null&&Fu(m,p.tolerance))return this.handleCancel();if(Fu(m,p.distance))return this.handleStart()}if(cm(p)&&Fu(m,p.tolerance))return this.handleCancel();this.handlePending(p,m);return}s.cancelable&&s.preventDefault(),d(g)}handleEnd(){const{onAbort:s,onEnd:r}=this.props;this.detach(),this.activated||s(this.props.active),r()}handleCancel(){const{onAbort:s,onCancel:r}=this.props;this.detach(),this.activated||s(this.props.active),r()}handleKeydown(s){s.code===tt.Esc&&this.handleCancel()}removeTextSelection(){var s;(s=this.document.getSelection())==null||s.removeAllRanges()}}const Pk={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Bl extends Od{constructor(s){const{event:r}=s,o=_i(r.target);super(s,Pk,o)}}Bl.activators=[{eventName:"onPointerDown",handler:(t,s)=>{let{nativeEvent:r}=t,{onActivation:o}=s;return!r.isPrimary||r.button!==0?!1:(o==null||o({event:r}),!0)}}];const $k={move:{name:"mousemove"},end:{name:"mouseup"}};var nd;(function(t){t[t.RightClick=2]="RightClick"})(nd||(nd={}));class zk extends Od{constructor(s){super(s,$k,_i(s.event.target))}}zk.activators=[{eventName:"onMouseDown",handler:(t,s)=>{let{nativeEvent:r}=t,{onActivation:o}=s;return r.button===nd.RightClick?!1:(o==null||o({event:r}),!0)}}];const Uu={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Fk extends Od{constructor(s){super(s,Uu)}static setup(){return window.addEventListener(Uu.move.name,s,{capture:!1,passive:!1}),function(){window.removeEventListener(Uu.move.name,s)};function s(){}}}Fk.activators=[{eventName:"onTouchStart",handler:(t,s)=>{let{nativeEvent:r}=t,{onActivation:o}=s;const{touches:l}=r;return l.length>1?!1:(o==null||o({event:r}),!0)}}];var wo;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(wo||(wo={}));var Nl;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Nl||(Nl={}));function Uk(t){let{acceleration:s,activator:r=wo.Pointer,canScroll:o,draggingRect:l,enabled:c,interval:d=5,order:p=Nl.TreeOrder,pointerCoordinates:g,scrollableAncestors:m,scrollableAncestorRects:v,delta:k,threshold:y}=t;const S=Wk({delta:k,disabled:!c}),[T,E]=ek(),N=x.useRef({x:0,y:0}),C=x.useRef({x:0,y:0}),_=x.useMemo(()=>{switch(r){case wo.Pointer:return g?{top:g.y,bottom:g.y,left:g.x,right:g.x}:null;case wo.DraggableRect:return l}},[r,l,g]),H=x.useRef(null),D=x.useCallback(()=>{const K=H.current;if(!K)return;const G=N.current.x*C.current.x,z=N.current.y*C.current.y;K.scrollBy(G,z)},[]),O=x.useMemo(()=>p===Nl.TreeOrder?[...m].reverse():m,[p,m]);x.useEffect(()=>{if(!c||!m.length||!_){E();return}for(const K of O){if((o==null?void 0:o(K))===!1)continue;const G=m.indexOf(K),z=v[G];if(!z)continue;const{direction:J,speed:he}=Ek(K,z,_,s,y);for(const ae of["x","y"])S[ae][J[ae]]||(he[ae]=0,J[ae]=0);if(he.x>0||he.y>0){E(),H.current=K,T(D,d),N.current=he,C.current=J;return}}N.current={x:0,y:0},C.current={x:0,y:0},E()},[s,D,o,E,c,d,JSON.stringify(_),JSON.stringify(S),T,m,O,v,JSON.stringify(y)])}const Bk={x:{[Jt.Backward]:!1,[Jt.Forward]:!1},y:{[Jt.Backward]:!1,[Jt.Forward]:!1}};function Wk(t){let{delta:s,disabled:r}=t;const o=kl(s);return Po(l=>{if(r||!o||!l)return Bk;const c={x:Math.sign(s.x-o.x),y:Math.sign(s.y-o.y)};return{x:{[Jt.Backward]:l.x[Jt.Backward]||c.x===-1,[Jt.Forward]:l.x[Jt.Forward]||c.x===1},y:{[Jt.Backward]:l.y[Jt.Backward]||c.y===-1,[Jt.Forward]:l.y[Jt.Forward]||c.y===1}}},[r,s,o])}function Hk(t,s){const r=s!=null?t.get(s):void 0,o=r?r.node.current:null;return Po(l=>{var c;return s==null?null:(c=o??l)!=null?c:null},[o,s])}function Vk(t,s){return x.useMemo(()=>t.reduce((r,o)=>{const{sensor:l}=o,c=l.activators.map(d=>({eventName:d.eventName,handler:s(d.handler,o)}));return[...r,...c]},[]),[t,s])}var Ao;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Ao||(Ao={}));var sd;(function(t){t.Optimized="optimized"})(sd||(sd={}));const um=new Map;function Gk(t,s){let{dragging:r,dependencies:o,config:l}=s;const[c,d]=x.useState(null),{frequency:p,measure:g,strategy:m}=l,v=x.useRef(t),k=N(),y=Ro(k),S=x.useCallback(function(C){C===void 0&&(C=[]),!y.current&&d(_=>_===null?C:_.concat(C.filter(H=>!_.includes(H))))},[y]),T=x.useRef(null),E=Po(C=>{if(k&&!r)return um;if(!C||C===um||v.current!==t||c!=null){const _=new Map;for(let H of t){if(!H)continue;if(c&&c.length>0&&!c.includes(H.id)&&H.rect.current){_.set(H.id,H.rect.current);continue}const D=H.node.current,O=D?new Ld(g(D),D):null;H.rect.current=O,O&&_.set(H.id,O)}return _}return C},[t,c,r,k,g]);return x.useEffect(()=>{v.current=t},[t]),x.useEffect(()=>{k||S()},[r,k]),x.useEffect(()=>{c&&c.length>0&&d(null)},[JSON.stringify(c)]),x.useEffect(()=>{k||typeof p!="number"||T.current!==null||(T.current=setTimeout(()=>{S(),T.current=null},p))},[p,k,S,...o]),{droppableRects:E,measureDroppableContainers:S,measuringScheduled:c!=null};function N(){switch(m){case Ao.Always:return!1;case Ao.BeforeDragging:return r;default:return!r}}}function Pd(t,s){return Po(r=>t?r||(typeof s=="function"?s(t):t):null,[s,t])}function Kk(t,s){return Pd(t,s)}function qk(t){let{callback:s,disabled:r}=t;const o=Fl(s),l=x.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(o)},[o,r]);return x.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function Wl(t){let{callback:s,disabled:r}=t;const o=Fl(s),l=x.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(o)},[r]);return x.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function Yk(t){return new Ld(Ei(t),t)}function dm(t,s,r){s===void 0&&(s=Yk);const[o,l]=x.useState(null);function c(){l(g=>{if(!t)return null;if(t.isConnected===!1){var m;return(m=g??r)!=null?m:null}const v=s(t);return JSON.stringify(g)===JSON.stringify(v)?g:v})}const d=qk({callback(g){if(t)for(const m of g){const{type:v,target:k}=m;if(v==="childList"&&k instanceof HTMLElement&&k.contains(t)){c();break}}}}),p=Wl({callback:c});return fs(()=>{c(),t?(p==null||p.observe(t),d==null||d.observe(document.body,{childList:!0,subtree:!0})):(p==null||p.disconnect(),d==null||d.disconnect())},[t]),o}function Xk(t){const s=Pd(t);return xv(t,s)}const fm=[];function Qk(t){const s=x.useRef(t),r=Po(o=>t?o&&o!==fm&&t&&s.current&&t.parentNode===s.current.parentNode?o:Md(t):fm,[t]);return x.useEffect(()=>{s.current=t},[t]),r}function Zk(t){const[s,r]=x.useState(null),o=x.useRef(t),l=x.useCallback(c=>{const d=zu(c.target);d&&r(p=>p?(p.set(d,td(d)),new Map(p)):null)},[]);return x.useEffect(()=>{const c=o.current;if(t!==c){d(c);const p=t.map(g=>{const m=zu(g);return m?(m.addEventListener("scroll",l,{passive:!0}),[m,td(m)]):null}).filter(g=>g!=null);r(p.length?new Map(p):null),o.current=t}return()=>{d(t),d(c)};function d(p){p.forEach(g=>{const m=zu(g);m==null||m.removeEventListener("scroll",l)})}},[l,t]),x.useMemo(()=>t.length?s?Array.from(s.values()).reduce((c,d)=>bi(c,d),ps):jv(t):ps,[t,s])}function pm(t,s){s===void 0&&(s=[]);const r=x.useRef(null);return x.useEffect(()=>{r.current=null},s),x.useEffect(()=>{const o=t!==ps;o&&!r.current&&(r.current=t),!o&&r.current&&(r.current=null)},[t]),r.current?Sl(t,r.current):ps}function Jk(t){x.useEffect(()=>{if(!zl)return;const s=t.map(r=>{let{sensor:o}=r;return o.setup==null?void 0:o.setup()});return()=>{for(const r of s)r==null||r()}},t.map(s=>{let{sensor:r}=s;return r}))}function eS(t,s){return x.useMemo(()=>t.reduce((r,o)=>{let{eventName:l,handler:c}=o;return r[l]=d=>{c(d,s)},r},{}),[t,s])}function Rv(t){return x.useMemo(()=>t?Nk(t):null,[t])}const hm=[];function tS(t,s){s===void 0&&(s=Ei);const[r]=t,o=Rv(r?Nn(r):null),[l,c]=x.useState(hm);function d(){c(()=>t.length?t.map(g=>Tv(g)?o:new Ld(s(g),g)):hm)}const p=Wl({callback:d});return fs(()=>{p==null||p.disconnect(),d(),t.forEach(g=>p==null?void 0:p.observe(g))},[t]),l}function Av(t){if(!t)return null;if(t.children.length>1)return t;const s=t.children[0];return Oo(s)?s:t}function nS(t){let{measure:s}=t;const[r,o]=x.useState(null),l=x.useCallback(m=>{for(const{target:v}of m)if(Oo(v)){o(k=>{const y=s(v);return k?{...k,width:y.width,height:y.height}:y});break}},[s]),c=Wl({callback:l}),d=x.useCallback(m=>{const v=Av(m);c==null||c.disconnect(),v&&(c==null||c.observe(v)),o(v?s(v):null)},[s,c]),[p,g]=wl(d);return x.useMemo(()=>({nodeRef:p,rect:r,setRef:g}),[r,p,g])}const sS=[{sensor:Bl,options:{}},{sensor:Ev,options:{}}],rS={current:{}},al={draggable:{measure:om},droppable:{measure:om,strategy:Ao.WhileDragging,frequency:sd.Optimized},dragOverlay:{measure:Ei}};class ko extends Map{get(s){var r;return s!=null&&(r=super.get(s))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(s=>{let{disabled:r}=s;return!r})}getNodeFor(s){var r,o;return(r=(o=this.get(s))==null?void 0:o.node.current)!=null?r:void 0}}const iS={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ko,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Tl},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:al,measureDroppableContainers:Tl,windowRect:null,measuringScheduled:!1},Iv={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Tl,draggableNodes:new Map,over:null,measureDroppableContainers:Tl},zo=x.createContext(Iv),Dv=x.createContext(iS);function oS(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ko}}}function aS(t,s){switch(s.type){case Wt.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:s.initialCoordinates,active:s.active}};case Wt.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:s.coordinates.x-t.draggable.initialCoordinates.x,y:s.coordinates.y-t.draggable.initialCoordinates.y}}};case Wt.DragEnd:case Wt.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Wt.RegisterDroppable:{const{element:r}=s,{id:o}=r,l=new ko(t.droppable.containers);return l.set(o,r),{...t,droppable:{...t.droppable,containers:l}}}case Wt.SetDroppableDisabled:{const{id:r,key:o,disabled:l}=s,c=t.droppable.containers.get(r);if(!c||o!==c.key)return t;const d=new ko(t.droppable.containers);return d.set(r,{...c,disabled:l}),{...t,droppable:{...t.droppable,containers:d}}}case Wt.UnregisterDroppable:{const{id:r,key:o}=s,l=t.droppable.containers.get(r);if(!l||o!==l.key)return t;const c=new ko(t.droppable.containers);return c.delete(r),{...t,droppable:{...t.droppable,containers:c}}}default:return t}}function lS(t){let{disabled:s}=t;const{active:r,activatorEvent:o,draggableNodes:l}=x.useContext(zo),c=kl(o),d=kl(r==null?void 0:r.id);return x.useEffect(()=>{if(!s&&!o&&c&&d!=null){if(!Ul(c)||document.activeElement===c.target)return;const p=l.get(d);if(!p)return;const{activatorNode:g,node:m}=p;if(!g.current&&!m.current)return;requestAnimationFrame(()=>{for(const v of[g.current,m.current]){if(!v)continue;const k=sk(v);if(k){k.focus();break}}})}},[o,s,l,d,c]),null}function Mv(t,s){let{transform:r,...o}=s;return t!=null&&t.length?t.reduce((l,c)=>c({transform:l,...o}),r):r}function cS(t){return x.useMemo(()=>({draggable:{...al.draggable,...t==null?void 0:t.draggable},droppable:{...al.droppable,...t==null?void 0:t.droppable},dragOverlay:{...al.dragOverlay,...t==null?void 0:t.dragOverlay}}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function uS(t){let{activeNode:s,measure:r,initialRect:o,config:l=!0}=t;const c=x.useRef(!1),{x:d,y:p}=typeof l=="boolean"?{x:l,y:l}:l;fs(()=>{if(!d&&!p||!s){c.current=!1;return}if(c.current||!o)return;const m=s==null?void 0:s.node.current;if(!m||m.isConnected===!1)return;const v=r(m),k=xv(v,o);if(d||(k.x=0),p||(k.y=0),c.current=!0,Math.abs(k.x)>0||Math.abs(k.y)>0){const y=kv(m);y&&y.scrollBy({top:k.y,left:k.x})}},[s,d,p,o,r])}const Hl=x.createContext({...ps,scaleX:1,scaleY:1});var ur;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(ur||(ur={}));const Lv=x.memo(function(s){var r,o,l,c;let{id:d,accessibility:p,autoScroll:g=!0,children:m,sensors:v=sS,collisionDetection:k=xk,measuring:y,modifiers:S,...T}=s;const E=x.useReducer(aS,void 0,oS),[N,C]=E,[_,H]=ck(),[D,O]=x.useState(ur.Uninitialized),K=D===ur.Initialized,{draggable:{active:G,nodes:z,translate:J},droppable:{containers:he}}=N,ae=G!=null?z.get(G):null,ve=x.useRef({initial:null,translated:null}),we=x.useMemo(()=>{var Qe;return G!=null?{id:G,data:(Qe=ae==null?void 0:ae.data)!=null?Qe:rS,rect:ve}:null},[G,ae]),Ae=x.useRef(null),[ee,ne]=x.useState(null),[oe,F]=x.useState(null),X=Ro(T,Object.values(T)),L=$o("DndDescribedBy",d),R=x.useMemo(()=>he.getEnabled(),[he]),$=cS(y),{droppableRects:le,measureDroppableContainers:me,measuringScheduled:Y}=Gk(R,{dragging:K,dependencies:[J.x,J.y],config:$.droppable}),fe=Hk(z,G),Te=x.useMemo(()=>oe?bl(oe):null,[oe]),se=vn(),pe=Kk(fe,$.draggable.measure);uS({activeNode:G!=null?z.get(G):null,config:se.layoutShiftCompensation,initialRect:pe,measure:$.draggable.measure});const be=dm(fe,$.draggable.measure,pe),He=dm(fe?fe.parentElement:null),Ee=x.useRef({activatorEvent:null,active:null,activeNode:fe,collisionRect:null,collisions:null,droppableRects:le,draggableNodes:z,draggingNode:null,draggingNodeRect:null,droppableContainers:he,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ct=he.getNodeFor((r=Ee.current.over)==null?void 0:r.id),$e=nS({measure:$.dragOverlay.measure}),en=(o=$e.nodeRef.current)!=null?o:fe,Fe=K?(l=$e.rect)!=null?l:be:null,Ht=!!($e.nodeRef.current&&$e.rect),tn=Xk(Ht?null:be),wt=Rv(en?Nn(en):null),jt=Qk(K?ct??fe:null),zt=tS(jt),Lt=Mv(S,{transform:{x:J.x-tn.x,y:J.y-tn.y,scaleX:1,scaleY:1},activatorEvent:oe,active:we,activeNodeRect:be,containerNodeRect:He,draggingNodeRect:Fe,over:Ee.current.over,overlayNodeRect:$e.rect,scrollableAncestors:jt,scrollableAncestorRects:zt,windowRect:wt}),q=Te?bi(Te,J):null,ge=Zk(jt),Ue=pm(ge),nt=pm(ge,[be]),mt=bi(Lt,Ue),gt=Fe?Sk(Fe,Lt):null,Ct=we&&gt?k({active:we,collisionRect:gt,droppableRects:le,droppableContainers:R,pointerCoordinates:q}):null,an=vk(Ct,"id"),[dt,Dn]=x.useState(null),Mn=Ht?Lt:bi(Lt,nt),hs=wk(Mn,(c=dt==null?void 0:dt.rect)!=null?c:null,be),ms=x.useRef(null),ts=x.useCallback((Qe,_t)=>{let{sensor:ft,options:Gt}=_t;if(Ae.current==null)return;const vt=z.get(Ae.current);if(!vt)return;const yt=Qe.nativeEvent,at=new ft({active:Ae.current,activeNode:vt,event:yt,options:Gt,context:Ee,onAbort(rt){if(!z.get(rt))return;const{onDragAbort:A}=X.current,de={id:rt};A==null||A(de),_({type:"onDragAbort",event:de})},onPending(rt,Ot,A,de){if(!z.get(rt))return;const{onDragPending:ke}=X.current,Le={id:rt,constraint:Ot,initialCoordinates:A,offset:de};ke==null||ke(Le),_({type:"onDragPending",event:Le})},onStart(rt){const Ot=Ae.current;if(Ot==null)return;const A=z.get(Ot);if(!A)return;const{onDragStart:de}=X.current,ie={activatorEvent:yt,active:{id:Ot,data:A.data,rect:ve}};go.unstable_batchedUpdates(()=>{de==null||de(ie),O(ur.Initializing),C({type:Wt.DragStart,initialCoordinates:rt,active:Ot}),_({type:"onDragStart",event:ie}),ne(ms.current),F(yt)})},onMove(rt){C({type:Wt.DragMove,coordinates:rt})},onEnd:Kt(Wt.DragEnd),onCancel:Kt(Wt.DragCancel)});ms.current=at;function Kt(rt){return async function(){const{active:A,collisions:de,over:ie,scrollAdjustedTranslate:ke}=Ee.current;let Le=null;if(A&&ke){const{cancelDrop:Ke}=X.current;Le={activatorEvent:yt,active:A,collisions:de,delta:ke,over:ie},rt===Wt.DragEnd&&typeof Ke=="function"&&await Promise.resolve(Ke(Le))&&(rt=Wt.DragCancel)}Ae.current=null,go.unstable_batchedUpdates(()=>{C({type:rt}),O(ur.Uninitialized),Dn(null),ne(null),F(null),ms.current=null;const Ke=rt===Wt.DragEnd?"onDragEnd":"onDragCancel";if(Le){const Oe=X.current[Ke];Oe==null||Oe(Le),_({type:Ke,event:Le})}})}}},[z]),Ln=x.useCallback((Qe,_t)=>(ft,Gt)=>{const vt=ft.nativeEvent,yt=z.get(Gt);if(Ae.current!==null||!yt||vt.dndKit||vt.defaultPrevented)return;const at={active:yt};Qe(ft,_t.options,at)===!0&&(vt.dndKit={capturedBy:_t.sensor},Ae.current=Gt,ts(ft,_t))},[z,ts]),gn=Vk(v,Ln);Jk(v),fs(()=>{be&&D===ur.Initializing&&O(ur.Initialized)},[be,D]),x.useEffect(()=>{const{onDragMove:Qe}=X.current,{active:_t,activatorEvent:ft,collisions:Gt,over:vt}=Ee.current;if(!_t||!ft)return;const yt={active:_t,activatorEvent:ft,collisions:Gt,delta:{x:mt.x,y:mt.y},over:vt};go.unstable_batchedUpdates(()=>{Qe==null||Qe(yt),_({type:"onDragMove",event:yt})})},[mt.x,mt.y]),x.useEffect(()=>{const{active:Qe,activatorEvent:_t,collisions:ft,droppableContainers:Gt,scrollAdjustedTranslate:vt}=Ee.current;if(!Qe||Ae.current==null||!_t||!vt)return;const{onDragOver:yt}=X.current,at=Gt.get(an),Kt=at&&at.rect.current?{id:at.id,rect:at.rect.current,data:at.data,disabled:at.disabled}:null,rt={active:Qe,activatorEvent:_t,collisions:ft,delta:{x:vt.x,y:vt.y},over:Kt};go.unstable_batchedUpdates(()=>{Dn(Kt),yt==null||yt(rt),_({type:"onDragOver",event:rt})})},[an]),fs(()=>{Ee.current={activatorEvent:oe,active:we,activeNode:fe,collisionRect:gt,collisions:Ct,droppableRects:le,draggableNodes:z,draggingNode:en,draggingNodeRect:Fe,droppableContainers:he,over:dt,scrollableAncestors:jt,scrollAdjustedTranslate:mt},ve.current={initial:Fe,translated:gt}},[we,fe,Ct,gt,z,en,Fe,le,he,dt,jt,mt]),Uk({...se,delta:J,draggingRect:gt,pointerCoordinates:q,scrollableAncestors:jt,scrollableAncestorRects:zt});const ln=x.useMemo(()=>({active:we,activeNode:fe,activeNodeRect:be,activatorEvent:oe,collisions:Ct,containerNodeRect:He,dragOverlay:$e,draggableNodes:z,droppableContainers:he,droppableRects:le,over:dt,measureDroppableContainers:me,scrollableAncestors:jt,scrollableAncestorRects:zt,measuringConfiguration:$,measuringScheduled:Y,windowRect:wt}),[we,fe,be,oe,Ct,He,$e,z,he,le,dt,me,jt,zt,$,Y,wt]),Vt=x.useMemo(()=>({activatorEvent:oe,activators:gn,active:we,activeNodeRect:be,ariaDescribedById:{draggable:L},dispatch:C,draggableNodes:z,over:dt,measureDroppableContainers:me}),[oe,gn,we,be,C,L,z,dt,me]);return lt.createElement(mv.Provider,{value:H},lt.createElement(zo.Provider,{value:Vt},lt.createElement(Dv.Provider,{value:ln},lt.createElement(Hl.Provider,{value:hs},m)),lt.createElement(lS,{disabled:(p==null?void 0:p.restoreFocus)===!1})),lt.createElement(fk,{...p,hiddenTextDescribedById:L}));function vn(){const Qe=(ee==null?void 0:ee.autoScrollEnabled)===!1,_t=typeof g=="object"?g.enabled===!1:g===!1,ft=K&&!Qe&&!_t;return typeof g=="object"?{...g,enabled:ft}:{enabled:ft}}}),dS=x.createContext(null),mm="button",fS="Draggable";function pS(t){let{id:s,data:r,disabled:o=!1,attributes:l}=t;const c=$o(fS),{activators:d,activatorEvent:p,active:g,activeNodeRect:m,ariaDescribedById:v,draggableNodes:k,over:y}=x.useContext(zo),{role:S=mm,roleDescription:T="draggable",tabIndex:E=0}=l??{},N=(g==null?void 0:g.id)===s,C=x.useContext(N?Hl:dS),[_,H]=wl(),[D,O]=wl(),K=eS(d,s),G=Ro(r);fs(()=>(k.set(s,{id:s,key:c,node:_,activatorNode:D,data:G}),()=>{const J=k.get(s);J&&J.key===c&&k.delete(s)}),[k,s]);const z=x.useMemo(()=>({role:S,tabIndex:E,"aria-disabled":o,"aria-pressed":N&&S===mm?!0:void 0,"aria-roledescription":T,"aria-describedby":v.draggable}),[o,S,E,N,T,v.draggable]);return{active:g,activatorEvent:p,activeNodeRect:m,attributes:z,isDragging:N,listeners:o?void 0:K,node:_,over:y,setNodeRef:H,setActivatorNodeRef:O,transform:C}}function Ov(){return x.useContext(Dv)}const hS="Droppable",mS={timeout:25};function Pv(t){let{data:s,disabled:r=!1,id:o,resizeObserverConfig:l}=t;const c=$o(hS),{active:d,dispatch:p,over:g,measureDroppableContainers:m}=x.useContext(zo),v=x.useRef({disabled:r}),k=x.useRef(!1),y=x.useRef(null),S=x.useRef(null),{disabled:T,updateMeasurementsFor:E,timeout:N}={...mS,...l},C=Ro(E??o),_=x.useCallback(()=>{if(!k.current){k.current=!0;return}S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{m(Array.isArray(C.current)?C.current:[C.current]),S.current=null},N)},[N]),H=Wl({callback:_,disabled:T||!d}),D=x.useCallback((z,J)=>{H&&(J&&(H.unobserve(J),k.current=!1),z&&H.observe(z))},[H]),[O,K]=wl(D),G=Ro(s);return x.useEffect(()=>{!H||!O.current||(H.disconnect(),k.current=!1,H.observe(O.current))},[O,H]),x.useEffect(()=>(p({type:Wt.RegisterDroppable,element:{id:o,key:c,disabled:r,node:O,rect:y,data:G}}),()=>p({type:Wt.UnregisterDroppable,key:c,id:o})),[o]),x.useEffect(()=>{r!==v.current.disabled&&(p({type:Wt.SetDroppableDisabled,id:o,key:c,disabled:r}),v.current.disabled=r)},[o,c,r,p]),{active:d,rect:y,isOver:(g==null?void 0:g.id)===o,node:O,over:g,setNodeRef:K}}function gS(t){let{animation:s,children:r}=t;const[o,l]=x.useState(null),[c,d]=x.useState(null),p=kl(r);return!r&&!o&&p&&l(p),fs(()=>{if(!c)return;const g=o==null?void 0:o.key,m=o==null?void 0:o.props.id;if(g==null||m==null){l(null);return}Promise.resolve(s(m,c)).then(()=>{l(null)})},[s,o,c]),lt.createElement(lt.Fragment,null,r,o?x.cloneElement(o,{ref:d}):null)}const vS={x:0,y:0,scaleX:1,scaleY:1};function yS(t){let{children:s}=t;return lt.createElement(zo.Provider,{value:Iv},lt.createElement(Hl.Provider,{value:vS},s))}const xS={position:"fixed",touchAction:"none"},wS=t=>Ul(t)?"transform 250ms ease":void 0,kS=x.forwardRef((t,s)=>{let{as:r,activatorEvent:o,adjustScale:l,children:c,className:d,rect:p,style:g,transform:m,transition:v=wS}=t;if(!p)return null;const k=l?m:{...m,scaleX:1,scaleY:1},y={...xS,width:p.width,height:p.height,top:p.top,left:p.left,transform:js.Transform.toString(k),transformOrigin:l&&o?hk(o,p):void 0,transition:typeof v=="function"?v(o):v,...g};return lt.createElement(r,{className:d,style:y,ref:s},c)}),SS=t=>s=>{let{active:r,dragOverlay:o}=s;const l={},{styles:c,className:d}=t;if(c!=null&&c.active)for(const[p,g]of Object.entries(c.active))g!==void 0&&(l[p]=r.node.style.getPropertyValue(p),r.node.style.setProperty(p,g));if(c!=null&&c.dragOverlay)for(const[p,g]of Object.entries(c.dragOverlay))g!==void 0&&o.node.style.setProperty(p,g);return d!=null&&d.active&&r.node.classList.add(d.active),d!=null&&d.dragOverlay&&o.node.classList.add(d.dragOverlay),function(){for(const[g,m]of Object.entries(l))r.node.style.setProperty(g,m);d!=null&&d.active&&r.node.classList.remove(d.active)}},bS=t=>{let{transform:{initial:s,final:r}}=t;return[{transform:js.Transform.toString(s)},{transform:js.Transform.toString(r)}]},TS={duration:250,easing:"ease",keyframes:bS,sideEffects:SS({styles:{active:{opacity:"0"}}})};function NS(t){let{config:s,draggableNodes:r,droppableContainers:o,measuringConfiguration:l}=t;return Fl((c,d)=>{if(s===null)return;const p=r.get(c);if(!p)return;const g=p.node.current;if(!g)return;const m=Av(d);if(!m)return;const{transform:v}=Nn(d).getComputedStyle(d),k=wv(v);if(!k)return;const y=typeof s=="function"?s:jS(s);return Cv(g,l.draggable.measure),y({active:{id:c,data:p.data,node:g,rect:l.draggable.measure(g)},draggableNodes:r,dragOverlay:{node:d,rect:l.dragOverlay.measure(m)},droppableContainers:o,measuringConfiguration:l,transform:k})})}function jS(t){const{duration:s,easing:r,sideEffects:o,keyframes:l}={...TS,...t};return c=>{let{active:d,dragOverlay:p,transform:g,...m}=c;if(!s)return;const v={x:p.rect.left-d.rect.left,y:p.rect.top-d.rect.top},k={scaleX:g.scaleX!==1?d.rect.width*g.scaleX/p.rect.width:1,scaleY:g.scaleY!==1?d.rect.height*g.scaleY/p.rect.height:1},y={x:g.x-v.x,y:g.y-v.y,...k},S=l({...m,active:d,dragOverlay:p,transform:{initial:g,final:y}}),[T]=S,E=S[S.length-1];if(JSON.stringify(T)===JSON.stringify(E))return;const N=o==null?void 0:o({active:d,dragOverlay:p,...m}),C=p.node.animate(S,{duration:s,easing:r,fill:"forwards"});return new Promise(_=>{C.onfinish=()=>{N==null||N(),_()}})}}let gm=0;function CS(t){return x.useMemo(()=>{if(t!=null)return gm++,gm},[t])}const _S=lt.memo(t=>{let{adjustScale:s=!1,children:r,dropAnimation:o,style:l,transition:c,modifiers:d,wrapperElement:p="div",className:g,zIndex:m=999}=t;const{activatorEvent:v,active:k,activeNodeRect:y,containerNodeRect:S,draggableNodes:T,droppableContainers:E,dragOverlay:N,over:C,measuringConfiguration:_,scrollableAncestors:H,scrollableAncestorRects:D,windowRect:O}=Ov(),K=x.useContext(Hl),G=CS(k==null?void 0:k.id),z=Mv(d,{activatorEvent:v,active:k,activeNodeRect:y,containerNodeRect:S,draggingNodeRect:N.rect,over:C,overlayNodeRect:N.rect,scrollableAncestors:H,scrollableAncestorRects:D,transform:K,windowRect:O}),J=Pd(y),he=NS({config:o,draggableNodes:T,droppableContainers:E,measuringConfiguration:_}),ae=J?N.setRef:void 0;return lt.createElement(yS,null,lt.createElement(gS,{animation:he},k&&G?lt.createElement(kS,{key:G,id:k.id,ref:ae,as:p,activatorEvent:v,adjustScale:s,className:g,transition:c,rect:J,style:{zIndex:m,...l},transform:z},r):null))});function $v(t,s,r){const o=t.slice();return o.splice(r<0?o.length+r:r,0,o.splice(s,1)[0]),o}function ES(t,s){return t.reduce((r,o,l)=>{const c=s.get(o);return c&&(r[l]=c),r},Array(t.length))}function Ga(t){return t!==null&&t>=0}function RS(t,s){if(t===s)return!0;if(t.length!==s.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==s[r])return!1;return!0}function AS(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const Ka={scaleX:1,scaleY:1},IS=t=>{var s;let{rects:r,activeNodeRect:o,activeIndex:l,overIndex:c,index:d}=t;const p=(s=r[l])!=null?s:o;if(!p)return null;const g=DS(r,d,l);if(d===l){const m=r[c];return m?{x:l<c?m.left+m.width-(p.left+p.width):m.left-p.left,y:0,...Ka}:null}return d>l&&d<=c?{x:-p.width-g,y:0,...Ka}:d<l&&d>=c?{x:p.width+g,y:0,...Ka}:{x:0,y:0,...Ka}};function DS(t,s,r){const o=t[s],l=t[s-1],c=t[s+1];return!o||!l&&!c?0:r<s?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 zv=t=>{let{rects:s,activeIndex:r,overIndex:o,index:l}=t;const c=$v(s,o,r),d=s[l],p=c[l];return!p||!d?null:{x:p.left-d.left,y:p.top-d.top,scaleX:p.width/d.width,scaleY:p.height/d.height}},qa={scaleX:1,scaleY:1},vm=t=>{var s;let{activeIndex:r,activeNodeRect:o,index:l,rects:c,overIndex:d}=t;const p=(s=c[r])!=null?s:o;if(!p)return null;if(l===r){const m=c[d];return m?{x:0,y:r<d?m.top+m.height-(p.top+p.height):m.top-p.top,...qa}:null}const g=MS(c,l,r);return l>r&&l<=d?{x:0,y:-p.height-g,...qa}:l<r&&l>=d?{x:0,y:p.height+g,...qa}:{x:0,y:0,...qa}};function MS(t,s,r){const o=t[s],l=t[s-1],c=t[s+1];return o?r<s?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 Fv="Sortable",Uv=lt.createContext({activeIndex:-1,containerId:Fv,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:zv,disabled:{draggable:!1,droppable:!1}});function rd(t){let{children:s,id:r,items:o,strategy:l=zv,disabled:c=!1}=t;const{active:d,dragOverlay:p,droppableRects:g,over:m,measureDroppableContainers:v}=Ov(),k=$o(Fv,r),y=p.rect!==null,S=x.useMemo(()=>o.map(K=>typeof K=="object"&&"id"in K?K.id:K),[o]),T=d!=null,E=d?S.indexOf(d.id):-1,N=m?S.indexOf(m.id):-1,C=x.useRef(S),_=!RS(S,C.current),H=N!==-1&&E===-1||_,D=AS(c);fs(()=>{_&&T&&v(S)},[_,S,T,v]),x.useEffect(()=>{C.current=S},[S]);const O=x.useMemo(()=>({activeIndex:E,containerId:k,disabled:D,disableTransforms:H,items:S,overIndex:N,useDragOverlay:y,sortedRects:ES(S,g),strategy:l}),[E,k,D.draggable,D.droppable,H,S,N,g,y,l]);return lt.createElement(Uv.Provider,{value:O},s)}const LS=t=>{let{id:s,items:r,activeIndex:o,overIndex:l}=t;return $v(r,o,l).indexOf(s)},OS=t=>{let{containerId:s,isSorting:r,wasDragging:o,index:l,items:c,newIndex:d,previousItems:p,previousContainerId:g,transition:m}=t;return!m||!o||p!==c&&l===d?!1:r?!0:d!==l&&s===g},PS={duration:200,easing:"ease"},Bv="transform",$S=js.Transition.toString({property:Bv,duration:0,easing:"linear"}),zS={roleDescription:"sortable"};function FS(t){let{disabled:s,index:r,node:o,rect:l}=t;const[c,d]=x.useState(null),p=x.useRef(r);return fs(()=>{if(!s&&r!==p.current&&o.current){const g=l.current;if(g){const m=Ei(o.current,{ignoreTransform:!0}),v={x:g.left-m.left,y:g.top-m.top,scaleX:g.width/m.width,scaleY:g.height/m.height};(v.x||v.y)&&d(v)}}r!==p.current&&(p.current=r)},[s,r,o,l]),x.useEffect(()=>{c&&d(null)},[c]),c}function $d(t){let{animateLayoutChanges:s=OS,attributes:r,disabled:o,data:l,getNewIndex:c=LS,id:d,strategy:p,resizeObserverConfig:g,transition:m=PS}=t;const{items:v,containerId:k,activeIndex:y,disabled:S,disableTransforms:T,sortedRects:E,overIndex:N,useDragOverlay:C,strategy:_}=x.useContext(Uv),H=US(o,S),D=v.indexOf(d),O=x.useMemo(()=>({sortable:{containerId:k,index:D,items:v},...l}),[k,l,D,v]),K=x.useMemo(()=>v.slice(v.indexOf(d)),[v,d]),{rect:G,node:z,isOver:J,setNodeRef:he}=Pv({id:d,data:O,disabled:H.droppable,resizeObserverConfig:{updateMeasurementsFor:K,...g}}),{active:ae,activatorEvent:ve,activeNodeRect:we,attributes:Ae,setNodeRef:ee,listeners:ne,isDragging:oe,over:F,setActivatorNodeRef:X,transform:L}=pS({id:d,data:O,attributes:{...zS,...r},disabled:H.draggable}),R=J1(he,ee),$=!!ae,le=$&&!T&&Ga(y)&&Ga(N),me=!C&&oe,Y=me&&le?L:null,Te=le?Y??(p??_)({rects:E,activeNodeRect:we,activeIndex:y,overIndex:N,index:D}):null,se=Ga(y)&&Ga(N)?c({id:d,items:v,activeIndex:y,overIndex:N}):D,pe=ae==null?void 0:ae.id,be=x.useRef({activeId:pe,items:v,newIndex:se,containerId:k}),He=v!==be.current.items,Ee=s({active:ae,containerId:k,isDragging:oe,isSorting:$,id:d,index:D,items:v,newIndex:be.current.newIndex,previousItems:be.current.items,previousContainerId:be.current.containerId,transition:m,wasDragging:be.current.activeId!=null}),ct=FS({disabled:!Ee,index:D,node:z,rect:G});return x.useEffect(()=>{$&&be.current.newIndex!==se&&(be.current.newIndex=se),k!==be.current.containerId&&(be.current.containerId=k),v!==be.current.items&&(be.current.items=v)},[$,se,k,v]),x.useEffect(()=>{if(pe===be.current.activeId)return;if(pe!=null&&be.current.activeId==null){be.current.activeId=pe;return}const en=setTimeout(()=>{be.current.activeId=pe},50);return()=>clearTimeout(en)},[pe]),{active:ae,activeIndex:y,attributes:Ae,data:O,rect:G,index:D,newIndex:se,items:v,isOver:J,isSorting:$,isDragging:oe,listeners:ne,node:z,overIndex:N,over:F,setNodeRef:R,setActivatorNodeRef:X,setDroppableNodeRef:he,setDraggableNodeRef:ee,transform:ct??Te,transition:$e()};function $e(){if(ct||He&&be.current.newIndex===D)return $S;if(!(me&&!Ul(ve)||!m)&&($||Ee))return js.Transition.toString({...m,property:Bv})}}function US(t,s){var r,o;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(r=t==null?void 0:t.draggable)!=null?r:s.draggable,droppable:(o=t==null?void 0:t.droppable)!=null?o:s.droppable}}tt.Down,tt.Right,tt.Up,tt.Left;function Ya(t){const[s,r]=x.useState(()=>{try{const l=localStorage.getItem(t);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=x.useCallback(l=>{r(c=>{const d=l(new Set(c));try{localStorage.setItem(t,JSON.stringify([...d]))}catch{}return d})},[t]);return[s,o]}function BS(t,s=!1){const[r,o]=x.useState(()=>{try{const c=localStorage.getItem(t);return c==="1"?!0:c==="0"?!1:s}catch{return s}}),l=x.useCallback(c=>{o(c);try{localStorage.setItem(t,c?"1":"0")}catch{}},[t]);return[r,l]}async function Io(t){try{return await navigator.clipboard.writeText(t),!0}catch{try{const s=document.createElement("textarea");s.value=t,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select();const r=document.execCommand("copy");return document.body.removeChild(s),r}catch{return!1}}}function WS(t){return t.origin_app_id!=null&&!t.user_touched&&!t.starred}const id="(no directory)";function hr(t){return t.replaceAll("\\","/").replace(/\/+$/,"")}function od(t,s){if(!s||!t.cwd)return!1;const r=hr(t.cwd),o=hr(s);return r.startsWith(`${o}/`)}function HS(t,s){const r=new Map;for(const d of s){const p=d.cwd||id,g=r.get(p)??[];g.push(d),r.set(p,g)}const o=new Set,l=new Set(t.filter(d=>d.deleted===1).map(d=>d.path)),c=[];for(const d of t){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,p]of r)o.has(d)||l.has(d)||c.push({path:d,label:d===id?"Other":d.split("/").pop()||d,sessions:p,workspace:null});return c}function VS(t,s,r){if(s.length===0)return!1;const o=new Set(t.filter(l=>l.deleted===1).map(l=>l.path));return s.some(l=>!od(l,r)&&!o.has(l.cwd||id))}function jl(t){return[...t].sort((s,r)=>r.sort_order-s.sort_order||(s.created_at<r.created_at?1:-1))}function ym(t,s,r,o){const l=s.map(c=>({folder:c,sessions:t.sessions.filter(d=>d.folder_id===c.id),finishedKey:`folder:${c.id}:finished`,hidden:o.has(c.id)}));return l.push({folder:null,sessions:t.sessions.filter(c=>!(c.folder_id&&r.has(c.folder_id))),finishedKey:`${t.path}:finished`,hidden:!1}),l}function xm(t,s){return{working:jl(t.sessions.filter(r=>r.lifecycle!=="finished")),finished:jl(t.sessions.filter(r=>r.lifecycle==="finished")),finishedCollapsed:s.has(t.finishedKey)}}function Xa(t,s){return t.folder_id&&s.has(t.folder_id)?t.folder_id:null}function GS(t){const s=new Set(t.map(o=>o.name));if(!s.has("New Folder"))return"New Folder";let r=2;for(;s.has(`New Folder ${r}`);)r++;return`New Folder ${r}`}function wm({id:t,children:s,className:r}){const{setNodeRef:o,isOver:l}=Pv({id:t});return a.jsx("div",{ref:o,className:`${r??""}${l?" drop-over":""}`,children:s})}function zd({inputRef:t,value:s,onChange:r,onConfirm:o,onCancel:l}){return a.jsx("input",{ref:t,className:"tree-rename-input",value:s,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 KS({s:t,backgroundTaskCount:s,isActive:r,isSelected:o,originApp:l,renaming:c,renameValue:d,renameRef:p,onRenameValue:g,onRenameConfirm:m,onRenameCancel:v,onSelect:k,onCtxMenu:y,onToggleStar:S}){const{attributes:T,listeners:E,setNodeRef:N,transform:C,transition:_,isDragging:H}=$d({id:`s:${t.id}`}),D=Pl(t,s);return a.jsxs("div",{ref:N,style:{transform:js.Transform.toString(C),transition:_},className:`tree-item ${r?"active":""}${o?" selected":""} ${D.isFinished?"tree-item-finished":""}${H?" dragging":""}${t.starred?" tree-item-starred":""}`,...T,...E,onClick:k,onContextMenu:y,children:[a.jsx(Ad,{iconClass:D.iconClass,iconText:D.iconText,size:16}),l&&a.jsx("span",{className:"tree-app-badge",title:"Created by a mini app",children:a.jsx(ji,{iconNode:l.iconNode,size:10})}),c?a.jsx(zd,{inputRef:p,value:d,onChange:g,onConfirm:m,onCancel:v}):a.jsx("span",{className:"tree-label",children:t.title||t.id.slice(0,8)}),!c&&a.jsx("button",{className:`star-btn${t.starred?" starred":""}`,title:t.starred?"Unstar session":"Star session",onClick:O=>{O.stopPropagation(),S()},onPointerDown:O=>O.stopPropagation(),children:a.jsx(xl,{size:10,fill:t.starred?"currentColor":"none"})}),D.dot&&a.jsx(Rd,{status:D.dot,title:D.dotTitle})]})}function qS({folder:t,count:s,collapsed:r,renaming:o,renameValue:l,renameRef:c,onRenameValue:d,onRenameConfirm:p,onRenameCancel:g,onToggle:m,onCtxMenu:v,children:k}){const{attributes:y,listeners:S,setNodeRef:T,transform:E,transition:N,isDragging:C,over:_}=$d({id:`f:${t.id}`}),H=_!=null&&String(_.id).startsWith("s:");return a.jsxs("div",{ref:T,style:{transform:js.Transform.toString(E),transition:N},className:`tree-folder ${r?"collapsed":""}${C?" dragging":""}`,children:[a.jsx("div",{className:`tree-folder-header${H?" drop-over":""}`,...y,...S,onClick:()=>{o||m()},onContextMenu:v,children:o?a.jsx(zd,{inputRef:c,value:l,onChange:d,onConfirm:p,onCancel:g}):a.jsxs(a.Fragment,{children:[a.jsx(Si,{size:8,className:"tree-chevron"}),a.jsx(yl,{size:12}),a.jsx("span",{className:"tree-folder-label",children:t.name}),a.jsx("span",{className:"tree-count",children:s})]})}),!r&&a.jsx("div",{className:"tree-folder-children",children:k})]})}function YS(){const t=I(A=>A.sessions),s=I(A=>A.backgroundTasks),r=I(A=>A.workspaces),o=I(A=>A.folders),l=I(A=>A.activeSessionId),c=I(A=>A.selectSession),d=I(A=>A.deleteSession),p=I(A=>A.removeWorkspace),g=I(A=>A.createSessionInWorkspace),m=I(A=>A.pickAndAddWorkspace),v=I(A=>A.setImportSessionsWorkspace),k=I(A=>A.renameSession),y=I(A=>A.markFinished),S=I(A=>A.markFinishedMany),T=I(A=>A.toggleStar),E=I(A=>A.reopenSession),N=I(A=>A.reopenSessionMany),C=I(A=>A.deleteSessionMany),_=I(A=>A.createSidebarFolder),H=I(A=>A.renameFolder),D=I(A=>A.deleteFolder),O=I(A=>A.applyMoves),K=I(A=>A.reorderFolders),G=I(A=>A.apps),z=I(A=>A.appsRootPath),J=I(A=>A.activeAppTabId),he=I(A=>A.openAppTab),ae=I(A=>A.startAppEdit),ve=I(A=>A.toggleAppPin),we=I(A=>A.deleteApp),Ae=I(A=>A.openAppCatalog),[ee,ne]=Ya("agentpane:sidebar-ws-collapsed"),[oe,F]=Ya("agentpane:sidebar-sub-collapsed"),[X,L]=Ya("agentpane:sidebar-folders-collapsed"),[R,$]=Ya("agentpane:sidebar-app-edits-collapsed"),[le,me]=BS("agentpane:sidebar-hide-auto-sessions"),[Y,fe]=x.useState(null),[Te,se]=x.useState(null),[pe,be]=x.useState(""),[He,Ee]=x.useState(null),[ct,$e]=x.useState(new Set),[en,Fe]=x.useState(null),Ht=x.useRef(null),tn=x.useRef(null),wt=x.useRef(null),jt=x.useRef(!1),zt=vv(gv(Bl,{activationConstraint:{distance:5}}));function Lt(){$e(new Set),Fe(null)}Mo(Ht,()=>fe(null),!!Y),Ni(()=>{fe(null),Lt()},!!Y||ct.size>0),x.useLayoutEffect(()=>{const A=Ht.current;if(!Y||!A)return;const de=8,{offsetWidth:ie,offsetHeight:ke}=A,Le=Y.x+ie>window.innerWidth-de?Math.max(de,Y.x-ie):Y.x,Ke=Y.y+ke>window.innerHeight-de?Math.max(de,Y.y-ke):Y.y;A.style.left=`${Le}px`,A.style.top=`${Ke}px`},[Y]);const q=x.useMemo(()=>new Map(t.map(A=>[A.id,A])),[t]),ge=x.useMemo(()=>new Map(o.map(A=>[A.id,A])),[o]),Ue=x.useMemo(()=>{const A=new Map;for(const de of[...o].sort((ie,ke)=>ie.sort_order-ke.sort_order)){const ie=A.get(de.workspace_path)??[];ie.push(de),A.set(de.workspace_path,ie)}return A},[o]);function nt(A){ne(de=>{const ie=new Set(de);return ie.has(A)?ie.delete(A):ie.add(A),ie})}function mt(A){F(de=>{const ie=new Set(de);return ie.has(A)?ie.delete(A):ie.add(A),ie})}function gt(A){L(de=>{const ie=new Set(de);return ie.has(A)?ie.delete(A):ie.add(A),ie})}function Ct(){me(!le),Lt()}function an(A){$(de=>{const ie=new Set(de);return ie.has(A)?ie.delete(A):ie.add(A),ie})}x.useEffect(()=>{Te&&tn.current&&(tn.current.focus(),tn.current.select())},[Te]),x.useEffect(()=>{var A,de,ie;jt.current||!l||(jt.current=!0,(ie=(de=(A=wt.current)==null?void 0:A.querySelector(".tree-item.active, .sidebar-app-edit-row.active"))==null?void 0:de.scrollIntoView)==null||ie.call(de,{block:"nearest"}))},[l]);function dt(A,de,ie,ke=""){se({kind:A,id:de}),be(ie||ke)}function Dn(){if(Te){const A=pe.trim();A&&(Te.kind==="session"?k(Te.id,A):H(Te.id,A))}se(null)}function Mn(){se(null),be("")}async function hs(A){const de=GS(Ue.get(A)??[]),ie=await _(A,de);ie&&dt("folder",ie.id,ie.name)}function ms(A){const de=String(A.active.id);if(de.startsWith("s:")){const ie=q.get(de.slice(2));ie&&Ee({kind:"session",label:ie.title||ie.id.slice(0,8)})}else if(de.startsWith("f:")){const ie=ge.get(de.slice(2));ie&&Ee({kind:"folder",label:ie.name})}}function ts(A){Ee(null);const{active:de,over:ie}=A;if(!ie)return;const ke=String(de.id),Le=String(ie.id);if(ke.startsWith("s:")){const Ke=q.get(ke.slice(2));if(!Ke)return;const Oe=Ke.cwd||"(no directory)",Ft=Xa(Ke,ge);let On,Be;if(Le.startsWith("f:")){const Ze=ge.get(Le.slice(2));if(!Ze)return;On=Ze.workspace_path,Be=Ze.id}else if(Le.startsWith("s:")){const Ze=q.get(Le.slice(2));if(!Ze)return;On=Ze.cwd||"(no directory)",Be=Xa(Ze,ge)}else if(Le.startsWith("c:")){const Ze=Le.slice(2),Et=Ze.lastIndexOf("|");On=Ze.slice(0,Et);const vs=Ze.slice(Et+1);Be=vs==="root"?null:vs}else return;if(On!==Oe)return;const yn=jl(t.filter(Ze=>(Ze.cwd||"(no directory)")===On&&Xa(Ze,ge)===Be)),Cs=yn.filter(Ze=>Ze.id!==Ke.id);let Bs=Cs.length;if(Le.startsWith("s:")){const Ze=Cs.findIndex(Et=>Et.id===Le.slice(2));Ze>=0&&(Bs=Ze)}const Pn=[...Cs.slice(0,Bs),Ke,...Cs.slice(Bs)],gs=[];if(Be===Ft){if(Pn.length===yn.length&&Pn.every((Ze,Et)=>Ze.id===yn[Et].id))return;Pn.forEach((Ze,Et)=>gs.push({id:Ze.id,folder_id:Be,sort_order:Pn.length-1-Et}))}else{const Ze=jl(t.filter(Et=>(Et.cwd||"(no directory)")===Oe&&Xa(Et,ge)===Ft)).filter(Et=>Et.id!==Ke.id);Ze.forEach((Et,vs)=>gs.push({id:Et.id,folder_id:Ft,sort_order:Ze.length-1-vs})),Pn.forEach((Et,vs)=>gs.push({id:Et.id,folder_id:Be,sort_order:Pn.length-1-vs}))}O(gs);return}if(ke.startsWith("f:")){if(!Le.startsWith("f:"))return;const Ke=ge.get(ke.slice(2)),Oe=ge.get(Le.slice(2));if(!Ke||!Oe||Ke.id===Oe.id||Ke.workspace_path!==Oe.workspace_path)return;const Ft=(Ue.get(Ke.workspace_path)??[]).map(yn=>yn.id),On=Ft.indexOf(Ke.id),Be=Ft.indexOf(Oe.id);Ft.splice(Be,0,...Ft.splice(On,1)),K(Ft)}}const Ln=z?t.filter(A=>!od(A,z)):t,gn=new Set(le?Ln.filter(A=>WS(A)&&A.id!==l).map(A=>A.id):[]),ln=HS(r,gn.size>0?Ln.filter(A=>!gn.has(A.id)):Ln),Vt=x.useMemo(()=>{const A=new Map;if(!z)return A;const de=hr(z);for(const ie of t){if(!od(ie,z))continue;const ke=hr(ie.cwd).slice(de.length+1).split("/")[0],Le=A.get(ke)??[];Le.push(ie),A.set(ke,Le)}return A},[t,z]);function vn(A){return{folder:null,sessions:Vt.get(A)??[],finishedKey:`app:${A}:finished`,hidden:R.has(A)}}const Qe=[],_t=A=>{if(A.hidden)return;const{working:de,finished:ie,finishedCollapsed:ke}=xm(A,oe);Qe.push(...de.map(Le=>Le.id)),ke||Qe.push(...ie.map(Le=>Le.id))};for(const A of ln){if(ee.has(A.path))continue;const de=Ue.get(A.path)??[],ie=new Set(de.map(ke=>ke.id));ym(A,de,ie,X).forEach(_t)}G.forEach(A=>_t(vn(A.id)));const ft=t.filter(A=>ct.has(A.id)),Gt=ft.filter(A=>A.lifecycle!=="finished").map(A=>A.id),vt=ft.filter(A=>A.lifecycle==="finished").map(A=>A.id);function yt(A,de){if(de.metaKey||de.ctrlKey){de.preventDefault(),Fe(A.id),$e(ie=>{const ke=new Set(ie);return ke.has(A.id)?ke.delete(A.id):ke.add(A.id),ke});return}if(de.shiftKey){de.preventDefault();const ie=en??A.id;Fe(ie);const ke=Qe.indexOf(ie),Le=Qe.indexOf(A.id);if(ke>=0&&Le>=0){const[Ke,Oe]=ke<Le?[ke,Le]:[Le,ke];$e(new Set(Qe.slice(Ke,Oe+1)))}return}Lt(),Fe(A.id),c(A.id)}function at(A,de){de.preventDefault();const ie=ct.has(A.id)&&ct.size>1;ct.has(A.id)||($e(new Set),Fe(A.id)),fe({x:de.clientX,y:de.clientY,type:"session",sessionId:A.id,sessionTitle:A.title,sessionLifecycle:A.lifecycle,sessionExternalId:A.external_thread_id,multi:ie})}function Kt(A){var ie;const de=A.origin_app_id?G.find(ke=>ke.id===A.origin_app_id):null;return a.jsx(KS,{s:A,backgroundTaskCount:((ie=s[A.id])==null?void 0:ie.length)??0,isActive:l===A.id,isSelected:ct.has(A.id),originApp:de??null,renaming:(Te==null?void 0:Te.kind)==="session"&&Te.id===A.id,renameValue:pe,renameRef:tn,onRenameValue:be,onRenameConfirm:Dn,onRenameCancel:Mn,onSelect:ke=>yt(A,ke),onToggleStar:()=>T(A.id),onCtxMenu:ke=>at(A,ke)},A.id)}function rt(A){var ie;const de=Pl(A,((ie=s[A.id])==null?void 0:ie.length)??0);return a.jsxs("div",{className:`sidebar-app-edit-row${l===A.id?" active":""}${ct.has(A.id)?" selected":""}${de.isFinished?" tree-item-finished":""}`,title:"App edit session — click to open",onClick:ke=>yt(A,ke),onContextMenu:ke=>at(A,ke),children:[a.jsx(Ad,{iconClass:de.iconClass,iconText:de.iconText,size:14}),(Te==null?void 0:Te.kind)==="session"&&Te.id===A.id?a.jsx(zd,{inputRef:tn,value:pe,onChange:be,onConfirm:Dn,onCancel:Mn}):a.jsx("span",{className:"tree-label",children:A.title||A.id.slice(0,8)}),de.dot&&a.jsx(Rd,{status:de.dot,title:de.dotTitle})]},A.id)}function Ot(A,de="workspace"){const{working:ie,finished:ke,finishedCollapsed:Le}=xm(A,oe),Ke=de==="workspace"?Kt:rt,Oe=a.jsxs(a.Fragment,{children:[ie.length===0&&ke.length===0?a.jsx("div",{className:"tree-empty",children:"No sessions"}):ie.map(Ke),ke.length>0&&a.jsxs("div",{className:`tree-subgroup ${Le?"collapsed":""}`,children:[a.jsxs("div",{className:"tree-subgroup-header",onClick:()=>mt(A.finishedKey),children:[a.jsx(Si,{size:8,className:"tree-chevron"}),a.jsx("span",{className:"tree-subgroup-label",children:"Finished"}),a.jsx("span",{className:"tree-subgroup-count",children:ke.length})]}),!Le&&a.jsx("div",{className:"tree-subgroup-items",children:ke.map(Ke)})]})]});if(de==="app")return Oe;const Ft=[...ie,...ke].map(On=>`s:${On.id}`);return a.jsx(rd,{items:Ft,strategy:vm,children:Oe})}return a.jsxs("div",{className:"ide-sidebar",ref:wt,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${le?" active":""}`,title:le?`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":le?"Show automatic sessions":"Hide automatic sessions","aria-pressed":le,onClick:Ct,children:le?a.jsx(p1,{size:14}):a.jsx(mr,{size:14})}),a.jsx("button",{className:"sidebar-add",title:"Add workspace",onClick:()=>m(),children:a.jsx(fr,{size:14})})]})]}),a.jsxs(Lv,{sensors:zt,collisionDetection:yv,onDragStart:ms,onDragEnd:ts,children:[ln.length===0?a.jsx("div",{className:"empty-state",style:{padding:"16px"},children:"No workspaces yet. Click + to add one."}):ln.map(A=>{const de=ee.has(A.path),ie=Ue.get(A.path)??[],ke=new Set(ie.map(Oe=>Oe.id)),Le=ym(A,ie,ke,X),Ke=Le[Le.length-1];return a.jsxs("div",{className:`tree-section ${de?"collapsed":""}`,children:[a.jsxs("div",{className:"tree-section-header",onClick:()=>nt(A.path),onContextMenu:Oe=>{Oe.preventDefault(),fe({x:Oe.clientX,y:Oe.clientY,type:"workspace",path:A.path})},children:[a.jsx(Si,{size:9,className:"tree-chevron"}),a.jsx(yl,{size:14}),a.jsx("span",{className:"tree-section-label",children:A.label}),a.jsx("button",{className:"tree-section-add",title:"New session in this workspace",onClick:Oe=>{Oe.stopPropagation(),g(A.path)},children:a.jsx(fr,{size:11})}),a.jsx("button",{className:"tree-section-add",title:"New folder in this workspace",onClick:Oe=>{Oe.stopPropagation(),hs(A.path)},children:a.jsx(Pu,{size:11})}),a.jsx("span",{className:"tree-count",children:A.sessions.length})]}),!de&&a.jsxs("div",{className:"tree-children",children:[a.jsx(rd,{items:ie.map(Oe=>`f:${Oe.id}`),strategy:vm,children:Le.filter(Oe=>Oe.folder).map(Oe=>a.jsx(qS,{folder:Oe.folder,count:Oe.sessions.length,collapsed:Oe.hidden,renaming:(Te==null?void 0:Te.kind)==="folder"&&Te.id===Oe.folder.id,renameValue:pe,renameRef:tn,onRenameValue:be,onRenameConfirm:Dn,onRenameCancel:Mn,onToggle:()=>gt(Oe.folder.id),onCtxMenu:Ft=>{Ft.preventDefault(),fe({x:Ft.clientX,y:Ft.clientY,type:"folder",folderId:Oe.folder.id,folderName:Oe.folder.name})},children:a.jsx(wm,{id:`c:${A.path}|${Oe.folder.id}`,children:Ot(Oe)})},Oe.folder.id))}),a.jsx(wm,{id:`c:${A.path}|root`,children:Ot(Ke)})]})]},A.path)}),a.jsx(_S,{children:He&&a.jsxs("div",{className:"drag-overlay",children:[He.kind==="folder"&&a.jsx(yl,{size:12}),a.jsx("span",{children:He.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:()=>Ae(),children:a.jsx(fr,{size:14})})]}),G.length===0&&a.jsx("div",{className:"tree-empty",children:"No apps yet"}),G.map(A=>{const de=vn(A.id),ie=de.sessions.length>0&&!de.hidden;return a.jsxs("div",{className:"sidebar-app-block",children:[a.jsxs("div",{className:`sidebar-app-row${J===A.id?" active":""}`,title:A.description??void 0,onClick:()=>he(A.id),onContextMenu:ke=>{ke.preventDefault(),fe({x:ke.clientX,y:ke.clientY,type:"app",appId:A.id,appPinned:A.pinned})},children:[de.sessions.length>0&&a.jsx("button",{className:`sidebar-app-chevron${ie?"":" closed"}`,title:"Edit sessions of this app",onClick:ke=>{ke.stopPropagation(),an(A.id)},children:a.jsx(Si,{size:10,className:"tree-chevron"})}),a.jsx(ji,{iconNode:A.iconNode,size:14,className:"sidebar-app-icon"}),a.jsx("span",{className:"tree-label",children:A.title}),de.sessions.length>0&&a.jsx("span",{className:"sidebar-app-count",children:de.sessions.length}),A.pinned&&a.jsx(xl,{size:10,className:"sidebar-app-pin",fill:"currentColor"})]}),ie&&a.jsx("div",{className:"sidebar-app-edits",children:Ot(de,"app")})]},A.id)})]}),a.jsxs("div",{className:"sidebar-footer",onClick:()=>m(),children:[a.jsx(Pu,{size:14}),a.jsx("span",{children:"Add workspace"})]}),Y&&a.jsxs("div",{ref:Ht,className:"ctx-menu",style:{position:"fixed",left:Y.x,top:Y.y,zIndex:500},children:[Y.type==="workspace"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{g(Y.path),fe(null)},children:[a.jsx(fr,{size:12})," New Session"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{hs(Y.path),fe(null)},children:[a.jsx(Pu,{size:12})," New Folder"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{v(Y.path),fe(null)},children:[a.jsx(sv,{size:12})," Import Claude Code Sessions…"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{p(Y.path),fe(null)},children:[a.jsx(us,{size:12})," Hide Workspace"]})]}),Y.type==="folder"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{dt("folder",Y.folderId,Y.folderName??""),fe(null)},children:[a.jsx(ol,{size:12})," Rename Folder"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{D(Y.folderId),fe(null)},children:[a.jsx(us,{size:12})," Delete Folder"]})]}),Y.type==="session"&&!Y.multi&&a.jsx(a.Fragment,{children:Y.sessionLifecycle!=="finished"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{dt("session",Y.sessionId,Y.sessionTitle??""),fe(null)},children:[a.jsx(ol,{size:12})," Rename"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{y(Y.sessionId),fe(null)},children:[a.jsx(vl,{size:12})," Mark as Finished"]}),a.jsxs("div",{className:`ctx-menu-item${Y.sessionExternalId?"":" ctx-disabled"}`,title:Y.sessionExternalId?void 0:"Session not started",onClick:()=>{Y.sessionExternalId&&(Io(Y.sessionExternalId),fe(null))},children:[a.jsx(_o,{size:12})," Copy Session ID"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{d(Y.sessionId),fe(null)},children:[a.jsx(us,{size:12})," Delete Session"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{E(Y.sessionId),fe(null)},children:[a.jsx(Eo,{size:12})," Reopen"]}),a.jsxs("div",{className:`ctx-menu-item${Y.sessionExternalId?"":" ctx-disabled"}`,title:Y.sessionExternalId?void 0:"Session not started",onClick:()=>{Y.sessionExternalId&&(Io(Y.sessionExternalId),fe(null))},children:[a.jsx(_o,{size:12})," Copy Session ID"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{d(Y.sessionId),fe(null)},children:[a.jsx(us,{size:12})," Delete Session"]})]})}),Y.type==="session"&&Y.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),fe(null),Lt()},children:[a.jsx(vl,{size:12})," Mark ",Gt.length," as Finished"]}),vt.length>0&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{N(vt),fe(null),Lt()},children:[a.jsx(Eo,{size:12})," Reopen ",vt.length]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{C([...ct]),fe(null),Lt()},children:[a.jsx(us,{size:12})," Delete ",ft.length," Sessions"]})]}),Y.type==="app"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{ae(Y.appId),fe(null)},children:[a.jsx(ol,{size:12})," Edit App"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{ve(Y.appId),fe(null)},children:[a.jsx(xl,{size:12})," ",Y.appPinned?"Unpin":"Pin"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{we(Y.appId),fe(null)},children:[a.jsx(us,{size:12})," Delete App"]})]})]})]})}const Qa=4,XS=({transform:t})=>({...t,y:0});function km({tabKey:t,title:s,active:r,icon:o,badge:l,onSelect:c,onClose:d,onMenu:p}){const{attributes:g,listeners:m,setNodeRef:v,transform:k,transition:y,isDragging:S}=$d({id:t});return a.jsxs("div",{ref:v,style:{transform:js.Translate.toString(k),transition:y},className:`ide-tab ${r?"active":""} ${S?"dragging":""}`,title:s,...g,...m,onClick:c,onMouseDown:T=>{T.button===1&&T.preventDefault()},onAuxClick:T=>{T.button===1&&d()},onContextMenu:T=>{T.preventDefault(),T.stopPropagation(),p(T.clientX,T.clientY)},children:[o,s,l,a.jsx("span",{className:"ide-tab-close",onClick:T=>{T.stopPropagation(),d()},children:a.jsx(Tn,{size:12})})]})}function QS({menu:t,tabs:s,onDone:r}){const o=I(k=>k.closeTabs),l=I(k=>k.reopenClosedTab),c=I(k=>k.closedTabs.some(y=>Lg(k,y.key))),d=x.useRef(null),[p,g]=x.useState({left:t.x,top:t.y});Mo(d,r,!0),Ni(r,!0),x.useLayoutEffect(()=>{if(!d.current)return;const{width:k,height:y}=d.current.getBoundingClientRect();g({left:Math.max(Qa,Math.min(t.x,window.innerWidth-k-Qa)),top:Math.max(Qa,Math.min(t.y,window.innerHeight-y-Qa))})},[t.x,t.y]);const m=t.key!==null&&s.includes(t.key)?t.key:null,v=(k,y,S=!1)=>a.jsx("div",{role:"menuitem","aria-disabled":S,className:`ctx-menu-item ${S?"ctx-disabled":""}`,onClick:()=>{S||(y(),r())},children:k});return a.jsxs("div",{ref:d,role:"menu",className:"ctx-menu",style:{position:"fixed",...p,zIndex:500},children:[m!==null&&a.jsxs(a.Fragment,{children:[v("Close",()=>o([m])),v("Close Others",()=>o(s.filter(k=>k!==m)),s.length<2),v("Close to the Right",()=>o(s.slice(s.indexOf(m)+1)),s.at(-1)===m),v("Close All",()=>o(s))]}),v("Reopen Closed Tab",l,!c)]})}function ZS(){const t=I(O=>O.tabOrder),s=I(O=>O.activeSessionId),r=I(O=>O.sessions),o=I(O=>O.backgroundTasks),l=I(O=>O.selectSession),c=I(O=>O.closeTab),d=I(O=>O.setShowNewSessionDialog),p=I(O=>O.apps),g=I(O=>O.activeAppTabId),m=I(O=>O.openAppTab),v=I(O=>O.closeAppTab),k=I(O=>O.moveTab),[y,S]=x.useState(null),T=x.useRef(null),E=vv(gv(Bl,{activationConstraint:{distance:5}})),N=Sd({activeSessionId:s,activeAppTabId:g});x.useEffect(()=>{var O,K,G;(G=(K=(O=T.current)==null?void 0:O.querySelector(".ide-tab.active"))==null?void 0:K.scrollIntoView)==null||G.call(K,{block:"nearest",inline:"nearest"})},[N]);const C=t.filter(O=>{const{kind:K,id:G}=pr(O);return K==="app"||r.some(z=>z.id===G)}),_=({active:O,over:K})=>{K&&k(String(O.id),String(K.id))},H=O=>{O.preventDefault(),S({x:O.clientX,y:O.clientY,key:null})},D=O=>{var ae;const{kind:K,id:G}=pr(O),z=(ve,we)=>S({x:ve,y:we,key:O});if(K==="app"){const ve=p.find(we=>we.id===G);return a.jsx(km,{tabKey:O,title:(ve==null?void 0:ve.title)??G,active:g===G,icon:a.jsx(ji,{iconNode:ve==null?void 0:ve.iconNode,size:12,className:"miniapp-tab-icon"}),onSelect:()=>m(G),onClose:()=>v(G),onMenu:z},O)}const J=r.find(ve=>ve.id===G);if(!J)return null;const he=Pl(J,((ae=o[G])==null?void 0:ae.length)??0);return a.jsx(km,{tabKey:O,title:J.title||G.slice(0,8),active:s===G&&g==null,icon:a.jsx(Ad,{iconClass:he.iconClass,iconText:he.iconText,size:14}),badge:he.dot&&a.jsx(Rd,{status:he.dot,title:he.dotTitle}),onSelect:()=>void l(G),onClose:()=>c(G),onMenu:z},O)};return a.jsxs(Lv,{sensors:E,collisionDetection:yv,modifiers:[XS],onDragEnd:_,children:[a.jsx(rd,{items:C,strategy:IS,children:a.jsxs("div",{ref:T,className:"ide-tabs",onContextMenu:H,onWheel:O=>{O.deltaX===0&&(O.currentTarget.scrollLeft+=O.deltaY)},children:[C.map(D),a.jsx("div",{className:"ide-tab-add",title:"New Session",onClick:()=>d(!0),children:a.jsx(fr,{size:14})})]})}),y&&a.jsx(QS,{menu:y,tabs:C,onDone:()=>S(null)})]})}function Fd(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ur=Fd();function Wv(t){Ur=t}var So={exec:()=>null};function st(t,s=""){let r=typeof t=="string"?t:t.source;const o={replace:(l,c)=>{let d=typeof c=="string"?c:c.source;return d=d.replace(bn.caret,"$1"),r=r.replace(l,d),o},getRegex:()=>new RegExp(r,s)};return o}var bn={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:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},JS=/^(?:[ \t]*(?:\n|$))+/,eb=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,tb=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Fo=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,nb=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ud=/(?:[*+-]|\d{1,9}[.)])/,Hv=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Vv=st(Hv).replace(/bull/g,Ud).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(),sb=st(Hv).replace(/bull/g,Ud).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(),Bd=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,rb=/^[^\n]+/,Wd=/(?!\s*\])(?:\\.|[^\[\]\\])+/,ib=st(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Wd).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ob=st(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ud).getRegex(),Vl="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",Hd=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ab=st("^ {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",Hd).replace("tag",Vl).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Gv=st(Bd).replace("hr",Fo).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",Vl).getRegex(),lb=st(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Gv).getRegex(),Vd={blockquote:lb,code:eb,def:ib,fences:tb,heading:nb,hr:Fo,html:ab,lheading:Vv,list:ob,newline:JS,paragraph:Gv,table:So,text:rb},Sm=st("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Fo).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",Vl).getRegex(),cb={...Vd,lheading:sb,table:Sm,paragraph:st(Bd).replace("hr",Fo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Sm).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",Vl).getRegex()},ub={...Vd,html:st(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Hd).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:So,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:st(Bd).replace("hr",Fo).replace("heading",` *#{1,6} *[^
445
- ]`).replace("lheading",Vv).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},db=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,fb=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Kv=/^( {2,}|\\)\n(?!\s*$)/,pb=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Gl=/[\p{P}\p{S}]/u,Gd=/[\s\p{P}\p{S}]/u,qv=/[^\s\p{P}\p{S}]/u,hb=st(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Gd).getRegex(),Yv=/(?!~)[\p{P}\p{S}]/u,mb=/(?!~)[\s\p{P}\p{S}]/u,gb=/(?:[^\s\p{P}\p{S}]|~)/u,vb=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Xv=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,yb=st(Xv,"u").replace(/punct/g,Gl).getRegex(),xb=st(Xv,"u").replace(/punct/g,Yv).getRegex(),Qv="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",wb=st(Qv,"gu").replace(/notPunctSpace/g,qv).replace(/punctSpace/g,Gd).replace(/punct/g,Gl).getRegex(),kb=st(Qv,"gu").replace(/notPunctSpace/g,gb).replace(/punctSpace/g,mb).replace(/punct/g,Yv).getRegex(),Sb=st("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,qv).replace(/punctSpace/g,Gd).replace(/punct/g,Gl).getRegex(),bb=st(/\\(punct)/,"gu").replace(/punct/g,Gl).getRegex(),Tb=st(/^<(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(),Nb=st(Hd).replace("(?:-->|$)","-->").getRegex(),jb=st("^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",Nb).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Cl=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Cb=st(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Cl).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Zv=st(/^!?\[(label)\]\[(ref)\]/).replace("label",Cl).replace("ref",Wd).getRegex(),Jv=st(/^!?\[(ref)\](?:\[\])?/).replace("ref",Wd).getRegex(),_b=st("reflink|nolink(?!\\()","g").replace("reflink",Zv).replace("nolink",Jv).getRegex(),Kd={_backpedal:So,anyPunctuation:bb,autolink:Tb,blockSkip:vb,br:Kv,code:fb,del:So,emStrongLDelim:yb,emStrongRDelimAst:wb,emStrongRDelimUnd:Sb,escape:db,link:Cb,nolink:Jv,punctuation:hb,reflink:Zv,reflinkSearch:_b,tag:jb,text:pb,url:So},Eb={...Kd,link:st(/^!?\[(label)\]\((.*?)\)/).replace("label",Cl).getRegex(),reflink:st(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Cl).getRegex()},ad={...Kd,emStrongRDelimAst:kb,emStrongLDelim:xb,url:st(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},Rb={...ad,br:st(Kv).replace("{2,}","*").getRegex(),text:st(ad.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Za={normal:Vd,gfm:cb,pedantic:ub},uo={normal:Kd,gfm:ad,breaks:Rb,pedantic:Eb},Ab={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},bm=t=>Ab[t];function Ts(t,s){if(s){if(bn.escapeTest.test(t))return t.replace(bn.escapeReplace,bm)}else if(bn.escapeTestNoEncode.test(t))return t.replace(bn.escapeReplaceNoEncode,bm);return t}function Tm(t){try{t=encodeURI(t).replace(bn.percentDecode,"%")}catch{return null}return t}function Nm(t,s){var c;const r=t.replace(bn.findPipe,(d,p,g)=>{let m=!1,v=p;for(;--v>=0&&g[v]==="\\";)m=!m;return m?"|":" |"}),o=r.split(bn.splitPipe);let l=0;if(o[0].trim()||o.shift(),o.length>0&&!((c=o.at(-1))!=null&&c.trim())&&o.pop(),s)if(o.length>s)o.splice(s);else for(;o.length<s;)o.push("");for(;l<o.length;l++)o[l]=o[l].trim().replace(bn.slashPipe,"|");return o}function fo(t,s,r){const o=t.length;if(o===0)return"";let l=0;for(;l<o&&t.charAt(o-l-1)===s;)l++;return t.slice(0,o-l)}function Ib(t,s){if(t.indexOf(s[1])===-1)return-1;let r=0;for(let o=0;o<t.length;o++)if(t[o]==="\\")o++;else if(t[o]===s[0])r++;else if(t[o]===s[1]&&(r--,r<0))return o;return r>0?-2:-1}function jm(t,s,r,o,l){const c=s.href,d=s.title||null,p=t[1].replace(l.other.outputLinkReplace,"$1");o.state.inLink=!0;const g={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:c,title:d,text:p,tokens:o.inlineTokens(p)};return o.state.inLink=!1,g}function Db(t,s,r){const o=t.match(r.other.indentCodeCompensation);if(o===null)return s;const l=o[1];return s.split(`
446
- `).map(c=>{const d=c.match(r.other.beginningSpace);if(d===null)return c;const[p]=d;return p.length>=l.length?c.slice(l.length):c}).join(`
447
- `)}var _l=class{constructor(t){it(this,"options");it(this,"rules");it(this,"lexer");this.options=t||Ur}space(t){const s=this.rules.block.newline.exec(t);if(s&&s[0].length>0)return{type:"space",raw:s[0]}}code(t){const s=this.rules.block.code.exec(t);if(s){const r=s[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:s[0],codeBlockStyle:"indented",text:this.options.pedantic?r:fo(r,`
448
- `)}}}fences(t){const s=this.rules.block.fences.exec(t);if(s){const r=s[0],o=Db(r,s[3]||"",this.rules);return{type:"code",raw:r,lang:s[2]?s[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):s[2],text:o}}}heading(t){const s=this.rules.block.heading.exec(t);if(s){let r=s[2].trim();if(this.rules.other.endingHash.test(r)){const o=fo(r,"#");(this.options.pedantic||!o||this.rules.other.endingSpaceChar.test(o))&&(r=o.trim())}return{type:"heading",raw:s[0],depth:s[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){const s=this.rules.block.hr.exec(t);if(s)return{type:"hr",raw:fo(s[0],`
449
- `)}}blockquote(t){const s=this.rules.block.blockquote.exec(t);if(s){let r=fo(s[0],`
450
- `).split(`
451
- `),o="",l="";const c=[];for(;r.length>0;){let d=!1;const p=[];let g;for(g=0;g<r.length;g++)if(this.rules.other.blockquoteStart.test(r[g]))p.push(r[g]),d=!0;else if(!d)p.push(r[g]);else break;r=r.slice(g);const m=p.join(`
452
- `),v=m.replace(this.rules.other.blockquoteSetextReplace,`
453
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");o=o?`${o}
454
- ${m}`:m,l=l?`${l}
455
- ${v}`:v;const k=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(v,c,!0),this.lexer.state.top=k,r.length===0)break;const y=c.at(-1);if((y==null?void 0:y.type)==="code")break;if((y==null?void 0:y.type)==="blockquote"){const S=y,T=S.raw+`
456
- `+r.join(`
457
- `),E=this.blockquote(T);c[c.length-1]=E,o=o.substring(0,o.length-S.raw.length)+E.raw,l=l.substring(0,l.length-S.text.length)+E.text;break}else if((y==null?void 0:y.type)==="list"){const S=y,T=S.raw+`
458
- `+r.join(`
459
- `),E=this.list(T);c[c.length-1]=E,o=o.substring(0,o.length-y.raw.length)+E.raw,l=l.substring(0,l.length-S.raw.length)+E.raw,r=T.substring(c.at(-1).raw.length).split(`
460
- `);continue}}return{type:"blockquote",raw:o,tokens:c,text:l}}}list(t){let s=this.rules.block.list.exec(t);if(s){let r=s[1].trim();const o=r.length>1,l={type:"list",raw:"",ordered:o,start:o?+r.slice(0,-1):"",loose:!1,items:[]};r=o?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=o?r:"[*+-]");const c=this.rules.other.listItemRegex(r);let d=!1;for(;t;){let g=!1,m="",v="";if(!(s=c.exec(t))||this.rules.block.hr.test(t))break;m=s[0],t=t.substring(m.length);let k=s[2].split(`
461
- `,1)[0].replace(this.rules.other.listReplaceTabs,C=>" ".repeat(3*C.length)),y=t.split(`
462
- `,1)[0],S=!k.trim(),T=0;if(this.options.pedantic?(T=2,v=k.trimStart()):S?T=s[1].length+1:(T=s[2].search(this.rules.other.nonSpaceChar),T=T>4?1:T,v=k.slice(T),T+=s[1].length),S&&this.rules.other.blankLine.test(y)&&(m+=y+`
463
- `,t=t.substring(y.length+1),g=!0),!g){const C=this.rules.other.nextBulletRegex(T),_=this.rules.other.hrRegex(T),H=this.rules.other.fencesBeginRegex(T),D=this.rules.other.headingBeginRegex(T),O=this.rules.other.htmlBeginRegex(T);for(;t;){const K=t.split(`
464
- `,1)[0];let G;if(y=K,this.options.pedantic?(y=y.replace(this.rules.other.listReplaceNesting," "),G=y):G=y.replace(this.rules.other.tabCharGlobal," "),H.test(y)||D.test(y)||O.test(y)||C.test(y)||_.test(y))break;if(G.search(this.rules.other.nonSpaceChar)>=T||!y.trim())v+=`
465
- `+G.slice(T);else{if(S||k.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||H.test(k)||D.test(k)||_.test(k))break;v+=`
466
- `+y}!S&&!y.trim()&&(S=!0),m+=K+`
467
- `,t=t.substring(K.length+1),k=G.slice(T)}}l.loose||(d?l.loose=!0:this.rules.other.doubleBlankLine.test(m)&&(d=!0));let E=null,N;this.options.gfm&&(E=this.rules.other.listIsTask.exec(v),E&&(N=E[0]!=="[ ] ",v=v.replace(this.rules.other.listReplaceTask,""))),l.items.push({type:"list_item",raw:m,task:!!E,checked:N,loose:!1,text:v,tokens:[]}),l.raw+=m}const p=l.items.at(-1);if(p)p.raw=p.raw.trimEnd(),p.text=p.text.trimEnd();else return;l.raw=l.raw.trimEnd();for(let g=0;g<l.items.length;g++)if(this.lexer.state.top=!1,l.items[g].tokens=this.lexer.blockTokens(l.items[g].text,[]),!l.loose){const m=l.items[g].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 g=0;g<l.items.length;g++)l.items[g].loose=!0;return l}}html(t){const s=this.rules.block.html.exec(t);if(s)return{type:"html",block:!0,raw:s[0],pre:s[1]==="pre"||s[1]==="script"||s[1]==="style",text:s[0]}}def(t){const s=this.rules.block.def.exec(t);if(s){const r=s[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),o=s[2]?s[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",l=s[3]?s[3].substring(1,s[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):s[3];return{type:"def",tag:r,raw:s[0],href:o,title:l}}}table(t){var d;const s=this.rules.block.table.exec(t);if(!s||!this.rules.other.tableDelimiter.test(s[2]))return;const r=Nm(s[1]),o=s[2].replace(this.rules.other.tableAlignChars,"").split("|"),l=(d=s[3])!=null&&d.trim()?s[3].replace(this.rules.other.tableRowBlankLine,"").split(`
468
- `):[],c={type:"table",raw:s[0],header:[],align:[],rows:[]};if(r.length===o.length){for(const p of o)this.rules.other.tableAlignRight.test(p)?c.align.push("right"):this.rules.other.tableAlignCenter.test(p)?c.align.push("center"):this.rules.other.tableAlignLeft.test(p)?c.align.push("left"):c.align.push(null);for(let p=0;p<r.length;p++)c.header.push({text:r[p],tokens:this.lexer.inline(r[p]),header:!0,align:c.align[p]});for(const p of l)c.rows.push(Nm(p,c.header.length).map((g,m)=>({text:g,tokens:this.lexer.inline(g),header:!1,align:c.align[m]})));return c}}lheading(t){const s=this.rules.block.lheading.exec(t);if(s)return{type:"heading",raw:s[0],depth:s[2].charAt(0)==="="?1:2,text:s[1],tokens:this.lexer.inline(s[1])}}paragraph(t){const s=this.rules.block.paragraph.exec(t);if(s){const r=s[1].charAt(s[1].length-1)===`
469
- `?s[1].slice(0,-1):s[1];return{type:"paragraph",raw:s[0],text:r,tokens:this.lexer.inline(r)}}}text(t){const s=this.rules.block.text.exec(t);if(s)return{type:"text",raw:s[0],text:s[0],tokens:this.lexer.inline(s[0])}}escape(t){const s=this.rules.inline.escape.exec(t);if(s)return{type:"escape",raw:s[0],text:s[1]}}tag(t){const s=this.rules.inline.tag.exec(t);if(s)return!this.lexer.state.inLink&&this.rules.other.startATag.test(s[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(s[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(s[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(s[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:s[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:s[0]}}link(t){const s=this.rules.inline.link.exec(t);if(s){const r=s[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;const c=fo(r.slice(0,-1),"\\");if((r.length-c.length)%2===0)return}else{const c=Ib(s[2],"()");if(c===-2)return;if(c>-1){const p=(s[0].indexOf("!")===0?5:4)+s[1].length+c;s[2]=s[2].substring(0,c),s[0]=s[0].substring(0,p).trim(),s[3]=""}}let o=s[2],l="";if(this.options.pedantic){const c=this.rules.other.pedanticHrefTitle.exec(o);c&&(o=c[1],l=c[3])}else l=s[3]?s[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)),jm(s,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:l&&l.replace(this.rules.inline.anyPunctuation,"$1")},s[0],this.lexer,this.rules)}}reflink(t,s){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){const o=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),l=s[o.toLowerCase()];if(!l){const c=r[0].charAt(0);return{type:"text",raw:c,text:c}}return jm(r,l,r[0],this.lexer,this.rules)}}emStrong(t,s,r=""){let o=this.rules.inline.emStrongLDelim.exec(t);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,p,g=c,m=0;const v=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(v.lastIndex=0,s=s.slice(-1*t.length+c);(o=v.exec(s))!=null;){if(d=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!d)continue;if(p=[...d].length,o[3]||o[4]){g+=p;continue}else if((o[5]||o[6])&&c%3&&!((c+p)%3)){m+=p;continue}if(g-=p,g>0)continue;p=Math.min(p,p+g+m);const k=[...o[0]][0].length,y=t.slice(0,c+o.index+k+p);if(Math.min(c,p)%2){const T=y.slice(1,-1);return{type:"em",raw:y,text:T,tokens:this.lexer.inlineTokens(T)}}const S=y.slice(2,-2);return{type:"strong",raw:y,text:S,tokens:this.lexer.inlineTokens(S)}}}}codespan(t){const s=this.rules.inline.code.exec(t);if(s){let r=s[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:s[0],text:r}}}br(t){const s=this.rules.inline.br.exec(t);if(s)return{type:"br",raw:s[0]}}del(t){const s=this.rules.inline.del.exec(t);if(s)return{type:"del",raw:s[0],text:s[2],tokens:this.lexer.inlineTokens(s[2])}}autolink(t){const s=this.rules.inline.autolink.exec(t);if(s){let r,o;return s[2]==="@"?(r=s[1],o="mailto:"+r):(r=s[1],o=r),{type:"link",raw:s[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}url(t){var r;let s;if(s=this.rules.inline.url.exec(t)){let o,l;if(s[2]==="@")o=s[0],l="mailto:"+o;else{let c;do c=s[0],s[0]=((r=this.rules.inline._backpedal.exec(s[0]))==null?void 0:r[0])??"";while(c!==s[0]);o=s[0],s[1]==="www."?l="http://"+s[0]:l=s[0]}return{type:"link",raw:s[0],text:o,href:l,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(t){const s=this.rules.inline.text.exec(t);if(s){const r=this.lexer.state.inRawBlock;return{type:"text",raw:s[0],text:s[0],escaped:r}}}},$s=class ld{constructor(s){it(this,"tokens");it(this,"options");it(this,"state");it(this,"tokenizer");it(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=s||Ur,this.options.tokenizer=this.options.tokenizer||new _l,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:bn,block:Za.normal,inline:uo.normal};this.options.pedantic?(r.block=Za.pedantic,r.inline=uo.pedantic):this.options.gfm&&(r.block=Za.gfm,this.options.breaks?r.inline=uo.breaks:r.inline=uo.gfm),this.tokenizer.rules=r}static get rules(){return{block:Za,inline:uo}}static lex(s,r){return new ld(r).lex(s)}static lexInline(s,r){return new ld(r).inlineTokens(s)}lex(s){s=s.replace(bn.carriageReturn,`
470
- `),this.blockTokens(s,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(s,r=[],o=!1){var l,c,d;for(this.options.pedantic&&(s=s.replace(bn.tabCharGlobal," ").replace(bn.spaceLine,""));s;){let p;if((c=(l=this.options.extensions)==null?void 0:l.block)!=null&&c.some(m=>(p=m.call({lexer:this},s,r))?(s=s.substring(p.raw.length),r.push(p),!0):!1))continue;if(p=this.tokenizer.space(s)){s=s.substring(p.raw.length);const m=r.at(-1);p.raw.length===1&&m!==void 0?m.raw+=`
471
- `:r.push(p);continue}if(p=this.tokenizer.code(s)){s=s.substring(p.raw.length);const m=r.at(-1);(m==null?void 0:m.type)==="paragraph"||(m==null?void 0:m.type)==="text"?(m.raw+=`
472
- `+p.raw,m.text+=`
473
- `+p.text,this.inlineQueue.at(-1).src=m.text):r.push(p);continue}if(p=this.tokenizer.fences(s)){s=s.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.heading(s)){s=s.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.hr(s)){s=s.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.blockquote(s)){s=s.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.list(s)){s=s.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.html(s)){s=s.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.def(s)){s=s.substring(p.raw.length);const m=r.at(-1);(m==null?void 0:m.type)==="paragraph"||(m==null?void 0:m.type)==="text"?(m.raw+=`
474
- `+p.raw,m.text+=`
475
- `+p.raw,this.inlineQueue.at(-1).src=m.text):this.tokens.links[p.tag]||(this.tokens.links[p.tag]={href:p.href,title:p.title});continue}if(p=this.tokenizer.table(s)){s=s.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.lheading(s)){s=s.substring(p.raw.length),r.push(p);continue}let g=s;if((d=this.options.extensions)!=null&&d.startBlock){let m=1/0;const v=s.slice(1);let k;this.options.extensions.startBlock.forEach(y=>{k=y.call({lexer:this},v),typeof k=="number"&&k>=0&&(m=Math.min(m,k))}),m<1/0&&m>=0&&(g=s.substring(0,m+1))}if(this.state.top&&(p=this.tokenizer.paragraph(g))){const m=r.at(-1);o&&(m==null?void 0:m.type)==="paragraph"?(m.raw+=`
476
- `+p.raw,m.text+=`
477
- `+p.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):r.push(p),o=g.length!==s.length,s=s.substring(p.raw.length);continue}if(p=this.tokenizer.text(s)){s=s.substring(p.raw.length);const m=r.at(-1);(m==null?void 0:m.type)==="text"?(m.raw+=`
478
- `+p.raw,m.text+=`
479
- `+p.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):r.push(p);continue}if(s){const m="Infinite loop on byte: "+s.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return this.state.top=!0,r}inline(s,r=[]){return this.inlineQueue.push({src:s,tokens:r}),r}inlineTokens(s,r=[]){var p,g,m;let o=s,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(;s;){c||(d=""),c=!1;let v;if((g=(p=this.options.extensions)==null?void 0:p.inline)!=null&&g.some(y=>(v=y.call({lexer:this},s,r))?(s=s.substring(v.raw.length),r.push(v),!0):!1))continue;if(v=this.tokenizer.escape(s)){s=s.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.tag(s)){s=s.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.link(s)){s=s.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.reflink(s,this.tokens.links)){s=s.substring(v.raw.length);const y=r.at(-1);v.type==="text"&&(y==null?void 0:y.type)==="text"?(y.raw+=v.raw,y.text+=v.text):r.push(v);continue}if(v=this.tokenizer.emStrong(s,o,d)){s=s.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.codespan(s)){s=s.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.br(s)){s=s.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.del(s)){s=s.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.autolink(s)){s=s.substring(v.raw.length),r.push(v);continue}if(!this.state.inLink&&(v=this.tokenizer.url(s))){s=s.substring(v.raw.length),r.push(v);continue}let k=s;if((m=this.options.extensions)!=null&&m.startInline){let y=1/0;const S=s.slice(1);let T;this.options.extensions.startInline.forEach(E=>{T=E.call({lexer:this},S),typeof T=="number"&&T>=0&&(y=Math.min(y,T))}),y<1/0&&y>=0&&(k=s.substring(0,y+1))}if(v=this.tokenizer.inlineText(k)){s=s.substring(v.raw.length),v.raw.slice(-1)!=="_"&&(d=v.raw.slice(-1)),c=!0;const y=r.at(-1);(y==null?void 0:y.type)==="text"?(y.raw+=v.raw,y.text+=v.text):r.push(v);continue}if(s){const y="Infinite loop on byte: "+s.charCodeAt(0);if(this.options.silent){console.error(y);break}else throw new Error(y)}}return r}},El=class{constructor(t){it(this,"options");it(this,"parser");this.options=t||Ur}space(t){return""}code({text:t,lang:s,escaped:r}){var c;const o=(c=(s||"").match(bn.notSpaceStart))==null?void 0:c[0],l=t.replace(bn.endingNewline,"")+`
480
- `;return o?'<pre><code class="language-'+Ts(o)+'">'+(r?l:Ts(l,!0))+`</code></pre>
481
- `:"<pre><code>"+(r?l:Ts(l,!0))+`</code></pre>
482
- `}blockquote({tokens:t}){return`<blockquote>
483
- ${this.parser.parse(t)}</blockquote>
484
- `}html({text:t}){return t}heading({tokens:t,depth:s}){return`<h${s}>${this.parser.parseInline(t)}</h${s}>
485
- `}hr(t){return`<hr>
486
- `}list(t){const s=t.ordered,r=t.start;let o="";for(let d=0;d<t.items.length;d++){const p=t.items[d];o+=this.listitem(p)}const l=s?"ol":"ul",c=s&&r!==1?' start="'+r+'"':"";return"<"+l+c+`>
487
- `+o+"</"+l+`>
488
- `}listitem(t){var r;let s="";if(t.task){const o=this.checkbox({checked:!!t.checked});t.loose?((r=t.tokens[0])==null?void 0:r.type)==="paragraph"?(t.tokens[0].text=o+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=o+" "+Ts(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:o+" ",text:o+" ",escaped:!0}):s+=o+" "}return s+=this.parser.parse(t.tokens,!!t.loose),`<li>${s}</li>
489
- `}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
490
- `}table(t){let s="",r="";for(let l=0;l<t.header.length;l++)r+=this.tablecell(t.header[l]);s+=this.tablerow({text:r});let o="";for(let l=0;l<t.rows.length;l++){const c=t.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>
491
- <thead>
492
- `+s+`</thead>
493
- `+o+`</table>
494
- `}tablerow({text:t}){return`<tr>
495
- ${t}</tr>
496
- `}tablecell(t){const s=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+s+`</${r}>
497
- `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Ts(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:s,tokens:r}){const o=this.parser.parseInline(r),l=Tm(t);if(l===null)return o;t=l;let c='<a href="'+t+'"';return s&&(c+=' title="'+Ts(s)+'"'),c+=">"+o+"</a>",c}image({href:t,title:s,text:r,tokens:o}){o&&(r=this.parser.parseInline(o,this.parser.textRenderer));const l=Tm(t);if(l===null)return Ts(r);t=l;let c=`<img src="${t}" alt="${r}"`;return s&&(c+=` title="${Ts(s)}"`),c+=">",c}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Ts(t.text)}},qd=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},zs=class cd{constructor(s){it(this,"options");it(this,"renderer");it(this,"textRenderer");this.options=s||Ur,this.options.renderer=this.options.renderer||new El,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new qd}static parse(s,r){return new cd(r).parse(s)}static parseInline(s,r){return new cd(r).parseInline(s)}parse(s,r=!0){var l,c;let o="";for(let d=0;d<s.length;d++){const p=s[d];if((c=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&c[p.type]){const m=p,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 g=p;switch(g.type){case"space":{o+=this.renderer.space(g);continue}case"hr":{o+=this.renderer.hr(g);continue}case"heading":{o+=this.renderer.heading(g);continue}case"code":{o+=this.renderer.code(g);continue}case"table":{o+=this.renderer.table(g);continue}case"blockquote":{o+=this.renderer.blockquote(g);continue}case"list":{o+=this.renderer.list(g);continue}case"html":{o+=this.renderer.html(g);continue}case"paragraph":{o+=this.renderer.paragraph(g);continue}case"text":{let m=g,v=this.renderer.text(m);for(;d+1<s.length&&s[d+1].type==="text";)m=s[++d],v+=`
498
- `+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 "'+g.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}parseInline(s,r=this.renderer){var l,c;let o="";for(let d=0;d<s.length;d++){const p=s[d];if((c=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&c[p.type]){const m=this.options.extensions.renderers[p.type].call({parser:this},p);if(m!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(p.type)){o+=m||"";continue}}const g=p;switch(g.type){case"escape":{o+=r.text(g);break}case"html":{o+=r.html(g);break}case"link":{o+=r.link(g);break}case"image":{o+=r.image(g);break}case"strong":{o+=r.strong(g);break}case"em":{o+=r.em(g);break}case"codespan":{o+=r.codespan(g);break}case"br":{o+=r.br(g);break}case"del":{o+=r.del(g);break}case"text":{o+=r.text(g);break}default:{const m='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}},Yu,ll=(Yu=class{constructor(t){it(this,"options");it(this,"block");this.options=t||Ur}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?$s.lex:$s.lexInline}provideParser(){return this.block?zs.parse:zs.parseInline}},it(Yu,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),Yu),Mb=class{constructor(...t){it(this,"defaults",Fd());it(this,"options",this.setOptions);it(this,"parse",this.parseMarkdown(!0));it(this,"parseInline",this.parseMarkdown(!1));it(this,"Parser",zs);it(this,"Renderer",El);it(this,"TextRenderer",qd);it(this,"Lexer",$s);it(this,"Tokenizer",_l);it(this,"Hooks",ll);this.use(...t)}walkTokens(t,s){var o,l;let r=[];for(const c of t)switch(r=r.concat(s.call(this,c)),c.type){case"table":{const d=c;for(const p of d.header)r=r.concat(this.walkTokens(p.tokens,s));for(const p of d.rows)for(const g of p)r=r.concat(this.walkTokens(g.tokens,s));break}case"list":{const d=c;r=r.concat(this.walkTokens(d.items,s));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(p=>{const g=d[p].flat(1/0);r=r.concat(this.walkTokens(g,s))}):d.tokens&&(r=r.concat(this.walkTokens(d.tokens,s)))}}return r}use(...t){const s=this.defaults.extensions||{renderers:{},childTokens:{}};return t.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=s.renderers[l.name];c?s.renderers[l.name]=function(...d){let p=l.renderer.apply(this,d);return p===!1&&(p=c.apply(this,d)),p}:s.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=s[l.level];c?c.unshift(l.tokenizer):s[l.level]=[l.tokenizer],l.start&&(l.level==="block"?s.startBlock?s.startBlock.push(l.start):s.startBlock=[l.start]:l.level==="inline"&&(s.startInline?s.startInline.push(l.start):s.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(s.childTokens[l.name]=l.childTokens)}),o.extensions=s),r.renderer){const l=this.defaults.renderer||new El(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,p=r.renderer[d],g=l[d];l[d]=(...m)=>{let v=p.apply(l,m);return v===!1&&(v=g.apply(l,m)),v||""}}o.renderer=l}if(r.tokenizer){const l=this.defaults.tokenizer||new _l(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,p=r.tokenizer[d],g=l[d];l[d]=(...m)=>{let v=p.apply(l,m);return v===!1&&(v=g.apply(l,m)),v}}o.tokenizer=l}if(r.hooks){const l=this.defaults.hooks||new ll;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,p=r.hooks[d],g=l[d];ll.passThroughHooks.has(c)?l[d]=m=>{if(this.defaults.async)return Promise.resolve(p.call(l,m)).then(k=>g.call(l,k));const v=p.call(l,m);return g.call(l,v)}:l[d]=(...m)=>{let v=p.apply(l,m);return v===!1&&(v=g.apply(l,m)),v}}o.hooks=l}if(r.walkTokens){const l=this.defaults.walkTokens,c=r.walkTokens;o.walkTokens=function(d){let p=[];return p.push(c.call(this,d)),l&&(p=p.concat(l.call(this,d))),p}}this.defaults={...this.defaults,...o}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,s){return $s.lex(t,s??this.defaults)}parser(t,s){return zs.parse(t,s??this.defaults)}parseMarkdown(t){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=t);const p=c.hooks?c.hooks.provideLexer():t?$s.lex:$s.lexInline,g=c.hooks?c.hooks.provideParser():t?zs.parse:zs.parseInline;if(c.async)return Promise.resolve(c.hooks?c.hooks.preprocess(r):r).then(m=>p(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=>g(m,c)).then(m=>c.hooks?c.hooks.postprocess(m):m).catch(d);try{c.hooks&&(r=c.hooks.preprocess(r));let m=p(r,c);c.hooks&&(m=c.hooks.processAllTokens(m)),c.walkTokens&&this.walkTokens(m,c.walkTokens);let v=g(m,c);return c.hooks&&(v=c.hooks.postprocess(v)),v}catch(m){return d(m)}}}onError(t,s){return r=>{if(r.message+=`
499
- Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An error occurred:</p><pre>"+Ts(r.message+"",!0)+"</pre>";return s?Promise.resolve(o):o}if(s)return Promise.reject(r);throw r}}},zr=new Mb;function Ge(t,s){return zr.parse(t,s)}Ge.options=Ge.setOptions=function(t){return zr.setOptions(t),Ge.defaults=zr.defaults,Wv(Ge.defaults),Ge};Ge.getDefaults=Fd;Ge.defaults=Ur;Ge.use=function(...t){return zr.use(...t),Ge.defaults=zr.defaults,Wv(Ge.defaults),Ge};Ge.walkTokens=function(t,s){return zr.walkTokens(t,s)};Ge.parseInline=zr.parseInline;Ge.Parser=zs;Ge.parser=zs.parse;Ge.Renderer=El;Ge.TextRenderer=qd;Ge.Lexer=$s;Ge.lexer=$s.lex;Ge.Tokenizer=_l;Ge.Hooks=ll;Ge.parse=Ge;Ge.options;Ge.setOptions;Ge.use;Ge.walkTokens;Ge.parseInline;zs.parse;$s.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 Cm(t,s){(s==null||s>t.length)&&(s=t.length);for(var r=0,o=Array(s);r<s;r++)o[r]=t[r];return o}function Lb(t){if(Array.isArray(t))return t}function Ob(t,s){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var o,l,c,d,p=[],g=!0,m=!1;try{if(c=(r=r.call(t)).next,s!==0)for(;!(g=(o=c.call(r)).done)&&(p.push(o.value),p.length!==s);g=!0);}catch(v){m=!0,l=v}finally{try{if(!g&&r.return!=null&&(d=r.return(),Object(d)!==d))return}finally{if(m)throw l}}return p}}function Pb(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
500
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $b(t,s){return Lb(t)||Ob(t,s)||zb(t,s)||Pb()}function zb(t,s){if(t){if(typeof t=="string")return Cm(t,s);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Cm(t,s):void 0}}const ey=Object.entries,_m=Object.setPrototypeOf,Fb=Object.isFrozen,Ub=Object.getPrototypeOf,Bb=Object.getOwnPropertyDescriptor;let rn=Object.freeze,on=Object.seal,vi=Object.create,ty=typeof Reflect<"u"&&Reflect,ud=ty.apply,dd=ty.construct;rn||(rn=function(s){return s});on||(on=function(s){return s});ud||(ud=function(s,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 s.apply(r,l)});dd||(dd=function(s){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 s(...o)});const hi=$t(Array.prototype.forEach),Wb=$t(Array.prototype.lastIndexOf),Em=$t(Array.prototype.pop),mi=$t(Array.prototype.push),Hb=$t(Array.prototype.splice),dr=Array.isArray,vo=$t(String.prototype.toLowerCase),Bu=$t(String.prototype.toString),Rm=$t(String.prototype.match),po=$t(String.prototype.replace),Am=$t(String.prototype.indexOf),Vb=$t(String.prototype.trim),Gb=$t(Number.prototype.toString),Kb=$t(Boolean.prototype.toString),Im=typeof BigInt>"u"?null:$t(BigInt.prototype.toString),Dm=typeof Symbol>"u"?null:$t(Symbol.prototype.toString),Zt=$t(Object.prototype.hasOwnProperty),ho=$t(Object.prototype.toString),Qt=$t(RegExp.prototype.test),Lr=qb(TypeError);function $t(t){return function(s){s instanceof RegExp&&(s.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 ud(t,s,o)}}function qb(t){return function(){for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return dd(t,r)}}function Ve(t,s){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:vo;if(_m&&_m(t,null),!dr(s))return t;let o=s.length;for(;o--;){let l=s[o];if(typeof l=="string"){const c=r(l);c!==l&&(Fb(s)||(s[o]=c),l=c)}t[l]=!0}return t}function Yb(t){for(let s=0;s<t.length;s++)Zt(t,s)||(t[s]=null);return t}function pn(t){const s=vi(null);for(const o of ey(t)){var r=$b(o,2);const l=r[0],c=r[1];Zt(t,l)&&(dr(c)?s[l]=Yb(c):c&&typeof c=="object"&&c.constructor===Object?s[l]=pn(c):s[l]=c)}return s}function Xb(t){switch(typeof t){case"string":return t;case"number":return Gb(t);case"boolean":return Kb(t);case"bigint":return Im?Im(t):"0";case"symbol":return Dm?Dm(t):"Symbol()";case"undefined":return ho(t);case"function":case"object":{if(t===null)return ho(t);const s=t,r=ls(s,"toString");if(typeof r=="function"){const o=r(s);return typeof o=="string"?o:ho(o)}return ho(t)}default:return ho(t)}}function ls(t,s){for(;t!==null;){const o=Bb(t,s);if(o){if(o.get)return $t(o.get);if(typeof o.value=="function")return $t(o.value)}t=Ub(t)}function r(){return null}return r}function Qb(t){try{return Qt(t,""),!0}catch{return!1}}const Mm=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"]),Wu=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"]),Hu=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"]),Zb=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"]),Vu=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"]),Jb=rn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Lm=rn(["#text"]),Om=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"]),Gu=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"]),Pm=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"]),Ja=rn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),eT=on(/{{[\w\W]*|^[\w\W]*}}/g),tT=on(/<%[\w\W]*|^[\w\W]*%>/g),nT=on(/\${[\w\W]*/g),sT=on(/^data-[\-\w.\u00B7-\uFFFF]+$/),rT=on(/^aria-[\-\w]+$/),$m=on(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),iT=on(/^(?:\w+script|data):/i),oT=on(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),aT=on(/^html$/i),lT=on(/^[a-z][.\w]*(-[.\w]+)+$/i),zm=on(/<[/\w!]/g),Fm=on(/<[/\w]/g),cT=on(/<\/no(script|embed|frames)/i),uT=on(/\/>/i),Wn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},dT=function(){return typeof window>"u"?null:window},fT=function(s,r){if(typeof s!="object"||typeof s.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 s.createPolicy(c,{createHTML(d){return d},createScriptURL(d){return d}})}catch{return console.warn("TrustedTypes policy "+c+" could not be created."),null}},Um=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},cr=function(s,r,o,l){return Zt(s,r)&&dr(s[r])?Ve(l.base?pn(l.base):{},s[r],l.transform):o};function ny(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:dT();const s=ce=>ny(ce);if(s.version="3.4.13",s.removed=[],!t||!t.document||t.document.nodeType!==Wn.document||!t.Element)return s.isSupported=!1,s;let r=t.document;const o=r,l=o.currentScript;t.DocumentFragment;const c=t.HTMLTemplateElement,d=t.Node,p=t.Element,g=t.NodeFilter,m=t.NamedNodeMap;m===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const v=t.DOMParser,k=t.trustedTypes,y=p.prototype,S=ls(y,"cloneNode"),T=ls(y,"remove"),E=ls(y,"nextSibling"),N=ls(y,"childNodes"),C=ls(y,"parentNode"),_=ls(y,"shadowRoot"),H=ls(y,"attributes"),D=d&&d.prototype?ls(d.prototype,"nodeType"):null,O=d&&d.prototype?ls(d.prototype,"nodeName"):null,K=d&&d.prototype?ls(d.prototype,"ownerDocument"):null;if(typeof c=="function"){const ce=r.createElement("template");ce.content&&ce.content.ownerDocument&&(r=ce.content.ownerDocument)}let G,z="",J,he=!1,ae=0;const ve=function(){if(ae>0)throw Lr('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.')},we=function(b){ve(),ae++;try{return G.createHTML(b)}finally{ae--}},Ae=function(b){ve(),ae++;try{return G.createScriptURL(b)}finally{ae--}},ee=function(){return he||(J=fT(k,l),he=!0),J},ne=r,oe=ne.implementation,F=ne.createNodeIterator,X=ne.createDocumentFragment,L=ne.getElementsByTagName,R=o.importNode;let $=Um();s.isSupported=typeof ey=="function"&&typeof C=="function"&&oe&&oe.createHTMLDocument!==void 0;const le=eT,me=tT,Y=nT,fe=sT,Te=rT,se=iT,pe=oT,be=lT;let He=$m,Ee=null;const ct=Ve({},[...Mm,...Wu,...Hu,...Vu,...Lm]);let $e=null;const en=Ve({},[...Om,...Gu,...Pm,...Ja]);let Fe=Object.seal(vi(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}})),Ht=null,tn=null;const wt=Object.seal(vi(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let jt=!0,zt=!0,Lt=!1,q=!0,ge=!1,Ue=!0,nt=!1,mt=!1,gt=null,Ct=null,an=!1,dt=!1,Dn=!1,Mn=!1,hs=!0,ms=!1;const ts="user-content-";let Ln=!0,gn=!1,ln={},Vt=null;const vn=Ve({},["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 Qe=null;const _t=Ve({},["audio","video","img","source","image","track"]);let ft=null;const Gt=Ve({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),vt="http://www.w3.org/1998/Math/MathML",yt="http://www.w3.org/2000/svg",at="http://www.w3.org/1999/xhtml";let Kt=at,rt=!1,Ot=null;const A=Ve({},[vt,yt,at],Bu),de=rn(["mi","mo","mn","ms","mtext"]);let ie=Ve({},de);const ke=rn(["annotation-xml"]);let Le=Ve({},ke);const Ke=Ve({},["title","style","font","a","script"]);let Oe=null;const Ft=["application/xhtml+xml","text/html"],On="text/html";let Be=null,yn=null;const Cs=r.createElement("form"),Bs=function(b){return b instanceof RegExp||b instanceof Function},Pn=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(yn&&yn===b)return;(!b||typeof b!="object")&&(b={}),b=pn(b),Oe=Ft.indexOf(b.PARSER_MEDIA_TYPE)===-1?On:b.PARSER_MEDIA_TYPE,Be=Oe==="application/xhtml+xml"?Bu:vo,Ee=cr(b,"ALLOWED_TAGS",ct,{transform:Be}),$e=cr(b,"ALLOWED_ATTR",en,{transform:Be}),Ot=cr(b,"ALLOWED_NAMESPACES",A,{transform:Bu}),ft=cr(b,"ADD_URI_SAFE_ATTR",Gt,{transform:Be,base:Gt}),Qe=cr(b,"ADD_DATA_URI_TAGS",_t,{transform:Be,base:_t}),Vt=cr(b,"FORBID_CONTENTS",vn,{transform:Be}),Ht=cr(b,"FORBID_TAGS",pn({}),{transform:Be}),tn=cr(b,"FORBID_ATTR",pn({}),{transform:Be}),ln=Zt(b,"USE_PROFILES")?b.USE_PROFILES&&typeof b.USE_PROFILES=="object"?pn(b.USE_PROFILES):b.USE_PROFILES:!1,jt=b.ALLOW_ARIA_ATTR!==!1,zt=b.ALLOW_DATA_ATTR!==!1,Lt=b.ALLOW_UNKNOWN_PROTOCOLS||!1,q=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ge=b.SAFE_FOR_TEMPLATES||!1,Ue=b.SAFE_FOR_XML!==!1,nt=b.WHOLE_DOCUMENT||!1,dt=b.RETURN_DOM||!1,Dn=b.RETURN_DOM_FRAGMENT||!1,Mn=b.RETURN_TRUSTED_TYPE||!1,an=b.FORCE_BODY||!1,hs=b.SANITIZE_DOM!==!1,ms=b.SANITIZE_NAMED_PROPS||!1,Ln=b.KEEP_CONTENT!==!1,gn=b.IN_PLACE||!1,He=Qb(b.ALLOWED_URI_REGEXP)?b.ALLOWED_URI_REGEXP:$m,Kt=typeof b.NAMESPACE=="string"?b.NAMESPACE:at,ie=Zt(b,"MATHML_TEXT_INTEGRATION_POINTS")&&b.MATHML_TEXT_INTEGRATION_POINTS&&typeof b.MATHML_TEXT_INTEGRATION_POINTS=="object"?pn(b.MATHML_TEXT_INTEGRATION_POINTS):Ve({},de),Le=Zt(b,"HTML_INTEGRATION_POINTS")&&b.HTML_INTEGRATION_POINTS&&typeof b.HTML_INTEGRATION_POINTS=="object"?pn(b.HTML_INTEGRATION_POINTS):Ve({},ke);const U=Zt(b,"CUSTOM_ELEMENT_HANDLING")&&b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING=="object"?pn(b.CUSTOM_ELEMENT_HANDLING):vi(null);if(Fe=vi(null),Zt(U,"tagNameCheck")&&Bs(U.tagNameCheck)&&(Fe.tagNameCheck=U.tagNameCheck),Zt(U,"attributeNameCheck")&&Bs(U.attributeNameCheck)&&(Fe.attributeNameCheck=U.attributeNameCheck),Zt(U,"allowCustomizedBuiltInElements")&&typeof U.allowCustomizedBuiltInElements=="boolean"&&(Fe.allowCustomizedBuiltInElements=U.allowCustomizedBuiltInElements),on(Fe),ge&&(zt=!1),Dn&&(dt=!0),ln&&(Ee=Ve({},Lm),$e=vi(null),ln.html===!0&&(Ve(Ee,Mm),Ve($e,Om)),ln.svg===!0&&(Ve(Ee,Wu),Ve($e,Gu),Ve($e,Ja)),ln.svgFilters===!0&&(Ve(Ee,Hu),Ve($e,Gu),Ve($e,Ja)),ln.mathMl===!0&&(Ve(Ee,Vu),Ve($e,Pm),Ve($e,Ja))),wt.tagCheck=null,wt.attributeCheck=null,Zt(b,"ADD_TAGS")&&(typeof b.ADD_TAGS=="function"?wt.tagCheck=b.ADD_TAGS:dr(b.ADD_TAGS)&&(Ee===ct&&(Ee=pn(Ee)),Ve(Ee,b.ADD_TAGS,Be))),Zt(b,"ADD_ATTR")&&(typeof b.ADD_ATTR=="function"?wt.attributeCheck=b.ADD_ATTR:dr(b.ADD_ATTR)&&($e===en&&($e=pn($e)),Ve($e,b.ADD_ATTR,Be))),Zt(b,"ADD_URI_SAFE_ATTR")&&dr(b.ADD_URI_SAFE_ATTR)&&Ve(ft,b.ADD_URI_SAFE_ATTR,Be),Zt(b,"FORBID_CONTENTS")&&dr(b.FORBID_CONTENTS)&&(Vt===vn&&(Vt=pn(Vt)),Ve(Vt,b.FORBID_CONTENTS,Be)),Zt(b,"ADD_FORBID_CONTENTS")&&dr(b.ADD_FORBID_CONTENTS)&&(Vt===vn&&(Vt=pn(Vt)),Ve(Vt,b.ADD_FORBID_CONTENTS,Be)),Ln&&(Ee["#text"]=!0),nt&&Ve(Ee,["html","head","body"]),Ee.table&&(Ve(Ee,["tbody"]),delete Ht.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw Lr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Lr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const Q=G;G=b.TRUSTED_TYPES_POLICY;try{z=we("")}catch(je){throw G=Q,je}}else b.TRUSTED_TYPES_POLICY===null?(G=void 0,z=""):(G===void 0&&(G=ee()),G&&typeof z=="string"&&(z=we("")));rn&&rn(b),yn=b},gs=Ve({},[...Wu,...Hu,...Zb]),Ze=Ve({},[...Vu,...Jb]),Et=function(b,U,Q){return U.namespaceURI===at?b==="svg":U.namespaceURI===vt?b==="svg"&&(Q==="annotation-xml"||ie[Q]):!!gs[b]},vs=function(b,U,Q){return U.namespaceURI===at?b==="math":U.namespaceURI===yt?b==="math"&&Le[Q]:!!Ze[b]},Kl=function(b,U,Q){return U.namespaceURI===yt&&!Le[Q]||U.namespaceURI===vt&&!ie[Q]?!1:!Ze[b]&&(Ke[b]||!gs[b])},kt=function(b){let U=C(b);(!U||!U.tagName)&&(U={namespaceURI:Kt,tagName:"template"});const Q=vo(b.tagName),je=vo(U.tagName);return Ot[b.namespaceURI]?b.namespaceURI===yt?Et(Q,U,je):b.namespaceURI===vt?vs(Q,U,je):b.namespaceURI===at?Kl(Q,U,je):!!(Oe==="application/xhtml+xml"&&Ot[b.namespaceURI]):!1},ys=function(b){mi(s.removed,{element:b});try{C(b).removeChild(b)}catch{if(T(b),!C(b))throw Lr("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Ws=function(b){gr(b);const U=N(b);if(U){const je=[];hi(U,Re=>{mi(je,Re)}),hi(je,Re=>{try{T(Re)}catch{}})}const Q=H(b);if(Q)for(let je=Q.length-1;je>=0;--je){const Re=Q[je],ze=Re&&Re.name;if(typeof ze=="string")try{b.removeAttribute(ze)}catch{}}},xs=function(b,U){try{mi(s.removed,{attribute:U.getAttributeNode(b),from:U})}catch{mi(s.removed,{attribute:null,from:U})}if(U.removeAttribute(b),b==="is")if(dt||Dn)try{ys(U)}catch{}else try{U.setAttribute(b,"")}catch{}},Br=function(b){const U=H(b);if(U)for(let Q=U.length-1;Q>=0;--Q){const je=U[Q],Re=je&&je.name;if(!(typeof Re!="string"||$e[Be(Re)]))try{b.removeAttribute(Re)}catch{}}},gr=function(b){const U=[b];for(;U.length>0;){const Q=U.pop();(D?D(Q):Q.nodeType)===Wn.element&&Br(Q);const Re=N(Q);if(Re)for(let ze=Re.length-1;ze>=0;--ze)U.push(Re[ze])}},Uo=function(b){if(!Ue)return;const U=[b];for(;U.length>0;){const Q=U.pop(),je=D?D(Q):Q.nodeType;if(je===Wn.processingInstruction||je===Wn.comment&&Qt(Fm,Q.data)){try{T(Q)}catch{}continue}if(je===Wn.element){const ze=Q,Ye=Be(O?O(Q):Q.nodeName);try{ze.hasAttribute&&ze.hasAttribute("patchsrc")&&ze.removeAttribute("patchsrc"),ze.hasAttribute&&ze.hasAttribute("for")&&Ye!=="label"&&Ye!=="output"&&ze.removeAttribute("for")}catch{}}const Re=N(Q);if(Re)for(let ze=Re.length-1;ze>=0;--ze)U.push(Re[ze])}},vr=function(b){let U=null,Q=null;if(an)b="<remove></remove>"+b;else{const ze=Rm(b,/^[\r\n\t ]+/);Q=ze&&ze[0]}Oe==="application/xhtml+xml"&&Kt===at&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const je=G?we(b):b;if(Kt===at)try{U=new v().parseFromString(je,Oe)}catch{}if(!U||!U.documentElement){U=oe.createDocument(Kt,"template",null);try{U.documentElement.innerHTML=rt?z:je}catch{}}const Re=U.body||U.documentElement;return b&&Q&&Re.insertBefore(r.createTextNode(Q),Re.childNodes[0]||null),Kt===at?L.call(U,nt?"html":"body")[0]:nt?U.documentElement:Re},$n=function(b){const U=K?K(b):b.ownerDocument;return F.call(U||b,b,g.SHOW_ELEMENT|g.SHOW_COMMENT|g.SHOW_TEXT|g.SHOW_PROCESSING_INSTRUCTION|g.SHOW_CDATA_SECTION,null)},Wr=function(b){return b=po(b,le," "),b=po(b,me," "),b=po(b,Y," "),b},xn=function(b){var U;b.normalize();const Q=K?K(b):b.ownerDocument,je=F.call(Q||b,b,g.SHOW_TEXT|g.SHOW_COMMENT|g.SHOW_CDATA_SECTION|g.SHOW_PROCESSING_INSTRUCTION,null);let Re=je.nextNode();for(;Re;)Re.data=Wr(Re.data),Re=je.nextNode();const ze=(U=b.querySelectorAll)===null||U===void 0?void 0:U.call(b,"template");ze&&hi(ze,Ye=>{Hs(Ye.content)&&xn(Ye.content)})},Hr=function(b){const U=O?O(b):null;return typeof U!="string"||Be(U)!=="form"?!1:typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||b.attributes!==H(b)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function"||b.nodeType!==D(b)||b.childNodes!==N(b)},Hs=function(b){if(!D||typeof b!="object"||b===null)return!1;try{return D(b)===Wn.documentFragment}catch{return!1}},yr=function(b){if(!D||typeof b!="object"||b===null)return!1;try{return typeof D(b)=="number"}catch{return!1}};function wn(ce,b,U){ce.length!==0&&hi(ce,Q=>{Q.call(s,b,U,yn)})}const Vr=function(b,U){return!!(Ue&&b.hasChildNodes()&&!yr(b.firstElementChild)&&Qt(zm,b.textContent)&&Qt(zm,b.innerHTML)||Ue&&b.namespaceURI===at&&U==="style"&&yr(b.firstElementChild)||b.nodeType===Wn.processingInstruction||Ue&&b.nodeType===Wn.comment&&Qt(Fm,b.data))},xr=function(b,U,Q){if(!Ht[U]&&Ai(U)&&(Fe.tagNameCheck instanceof RegExp&&Qt(Fe.tagNameCheck,U)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(U)))return!1;if(Ln&&!Vt[U]){const je=C(b),Re=N(b);if(Re&&je){const ze=Re.length;for(let Ye=ze-1;Ye>=0;--Ye){const Je=b===Q?S(Re[Ye],!0):Re[Ye];je.insertBefore(Je,E(b))}}}return ys(b),!0},wr=function(b,U,Q,je){return b.length===0?U:U===Q||U===je?pn(U):U},Bo=function(b,U){if(wn($.beforeSanitizeElements,b,null),b!==U&&C(b)===null)return gn&&gr(b),!0;if(Hr(b))return ys(b),!0;const Q=Be(O?O(b):b.nodeName);if(Ee=wr($.uponSanitizeElement,Ee,ct,gt),wn($.uponSanitizeElement,b,{tagName:Q,allowedTags:Ee}),b!==U&&C(b)===null)return gn&&gr(b),!0;if(Vr(b,Q))return ys(b),!0;if(Ht[Q]||!(wt.tagCheck instanceof Function&&wt.tagCheck(Q))&&!Ee[Q]){const Re=xr(b,Q,U);return Re===!1&&wn($.afterSanitizeElements,b,null),Re}if((D?D(b):b.nodeType)===Wn.element&&!kt(b)||(Q==="noscript"||Q==="noembed"||Q==="noframes")&&Qt(cT,b.innerHTML))return ys(b),!0;if(ge&&b.nodeType===Wn.text){const Re=Wr(b.textContent);b.textContent!==Re&&(mi(s.removed,{element:b.cloneNode()}),b.textContent=Re)}return wn($.afterSanitizeElements,b,null),!1},Wo=function(b,U,Q){if(tn[U]||Ue&&U==="patchsrc"||Ue&&U==="for"&&b!=="label"&&b!=="output"||hs&&(U==="id"||U==="name")&&(Q in r||Q in Cs))return!1;const je=$e[U]||wt.attributeCheck instanceof Function&&wt.attributeCheck(U,b);if(!(zt&&Qt(fe,U))){if(!(jt&&Qt(Te,U))){if(je){if(!ft[U]){if(!Qt(He,po(Q,pe,""))){if(!((U==="src"||U==="xlink:href"||U==="href")&&b!=="script"&&Am(Q,"data:")===0&&Qe[b])){if(!(Lt&&!Qt(se,po(Q,pe,"")))){if(Q)return!1}}}}}else if(!(Ai(b)&&(Fe.tagNameCheck instanceof RegExp&&Qt(Fe.tagNameCheck,b)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(b))&&(Fe.attributeNameCheck instanceof RegExp&&Qt(Fe.attributeNameCheck,U)||Fe.attributeNameCheck instanceof Function&&Fe.attributeNameCheck(U,b))||U==="is"&&Fe.allowCustomizedBuiltInElements&&(Fe.tagNameCheck instanceof RegExp&&Qt(Fe.tagNameCheck,Q)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(Q))))return!1}}return!0},Ri=Ve({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ai=function(b){return!Ri[vo(b)]&&Qt(be,b)},Ii=function(b,U,Q,je){if(G&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!Q)switch(k.getAttributeType(b,U)){case"TrustedHTML":return we(je);case"TrustedScriptURL":return Ae(je)}return je},kr=function(b,U,Q,je){try{Q?b.setAttributeNS(Q,U,je):b.setAttribute(U,je),Hr(b)?ys(b):Em(s.removed)}catch{xs(U,b)}},Ho=function(b){wn($.beforeSanitizeAttributes,b,null);const U=b.attributes;if(!U||Hr(b))return;$e=wr($.uponSanitizeAttribute,$e,en,Ct);const Q={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:$e,forceKeepAttr:void 0};let je=U.length;const Re=Be(b.nodeName);for(;je--;){const ze=U[je],Ye=ze.name,Je=ze.namespaceURI,St=ze.value,bt=Be(Ye),_s=St;let At=Ye==="value"?_s:Vb(_s);if(Q.attrName=bt,Q.attrValue=At,Q.keepAttr=!0,Q.forceKeepAttr=void 0,wn($.uponSanitizeAttribute,b,Q),At=Q.attrValue,ms&&(bt==="id"||bt==="name")&&Am(At,ts)!==0&&(xs(Ye,b),At=ts+At),Ue&&Qt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,At)){xs(Ye,b);continue}if(bt==="attributename"&&Rm(At,"href")){xs(Ye,b);continue}if(!Q.forceKeepAttr){if(!Q.keepAttr){xs(Ye,b);continue}if(!q&&Qt(uT,At)){xs(Ye,b);continue}if(ge&&(At=Wr(At)),!Wo(Re,bt,At)){xs(Ye,b);continue}At=Ii(Re,bt,Je,At),At!==_s&&kr(b,Ye,Je,At)}}wn($.afterSanitizeAttributes,b,null)},Vs=function(b){let U=null;const Q=$n(b);for(wn($.beforeSanitizeShadowDOM,b,null);U=Q.nextNode();)if(wn($.uponSanitizeShadowNode,U,null),Bo(U,b),Ho(U),Hs(U.content)&&Vs(U.content),(D?D(U):U.nodeType)===Wn.element){const Re=_(U);Hs(Re)&&(qe(Re),Vs(Re))}wn($.afterSanitizeShadowDOM,b,null)},qe=function(b){const U=[{node:b,shadow:null}];for(;U.length>0;){const Q=U.pop();if(Q.shadow){Vs(Q.shadow);continue}const je=Q.node,ze=(D?D(je):je.nodeType)===Wn.element,Ye=N(je);if(Ye)for(let Je=Ye.length-1;Je>=0;--Je)U.push({node:Ye[Je],shadow:null});if(ze){const Je=O?O(je):null;if(typeof Je=="string"&&Be(Je)==="template"){const St=je.content;Hs(St)&&U.push({node:St,shadow:null})}}if(ze){const Je=_(je);Hs(Je)&&U.push({node:null,shadow:Je},{node:Je,shadow:null})}}};return s.sanitize=function(ce){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},U=null,Q=null,je=null,Re=null;if(rt=!ce,rt&&(ce="<!-->"),typeof ce!="string"&&!yr(ce)&&(ce=Xb(ce),typeof ce!="string"))throw Lr("dirty is not a string, aborting");if(!s.isSupported)return ce;mt?(Ee=gt,$e=Ct):Pn(b),($.uponSanitizeElement.length>0||$.uponSanitizeAttribute.length>0)&&(Ee=pn(Ee)),$.uponSanitizeAttribute.length>0&&($e=pn($e)),s.removed=[];const ze=gn&&typeof ce!="string"&&yr(ce);if(ze){Uo(ce);const St=O?O(ce):ce.nodeName;if(typeof St=="string"){const bt=Be(St);if(!Ee[bt]||Ht[bt])throw Ws(ce),Lr("root node is forbidden and cannot be sanitized in-place")}if(Hr(ce))throw Ws(ce),Lr("root node is clobbered and cannot be sanitized in-place");try{qe(ce)}catch(bt){throw Ws(ce),bt}}else if(yr(ce))U=vr("<!---->"),Q=U.ownerDocument.importNode(ce,!0),Q.nodeType===Wn.element&&Q.nodeName==="BODY"||Q.nodeName==="HTML"?U=Q:U.appendChild(Q),qe(Q);else{if(!dt&&!ge&&!nt&&ce.indexOf("<")===-1)return G&&Mn?we(ce):ce;if(U=vr(ce),!U)return dt?null:Mn?z:""}U&&an&&ys(U.firstChild);const Ye=ze?ce:U;try{const St=$n(Ye);for(;je=St.nextNode();)Bo(je,Ye),Ho(je),Hs(je.content)&&Vs(je.content)}catch(St){throw ze&&(Ws(ce),hi(s.removed,bt=>{bt.element&&gr(bt.element)})),St}if(ze)return hi(s.removed,St=>{St.element&&gr(St.element)}),ge&&xn(ce),ce;if(dt){if(ge&&xn(U),Dn)for(Re=X.call(U.ownerDocument);U.firstChild;)Re.appendChild(U.firstChild);else Re=U;return($e.shadowroot||$e.shadowrootmode)&&(Re=R.call(o,Re,!0)),Re}let Je=nt?U.outerHTML:U.innerHTML;return nt&&Ee["!doctype"]&&U.ownerDocument&&U.ownerDocument.doctype&&U.ownerDocument.doctype.name&&Qt(aT,U.ownerDocument.doctype.name)&&(Je="<!DOCTYPE "+U.ownerDocument.doctype.name+`>
501
- `+Je),ge&&(Je=Wr(Je)),G&&Mn?we(Je):Je},s.setConfig=function(){let ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Pn(ce),mt=!0,gt=Ee,Ct=$e},s.clearConfig=function(){yn=null,mt=!1,gt=null,Ct=null,G=J,z=""},s.isValidAttribute=function(ce,b,U){yn||Pn({});const Q=Be(ce),je=Be(b);return Wo(Q,je,U)},s.addHook=function(ce,b){typeof b=="function"&&Zt($,ce)&&mi($[ce],b)},s.removeHook=function(ce,b){if(Zt($,ce)){if(b!==void 0){const U=Wb($[ce],b);return U===-1?void 0:Hb($[ce],U,1)[0]}return Em($[ce])}},s.removeHooks=function(ce){Zt($,ce)&&($[ce]=[])},s.removeAllHooks=function(){$=Um()},s}var Yd=ny();const pT=new Set(["command_execution","file_change","mcp_tool_call","web_search"]),hT=100;function Bm(t){return pT.has(t.type)}function mT({items:t,runtimeType:s,turn:r,threads:o=[]}){const[l,c]=x.useState(!1),[d,p]=x.useState(!1);if(t.length===0)return null;const g=t.length,m=d?0:Math.max(0,g-hT),v=m>0?t.slice(m):t;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:[g," tool call",g>1?"s":""]}),a.jsx(Co,{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:()=>p(!0),children:["Show ",m," earlier tool call",m>1?"s":""]})}),v.map(k=>a.jsx(Ps,{item:k,runtimeType:s,turn:r,threads:o},k.id))]})]})}Ge.setOptions({breaks:!0,gfm:!0});function gT(t){const s=Ge.parse(t);return Yd.sanitize(s)}function Wm(t,s){var l;const r=document.createTreeWalker(t,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>s)return{node:c,offset:s-o};o+=d}return null}function vT(t,s,r){const o=document.createTreeWalker(t,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,s)<=0)&&(d.compareBoundaryPoints(Range.END_TO_START,s)>=0||l.push(c))}for(const c of l){const d=c.length;let p=0,g=d;if(c===s.startContainer&&(p=Math.min(s.startOffset,d)),c===s.endContainer&&(g=Math.min(s.endOffset,d)),p>=g)continue;g<d&&c.splitText(g);const m=p>0?c.splitText(p):c,v=r(),k=m.parentNode;k&&(k.insertBefore(v,m),v.appendChild(m))}}function yT(t,s){t.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 s){if(r.start_offset===null||r.end_offset===null)continue;const o=Wm(t,r.start_offset),l=Wm(t,r.end_offset);if(!o||!l)continue;const c=document.createRange();c.setStart(o.node,o.offset),c.setEnd(l.node,l.offset),vT(t,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 xT(t){const s=window.getSelection();if(!s||s.rangeCount===0)return null;const r=s.getRangeAt(0);if(r.collapsed||!t.contains(r.commonAncestorContainer))return null;const o=document.createRange();o.setStart(t,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 wT({itemId:t,turnId:s,sessionId:r,content:o,threads:l}){const c=x.useRef(null),d=x.useRef(null),p=x.useRef(null),g=x.useRef(""),m=x.useRef(0),[v,k]=x.useState(!1),[y,S]=x.useState({x:0,y:0}),[T,E]=x.useState(!1),[N,C]=x.useState({x:0,y:0}),[_,H]=x.useState(""),[D,O]=x.useState(null),[K,G]=x.useState(!1),z=I(L=>L.createThread),J=I(L=>L.switchRightTab),he=I(L=>Ml(L.sessionDetails[r])),ae=x.useCallback(async()=>{await Io(o||""),G(!0),setTimeout(()=>G(!1),1500)},[o]),ve=x.useCallback(()=>{var R;if(!D)return;const L=`
502
- \`\`\`QUOTE
503
- ${D.text}
504
- \`\`\`
505
-
506
- `;I.setState({quotedText:L}),k(!1),O(null),(R=window.getSelection())==null||R.removeAllRanges()},[D]),we=x.useMemo(()=>gT(o||"…"),[o]),Ae=x.useMemo(()=>l.filter(L=>L.item_id===t),[l,t]);x.useEffect(()=>{c.current&&yT(c.current,Ae)},[we,Ae]),x.useEffect(()=>{g.current=_},[_]),x.useEffect(()=>{function L(R){d.current&&!d.current.contains(R.target)&&(k(!1),g.current.trim()||E(!1))}return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[]);const ee=x.useCallback(()=>{k(!1),g.current.trim()||E(!1)},[]),ne=x.useCallback(()=>{const L=c.current;if(!L)return;const R=xT(L);if(R&&R.text.trim().length>0){const $=window.getSelection();if($&&$.rangeCount>0&&$.anchorNode&&$.focusNode){const me=$.getRangeAt(0).getBoundingClientRect(),Y=28,fe=6,Te=170;let se=!1;try{const He=document.createRange();He.setStart($.focusNode,$.focusOffset),He.setEnd($.focusNode,$.focusOffset);const Ee=document.createRange();Ee.setStart($.anchorNode,$.anchorOffset),Ee.setEnd($.anchorNode,$.anchorOffset),se=Ee.compareBoundaryPoints(Range.START_TO_START,He)>0}catch{se=!1}let pe=me.top-Y-fe;pe<8&&(pe=me.bottom+fe);let be=se?me.left-Te:me.right;be=Math.max(8,Math.min(be,window.innerWidth-Te-8)),S({x:be,y:pe}),k(!0),O(R)}}else k(!1)},[]);x.useEffect(()=>{function L(R){const $=R.target;$&&($.closest(".selection-actions")||$.closest(".thread-create-popover"))||ne()}return document.addEventListener("mouseup",L),()=>document.removeEventListener("mouseup",L)},[ne]);const oe=x.useCallback(()=>{k(!1),E(!0),C({x:y.x,y:y.y})},[y]);x.useLayoutEffect(()=>{if(!T)return;const L=p.current;if(!L)return;const R=L.offsetWidth,$=L.offsetHeight,le=8;let me=y.x,Y=y.y;me-R<le&&(me=R+le),me>window.innerWidth-le&&(me=window.innerWidth-le),Y<le&&(Y=le),Y+$>window.innerHeight-le&&(Y=window.innerHeight-$-le),C({x:me,y:Y})},[T,y]);const F=x.useCallback(async()=>{var L;he||!D||!_.trim()||(await z(r,{itemId:t,turnId:s,startOffset:D.start,endOffset:D.end,selectedText:D.text,message:_.trim()}),H(""),E(!1),O(null),(L=window.getSelection())==null||L.removeAllRanges(),J("threads"))},[D,_,z,r,t,s,J,he]),X=x.useCallback(L=>{const R=L.target;if(R.tagName==="MARK"&&R.hasAttribute("data-thread-id")){L.preventDefault(),J("threads");const $=R.getAttribute("data-thread-id");setTimeout(()=>{const le=document.getElementById(`thread-${$}`);le&&(le.scrollIntoView({behavior:"smooth",block:"center"}),le.classList.add("thread-card-highlighted"),setTimeout(()=>le.classList.remove("thread-card-highlighted"),1500))},100)}},[J]);return a.jsxs("div",{className:"copy-text-wrapper",style:{position:"relative"},ref:d,children:[a.jsx("div",{ref:c,dangerouslySetInnerHTML:{__html:we},onMouseDown:ee,onClick:X}),a.jsx("button",{className:`copy-text-btn${K?" copied":""}`,onClick:ae,title:K?"Copied":"Copy message","aria-label":"Copy message text",children:K?a.jsx(Ns,{size:14}):a.jsx(_o,{size:14})}),v&&!T&&a.jsxs("div",{className:"selection-actions",style:{left:y.x,top:y.y},children:[!he&&a.jsxs("button",{className:"discuss-button",onClick:oe,title:"Start a discussion about this text",children:[a.jsx(I1,{size:14}),a.jsx("span",{children:"Discuss"})]}),a.jsxs("button",{className:"discuss-button",onClick:ve,title:"Quote this text in your message",children:[a.jsx(ov,{size:14}),a.jsx("span",{children:"Quote"})]})]}),T&&a.jsxs("div",{ref:p,className:"thread-create-popover",style:{left:N.x,top:N.y},children:[a.jsxs("div",{className:"thread-create-header",children:[a.jsxs("span",{className:"thread-create-quote",children:['"',D==null?void 0:D.text.slice(0,80),D&&D.text.length>80?"…":"",'"']}),a.jsx("button",{className:"thread-create-close",onClick:()=>{E(!1),O(null)},children:a.jsx(Tn,{size:14})})]}),a.jsx("textarea",{className:"thread-create-input",placeholder:"Ask about this text…",value:_,onChange:L=>H(L.target.value),autoFocus:!0,rows:2,onKeyDown:L=>{if(L.key==="Enter"&&(L.metaKey||L.ctrlKey)&&(L.preventDefault(),F()),L.key==="Escape")if(g.current.trim()){const R=Date.now();m.current&&R-m.current<400?(m.current=0,E(!1),O(null)):m.current=R}else E(!1),O(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:!_.trim()||he,title:he?"Wait for the running turn to finish first":void 0,children:[a.jsx(Lo,{size:13}),a.jsx("span",{children:"Send"})]})]})]})]})}const Hm=x.memo(wT),Rl=new Map,sy=new Set,fd=new Set,Vm=new Map;function ry(){fd.forEach(t=>t())}function iy(t,s){return`${t}:${s}`}function kT(t,s,r,o,l){var g;const c=iy(s,r),d=Rl.get(t)??new Map,p=new Map(d);((g=p.get(c))==null?void 0:g.answer)===l?p.delete(c):p.set(c,{itemIndex:s,groupIndex:r,question:o,answer:l}),Rl.set(t,p),ry()}function ST(t){Rl.delete(t),ry()}function bT(t){sy.add(t),ST(t)}function TT(t){const s=x.useCallback(r=>(fd.add(r),()=>{fd.delete(r)}),[]);return x.useSyncExternalStore(s,()=>Rl.get(t)??Vm,()=>Vm)}function NT(t){return[...t].sort((s,r)=>s.itemIndex-r.itemIndex||s.groupIndex-r.groupIndex).map(s=>`> ${s.question}
507
- ${s.answer}`).join(`
508
-
509
- `)}function Gm({item:t,turn:s}){var S;const r=t.data??{},o=x.useMemo(()=>Array.isArray(r.groups)?r.groups.filter(T=>!!T&&Array.isArray(T.selections)&&T.selections.length>0):[],[r.groups]),l=TT(s.id),c=I(T=>s.session_id?T.sessionDetails[s.session_id]:null),d=I(T=>T.activeSessionId),p=s.items.filter(T=>T.type==="ask_user"||T.type==="final_result").findIndex(T=>T.id===t.id),g=c?((S=c.turns[c.turns.length-1])==null?void 0:S.id)===s.id:!0,m=sy.has(s.id),v=m||Dg(c)||!g||s.session_id!==d,k=(T,E,N)=>{v||kT(s.id,p,T,E,N)},y=()=>{const T=[...l.values()];if(T.length===0)return;const E=NT(T);bT(s.id),I.getState().submitPrompt(E)};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(g1,{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((T,E)=>a.jsxs("div",{className:"ask-user-group",children:[T.question&&a.jsx("div",{className:"ask-user-question",children:T.question}),a.jsx("div",{className:"ask-user-options",children:T.selections.map(N=>{var _;const C=((_=l.get(iy(p,E)))==null?void 0:_.answer)===N;return a.jsx("button",{type:"button",className:`ask-user-option ${C?"selected":""}`,disabled:v,onClick:()=>k(E,T.question,N),children:N},N)})})]},E)),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:y,children:[a.jsx(Lo,{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 cl(t){return t&&jT[t]||"interrupted"}function Al(t){if(!t)return"";const s=new Date(t);return Number.isNaN(s.getTime())?"":s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function CT(t){switch(t.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 s=Al(t.resume_at);return s?`Usage limit reached — resumes at ${s}.`:"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 _T(t){return t.items.filter(s=>s.type==="interruption").map(s=>s.data)}function ET({item:t}){const s=t.data,r=Al(s.interrupted_at);let o="";switch(s.outcome){case"waiting":o="waiting to resume";break;case"resuming":o="resuming…";break;case"resumed":o=s.resumed_at?`resumed ${Al(s.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:s.detail??void 0,children:a.jsxs("span",{children:["Interrupted",r?` ${r}`:""," (",cl(s.reason),") · ",o]})})}function RT({turn:t,label:s}){const[r,o]=x.useState(!1),l=I(d=>d.addToast),c=()=>{o(!0),b0(t.session_id,t.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(av,{size:12}),s]})}function AT({turn:t}){const s=t.resume_state;if(!s||s==="cancelled"||s==="resumed")return null;const r=t.interrupt_reason,o=_T(t),l=o[o.length-1],c=Al(t.interrupted_at??(l==null?void 0:l.interrupted_at));let d,p=null,g=null;switch(s){case"waiting":{const m=r==="usage_limit"&&!t.resume_at;d=CT(t),p=m?(l==null?void 0:l.detail)??null:null,g=r==="auth"||m?"Resume":"Resume now";break}case"resuming":d=`Interrupted (${cl(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.`,p=t.error&&!t.error.startsWith("Automatic resume stopped")?t.error:null,g="Resume";break}case"skipped":d=`Interrupted${c?` ${c}`:""} (${cl(r)}) — too long ago to resume automatically.`,g="Resume";break;default:d=`Interrupted (${cl(r)}) — this turn cannot be resumed.`,p=t.error}return a.jsxs("div",{className:"interruption-banner","data-state":s,children:[a.jsx("span",{className:"banner-icon",children:r==="network"?a.jsx(fv,{size:12}):a.jsx($l,{size:12})}),a.jsxs("span",{className:"banner-text",children:[d,p&&a.jsx("span",{className:"banner-detail",children:p})]}),g&&a.jsx(RT,{turn:t,label:g})]})}function IT({turnId:t}){const s=I(o=>o.retryStates[t]);if(!s)return null;const r=s.errorStatus?`API error ${s.errorStatus}`:"Connection problem";return a.jsxs("div",{className:"retry-banner",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(fv,{size:12})}),a.jsxs("span",{className:"banner-text",children:[r," — retrying (attempt ",s.attempt," of ",s.maxRetries,")…"]})]})}Ge.setOptions({breaks:!0,gfm:!0});const DT=10,MT=100;function LT({attachments:t}){const[s,r]=x.useState(null);return x.useEffect(()=>{if(!s)return;function o(l){l.key==="Escape"&&r(null)}return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[s]),!Array.isArray(t)||t.length===0?null:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"attachment-pills",children:t.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(ev,{size:12,className:"attachment-pill-icon"}),a.jsx("span",{className:"attachment-pill-name",children:o.name})]},l)})}),s&&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:s,alt:"preview"}),a.jsx("button",{className:"image-preview-close",onClick:()=>r(null),children:a.jsx(Tn,{size:20})})]})})]})}function OT(t){const s=Ge.parse(t);return Yd.sanitize(s)}function Km(t){var s;return(s=t.data)!=null&&s.text?t.data.text:""}function PT(t){const s=t.match(/^\/bin\/\w+\s+-\w+\s+"(.*)"$/s);return s?s[1]:t}const qm='<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 $T(t){return/<\/body>/i.test(t)?t.replace(/<\/body>/i,`${qm}</body>`):t+qm}function zT({html:t}){const[s,r]=x.useState(480),o=x.useRef(null);return x.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:$T(t),title:"HTML content",style:{width:"100%",height:`${s}px`,border:"1px solid var(--border)",borderRadius:"var(--r-md)",background:"#fff",marginTop:"8px"}})}const Ym=1e4;function FT({item:t,runtimeType:s,turn:r,threads:o}){var p,g,m,v,k,y,S,T;const l=t.status==="in_progress",[c,d]=x.useState(!1);switch(t.type){case"agent_message":{const{iconClass:E,iconText:N}=ed(s??"codex");return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:`turn-header-icon ${E}`,children:N}),a.jsx("span",{className:"turn-header-title",children:"Agent"}),l&&a.jsx("span",{className:"turn-header-meta",children:"writing…"})]}),a.jsx(Hm,{itemId:t.id,turnId:r.id,sessionId:r.session_id,content:Km(t)||"…",threads:o,runtimeType:s})]})}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(h1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Reasoning"})]}),a.jsx("div",{dangerouslySetInnerHTML:{__html:OT(Km(t))}})]});case"command_execution":{const E=t.data||{},N=PT(E.command||""),C=E.aggregated_output||"",_=E.exit_code,H=l?"running…":_!==null?`exit ${_}`:"",D=C.length>Ym,O=D&&!c?C.slice(0,Ym)+`
510
- … (truncated, click to expand)`:C;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(uv,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Command"}),H&&a.jsx("span",{className:"turn-header-meta",children:H})]}),a.jsx("pre",{className:"cmd-block",children:a.jsx("code",{children:N})}),C&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"cmd-output",children:a.jsx("code",{children:O})}),D&&a.jsx("button",{className:"cmd-output-toggle",onClick:()=>d(K=>!K),children:c?"Show less":`Show full output (${(C.length/1024).toFixed(0)}KB)`})]})]})}case"file_change":{const E=(p=t.data)==null?void 0:p.changes,N=Array.isArray(E)?E:[],C=`${N.length} file${N.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(k1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"File Changes"}),a.jsx("span",{className:"turn-header-meta",children:C})]}),a.jsx("div",{className:"file-change-list",children:N.map((_,H)=>{const D=_.kind==="add"?"A":_.kind==="delete"?"D":"M",O=_.kind==="add"?"fc-add":_.kind==="delete"?"fc-del":"fc-mod";return a.jsxs("div",{className:"file-change",children:[a.jsx("span",{className:`fc-status ${O}`,children:D}),a.jsx("span",{className:"fc-name",children:_.path})]},H)})})]})}case"mcp_tool_call":{const E=t.data||{},N=E.tool||"mcp";if(N==="Agent"){const z=E.arguments,J=(z==null?void 0:z.description)||(z==null?void 0:z.prompt)||"Subagent",he=t.status==="failed",ae=l?"running…":he?"failed":"done";return a.jsxs("div",{className:"agent-call-card",children:[a.jsx("span",{className:"agent-call-icon",children:a.jsx(mr,{size:14})}),a.jsx("span",{className:"agent-call-desc",children:J}),a.jsx("span",{className:`agent-call-status ${l?"running":he?"failed":"done"}`,children:ae})]})}const C=E.server||"",_=E.arguments,H=E.result,D=E.error,O=t.status==="failed"||!!D,K=l?"running…":O?"failed":"done",G=((g=H==null?void 0:H.content)==null?void 0:g.filter(z=>z.type==="text").map(z=>z.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(F1,{size:14})}),a.jsxs("span",{className:"turn-header-title",children:["MCP: ",N]}),C&&a.jsx("span",{className:"turn-header-meta",children:C}),a.jsx("span",{className:"turn-header-meta",style:O?{color:"var(--red)"}:void 0,children:K})]}),_&&Object.keys(_).length>0&&a.jsx("div",{className:"mcp-args",children:Object.entries(_).map(([z,J])=>a.jsxs("div",{className:"mcp-arg",children:[a.jsx("span",{className:"mcp-arg-key",children:z}),z==="code"?a.jsx("pre",{className:"cmd-block",children:a.jsx("code",{children:String(J)})}):a.jsx("span",{className:"mcp-arg-value",children:typeof J=="string"?J:JSON.stringify(J,null,2)})]},z))}),G.length>0&&G.map((z,J)=>a.jsx("pre",{className:"cmd-output",children:a.jsx("code",{children:z})},J)),D&&a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:D})})]})}case"web_search":{const E=((m=t.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(W1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Web Search"})]}),a.jsx("p",{className:"user-message",children:E})]})}case"todo_list":{const E=((v=t.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(E1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Todo List"})]}),a.jsx("ul",{className:"todo-list",children:E.map((N,C)=>a.jsxs("li",{className:N.completed?"todo-done":"todo-pending",children:[N.completed?a.jsx(Ns,{size:14}):a.jsx(Fr,{size:14})," ",N.text]},C))})]})}case"ask_user":return a.jsx(Gm,{item:t,turn:r});case"final_result":{const E=t.data??{},N=E.text||"",C=E.html||null,_=Array.isArray(E.groups)?E.groups.filter(O=>!!O&&Array.isArray(O.selections)&&O.selections.length>0):[],{iconClass:H,iconText:D}=ed(s??"codex");return a.jsxs(a.Fragment,{children:[(N||C)&&a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:`turn-header-icon ${H}`,children:D}),a.jsx("span",{className:"turn-header-title",children:"Agent"})]}),N&&a.jsx(Hm,{itemId:t.id,turnId:r.id,sessionId:r.session_id,content:N,threads:o,runtimeType:s}),C&&a.jsx(zT,{html:C})]}),_.length>0&&a.jsx(Gm,{item:t,turn:r})]})}case"background_task":{const E=t.data||{},N=E.task_type||"unknown",C=E.subagent_type||null,_=E.description||"",H=E.status||"running",D=E.last_tool_name||null,O=E.token_count||null,K=N==="local_agent",G=N==="local_bash",z=K?mr:G?lv:Jg,J=K?`Subagent${C?`: ${C}`:""}`:G?"Monitor":"Background Task",he=H==="running"?"running…":H==="completed"?"done":H==="failed"?"failed":H==="stopped"?"stopped":H,ae=t.status==="failed"||H==="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(z,{size:14})}),a.jsx("span",{className:"turn-header-title",children:J}),a.jsx("span",{className:"turn-header-meta",style:ae?{color:"var(--red)"}:void 0,children:he})]}),_&&a.jsx("p",{className:"user-message",style:{fontSize:"13px"},children:_}),D&&l&&a.jsxs("div",{className:"cmd-output",style:{color:"var(--text-3)",fontSize:"12px"},children:["last tool: ",D,O!=null&&` · ${O.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 E=((k=t.data)==null?void 0:k.trigger)??"auto",N=((y=t.data)==null?void 0:y.pre_tokens)??0,C=((S=t.data)==null?void 0:S.post_tokens)??0,_=N>0?Math.round((1-C/N)*100):0,H=E==="manual"?"Context compacted (/compact)":"Context auto-compacted";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(D1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:H})]}),a.jsxs("div",{className:"cmd-output",style:{color:"var(--text-3)"},children:[N.toLocaleString()," → ",C.toLocaleString()," tokens (",_,"% reduction)"]})]})}case"interruption":return a.jsx(ET,{item:t});case"error":{const E=((T=t.data)==null?void 0:T.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($l,{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:E})})]})}default:return null}}const Ps=x.memo(FT,(t,s)=>t.item===s.item&&t.runtimeType===s.runtimeType&&t.threads===s.threads&&t.turn.id===s.turn.id);function UT({turn:t,runtimeType:s,threads:r=[]}){Dt.trackRender("TurnContent");const[o,l]=x.useState(!1),[c,d]=x.useState(!1),[p,g]=x.useState(!1),[m,v]=x.useState(!1),k=I(L=>L.loadDeferredItems),y=t.items.some(L=>L.type==="background_task"&&L.status==="in_progress");x.useEffect(()=>{t.status==="running"||t.status==="pending"?l(!0):t.status==="completed"&&!y&&l(!1)},[t.status,y]);const S=t.deferred_item_count??0,T=Fs(t),E=x.useRef(T);x.useEffect(()=>{const L=E.current&&!T&&t.status==="completed"&&!y;if(E.current=T,L||!o||S===0||m||T&&!c)return;let R=!1;return k(t.session_id,t.id).then($=>{!$&&!R&&v(!0)}),()=>{R=!0}},[o,S,m,T,c,t.status,y,k,t.session_id,t.id]);let N=-1;for(let L=t.items.length-1;L>=0;L--)if(t.items[L].type==="agent_message"){N=L;break}const C=N>=0,_=C?t.items.slice(0,N):t.items,H=t.items.some(L=>L.type==="final_result"||L.type==="ask_user"),D=!C&&t.status==="completed"&&t.agent_response&&!H?{id:`response-${t.id}`,turn_id:t.id,external_item_id:`response-${t.id}`,type:"agent_message",data:{text:t.agent_response},status:"completed",created_at:t.created_at,updated_at:t.updated_at}:null,O=_.filter(L=>{var R;return!(L.type==="reasoning"&&(!((R=L.data)!=null&&R.text)||L.data.text===""))}),K=t.items.some(L=>{var R;return L.type==="interruption"&&((R=L.data)==null?void 0:R.reason)==="auth"}),G=t.items.some(L=>{var R;return L.type==="interruption"&&((R=L.data)==null?void 0:R.reason)==="usage_limit"}),z=O.filter(L=>{var R,$;return!(L.type==="background_task"||L.type==="ask_user"||L.type==="final_result"||K&&L.type==="error"&&((R=L.data)==null?void 0:R.error)==="authentication_failed"||G&&L.type==="error"&&(($=L.data)==null?void 0:$.error)==="rate_limit")}),J=c?0:Math.max(0,z.length-MT),he=J>0?z.slice(J):z,ae=[];let ve=null;for(const L of he)L.type==="agent_message"?(ve&&ae.push(ve),ve={agentMessage:L,toolItems:[],otherItems:[]}):L.type==="interruption"||L.type==="error"?(ve&&ae.push(ve),ae.push({agentMessage:null,toolItems:[],otherItems:[L]}),ve=null):(ve||(ve={agentMessage:null,toolItems:[],otherItems:[]}),Bm(L)?ve.toolItems.push(L):ve.otherItems.push(L));ve&&ae.push(ve);const we=t.items.filter(L=>L.type==="background_task"),Ae=p?0:Math.max(0,we.length-DT),ee=Ae>0?we.slice(Ae):we,ne=z.filter(L=>Bm(L)).length+(t.deferred_tool_calls??0),oe=ne>0||T&&(z.length>0||S>0),F=t.status==="pending"&&t.resume_state==="waiting",X=t.resume_state==="gave_up"||t.resume_state==="skipped"||t.resume_state==="unsupported";return 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:t.user_prompt}),Array.isArray(t.attachments)&&t.attachments.length>0&&a.jsx(LT,{attachments:t.attachments})]}),oe&&a.jsxs("div",{className:"tool-calls",children:[a.jsxs("div",{className:"tool-calls-header",onClick:()=>l(L=>!L),children:[a.jsx("span",{className:"tool-calls-icon",children:a.jsx(j1,{size:12})}),a.jsx("span",{className:"tool-calls-summary",children:ne>0?`${ne} tool call${ne>1?"s":""}`:F?"interrupted":"thinking…"}),a.jsx(Co,{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"}):T&&!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||T)&&a.jsxs(a.Fragment,{children:[S===0&&J>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>d(!0),children:["Show ",J," earlier step",J>1?"s":""]})}),ae.map((L,R)=>a.jsxs("div",{className:"intermediate-segment",children:[L.agentMessage&&a.jsx(Ps,{item:L.agentMessage,runtimeType:s,turn:t,threads:r}),L.otherItems.map($=>a.jsx(Ps,{item:$,runtimeType:s,turn:t,threads:r},$.id)),L.toolItems.length>0&&a.jsx(mT,{items:L.toolItems,runtimeType:s,turn:t,threads:r})]},R))]})]})]}),Ae>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>g(!0),children:["Show ",Ae," earlier background task",Ae>1?"s":""]})}),ee.map(L=>a.jsx(Ps,{item:L,runtimeType:s,turn:t,threads:r},`task-${L.id}`)),C&&a.jsx(Ps,{item:t.items[N],runtimeType:s,turn:t,threads:r},t.items[N].id),D&&a.jsx(Ps,{item:D,runtimeType:s,turn:t,threads:r},D.id),C&&t.items.slice(N+1).filter(L=>L.type!=="ask_user"&&L.type!=="background_task"&&L.type!=="final_result").map(L=>a.jsx(Ps,{item:L,runtimeType:s,turn:t,threads:r},L.id)),t.items.filter(L=>L.type==="final_result").map(L=>a.jsx(Ps,{item:L,runtimeType:s,turn:t,threads:r},`final-${L.id}`)),t.items.filter(L=>L.type==="ask_user").map(L=>a.jsx(Ps,{item:L,runtimeType:s,turn:t,threads:r},`ask-${L.id}`)),t.items.length===0&&!t.error&&(t.status==="pending"||t.status==="running")&&a.jsx("div",{className:"render-content",children:a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:t.status==="running"?"Agent is thinking…":"Waiting to start…"})}),t.error&&!X&&a.jsx("div",{className:"render-content",children:a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:t.error})})}),t.status==="running"&&a.jsx(IT,{turnId:t.id}),a.jsx(AT,{turn:t}),t.status==="aborted"&&a.jsxs("div",{className:"aborted-banner",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(Fr,{size:12})}),a.jsx("span",{className:"banner-text",children:"Turn stopped — work generated so far is kept."})]})]})}const BT=x.memo(UT),WT=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.userAgent)?"⌘K":"Ctrl+K";function HT(){const t=I(N=>N.workspaces),s=I(N=>N.loadPickerSupport),r=I(N=>N.pickAndAddWorkspace),o=I(N=>N.createSessionInWorkspace),l=I(N=>N.setImportSessionsWorkspace);x.useEffect(()=>{s()},[s]);const c=t.filter(N=>N.deleted===0),[d,p]=x.useState(null),g=c.find(N=>N.path===d)??c[c.length-1]??null,m=(g==null?void 0:g.path)??null,[v,k]=x.useState(null);x.useEffect(()=>{if(!m)return;let N=!1;return Ug(m).then(C=>{N||k({path:m,count:C.length})}).catch(()=>{}),()=>{N=!0}},[m]);const y=v&&v.path===m?v.count:0,[S,T]=x.useState(!1);async function E(N){T(!0);try{await o(N)}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${g?" done":" current"}`,children:[a.jsx("span",{className:"welcome-step-mark","aria-hidden":"true",children:g?a.jsx(Ns,{size:13}):"1"}),a.jsxs("div",{className:"welcome-step-body",children:[a.jsx("h2",{className:"welcome-step-title",children:"Add a workspace"}),g?a.jsx("p",{className:"welcome-step-text",children:a.jsx("code",{title:g.path,children:g.path})}):a.jsxs("button",{className:"dialog-btn-create welcome-primary",onClick:()=>void r(),children:[a.jsx(b1,{size:14})," Open folder…"]})]})]}),a.jsxs("li",{className:`welcome-step${g?" 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"}),g&&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:N=>p(N.target.value),children:c.map(N=>a.jsx("option",{value:N.path,children:N.label||N.path},N.id))})]}),a.jsxs("div",{className:"welcome-actions",children:[a.jsxs("button",{className:"dialog-btn-create welcome-primary",disabled:S,onClick:()=>void E(m),children:[a.jsx(fr,{size:14})," New session"]}),y>0&&a.jsxs("button",{className:"dialog-btn-cancel",onClick:()=>l(m),children:[a.jsx(sv,{size:14})," Import ",y," Claude Code"," ",y===1?"session":"sessions"]})]}),y>0&&a.jsxs("p",{className:"welcome-step-text",children:["Sessions you started with ",a.jsx("code",{children:"claude"})," 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 sessions, and press ",a.jsx("kbd",{children:WT})," for the command palette."]})]})})}const VT=[],el=50;function GT(){Dt.trackRender("RenderArea");const t=I(S=>S.activeSessionId),s=I(S=>S.activeSessionId?S.sessionDetails[S.activeSessionId]:null),r=I(S=>S.submittingPrompt),o=I(S=>S.loading),l=I(S=>!S.activeSessionId&&!VS(S.workspaces,S.sessions,S.appsRootPath)),c=(s==null?void 0:s.turns)??[],d=(s==null?void 0:s.threads)??VT,p=x.useRef(null),[g,m]=x.useState(el);x.useEffect(()=>{m(el)},[t]);const v=c.filter(S=>!S.thread_id),k=Math.max(0,v.length-g),y=v.slice(k);return x.useEffect(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},[t,c.length]),o&&!s?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"})]})}):s?a.jsxs("div",{className:"render-scroll",ref:p,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+el),children:["Show ",Math.min(el,k)," earlier turns (",k," hidden)"]})}),y.map((S,T)=>a.jsx("div",{id:`turn-${k+T}`,className:"turn-block",children:a.jsx(BT,{turn:S,runtimeType:s.runtime_type,threads:d})},S.id))]}):l?a.jsx(HT,{}):a.jsx("div",{className:"render-scroll",children:a.jsx("div",{className:"empty-state",children:"No session selected"})})}const KT=x.memo(GT),qT=[{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 YT(t){return t.map(s=>({id:s.name,label:`/${s.name}`,hint:s.description,capability:null,insertAsText:!0}))}function XT(t,s,r=[]){const o=[...qT,...YT(r)],l=new Set;return o.filter(c=>!(l.has(c.label)||(l.add(c.label),c.capability&&!s[c.capability])||t&&!c.label.toLowerCase().includes(t.toLowerCase())))}function QT({commands:t,selectedIndex:s,onSelect:r,onHover:o}){return a.jsxs("div",{className:"slash-popup",children:[a.jsx("div",{className:"slash-popup-header",children:"Commands"}),t.length===0&&a.jsx("div",{className:"slash-popup-empty",children:"No matching commands"}),t.map((l,c)=>a.jsxs("div",{className:`slash-popup-item ${c===s?"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 Ku({title:t,options:s,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:t})]}),s.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 ZT(t){return Mt("/skills")}function JT({filter:t,onSelect:s,onClose:r}){const[o,l]=x.useState([]),[c,d]=x.useState(!0),[p,g]=x.useState(0),m=x.useRef(null);x.useEffect(()=>{ZT().then(l).catch(()=>l([])).finally(()=>d(!1))},[]);const v=o.filter(k=>k.name.toLowerCase().includes(t.toLowerCase())||k.description.toLowerCase().includes(t.toLowerCase()));return x.useEffect(()=>{g(0)},[t]),x.useEffect(()=>{function k(y){y.key==="ArrowDown"?(y.preventDefault(),g(S=>Math.min(S+1,v.length-1))):y.key==="ArrowUp"?(y.preventDefault(),g(S=>Math.max(S-1,0))):y.key==="Enter"?(y.preventDefault(),v[p]&&s(v[p])):y.key==="Escape"&&(y.preventDefault(),r())}return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[v,p,s,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,y)=>a.jsxs("div",{className:`slash-popup-item ${y===p?"selected":""}`,onMouseEnter:()=>g(y),onClick:()=>s(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 oy(){return Mt("/providers")}function eN(t,s){const r=s?`?cwd=${encodeURIComponent(s)}`:"";return Mt(`/providers/${t}/commands${r}`)}const tN={dynamicModels:!1,skills:!1,plugins:!1,mcpServers:!1,imageAttachments:!1,sandbox:!1,webSearch:!1,networkAccess:!1,fileReferences:!1};function nN(t){const[s,r]=x.useState([]),[o,l]=x.useState(!0);x.useEffect(()=>{oy().then(r).catch(()=>r([])).finally(()=>l(!1))},[]);const c=s.find(d=>d.id===t)??null;return{provider:c,capabilities:(c==null?void 0:c.capabilities)??tN,loading:o}}const gi=32,qu=200;function Xm(t){if(!t)return{};try{return JSON.parse(t)}catch{return{}}}function Qm(t){return t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}let Zm=0;function sN(){return Zm+=1,`att-${Date.now()}-${Zm}`}function rN(){Dt.trackRender("CommandInputBar");const[t,s]=x.useState(""),r=x.useRef(null),o=x.useRef(gi),l=x.useRef(null),{submitPrompt:c,cancelTurn:d,updateRuntimeConfig:p,setShowModelSelector:g}=I(),m=I(q=>q.activeSessionId),v=I(q=>q.activeSessionId?q.sessionDetails[q.activeSessionId]:null),k=I(q=>q.quotedText),y=Dg(v),S=!!(v!=null&&v.turns.some(q=>q.status==="pending"&&q.resume_state==="waiting")),T=!m,{capabilities:E}=nN(v==null?void 0:v.runtime_type),N=(v==null?void 0:v.runtime_type)??null,C=E.imageAttachments,[_,H]=x.useState([]),[D,O]=x.useState(!1),[K,G]=x.useState(null),[z,J]=x.useState([]);x.useEffect(()=>{if(!N){J([]);return}let q=!1;return eN(N,(v==null?void 0:v.cwd)??void 0).then(ge=>{q||J(ge)}).catch(()=>{q||J([])}),()=>{q=!0}},[N,v==null?void 0:v.cwd]);const[he,ae]=x.useState(!1),[ve,we]=x.useState(""),[Ae,ee]=x.useState(0),[ne,oe]=x.useState(void 0),[F,X]=x.useState(!1),[L,R]=x.useState(""),[$,le]=x.useState([]),me=he?XT(ve,E,z):[];x.useEffect(()=>{k!==null&&(s(q=>q+k),setTimeout(()=>{if(r.current){Ee(),r.current.focus();const q=r.current.value.length;r.current.setSelectionRange(q,q)}},0),I.setState({quotedText:null}))},[k]),x.useEffect(()=>{if(!y)return;function q(ge){ge.key==="Escape"&&(ge.preventDefault(),d())}return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[y,d]),x.useEffect(()=>{ae(!1),oe(void 0),X(!1),le([]),H(q=>{for(const ge of q)ge.previewUrl&&URL.revokeObjectURL(ge.previewUrl);return[]})},[m]),x.useEffect(()=>{if(!K)return;function q(ge){ge.key==="Escape"&&(ge.preventDefault(),G(null))}return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[K]);const Y=x.useCallback(q=>{if(!q)return;const ge=Array.from(q);for(const Ue of ge){const nt=new FileReader;nt.onload=()=>{const gt=nt.result.split(",")[1]??"",Ct=Ue.type.startsWith("image/")?URL.createObjectURL(Ue):void 0;H(an=>[...an,{id:sN(),name:Ue.name,media_type:Ue.type||"application/octet-stream",data:gt,previewUrl:Ct,size:Ue.size}])},nt.readAsDataURL(Ue)}},[]),fe=x.useCallback(q=>{H(ge=>{const Ue=ge.find(nt=>nt.id===q);return Ue!=null&&Ue.previewUrl&&URL.revokeObjectURL(Ue.previewUrl),ge.filter(nt=>nt.id!==q)})},[]),Te=x.useCallback(q=>{q.preventDefault(),q.stopPropagation(),!(!C||y)&&O(!0)},[C,y]),se=x.useCallback(q=>{q.preventDefault(),q.stopPropagation(),O(!1)},[]),pe=x.useCallback(q=>{q.preventDefault(),q.stopPropagation(),O(!1),!(!C||y)&&Y(q.dataTransfer.files)},[C,y,Y]),be=x.useCallback(q=>{var nt;if(!C)return;const ge=(nt=q.clipboardData)==null?void 0:nt.items;if(!ge)return;const Ue=[];for(let mt=0;mt<ge.length;mt++){const gt=ge[mt];if(gt.type.startsWith("image/")){const Ct=gt.getAsFile();Ct&&Ue.push(Ct)}}Ue.length>0&&(q.preventDefault(),Y(Ue))},[C,Y]);function He(q){const ge=r.current;ge&&(ge.style.height=`${q}px`,o.current=q)}function Ee(){const q=r.current;if(q){if(q.scrollHeight>q.clientHeight){const ge=Math.min(q.scrollHeight,qu);ge!==o.current&&He(ge);return}o.current>gi&&(q.style.height="auto",He(Math.min(q.scrollHeight,qu)))}}function ct(){const q=t.trim();if(!q||y)return;let ge=q;$.length>0&&(ge=`${$.map(mt=>`$${mt.name}`).join(" ")}
511
-
512
- ${q}`);const Ue=_.map(({id:nt,previewUrl:mt,size:gt,...Ct})=>Ct);s(""),le([]),He(gi),ae(!1),oe(void 0),X(!1);for(const nt of _)nt.previewUrl&&URL.revokeObjectURL(nt.previewUrl);H([]),c(ge,Ue.length>0?Ue:void 0)}function $e(q){if(q.insertAsText){const ge=`/${q.id} `;s(ge),ae(!1),oe(void 0),requestAnimationFrame(()=>{if(r.current){r.current.focus();const Ue=ge.length;r.current.setSelectionRange(Ue,Ue),Ee()}});return}q.subPopup?oe(q.subPopup):q.id==="skills"?(X(!0),R(""),ae(!1),s("")):q.id==="model"?(g(!0),ae(!1),s("")):(ae(!1),s(""))}function en(q){le(ge=>[...ge,q]),X(!1),s(""),He(gi)}function Fe(q){const ge=Xm(v==null?void 0:v.runtime_config);ne==="sandbox"?ge.sandboxMode=q:ne==="websearch"?ge.webSearchMode=q:ne==="network"&&(ge.networkAccessEnabled=q==="true"),p(ge),oe(void 0),ae(!1),s(""),He(gi)}function Ht(q){if(Dt.markKeystroke(),he&&!ne){if(q.key==="ArrowDown"){q.preventDefault(),ee(ge=>Math.min(ge+1,me.length-1));return}if(q.key==="ArrowUp"){q.preventDefault(),ee(ge=>Math.max(ge-1,0));return}if(q.key==="Enter"){q.preventDefault(),me[Ae]&&$e(me[Ae]);return}if(q.key==="Escape"){q.preventDefault(),ae(!1),s("");return}}if(ne&&q.key==="Escape"){q.preventDefault(),oe(void 0);return}if(q.key==="Enter"&&(q.metaKey||q.ctrlKey)&&!y){q.preventDefault(),ct();return}q.key==="Escape"&&y&&(q.preventDefault(),d())}function tn(q){Dt.markInputChange();const ge=q.target.value;s(ge),Ee(),ge.startsWith("/")&&!ge.includes(" ")&&!y?(ae(!0),we(ge.slice(1)),ee(0)):(ae(!1),oe(void 0)),ge.startsWith("$")&&!y?(X(!0),R(ge.slice(1))):ge.startsWith("$")||X(!1)}const wt=Xm(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"}],zt=[{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"}],Lt=[{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${D?" drag-over":""}`,onDragOver:Te,onDragLeave:se,onDrop:pe,children:[he&&!ne&&a.jsx(QT,{commands:me,selectedIndex:Ae,onSelect:$e,onHover:ee}),he&&ne==="sandbox"&&a.jsx(Ku,{title:"Sandbox Mode",options:jt,currentValue:wt.sandboxMode,onSelect:Fe,onClose:()=>oe(void 0)}),he&&ne==="websearch"&&a.jsx(Ku,{title:"Web Search",options:zt,currentValue:wt.webSearchMode,onSelect:Fe,onClose:()=>oe(void 0)}),he&&ne==="network"&&a.jsx(Ku,{title:"Network Access",options:Lt,currentValue:wt.networkAccessEnabled===!0?"true":"false",onSelect:Fe,onClose:()=>oe(void 0)}),F&&a.jsx(JT,{filter:L,onSelect:en,onClose:()=>{X(!1),s("")}}),$.length>0&&a.jsx("div",{className:"skill-badges",children:$.map(q=>a.jsxs("span",{className:"skill-badge",children:["$",q.name,a.jsx("button",{className:"skill-badge-remove",onClick:()=>le(ge=>ge.filter(Ue=>Ue.id!==q.id)),children:"×"})]},q.id))}),_.length>0&&a.jsx("div",{className:"attachment-preview-area",children:_.map(q=>a.jsxs("div",{className:"attachment-chip",title:q.name,children:[q.previewUrl?a.jsx("img",{src:q.previewUrl,alt:q.name,className:"attachment-thumb",onClick:()=>G(q),style:{cursor:"pointer"}}):a.jsx(ev,{size:20,className:"attachment-file-icon"}),a.jsxs("div",{className:"attachment-info",children:[a.jsx("span",{className:"attachment-name",children:q.name}),a.jsx("span",{className:"attachment-size",children:Qm(q.size)})]}),a.jsx("button",{className:"attachment-remove",onClick:()=>fe(q.id),title:"Remove attachment",children:a.jsx(Tn,{size:14})})]},q.id))}),C&&!y&&!T&&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:q=>{Y(q.target.files),q.target.value=""}}),a.jsxs("div",{className:"cmd-input-row",children:[C&&!y&&!T&&a.jsx("button",{className:"attachment-clip-btn",onClick:()=>{var q;return(q=l.current)==null?void 0:q.click()},title:"Attach files",disabled:y,children:a.jsx($1,{size:16})}),a.jsx("textarea",{ref:r,className:"cmd-textarea",placeholder:T?"Select or create a session…":S?"Interrupted — waiting to resume…":y?"Agent is running…":"Type a message… Use / for commands",autoComplete:"off",value:t,disabled:y||T,rows:1,style:{minHeight:gi,maxHeight:qu},onChange:tn,onKeyDown:Ht,onPaste:be}),y?a.jsx("button",{className:"cmd-stop-btn",onClick:()=>d(),title:"Stop (Esc)",children:a.jsx(Fr,{size:15})}):a.jsx("button",{className:"cmd-send-btn",onClick:ct,disabled:!t.trim()||T,title:"Send (⌘↵)",children:a.jsx(Zg,{size:16})})]}),K&&a.jsx("div",{className:"image-preview-modal",onClick:()=>G(null),children:a.jsxs("div",{className:"image-preview-content",onClick:q=>q.stopPropagation(),children:[a.jsx("img",{src:K.previewUrl,alt:K.name}),a.jsxs("div",{className:"image-preview-info",children:[a.jsx("span",{children:K.name}),a.jsx("span",{children:Qm(K.size)})]}),a.jsx("button",{className:"image-preview-close",onClick:()=>G(null),children:a.jsx(Tn,{size:20})})]})})]})}function iN(){const t=I(N=>N.activeSessionId),s=I(N=>N.activeSessionId?N.sessionDetails[N.activeSessionId]:null),r=I(N=>N.activeTurnIndex),o=I(N=>N.setActiveTurnIndex),l=I(N=>N.rewindToTurn),c=I(N=>N.restoreSession),d=I(N=>N.branchFromTurn),p=(s==null?void 0:s.turns)??[],g=Ml(s),m=!!(s!=null&&s.rewound_at_turn_id),v=(s==null?void 0:s.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.",[y,S]=x.useState(null),T=x.useRef(null);if(Mo(T,()=>S(null),!!y),Ni(()=>S(null),!!y),p.length===0)return a.jsx("div",{className:"empty-state",children:"No turns yet"});function E(N){o(N),requestAnimationFrame(()=>{var C;(C=document.getElementById(`turn-${N}`))==null||C.scrollIntoView({behavior:"smooth",block:"start"})})}return a.jsxs("div",{className:"right-section",children:[a.jsx("div",{className:"right-section-title",children:"Conversation"}),p.map((N,C)=>{const _=C===r,H=N.user_prompt.length>50?N.user_prompt.slice(0,50)+"…":N.user_prompt,D=N.status==="running"||N.status==="pending";return a.jsx("div",{children:a.jsxs("div",{className:`turn-item ${_?"active":""}`,onClick:()=>E(C),onContextMenu:O=>{O.preventDefault(),S({x:O.clientX,y:O.clientY,turnId:N.id,turnIndex:C,isLast:C===p.length-1,isSlashCommand:N.user_prompt.trimStart().startsWith("/")})},children:[a.jsx("span",{className:"turn-item-icon",style:{background:"var(--amber)",color:"#fff"},children:a.jsx(K1,{size:12})}),a.jsx("span",{className:"turn-item-label",children:H}),D&&a.jsx("span",{className:"turn-item-status",children:N.status==="pending"&&N.resume_state==="waiting"?"interrupted":"running…"})]})},N.id)}),y&&a.jsxs("div",{ref:T,className:"ctx-menu",style:{position:"fixed",left:y.x,top:y.y,zIndex:500},children:[a.jsxs("div",{className:`ctx-menu-item ${y.isLast||g||y.isSlashCommand?"ctx-disabled":""}`,onClick:()=>{y.isLast||g||y.isSlashCommand||(window.confirm(k)&&l(t,y.turnId),S(null))},children:[a.jsx(B1,{size:12})," Rewind to Here",y.isSlashCommand?" (slash command)":""]}),m&&!v&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{c(t),S(null)},children:[a.jsx(Eo,{size:12})," Restore Rewind"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{d(t,y.turnId),S(null)},children:[a.jsx(nv,{size:12})," Branch from Here"]})]})]})}function Xd(t){return(t??[]).filter(s=>s.task_type!=="local_agent").length}const Jm=2e4;function oN(t){const s=[];return t.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;s.push({item:c,turnIndex:o,turnPrompt:r.user_prompt})}}),s}function aN({entry:t}){const{item:s,turnIndex:r,turnPrompt:o}=t,l=s.data||{},c=l.task_type||"unknown",d=l.subagent_type||null,p=l.description||"",g=l.summary||null,m=l.last_tool_name||null,v=l.token_count||null,k=l.output||"",y=s.status==="in_progress",S=l.status||"running",T=!y&&S==="running"?"stopped":S,E=c==="local_agent",N=c==="local_bash",C=E?mr:N?lv:Jg,_=E?`Subagent${d?`: ${d}`:""}`:N?"Monitor":"Background Task",H=T==="running"?"running…":T==="completed"?"done":T==="failed"?"failed":T==="stopped"?"stopped":T,D=T==="failed"||s.status==="failed"&&T!=="stopped",[O,K]=x.useState(y),[G,z]=x.useState(!1),J=x.useRef(null);x.useEffect(()=>{y&&K(!0)},[y]),x.useEffect(()=>{O&&y&&J.current&&(J.current.scrollTop=J.current.scrollHeight)},[O,y,k]);const he=k.length>Jm,ae=he&&!G?k.slice(0,Jm)+`
513
- … (truncated, click to expand)`:k,ve=y?null:T==="completed"?a.jsx(Ns,{size:12}):D?a.jsx($l,{size:12}):a.jsx(Fr,{size:12});return a.jsxs("div",{className:`task-card ${y?"task-running":""} ${D?"task-failed":""}`,children:[a.jsxs("div",{className:"task-card-header",onClick:()=>K(we=>!we),style:{cursor:"pointer"},children:[a.jsx("span",{className:"task-card-icon",children:a.jsx(C,{size:14})}),a.jsx("span",{className:"task-card-type",children:_}),a.jsxs("span",{className:`task-card-status ${D?"task-status-failed":y?"task-status-running":"task-status-done"}`,children:[ve," ",H]}),a.jsx(Co,{size:14,className:"task-card-chevron",style:{transform:O?"rotate(90deg)":"none",marginLeft:"auto"}})]}),p&&a.jsx("div",{className:"task-card-desc",children:p}),y&&m&&a.jsxs("div",{className:"task-card-meta",children:["last tool: ",m,v!=null&&` · ${v.toLocaleString()} tokens`]}),O&&a.jsxs("div",{className:"task-card-body",children:[k?a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"cmd-output task-output",ref:J,children:a.jsx("code",{children:ae})}),he&&a.jsx("button",{className:"cmd-output-toggle",onClick:()=>z(we=>!we),children:G?"Show less":`Show full output (${(k.length/1024).toFixed(0)}KB)`})]}):g?a.jsx("pre",{className:"cmd-output task-output",children:a.jsx("code",{children:g})}):y?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:o,children:["from turn ",r+1,": ",o.length>60?o.slice(0,60)+"…":o]})]})]})}const lN=x.memo(aN);function cN(){const t=I(d=>d.activeSessionId?d.sessionDetails[d.activeSessionId]:null),s=I(d=>d.activeSessionId?d.backgroundTasks[d.activeSessionId]:void 0),r=(t==null?void 0:t.turns)??[],o=oN(r),l=[...o].sort((d,p)=>{const g=d.item.status==="in_progress",m=p.item.status==="in_progress";return g&&!m?-1:!g&&m?1:p.turnIndex-d.turnIndex}),c=Xd(s);return o.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 (",o.length,")",c>0&&a.jsxs("span",{className:"task-count-badge",style:{color:"var(--amber)"},children:[" ",c," running"]})]}),l.map(d=>a.jsx(lN,{entry:d},d.item.id))]})}const uN=x.memo(cN),dN="Your job is to answer questions about this session:",eg="Understand the user's question below, read the session file given above, and answer.",fN=new Set(["claude"]);function pN(t){return fN.has(t)}function Qd(t){return t.kind==="sidecar"}function hN(t){const s=(t??[]).filter(Qd);return s.length?s[s.length-1]:null}function mN(t){if(!t.startsWith(dN))return t;const s=t.indexOf(eg);return s<0?t:t.slice(s+eg.length).replace(/^\n+/,"")}function gN({thread:t,onClose:s}){const{activeSessionId:r,resolveThread:o,shareThread:l}=I(),[c,d]=x.useState(""),[p,g]=x.useState(!1),[m,v]=x.useState(!1);async function k(){if(!r||p)return;g(!0),await l(r,t.id,c)?s():g(!1)}async function y(){!r||m||(v(!0),await o(r,t.id),s())}const S=p||m;return a.jsx("div",{className:"dialog-overlay",onClick:S?void 0:s,children:a.jsxs("div",{className:"dialog",onClick:T=>T.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:s,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:T=>d(T.target.value),rows:3,disabled:S,autoFocus:!0})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:s,disabled:S,children:"Cancel"}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:y,disabled:S,title:"Resolve without sharing",children:[m?a.jsx(hn,{size:13,className:"spin"}):a.jsx(vl,{size:13}),"Resolve only"]}),a.jsxs("button",{className:"dialog-btn-create",onClick:k,disabled:S,children:[p?a.jsx(hn,{size:13,className:"spin"}):a.jsx(H1,{size:13}),p?"Summarizing…":"Share & Resolve"]})]})]})})}const tg=[];Ge.setOptions({breaks:!0,gfm:!0});function vN(t){const s=Ge.parse(t);return Yd.sanitize(s)}function yN(t){var s,r,o;if(t.type==="agent_message"||t.type==="final_result"){const l=(s=t.data)==null?void 0:s.text;return typeof l=="string"&&l?l:null}if(t.type==="ask_user"){const l=Array.isArray((r=t.data)==null?void 0:r.groups)?t.data.groups:[],c=[(o=t.data)==null?void 0:o.question,...l.map(d=>d.question)].filter(d=>typeof d=="string"&&!!d);return c.length?c.join(`
514
-
515
- `):null}return null}function xN(t){const s=t.match(/^\[Quoting from your previous response\]:\n> .*\n\n([\s\S]*)$/);return s?s[1]:t}function ay({turn:t,formatPrompt:s=xN}){const r=s(t.user_prompt),o=t.items.map(yN).filter(l=>l!==null);return o.length===0&&t.status==="completed"&&t.agent_response&&o.push(t.agent_response),a.jsxs("div",{className:"thread-card-turn",children:[a.jsx("div",{className:"thread-card-user-message",children:r}),o.map((l,c)=>a.jsx("div",{className:"thread-card-ai-response",dangerouslySetInnerHTML:{__html:vN(l)}},c)),o.length===0&&(t.status==="pending"||t.status==="running")&&a.jsx("div",{className:"thread-card-pending",children:t.status==="running"?"AI is responding…":"Waiting…"}),t.status==="failed"&&a.jsx("div",{className:"thread-card-pending",children:t.error||"Turn failed"})]})}function wN({thread:t,threadTurns:s,onStop:r,onResolve:o,onReopen:l,onDelete:c,onFollowup:d,onLocate:p}){var we,Ae,ee;const[g,m]=x.useState(""),[v,k]=x.useState(!0),y=x.useRef(null),S=x.useRef(null),[T,E]=x.useState(!1),[N,C]=x.useState({x:0,y:0}),[_,H]=x.useState(""),D=s.some(Fs),O=28,K=120,G=x.useRef(O);x.useEffect(()=>{const ne=S.current;ne&&(ne.scrollTop=ne.scrollHeight)},[s.length,v]);function z(ne){const oe=y.current;oe&&(oe.style.height=`${ne}px`,G.current=ne)}function J(){const ne=y.current;if(ne){if(ne.scrollHeight>ne.clientHeight){const oe=Math.min(ne.scrollHeight,K);oe!==G.current&&z(oe);return}G.current>O&&(ne.style.height="auto",z(Math.min(ne.scrollHeight,K)))}}const he=x.useCallback(()=>{E(!1)},[]),ae=x.useCallback(()=>{const ne=S.current;if(!ne)return;const oe=window.getSelection();if(!oe||oe.rangeCount===0||oe.isCollapsed){E(!1);return}const F=oe.getRangeAt(0);if(!ne.contains(F.commonAncestorContainer)){E(!1);return}const X=F.commonAncestorContainer.nodeType===Node.TEXT_NODE?F.commonAncestorContainer.parentElement:F.commonAncestorContainer;if(!(X!=null&&X.closest(".thread-card-ai-response"))){E(!1);return}const L=oe.toString();if(!L.trim()){E(!1);return}const R=F.getBoundingClientRect(),$=28,le=6,me=170;let Y=!1;if(oe.anchorNode&&oe.focusNode)try{const se=document.createRange();se.setStart(oe.focusNode,oe.focusOffset),se.setEnd(oe.focusNode,oe.focusOffset);const pe=document.createRange();pe.setStart(oe.anchorNode,oe.anchorOffset),pe.setEnd(oe.anchorNode,oe.anchorOffset),Y=pe.compareBoundaryPoints(Range.START_TO_START,se)>0}catch{Y=!1}let fe=R.top-$-le;fe<8&&(fe=R.bottom+le);let Te=Y?R.left-me:R.right;Te=Math.max(8,Math.min(Te,window.innerWidth-me-8)),C({x:Te,y:fe}),H(L),E(!0)},[]);x.useEffect(()=>{function ne(oe){const F=oe.target;F&&F.closest(".selection-actions")||ae()}return document.addEventListener("mouseup",ne),()=>document.removeEventListener("mouseup",ne)},[ae]);const ve=x.useCallback(()=>{var oe;const ne=`
516
- \`\`\`QUOTE
517
- ${_}
518
- \`\`\`
519
-
520
- `;m(F=>F+ne),E(!1),H(""),(oe=window.getSelection())==null||oe.removeAllRanges(),setTimeout(()=>{if(y.current){J(),y.current.focus();const F=y.current.value.length;y.current.setSelectionRange(F,F)}},0)},[_]);return a.jsxs("div",{className:`thread-card ${t.status==="resolved"?"thread-resolved":""}`,id:`thread-${t.id}`,children:[a.jsxs("div",{className:"thread-card-header",onClick:()=>k(ne=>!ne),children:[a.jsx("div",{className:"thread-card-quote",children:t.selected_text===null?((ee=(Ae=(we=t.turns)==null?void 0:we[0])==null?void 0:Ae.user_prompt)==null?void 0:ee.slice(0,100))||"Quick question":`“${t.selected_text.slice(0,100)}${t.selected_text.length>100?"…":""}”`}),a.jsxs("div",{className:"thread-card-header-right",children:[t.selected_text!==null&&a.jsx("button",{className:"thread-locate-btn",onClick:ne=>{ne.stopPropagation(),p()},title:"Scroll to text",children:a.jsx(M1,{size:12})}),a.jsx("span",{className:`thread-status-badge ${t.status==="open"?"thread-status-open":"thread-status-resolved"}`,children:t.status==="open"?"Open":"Resolved"})]})]}),v&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"thread-card-conversation",ref:S,onMouseDown:he,children:[s.map(ne=>a.jsx(ay,{turn:ne},ne.id)),s.length===0&&a.jsx("div",{className:"thread-card-placeholder",children:"No messages yet."})]}),T&&a.jsx("div",{className:"selection-actions",style:{left:N.x,top:N.y},children:a.jsxs("button",{className:"discuss-button",onClick:ve,title:"Quote this text in your follow-up",children:[a.jsx(ov,{size:14}),a.jsx("span",{children:"Quote"})]})}),t.status==="open"&&a.jsxs("div",{className:"thread-card-followup",children:[a.jsx("textarea",{ref:y,className:"thread-card-followup-input",placeholder:D?"Agent is running…":"Type a follow-up…",value:g,onChange:ne=>{Dt.markInputChange(),m(ne.target.value),J()},disabled:D,rows:1,style:{minHeight:O,maxHeight:K},onKeyDown:ne=>{Dt.markKeystroke(),ne.key==="Enter"&&(ne.metaKey||ne.ctrlKey)&&!D&&g.trim()&&(ne.preventDefault(),d(g.trim()),m(""),z(O))}}),a.jsx("button",{className:"thread-card-followup-send",disabled:D||!g.trim(),onClick:()=>{d(g.trim()),m("")},children:a.jsx(Lo,{size:13})}),D&&a.jsx("button",{className:"thread-card-followup-stop",onClick:r,title:"Stop this thread's turn (Esc)",children:a.jsx(Fr,{size:13})})]}),a.jsxs("div",{className:"thread-card-actions",children:[t.status==="open"?a.jsxs("button",{className:"thread-action-btn",onClick:o,title:"Resolve thread",children:[a.jsx(vl,{size:13})," Resolve"]}):a.jsxs("button",{className:"thread-action-btn",onClick:l,title:"Reopen thread",children:[a.jsx(Eo,{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 kN(){Dt.trackRender("ThreadsPanel");const t=I(C=>C.activeSessionId),s=I(C=>{var _;return C.activeSessionId?((_=C.sessionDetails[C.activeSessionId])==null?void 0:_.threads)??tg:tg}),r=x.useMemo(()=>s.filter(C=>!Qd(C)),[s]),o=I(C=>C.followupThread),l=I(C=>C.cancelThreadTurn),c=I(C=>C.reopenThread),d=I(C=>C.deleteThread),p=I(C=>C.deepLinkThreadId),g=I(C=>C.setDeepLinkThreadId),[m,v]=x.useState("open"),[k,y]=x.useState(null);x.useEffect(()=>{if(!p)return;const C=p;g(null),v(H=>r.some(D=>D.id===C&&D.status==="open")?H:"all");const _=setTimeout(()=>{const H=document.getElementById(`thread-${C}`);H&&(H.scrollIntoView({behavior:"smooth",block:"center"}),H.classList.add("thread-card-highlighted"),setTimeout(()=>H.classList.remove("thread-card-highlighted"),1500))},100);return()=>clearTimeout(_)},[p,g,r]);const S=r.filter(C=>m==="open"?C.status==="open":m==="resolved"?C.status==="resolved":!0),T=r.filter(C=>C.status==="open").length,E=r.filter(C=>C.status==="resolved").length;function N(C){setTimeout(()=>{const _=document.querySelector(`mark[data-thread-id="${C}"]`);_&&(_.scrollIntoView({behavior:"smooth",block:"center"}),_.classList.add("thread-mark-flash"),setTimeout(()=>_.classList.remove("thread-mark-flash"),1500))},50)}return t?r.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx(iv,{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 (",T,")"]}),a.jsxs("button",{className:`thread-filter-tab ${m==="resolved"?"active":""}`,onClick:()=>v("resolved"),children:["Resolved (",E,")"]}),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(C=>a.jsx(wN,{thread:C,threadTurns:C.turns??[],onStop:()=>l(t,C.id),onResolve:()=>y(C),onReopen:()=>c(t,C.id),onDelete:()=>d(t,C.id),onFollowup:_=>o(t,C.id,_),onLocate:()=>N(C.id)},C.id)),k&&a.jsx(gN,{thread:k,onClose:()=>y(null)})]}):a.jsx("div",{className:"empty-state",children:"No session selected"})}function SN(){const t=I(d=>d.apps),s=I(d=>d.activeAppTabId),r=I(d=>d.openAppTab),o=I(d=>d.startAppEdit),l=I(d=>d.toggleAppPin),c=I(d=>d.deleteApp);return t.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:t.map(d=>a.jsxs("div",{className:`apps-panel-row${s===d.id?" active":""}`,onClick:()=>r(d.id),title:d.description??void 0,children:[a.jsx(ji,{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:p=>{p.stopPropagation(),o(d.id)},children:a.jsx(ol,{size:12})}),a.jsx("button",{className:`apps-panel-action${d.pinned?" pinned":""}`,title:d.pinned?"Unpin app":"Pin app (sorts first)",onClick:p=>{p.stopPropagation(),l(d.id)},children:a.jsx(xl,{size:12,fill:d.pinned?"currentColor":"none"})}),a.jsx("button",{className:"apps-panel-action apps-panel-danger",title:"Delete app",onClick:p=>{p.stopPropagation(),c(d.id)},children:a.jsx(us,{size:12})})]},d.id))})}const bN=24;function TN(){Dt.trackRender("SidecarPanel");const t=I(C=>C.activeSessionId),s=I(C=>{var _;return C.activeSessionId?(_=C.sessionDetails[C.activeSessionId])==null?void 0:_.runtime_type:void 0}),r=I(C=>{var _;return C.activeSessionId?hN((_=C.sessionDetails[C.activeSessionId])==null?void 0:_.threads):null}),o=I(C=>C.askSidecar),l=I(C=>C.cancelThreadTurn),c=I(C=>C.deleteThread),[d,p]=x.useState(""),[g,m]=x.useState(!1),v=x.useRef(null),k=x.useRef(!0),y=(r==null?void 0:r.turns)??[],S=y[y.length-1],T=y.some(Fs);if(x.useEffect(()=>{k.current=!0},[t,y.length]),x.useEffect(()=>{const C=v.current;C&&k.current&&(C.scrollTop=C.scrollHeight)},[t,y.length,S==null?void 0:S.items.length,S==null?void 0:S.status]),!t||!s)return a.jsx("div",{className:"empty-state",children:"No session selected"});if(!pN(s))return a.jsxs("div",{className:"empty-state",children:[a.jsx(mr,{size:24,style:{opacity:.3,marginBottom:8}}),a.jsxs("div",{children:["The sidecar is not available for ",s," sessions yet."]})]});const E=!T&&!g&&d.trim().length>0;async function N(){if(!t||!E)return;m(!0);const C=await o(t,d.trim());m(!1),C&&p("")}return a.jsxs("div",{className:"sidecar-panel",children:[a.jsx("div",{ref:v,className:"sidecar-conversation",onScroll:C=>{const _=C.currentTarget;k.current=_.scrollHeight-_.scrollTop-_.clientHeight<=bN},children:y.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx(mr,{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?"})]}):y.map(C=>a.jsx(ay,{turn:C,formatPrompt:mN},C.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:T?"Sidecar is answering…":"Ask about this session… (⌘/Ctrl+Enter)",value:d,rows:2,disabled:T,onChange:C=>{Dt.markInputChange(),p(C.target.value)},onKeyDown:C=>{Dt.markKeystroke(),C.key==="Enter"&&(C.metaKey||C.ctrlKey)&&(C.preventDefault(),N())}}),T&&r?a.jsx("button",{className:"thread-card-followup-stop",title:"Stop the answer","aria-label":"Stop the answer",onClick:()=>l(t,r.id),children:a.jsx(Fr,{size:13})}):a.jsx("button",{className:"thread-card-followup-send",title:"Ask","aria-label":"Ask",disabled:!E,onClick:()=>void N(),children:a.jsx(Lo,{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:T,onClick:()=>c(t,r.id),children:[a.jsx(us,{size:13})," Clear"]})})]})]})}function NN(){var g;Dt.trackRender("RightPanel");const t=I(m=>m.activeRightTab),s=I(m=>m.switchRightTab),r=I(m=>m.rightPanelCollapsed),o=I(m=>m.toggleRightPanel),l=I(m=>m.activeSessionId?m.sessionDetails[m.activeSessionId]:null),c=I(m=>m.activeSessionId?Xd(m.backgroundTasks[m.activeSessionId]):0),d=((g=l==null?void 0:l.threads)==null?void 0:g.filter(m=>m.status==="open"&&!Qd(m)).length)??0,p=[{id:"turns",label:"Turns",icon:_1},{id:"sidecar",label:"Sidecar",icon:mr},{id:"tasks",label:"Tasks",icon:C1,badge:c||void 0},{id:"threads",label:"Threads",icon:iv,badge:d||void 0},{id:"apps",label:"Apps",icon:rv}];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(O1,{size:15})}),a.jsx("div",{className:"right-rail-divider"}),p.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 ${t===m.id?"active":""}`,title:k,"aria-label":k,onClick:()=>s(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:p.map(m=>a.jsxs("div",{className:`right-tab ${t===m.id?"active":""}`,onClick:()=>s(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(L1,{size:14})})]}),a.jsxs("div",{className:"right-content",children:[t==="turns"&&a.jsx(iN,{}),t==="sidecar"&&a.jsx(TN,{}),t==="tasks"&&a.jsx(uN,{}),t==="threads"&&a.jsx(kN,{}),t==="apps"&&a.jsx(SN,{})]})]})}const Ie={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"}},pd=[{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:[Ie.low,Ie.medium,Ie.high,Ie.xhigh,Ie.max,Ie.ultra]},{slug:"gpt-5.6-terra",displayName:"GPT-5.6-Terra",description:"Balanced all-rounder for everyday work",defaultReasoning:"medium",reasoningLevels:[Ie.low,Ie.medium,Ie.high,Ie.xhigh,Ie.max,Ie.ultra]},{slug:"gpt-5.6-luna",displayName:"GPT-5.6-Luna",description:"Fast, affordable — clear, repeatable tasks",defaultReasoning:"medium",reasoningLevels:[Ie.low,Ie.medium,Ie.high,Ie.xhigh,Ie.max]},{slug:"gpt-5.5",displayName:"GPT-5.5",description:"Previous-gen frontier model",defaultReasoning:"medium",reasoningLevels:[Ie.low,Ie.medium,Ie.high,Ie.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:[Ie.low,Ie.medium,Ie.high,Ie.xhigh,Ie.max]},{slug:"claude-sonnet-5",displayName:"Claude Sonnet 5",description:"Previous-gen balanced all-rounder",defaultReasoning:"medium",reasoningLevels:[Ie.low,Ie.medium,Ie.high,Ie.xhigh,Ie.max]},{slug:"claude-opus-5",displayName:"Claude Opus 5",description:"Deep reasoning for complex tasks",defaultReasoning:"medium",reasoningLevels:[Ie.low,Ie.medium,Ie.high,Ie.xhigh,Ie.max]},{slug:"claude-fable-5",displayName:"Claude Fable 5",description:"Fast and efficient for simple tasks",defaultReasoning:"medium",reasoningLevels:[Ie.low,Ie.medium,Ie.high,Ie.xhigh,Ie.max]}]},{id:"repoburg",label:"Repoburg",available:!0,models:[{slug:"ollama/glm-5.3:cloud",displayName:"GLM-5.3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[Ie.low,Ie.medium,Ie.high]},{slug:"ollama/glm-5.3-flash:cloud",displayName:"GLM-5.3 Flash",description:"Ollama Cloud — fast",defaultReasoning:"medium",reasoningLevels:[Ie.low,Ie.medium,Ie.high]},{slug:"ollama/minimax-m3:cloud",displayName:"MiniMax M3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[Ie.low,Ie.medium,Ie.high]},{slug:"ollama/deepseek-v4-pro:cloud",displayName:"DeepSeek V4 Pro",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[Ie.low,Ie.medium,Ie.high]}]}];function jN(t){return pd.find(s=>s.id===t)}function Zd(t){const s=jN(t);return(s==null?void 0:s.models)??[]}function ly(t,s){return Zd(t).find(r=>r.slug===s)}function hd(t,s){var r;return((r=ly(t,s))==null?void 0:r.reasoningLevels)??[]}function md(t,s){var r;return(r=ly(t,s))==null?void 0:r.defaultReasoning}function CN(){const{activeSessionId:t,sessions:s,updateModelConfig:r}=I(),o=I(ee=>ee.showModelSelector),l=I(ee=>ee.setShowModelSelector),c=s.find(ee=>ee.id===t),d=I(ee=>ee.models),p=I(ee=>ee.modelsLoading),g=I(ee=>ee.loadModels),[m,v]=x.useState(!1),k=x.useRef(null);if(Mo(k,()=>v(!1),m),Ni(()=>v(!1),m),x.useEffect(()=>{o&&(v(!0),l(!1))},[o,l]),x.useEffect(()=>{c!=null&&c.runtime_type&&g(c.runtime_type,c.cwd??void 0)},[c==null?void 0:c.runtime_type,c==null?void 0:c.cwd,g]),!c)return null;const y=c.runtime_type,S=c.model??"",T=c.model_reasoning_effort??"",E=d.length>0?d:[],N=Zd(y),_=[...E.length>0?E:N];if(S&&!_.some(ee=>ee.slug===S)){const ee=N[0];_.unshift({slug:S,displayName:S,description:"Custom model",defaultReasoning:(ee==null?void 0:ee.defaultReasoning)??"medium",reasoningLevels:(ee==null?void 0:ee.reasoningLevels)??[]})}function H(ee){return _.find(ne=>ne.slug===ee)}function D(ee){var ne;return E.length>0?((ne=H(ee))==null?void 0:ne.reasoningLevels)??[]:hd(y,ee)}function O(ee){var ne;return E.length>0?(ne=H(ee))==null?void 0:ne.defaultReasoning:md(y,ee)}const K=pd.find(ee=>ee.id===y),G=H(S),z=S?D(S):[],J=(K==null?void 0:K.label)??y,he=(G==null?void 0:G.displayName)??(S||"Default"),ae=z.find(ee=>ee.effort===T),ve=(ae==null?void 0:ae.label)??(T||"Default");function we(ee){var X;const ne=D(ee),F=ne.some(L=>L.effort===T)?T:O(ee)??((X=ne[0])==null?void 0:X.effort)??"";r(ee,F),v(!1)}function Ae(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:J}),a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-model",children:he}),ve!=="Default"&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-reasoning",children:ve})]}),a.jsx(Si,{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"}),pd.map(ee=>a.jsxs("div",{className:`model-selector-item ${ee.id===y?"selected":""} ${ee.available?"":"disabled"}`,onClick:()=>{if(ee.available){if(ee.id===y){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(A1,{size:10})," Soon"]}),ee.id===y&&a.jsx(Ns,{size:12})]},ee.id))]}),a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Model"}),p&&a.jsx("div",{className:"model-selector-empty",children:"Loading models…"}),!p&&_.length===0&&a.jsx("div",{className:"model-selector-empty",children:"No models available"}),_.map(ee=>a.jsxs("div",{className:`model-selector-item ${ee.slug===S?"selected":""}`,onClick:()=>we(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(Ns,{size:12})]},ee.slug))]}),a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Thinking"}),z.length===0&&a.jsx("div",{className:"model-selector-empty",children:"Select a model first"}),z.map(ee=>a.jsxs("div",{className:`model-selector-item ${ee.effort===T?"selected":""}`,onClick:()=>Ae(ee.effort),children:[a.jsx("span",{children:ee.label}),ee.effort===T&&a.jsx(Ns,{size:12})]},ee.effort))]})]})]})}function mo(t){return t>=1e6?`${(t/1e6).toFixed(t%1e6===0?0:1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}function ng(){const t=I(r=>r.canGoBack),s=I(r=>r.canGoForward);return a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"sb-item sb-btn",title:"Back","aria-label":"Back",disabled:!t,onClick:()=>window.history.back(),children:a.jsx(d1,{size:14})}),a.jsx("button",{className:"sb-item sb-btn",title:"Forward","aria-label":"Forward",disabled:!s,onClick:()=>window.history.forward(),children:a.jsx(f1,{size:14})})]})}function sg(){const t=I(s=>s.setShowRemoteModal);return a.jsxs("div",{className:"sb-item",style:{cursor:"pointer"},title:"Remote access — make this machine remote",onClick:()=>t(!0),children:[a.jsx(Y1,{size:14})," Repoburg"]})}function rg(){const t=I(r=>r.usageViewOpen),s=I(r=>r.toggleUsageView);return a.jsxs("button",{className:`sb-item sb-btn${t?" sb-item-active":""}`,title:t?"Back to the agent view":"Usage Center",onClick:s,children:[a.jsx(tv,{size:14})," Usage"]})}function ig(){const t=I(r=>r.vscodeViewOpen),s=I(r=>r.toggleVscodeView);return a.jsxs("button",{className:`sb-item sb-btn${t?" sb-item-active":""}`,title:t?"Back to the agent view":"Open VS Code",onClick:s,children:[a.jsx(y1,{size:14})," Code"]})}function og(){const t=I(r=>r.terminalViewOpen),s=I(r=>r.toggleTerminalView);return a.jsxs("button",{className:`sb-item sb-btn${t?" sb-item-active":""}`,title:t?"Back to the agent view":"Open a terminal",onClick:s,children:[a.jsx(cv,{size:14})," Terminal"]})}function _N(){Dt.trackRender("StatusBar");const t=I(v=>v.activeSessionId),s=I(v=>t?v.sessions.find(k=>k.id===t)??null:null),r=I(v=>t?v.sessionDetails[t]??null:null),o=I(v=>t?v.backgroundTasks[t]:void 0),l=I(v=>v.wsConnected),c=I(v=>v.switchRightTab),d=(r==null?void 0:r.contextUsage)??null;if(!s)return a.jsxs("div",{className:"ide-statusbar",children:[a.jsx(ng,{}),a.jsx(sg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(ig,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(og,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(rg,{}),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(nm,{size:14})," K"]})]});const p=o??[],g=Pl(s,p.length),m=Xd(p);return a.jsxs("div",{className:"ide-statusbar",children:[a.jsx(ng,{}),a.jsx(sg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(ig,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(og,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(rg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(CN,{}),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(uv,{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:g.dot==="background"?{color:"var(--purple)"}:s.status==="failed"?{color:"var(--red)"}:void 0,title:g.dot==="background"?g.dotTitle:void 0,children:g.label}),d&&a.jsx(EN,{usage:d}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsxs("div",{className:"sb-item",children:[a.jsx(nm,{size:14})," K"]})]})}function EN({usage:t}){const s=t.percentage>=85?"var(--red)":t.percentage>=60?"var(--amber)":"var(--green)",r=`${mo(t.totalTokens)} / ${mo(t.contextWindow)} tokens`+(t.autoCompactThreshold?` · auto-compacts at ${mo(t.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:s},children:[Math.round(t.percentage),"% / ",mo(t.totalTokens)," / ",mo(t.contextWindow)]})})]})}function ag(t){return Mt(`/vscode-web/status?folder=${encodeURIComponent(t??"")}`)}function RN(t){return ot("/vscode-web/start",{folder:t})}function AN(t){return ot("/vscode-web/heartbeat",{id:t})}const IN=1e3,DN=5*6e4;function lg({children:t}){const s=I(r=>r.toggleVscodeView);return a.jsxs("div",{className:"vscode-view vscode-view--loading",children:[t,a.jsx("button",{className:"dialog-close vscode-view-close",title:"Close VS Code view","aria-label":"Close VS Code view",onClick:s,children:a.jsx(Tn,{size:16})})]})}function MN(){const t=I(T=>T.vscodeState),s=I(T=>T.vscodeId),r=I(T=>T.vscodeToken),o=I(T=>T.setVscodeView),l=I(T=>{var N;const E=T.activeSessionId?T.sessions.find(C=>C.id===T.activeSessionId):null;return E!=null&&E.cwd?E.cwd:((N=T.workspaces.find(C=>C.deleted===0))==null?void 0:N.path)??null}),[c,d]=x.useState(!1),[p,g]=x.useState(0),m=x.useRef(null),v=mn(),k=v===""||v===window.location.origin,y=`${v}/vscode/${s??""}/?tkn=${r??""}${l?`&folder=${encodeURIComponent(l)}`:""}`;x.useEffect(()=>{let T=!1;function E(){m.current&&(clearInterval(m.current),m.current=null)}async function N(){try{let _=await ag(l);if((_.state==="stopped"||_.state==="error")&&(_=await RN(l)),T||(o(_.state,_.id,_.token),_.state==="running"||_.state==="error"))return;m.current=setInterval(async()=>{const H=await ag(l);T||(o(H.state,H.id,H.token),(H.state==="running"||H.state==="error"||H.state==="stopped")&&E())},IN)}catch{T||o("error",null,null)}}N();const C=setInterval(()=>{const _=I.getState().vscodeId;_&&AN(_).catch(()=>{})},DN);return()=>{T=!0,E(),clearInterval(C)}},[p,l,o]);function S(){d(!1),o("starting",null,null),g(T=>T+1)}return t!=="running"||!r||!s?a.jsx(lg,{children:t==="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(Eo,{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:y,title:"VS Code",className:"vscode-view-frame",onLoad:()=>d(!0)},s)]}):a.jsxs(lg,{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(y,"_blank","noopener"),children:[a.jsx(w1,{size:14})," Open VS Code in a new tab"]})]})}function cg(t,s){const r=new URLSearchParams;t&&r.set("since",t),s&&r.set("until",s);const o=r.toString();return Mt(`/usage/summary${o?`?${o}`:""}`)}const cy="agentpane:usage-budget";function cs(t){return t>=1e6?`${(t/1e6).toFixed(t%1e6===0?0:1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}function Or(t){return`$${t>=100?t.toFixed(0):t>=1?t.toFixed(2):t.toFixed(4).replace(/0+$/,"").replace(/\.$/,"")}`}function LN(t,s=new Date){if(t==="all")return{since:null,until:null};const r=new Date(s);return t==="today"?r.setHours(0,0,0,0):r.setDate(r.getDate()-(t==="7d"?7:30)),{since:r.toISOString(),until:null}}function ON(t=new Date){return new Date(t.getFullYear(),t.getMonth(),1).toISOString()}function PN(){try{const t=Number(localStorage.getItem(cy));return Number.isFinite(t)&&t>0?t:0}catch{return 0}}function $N(t){try{localStorage.setItem(cy,String(t))}catch{}}const zN={claude:"Claude",codex:"Codex",repoburg:"Repoburg"};function tl({label:t,value:s,sub:r,tone:o}){return a.jsxs("div",{className:"usage-kpi",children:[a.jsx("div",{className:"usage-kpi-label",children:t}),a.jsx("div",{className:"usage-kpi-value",style:o?{color:o}:void 0,children:s}),r&&a.jsx("div",{className:"usage-kpi-sub",children:r})]})}function FN({day:t,max:s}){const r=o=>s>0?o/s*100:0;return a.jsxs("div",{className:"usage-day",title:`${t.date} · ${cs(t.input_tokens)} input · ${cs(t.cached_input_tokens)} cached · ${cs(t.output_tokens)} output · ${Or(t.cost_usd)}`,children:[a.jsxs("div",{className:"usage-day-bar",children:[a.jsx("div",{className:"usage-seg usage-seg-output",style:{height:`${r(t.output_tokens)}%`}}),a.jsx("div",{className:"usage-seg usage-seg-cached",style:{height:`${r(t.cached_input_tokens+t.cache_write_input_tokens)}%`}}),a.jsx("div",{className:"usage-seg usage-seg-input",style:{height:`${r(t.input_tokens)}%`}})]}),a.jsx("div",{className:"usage-day-label",children:t.date.slice(5)})]})}function UN(){const t=I(_=>_.toggleUsageView),[s,r]=x.useState("30d"),[o,l]=x.useState(null),[c,d]=x.useState(null),[p,g]=x.useState(PN),[m,v]=x.useState(null),[k,y]=x.useState(!1),S=x.useCallback(async()=>{y(!0),v(null);try{const{since:_,until:H}=LN(s),[D,O]=await Promise.all([cg(_,H),cg(ON(),null)]);l(D),d(O.totals.cost_usd)}catch(_){v(_.message)}finally{y(!1)}},[s]);x.useEffect(()=>{S()},[S]);const T=o==null?void 0:o.totals,E=p>0&&c!==null?p-c:null,N=x.useMemo(()=>Math.max(0,...((o==null?void 0:o.daily)??[]).map(_=>_.input_tokens+_.cached_input_tokens+_.output_tokens)),[o]),C=_=>{const H=Number(_.replace(",",".")),D=Number.isFinite(H)&&H>0?H:0;g(D),$N(D)};return a.jsxs("div",{className:"usage-view",children:[a.jsxs("div",{className:"usage-header",children:[a.jsxs("div",{className:"usage-title",children:[a.jsx(tv,{size:18})," Usage Center"]}),a.jsxs("div",{className:"usage-controls",children:[["today","7d","30d","all"].map(_=>a.jsx("button",{className:`usage-range-btn${s===_?" usage-range-btn-active":""}`,onClick:()=>r(_),children:_==="today"?"Today":_==="7d"?"7 days":_==="30d"?"30 days":"All"},_)),a.jsx("button",{className:"usage-range-btn",onClick:()=>void S(),title:"Refresh",children:a.jsx(U1,{size:13,className:k?"spin":void 0})}),a.jsx("button",{className:"dialog-close",title:"Close usage view","aria-label":"Close usage view",onClick:t,children:a.jsx(Tn,{size:16})})]})]}),m&&a.jsxs("div",{className:"usage-error",children:["Could not load usage data: ",m]}),!o&&!m&&a.jsx("div",{className:"usage-empty",children:"Loading…"}),o&&T&&a.jsxs("div",{className:"usage-body",children:[a.jsxs("div",{className:"usage-kpis",children:[a.jsx(tl,{label:"Spend",value:Or(T.cost_usd),sub:T.unpriced_models.length>0?"excluding unpriced models":void 0}),a.jsx(tl,{label:"Remaining (monthly)",value:E===null?"—":E>=0?Or(E):Or(0),sub:p>0&&c!==null?`this month ${Or(c)} / budget ${Or(p)}`:"no budget set",tone:E!==null&&E<0?"var(--red)":void 0}),a.jsx(tl,{label:"Tokens",value:cs(T.input_tokens+T.cached_input_tokens+T.cache_write_input_tokens+T.output_tokens),sub:`input ${cs(T.input_tokens)} · cached ${cs(T.cached_input_tokens)} · write ${cs(T.cache_write_input_tokens)} · output ${cs(T.output_tokens)}`}),a.jsx(tl,{label:"Calls",value:String(T.calls),sub:T.errors>0?`${T.errors} failed`:void 0,tone:T.errors>0?"var(--amber)":void 0})]}),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:p>0?p:"",placeholder:"e.g. 50",onBlur:_=>C(_.target.value)}),p>0&&c!==null&&a.jsx("div",{className:"usage-budget-bar",children:a.jsx("div",{className:"usage-budget-fill",style:{width:`${Math.min(100,c/p*100)}%`,background:c>=p?"var(--red)":void 0}})})]}),T.unpriced_models.length>0&&a.jsxs("div",{className:"usage-note",children:["Unpriced models: ",T.unpriced_models.join(", ")]}),a.jsxs("div",{className:"usage-chart",children:[a.jsx("div",{className:"usage-section-title",children:"Daily usage"}),o.daily.length===0?a.jsx("div",{className:"usage-empty",children:"No usage in this range."}):a.jsx("div",{className:"usage-days",children:o.daily.map(_=>a.jsx(FN,{day:_,max:N},_.date))}),a.jsxs("div",{className:"usage-legend",children:[a.jsxs("span",{children:[a.jsx("span",{className:"usage-dot usage-seg-input"})," input"]}),a.jsxs("span",{children:[a.jsx("span",{className:"usage-dot usage-seg-cached"})," cached"]}),a.jsxs("span",{children:[a.jsx("span",{className:"usage-dot usage-seg-output"})," output"]})]})]}),a.jsxs("div",{className:"usage-table-wrap",children:[a.jsx("div",{className:"usage-section-title",children:"By model"}),a.jsxs("table",{className:"usage-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Runtime"}),a.jsx("th",{children:"Provider"}),a.jsx("th",{children:"Model"}),a.jsx("th",{children:"Effort"}),a.jsx("th",{children:"Calls"}),a.jsx("th",{children:"Input"}),a.jsx("th",{children:"Cached"}),a.jsx("th",{children:"Output"}),a.jsx("th",{children:"Cost"})]})}),a.jsxs("tbody",{children:[o.by_model.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:9,className:"usage-empty",children:"No usage records yet."})}),o.by_model.map(_=>a.jsxs("tr",{children:[a.jsx("td",{children:zN[_.runtime_type]??_.runtime_type}),a.jsx("td",{children:_.provider??"—"}),a.jsx("td",{title:_.model,children:_.model}),a.jsx("td",{children:_.reasoning_effort??"default"}),a.jsxs("td",{children:[_.calls,_.errors>0&&a.jsxs("span",{className:"usage-err",children:[" (",_.errors," failed)"]})]}),a.jsx("td",{children:cs(_.input_tokens)}),a.jsx("td",{children:cs(_.cached_input_tokens+_.cache_write_input_tokens)}),a.jsx("td",{children:cs(_.output_tokens)}),a.jsx("td",{children:_.cost_usd===null?a.jsx("span",{className:"usage-unpriced",children:"unknown"}):Or(_.cost_usd)})]},`${_.runtime_type}|${_.provider??""}|${_.model}|${_.reasoning_effort??""}`))]})]})]})]})]})}const ug="claude auth login";function BN(){const t=I(p=>Object.keys(p.signedOutTurns).length),s=I(p=>p.terminalViewOpen),r=I(p=>p.toggleTerminalView),o=I(p=>p.addToast),[l,c]=x.useState(!1);if(t===0)return null;const d=()=>{c(!0),T0().catch(p=>o("error",`Could not resume the turns — ${Pr(p)}`)).finally(()=>c(!1))};return a.jsxs("div",{className:"signed-out-band",role:"status",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(N1,{size:12})}),a.jsxs("span",{className:"banner-text",children:["Claude is signed out — ",t===1?"1 turn is":`${t} turns are`," waiting. Run"," ",a.jsx("code",{children:ug})," in a terminal, then resume."]}),a.jsxs("button",{type:"button",className:"banner-action",onClick:()=>void Io(ug),children:[a.jsx(_o,{size:12}),"Copy"]}),!s&&a.jsxs("button",{type:"button",className:"banner-action",onClick:r,children:[a.jsx(cv,{size:12}),"Open terminal"]}),a.jsxs("button",{type:"button",className:"banner-action",onClick:d,disabled:l,children:[a.jsx(av,{size:12}),t===1?"Resume turn":"Resume turns"]})]})}const dg=/^[a-f0-9]{64}\.(?:png|jpg|gif|webp)$/,WN=/^(?:https?:\/\/[^/?#]+)?\/api\/apps\/([^/?#]+)\/files\/([^/?#]+)$/i,HN={png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp"};function uy(){return mn()||window.location.origin}function dy(t,s){let r=s;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(dg.test(o))return o;const l=WN.exec(o);if(!l)return null;let c;try{c=decodeURIComponent(l[1])}catch{return null}return c===t&&dg.test(l[2])?l[2]:null}function fg(t){return/^https?:\/\//i.test(t.url)?t:{...t,url:`${uy()}${t.url}`}}function VN(t){return HN[t.slice(t.lastIndexOf(".")+1)]??"application/octet-stream"}function fy(t){return new Promise((s,r)=>{const o=new FileReader;o.onload=()=>{const l=String(o.result??"");s(l.slice(l.indexOf(",")+1))},o.onerror=()=>r(o.error??new Error("Could not read the file")),o.readAsDataURL(t)})}function GN(t,s){const r=/^data:([^;,]*)(?:;[^;,]*)*;base64,/i.exec(t);return r?{type:s||r[1]||void 0,data:t.slice(r[0].length)}:{type:s,data:t}}async function py(t){if(t instanceof Blob){const s=t.name;return{name:typeof s=="string"&&s?s:void 0,type:t.type||void 0,data:await fy(t)}}if(t&&typeof t=="object"&&typeof t.data=="string"){const s=t;return{name:typeof s.name=="string"&&s.name?s.name:void 0,type:typeof s.type=="string"&&s.type?s.type:void 0,data:s.data}}return null}async function KN(t){const s=await py(t);if(!s)throw new Error("uploadFile: expected a Blob/File or { name, type, data }");return s}async function qN(t,s,r){if(s==null)return[];if(!Array.isArray(s))throw new Error("submitTurn: attachments must be an array");const o=[];for(let l=0;l<s.length;l++){const c=s[l],d=await py(c);if(d){const{type:m,data:v}=GN(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 p=dy(t,c);if(!p)throw new Error(`submitTurn: attachment ${l+1} is not a file of this app`);const g=await r(p);o.push({name:p,media_type:VN(p),data:await fy(g)})}return o}const YN=`function (config) {
521
- var nextId = 1;
522
- var pending = new Map();
523
- var listeners = [];
524
- // Absolute http(s) URL, or null. Relative and #fragment hrefs are not
525
- // external and keep their in-frame behavior.
526
- function externalUrl(raw) {
527
- if (typeof raw !== 'string' || !/^\\s*https?:\\/\\//i.test(raw)) return null;
528
- try { return new URL(raw.trim()).href; } catch (err) { return null; }
529
- }
530
- // New browser tab. The sandbox lets popups escape it, so the page loads
531
- // like any other tab; noopener leaves it no handle back to this frame.
532
- function openTab(url) {
533
- window.open(url, '_blank', 'noopener,noreferrer');
534
- }
535
- // A plain external link would navigate THIS frame: the app disappears and
536
- // most sites refuse to be framed anyway. Open it in a new tab instead.
537
- // Bubble phase on window, so the app's own handlers run first and can
538
- // still claim the click with preventDefault(). Modifier clicks and
539
- // target="_blank" links already open a tab natively.
540
- window.addEventListener('click', function (e) {
541
- if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
542
- var a = e.target && e.target.closest ? e.target.closest('a[href]') : null;
543
- if (!a) return;
544
- var target = (a.getAttribute('target') || '').toLowerCase();
545
- if (target && target !== '_self' && target !== '_parent' && target !== '_top') return;
546
- var url = externalUrl(a.getAttribute('href'));
547
- if (!url) return;
548
- e.preventDefault();
549
- openTab(url);
550
- });
551
- // Stored files: <apiOrigin>/api/apps/<app-id>/files/<id>. Same reference
552
- // rules as the pane (utils/appFiles.ts): an id, a file URL of this app on
553
- // any origin, or an object carrying id/url.
554
- var FILE_ID_RE = /^[a-f0-9]{64}\\.(?:png|jpg|gif|webp)$/;
555
- var FILE_URL_RE = /^(?:https?:\\/\\/[^\\/?#]+)?\\/api\\/apps\\/([^\\/?#]+)\\/files\\/([^\\/?#]+)$/i;
556
- function fileRefId(ref) {
557
- if (ref && typeof ref === 'object') ref = typeof ref.id === 'string' ? ref.id : ref.url;
558
- if (typeof ref !== 'string') return null;
559
- var s = ref.trim();
560
- if (FILE_ID_RE.test(s)) return s;
561
- var m = FILE_URL_RE.exec(s);
562
- if (!m) return null;
563
- var owner;
564
- try { owner = decodeURIComponent(m[1]); } catch (err) { return null; }
565
- return owner === config.appId && FILE_ID_RE.test(m[2]) ? m[2] : null;
566
- }
567
- function fileUrl(ref) {
568
- var id = fileRefId(ref);
569
- if (!id) return typeof ref === 'string' ? ref : '';
570
- return config.apiOrigin + '/api/apps/' + encodeURIComponent(config.appId) + '/files/' + id;
571
- }
572
- window.addEventListener('message', function (e) {
573
- var msg = e.data;
574
- if (!msg || msg.source !== 'agentpane-host') return;
575
- if (msg.id != null && pending.has(msg.id)) {
576
- var p = pending.get(msg.id);
577
- pending.delete(msg.id);
578
- if (msg.ok) {
579
- p.resolve(msg.result);
580
- } else {
581
- var err = new Error(msg.error || 'bridge error');
582
- // code 'conflict': setState's ifVersion is stale; state = the stored copy.
583
- if (msg.code) err.code = msg.code;
584
- if (msg.state) err.state = msg.state;
585
- p.reject(err);
586
- }
587
- } else if (msg.event) {
588
- for (var i = 0; i < listeners.length; i++) {
589
- try { listeners[i](msg.event, msg.payload); } catch (err) { /* app error */ }
590
- }
591
- }
592
- });
593
- function call(method, params) {
594
- return new Promise(function (resolve, reject) {
595
- var id = nextId++;
596
- pending.set(id, { resolve: resolve, reject: reject });
597
- try {
598
- parent.postMessage({ source: 'agentpane-app', id: id, method: method, params: params || null }, '*');
599
- } catch (err) {
600
- // Params that cannot be cloned (functions, DOM nodes, ...).
601
- pending.delete(id);
602
- reject(err);
603
- }
604
- });
605
- }
606
- window.AgentPane = {
607
- getApp: function () { return call('getApp'); },
608
- getState: function () { return call('getState'); },
609
- setState: function (data, opts) {
610
- var params = { data: data };
611
- if (opts && typeof opts.ifVersion === 'number') params.ifVersion = opts.ifVersion;
612
- return call('setState', params);
613
- },
614
- createSession: function (opts) { return call('createSession', opts); },
615
- submitTurn: function (sessionId, prompt, opts) {
616
- var params = { sessionId: sessionId, prompt: prompt };
617
- if (opts && opts.attachments != null) params.attachments = opts.attachments;
618
- return call('submitTurn', params);
619
- },
620
- getSession: function (sessionId) { return call('getSession', { sessionId: sessionId }); },
621
- cancelTurn: function (sessionId) { return call('cancelTurn', { sessionId: sessionId }); },
622
- setSessionLifecycle: function (sessionId, lifecycle) { return call('setSessionLifecycle', { sessionId: sessionId, lifecycle: lifecycle }); },
623
- callTool: function (tool, args) { return call('callTool', { tool: tool, args: args }); },
624
- listProviders: function () { return call('listProviders'); },
625
- listModels: function (runtime, cwd) { return call('listModels', { runtime: runtime, cwd: cwd }); },
626
- pickDirectory: function () { return call('pickDirectory'); },
627
- onTurnCompleted: function (cb) { listeners.push(function (event, payload) { if (event === 'turn:completed' || event === 'turn:failed') cb(event, payload); }); },
628
- onTurnDelta: function (cb) { listeners.push(function (event, payload) { if (event === 'turn:delta' && payload) cb(payload); }); },
629
- onToolCall: function (cb) { listeners.push(function (event, payload) { if (event === 'tool_call' && payload) cb(payload); }); },
630
- onStateChanged: function (cb) { listeners.push(function (event, payload) { if (event === 'state_changed') cb(payload || {}); }); },
631
- onBackgroundTasks: function (cb) { listeners.push(function (event, payload) { if (event === 'background_tasks' && payload) cb(payload); }); },
632
- resolveToolCall: function (callId, result) { return call('resolveToolCall', { callId: callId, result: result }); },
633
- openSession: function (sessionId) { return call('openSession', { sessionId: sessionId }); },
634
- openUrl: function (url) {
635
- var href = externalUrl(url);
636
- if (!href) return Promise.reject(new Error('openUrl: expected an absolute http(s) URL, got ' + JSON.stringify(url)));
637
- try { openTab(href); } catch (err) { return Promise.reject(err); }
638
- return Promise.resolve({ ok: true });
639
- },
640
- uploadFile: function (file) { return call('uploadFile', { file: file }); },
641
- getFile: function (ref) { return call('getFile', { ref: ref }); },
642
- fileUrl: fileUrl
643
- };
644
- // Runtime error reporting — surface compile checks' blind side to the pane.
645
- window.addEventListener('error', function (e) {
646
- parent.postMessage({
647
- source: 'agentpane-app', report: 'error',
648
- message: e.message || 'Unknown error',
649
- stack: (e.error && e.error.stack) || '',
650
- line: e.lineno || 0, col: e.colno || 0
651
- }, '*');
652
- });
653
- window.addEventListener('unhandledrejection', function (e) {
654
- var r = e.reason;
655
- var msg = r && (r.message || String(r)) || 'unknown';
656
- parent.postMessage({
657
- source: 'agentpane-app', report: 'error',
658
- message: 'Unhandled promise rejection: ' + msg,
659
- stack: (r && r.stack) || '', line: 0, col: 0
660
- }, '*');
661
- });
662
- }`;function XN(t){return`(${YN})(${JSON.stringify(t)});`}function pg(t){return t.replace(/<\/script/gi,"<\\/script")}function QN(t,s){const r=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(r,"gi");let l=-1,c;for(;(c=o.exec(t))!==null;)l=c.index;return l}function hg(t,s,r){const o=QN(t,s);return o===-1?t+r:t.slice(0,o)+r+t.slice(o)}function ZN(t,s,r){let o=t;const l=`<script>${pg(s)}<\/script>`;if(/<\/head>/i.test(o)?o=hg(o,"</head>",l):/<html[^>]*>/i.test(o)?o=o.replace(/(<html[^>]*>)/i,`$1<head>${l}</head>`):o=`${l}${o}`,r){const c=`<script>${pg(r)}<\/script>`;o=hg(o,"</body>",c)}return o}function JN(){const t=globalThis.crypto;return t&&typeof t.randomUUID=="function"?`tab-${t.randomUUID()}`:`tab-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function ej(t){var r;if(!(t instanceof Il)||t.status!==409)return null;const s=(r=t.body)==null?void 0:r.state;return s&&typeof s=="object"?s:null}function tj({appId:t,workspace:s=""}){const r=x.useRef(null),o=x.useRef({pinned:!1,data:null}),[l,c]=x.useState(null),[d,p]=x.useState(null),[g,m]=x.useState([]);x.useEffect(()=>{let S=!0;const T=JN(),E=C=>{const _=o.current.version;typeof C.version=="number"&&typeof _=="number"&&C.version<_||(o.current=C)};V0(t,C=>{var _,H;return(H=(_=r.current)==null?void 0:_.contentWindow)==null?void 0:H.postMessage(C,"*")},s);const N=async C=>{var G,z,J,he,ae,ve,we,Ae,ee,ne,oe,F,X,L,R,$,le,me,Y,fe,Te;if(C.source!==((G=r.current)==null?void 0:G.contentWindow))return;const _=C.data;if(!_||_.source!=="agentpane-app")return;if(_.report==="error"){const se={message:String(_.message??"Unknown error"),stack:String(_.stack??"")};m(pe=>{const be=pe[pe.length-1];return be&&be.message===se.message?pe:[...pe,se].slice(-20)});return}if(typeof _.method!="string")return;let H=!0,D,O,K=null;try{switch(_.method){case"getApp":D={id:t,workspace:s};break;case"getState":try{const se=await Qh(t,s);E(se),D=se}catch{D=o.current}break;case"setState":{const se=((z=_.params)==null?void 0:z.data)??null,pe=(J=_.params)==null?void 0:J.ifVersion,be={data:se,writer:T};typeof pe=="number"&&(be.ifVersion=pe);try{const He=await Hg(t,be,s);E(He),D=He}catch(He){if(K=ej(He),!K)throw He;E(K);const Ee=He.body;throw new Error(typeof(Ee==null?void 0:Ee.error)=="string"?Ee.error:"App state changed since that version")}break}case"createSession":{const se=_.params??{},pe=await kd({title:typeof se.title=="string"?se.title:void 0,runtime_type:typeof se.runtime_type=="string"?se.runtime_type:void 0,model:typeof se.model=="string"?se.model:void 0,model_reasoning_effort:typeof se.model_reasoning_effort=="string"?se.model_reasoning_effort:void 0,cwd:typeof se.cwd=="string"?se.cwd:void 0,origin_app_id:t,origin_app_workspace:s});sl(pe.id,t),I.getState().addSession(pe),D=pe;break}case"submitTurn":{const se=String(((he=_.params)==null?void 0:he.sessionId)??""),pe=String(((ae=_.params)==null?void 0:ae.prompt)??""),be=await qN(t,(ve=_.params)==null?void 0:ve.attachments,Ee=>Ww(t,Ee)),He=await Eg(se,pe,be.length?be:void 0,{originAppId:t});sl(se,t),D=He;break}case"getSession":{D=await Aw(t,String(((we=_.params)==null?void 0:we.sessionId)??""));break}case"cancelTurn":{D=await Iw(t,String(((Ae=_.params)==null?void 0:Ae.sessionId)??""));break}case"setSessionLifecycle":{D=await Dw(t,String(((ee=_.params)==null?void 0:ee.sessionId)??""),String(((ne=_.params)==null?void 0:ne.lifecycle)??""));break}case"callTool":{const se=(oe=_.params)==null?void 0:oe.args;D=await Mw(t,s,String(((F=_.params)==null?void 0:F.tool)??""),se&&typeof se=="object"?se:{});break}case"listProviders":{D=await oy();break}case"listModels":{const se=typeof((X=_.params)==null?void 0:X.runtime)=="string"?_.params.runtime.trim():"";if(!se)throw new Error("listModels: runtime is required");const pe=(L=_.params)==null?void 0:L.cwd;D=await Bg(se,typeof pe=="string"&&pe?pe:void 0);break}case"pickDirectory":{if(I.getState().activeAppTabId!==t)throw new Error("pickDirectory: the app is not on screen — call it from a click in the app");D=await Ag();break}case"resolveToolCall":{const se=String(((R=_.params)==null?void 0:R.callId)??""),pe=($=_.params)==null?void 0:$.result;await zw(se,pe),D={ok:!0};break}case"openSession":{if(I.getState().activeAppTabId!==t)throw new Error("openSession: the app is not on screen — call it from a click in the app");const se=typeof((le=_.params)==null?void 0:le.sessionId)=="string"?_.params.sessionId.trim():"";if(!se)throw new Error("openSession: sessionId is required");try{await I.getState().revealSession(se)}catch(pe){throw new Error(`openSession: ${pe instanceof Error?pe.message:String(pe)}`)}D={ok:!0};break}case"uploadFile":{const se=await KN((me=_.params)==null?void 0:me.file);try{D=fg(await Uw(t,se))}catch(pe){throw new Error(`uploadFile: ${pe instanceof Error?pe.message:String(pe)}`)}break}case"getFile":{const se=dy(t,(Y=_.params)==null?void 0:Y.ref),pe=se?await Bw(t,se):null;D=pe?fg(pe):null;break}default:throw new Error(`Unknown bridge method: ${_.method}`)}}catch(se){H=!1,O=se instanceof Error?se.message:String(se)}(Te=(fe=r.current)==null?void 0:fe.contentWindow)==null||Te.postMessage(K?{source:"agentpane-host",id:_.id,ok:H,error:O,code:"conflict",state:K}:{source:"agentpane-host",id:_.id,ok:H,result:D,error:O},"*")};return window.addEventListener("message",N),Z0(t,C=>{var _,H;typeof C.workspace=="string"&&C.workspace!==s||C.writer!==T&&((H=(_=r.current)==null?void 0:_.contentWindow)==null||H.postMessage({source:"agentpane-host",event:"state_changed",payload:typeof C.version=="number"?{version:C.version}:{}},"*"))}),X0(t,()=>{Xh(t).then(C=>{S&&(c(C),m([]))}).catch(()=>{})}),(async()=>{try{const[C,_,H]=await Promise.all([Xh(t),Qh(t,s),Rw(t).catch(()=>[])]);if(!S)return;o.current=_,H.forEach(D=>sl(D.id,t)),c(C)}catch(C){S&&p(C instanceof Error?C.message:String(C))}})(),()=>{S=!1,G0(t),Q0(t),J0(t),window.removeEventListener("message",N)}},[t,s]),x.useEffect(()=>{l&&K0(t,l.manifest.headlessSessions===!0)},[t,l]);const v=x.useMemo(()=>l?ZN(l.html,XN({appId:t,apiOrigin:uy()}),l.js):"",[l,t]);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)??[],y=k.some(S=>S.severity==="error");return a.jsxs("div",{className:"miniapp-runtime",children:[k.length>0&&a.jsxs("div",{className:`miniapp-diagnostics${y?"":" miniapp-diagnostics-warn"}`,"data-testid":"miniapp-diagnostics",children:[a.jsx("div",{className:"miniapp-diagnostics-title",children:y?`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,T)=>a.jsxs("div",{className:"miniapp-diag",children:[S.file,":",S.line,":",S.column," — ",S.message]},T))]}),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: ${t}`,srcDoc:v}),g.length>0&&a.jsx("div",{className:"miniapp-rt-errors","data-testid":"miniapp-rt-errors",children:g.map((S,T)=>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})]},T))})]})}function nj({appId:t,active:s}){const r=I(y=>y.apps),o=I(y=>y.workspaces),l=I(y=>y.appWorkspaces),c=I(y=>y.setAppWorkspace),d=I(y=>y.setActiveAppTab),p=I(y=>y.startAppEdit),g=r.find(y=>y.id===t),m=l[t]??"",v=o.filter(y=>y.deleted!==1),k=m!==""&&!v.some(y=>y.path===m)?m:null;return a.jsxs("div",{className:`miniapp-view ${s?"":"miniapp-view-hidden"}`,children:[a.jsxs("div",{className:"miniapp-header",children:[a.jsx(ji,{iconNode:g==null?void 0:g.iconNode,size:14,className:"miniapp-header-icon"}),a.jsx("span",{className:"miniapp-header-title",children:(g==null?void 0:g.title)??t}),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:y=>c(t,y.target.value),children:[a.jsx("option",{value:"",children:"All workspaces (global)"}),v.map(y=>a.jsx("option",{value:y.path,children:y.label||y.path.split("/").pop()||y.path},y.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 p(t),children:[a.jsx(z1,{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(tj,{appId:t,workspace:m},`${t}:${m}`)})]})}function sj({side:t,minWidth:s,maxWidth:r,getWidth:o,setWidth:l}){const[c,d]=x.useState(!1),p=x.useRef(0),g=x.useRef(0),m=x.useCallback(y=>{const S=y.clientX-p.current,T=t==="left"?g.current+S:g.current-S,E=Math.min(r,Math.max(s,T));l(E)},[t,s,r,l]),v=x.useCallback(()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",v),document.body.classList.remove("is-resizing"),d(!1)},[m]);return{onPointerDown:x.useCallback(y=>{var S,T;y.preventDefault(),y.stopPropagation();try{(T=(S=y.currentTarget)==null?void 0:S.setPointerCapture)==null||T.call(S,y.pointerId)}catch{}p.current=y.clientX,g.current=o(),d(!0),document.body.classList.add("is-resizing"),window.addEventListener("pointermove",m),window.addEventListener("pointerup",v)},[o,m,v]),dragging:c}}function mg({side:t,minWidth:s,maxWidth:r,getWidth:o,setWidth:l}){const{onPointerDown:c,dragging:d}=sj({side:t,minWidth:s,maxWidth:r,getWidth:o,setWidth:l});return a.jsx("div",{className:`resize-handle ${t}${d?" dragging":""}`,onPointerDown:c,role:"separator","aria-orientation":"vertical","aria-label":`Resize ${t} panel`,"data-resizing":d?"":void 0})}const rj=x.lazy(()=>o1(()=>import("./TerminalView-DLqkILpD.js"),__vite__mapDeps([0,1])));function ij(){Dt.trackRender("IdeWorkspace");const t=I(S=>S.sidebarWidth),s=I(S=>S.rightPanelWidth),r=I(S=>S.setSidebarWidth),o=I(S=>S.setRightPanelWidth),l=I(S=>S.rightPanelCollapsed),c=I(S=>S.vscodeViewOpen),d=I(S=>S.usageViewOpen),p=I(S=>S.terminalViewOpen),[g,m]=x.useState(!1);p&&!g&&m(!0);const v=I(S=>S.activeAppTabId),k=I(S=>S.openAppTabs);x.useEffect(()=>{const S=()=>{const T=fl(),{rightPanelWidth:E,setRightPanelWidth:N}=I.getState();E>T&&N(T)};return window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const y=l?`${t}px 6px 1fr ${bw}px`:`${t}px 6px 1fr 6px ${s}px`;return a.jsxs("div",{className:"ide-root",children:[a.jsx(BN,{}),a.jsxs("div",{className:`ide-layout ${c||d||p?"ide-hidden":""}`,style:{gridTemplateColumns:y},children:[a.jsx(YS,{}),a.jsx(mg,{side:"left",minWidth:Qu,maxWidth:Zu,getWidth:()=>I.getState().sidebarWidth,setWidth:r}),a.jsxs("div",{className:"ide-center",children:[a.jsx(ZS,{}),a.jsxs("div",{className:"ide-render",children:[k.map(S=>a.jsx(nj,{appId:S,active:v===S},S)),v==null&&a.jsx(KT,{})]}),a.jsx(rN,{})]}),!l&&a.jsx(mg,{side:"right",minWidth:dl,maxWidth:fl(),getWidth:()=>I.getState().rightPanelWidth,setWidth:o}),a.jsx(NN,{})]}),c&&a.jsx(MN,{}),d&&a.jsx(UN,{}),g&&a.jsx(x.Suspense,{fallback:null,children:a.jsx(rj,{visible:p})}),a.jsx(_N,{})]})}function oj(){const{showNewSessionDialog:t,setShowNewSessionDialog:s,createSession:r,lastModelConfig:o}=I(),l=(o==null?void 0:o.provider)??"codex",c=(o==null?void 0:o.model)??"",d=(o==null?void 0:o.reasoning)??"",[p,g]=x.useState(""),[m,v]=x.useState(c),[k,y]=x.useState(d),[S,T]=x.useState("");if(!t)return null;const E=Zd(l),N=m?hd(l,m):[];function C(){r({title:p.trim()||void 0,model:m||void 0,model_reasoning_effort:k||void 0,cwd:S.trim()||void 0,runtime_type:l}),g(""),T("")}function _(D){D.key==="Escape"&&s(!1)}function H(D){var G;v(D);const O=hd(l,D);O.some(z=>z.effort===k)||y(md(l,D)??((G=O[0])==null?void 0:G.effort)??"")}return a.jsx("div",{className:"dialog-overlay",onClick:()=>s(!1),children:a.jsxs("div",{className:"dialog",onClick:D=>D.stopPropagation(),onKeyDown:_,children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"New Session"}),a.jsx("button",{className:"dialog-close",onClick:()=>s(!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:p,onChange:D=>g(D.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:D=>H(D.target.value),children:[a.jsx("option",{value:"",children:"Default (Codex picks)"}),E.map(D=>a.jsxs("option",{value:D.slug,children:[D.displayName," — ",D.description]},D.slug))]})]}),N.length>0&&a.jsxs("label",{className:"dialog-label",children:["Thinking Level",a.jsxs("select",{className:"dialog-input dialog-select",value:k,onChange:D=>y(D.target.value),children:[a.jsxs("option",{value:"",children:["Default (",md(l,m),")"]}),N.map(D=>a.jsx("option",{value:D.effort,children:D.label},D.effort))]})]}),a.jsxs("label",{className:"dialog-label",children:["Working Directory (optional)",a.jsx("input",{className:"dialog-input",type:"text",value:S,onChange:D=>T(D.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:()=>s(!1),children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:C,children:"Create"})]})]})})}function aj(t,s){const r=s!==""&&(t===s||t.startsWith(`${s}/`)),o=[r?{label:"~",path:s}:{label:"/",path:"/"}],l=t.slice(r?s.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 lj(t){const s=t.filter(l=>l.deleted===0).at(-1);if(!s)return;const r=hr(s.path),o=r.lastIndexOf("/");return o>0?r.slice(0,o):void 0}function cj(){return I(s=>s.showAddWorkspaceDialog)?a.jsx(uj,{}):null}function uj(){var G;const t=I(z=>z.setShowAddWorkspaceDialog),s=I(z=>z.workspaces),r=I(z=>z.createWorkspaceAt),o=I(z=>z.addToast),[l,c]=x.useState(null),[d,p]=x.useState(!0),[g,m]=x.useState(null),[v,k]=x.useState(!1),y=x.useRef(0),[S]=x.useState(()=>lj(I.getState().workspaces)),T=x.useRef(null),E=x.useCallback(()=>{v||t(!1)},[v,t]);Ni(E);const N=x.useCallback(async(z,J=!1)=>{const he=++y.current;p(!0);let ae=null,ve=null;try{ae=await Ih(z)}catch(we){if(ve=Pr(we),J&&z)try{ae=await Ih(),ve=null}catch(Ae){ve=Pr(Ae)}}he===y.current&&(ae&&c(ae),m(ve),p(!1))},[]);x.useEffect(()=>{N(S,!0)},[N,S]);const C=l==null?void 0:l.path;x.useEffect(()=>{T.current&&(T.current.scrollTop=0)},[C]);const _=new Set(s.filter(z=>z.deleted===0).map(z=>hr(z.path)));async function H(z){if(!v){k(!0),m(null);try{const J=await r(z);t(!1),o("success",`Workspace added — ${J.path}`)}catch(J){m(Pr(J)),k(!1)}}}const D=l?aj(l.path,l.home):[],O=((G=D.at(-1))==null?void 0:G.label)??"",K=l!==null&&_.has(hr(l.path));return a.jsx("div",{className:"dialog-overlay",onClick:E,children:a.jsxs("div",{className:"dialog folder-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"folder-dialog-title",onClick:z=>z.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:E,"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 N(l.parent),disabled:!(l!=null&&l.parent),"aria-label":"Parent folder",title:"Parent folder",children:a.jsx(Zg,{size:14})}),a.jsx("nav",{className:"folder-crumbs","aria-label":"Folder path",children:D.map((z,J)=>a.jsxs(x.Fragment,{children:[J>0&&a.jsx(Co,{size:12,className:"folder-crumb-sep","aria-hidden":"true"}),J===D.length-1?a.jsx("span",{className:"folder-crumb current","aria-current":"location",title:z.path,children:z.label}):a.jsx("button",{className:"folder-crumb",onClick:()=>void N(z.path),title:z.path,children:z.label})]},z.path))}),d&&l&&a.jsx(hn,{size:14,className:"spin folder-spinner","aria-label":"Loading"})]}),a.jsx("ul",{ref:T,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(z=>a.jsxs("li",{className:"folder-item",children:[a.jsxs("button",{className:"folder-row",onClick:()=>void N(z.path),title:z.path,"aria-label":z.git?`${z.name} (git repository)`:z.name,children:[z.git?a.jsx(S1,{size:15,className:"folder-icon git","aria-hidden":"true"}):a.jsx(yl,{size:15,className:"folder-icon","aria-hidden":"true"}),a.jsx("span",{className:"folder-name",children:z.name}),a.jsx(Co,{size:13,className:"folder-chevron","aria-hidden":"true"})]}),_.has(hr(z.path))?a.jsx("span",{className:"folder-tag",children:"Added"}):a.jsx("button",{className:"folder-add",onClick:()=>void H(z.path),disabled:v,"aria-label":`Add ${z.name}`,children:"Add"})]},z.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."]}),g&&a.jsx("p",{className:"folder-error",role:"alert",children:g})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:E,disabled:v,children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:()=>l&&void H(l.path),disabled:!l||d||v||K,children:v?"Adding…":K?"Already added":`Add “${O}”`})]})]})})}const gd=6e4,vd=60*gd,nl=24*vd;function dj(t,s=Date.now()){const r=Date.parse(t);if(Number.isNaN(r))return"";const o=Math.max(0,s-r);return o<gd?"just now":o<vd?`${Math.floor(o/gd)} min ago`:o<nl?`${Math.floor(o/vd)} h ago`:o<2*nl?"yesterday":o<7*nl?`${Math.floor(o/nl)} days ago`:new Date(r).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function fj(){const t=I(s=>s.importSessionsWorkspace);return t?a.jsx(pj,{workspace:t},t):null}function pj({workspace:t}){const s=I(D=>D.setImportSessionsWorkspace),r=I(D=>D.importClaudeSessions),[o,l]=x.useState(null),[c,d]=x.useState(null),[p,g]=x.useState(new Set),[m,v]=x.useState(!1),[k,y]=x.useState(new Map),S=x.useCallback(()=>{m||s(null)},[m,s]);Ni(S),x.useEffect(()=>{let D=!1;return Ug(t).then(O=>{D||l(O)}).catch(O=>{D||d(Pr(O))}),()=>{D=!0}},[t]);function T(D){g(O=>{const K=new Set(O);return K.has(D)?K.delete(D):K.add(D),K})}const E=o??[],N=E.length>0&&E.every(D=>p.has(D.session_id));async function C(){const D=E.filter(z=>p.has(z.session_id)).map(z=>z.session_id);if(D.length===0)return;v(!0);const{imported:O,failed:K}=await r(t,D);if(v(!1),K.length===0){s(null);return}const G=new Set(O.map(z=>z.import_source_id));l(z=>(z??[]).filter(J=>!G.has(J.session_id))),g(new Set(K.map(z=>z.id))),y(new Map(K.map(z=>[z.id,z.error])))}const _=t.split("/").pop()||t,H=p.size;return a.jsx("div",{className:"dialog-overlay",onClick:S,children:a.jsxs("div",{className:"dialog import-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"import-dialog-title",onClick:D=>D.stopPropagation(),children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",id:"import-dialog-title",children:"Import Claude Code sessions"}),a.jsx("button",{className:"dialog-close",onClick:S,"aria-label":"Close",disabled:m,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"})," in ",a.jsx("strong",{title:t,children:_}),", in a terminal or an IDE. An imported session keeps its history and continues the same Claude 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 sessions to import here. Sessions you start with ",a.jsx("code",{children:"claude"})," in this folder will show up here."]}):a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"import-select-all",children:[a.jsx("input",{type:"checkbox",checked:N,disabled:m,onChange:()=>g(N?new Set:new Set(E.map(D=>D.session_id)))}),"Select all (",o.length,")"]}),a.jsx("ul",{className:"import-list",children:o.map(D=>{const O=k.get(D.session_id);return a.jsx("li",{children:a.jsxs("label",{className:`import-row${p.has(D.session_id)?" selected":""}`,children:[a.jsx("input",{type:"checkbox",checked:p.has(D.session_id),disabled:m,onChange:()=>T(D.session_id)}),a.jsxs("span",{className:"import-row-main",children:[a.jsx("span",{className:"import-row-title",title:D.title,children:D.title}),a.jsxs("span",{className:"import-row-meta",children:[a.jsx("span",{title:new Date(D.last_modified).toLocaleString(),children:dj(D.last_modified)}),D.git_branch&&a.jsxs("span",{className:"import-row-branch",title:"Git branch",children:[a.jsx(nv,{size:10})," ",D.git_branch]})]}),D.recently_active&&a.jsxs("span",{className:"import-row-warn",children:[a.jsx(dv,{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."]}),O&&a.jsx("span",{className:"import-row-error",role:"alert",children:O})]})]})},D.session_id)})})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:S,disabled:m,children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:()=>void C(),disabled:H===0||m,children:m?a.jsxs(a.Fragment,{children:[a.jsx(hn,{size:12,className:"spin"})," Importing…"]}):H>1?`Import ${H} sessions`:"Import"})]})]})})}const hj=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,mj=512*1024;function gj(t){const s=t.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"");return/^[a-z0-9]/.test(s)?s:""}function vj(){const{appCatalogOpen:t,closeAppCatalog:s,apps:r,installExampleApp:o,createSkeletonApp:l,importAppFolder:c}=I(),[d,p]=x.useState("examples"),[g,m]=x.useState(null),[v,k]=x.useState(null),[y,S]=x.useState(!1),[T,E]=x.useState(""),[N,C]=x.useState(""),[_,H]=x.useState(""),[D,O]=x.useState(""),[K,G]=x.useState(null),[z,J]=x.useState(""),he=x.useRef(null);if(x.useEffect(()=>{t&&(m(null),Lw().then(m).catch(()=>m([])))},[t]),x.useEffect(()=>{he.current&&(he.current.webkitdirectory=!0)},[d]),!t)return null;const ae=new Set(r.map(F=>F.id));async function ve(F){k(F);try{await o(F)&&s()}finally{k(null)}}async function we(){if(y)return;const F=T.trim(),X=N.trim();if(!(!F||!X)){S(!0);try{await l({id:F,title:X,description:_.trim()||void 0,icon:D.trim()||void 0})&&(E(""),C(""),H(""),O(""),s())}finally{S(!1)}}}async function Ae(F){const X=Array.from(F.target.files??[]),L={};let R="";for(const $ of X){const me=($.webkitRelativePath??"").split("/");!R&&me.length>1&&(R=me[0]);const Y=me[me.length-1];if(!(!Y||!hj.test(Y))&&!($.size>mj))try{L[Y]=await $.text()}catch{}}G(Object.keys(L).length>0?L:null),J(gj(R))}async function ee(){if(!(y||!K||!z.trim())){S(!0);try{await c(z.trim(),K)&&(G(null),J(""),s())}finally{S(!1)}}}function ne(F){F.key==="Escape"&&s()}const oe=[{key:"examples",label:"Examples"},{key:"new",label:"New App"},{key:"upload",label:"Upload"}];return a.jsx("div",{className:"dialog-overlay",onClick:s,children:a.jsxs("div",{className:"dialog app-catalog",onClick:F=>F.stopPropagation(),onKeyDown:ne,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:s,children:"✕"})]}),a.jsx("div",{className:"catalog-tabs",children:oe.map(F=>a.jsx("button",{className:`catalog-tab${d===F.key?" active":""}`,onClick:()=>p(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:g===null?a.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"Loading examples…"}):g.length===0?a.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"No example apps available."}):g.map(F=>{const X=ae.has(F.id);return a.jsxs("div",{className:"example-row",children:[a.jsx(ji,{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:X||v===F.id,onClick:()=>ve(F.id),title:X?"Already installed":"Install this example",children:X?"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:T,onChange:F=>E(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:N,onChange:F=>C(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:_,onChange:F=>H(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:D,onChange:F=>O(F.target.value),placeholder:"e.g. notebook-pen",spellCheck:!1,autoCapitalize:"off"})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:y||!T.trim()||!N.trim(),onClick:we,children:[a.jsx(fr,{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:he,type:"file",multiple:!0,onChange:Ae}),K&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["App id",a.jsx("input",{className:"dialog-input",type:"text",value:z,onChange:F=>J(F.target.value)})]}),a.jsxs("div",{className:"catalog-upload-summary",children:[Object.keys(K).length," file(s):"," ",Object.keys(K).slice(0,6).join(", "),Object.keys(K).length>6?", …":""]})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:y||!K||!z.trim(),onClick:ee,children:[a.jsx(G1,{size:13})," Import App"]})]})]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:s,children:"Close"})})]})})}function yj(){const t=I(k=>k.showCommandPalette),s=I(k=>k.setShowCommandPalette),r=I(),[o,l]=x.useState(""),[c,d]=x.useState(0),p=x.useRef(null),g=x.useMemo(()=>{const k=r.activeSessionId?r.sessionDetails[r.activeSessionId]:null,y=Ml(k);return[{id:"new-session",label:"New Session",hint:"Create a new Codex session",icon:fr,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:Lo,action:()=>{const S=document.querySelector(".cmd-input");S==null||S.focus()},available:!!r.activeSessionId&&!y},{id:"cancel-turn",label:"Cancel Turn",hint:"Cancel the running turn",icon:Fr,action:()=>r.cancelTurn(),available:y},{id:"tab-turns",label:"Switch to Turns Tab",hint:"View conversation timeline",icon:R1,action:()=>r.switchRightTab("turns"),available:!!r.activeSessionId},{id:"tab-sidecar",label:"Ask Sidecar",hint:"Ask about this session — status, blockers, what is left",icon:mr,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:P1,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=x.useMemo(()=>{const k=o.toLowerCase().trim(),y=g.filter(S=>S.available);return k?y.filter(S=>S.label.toLowerCase().includes(k)||S.hint.toLowerCase().includes(k)):y},[g,o]);x.useEffect(()=>{t&&(l(""),d(0),setTimeout(()=>{var k;return(k=p.current)==null?void 0:k.focus()},50))},[t]);function v(k){if(k.key==="ArrowDown")k.preventDefault(),d(y=>Math.min(y+1,m.length-1));else if(k.key==="ArrowUp")k.preventDefault(),d(y=>Math.max(y-1,0));else if(k.key==="Enter"){k.preventDefault();const y=m[c];y&&(y.action(),s(!1))}else k.key==="Escape"&&s(!1)}return t?a.jsx("div",{className:"palette-overlay",onClick:()=>s(!1),children:a.jsxs("div",{className:"palette",onClick:k=>k.stopPropagation(),children:[a.jsxs("div",{className:"palette-search",children:[a.jsx("input",{ref:p,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,y)=>{const S=k.icon;return a.jsxs("div",{className:`palette-item ${y===c?"selected":""}`,onClick:()=>{k.action(),s(!1)},onMouseEnter:()=>d(y),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}),y===c&&a.jsx(x1,{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 gg=/^[a-z][a-z0-9-]{1,30}$/,xj=2e3;function wj(){const{showRemoteModal:t,setShowRemoteModal:s,selectSession:r}=I(),[o,l]=x.useState(null),[c,d]=x.useState(null),[p,g]=x.useState(!1),[m,v]=x.useState(!1),[k,y]=x.useState(!1),[S,T]=x.useState(!1),[E,N]=x.useState("main"),[C,_]=x.useState(""),[H,D]=x.useState(!1),[O,K]=x.useState(null),G=x.useRef(null);Mo(G,()=>T(!1),S);const z=m||k,J=x.useCallback(async()=>{g(!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{g(!1)}},[]);x.useEffect(()=>{t&&(N("main"),K(null),J())},[t,J]);const he=O!==null&&O.state==="running";if(x.useEffect(()=>{if(!he)return;const F=setInterval(async()=>{try{const X=await fetch(`${mn()}/remote/enable`,{headers:{Accept:"application/json"}});X.ok&&K(await X.json())}catch{}},xj);return()=>clearInterval(F)},[he]),!t)return null;const ae=!!(o!=null&&o.tunnel.provisioned)&&!!(o!=null&&o.service.running)&&!!(o!=null&&o.connection.ok);function ve(F){F.key==="Escape"&&s(!1)}async function we(F){if(gg.test(F)){D(!0);try{const X=await fetch(`${mn()}/remote/enable`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mahlas:F})});if(!X.ok)throw new Error(`enable ${X.status}`);K(await X.json()),N("setup")}catch{d("Could not start the setup — check the daemon logs.")}finally{D(!1)}}}function Ae(){O!=null&&O.troubleshootingSessionId&&(r(O.troubleshootingSessionId),s(!1))}async function ee(){v(!0);try{await fetch(`${mn()}/remote/disable`,{method:"POST"}),await J()}catch{d("Could not stop the tunnel service — check the service logs.")}finally{v(!1)}}async function ne(){if(T(!1),!!window.confirm(`Remove the tunnel completely?
663
-
664
- This deletes the Cloudflare tunnel, its DNS record and Access app, and this machine's remote state. The mahlas is released.
665
-
666
- This cannot be undone.`)){y(!0);try{const X=await fetch(`${mn()}/remote/uninstall`,{method:"DELETE"});if(!X.ok)throw new Error(`uninstall ${X.status}`);await J()}catch{d("Could not remove the tunnel — check the daemon logs.")}finally{y(!1)}}}function oe(){if(!O)return a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["Machine name (mahlas)",a.jsx("input",{className:"dialog-input",value:C,onChange:R=>_(R.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:()=>N("main"),children:"Back"}),a.jsxs("button",{className:"dialog-btn-create",disabled:!gg.test(C)||H,onClick:()=>void we(C),children:[H?a.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Start setup"]})]})]});const F=["detect","provision","install","verify","ready"],X=F.indexOf(O.step),L=O.state==="ready";return a.jsxs(a.Fragment,{children:[O.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…"]}),O.state==="ready"&&a.jsxs("div",{className:"dialog-label",style:{color:"var(--green)",display:"flex",alignItems:"center",gap:6},children:[a.jsx(Ns,{size:14})," Setup complete — you can close this window."]}),O.state==="ready"&&O.hostname&&a.jsxs("div",{className:"dialog-label",children:["This machine is accessible at"," ",a.jsx("a",{href:`https://${O.hostname}`,target:"_blank",rel:"noreferrer",children:O.hostname})]}),a.jsx("ol",{className:"dialog-label",style:{margin:"4px 0",paddingLeft:0,listStyle:"none"},children:F.map((R,$)=>{const le=L||X>-1&&$<X,me=!L&&$===X&&O.state==="running";return a.jsxs("li",{style:{display:"flex",alignItems:"center",gap:6,opacity:le||me?1:.4,color:le?"var(--green)":void 0},children:[le?a.jsx(Ns,{size:13}):me?a.jsx(hn,{size:13,className:"spin"}):a.jsx(v1,{size:9,style:{marginLeft:2,marginRight:2}}),R]},R)})}),O.logs.length>0&&a.jsx("div",{className:"dialog-label",style:{opacity:.7,fontSize:12,whiteSpace:"pre-wrap"},children:O.logs.slice(-3).map(R=>R.message).join(`
667
- `)}),O.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:Ae,children:"Open troubleshooting session"})})]}),O.state==="failed"&&a.jsxs("div",{className:"dialog-label",style:{color:"var(--red)"},children:["Setup failed: ",O.error]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:()=>void J(),children:"Refresh status"})})]})}return a.jsx("div",{className:"dialog-overlay",onClick:()=>s(!1),children:a.jsxs("div",{className:"dialog",onClick:F=>F.stopPropagation(),onKeyDown:ve,children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"Remote Access"}),a.jsx("button",{className:"dialog-close",onClick:()=>s(!1),children:a.jsx(Tn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[p&&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}),E==="setup"?oe():a.jsxs(a.Fragment,{children:[ae&&(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:z,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:()=>T(F=>!F),disabled:z,"aria-label":"More tunnel actions","aria-haspopup":"menu","aria-expanded":S,children:k?a.jsx(hn,{size:14,className:"spin"}):a.jsx(Si,{size:14})}),S&&a.jsx("div",{ref:G,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 ne(),children:[a.jsx(us,{size:12})," Remove tunnel"]})})]})]}),!ae&&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 we(o.tunnel.mahlas),disabled:H,children:[H?a.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):a.jsx(sm,{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:()=>N("setup"),children:[a.jsx(sm,{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 kj={success:m1,error:$l,info:T1,warn:dv},Sj=4e3;function bj({toast:t}){const s=I(d=>d.removeToast),r=kj[t.type],o=x.useRef(null);x.useEffect(()=>{function d(){o.current=setTimeout(()=>s(t.id),Sj)}return d(),()=>{o.current&&clearTimeout(o.current)}},[t.id,s]);function l(){o.current&&(clearTimeout(o.current),o.current=null)}function c(){o.current=setTimeout(()=>s(t.id),2e3)}return a.jsxs("div",{className:`toast toast-${t.type}`,onMouseEnter:l,onMouseLeave:c,children:[a.jsx(r,{size:16}),a.jsx("span",{className:"toast-message",children:t.message}),t.undoAction&&a.jsxs("button",{className:"toast-undo",onClick:()=>{var d;(d=t.undoAction)==null||d.call(t),s(t.id)},children:[a.jsx(V1,{size:12})," ",t.undoLabel||"Undo"]}),a.jsx("button",{className:"toast-close",onClick:()=>s(t.id),children:a.jsx(Tn,{size:14})})]})}function Tj(){const t=I(s=>s.toasts);return t.length===0?null:a.jsx("div",{className:"toast-container",children:t.map(s=>a.jsx(bj,{toast:s},s.id))})}function Nj(){const[t]=x.useState(vw),[s,r]=x.useState(!1),[o,l]=x.useState(!1),c=x.useRef(void 0);x.useEffect(()=>()=>clearTimeout(c.current),[]);async function d(){await Io(Wh)&&(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"}),t&&a.jsx("p",{className:"daemon-download-text",children:"Open the Repoburg app to continue."}),a.jsxs("div",{className:"daemon-download-install",children:[t&&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:Wh}),a.jsx("button",{type:"button",className:`daemon-download-copy${s?" copied":""}`,onClick:()=>void d(),"aria-label":"Copy the install command",title:s?"Copied":"Copy",children:s?a.jsx(Ns,{size:15}):a.jsx(_o,{size:15})})]}),!t&&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."}),(t||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,Ti=null,bo=1e3;const jj=1e4;function yd(){Jn&&(Jn.readyState===WebSocket.OPEN||Jn.readyState===WebSocket.CONNECTING)||(Jn=new WebSocket(v0("/ws")),Jn.onopen=()=>{const t=bo>1e3;if(bo=1e3,I.getState().setWsConnected(!0),I.getState().addLogEntry("INFO","WebSocket connected"),t){ew();const s=I.getState();s.activeSessionId&&(s.refreshActiveSession(),s.addToast("info","WebSocket reconnected — session state reconciled"))}},Jn.onclose=()=>{I.getState().setWsConnected(!1),I.getState().addLogEntry("WARN","WebSocket disconnected"),I.getState().addToast("warn","WebSocket disconnected — reconnecting…"),_j()},Jn.onerror=()=>{},Jn.onmessage=t=>{try{const s=JSON.parse(t.data);Dt.trackWsEvent(typeof s.event=="string"?s.event:"unknown",typeof t.data=="string"?t.data.length:0);const r=Ej[s.event];r&&r(s.data)}catch{}})}function Cj(){Ti&&(clearTimeout(Ti),Ti=null),Jn&&(Jn.onclose=null,Jn.close(),Jn=null),I.getState().setWsConnected(!1)}function _j(){Ti||(Ti=window.setTimeout(()=>{Ti=null,yd()},bo),bo=Math.min(bo*2,jj))}const Ej={"turn:created":t=>{const s=t;I.getState().onTurnCreated(s.sessionId,s.turn)},"turn:started":t=>{const s=t;Dt.note(`turn:started — ${s.turnId.slice(0,8)}`),I.getState().onTurnStarted(s.sessionId,s.turnId)},"item:started":t=>{const s=t;I.getState().onItemStarted(s.sessionId,s.turnId,s.item)},"item:updated":t=>{const s=t;I.getState().onItemUpdated(s.sessionId,s.turnId,s.item)},"item:completed":t=>{const s=t;I.getState().onItemCompleted(s.sessionId,s.turnId,s.item)},"item:delta":t=>{const s=t;I.getState().onItemDelta(s.sessionId,s.turnId,s.itemId,s.delta)},"turn:completed":t=>{const s=t;Dt.note(`turn:completed — ${s.turnId.slice(0,8)}`),I.getState().onTurnCompleted(s.sessionId,s.turnId,s.usage,s.hasUnreviewed,s.response??void 0)},"turn:tokenUsage":t=>{const s=t;I.getState().onTokenUsageUpdated(s.sessionId,s.turnId,s.usage)},"turn:contextUsage":t=>{const s=t,r={totalTokens:s.totalTokens,contextWindow:s.contextWindow,percentage:s.percentage,...s.autoCompactThreshold?{autoCompactThreshold:s.autoCompactThreshold}:{}};I.getState().onContextUsageUpdated(s.sessionId,r)},"turn:failed":t=>{const s=t;I.getState().onTurnFailed(s.sessionId,s.turnId,s.error,s.resumeState)},"turn:interrupted":t=>{const s=t;Dt.note(`turn:interrupted — ${s.turnId.slice(0,8)} (${s.reason})`),I.getState().onTurnInterrupted(s.sessionId,s.turnId,{reason:s.reason,interruptedAt:s.interruptedAt,attempts:s.attempts,detail:s.detail??null,resumeAt:s.resumeAt??null})},"turn:resuming":t=>{const s=t;I.getState().onTurnResuming(s.sessionId,s.turnId,s.attempt)},"turn:resumed":t=>{const s=t;I.getState().onTurnResumed(s.sessionId,s.turnId)},"turn:retrying":t=>{const s=t;I.getState().onTurnRetrying(s.sessionId,s.turnId,{attempt:s.attempt,maxRetries:s.maxRetries,retryDelayMs:s.retryDelayMs,errorStatus:s.errorStatus??null,error:s.error??null})},"turn:cancelled":t=>{const s=t;I.getState().onTurnCancelled(s.sessionId,s.turnId)},"session:title":t=>{const s=t;I.getState().onSessionTitle(s.sessionId,s.title)},"session:touched":t=>{const s=t;I.getState().onSessionTouched(s.sessionId)},"session:created":t=>{const{session:s}=t;s.origin_app_id&&sl(s.id,s.origin_app_id),I.getState().addSession(s)},"session:updated":t=>{const s=t;I.getState().onSessionUpdated(s.session)},background_tasks:t=>{const s=t;Dt.note(`background_tasks — ${s.tasks.length} live (${s.tasks.map(r=>r.task_type).join(", ")||"none"})`),I.getState().onBackgroundTasksChanged(s.sessionId,s.tasks)},"background_tasks:snapshot":t=>{const s=t;I.getState().onBackgroundTasksSnapshot(s.sessions??{})},"signed_out_turns:snapshot":t=>{const s=t;I.getState().onSignedOutTurnsSnapshot(s.turns??[])},"thread:created":t=>{const s=t;I.getState().onThreadCreated(s.sessionId,s.thread,s.turn)},"thread:followup":t=>{const s=t;I.getState().onThreadFollowup(s.sessionId,s.threadId,s.turn)},"thread:resolved":t=>{const s=t;I.getState().onThreadResolved(s.sessionId,s.threadId,s.status)},"thread:deleted":t=>{const s=t;I.getState().onThreadDeleted(s.sessionId,s.threadId)},"app:tool_call":t=>{const s=t;q0(s.appId,s.callId,s.tool,s.args??{},s.workspace,s.caller)},"app:source:updated":t=>{tw(t.appId),I.getState().refreshApps()},"app:state_changed":t=>{const{appId:s,...r}=t;zg(s,r)}};function Rj(){const t=I(s=>s.init);return x.useEffect(()=>{m0();function s(){t(),yd()}const{daemonStatus:r,setDaemonStatus:o}=I.getState();let l=null;r==="ready"?s():l=xw({onMissing:()=>o("missing"),onReady:()=>{o("ready"),s()}});function c(){if(document.visibilityState!=="visible")return;const d=I.getState(),p=d.activeSessionId;if(!p)return;const g=d.sessionDetails[p];d.wsConnected||yd(),g&&g.is_running===1&&(d.refreshActiveSession(),d.addLogEntry("INFO","Tab returned — reconciling session state"))}return document.addEventListener("visibilitychange",c),()=>{l==null||l(),Cj(),document.removeEventListener("visibilitychange",c)}},[t]),null}const hy="agentpaneView";function xd(t){return{tab:Sd(t),vscode:t.vscodeViewOpen,usage:t.usageViewOpen,terminal:t.terminalViewOpen}}function my(t,s){return t.tab===s.tab&&t.vscode===s.vscode&&t.usage===s.usage&&t.terminal===s.terminal}function vg(t){return t.tab===null&&!t.vscode&&!t.usage&&!t.terminal}function yg(t,s){return s.tab!==null&&!t.tabOrder.includes(s.tab)?!1:!my(s,xd(t))}function xg(t){const s=t==null?void 0:t[hy];return typeof(s==null?void 0:s.index)!="number"?null:{...s,view:{...s.view,terminal:!!s.view.terminal}}}function Aj(t,s){t.getState().vscodeViewOpen!==s.vscode&&t.getState().toggleVscodeView(),t.getState().usageViewOpen!==s.usage&&t.getState().toggleUsageView(),t.getState().terminalViewOpen!==s.terminal&&t.getState().toggleTerminalView();const r=t.getState();if(s.tab===null)return;const{kind:o,id:l}=pr(s.tab);o==="app"?r.openAppTab(l):r.activeSessionId===l?r.setActiveAppTab(null):r.selectSession(l)}function Ij(t){let s=xg(window.history.state)??{index:0,newest:0,view:xd(t.getState())},r=s.newest,o=!1;const l=new Map([[s.index,s.view]]),c=y=>{const S=t.getState();for(let T=s.index+y;T>=0&&T<=r;T+=y){const E=l.get(T);if(!E||yg(S,E))return!0}return!1},d=()=>{const y=c(-1),S=c(1),T=t.getState();(T.canGoBack!==y||T.canGoForward!==S)&&t.setState({canGoBack:y,canGoForward:S})},p=()=>({[hy]:{...s,newest:r}}),g=()=>{window.history.replaceState({...window.history.state,...p()},"")},m=y=>{if(l.set(s.index,s.view),vg(s.view))s={...s,view:y},g();else{s={index:s.index+1,newest:s.index+1,view:y},r=s.index;for(const S of l.keys())S>r&&l.delete(S);window.history.pushState(p(),"")}l.set(s.index,y)},v=y=>{const S=xg(y.state);if(!S)return;l.set(S.index,S.view),r=Math.max(r,S.index);const T=t.getState(),E=Math.sign(S.index-s.index);if(E!==0&&!yg(T,S.view)){const N=S.index+E;window.history.go(N<0||N>r?s.index-S.index:E);return}s=S,g(),o=!0;try{Aj(t,S.view)}finally{o=!1}d()};g(),d(),window.addEventListener("popstate",v);const k=t.subscribe((y,S)=>{const T=y.activeSessionId!==S.activeSessionId||y.activeAppTabId!==S.activeAppTabId||y.vscodeViewOpen!==S.vscodeViewOpen||y.usageViewOpen!==S.usageViewOpen||y.terminalViewOpen!==S.terminalViewOpen;if(!(!T&&y.tabOrder===S.tabOrder)){if(T&&!o){const E=xd(y);!vg(E)&&!my(E,s.view)&&m(E)}d()}});return()=>{k(),window.removeEventListener("popstate",v)}}function Dj(){const t=I(c=>c.loading),s=I(c=>c.error),r=I(c=>c.sessions),o=I(c=>c.daemonStatus),l=I(c=>c.setShowCommandPalette);return x.useEffect(()=>Dt.start(),[]),x.useEffect(()=>Ij(I),[]),x.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(Rj,{}),o==="missing"?a.jsx(Nj,{}):o==="checking"||t&&r.length===0?a.jsx("div",{className:"empty-state",children:"Loading sessions…"}):s&&r.length===0?a.jsxs("div",{className:"empty-state",children:["Error: ",s]}):a.jsxs(a.Fragment,{children:[a.jsx(ij,{}),a.jsx(oj,{}),a.jsx(cj,{}),a.jsx(fj,{}),a.jsx(vj,{}),a.jsx(wj,{}),a.jsx(yj,{}),a.jsx(Tj,{})]})]})}r0.createRoot(document.getElementById("root")).render(a.jsx(lt.StrictMode,{children:a.jsx(Dj,{})}));export{Eo as R,Tn as X,v0 as b,ye as c,a as j,x as r,I as u};