repoburg 1.3.315 → 1.3.317

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.
@@ -0,0 +1,852 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalView-D3fkOngy.js","assets/TerminalView-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
2
+ var Ww=Object.defineProperty;var Hw=(e,n,r)=>n in e?Ww(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var dt=(e,n,r)=>Hw(e,typeof n!="symbol"?n+"":n,r);(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))o(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&o(d)}).observe(document,{childList:!0,subtree:!0});function r(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function o(l){if(l.ep)return;l.ep=!0;const c=r(l);fetch(l.href,c)}})();function ev(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fu={exports:{}},vi={},Uu={exports:{}},Ve={};/**
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 Kh;function Vw(){if(Kh)return Ve;Kh=1;var e=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),k=Symbol.iterator;function y(E){return E===null||typeof E!="object"?null:(E=k&&E[k]||E["@@iterator"],typeof E=="function"?E:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,T={};function C(E,L,de){this.props=E,this.context=L,this.refs=T,this.updater=de||S}C.prototype.isReactComponent={},C.prototype.setState=function(E,L){if(typeof E!="object"&&typeof E!="function"&&E!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,E,L,"setState")},C.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function b(){}b.prototype=C.prototype;function A(E,L,de){this.props=E,this.context=L,this.refs=T,this.updater=de||S}var $=A.prototype=new b;$.constructor=A,j($,C.prototype),$.isPureReactComponent=!0;var P=Array.isArray,z=Object.prototype.hasOwnProperty,G={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function F(E,L,de){var U,me={},Y=null,xe=null;if(L!=null)for(U in L.ref!==void 0&&(xe=L.ref),L.key!==void 0&&(Y=""+L.key),L)z.call(L,U)&&!M.hasOwnProperty(U)&&(me[U]=L[U]);var we=arguments.length-2;if(we===1)me.children=de;else if(1<we){for(var Me=Array(we),_e=0;_e<we;_e++)Me[_e]=arguments[_e+2];me.children=Me}if(E&&E.defaultProps)for(U in we=E.defaultProps,we)me[U]===void 0&&(me[U]=we[U]);return{$$typeof:e,type:E,key:Y,ref:xe,props:me,_owner:G.current}}function Z(E,L){return{$$typeof:e,type:E.type,key:L,ref:E.ref,props:E.props,_owner:E._owner}}function Q(E){return typeof E=="object"&&E!==null&&E.$$typeof===e}function J(E){var L={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(de){return L[de]})}var he=/\/+/g;function ke(E,L){return typeof E=="object"&&E!==null&&E.key!=null?J(""+E.key):L.toString(36)}function re(E,L,de,U,me){var Y=typeof E;(Y==="undefined"||Y==="boolean")&&(E=null);var xe=!1;if(E===null)xe=!0;else switch(Y){case"string":case"number":xe=!0;break;case"object":switch(E.$$typeof){case e:case n:xe=!0}}if(xe)return xe=E,me=me(xe),E=U===""?"."+ke(xe,0):U,P(me)?(de="",E!=null&&(de=E.replace(he,"$&/")+"/"),re(me,L,de,"",function(_e){return _e})):me!=null&&(Q(me)&&(me=Z(me,de+(!me.key||xe&&xe.key===me.key?"":(""+me.key).replace(he,"$&/")+"/")+E)),L.push(me)),1;if(xe=0,U=U===""?".":U+":",P(E))for(var we=0;we<E.length;we++){Y=E[we];var Me=U+ke(Y,we);xe+=re(Y,L,de,Me,me)}else if(Me=y(E),typeof Me=="function")for(E=Me.call(E),we=0;!(Y=E.next()).done;)Y=Y.value,Me=U+ke(Y,we++),xe+=re(Y,L,de,Me,me);else if(Y==="object")throw L=String(E),Error("Objects are not valid as a React child (found: "+(L==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":L)+"). If you meant to render a collection of children, use an array instead.");return xe}function ve(E,L,de){if(E==null)return E;var U=[],me=0;return re(E,U,"","",function(Y){return L.call(de,Y,me++)}),U}function le(E){if(E._status===-1){var L=E._result;L=L(),L.then(function(de){(E._status===0||E._status===-1)&&(E._status=1,E._result=de)},function(de){(E._status===0||E._status===-1)&&(E._status=2,E._result=de)}),E._status===-1&&(E._status=0,E._result=L)}if(E._status===1)return E._result.default;throw E._result}var ee={current:null},X={transition:null},ie={ReactCurrentDispatcher:ee,ReactCurrentBatchConfig:X,ReactCurrentOwner:G};function K(){throw Error("act(...) is not supported in production builds of React.")}return Ve.Children={map:ve,forEach:function(E,L,de){ve(E,function(){L.apply(this,arguments)},de)},count:function(E){var L=0;return ve(E,function(){L++}),L},toArray:function(E){return ve(E,function(L){return L})||[]},only:function(E){if(!Q(E))throw Error("React.Children.only expected to receive a single React element child.");return E}},Ve.Component=C,Ve.Fragment=r,Ve.Profiler=l,Ve.PureComponent=A,Ve.StrictMode=o,Ve.Suspense=h,Ve.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ie,Ve.act=K,Ve.cloneElement=function(E,L,de){if(E==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+E+".");var U=j({},E.props),me=E.key,Y=E.ref,xe=E._owner;if(L!=null){if(L.ref!==void 0&&(Y=L.ref,xe=G.current),L.key!==void 0&&(me=""+L.key),E.type&&E.type.defaultProps)var we=E.type.defaultProps;for(Me in L)z.call(L,Me)&&!M.hasOwnProperty(Me)&&(U[Me]=L[Me]===void 0&&we!==void 0?we[Me]:L[Me])}var Me=arguments.length-2;if(Me===1)U.children=de;else if(1<Me){we=Array(Me);for(var _e=0;_e<Me;_e++)we[_e]=arguments[_e+2];U.children=we}return{$$typeof:e,type:E.type,key:me,ref:Y,props:U,_owner:xe}},Ve.createContext=function(E){return E={$$typeof:d,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},E.Provider={$$typeof:c,_context:E},E.Consumer=E},Ve.createElement=F,Ve.createFactory=function(E){var L=F.bind(null,E);return L.type=E,L},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function(E){return{$$typeof:f,render:E}},Ve.isValidElement=Q,Ve.lazy=function(E){return{$$typeof:v,_payload:{_status:-1,_result:E},_init:le}},Ve.memo=function(E,L){return{$$typeof:m,type:E,compare:L===void 0?null:L}},Ve.startTransition=function(E){var L=X.transition;X.transition={};try{E()}finally{X.transition=L}},Ve.unstable_act=K,Ve.useCallback=function(E,L){return ee.current.useCallback(E,L)},Ve.useContext=function(E){return ee.current.useContext(E)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function(E){return ee.current.useDeferredValue(E)},Ve.useEffect=function(E,L){return ee.current.useEffect(E,L)},Ve.useId=function(){return ee.current.useId()},Ve.useImperativeHandle=function(E,L,de){return ee.current.useImperativeHandle(E,L,de)},Ve.useInsertionEffect=function(E,L){return ee.current.useInsertionEffect(E,L)},Ve.useLayoutEffect=function(E,L){return ee.current.useLayoutEffect(E,L)},Ve.useMemo=function(E,L){return ee.current.useMemo(E,L)},Ve.useReducer=function(E,L,de){return ee.current.useReducer(E,L,de)},Ve.useRef=function(E){return ee.current.useRef(E)},Ve.useState=function(E){return ee.current.useState(E)},Ve.useSyncExternalStore=function(E,L,de){return ee.current.useSyncExternalStore(E,L,de)},Ve.useTransition=function(){return ee.current.useTransition()},Ve.version="18.3.1",Ve}var Gh;function Vd(){return Gh||(Gh=1,Uu.exports=Vw()),Uu.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 qh;function Kw(){if(qh)return vi;qh=1;var e=Vd(),n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,l=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function d(f,h,m){var v,k={},y=null,S=null;m!==void 0&&(y=""+m),h.key!==void 0&&(y=""+h.key),h.ref!==void 0&&(S=h.ref);for(v in h)o.call(h,v)&&!c.hasOwnProperty(v)&&(k[v]=h[v]);if(f&&f.defaultProps)for(v in h=f.defaultProps,h)k[v]===void 0&&(k[v]=h[v]);return{$$typeof:n,type:f,key:y,ref:S,props:k,_owner:l.current}}return vi.Fragment=r,vi.jsx=d,vi.jsxs=d,vi}var Xh;function Gw(){return Xh||(Xh=1,Fu.exports=Kw()),Fu.exports}var a=Gw(),x=Vd();const pt=ev(x);var el={},Bu={exports:{}},In={},Wu={exports:{}},Hu={};/**
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 Yh;function qw(){return Yh||(Yh=1,(function(e){function n(X,ie){var K=X.length;X.push(ie);e:for(;0<K;){var E=K-1>>>1,L=X[E];if(0<l(L,ie))X[E]=ie,X[K]=L,K=E;else break e}}function r(X){return X.length===0?null:X[0]}function o(X){if(X.length===0)return null;var ie=X[0],K=X.pop();if(K!==ie){X[0]=K;e:for(var E=0,L=X.length,de=L>>>1;E<de;){var U=2*(E+1)-1,me=X[U],Y=U+1,xe=X[Y];if(0>l(me,K))Y<L&&0>l(xe,me)?(X[E]=xe,X[Y]=K,E=Y):(X[E]=me,X[U]=K,E=U);else if(Y<L&&0>l(xe,K))X[E]=xe,X[Y]=K,E=Y;else break e}}return ie}function l(X,ie){var K=X.sortIndex-ie.sortIndex;return K!==0?K:X.id-ie.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var h=[],m=[],v=1,k=null,y=3,S=!1,j=!1,T=!1,C=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function $(X){for(var ie=r(m);ie!==null;){if(ie.callback===null)o(m);else if(ie.startTime<=X)o(m),ie.sortIndex=ie.expirationTime,n(h,ie);else break;ie=r(m)}}function P(X){if(T=!1,$(X),!j)if(r(h)!==null)j=!0,le(z);else{var ie=r(m);ie!==null&&ee(P,ie.startTime-X)}}function z(X,ie){j=!1,T&&(T=!1,b(F),F=-1),S=!0;var K=y;try{for($(ie),k=r(h);k!==null&&(!(k.expirationTime>ie)||X&&!J());){var E=k.callback;if(typeof E=="function"){k.callback=null,y=k.priorityLevel;var L=E(k.expirationTime<=ie);ie=e.unstable_now(),typeof L=="function"?k.callback=L:k===r(h)&&o(h),$(ie)}else o(h);k=r(h)}if(k!==null)var de=!0;else{var U=r(m);U!==null&&ee(P,U.startTime-ie),de=!1}return de}finally{k=null,y=K,S=!1}}var G=!1,M=null,F=-1,Z=5,Q=-1;function J(){return!(e.unstable_now()-Q<Z)}function he(){if(M!==null){var X=e.unstable_now();Q=X;var ie=!0;try{ie=M(!0,X)}finally{ie?ke():(G=!1,M=null)}}else G=!1}var ke;if(typeof A=="function")ke=function(){A(he)};else if(typeof MessageChannel<"u"){var re=new MessageChannel,ve=re.port2;re.port1.onmessage=he,ke=function(){ve.postMessage(null)}}else ke=function(){C(he,0)};function le(X){M=X,G||(G=!0,ke())}function ee(X,ie){F=C(function(){X(e.unstable_now())},ie)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(X){X.callback=null},e.unstable_continueExecution=function(){j||S||(j=!0,le(z))},e.unstable_forceFrameRate=function(X){0>X||125<X?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Z=0<X?Math.floor(1e3/X):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return r(h)},e.unstable_next=function(X){switch(y){case 1:case 2:case 3:var ie=3;break;default:ie=y}var K=y;y=ie;try{return X()}finally{y=K}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(X,ie){switch(X){case 1:case 2:case 3:case 4:case 5:break;default:X=3}var K=y;y=X;try{return ie()}finally{y=K}},e.unstable_scheduleCallback=function(X,ie,K){var E=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?E+K:E):K=E,X){case 1:var L=-1;break;case 2:L=250;break;case 5:L=1073741823;break;case 4:L=1e4;break;default:L=5e3}return L=K+L,X={id:v++,callback:ie,priorityLevel:X,startTime:K,expirationTime:L,sortIndex:-1},K>E?(X.sortIndex=K,n(m,X),r(h)===null&&X===r(m)&&(T?(b(F),F=-1):T=!0,ee(P,K-E))):(X.sortIndex=L,n(h,X),j||S||(j=!0,le(z))),X},e.unstable_shouldYield=J,e.unstable_wrapCallback=function(X){var ie=y;return function(){var K=y;y=ie;try{return X.apply(this,arguments)}finally{y=K}}}})(Hu)),Hu}var Qh;function Xw(){return Qh||(Qh=1,Wu.exports=qw()),Wu.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 Zh;function Yw(){if(Zh)return In;Zh=1;var e=Vd(),n=Xw();function r(t){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+t,i=1;i<arguments.length;i++)s+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+t+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var o=new Set,l={};function c(t,s){d(t,s),d(t+"Capture",s)}function d(t,s){for(l[t]=s,t=0;t<s.length;t++)o.add(s[t])}var f=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,v={},k={};function y(t){return h.call(k,t)?!0:h.call(v,t)?!1:m.test(t)?k[t]=!0:(v[t]=!0,!1)}function S(t,s,i,u){if(i!==null&&i.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return u?!1:i!==null?!i.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function j(t,s,i,u){if(s===null||typeof s>"u"||S(t,s,i,u))return!0;if(u)return!1;if(i!==null)switch(i.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function T(t,s,i,u,p,g,w){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=u,this.attributeNamespace=p,this.mustUseProperty=i,this.propertyName=t,this.type=s,this.sanitizeURL=g,this.removeEmptyString=w}var C={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){C[t]=new T(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var s=t[0];C[s]=new T(s,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){C[t]=new T(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){C[t]=new T(t,2,!1,t,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){C[t]=new T(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){C[t]=new T(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){C[t]=new T(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){C[t]=new T(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){C[t]=new T(t,5,!1,t.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function A(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var s=t.replace(b,A);C[s]=new T(s,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var s=t.replace(b,A);C[s]=new T(s,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var s=t.replace(b,A);C[s]=new T(s,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){C[t]=new T(t,1,!1,t.toLowerCase(),null,!1,!1)}),C.xlinkHref=new T("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){C[t]=new T(t,1,!1,t.toLowerCase(),null,!0,!0)});function $(t,s,i,u){var p=C.hasOwnProperty(s)?C[s]:null;(p!==null?p.type!==0:u||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(j(s,i,p,u)&&(i=null),u||p===null?y(s)&&(i===null?t.removeAttribute(s):t.setAttribute(s,""+i)):p.mustUseProperty?t[p.propertyName]=i===null?p.type===3?!1:"":i:(s=p.attributeName,u=p.attributeNamespace,i===null?t.removeAttribute(s):(p=p.type,i=p===3||p===4&&i===!0?"":""+i,u?t.setAttributeNS(u,s,i):t.setAttribute(s,i))))}var P=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,z=Symbol.for("react.element"),G=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),Z=Symbol.for("react.profiler"),Q=Symbol.for("react.provider"),J=Symbol.for("react.context"),he=Symbol.for("react.forward_ref"),ke=Symbol.for("react.suspense"),re=Symbol.for("react.suspense_list"),ve=Symbol.for("react.memo"),le=Symbol.for("react.lazy"),ee=Symbol.for("react.offscreen"),X=Symbol.iterator;function ie(t){return t===null||typeof t!="object"?null:(t=X&&t[X]||t["@@iterator"],typeof t=="function"?t:null)}var K=Object.assign,E;function L(t){if(E===void 0)try{throw Error()}catch(i){var s=i.stack.trim().match(/\n( *(at )?)/);E=s&&s[1]||""}return`
35
+ `+E+t}var de=!1;function U(t,s){if(!t||de)return"";de=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(V){var u=V}Reflect.construct(t,[],s)}else{try{s.call()}catch(V){u=V}t.call(s.prototype)}else{try{throw Error()}catch(V){u=V}t()}}catch(V){if(V&&u&&typeof V.stack=="string"){for(var p=V.stack.split(`
36
+ `),g=u.stack.split(`
37
+ `),w=p.length-1,_=g.length-1;1<=w&&0<=_&&p[w]!==g[_];)_--;for(;1<=w&&0<=_;w--,_--)if(p[w]!==g[_]){if(w!==1||_!==1)do if(w--,_--,0>_||p[w]!==g[_]){var D=`
38
+ `+p[w].replace(" at new "," at ");return t.displayName&&D.includes("<anonymous>")&&(D=D.replace("<anonymous>",t.displayName)),D}while(1<=w&&0<=_);break}}}finally{de=!1,Error.prepareStackTrace=i}return(t=t?t.displayName||t.name:"")?L(t):""}function me(t){switch(t.tag){case 5:return L(t.type);case 16:return L("Lazy");case 13:return L("Suspense");case 19:return L("SuspenseList");case 0:case 2:case 15:return t=U(t.type,!1),t;case 11:return t=U(t.type.render,!1),t;case 1:return t=U(t.type,!0),t;default:return""}}function Y(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case M:return"Fragment";case G:return"Portal";case Z:return"Profiler";case F:return"StrictMode";case ke:return"Suspense";case re:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case J:return(t.displayName||"Context")+".Consumer";case Q:return(t._context.displayName||"Context")+".Provider";case he:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case ve:return s=t.displayName||null,s!==null?s:Y(t.type)||"Memo";case le:s=t._payload,t=t._init;try{return Y(t(s))}catch{}}return null}function xe(t){var s=t.type;switch(t.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=s.render,t=t.displayName||t.name||"",s.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Y(s);case 8:return s===F?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function we(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Me(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function _e(t){var s=Me(t)?"checked":"value",i=Object.getOwnPropertyDescriptor(t.constructor.prototype,s),u=""+t[s];if(!t.hasOwnProperty(s)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var p=i.get,g=i.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return p.call(this)},set:function(w){u=""+w,g.call(this,w)}}),Object.defineProperty(t,s,{enumerable:i.enumerable}),{getValue:function(){return u},setValue:function(w){u=""+w},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function ge(t){t._valueTracker||(t._valueTracker=_e(t))}function pe(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var i=s.getValue(),u="";return t&&(u=Me(t)?t.checked?"true":"false":t.value),t=u,t!==i?(s.setValue(t),!0):!1}function Xe(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Re(t,s){var i=s.checked;return K({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??t._wrapperState.initialChecked})}function at(t,s){var i=s.defaultValue==null?"":s.defaultValue,u=s.checked!=null?s.checked:s.defaultChecked;i=we(s.value!=null?s.value:i),t._wrapperState={initialChecked:u,initialValue:i,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function He(t,s){s=s.checked,s!=null&&$(t,"checked",s,!1)}function Te(t,s){He(t,s);var i=we(s.value),u=s.type;if(i!=null)u==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+i):t.value!==""+i&&(t.value=""+i);else if(u==="submit"||u==="reset"){t.removeAttribute("value");return}s.hasOwnProperty("value")?Ke(t,s.type,i):s.hasOwnProperty("defaultValue")&&Ke(t,s.type,we(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(t.defaultChecked=!!s.defaultChecked)}function Ue(t,s,i){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var u=s.type;if(!(u!=="submit"&&u!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+t._wrapperState.initialValue,i||s===t.value||(t.value=s),t.defaultValue=s}i=t.name,i!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,i!==""&&(t.name=i)}function Ke(t,s,i){(s!=="number"||Xe(t.ownerDocument)!==t)&&(i==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+i&&(t.defaultValue=""+i))}var lt=Array.isArray;function Tt(t,s,i,u){if(t=t.options,s){s={};for(var p=0;p<i.length;p++)s["$"+i[p]]=!0;for(i=0;i<t.length;i++)p=s.hasOwnProperty("$"+t[i].value),t[i].selected!==p&&(t[i].selected=p),p&&u&&(t[i].defaultSelected=!0)}else{for(i=""+we(i),s=null,p=0;p<t.length;p++){if(t[p].value===i){t[p].selected=!0,u&&(t[p].defaultSelected=!0);return}s!==null||t[p].disabled||(s=t[p])}s!==null&&(s.selected=!0)}}function Wt(t,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return K({},s,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function q(t,s){var i=s.value;if(i==null){if(i=s.children,s=s.defaultValue,i!=null){if(s!=null)throw Error(r(92));if(lt(i)){if(1<i.length)throw Error(r(93));i=i[0]}s=i}s==null&&(s=""),i=s}t._wrapperState={initialValue:we(i)}}function Se(t,s){var i=we(s.value),u=we(s.defaultValue);i!=null&&(i=""+i,i!==t.value&&(t.value=i),s.defaultValue==null&&t.defaultValue!==i&&(t.defaultValue=i)),u!=null&&(t.defaultValue=""+u)}function Pe(t){var s=t.textContent;s===t._wrapperState.initialValue&&s!==""&&s!==null&&(t.value=s)}function Ye(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function xt(t,s){return t==null||t==="http://www.w3.org/1999/xhtml"?Ye(s):t==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var wt,Dt=(function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,i,u,p){MSApp.execUnsafeLocalFunction(function(){return t(s,i,u,p)})}:t})(function(t,s){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=s;else{for(wt=wt||document.createElement("div"),wt.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=wt.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;s.firstChild;)t.appendChild(s.firstChild)}});function un(t,s){if(s){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=s;return}}t.textContent=s}var Ct={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Mn=["Webkit","ms","Moz","O"];Object.keys(Ct).forEach(function(t){Mn.forEach(function(s){s=s+t.charAt(0).toUpperCase()+t.substring(1),Ct[s]=Ct[t]})});function Ln(t,s,i){return s==null||typeof s=="boolean"||s===""?"":i||typeof s!="number"||s===0||Ct.hasOwnProperty(t)&&Ct[t]?(""+s).trim():s+"px"}function ts(t,s){t=t.style;for(var i in s)if(s.hasOwnProperty(i)){var u=i.indexOf("--")===0,p=Ln(i,s[i],u);i==="float"&&(i="cssFloat"),u?t.setProperty(i,p):t[i]=p}}var ns=K({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 ss(t,s){if(s){if(ns[t]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(r(137,t));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(r(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(r(61))}if(s.style!=null&&typeof s.style!="object")throw Error(r(62))}}function rs(t,s){if(t.indexOf("-")===-1)return typeof s.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var vn=null;function dn(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Ft=null,Cn=null,ct=null;function mt(t){if(t=ni(t)){if(typeof Ft!="function")throw Error(r(280));var s=t.stateNode;s&&(s=ma(s),Ft(t.stateNode,t.type,s))}}function Et(t){Cn?ct?ct.push(t):ct=[t]:Cn=t}function Ht(){if(Cn){var t=Cn,s=ct;if(ct=Cn=null,mt(t),s)for(t=0;t<s.length;t++)mt(s[t])}}function kt(t,s){return t(s)}function gt(){}var ft=!1;function Vt(t,s,i){if(ft)return t(s,i);ft=!0;try{return kt(t,s,i)}finally{ft=!1,(Cn!==null||ct!==null)&&(gt(),Ht())}}function ut(t,s){var i=t.stateNode;if(i===null)return null;var u=ma(i);if(u===null)return null;i=u[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(i&&typeof i!="function")throw Error(r(231,s,typeof i));return i}var Qt=!1;if(f)try{var Mt={};Object.defineProperty(Mt,"passive",{get:function(){Qt=!0}}),window.addEventListener("test",Mt,Mt),window.removeEventListener("test",Mt,Mt)}catch{Qt=!1}function I(t,s,i,u,p,g,w,_,D){var V=Array.prototype.slice.call(arguments,3);try{s.apply(i,V)}catch(se){this.onError(se)}}var fe=!1,ae=null,be=!1,Fe=null,Qe={onError:function(t){fe=!0,ae=t}};function Be(t,s,i,u,p,g,w,_,D){fe=!1,ae=null,I.apply(Qe,arguments)}function Kt(t,s,i,u,p,g,w,_,D){if(Be.apply(this,arguments),fe){if(fe){var V=ae;fe=!1,ae=null}else throw Error(r(198));be||(be=!0,Fe=V)}}function We(t){var s=t,i=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(i=s.return),t=s.return;while(t)}return s.tag===3?i:null}function Gt(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function vs(t){if(We(t)!==t)throw Error(r(188))}function As(t){var s=t.alternate;if(!s){if(s=We(t),s===null)throw Error(r(188));return s!==t?null:t}for(var i=t,u=s;;){var p=i.return;if(p===null)break;var g=p.alternate;if(g===null){if(u=p.return,u!==null){i=u;continue}break}if(p.child===g.child){for(g=p.child;g;){if(g===i)return vs(p),t;if(g===u)return vs(p),s;g=g.sibling}throw Error(r(188))}if(i.return!==u.return)i=p,u=g;else{for(var w=!1,_=p.child;_;){if(_===i){w=!0,i=p,u=g;break}if(_===u){w=!0,u=p,i=g;break}_=_.sibling}if(!w){for(_=g.child;_;){if(_===i){w=!0,i=g,u=p;break}if(_===u){w=!0,u=g,i=p;break}_=_.sibling}if(!w)throw Error(r(189))}}if(i.alternate!==u)throw Error(r(190))}if(i.tag!==3)throw Error(r(188));return i.stateNode.current===i?t:s}function ys(t){return t=As(t),t!==null?Hn(t):null}function Hn(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var s=Hn(t);if(s!==null)return s;t=t.sibling}return null}var xs=n.unstable_scheduleCallback,st=n.unstable_cancelCallback,Ot=n.unstable_shouldYield,ws=n.unstable_requestPaint,jt=n.unstable_now,ks=n.unstable_getCurrentPriorityLevel,Vs=n.unstable_ImmediatePriority,Ss=n.unstable_UserBlockingPriority,Hr=n.unstable_NormalPriority,wr=n.unstable_LowPriority,Qi=n.unstable_IdlePriority,kr=null,On=null;function Vr(t){if(On&&typeof On.onCommitFiberRoot=="function")try{On.onCommitFiberRoot(kr,t,void 0,(t.current.flags&128)===128)}catch{}}var yn=Math.clz32?Math.clz32:Sr,Kr=Math.log,Ks=Math.LN2;function Sr(t){return t>>>=0,t===0?32:31-(Kr(t)/Ks|0)|0}var xn=64,Gr=4194304;function br(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Nr(t,s){var i=t.pendingLanes;if(i===0)return 0;var u=0,p=t.suspendedLanes,g=t.pingedLanes,w=i&268435455;if(w!==0){var _=w&~p;_!==0?u=br(_):(g&=w,g!==0&&(u=br(g)))}else w=i&~p,w!==0?u=br(w):g!==0&&(u=br(g));if(u===0)return 0;if(s!==0&&s!==u&&(s&p)===0&&(p=u&-u,g=s&-s,p>=g||p===16&&(g&4194240)!==0))return s;if((u&4)!==0&&(u|=i&16),s=t.entangledLanes,s!==0)for(t=t.entanglements,s&=u;0<s;)i=31-yn(s),p=1<<i,u|=t[i],s&=~p;return u}function Zi(t,s){switch(t){case 1:case 2:case 4:return s+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ji(t,s){for(var i=t.suspendedLanes,u=t.pingedLanes,p=t.expirationTimes,g=t.pendingLanes;0<g;){var w=31-yn(g),_=1<<w,D=p[w];D===-1?((_&i)===0||(_&u)!==0)&&(p[w]=Zi(_,s)):D<=s&&(t.expiredLanes|=_),g&=~_}}function zo(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Fo(){var t=xn;return xn<<=1,(xn&4194240)===0&&(xn=64),t}function Uo(t){for(var s=[],i=0;31>i;i++)s.push(t);return s}function Tr(t,s,i){t.pendingLanes|=s,s!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,s=31-yn(s),t[s]=i}function ea(t,s){var i=t.pendingLanes&~s;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=s,t.mutableReadLanes&=s,t.entangledLanes&=s,s=t.entanglements;var u=t.eventTimes;for(t=t.expirationTimes;0<i;){var p=31-yn(i),g=1<<p;s[p]=0,u[p]=-1,t[p]=-1,i&=~g}}function Gs(t,s){var i=t.entangledLanes|=s;for(t=t.entanglements;i;){var u=31-yn(i),p=1<<u;p&s|t[u]&s&&(t[u]|=s),i&=~p}}var Ze=0;function ce(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var N,B,te,je,De,ze=!1,Je=[],tt=null,_t=null,Rt=null,Is=new Map,$t=new Map,qs=[],dx="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function _f(t,s){switch(t){case"focusin":case"focusout":tt=null;break;case"dragenter":case"dragleave":_t=null;break;case"mouseover":case"mouseout":Rt=null;break;case"pointerover":case"pointerout":Is.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":$t.delete(s.pointerId)}}function Bo(t,s,i,u,p,g){return t===null||t.nativeEvent!==g?(t={blockedOn:s,domEventName:i,eventSystemFlags:u,nativeEvent:g,targetContainers:[p]},s!==null&&(s=ni(s),s!==null&&B(s)),t):(t.eventSystemFlags|=u,s=t.targetContainers,p!==null&&s.indexOf(p)===-1&&s.push(p),t)}function fx(t,s,i,u,p){switch(s){case"focusin":return tt=Bo(tt,t,s,i,u,p),!0;case"dragenter":return _t=Bo(_t,t,s,i,u,p),!0;case"mouseover":return Rt=Bo(Rt,t,s,i,u,p),!0;case"pointerover":var g=p.pointerId;return Is.set(g,Bo(Is.get(g)||null,t,s,i,u,p)),!0;case"gotpointercapture":return g=p.pointerId,$t.set(g,Bo($t.get(g)||null,t,s,i,u,p)),!0}return!1}function Rf(t){var s=Cr(t.target);if(s!==null){var i=We(s);if(i!==null){if(s=i.tag,s===13){if(s=Gt(i),s!==null){t.blockedOn=s,De(t.priority,function(){te(i)});return}}else if(s===3&&i.stateNode.current.memoizedState.isDehydrated){t.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}t.blockedOn=null}function ta(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var i=pc(t.domEventName,t.eventSystemFlags,s[0],t.nativeEvent);if(i===null){i=t.nativeEvent;var u=new i.constructor(i.type,i);vn=u,i.target.dispatchEvent(u),vn=null}else return s=ni(i),s!==null&&B(s),t.blockedOn=i,!1;s.shift()}return!0}function Af(t,s,i){ta(t)&&i.delete(s)}function px(){ze=!1,tt!==null&&ta(tt)&&(tt=null),_t!==null&&ta(_t)&&(_t=null),Rt!==null&&ta(Rt)&&(Rt=null),Is.forEach(Af),$t.forEach(Af)}function Wo(t,s){t.blockedOn===s&&(t.blockedOn=null,ze||(ze=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,px)))}function Ho(t){function s(p){return Wo(p,t)}if(0<Je.length){Wo(Je[0],t);for(var i=1;i<Je.length;i++){var u=Je[i];u.blockedOn===t&&(u.blockedOn=null)}}for(tt!==null&&Wo(tt,t),_t!==null&&Wo(_t,t),Rt!==null&&Wo(Rt,t),Is.forEach(s),$t.forEach(s),i=0;i<qs.length;i++)u=qs[i],u.blockedOn===t&&(u.blockedOn=null);for(;0<qs.length&&(i=qs[0],i.blockedOn===null);)Rf(i),i.blockedOn===null&&qs.shift()}var qr=P.ReactCurrentBatchConfig,na=!0;function hx(t,s,i,u){var p=Ze,g=qr.transition;qr.transition=null;try{Ze=1,fc(t,s,i,u)}finally{Ze=p,qr.transition=g}}function mx(t,s,i,u){var p=Ze,g=qr.transition;qr.transition=null;try{Ze=4,fc(t,s,i,u)}finally{Ze=p,qr.transition=g}}function fc(t,s,i,u){if(na){var p=pc(t,s,i,u);if(p===null)Rc(t,s,u,sa,i),_f(t,u);else if(fx(p,t,s,i,u))u.stopPropagation();else if(_f(t,u),s&4&&-1<dx.indexOf(t)){for(;p!==null;){var g=ni(p);if(g!==null&&N(g),g=pc(t,s,i,u),g===null&&Rc(t,s,u,sa,i),g===p)break;p=g}p!==null&&u.stopPropagation()}else Rc(t,s,u,null,i)}}var sa=null;function pc(t,s,i,u){if(sa=null,t=dn(u),t=Cr(t),t!==null)if(s=We(t),s===null)t=null;else if(i=s.tag,i===13){if(t=Gt(s),t!==null)return t;t=null}else if(i===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null);return sa=t,null}function If(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(ks()){case Vs:return 1;case Ss:return 4;case Hr:case wr:return 16;case Qi:return 536870912;default:return 16}default:return 16}}var Xs=null,hc=null,ra=null;function Df(){if(ra)return ra;var t,s=hc,i=s.length,u,p="value"in Xs?Xs.value:Xs.textContent,g=p.length;for(t=0;t<i&&s[t]===p[t];t++);var w=i-t;for(u=1;u<=w&&s[i-u]===p[g-u];u++);return ra=p.slice(t,1<u?1-u:void 0)}function oa(t){var s=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function ia(){return!0}function Mf(){return!1}function $n(t){function s(i,u,p,g,w){this._reactName=i,this._targetInst=p,this.type=u,this.nativeEvent=g,this.target=w,this.currentTarget=null;for(var _ in t)t.hasOwnProperty(_)&&(i=t[_],this[_]=i?i(g):g[_]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?ia:Mf,this.isPropagationStopped=Mf,this}return K(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=ia)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=ia)},persist:function(){},isPersistent:ia}),s}var Xr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},mc=$n(Xr),Vo=K({},Xr,{view:0,detail:0}),gx=$n(Vo),gc,vc,Ko,aa=K({},Vo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Ko&&(Ko&&t.type==="mousemove"?(gc=t.screenX-Ko.screenX,vc=t.screenY-Ko.screenY):vc=gc=0,Ko=t),gc)},movementY:function(t){return"movementY"in t?t.movementY:vc}}),Lf=$n(aa),vx=K({},aa,{dataTransfer:0}),yx=$n(vx),xx=K({},Vo,{relatedTarget:0}),yc=$n(xx),wx=K({},Xr,{animationName:0,elapsedTime:0,pseudoElement:0}),kx=$n(wx),Sx=K({},Xr,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),bx=$n(Sx),Nx=K({},Xr,{data:0}),Of=$n(Nx),Tx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Cx={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"},Ex={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function jx(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=Ex[t])?!!s[t]:!1}function xc(){return jx}var _x=K({},Vo,{key:function(t){if(t.key){var s=Tx[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=oa(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Cx[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xc,charCode:function(t){return t.type==="keypress"?oa(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?oa(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Rx=$n(_x),Ax=K({},aa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$f=$n(Ax),Ix=K({},Vo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xc}),Dx=$n(Ix),Mx=K({},Xr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Lx=$n(Mx),Ox=K({},aa,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),$x=$n(Ox),Px=[9,13,27,32],wc=f&&"CompositionEvent"in window,Go=null;f&&"documentMode"in document&&(Go=document.documentMode);var zx=f&&"TextEvent"in window&&!Go,Pf=f&&(!wc||Go&&8<Go&&11>=Go),zf=" ",Ff=!1;function Uf(t,s){switch(t){case"keyup":return Px.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Yr=!1;function Fx(t,s){switch(t){case"compositionend":return Bf(s);case"keypress":return s.which!==32?null:(Ff=!0,zf);case"textInput":return t=s.data,t===zf&&Ff?null:t;default:return null}}function Ux(t,s){if(Yr)return t==="compositionend"||!wc&&Uf(t,s)?(t=Df(),ra=hc=Xs=null,Yr=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Pf&&s.locale!=="ko"?null:s.data;default:return null}}var Bx={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Wf(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!Bx[t.type]:s==="textarea"}function Hf(t,s,i,u){Et(u),s=fa(s,"onChange"),0<s.length&&(i=new mc("onChange","change",null,i,u),t.push({event:i,listeners:s}))}var qo=null,Xo=null;function Wx(t){lp(t,0)}function la(t){var s=to(t);if(pe(s))return t}function Hx(t,s){if(t==="change")return s}var Vf=!1;if(f){var kc;if(f){var Sc="oninput"in document;if(!Sc){var Kf=document.createElement("div");Kf.setAttribute("oninput","return;"),Sc=typeof Kf.oninput=="function"}kc=Sc}else kc=!1;Vf=kc&&(!document.documentMode||9<document.documentMode)}function Gf(){qo&&(qo.detachEvent("onpropertychange",qf),Xo=qo=null)}function qf(t){if(t.propertyName==="value"&&la(Xo)){var s=[];Hf(s,Xo,t,dn(t)),Vt(Wx,s)}}function Vx(t,s,i){t==="focusin"?(Gf(),qo=s,Xo=i,qo.attachEvent("onpropertychange",qf)):t==="focusout"&&Gf()}function Kx(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return la(Xo)}function Gx(t,s){if(t==="click")return la(s)}function qx(t,s){if(t==="input"||t==="change")return la(s)}function Xx(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var os=typeof Object.is=="function"?Object.is:Xx;function Yo(t,s){if(os(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var i=Object.keys(t),u=Object.keys(s);if(i.length!==u.length)return!1;for(u=0;u<i.length;u++){var p=i[u];if(!h.call(s,p)||!os(t[p],s[p]))return!1}return!0}function Xf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Yf(t,s){var i=Xf(t);t=0;for(var u;i;){if(i.nodeType===3){if(u=t+i.textContent.length,t<=s&&u>=s)return{node:i,offset:s-t};t=u}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Xf(i)}}function Qf(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?Qf(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function Zf(){for(var t=window,s=Xe();s instanceof t.HTMLIFrameElement;){try{var i=typeof s.contentWindow.location.href=="string"}catch{i=!1}if(i)t=s.contentWindow;else break;s=Xe(t.document)}return s}function bc(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}function Yx(t){var s=Zf(),i=t.focusedElem,u=t.selectionRange;if(s!==i&&i&&i.ownerDocument&&Qf(i.ownerDocument.documentElement,i)){if(u!==null&&bc(i)){if(s=u.start,t=u.end,t===void 0&&(t=s),"selectionStart"in i)i.selectionStart=s,i.selectionEnd=Math.min(t,i.value.length);else if(t=(s=i.ownerDocument||document)&&s.defaultView||window,t.getSelection){t=t.getSelection();var p=i.textContent.length,g=Math.min(u.start,p);u=u.end===void 0?g:Math.min(u.end,p),!t.extend&&g>u&&(p=u,u=g,g=p),p=Yf(i,g);var w=Yf(i,u);p&&w&&(t.rangeCount!==1||t.anchorNode!==p.node||t.anchorOffset!==p.offset||t.focusNode!==w.node||t.focusOffset!==w.offset)&&(s=s.createRange(),s.setStart(p.node,p.offset),t.removeAllRanges(),g>u?(t.addRange(s),t.extend(w.node,w.offset)):(s.setEnd(w.node,w.offset),t.addRange(s)))}}for(s=[],t=i;t=t.parentNode;)t.nodeType===1&&s.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<s.length;i++)t=s[i],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var Qx=f&&"documentMode"in document&&11>=document.documentMode,Qr=null,Nc=null,Qo=null,Tc=!1;function Jf(t,s,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Tc||Qr==null||Qr!==Xe(u)||(u=Qr,"selectionStart"in u&&bc(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}),Qo&&Yo(Qo,u)||(Qo=u,u=fa(Nc,"onSelect"),0<u.length&&(s=new mc("onSelect","select",null,s,i),t.push({event:s,listeners:u}),s.target=Qr)))}function ca(t,s){var i={};return i[t.toLowerCase()]=s.toLowerCase(),i["Webkit"+t]="webkit"+s,i["Moz"+t]="moz"+s,i}var Zr={animationend:ca("Animation","AnimationEnd"),animationiteration:ca("Animation","AnimationIteration"),animationstart:ca("Animation","AnimationStart"),transitionend:ca("Transition","TransitionEnd")},Cc={},ep={};f&&(ep=document.createElement("div").style,"AnimationEvent"in window||(delete Zr.animationend.animation,delete Zr.animationiteration.animation,delete Zr.animationstart.animation),"TransitionEvent"in window||delete Zr.transitionend.transition);function ua(t){if(Cc[t])return Cc[t];if(!Zr[t])return t;var s=Zr[t],i;for(i in s)if(s.hasOwnProperty(i)&&i in ep)return Cc[t]=s[i];return t}var tp=ua("animationend"),np=ua("animationiteration"),sp=ua("animationstart"),rp=ua("transitionend"),op=new Map,ip="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Ys(t,s){op.set(t,s),c(s,[t])}for(var Ec=0;Ec<ip.length;Ec++){var jc=ip[Ec],Zx=jc.toLowerCase(),Jx=jc[0].toUpperCase()+jc.slice(1);Ys(Zx,"on"+Jx)}Ys(tp,"onAnimationEnd"),Ys(np,"onAnimationIteration"),Ys(sp,"onAnimationStart"),Ys("dblclick","onDoubleClick"),Ys("focusin","onFocus"),Ys("focusout","onBlur"),Ys(rp,"onTransitionEnd"),d("onMouseEnter",["mouseout","mouseover"]),d("onMouseLeave",["mouseout","mouseover"]),d("onPointerEnter",["pointerout","pointerover"]),d("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Zo="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(" "),ew=new Set("cancel close invalid load scroll toggle".split(" ").concat(Zo));function ap(t,s,i){var u=t.type||"unknown-event";t.currentTarget=i,Kt(u,s,void 0,t),t.currentTarget=null}function lp(t,s){s=(s&4)!==0;for(var i=0;i<t.length;i++){var u=t[i],p=u.event;u=u.listeners;e:{var g=void 0;if(s)for(var w=u.length-1;0<=w;w--){var _=u[w],D=_.instance,V=_.currentTarget;if(_=_.listener,D!==g&&p.isPropagationStopped())break e;ap(p,_,V),g=D}else for(w=0;w<u.length;w++){if(_=u[w],D=_.instance,V=_.currentTarget,_=_.listener,D!==g&&p.isPropagationStopped())break e;ap(p,_,V),g=D}}}if(be)throw t=Fe,be=!1,Fe=null,t}function vt(t,s){var i=s[Oc];i===void 0&&(i=s[Oc]=new Set);var u=t+"__bubble";i.has(u)||(cp(s,t,2,!1),i.add(u))}function _c(t,s,i){var u=0;s&&(u|=4),cp(i,t,u,s)}var da="_reactListening"+Math.random().toString(36).slice(2);function Jo(t){if(!t[da]){t[da]=!0,o.forEach(function(i){i!=="selectionchange"&&(ew.has(i)||_c(i,!1,t),_c(i,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[da]||(s[da]=!0,_c("selectionchange",!1,s))}}function cp(t,s,i,u){switch(If(s)){case 1:var p=hx;break;case 4:p=mx;break;default:p=fc}i=p.bind(null,s,i,t),p=void 0,!Qt||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(p=!0),u?p!==void 0?t.addEventListener(s,i,{capture:!0,passive:p}):t.addEventListener(s,i,!0):p!==void 0?t.addEventListener(s,i,{passive:p}):t.addEventListener(s,i,!1)}function Rc(t,s,i,u,p){var g=u;if((s&1)===0&&(s&2)===0&&u!==null)e:for(;;){if(u===null)return;var w=u.tag;if(w===3||w===4){var _=u.stateNode.containerInfo;if(_===p||_.nodeType===8&&_.parentNode===p)break;if(w===4)for(w=u.return;w!==null;){var D=w.tag;if((D===3||D===4)&&(D=w.stateNode.containerInfo,D===p||D.nodeType===8&&D.parentNode===p))return;w=w.return}for(;_!==null;){if(w=Cr(_),w===null)return;if(D=w.tag,D===5||D===6){u=g=w;continue e}_=_.parentNode}}u=u.return}Vt(function(){var V=g,se=dn(i),oe=[];e:{var ne=op.get(t);if(ne!==void 0){var Ne=mc,Ee=t;switch(t){case"keypress":if(oa(i)===0)break e;case"keydown":case"keyup":Ne=Rx;break;case"focusin":Ee="focus",Ne=yc;break;case"focusout":Ee="blur",Ne=yc;break;case"beforeblur":case"afterblur":Ne=yc;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":Ne=Lf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ne=yx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ne=Dx;break;case tp:case np:case sp:Ne=kx;break;case rp:Ne=Lx;break;case"scroll":Ne=gx;break;case"wheel":Ne=$x;break;case"copy":case"cut":case"paste":Ne=bx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ne=$f}var Ae=(s&4)!==0,Pt=!Ae&&t==="scroll",W=Ae?ne!==null?ne+"Capture":null:ne;Ae=[];for(var O=V,H;O!==null;){H=O;var ue=H.stateNode;if(H.tag===5&&ue!==null&&(H=ue,W!==null&&(ue=ut(O,W),ue!=null&&Ae.push(ei(O,ue,H)))),Pt)break;O=O.return}0<Ae.length&&(ne=new Ne(ne,Ee,null,i,se),oe.push({event:ne,listeners:Ae}))}}if((s&7)===0){e:{if(ne=t==="mouseover"||t==="pointerover",Ne=t==="mouseout"||t==="pointerout",ne&&i!==vn&&(Ee=i.relatedTarget||i.fromElement)&&(Cr(Ee)||Ee[Ds]))break e;if((Ne||ne)&&(ne=se.window===se?se:(ne=se.ownerDocument)?ne.defaultView||ne.parentWindow:window,Ne?(Ee=i.relatedTarget||i.toElement,Ne=V,Ee=Ee?Cr(Ee):null,Ee!==null&&(Pt=We(Ee),Ee!==Pt||Ee.tag!==5&&Ee.tag!==6)&&(Ee=null)):(Ne=null,Ee=V),Ne!==Ee)){if(Ae=Lf,ue="onMouseLeave",W="onMouseEnter",O="mouse",(t==="pointerout"||t==="pointerover")&&(Ae=$f,ue="onPointerLeave",W="onPointerEnter",O="pointer"),Pt=Ne==null?ne:to(Ne),H=Ee==null?ne:to(Ee),ne=new Ae(ue,O+"leave",Ne,i,se),ne.target=Pt,ne.relatedTarget=H,ue=null,Cr(se)===V&&(Ae=new Ae(W,O+"enter",Ee,i,se),Ae.target=H,Ae.relatedTarget=Pt,ue=Ae),Pt=ue,Ne&&Ee)t:{for(Ae=Ne,W=Ee,O=0,H=Ae;H;H=Jr(H))O++;for(H=0,ue=W;ue;ue=Jr(ue))H++;for(;0<O-H;)Ae=Jr(Ae),O--;for(;0<H-O;)W=Jr(W),H--;for(;O--;){if(Ae===W||W!==null&&Ae===W.alternate)break t;Ae=Jr(Ae),W=Jr(W)}Ae=null}else Ae=null;Ne!==null&&up(oe,ne,Ne,Ae,!1),Ee!==null&&Pt!==null&&up(oe,Pt,Ee,Ae,!0)}}e:{if(ne=V?to(V):window,Ne=ne.nodeName&&ne.nodeName.toLowerCase(),Ne==="select"||Ne==="input"&&ne.type==="file")var Ie=Hx;else if(Wf(ne))if(Vf)Ie=qx;else{Ie=Kx;var Le=Vx}else(Ne=ne.nodeName)&&Ne.toLowerCase()==="input"&&(ne.type==="checkbox"||ne.type==="radio")&&(Ie=Gx);if(Ie&&(Ie=Ie(t,V))){Hf(oe,Ie,i,se);break e}Le&&Le(t,ne,V),t==="focusout"&&(Le=ne._wrapperState)&&Le.controlled&&ne.type==="number"&&Ke(ne,"number",ne.value)}switch(Le=V?to(V):window,t){case"focusin":(Wf(Le)||Le.contentEditable==="true")&&(Qr=Le,Nc=V,Qo=null);break;case"focusout":Qo=Nc=Qr=null;break;case"mousedown":Tc=!0;break;case"contextmenu":case"mouseup":case"dragend":Tc=!1,Jf(oe,i,se);break;case"selectionchange":if(Qx)break;case"keydown":case"keyup":Jf(oe,i,se)}var Oe;if(wc)e:{switch(t){case"compositionstart":var $e="onCompositionStart";break e;case"compositionend":$e="onCompositionEnd";break e;case"compositionupdate":$e="onCompositionUpdate";break e}$e=void 0}else Yr?Uf(t,i)&&($e="onCompositionEnd"):t==="keydown"&&i.keyCode===229&&($e="onCompositionStart");$e&&(Pf&&i.locale!=="ko"&&(Yr||$e!=="onCompositionStart"?$e==="onCompositionEnd"&&Yr&&(Oe=Df()):(Xs=se,hc="value"in Xs?Xs.value:Xs.textContent,Yr=!0)),Le=fa(V,$e),0<Le.length&&($e=new Of($e,t,null,i,se),oe.push({event:$e,listeners:Le}),Oe?$e.data=Oe:(Oe=Bf(i),Oe!==null&&($e.data=Oe)))),(Oe=zx?Fx(t,i):Ux(t,i))&&(V=fa(V,"onBeforeInput"),0<V.length&&(se=new Of("onBeforeInput","beforeinput",null,i,se),oe.push({event:se,listeners:V}),se.data=Oe))}lp(oe,s)})}function ei(t,s,i){return{instance:t,listener:s,currentTarget:i}}function fa(t,s){for(var i=s+"Capture",u=[];t!==null;){var p=t,g=p.stateNode;p.tag===5&&g!==null&&(p=g,g=ut(t,i),g!=null&&u.unshift(ei(t,g,p)),g=ut(t,s),g!=null&&u.push(ei(t,g,p))),t=t.return}return u}function Jr(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function up(t,s,i,u,p){for(var g=s._reactName,w=[];i!==null&&i!==u;){var _=i,D=_.alternate,V=_.stateNode;if(D!==null&&D===u)break;_.tag===5&&V!==null&&(_=V,p?(D=ut(i,g),D!=null&&w.unshift(ei(i,D,_))):p||(D=ut(i,g),D!=null&&w.push(ei(i,D,_)))),i=i.return}w.length!==0&&t.push({event:s,listeners:w})}var tw=/\r\n?/g,nw=/\u0000|\uFFFD/g;function dp(t){return(typeof t=="string"?t:""+t).replace(tw,`
39
+ `).replace(nw,"")}function pa(t,s,i){if(s=dp(s),dp(t)!==s&&i)throw Error(r(425))}function ha(){}var Ac=null,Ic=null;function Dc(t,s){return t==="textarea"||t==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Mc=typeof setTimeout=="function"?setTimeout:void 0,sw=typeof clearTimeout=="function"?clearTimeout:void 0,fp=typeof Promise=="function"?Promise:void 0,rw=typeof queueMicrotask=="function"?queueMicrotask:typeof fp<"u"?function(t){return fp.resolve(null).then(t).catch(ow)}:Mc;function ow(t){setTimeout(function(){throw t})}function Lc(t,s){var i=s,u=0;do{var p=i.nextSibling;if(t.removeChild(i),p&&p.nodeType===8)if(i=p.data,i==="/$"){if(u===0){t.removeChild(p),Ho(s);return}u--}else i!=="$"&&i!=="$?"&&i!=="$!"||u++;i=p}while(i);Ho(s)}function Qs(t){for(;t!=null;t=t.nextSibling){var s=t.nodeType;if(s===1||s===3)break;if(s===8){if(s=t.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return t}function pp(t){t=t.previousSibling;for(var s=0;t;){if(t.nodeType===8){var i=t.data;if(i==="$"||i==="$!"||i==="$?"){if(s===0)return t;s--}else i==="/$"&&s++}t=t.previousSibling}return null}var eo=Math.random().toString(36).slice(2),bs="__reactFiber$"+eo,ti="__reactProps$"+eo,Ds="__reactContainer$"+eo,Oc="__reactEvents$"+eo,iw="__reactListeners$"+eo,aw="__reactHandles$"+eo;function Cr(t){var s=t[bs];if(s)return s;for(var i=t.parentNode;i;){if(s=i[Ds]||i[bs]){if(i=s.alternate,s.child!==null||i!==null&&i.child!==null)for(t=pp(t);t!==null;){if(i=t[bs])return i;t=pp(t)}return s}t=i,i=t.parentNode}return null}function ni(t){return t=t[bs]||t[Ds],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function to(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(r(33))}function ma(t){return t[ti]||null}var $c=[],no=-1;function Zs(t){return{current:t}}function yt(t){0>no||(t.current=$c[no],$c[no]=null,no--)}function ht(t,s){no++,$c[no]=t.current,t.current=s}var Js={},fn=Zs(Js),En=Zs(!1),Er=Js;function so(t,s){var i=t.type.contextTypes;if(!i)return Js;var u=t.stateNode;if(u&&u.__reactInternalMemoizedUnmaskedChildContext===s)return u.__reactInternalMemoizedMaskedChildContext;var p={},g;for(g in i)p[g]=s[g];return u&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=p),p}function jn(t){return t=t.childContextTypes,t!=null}function ga(){yt(En),yt(fn)}function hp(t,s,i){if(fn.current!==Js)throw Error(r(168));ht(fn,s),ht(En,i)}function mp(t,s,i){var u=t.stateNode;if(s=s.childContextTypes,typeof u.getChildContext!="function")return i;u=u.getChildContext();for(var p in u)if(!(p in s))throw Error(r(108,xe(t)||"Unknown",p));return K({},i,u)}function va(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Js,Er=fn.current,ht(fn,t),ht(En,En.current),!0}function gp(t,s,i){var u=t.stateNode;if(!u)throw Error(r(169));i?(t=mp(t,s,Er),u.__reactInternalMemoizedMergedChildContext=t,yt(En),yt(fn),ht(fn,t)):yt(En),ht(En,i)}var Ms=null,ya=!1,Pc=!1;function vp(t){Ms===null?Ms=[t]:Ms.push(t)}function lw(t){ya=!0,vp(t)}function er(){if(!Pc&&Ms!==null){Pc=!0;var t=0,s=Ze;try{var i=Ms;for(Ze=1;t<i.length;t++){var u=i[t];do u=u(!0);while(u!==null)}Ms=null,ya=!1}catch(p){throw Ms!==null&&(Ms=Ms.slice(t+1)),xs(Vs,er),p}finally{Ze=s,Pc=!1}}return null}var ro=[],oo=0,xa=null,wa=0,Vn=[],Kn=0,jr=null,Ls=1,Os="";function _r(t,s){ro[oo++]=wa,ro[oo++]=xa,xa=t,wa=s}function yp(t,s,i){Vn[Kn++]=Ls,Vn[Kn++]=Os,Vn[Kn++]=jr,jr=t;var u=Ls;t=Os;var p=32-yn(u)-1;u&=~(1<<p),i+=1;var g=32-yn(s)+p;if(30<g){var w=p-p%5;g=(u&(1<<w)-1).toString(32),u>>=w,p-=w,Ls=1<<32-yn(s)+p|i<<p|u,Os=g+t}else Ls=1<<g|i<<p|u,Os=t}function zc(t){t.return!==null&&(_r(t,1),yp(t,1,0))}function Fc(t){for(;t===xa;)xa=ro[--oo],ro[oo]=null,wa=ro[--oo],ro[oo]=null;for(;t===jr;)jr=Vn[--Kn],Vn[Kn]=null,Os=Vn[--Kn],Vn[Kn]=null,Ls=Vn[--Kn],Vn[Kn]=null}var Pn=null,zn=null,St=!1,is=null;function xp(t,s){var i=Yn(5,null,null,0);i.elementType="DELETED",i.stateNode=s,i.return=t,s=t.deletions,s===null?(t.deletions=[i],t.flags|=16):s.push(i)}function wp(t,s){switch(t.tag){case 5:var i=t.type;return s=s.nodeType!==1||i.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(t.stateNode=s,Pn=t,zn=Qs(s.firstChild),!0):!1;case 6:return s=t.pendingProps===""||s.nodeType!==3?null:s,s!==null?(t.stateNode=s,Pn=t,zn=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(i=jr!==null?{id:Ls,overflow:Os}:null,t.memoizedState={dehydrated:s,treeContext:i,retryLane:1073741824},i=Yn(18,null,null,0),i.stateNode=s,i.return=t,t.child=i,Pn=t,zn=null,!0):!1;default:return!1}}function Uc(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Bc(t){if(St){var s=zn;if(s){var i=s;if(!wp(t,s)){if(Uc(t))throw Error(r(418));s=Qs(i.nextSibling);var u=Pn;s&&wp(t,s)?xp(u,i):(t.flags=t.flags&-4097|2,St=!1,Pn=t)}}else{if(Uc(t))throw Error(r(418));t.flags=t.flags&-4097|2,St=!1,Pn=t}}}function kp(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Pn=t}function ka(t){if(t!==Pn)return!1;if(!St)return kp(t),St=!0,!1;var s;if((s=t.tag!==3)&&!(s=t.tag!==5)&&(s=t.type,s=s!=="head"&&s!=="body"&&!Dc(t.type,t.memoizedProps)),s&&(s=zn)){if(Uc(t))throw Sp(),Error(r(418));for(;s;)xp(t,s),s=Qs(s.nextSibling)}if(kp(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));e:{for(t=t.nextSibling,s=0;t;){if(t.nodeType===8){var i=t.data;if(i==="/$"){if(s===0){zn=Qs(t.nextSibling);break e}s--}else i!=="$"&&i!=="$!"&&i!=="$?"||s++}t=t.nextSibling}zn=null}}else zn=Pn?Qs(t.stateNode.nextSibling):null;return!0}function Sp(){for(var t=zn;t;)t=Qs(t.nextSibling)}function io(){zn=Pn=null,St=!1}function Wc(t){is===null?is=[t]:is.push(t)}var cw=P.ReactCurrentBatchConfig;function si(t,s,i){if(t=i.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(r(309));var u=i.stateNode}if(!u)throw Error(r(147,t));var p=u,g=""+t;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===g?s.ref:(s=function(w){var _=p.refs;w===null?delete _[g]:_[g]=w},s._stringRef=g,s)}if(typeof t!="string")throw Error(r(284));if(!i._owner)throw Error(r(290,t))}return t}function Sa(t,s){throw t=Object.prototype.toString.call(s),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t))}function bp(t){var s=t._init;return s(t._payload)}function Np(t){function s(W,O){if(t){var H=W.deletions;H===null?(W.deletions=[O],W.flags|=16):H.push(O)}}function i(W,O){if(!t)return null;for(;O!==null;)s(W,O),O=O.sibling;return null}function u(W,O){for(W=new Map;O!==null;)O.key!==null?W.set(O.key,O):W.set(O.index,O),O=O.sibling;return W}function p(W,O){return W=lr(W,O),W.index=0,W.sibling=null,W}function g(W,O,H){return W.index=H,t?(H=W.alternate,H!==null?(H=H.index,H<O?(W.flags|=2,O):H):(W.flags|=2,O)):(W.flags|=1048576,O)}function w(W){return t&&W.alternate===null&&(W.flags|=2),W}function _(W,O,H,ue){return O===null||O.tag!==6?(O=Mu(H,W.mode,ue),O.return=W,O):(O=p(O,H),O.return=W,O)}function D(W,O,H,ue){var Ie=H.type;return Ie===M?se(W,O,H.props.children,ue,H.key):O!==null&&(O.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===le&&bp(Ie)===O.type)?(ue=p(O,H.props),ue.ref=si(W,O,H),ue.return=W,ue):(ue=Ka(H.type,H.key,H.props,null,W.mode,ue),ue.ref=si(W,O,H),ue.return=W,ue)}function V(W,O,H,ue){return O===null||O.tag!==4||O.stateNode.containerInfo!==H.containerInfo||O.stateNode.implementation!==H.implementation?(O=Lu(H,W.mode,ue),O.return=W,O):(O=p(O,H.children||[]),O.return=W,O)}function se(W,O,H,ue,Ie){return O===null||O.tag!==7?(O=$r(H,W.mode,ue,Ie),O.return=W,O):(O=p(O,H),O.return=W,O)}function oe(W,O,H){if(typeof O=="string"&&O!==""||typeof O=="number")return O=Mu(""+O,W.mode,H),O.return=W,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case z:return H=Ka(O.type,O.key,O.props,null,W.mode,H),H.ref=si(W,null,O),H.return=W,H;case G:return O=Lu(O,W.mode,H),O.return=W,O;case le:var ue=O._init;return oe(W,ue(O._payload),H)}if(lt(O)||ie(O))return O=$r(O,W.mode,H,null),O.return=W,O;Sa(W,O)}return null}function ne(W,O,H,ue){var Ie=O!==null?O.key:null;if(typeof H=="string"&&H!==""||typeof H=="number")return Ie!==null?null:_(W,O,""+H,ue);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case z:return H.key===Ie?D(W,O,H,ue):null;case G:return H.key===Ie?V(W,O,H,ue):null;case le:return Ie=H._init,ne(W,O,Ie(H._payload),ue)}if(lt(H)||ie(H))return Ie!==null?null:se(W,O,H,ue,null);Sa(W,H)}return null}function Ne(W,O,H,ue,Ie){if(typeof ue=="string"&&ue!==""||typeof ue=="number")return W=W.get(H)||null,_(O,W,""+ue,Ie);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case z:return W=W.get(ue.key===null?H:ue.key)||null,D(O,W,ue,Ie);case G:return W=W.get(ue.key===null?H:ue.key)||null,V(O,W,ue,Ie);case le:var Le=ue._init;return Ne(W,O,H,Le(ue._payload),Ie)}if(lt(ue)||ie(ue))return W=W.get(H)||null,se(O,W,ue,Ie,null);Sa(O,ue)}return null}function Ee(W,O,H,ue){for(var Ie=null,Le=null,Oe=O,$e=O=0,en=null;Oe!==null&&$e<H.length;$e++){Oe.index>$e?(en=Oe,Oe=null):en=Oe.sibling;var nt=ne(W,Oe,H[$e],ue);if(nt===null){Oe===null&&(Oe=en);break}t&&Oe&&nt.alternate===null&&s(W,Oe),O=g(nt,O,$e),Le===null?Ie=nt:Le.sibling=nt,Le=nt,Oe=en}if($e===H.length)return i(W,Oe),St&&_r(W,$e),Ie;if(Oe===null){for(;$e<H.length;$e++)Oe=oe(W,H[$e],ue),Oe!==null&&(O=g(Oe,O,$e),Le===null?Ie=Oe:Le.sibling=Oe,Le=Oe);return St&&_r(W,$e),Ie}for(Oe=u(W,Oe);$e<H.length;$e++)en=Ne(Oe,W,$e,H[$e],ue),en!==null&&(t&&en.alternate!==null&&Oe.delete(en.key===null?$e:en.key),O=g(en,O,$e),Le===null?Ie=en:Le.sibling=en,Le=en);return t&&Oe.forEach(function(cr){return s(W,cr)}),St&&_r(W,$e),Ie}function Ae(W,O,H,ue){var Ie=ie(H);if(typeof Ie!="function")throw Error(r(150));if(H=Ie.call(H),H==null)throw Error(r(151));for(var Le=Ie=null,Oe=O,$e=O=0,en=null,nt=H.next();Oe!==null&&!nt.done;$e++,nt=H.next()){Oe.index>$e?(en=Oe,Oe=null):en=Oe.sibling;var cr=ne(W,Oe,nt.value,ue);if(cr===null){Oe===null&&(Oe=en);break}t&&Oe&&cr.alternate===null&&s(W,Oe),O=g(cr,O,$e),Le===null?Ie=cr:Le.sibling=cr,Le=cr,Oe=en}if(nt.done)return i(W,Oe),St&&_r(W,$e),Ie;if(Oe===null){for(;!nt.done;$e++,nt=H.next())nt=oe(W,nt.value,ue),nt!==null&&(O=g(nt,O,$e),Le===null?Ie=nt:Le.sibling=nt,Le=nt);return St&&_r(W,$e),Ie}for(Oe=u(W,Oe);!nt.done;$e++,nt=H.next())nt=Ne(Oe,W,$e,nt.value,ue),nt!==null&&(t&&nt.alternate!==null&&Oe.delete(nt.key===null?$e:nt.key),O=g(nt,O,$e),Le===null?Ie=nt:Le.sibling=nt,Le=nt);return t&&Oe.forEach(function(Bw){return s(W,Bw)}),St&&_r(W,$e),Ie}function Pt(W,O,H,ue){if(typeof H=="object"&&H!==null&&H.type===M&&H.key===null&&(H=H.props.children),typeof H=="object"&&H!==null){switch(H.$$typeof){case z:e:{for(var Ie=H.key,Le=O;Le!==null;){if(Le.key===Ie){if(Ie=H.type,Ie===M){if(Le.tag===7){i(W,Le.sibling),O=p(Le,H.props.children),O.return=W,W=O;break e}}else if(Le.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===le&&bp(Ie)===Le.type){i(W,Le.sibling),O=p(Le,H.props),O.ref=si(W,Le,H),O.return=W,W=O;break e}i(W,Le);break}else s(W,Le);Le=Le.sibling}H.type===M?(O=$r(H.props.children,W.mode,ue,H.key),O.return=W,W=O):(ue=Ka(H.type,H.key,H.props,null,W.mode,ue),ue.ref=si(W,O,H),ue.return=W,W=ue)}return w(W);case G:e:{for(Le=H.key;O!==null;){if(O.key===Le)if(O.tag===4&&O.stateNode.containerInfo===H.containerInfo&&O.stateNode.implementation===H.implementation){i(W,O.sibling),O=p(O,H.children||[]),O.return=W,W=O;break e}else{i(W,O);break}else s(W,O);O=O.sibling}O=Lu(H,W.mode,ue),O.return=W,W=O}return w(W);case le:return Le=H._init,Pt(W,O,Le(H._payload),ue)}if(lt(H))return Ee(W,O,H,ue);if(ie(H))return Ae(W,O,H,ue);Sa(W,H)}return typeof H=="string"&&H!==""||typeof H=="number"?(H=""+H,O!==null&&O.tag===6?(i(W,O.sibling),O=p(O,H),O.return=W,W=O):(i(W,O),O=Mu(H,W.mode,ue),O.return=W,W=O),w(W)):i(W,O)}return Pt}var ao=Np(!0),Tp=Np(!1),ba=Zs(null),Na=null,lo=null,Hc=null;function Vc(){Hc=lo=Na=null}function Kc(t){var s=ba.current;yt(ba),t._currentValue=s}function Gc(t,s,i){for(;t!==null;){var u=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,u!==null&&(u.childLanes|=s)):u!==null&&(u.childLanes&s)!==s&&(u.childLanes|=s),t===i)break;t=t.return}}function co(t,s){Na=t,Hc=lo=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&s)!==0&&(_n=!0),t.firstContext=null)}function Gn(t){var s=t._currentValue;if(Hc!==t)if(t={context:t,memoizedValue:s,next:null},lo===null){if(Na===null)throw Error(r(308));lo=t,Na.dependencies={lanes:0,firstContext:t}}else lo=lo.next=t;return s}var Rr=null;function qc(t){Rr===null?Rr=[t]:Rr.push(t)}function Cp(t,s,i,u){var p=s.interleaved;return p===null?(i.next=i,qc(s)):(i.next=p.next,p.next=i),s.interleaved=i,$s(t,u)}function $s(t,s){t.lanes|=s;var i=t.alternate;for(i!==null&&(i.lanes|=s),i=t,t=t.return;t!==null;)t.childLanes|=s,i=t.alternate,i!==null&&(i.childLanes|=s),i=t,t=t.return;return i.tag===3?i.stateNode:null}var tr=!1;function Xc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ep(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Ps(t,s){return{eventTime:t,lane:s,tag:0,payload:null,callback:null,next:null}}function nr(t,s,i){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(et&2)!==0){var p=u.pending;return p===null?s.next=s:(s.next=p.next,p.next=s),u.pending=s,$s(t,i)}return p=u.interleaved,p===null?(s.next=s,qc(u)):(s.next=p.next,p.next=s),u.interleaved=s,$s(t,i)}function Ta(t,s,i){if(s=s.updateQueue,s!==null&&(s=s.shared,(i&4194240)!==0)){var u=s.lanes;u&=t.pendingLanes,i|=u,s.lanes=i,Gs(t,i)}}function jp(t,s){var i=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var p=null,g=null;if(i=i.firstBaseUpdate,i!==null){do{var w={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};g===null?p=g=w:g=g.next=w,i=i.next}while(i!==null);g===null?p=g=s:g=g.next=s}else p=g=s;i={baseState:u.baseState,firstBaseUpdate:p,lastBaseUpdate:g,shared:u.shared,effects:u.effects},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=s:t.next=s,i.lastBaseUpdate=s}function Ca(t,s,i,u){var p=t.updateQueue;tr=!1;var g=p.firstBaseUpdate,w=p.lastBaseUpdate,_=p.shared.pending;if(_!==null){p.shared.pending=null;var D=_,V=D.next;D.next=null,w===null?g=V:w.next=V,w=D;var se=t.alternate;se!==null&&(se=se.updateQueue,_=se.lastBaseUpdate,_!==w&&(_===null?se.firstBaseUpdate=V:_.next=V,se.lastBaseUpdate=D))}if(g!==null){var oe=p.baseState;w=0,se=V=D=null,_=g;do{var ne=_.lane,Ne=_.eventTime;if((u&ne)===ne){se!==null&&(se=se.next={eventTime:Ne,lane:0,tag:_.tag,payload:_.payload,callback:_.callback,next:null});e:{var Ee=t,Ae=_;switch(ne=s,Ne=i,Ae.tag){case 1:if(Ee=Ae.payload,typeof Ee=="function"){oe=Ee.call(Ne,oe,ne);break e}oe=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=Ae.payload,ne=typeof Ee=="function"?Ee.call(Ne,oe,ne):Ee,ne==null)break e;oe=K({},oe,ne);break e;case 2:tr=!0}}_.callback!==null&&_.lane!==0&&(t.flags|=64,ne=p.effects,ne===null?p.effects=[_]:ne.push(_))}else Ne={eventTime:Ne,lane:ne,tag:_.tag,payload:_.payload,callback:_.callback,next:null},se===null?(V=se=Ne,D=oe):se=se.next=Ne,w|=ne;if(_=_.next,_===null){if(_=p.shared.pending,_===null)break;ne=_,_=ne.next,ne.next=null,p.lastBaseUpdate=ne,p.shared.pending=null}}while(!0);if(se===null&&(D=oe),p.baseState=D,p.firstBaseUpdate=V,p.lastBaseUpdate=se,s=p.shared.interleaved,s!==null){p=s;do w|=p.lane,p=p.next;while(p!==s)}else g===null&&(p.shared.lanes=0);Dr|=w,t.lanes=w,t.memoizedState=oe}}function _p(t,s,i){if(t=s.effects,s.effects=null,t!==null)for(s=0;s<t.length;s++){var u=t[s],p=u.callback;if(p!==null){if(u.callback=null,u=i,typeof p!="function")throw Error(r(191,p));p.call(u)}}}var ri={},Ns=Zs(ri),oi=Zs(ri),ii=Zs(ri);function Ar(t){if(t===ri)throw Error(r(174));return t}function Yc(t,s){switch(ht(ii,s),ht(oi,t),ht(Ns,ri),t=s.nodeType,t){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:xt(null,"");break;default:t=t===8?s.parentNode:s,s=t.namespaceURI||null,t=t.tagName,s=xt(s,t)}yt(Ns),ht(Ns,s)}function uo(){yt(Ns),yt(oi),yt(ii)}function Rp(t){Ar(ii.current);var s=Ar(Ns.current),i=xt(s,t.type);s!==i&&(ht(oi,t),ht(Ns,i))}function Qc(t){oi.current===t&&(yt(Ns),yt(oi))}var At=Zs(0);function Ea(t){for(var s=t;s!==null;){if(s.tag===13){var i=s.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Zc=[];function Jc(){for(var t=0;t<Zc.length;t++)Zc[t]._workInProgressVersionPrimary=null;Zc.length=0}var ja=P.ReactCurrentDispatcher,eu=P.ReactCurrentBatchConfig,Ir=0,It=null,qt=null,Zt=null,_a=!1,ai=!1,li=0,uw=0;function pn(){throw Error(r(321))}function tu(t,s){if(s===null)return!1;for(var i=0;i<s.length&&i<t.length;i++)if(!os(t[i],s[i]))return!1;return!0}function nu(t,s,i,u,p,g){if(Ir=g,It=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,ja.current=t===null||t.memoizedState===null?hw:mw,t=i(u,p),ai){g=0;do{if(ai=!1,li=0,25<=g)throw Error(r(301));g+=1,Zt=qt=null,s.updateQueue=null,ja.current=gw,t=i(u,p)}while(ai)}if(ja.current=Ia,s=qt!==null&&qt.next!==null,Ir=0,Zt=qt=It=null,_a=!1,s)throw Error(r(300));return t}function su(){var t=li!==0;return li=0,t}function Ts(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Zt===null?It.memoizedState=Zt=t:Zt=Zt.next=t,Zt}function qn(){if(qt===null){var t=It.alternate;t=t!==null?t.memoizedState:null}else t=qt.next;var s=Zt===null?It.memoizedState:Zt.next;if(s!==null)Zt=s,qt=t;else{if(t===null)throw Error(r(310));qt=t,t={memoizedState:qt.memoizedState,baseState:qt.baseState,baseQueue:qt.baseQueue,queue:qt.queue,next:null},Zt===null?It.memoizedState=Zt=t:Zt=Zt.next=t}return Zt}function ci(t,s){return typeof s=="function"?s(t):s}function ru(t){var s=qn(),i=s.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=t;var u=qt,p=u.baseQueue,g=i.pending;if(g!==null){if(p!==null){var w=p.next;p.next=g.next,g.next=w}u.baseQueue=p=g,i.pending=null}if(p!==null){g=p.next,u=u.baseState;var _=w=null,D=null,V=g;do{var se=V.lane;if((Ir&se)===se)D!==null&&(D=D.next={lane:0,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),u=V.hasEagerState?V.eagerState:t(u,V.action);else{var oe={lane:se,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null};D===null?(_=D=oe,w=u):D=D.next=oe,It.lanes|=se,Dr|=se}V=V.next}while(V!==null&&V!==g);D===null?w=u:D.next=_,os(u,s.memoizedState)||(_n=!0),s.memoizedState=u,s.baseState=w,s.baseQueue=D,i.lastRenderedState=u}if(t=i.interleaved,t!==null){p=t;do g=p.lane,It.lanes|=g,Dr|=g,p=p.next;while(p!==t)}else p===null&&(i.lanes=0);return[s.memoizedState,i.dispatch]}function ou(t){var s=qn(),i=s.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=t;var u=i.dispatch,p=i.pending,g=s.memoizedState;if(p!==null){i.pending=null;var w=p=p.next;do g=t(g,w.action),w=w.next;while(w!==p);os(g,s.memoizedState)||(_n=!0),s.memoizedState=g,s.baseQueue===null&&(s.baseState=g),i.lastRenderedState=g}return[g,u]}function Ap(){}function Ip(t,s){var i=It,u=qn(),p=s(),g=!os(u.memoizedState,p);if(g&&(u.memoizedState=p,_n=!0),u=u.queue,iu(Lp.bind(null,i,u,t),[t]),u.getSnapshot!==s||g||Zt!==null&&Zt.memoizedState.tag&1){if(i.flags|=2048,ui(9,Mp.bind(null,i,u,p,s),void 0,null),Jt===null)throw Error(r(349));(Ir&30)!==0||Dp(i,s,p)}return p}function Dp(t,s,i){t.flags|=16384,t={getSnapshot:s,value:i},s=It.updateQueue,s===null?(s={lastEffect:null,stores:null},It.updateQueue=s,s.stores=[t]):(i=s.stores,i===null?s.stores=[t]:i.push(t))}function Mp(t,s,i,u){s.value=i,s.getSnapshot=u,Op(s)&&$p(t)}function Lp(t,s,i){return i(function(){Op(s)&&$p(t)})}function Op(t){var s=t.getSnapshot;t=t.value;try{var i=s();return!os(t,i)}catch{return!0}}function $p(t){var s=$s(t,1);s!==null&&us(s,t,1,-1)}function Pp(t){var s=Ts();return typeof t=="function"&&(t=t()),s.memoizedState=s.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ci,lastRenderedState:t},s.queue=t,t=t.dispatch=pw.bind(null,It,t),[s.memoizedState,t]}function ui(t,s,i,u){return t={tag:t,create:s,destroy:i,deps:u,next:null},s=It.updateQueue,s===null?(s={lastEffect:null,stores:null},It.updateQueue=s,s.lastEffect=t.next=t):(i=s.lastEffect,i===null?s.lastEffect=t.next=t:(u=i.next,i.next=t,t.next=u,s.lastEffect=t)),t}function zp(){return qn().memoizedState}function Ra(t,s,i,u){var p=Ts();It.flags|=t,p.memoizedState=ui(1|s,i,void 0,u===void 0?null:u)}function Aa(t,s,i,u){var p=qn();u=u===void 0?null:u;var g=void 0;if(qt!==null){var w=qt.memoizedState;if(g=w.destroy,u!==null&&tu(u,w.deps)){p.memoizedState=ui(s,i,g,u);return}}It.flags|=t,p.memoizedState=ui(1|s,i,g,u)}function Fp(t,s){return Ra(8390656,8,t,s)}function iu(t,s){return Aa(2048,8,t,s)}function Up(t,s){return Aa(4,2,t,s)}function Bp(t,s){return Aa(4,4,t,s)}function Wp(t,s){if(typeof s=="function")return t=t(),s(t),function(){s(null)};if(s!=null)return t=t(),s.current=t,function(){s.current=null}}function Hp(t,s,i){return i=i!=null?i.concat([t]):null,Aa(4,4,Wp.bind(null,s,t),i)}function au(){}function Vp(t,s){var i=qn();s=s===void 0?null:s;var u=i.memoizedState;return u!==null&&s!==null&&tu(s,u[1])?u[0]:(i.memoizedState=[t,s],t)}function Kp(t,s){var i=qn();s=s===void 0?null:s;var u=i.memoizedState;return u!==null&&s!==null&&tu(s,u[1])?u[0]:(t=t(),i.memoizedState=[t,s],t)}function Gp(t,s,i){return(Ir&21)===0?(t.baseState&&(t.baseState=!1,_n=!0),t.memoizedState=i):(os(i,s)||(i=Fo(),It.lanes|=i,Dr|=i,t.baseState=!0),s)}function dw(t,s){var i=Ze;Ze=i!==0&&4>i?i:4,t(!0);var u=eu.transition;eu.transition={};try{t(!1),s()}finally{Ze=i,eu.transition=u}}function qp(){return qn().memoizedState}function fw(t,s,i){var u=ir(t);if(i={lane:u,action:i,hasEagerState:!1,eagerState:null,next:null},Xp(t))Yp(s,i);else if(i=Cp(t,s,i,u),i!==null){var p=kn();us(i,t,u,p),Qp(i,s,u)}}function pw(t,s,i){var u=ir(t),p={lane:u,action:i,hasEagerState:!1,eagerState:null,next:null};if(Xp(t))Yp(s,p);else{var g=t.alternate;if(t.lanes===0&&(g===null||g.lanes===0)&&(g=s.lastRenderedReducer,g!==null))try{var w=s.lastRenderedState,_=g(w,i);if(p.hasEagerState=!0,p.eagerState=_,os(_,w)){var D=s.interleaved;D===null?(p.next=p,qc(s)):(p.next=D.next,D.next=p),s.interleaved=p;return}}catch{}finally{}i=Cp(t,s,p,u),i!==null&&(p=kn(),us(i,t,u,p),Qp(i,s,u))}}function Xp(t){var s=t.alternate;return t===It||s!==null&&s===It}function Yp(t,s){ai=_a=!0;var i=t.pending;i===null?s.next=s:(s.next=i.next,i.next=s),t.pending=s}function Qp(t,s,i){if((i&4194240)!==0){var u=s.lanes;u&=t.pendingLanes,i|=u,s.lanes=i,Gs(t,i)}}var Ia={readContext:Gn,useCallback:pn,useContext:pn,useEffect:pn,useImperativeHandle:pn,useInsertionEffect:pn,useLayoutEffect:pn,useMemo:pn,useReducer:pn,useRef:pn,useState:pn,useDebugValue:pn,useDeferredValue:pn,useTransition:pn,useMutableSource:pn,useSyncExternalStore:pn,useId:pn,unstable_isNewReconciler:!1},hw={readContext:Gn,useCallback:function(t,s){return Ts().memoizedState=[t,s===void 0?null:s],t},useContext:Gn,useEffect:Fp,useImperativeHandle:function(t,s,i){return i=i!=null?i.concat([t]):null,Ra(4194308,4,Wp.bind(null,s,t),i)},useLayoutEffect:function(t,s){return Ra(4194308,4,t,s)},useInsertionEffect:function(t,s){return Ra(4,2,t,s)},useMemo:function(t,s){var i=Ts();return s=s===void 0?null:s,t=t(),i.memoizedState=[t,s],t},useReducer:function(t,s,i){var u=Ts();return s=i!==void 0?i(s):s,u.memoizedState=u.baseState=s,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:s},u.queue=t,t=t.dispatch=fw.bind(null,It,t),[u.memoizedState,t]},useRef:function(t){var s=Ts();return t={current:t},s.memoizedState=t},useState:Pp,useDebugValue:au,useDeferredValue:function(t){return Ts().memoizedState=t},useTransition:function(){var t=Pp(!1),s=t[0];return t=dw.bind(null,t[1]),Ts().memoizedState=t,[s,t]},useMutableSource:function(){},useSyncExternalStore:function(t,s,i){var u=It,p=Ts();if(St){if(i===void 0)throw Error(r(407));i=i()}else{if(i=s(),Jt===null)throw Error(r(349));(Ir&30)!==0||Dp(u,s,i)}p.memoizedState=i;var g={value:i,getSnapshot:s};return p.queue=g,Fp(Lp.bind(null,u,g,t),[t]),u.flags|=2048,ui(9,Mp.bind(null,u,g,i,s),void 0,null),i},useId:function(){var t=Ts(),s=Jt.identifierPrefix;if(St){var i=Os,u=Ls;i=(u&~(1<<32-yn(u)-1)).toString(32)+i,s=":"+s+"R"+i,i=li++,0<i&&(s+="H"+i.toString(32)),s+=":"}else i=uw++,s=":"+s+"r"+i.toString(32)+":";return t.memoizedState=s},unstable_isNewReconciler:!1},mw={readContext:Gn,useCallback:Vp,useContext:Gn,useEffect:iu,useImperativeHandle:Hp,useInsertionEffect:Up,useLayoutEffect:Bp,useMemo:Kp,useReducer:ru,useRef:zp,useState:function(){return ru(ci)},useDebugValue:au,useDeferredValue:function(t){var s=qn();return Gp(s,qt.memoizedState,t)},useTransition:function(){var t=ru(ci)[0],s=qn().memoizedState;return[t,s]},useMutableSource:Ap,useSyncExternalStore:Ip,useId:qp,unstable_isNewReconciler:!1},gw={readContext:Gn,useCallback:Vp,useContext:Gn,useEffect:iu,useImperativeHandle:Hp,useInsertionEffect:Up,useLayoutEffect:Bp,useMemo:Kp,useReducer:ou,useRef:zp,useState:function(){return ou(ci)},useDebugValue:au,useDeferredValue:function(t){var s=qn();return qt===null?s.memoizedState=t:Gp(s,qt.memoizedState,t)},useTransition:function(){var t=ou(ci)[0],s=qn().memoizedState;return[t,s]},useMutableSource:Ap,useSyncExternalStore:Ip,useId:qp,unstable_isNewReconciler:!1};function as(t,s){if(t&&t.defaultProps){s=K({},s),t=t.defaultProps;for(var i in t)s[i]===void 0&&(s[i]=t[i]);return s}return s}function lu(t,s,i,u){s=t.memoizedState,i=i(u,s),i=i==null?s:K({},s,i),t.memoizedState=i,t.lanes===0&&(t.updateQueue.baseState=i)}var Da={isMounted:function(t){return(t=t._reactInternals)?We(t)===t:!1},enqueueSetState:function(t,s,i){t=t._reactInternals;var u=kn(),p=ir(t),g=Ps(u,p);g.payload=s,i!=null&&(g.callback=i),s=nr(t,g,p),s!==null&&(us(s,t,p,u),Ta(s,t,p))},enqueueReplaceState:function(t,s,i){t=t._reactInternals;var u=kn(),p=ir(t),g=Ps(u,p);g.tag=1,g.payload=s,i!=null&&(g.callback=i),s=nr(t,g,p),s!==null&&(us(s,t,p,u),Ta(s,t,p))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var i=kn(),u=ir(t),p=Ps(i,u);p.tag=2,s!=null&&(p.callback=s),s=nr(t,p,u),s!==null&&(us(s,t,u,i),Ta(s,t,u))}};function Zp(t,s,i,u,p,g,w){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,g,w):s.prototype&&s.prototype.isPureReactComponent?!Yo(i,u)||!Yo(p,g):!0}function Jp(t,s,i){var u=!1,p=Js,g=s.contextType;return typeof g=="object"&&g!==null?g=Gn(g):(p=jn(s)?Er:fn.current,u=s.contextTypes,g=(u=u!=null)?so(t,p):Js),s=new s(i,g),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Da,t.stateNode=s,s._reactInternals=t,u&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=p,t.__reactInternalMemoizedMaskedChildContext=g),s}function eh(t,s,i,u){t=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(i,u),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(i,u),s.state!==t&&Da.enqueueReplaceState(s,s.state,null)}function cu(t,s,i,u){var p=t.stateNode;p.props=i,p.state=t.memoizedState,p.refs={},Xc(t);var g=s.contextType;typeof g=="object"&&g!==null?p.context=Gn(g):(g=jn(s)?Er:fn.current,p.context=so(t,g)),p.state=t.memoizedState,g=s.getDerivedStateFromProps,typeof g=="function"&&(lu(t,s,g,i),p.state=t.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(s=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),s!==p.state&&Da.enqueueReplaceState(p,p.state,null),Ca(t,i,p,u),p.state=t.memoizedState),typeof p.componentDidMount=="function"&&(t.flags|=4194308)}function fo(t,s){try{var i="",u=s;do i+=me(u),u=u.return;while(u);var p=i}catch(g){p=`
40
+ Error generating stack: `+g.message+`
41
+ `+g.stack}return{value:t,source:s,stack:p,digest:null}}function uu(t,s,i){return{value:t,source:null,stack:i??null,digest:s??null}}function du(t,s){try{console.error(s.value)}catch(i){setTimeout(function(){throw i})}}var vw=typeof WeakMap=="function"?WeakMap:Map;function th(t,s,i){i=Ps(-1,i),i.tag=3,i.payload={element:null};var u=s.value;return i.callback=function(){Fa||(Fa=!0,Cu=u),du(t,s)},i}function nh(t,s,i){i=Ps(-1,i),i.tag=3;var u=t.type.getDerivedStateFromError;if(typeof u=="function"){var p=s.value;i.payload=function(){return u(p)},i.callback=function(){du(t,s)}}var g=t.stateNode;return g!==null&&typeof g.componentDidCatch=="function"&&(i.callback=function(){du(t,s),typeof u!="function"&&(rr===null?rr=new Set([this]):rr.add(this));var w=s.stack;this.componentDidCatch(s.value,{componentStack:w!==null?w:""})}),i}function sh(t,s,i){var u=t.pingCache;if(u===null){u=t.pingCache=new vw;var p=new Set;u.set(s,p)}else p=u.get(s),p===void 0&&(p=new Set,u.set(s,p));p.has(i)||(p.add(i),t=Aw.bind(null,t,s,i),s.then(t,t))}function rh(t){do{var s;if((s=t.tag===13)&&(s=t.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return t;t=t.return}while(t!==null);return null}function oh(t,s,i,u,p){return(t.mode&1)===0?(t===s?t.flags|=65536:(t.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(s=Ps(-1,1),s.tag=2,nr(i,s,1))),i.lanes|=1),t):(t.flags|=65536,t.lanes=p,t)}var yw=P.ReactCurrentOwner,_n=!1;function wn(t,s,i,u){s.child=t===null?Tp(s,null,i,u):ao(s,t.child,i,u)}function ih(t,s,i,u,p){i=i.render;var g=s.ref;return co(s,p),u=nu(t,s,i,u,g,p),i=su(),t!==null&&!_n?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~p,zs(t,s,p)):(St&&i&&zc(s),s.flags|=1,wn(t,s,u,p),s.child)}function ah(t,s,i,u,p){if(t===null){var g=i.type;return typeof g=="function"&&!Du(g)&&g.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(s.tag=15,s.type=g,lh(t,s,g,u,p)):(t=Ka(i.type,null,u,s,s.mode,p),t.ref=s.ref,t.return=s,s.child=t)}if(g=t.child,(t.lanes&p)===0){var w=g.memoizedProps;if(i=i.compare,i=i!==null?i:Yo,i(w,u)&&t.ref===s.ref)return zs(t,s,p)}return s.flags|=1,t=lr(g,u),t.ref=s.ref,t.return=s,s.child=t}function lh(t,s,i,u,p){if(t!==null){var g=t.memoizedProps;if(Yo(g,u)&&t.ref===s.ref)if(_n=!1,s.pendingProps=u=g,(t.lanes&p)!==0)(t.flags&131072)!==0&&(_n=!0);else return s.lanes=t.lanes,zs(t,s,p)}return fu(t,s,i,u,p)}function ch(t,s,i){var u=s.pendingProps,p=u.children,g=t!==null?t.memoizedState:null;if(u.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},ht(ho,Fn),Fn|=i;else{if((i&1073741824)===0)return t=g!==null?g.baseLanes|i:i,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:t,cachePool:null,transitions:null},s.updateQueue=null,ht(ho,Fn),Fn|=t,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},u=g!==null?g.baseLanes:i,ht(ho,Fn),Fn|=u}else g!==null?(u=g.baseLanes|i,s.memoizedState=null):u=i,ht(ho,Fn),Fn|=u;return wn(t,s,p,i),s.child}function uh(t,s){var i=s.ref;(t===null&&i!==null||t!==null&&t.ref!==i)&&(s.flags|=512,s.flags|=2097152)}function fu(t,s,i,u,p){var g=jn(i)?Er:fn.current;return g=so(s,g),co(s,p),i=nu(t,s,i,u,g,p),u=su(),t!==null&&!_n?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~p,zs(t,s,p)):(St&&u&&zc(s),s.flags|=1,wn(t,s,i,p),s.child)}function dh(t,s,i,u,p){if(jn(i)){var g=!0;va(s)}else g=!1;if(co(s,p),s.stateNode===null)La(t,s),Jp(s,i,u),cu(s,i,u,p),u=!0;else if(t===null){var w=s.stateNode,_=s.memoizedProps;w.props=_;var D=w.context,V=i.contextType;typeof V=="object"&&V!==null?V=Gn(V):(V=jn(i)?Er:fn.current,V=so(s,V));var se=i.getDerivedStateFromProps,oe=typeof se=="function"||typeof w.getSnapshotBeforeUpdate=="function";oe||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(_!==u||D!==V)&&eh(s,w,u,V),tr=!1;var ne=s.memoizedState;w.state=ne,Ca(s,u,w,p),D=s.memoizedState,_!==u||ne!==D||En.current||tr?(typeof se=="function"&&(lu(s,i,se,u),D=s.memoizedState),(_=tr||Zp(s,i,_,u,ne,D,V))?(oe||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(s.flags|=4194308)):(typeof w.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=u,s.memoizedState=D),w.props=u,w.state=D,w.context=V,u=_):(typeof w.componentDidMount=="function"&&(s.flags|=4194308),u=!1)}else{w=s.stateNode,Ep(t,s),_=s.memoizedProps,V=s.type===s.elementType?_:as(s.type,_),w.props=V,oe=s.pendingProps,ne=w.context,D=i.contextType,typeof D=="object"&&D!==null?D=Gn(D):(D=jn(i)?Er:fn.current,D=so(s,D));var Ne=i.getDerivedStateFromProps;(se=typeof Ne=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(_!==oe||ne!==D)&&eh(s,w,u,D),tr=!1,ne=s.memoizedState,w.state=ne,Ca(s,u,w,p);var Ee=s.memoizedState;_!==oe||ne!==Ee||En.current||tr?(typeof Ne=="function"&&(lu(s,i,Ne,u),Ee=s.memoizedState),(V=tr||Zp(s,i,V,u,ne,Ee,D)||!1)?(se||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(u,Ee,D),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(u,Ee,D)),typeof w.componentDidUpdate=="function"&&(s.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof w.componentDidUpdate!="function"||_===t.memoizedProps&&ne===t.memoizedState||(s.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||_===t.memoizedProps&&ne===t.memoizedState||(s.flags|=1024),s.memoizedProps=u,s.memoizedState=Ee),w.props=u,w.state=Ee,w.context=D,u=V):(typeof w.componentDidUpdate!="function"||_===t.memoizedProps&&ne===t.memoizedState||(s.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||_===t.memoizedProps&&ne===t.memoizedState||(s.flags|=1024),u=!1)}return pu(t,s,i,u,g,p)}function pu(t,s,i,u,p,g){uh(t,s);var w=(s.flags&128)!==0;if(!u&&!w)return p&&gp(s,i,!1),zs(t,s,g);u=s.stateNode,yw.current=s;var _=w&&typeof i.getDerivedStateFromError!="function"?null:u.render();return s.flags|=1,t!==null&&w?(s.child=ao(s,t.child,null,g),s.child=ao(s,null,_,g)):wn(t,s,_,g),s.memoizedState=u.state,p&&gp(s,i,!0),s.child}function fh(t){var s=t.stateNode;s.pendingContext?hp(t,s.pendingContext,s.pendingContext!==s.context):s.context&&hp(t,s.context,!1),Yc(t,s.containerInfo)}function ph(t,s,i,u,p){return io(),Wc(p),s.flags|=256,wn(t,s,i,u),s.child}var hu={dehydrated:null,treeContext:null,retryLane:0};function mu(t){return{baseLanes:t,cachePool:null,transitions:null}}function hh(t,s,i){var u=s.pendingProps,p=At.current,g=!1,w=(s.flags&128)!==0,_;if((_=w)||(_=t!==null&&t.memoizedState===null?!1:(p&2)!==0),_?(g=!0,s.flags&=-129):(t===null||t.memoizedState!==null)&&(p|=1),ht(At,p&1),t===null)return Bc(s),t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?((s.mode&1)===0?s.lanes=1:t.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(w=u.children,t=u.fallback,g?(u=s.mode,g=s.child,w={mode:"hidden",children:w},(u&1)===0&&g!==null?(g.childLanes=0,g.pendingProps=w):g=Ga(w,u,0,null),t=$r(t,u,i,null),g.return=s,t.return=s,g.sibling=t,s.child=g,s.child.memoizedState=mu(i),s.memoizedState=hu,t):gu(s,w));if(p=t.memoizedState,p!==null&&(_=p.dehydrated,_!==null))return xw(t,s,w,u,_,p,i);if(g){g=u.fallback,w=s.mode,p=t.child,_=p.sibling;var D={mode:"hidden",children:u.children};return(w&1)===0&&s.child!==p?(u=s.child,u.childLanes=0,u.pendingProps=D,s.deletions=null):(u=lr(p,D),u.subtreeFlags=p.subtreeFlags&14680064),_!==null?g=lr(_,g):(g=$r(g,w,i,null),g.flags|=2),g.return=s,u.return=s,u.sibling=g,s.child=u,u=g,g=s.child,w=t.child.memoizedState,w=w===null?mu(i):{baseLanes:w.baseLanes|i,cachePool:null,transitions:w.transitions},g.memoizedState=w,g.childLanes=t.childLanes&~i,s.memoizedState=hu,u}return g=t.child,t=g.sibling,u=lr(g,{mode:"visible",children:u.children}),(s.mode&1)===0&&(u.lanes=i),u.return=s,u.sibling=null,t!==null&&(i=s.deletions,i===null?(s.deletions=[t],s.flags|=16):i.push(t)),s.child=u,s.memoizedState=null,u}function gu(t,s){return s=Ga({mode:"visible",children:s},t.mode,0,null),s.return=t,t.child=s}function Ma(t,s,i,u){return u!==null&&Wc(u),ao(s,t.child,null,i),t=gu(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function xw(t,s,i,u,p,g,w){if(i)return s.flags&256?(s.flags&=-257,u=uu(Error(r(422))),Ma(t,s,w,u)):s.memoizedState!==null?(s.child=t.child,s.flags|=128,null):(g=u.fallback,p=s.mode,u=Ga({mode:"visible",children:u.children},p,0,null),g=$r(g,p,w,null),g.flags|=2,u.return=s,g.return=s,u.sibling=g,s.child=u,(s.mode&1)!==0&&ao(s,t.child,null,w),s.child.memoizedState=mu(w),s.memoizedState=hu,g);if((s.mode&1)===0)return Ma(t,s,w,null);if(p.data==="$!"){if(u=p.nextSibling&&p.nextSibling.dataset,u)var _=u.dgst;return u=_,g=Error(r(419)),u=uu(g,u,void 0),Ma(t,s,w,u)}if(_=(w&t.childLanes)!==0,_n||_){if(u=Jt,u!==null){switch(w&-w){case 4:p=2;break;case 16:p=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:p=32;break;case 536870912:p=268435456;break;default:p=0}p=(p&(u.suspendedLanes|w))!==0?0:p,p!==0&&p!==g.retryLane&&(g.retryLane=p,$s(t,p),us(u,t,p,-1))}return Iu(),u=uu(Error(r(421))),Ma(t,s,w,u)}return p.data==="$?"?(s.flags|=128,s.child=t.child,s=Iw.bind(null,t),p._reactRetry=s,null):(t=g.treeContext,zn=Qs(p.nextSibling),Pn=s,St=!0,is=null,t!==null&&(Vn[Kn++]=Ls,Vn[Kn++]=Os,Vn[Kn++]=jr,Ls=t.id,Os=t.overflow,jr=s),s=gu(s,u.children),s.flags|=4096,s)}function mh(t,s,i){t.lanes|=s;var u=t.alternate;u!==null&&(u.lanes|=s),Gc(t.return,s,i)}function vu(t,s,i,u,p){var g=t.memoizedState;g===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:u,tail:i,tailMode:p}:(g.isBackwards=s,g.rendering=null,g.renderingStartTime=0,g.last=u,g.tail=i,g.tailMode=p)}function gh(t,s,i){var u=s.pendingProps,p=u.revealOrder,g=u.tail;if(wn(t,s,u.children,i),u=At.current,(u&2)!==0)u=u&1|2,s.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&mh(t,i,s);else if(t.tag===19)mh(t,i,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break e;for(;t.sibling===null;){if(t.return===null||t.return===s)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}u&=1}if(ht(At,u),(s.mode&1)===0)s.memoizedState=null;else switch(p){case"forwards":for(i=s.child,p=null;i!==null;)t=i.alternate,t!==null&&Ea(t)===null&&(p=i),i=i.sibling;i=p,i===null?(p=s.child,s.child=null):(p=i.sibling,i.sibling=null),vu(s,!1,p,i,g);break;case"backwards":for(i=null,p=s.child,s.child=null;p!==null;){if(t=p.alternate,t!==null&&Ea(t)===null){s.child=p;break}t=p.sibling,p.sibling=i,i=p,p=t}vu(s,!0,i,null,g);break;case"together":vu(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function La(t,s){(s.mode&1)===0&&t!==null&&(t.alternate=null,s.alternate=null,s.flags|=2)}function zs(t,s,i){if(t!==null&&(s.dependencies=t.dependencies),Dr|=s.lanes,(i&s.childLanes)===0)return null;if(t!==null&&s.child!==t.child)throw Error(r(153));if(s.child!==null){for(t=s.child,i=lr(t,t.pendingProps),s.child=i,i.return=s;t.sibling!==null;)t=t.sibling,i=i.sibling=lr(t,t.pendingProps),i.return=s;i.sibling=null}return s.child}function ww(t,s,i){switch(s.tag){case 3:fh(s),io();break;case 5:Rp(s);break;case 1:jn(s.type)&&va(s);break;case 4:Yc(s,s.stateNode.containerInfo);break;case 10:var u=s.type._context,p=s.memoizedProps.value;ht(ba,u._currentValue),u._currentValue=p;break;case 13:if(u=s.memoizedState,u!==null)return u.dehydrated!==null?(ht(At,At.current&1),s.flags|=128,null):(i&s.child.childLanes)!==0?hh(t,s,i):(ht(At,At.current&1),t=zs(t,s,i),t!==null?t.sibling:null);ht(At,At.current&1);break;case 19:if(u=(i&s.childLanes)!==0,(t.flags&128)!==0){if(u)return gh(t,s,i);s.flags|=128}if(p=s.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),ht(At,At.current),u)break;return null;case 22:case 23:return s.lanes=0,ch(t,s,i)}return zs(t,s,i)}var vh,yu,yh,xh;vh=function(t,s){for(var i=s.child;i!==null;){if(i.tag===5||i.tag===6)t.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},yu=function(){},yh=function(t,s,i,u){var p=t.memoizedProps;if(p!==u){t=s.stateNode,Ar(Ns.current);var g=null;switch(i){case"input":p=Re(t,p),u=Re(t,u),g=[];break;case"select":p=K({},p,{value:void 0}),u=K({},u,{value:void 0}),g=[];break;case"textarea":p=Wt(t,p),u=Wt(t,u),g=[];break;default:typeof p.onClick!="function"&&typeof u.onClick=="function"&&(t.onclick=ha)}ss(i,u);var w;i=null;for(V in p)if(!u.hasOwnProperty(V)&&p.hasOwnProperty(V)&&p[V]!=null)if(V==="style"){var _=p[V];for(w in _)_.hasOwnProperty(w)&&(i||(i={}),i[w]="")}else V!=="dangerouslySetInnerHTML"&&V!=="children"&&V!=="suppressContentEditableWarning"&&V!=="suppressHydrationWarning"&&V!=="autoFocus"&&(l.hasOwnProperty(V)?g||(g=[]):(g=g||[]).push(V,null));for(V in u){var D=u[V];if(_=p!=null?p[V]:void 0,u.hasOwnProperty(V)&&D!==_&&(D!=null||_!=null))if(V==="style")if(_){for(w in _)!_.hasOwnProperty(w)||D&&D.hasOwnProperty(w)||(i||(i={}),i[w]="");for(w in D)D.hasOwnProperty(w)&&_[w]!==D[w]&&(i||(i={}),i[w]=D[w])}else i||(g||(g=[]),g.push(V,i)),i=D;else V==="dangerouslySetInnerHTML"?(D=D?D.__html:void 0,_=_?_.__html:void 0,D!=null&&_!==D&&(g=g||[]).push(V,D)):V==="children"?typeof D!="string"&&typeof D!="number"||(g=g||[]).push(V,""+D):V!=="suppressContentEditableWarning"&&V!=="suppressHydrationWarning"&&(l.hasOwnProperty(V)?(D!=null&&V==="onScroll"&&vt("scroll",t),g||_===D||(g=[])):(g=g||[]).push(V,D))}i&&(g=g||[]).push("style",i);var V=g;(s.updateQueue=V)&&(s.flags|=4)}},xh=function(t,s,i,u){i!==u&&(s.flags|=4)};function di(t,s){if(!St)switch(t.tailMode){case"hidden":s=t.tail;for(var i=null;s!==null;)s.alternate!==null&&(i=s),s=s.sibling;i===null?t.tail=null:i.sibling=null;break;case"collapsed":i=t.tail;for(var u=null;i!==null;)i.alternate!==null&&(u=i),i=i.sibling;u===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function hn(t){var s=t.alternate!==null&&t.alternate.child===t.child,i=0,u=0;if(s)for(var p=t.child;p!==null;)i|=p.lanes|p.childLanes,u|=p.subtreeFlags&14680064,u|=p.flags&14680064,p.return=t,p=p.sibling;else for(p=t.child;p!==null;)i|=p.lanes|p.childLanes,u|=p.subtreeFlags,u|=p.flags,p.return=t,p=p.sibling;return t.subtreeFlags|=u,t.childLanes=i,s}function kw(t,s,i){var u=s.pendingProps;switch(Fc(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return hn(s),null;case 1:return jn(s.type)&&ga(),hn(s),null;case 3:return u=s.stateNode,uo(),yt(En),yt(fn),Jc(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(t===null||t.child===null)&&(ka(s)?s.flags|=4:t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,is!==null&&(_u(is),is=null))),yu(t,s),hn(s),null;case 5:Qc(s);var p=Ar(ii.current);if(i=s.type,t!==null&&s.stateNode!=null)yh(t,s,i,u,p),t.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!u){if(s.stateNode===null)throw Error(r(166));return hn(s),null}if(t=Ar(Ns.current),ka(s)){u=s.stateNode,i=s.type;var g=s.memoizedProps;switch(u[bs]=s,u[ti]=g,t=(s.mode&1)!==0,i){case"dialog":vt("cancel",u),vt("close",u);break;case"iframe":case"object":case"embed":vt("load",u);break;case"video":case"audio":for(p=0;p<Zo.length;p++)vt(Zo[p],u);break;case"source":vt("error",u);break;case"img":case"image":case"link":vt("error",u),vt("load",u);break;case"details":vt("toggle",u);break;case"input":at(u,g),vt("invalid",u);break;case"select":u._wrapperState={wasMultiple:!!g.multiple},vt("invalid",u);break;case"textarea":q(u,g),vt("invalid",u)}ss(i,g),p=null;for(var w in g)if(g.hasOwnProperty(w)){var _=g[w];w==="children"?typeof _=="string"?u.textContent!==_&&(g.suppressHydrationWarning!==!0&&pa(u.textContent,_,t),p=["children",_]):typeof _=="number"&&u.textContent!==""+_&&(g.suppressHydrationWarning!==!0&&pa(u.textContent,_,t),p=["children",""+_]):l.hasOwnProperty(w)&&_!=null&&w==="onScroll"&&vt("scroll",u)}switch(i){case"input":ge(u),Ue(u,g,!0);break;case"textarea":ge(u),Pe(u);break;case"select":case"option":break;default:typeof g.onClick=="function"&&(u.onclick=ha)}u=p,s.updateQueue=u,u!==null&&(s.flags|=4)}else{w=p.nodeType===9?p:p.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Ye(i)),t==="http://www.w3.org/1999/xhtml"?i==="script"?(t=w.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof u.is=="string"?t=w.createElement(i,{is:u.is}):(t=w.createElement(i),i==="select"&&(w=t,u.multiple?w.multiple=!0:u.size&&(w.size=u.size))):t=w.createElementNS(t,i),t[bs]=s,t[ti]=u,vh(t,s,!1,!1),s.stateNode=t;e:{switch(w=rs(i,u),i){case"dialog":vt("cancel",t),vt("close",t),p=u;break;case"iframe":case"object":case"embed":vt("load",t),p=u;break;case"video":case"audio":for(p=0;p<Zo.length;p++)vt(Zo[p],t);p=u;break;case"source":vt("error",t),p=u;break;case"img":case"image":case"link":vt("error",t),vt("load",t),p=u;break;case"details":vt("toggle",t),p=u;break;case"input":at(t,u),p=Re(t,u),vt("invalid",t);break;case"option":p=u;break;case"select":t._wrapperState={wasMultiple:!!u.multiple},p=K({},u,{value:void 0}),vt("invalid",t);break;case"textarea":q(t,u),p=Wt(t,u),vt("invalid",t);break;default:p=u}ss(i,p),_=p;for(g in _)if(_.hasOwnProperty(g)){var D=_[g];g==="style"?ts(t,D):g==="dangerouslySetInnerHTML"?(D=D?D.__html:void 0,D!=null&&Dt(t,D)):g==="children"?typeof D=="string"?(i!=="textarea"||D!=="")&&un(t,D):typeof D=="number"&&un(t,""+D):g!=="suppressContentEditableWarning"&&g!=="suppressHydrationWarning"&&g!=="autoFocus"&&(l.hasOwnProperty(g)?D!=null&&g==="onScroll"&&vt("scroll",t):D!=null&&$(t,g,D,w))}switch(i){case"input":ge(t),Ue(t,u,!1);break;case"textarea":ge(t),Pe(t);break;case"option":u.value!=null&&t.setAttribute("value",""+we(u.value));break;case"select":t.multiple=!!u.multiple,g=u.value,g!=null?Tt(t,!!u.multiple,g,!1):u.defaultValue!=null&&Tt(t,!!u.multiple,u.defaultValue,!0);break;default:typeof p.onClick=="function"&&(t.onclick=ha)}switch(i){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}}u&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return hn(s),null;case 6:if(t&&s.stateNode!=null)xh(t,s,t.memoizedProps,u);else{if(typeof u!="string"&&s.stateNode===null)throw Error(r(166));if(i=Ar(ii.current),Ar(Ns.current),ka(s)){if(u=s.stateNode,i=s.memoizedProps,u[bs]=s,(g=u.nodeValue!==i)&&(t=Pn,t!==null))switch(t.tag){case 3:pa(u.nodeValue,i,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&pa(u.nodeValue,i,(t.mode&1)!==0)}g&&(s.flags|=4)}else u=(i.nodeType===9?i:i.ownerDocument).createTextNode(u),u[bs]=s,s.stateNode=u}return hn(s),null;case 13:if(yt(At),u=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(St&&zn!==null&&(s.mode&1)!==0&&(s.flags&128)===0)Sp(),io(),s.flags|=98560,g=!1;else if(g=ka(s),u!==null&&u.dehydrated!==null){if(t===null){if(!g)throw Error(r(318));if(g=s.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));g[bs]=s}else io(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;hn(s),g=!1}else is!==null&&(_u(is),is=null),g=!0;if(!g)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=i,s):(u=u!==null,u!==(t!==null&&t.memoizedState!==null)&&u&&(s.child.flags|=8192,(s.mode&1)!==0&&(t===null||(At.current&1)!==0?Xt===0&&(Xt=3):Iu())),s.updateQueue!==null&&(s.flags|=4),hn(s),null);case 4:return uo(),yu(t,s),t===null&&Jo(s.stateNode.containerInfo),hn(s),null;case 10:return Kc(s.type._context),hn(s),null;case 17:return jn(s.type)&&ga(),hn(s),null;case 19:if(yt(At),g=s.memoizedState,g===null)return hn(s),null;if(u=(s.flags&128)!==0,w=g.rendering,w===null)if(u)di(g,!1);else{if(Xt!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(w=Ea(t),w!==null){for(s.flags|=128,di(g,!1),u=w.updateQueue,u!==null&&(s.updateQueue=u,s.flags|=4),s.subtreeFlags=0,u=i,i=s.child;i!==null;)g=i,t=u,g.flags&=14680066,w=g.alternate,w===null?(g.childLanes=0,g.lanes=t,g.child=null,g.subtreeFlags=0,g.memoizedProps=null,g.memoizedState=null,g.updateQueue=null,g.dependencies=null,g.stateNode=null):(g.childLanes=w.childLanes,g.lanes=w.lanes,g.child=w.child,g.subtreeFlags=0,g.deletions=null,g.memoizedProps=w.memoizedProps,g.memoizedState=w.memoizedState,g.updateQueue=w.updateQueue,g.type=w.type,t=w.dependencies,g.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),i=i.sibling;return ht(At,At.current&1|2),s.child}t=t.sibling}g.tail!==null&&jt()>mo&&(s.flags|=128,u=!0,di(g,!1),s.lanes=4194304)}else{if(!u)if(t=Ea(w),t!==null){if(s.flags|=128,u=!0,i=t.updateQueue,i!==null&&(s.updateQueue=i,s.flags|=4),di(g,!0),g.tail===null&&g.tailMode==="hidden"&&!w.alternate&&!St)return hn(s),null}else 2*jt()-g.renderingStartTime>mo&&i!==1073741824&&(s.flags|=128,u=!0,di(g,!1),s.lanes=4194304);g.isBackwards?(w.sibling=s.child,s.child=w):(i=g.last,i!==null?i.sibling=w:s.child=w,g.last=w)}return g.tail!==null?(s=g.tail,g.rendering=s,g.tail=s.sibling,g.renderingStartTime=jt(),s.sibling=null,i=At.current,ht(At,u?i&1|2:i&1),s):(hn(s),null);case 22:case 23:return Au(),u=s.memoizedState!==null,t!==null&&t.memoizedState!==null!==u&&(s.flags|=8192),u&&(s.mode&1)!==0?(Fn&1073741824)!==0&&(hn(s),s.subtreeFlags&6&&(s.flags|=8192)):hn(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function Sw(t,s){switch(Fc(s),s.tag){case 1:return jn(s.type)&&ga(),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return uo(),yt(En),yt(fn),Jc(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 5:return Qc(s),null;case 13:if(yt(At),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(r(340));io()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return yt(At),null;case 4:return uo(),null;case 10:return Kc(s.type._context),null;case 22:case 23:return Au(),null;case 24:return null;default:return null}}var Oa=!1,mn=!1,bw=typeof WeakSet=="function"?WeakSet:Set,Ce=null;function po(t,s){var i=t.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(u){Lt(t,s,u)}else i.current=null}function xu(t,s,i){try{i()}catch(u){Lt(t,s,u)}}var wh=!1;function Nw(t,s){if(Ac=na,t=Zf(),bc(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var u=i.getSelection&&i.getSelection();if(u&&u.rangeCount!==0){i=u.anchorNode;var p=u.anchorOffset,g=u.focusNode;u=u.focusOffset;try{i.nodeType,g.nodeType}catch{i=null;break e}var w=0,_=-1,D=-1,V=0,se=0,oe=t,ne=null;t:for(;;){for(var Ne;oe!==i||p!==0&&oe.nodeType!==3||(_=w+p),oe!==g||u!==0&&oe.nodeType!==3||(D=w+u),oe.nodeType===3&&(w+=oe.nodeValue.length),(Ne=oe.firstChild)!==null;)ne=oe,oe=Ne;for(;;){if(oe===t)break t;if(ne===i&&++V===p&&(_=w),ne===g&&++se===u&&(D=w),(Ne=oe.nextSibling)!==null)break;oe=ne,ne=oe.parentNode}oe=Ne}i=_===-1||D===-1?null:{start:_,end:D}}else i=null}i=i||{start:0,end:0}}else i=null;for(Ic={focusedElem:t,selectionRange:i},na=!1,Ce=s;Ce!==null;)if(s=Ce,t=s.child,(s.subtreeFlags&1028)!==0&&t!==null)t.return=s,Ce=t;else for(;Ce!==null;){s=Ce;try{var Ee=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(Ee!==null){var Ae=Ee.memoizedProps,Pt=Ee.memoizedState,W=s.stateNode,O=W.getSnapshotBeforeUpdate(s.elementType===s.type?Ae:as(s.type,Ae),Pt);W.__reactInternalSnapshotBeforeUpdate=O}break;case 3:var H=s.stateNode.containerInfo;H.nodeType===1?H.textContent="":H.nodeType===9&&H.documentElement&&H.removeChild(H.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ue){Lt(s,s.return,ue)}if(t=s.sibling,t!==null){t.return=s.return,Ce=t;break}Ce=s.return}return Ee=wh,wh=!1,Ee}function fi(t,s,i){var u=s.updateQueue;if(u=u!==null?u.lastEffect:null,u!==null){var p=u=u.next;do{if((p.tag&t)===t){var g=p.destroy;p.destroy=void 0,g!==void 0&&xu(s,i,g)}p=p.next}while(p!==u)}}function $a(t,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var i=s=s.next;do{if((i.tag&t)===t){var u=i.create;i.destroy=u()}i=i.next}while(i!==s)}}function wu(t){var s=t.ref;if(s!==null){var i=t.stateNode;switch(t.tag){case 5:t=i;break;default:t=i}typeof s=="function"?s(t):s.current=t}}function kh(t){var s=t.alternate;s!==null&&(t.alternate=null,kh(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&(delete s[bs],delete s[ti],delete s[Oc],delete s[iw],delete s[aw])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Sh(t){return t.tag===5||t.tag===3||t.tag===4}function bh(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Sh(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function ku(t,s,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,s?i.nodeType===8?i.parentNode.insertBefore(t,s):i.insertBefore(t,s):(i.nodeType===8?(s=i.parentNode,s.insertBefore(t,i)):(s=i,s.appendChild(t)),i=i._reactRootContainer,i!=null||s.onclick!==null||(s.onclick=ha));else if(u!==4&&(t=t.child,t!==null))for(ku(t,s,i),t=t.sibling;t!==null;)ku(t,s,i),t=t.sibling}function Su(t,s,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,s?i.insertBefore(t,s):i.appendChild(t);else if(u!==4&&(t=t.child,t!==null))for(Su(t,s,i),t=t.sibling;t!==null;)Su(t,s,i),t=t.sibling}var on=null,ls=!1;function sr(t,s,i){for(i=i.child;i!==null;)Nh(t,s,i),i=i.sibling}function Nh(t,s,i){if(On&&typeof On.onCommitFiberUnmount=="function")try{On.onCommitFiberUnmount(kr,i)}catch{}switch(i.tag){case 5:mn||po(i,s);case 6:var u=on,p=ls;on=null,sr(t,s,i),on=u,ls=p,on!==null&&(ls?(t=on,i=i.stateNode,t.nodeType===8?t.parentNode.removeChild(i):t.removeChild(i)):on.removeChild(i.stateNode));break;case 18:on!==null&&(ls?(t=on,i=i.stateNode,t.nodeType===8?Lc(t.parentNode,i):t.nodeType===1&&Lc(t,i),Ho(t)):Lc(on,i.stateNode));break;case 4:u=on,p=ls,on=i.stateNode.containerInfo,ls=!0,sr(t,s,i),on=u,ls=p;break;case 0:case 11:case 14:case 15:if(!mn&&(u=i.updateQueue,u!==null&&(u=u.lastEffect,u!==null))){p=u=u.next;do{var g=p,w=g.destroy;g=g.tag,w!==void 0&&((g&2)!==0||(g&4)!==0)&&xu(i,s,w),p=p.next}while(p!==u)}sr(t,s,i);break;case 1:if(!mn&&(po(i,s),u=i.stateNode,typeof u.componentWillUnmount=="function"))try{u.props=i.memoizedProps,u.state=i.memoizedState,u.componentWillUnmount()}catch(_){Lt(i,s,_)}sr(t,s,i);break;case 21:sr(t,s,i);break;case 22:i.mode&1?(mn=(u=mn)||i.memoizedState!==null,sr(t,s,i),mn=u):sr(t,s,i);break;default:sr(t,s,i)}}function Th(t){var s=t.updateQueue;if(s!==null){t.updateQueue=null;var i=t.stateNode;i===null&&(i=t.stateNode=new bw),s.forEach(function(u){var p=Dw.bind(null,t,u);i.has(u)||(i.add(u),u.then(p,p))})}}function cs(t,s){var i=s.deletions;if(i!==null)for(var u=0;u<i.length;u++){var p=i[u];try{var g=t,w=s,_=w;e:for(;_!==null;){switch(_.tag){case 5:on=_.stateNode,ls=!1;break e;case 3:on=_.stateNode.containerInfo,ls=!0;break e;case 4:on=_.stateNode.containerInfo,ls=!0;break e}_=_.return}if(on===null)throw Error(r(160));Nh(g,w,p),on=null,ls=!1;var D=p.alternate;D!==null&&(D.return=null),p.return=null}catch(V){Lt(p,s,V)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Ch(s,t),s=s.sibling}function Ch(t,s){var i=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(cs(s,t),Cs(t),u&4){try{fi(3,t,t.return),$a(3,t)}catch(Ae){Lt(t,t.return,Ae)}try{fi(5,t,t.return)}catch(Ae){Lt(t,t.return,Ae)}}break;case 1:cs(s,t),Cs(t),u&512&&i!==null&&po(i,i.return);break;case 5:if(cs(s,t),Cs(t),u&512&&i!==null&&po(i,i.return),t.flags&32){var p=t.stateNode;try{un(p,"")}catch(Ae){Lt(t,t.return,Ae)}}if(u&4&&(p=t.stateNode,p!=null)){var g=t.memoizedProps,w=i!==null?i.memoizedProps:g,_=t.type,D=t.updateQueue;if(t.updateQueue=null,D!==null)try{_==="input"&&g.type==="radio"&&g.name!=null&&He(p,g),rs(_,w);var V=rs(_,g);for(w=0;w<D.length;w+=2){var se=D[w],oe=D[w+1];se==="style"?ts(p,oe):se==="dangerouslySetInnerHTML"?Dt(p,oe):se==="children"?un(p,oe):$(p,se,oe,V)}switch(_){case"input":Te(p,g);break;case"textarea":Se(p,g);break;case"select":var ne=p._wrapperState.wasMultiple;p._wrapperState.wasMultiple=!!g.multiple;var Ne=g.value;Ne!=null?Tt(p,!!g.multiple,Ne,!1):ne!==!!g.multiple&&(g.defaultValue!=null?Tt(p,!!g.multiple,g.defaultValue,!0):Tt(p,!!g.multiple,g.multiple?[]:"",!1))}p[ti]=g}catch(Ae){Lt(t,t.return,Ae)}}break;case 6:if(cs(s,t),Cs(t),u&4){if(t.stateNode===null)throw Error(r(162));p=t.stateNode,g=t.memoizedProps;try{p.nodeValue=g}catch(Ae){Lt(t,t.return,Ae)}}break;case 3:if(cs(s,t),Cs(t),u&4&&i!==null&&i.memoizedState.isDehydrated)try{Ho(s.containerInfo)}catch(Ae){Lt(t,t.return,Ae)}break;case 4:cs(s,t),Cs(t);break;case 13:cs(s,t),Cs(t),p=t.child,p.flags&8192&&(g=p.memoizedState!==null,p.stateNode.isHidden=g,!g||p.alternate!==null&&p.alternate.memoizedState!==null||(Tu=jt())),u&4&&Th(t);break;case 22:if(se=i!==null&&i.memoizedState!==null,t.mode&1?(mn=(V=mn)||se,cs(s,t),mn=V):cs(s,t),Cs(t),u&8192){if(V=t.memoizedState!==null,(t.stateNode.isHidden=V)&&!se&&(t.mode&1)!==0)for(Ce=t,se=t.child;se!==null;){for(oe=Ce=se;Ce!==null;){switch(ne=Ce,Ne=ne.child,ne.tag){case 0:case 11:case 14:case 15:fi(4,ne,ne.return);break;case 1:po(ne,ne.return);var Ee=ne.stateNode;if(typeof Ee.componentWillUnmount=="function"){u=ne,i=ne.return;try{s=u,Ee.props=s.memoizedProps,Ee.state=s.memoizedState,Ee.componentWillUnmount()}catch(Ae){Lt(u,i,Ae)}}break;case 5:po(ne,ne.return);break;case 22:if(ne.memoizedState!==null){_h(oe);continue}}Ne!==null?(Ne.return=ne,Ce=Ne):_h(oe)}se=se.sibling}e:for(se=null,oe=t;;){if(oe.tag===5){if(se===null){se=oe;try{p=oe.stateNode,V?(g=p.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none"):(_=oe.stateNode,D=oe.memoizedProps.style,w=D!=null&&D.hasOwnProperty("display")?D.display:null,_.style.display=Ln("display",w))}catch(Ae){Lt(t,t.return,Ae)}}}else if(oe.tag===6){if(se===null)try{oe.stateNode.nodeValue=V?"":oe.memoizedProps}catch(Ae){Lt(t,t.return,Ae)}}else if((oe.tag!==22&&oe.tag!==23||oe.memoizedState===null||oe===t)&&oe.child!==null){oe.child.return=oe,oe=oe.child;continue}if(oe===t)break e;for(;oe.sibling===null;){if(oe.return===null||oe.return===t)break e;se===oe&&(se=null),oe=oe.return}se===oe&&(se=null),oe.sibling.return=oe.return,oe=oe.sibling}}break;case 19:cs(s,t),Cs(t),u&4&&Th(t);break;case 21:break;default:cs(s,t),Cs(t)}}function Cs(t){var s=t.flags;if(s&2){try{e:{for(var i=t.return;i!==null;){if(Sh(i)){var u=i;break e}i=i.return}throw Error(r(160))}switch(u.tag){case 5:var p=u.stateNode;u.flags&32&&(un(p,""),u.flags&=-33);var g=bh(t);Su(t,g,p);break;case 3:case 4:var w=u.stateNode.containerInfo,_=bh(t);ku(t,_,w);break;default:throw Error(r(161))}}catch(D){Lt(t,t.return,D)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function Tw(t,s,i){Ce=t,Eh(t)}function Eh(t,s,i){for(var u=(t.mode&1)!==0;Ce!==null;){var p=Ce,g=p.child;if(p.tag===22&&u){var w=p.memoizedState!==null||Oa;if(!w){var _=p.alternate,D=_!==null&&_.memoizedState!==null||mn;_=Oa;var V=mn;if(Oa=w,(mn=D)&&!V)for(Ce=p;Ce!==null;)w=Ce,D=w.child,w.tag===22&&w.memoizedState!==null?Rh(p):D!==null?(D.return=w,Ce=D):Rh(p);for(;g!==null;)Ce=g,Eh(g),g=g.sibling;Ce=p,Oa=_,mn=V}jh(t)}else(p.subtreeFlags&8772)!==0&&g!==null?(g.return=p,Ce=g):jh(t)}}function jh(t){for(;Ce!==null;){var s=Ce;if((s.flags&8772)!==0){var i=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:mn||$a(5,s);break;case 1:var u=s.stateNode;if(s.flags&4&&!mn)if(i===null)u.componentDidMount();else{var p=s.elementType===s.type?i.memoizedProps:as(s.type,i.memoizedProps);u.componentDidUpdate(p,i.memoizedState,u.__reactInternalSnapshotBeforeUpdate)}var g=s.updateQueue;g!==null&&_p(s,g,u);break;case 3:var w=s.updateQueue;if(w!==null){if(i=null,s.child!==null)switch(s.child.tag){case 5:i=s.child.stateNode;break;case 1:i=s.child.stateNode}_p(s,w,i)}break;case 5:var _=s.stateNode;if(i===null&&s.flags&4){i=_;var D=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":D.autoFocus&&i.focus();break;case"img":D.src&&(i.src=D.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var V=s.alternate;if(V!==null){var se=V.memoizedState;if(se!==null){var oe=se.dehydrated;oe!==null&&Ho(oe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}mn||s.flags&512&&wu(s)}catch(ne){Lt(s,s.return,ne)}}if(s===t){Ce=null;break}if(i=s.sibling,i!==null){i.return=s.return,Ce=i;break}Ce=s.return}}function _h(t){for(;Ce!==null;){var s=Ce;if(s===t){Ce=null;break}var i=s.sibling;if(i!==null){i.return=s.return,Ce=i;break}Ce=s.return}}function Rh(t){for(;Ce!==null;){var s=Ce;try{switch(s.tag){case 0:case 11:case 15:var i=s.return;try{$a(4,s)}catch(D){Lt(s,i,D)}break;case 1:var u=s.stateNode;if(typeof u.componentDidMount=="function"){var p=s.return;try{u.componentDidMount()}catch(D){Lt(s,p,D)}}var g=s.return;try{wu(s)}catch(D){Lt(s,g,D)}break;case 5:var w=s.return;try{wu(s)}catch(D){Lt(s,w,D)}}}catch(D){Lt(s,s.return,D)}if(s===t){Ce=null;break}var _=s.sibling;if(_!==null){_.return=s.return,Ce=_;break}Ce=s.return}}var Cw=Math.ceil,Pa=P.ReactCurrentDispatcher,bu=P.ReactCurrentOwner,Xn=P.ReactCurrentBatchConfig,et=0,Jt=null,Ut=null,an=0,Fn=0,ho=Zs(0),Xt=0,pi=null,Dr=0,za=0,Nu=0,hi=null,Rn=null,Tu=0,mo=1/0,Fs=null,Fa=!1,Cu=null,rr=null,Ua=!1,or=null,Ba=0,mi=0,Eu=null,Wa=-1,Ha=0;function kn(){return(et&6)!==0?jt():Wa!==-1?Wa:Wa=jt()}function ir(t){return(t.mode&1)===0?1:(et&2)!==0&&an!==0?an&-an:cw.transition!==null?(Ha===0&&(Ha=Fo()),Ha):(t=Ze,t!==0||(t=window.event,t=t===void 0?16:If(t.type)),t)}function us(t,s,i,u){if(50<mi)throw mi=0,Eu=null,Error(r(185));Tr(t,i,u),((et&2)===0||t!==Jt)&&(t===Jt&&((et&2)===0&&(za|=i),Xt===4&&ar(t,an)),An(t,u),i===1&&et===0&&(s.mode&1)===0&&(mo=jt()+500,ya&&er()))}function An(t,s){var i=t.callbackNode;Ji(t,s);var u=Nr(t,t===Jt?an:0);if(u===0)i!==null&&st(i),t.callbackNode=null,t.callbackPriority=0;else if(s=u&-u,t.callbackPriority!==s){if(i!=null&&st(i),s===1)t.tag===0?lw(Ih.bind(null,t)):vp(Ih.bind(null,t)),rw(function(){(et&6)===0&&er()}),i=null;else{switch(ce(u)){case 1:i=Vs;break;case 4:i=Ss;break;case 16:i=Hr;break;case 536870912:i=Qi;break;default:i=Hr}i=Fh(i,Ah.bind(null,t))}t.callbackPriority=s,t.callbackNode=i}}function Ah(t,s){if(Wa=-1,Ha=0,(et&6)!==0)throw Error(r(327));var i=t.callbackNode;if(go()&&t.callbackNode!==i)return null;var u=Nr(t,t===Jt?an:0);if(u===0)return null;if((u&30)!==0||(u&t.expiredLanes)!==0||s)s=Va(t,u);else{s=u;var p=et;et|=2;var g=Mh();(Jt!==t||an!==s)&&(Fs=null,mo=jt()+500,Lr(t,s));do try{_w();break}catch(_){Dh(t,_)}while(!0);Vc(),Pa.current=g,et=p,Ut!==null?s=0:(Jt=null,an=0,s=Xt)}if(s!==0){if(s===2&&(p=zo(t),p!==0&&(u=p,s=ju(t,p))),s===1)throw i=pi,Lr(t,0),ar(t,u),An(t,jt()),i;if(s===6)ar(t,u);else{if(p=t.current.alternate,(u&30)===0&&!Ew(p)&&(s=Va(t,u),s===2&&(g=zo(t),g!==0&&(u=g,s=ju(t,g))),s===1))throw i=pi,Lr(t,0),ar(t,u),An(t,jt()),i;switch(t.finishedWork=p,t.finishedLanes=u,s){case 0:case 1:throw Error(r(345));case 2:Or(t,Rn,Fs);break;case 3:if(ar(t,u),(u&130023424)===u&&(s=Tu+500-jt(),10<s)){if(Nr(t,0)!==0)break;if(p=t.suspendedLanes,(p&u)!==u){kn(),t.pingedLanes|=t.suspendedLanes&p;break}t.timeoutHandle=Mc(Or.bind(null,t,Rn,Fs),s);break}Or(t,Rn,Fs);break;case 4:if(ar(t,u),(u&4194240)===u)break;for(s=t.eventTimes,p=-1;0<u;){var w=31-yn(u);g=1<<w,w=s[w],w>p&&(p=w),u&=~g}if(u=p,u=jt()-u,u=(120>u?120:480>u?480:1080>u?1080:1920>u?1920:3e3>u?3e3:4320>u?4320:1960*Cw(u/1960))-u,10<u){t.timeoutHandle=Mc(Or.bind(null,t,Rn,Fs),u);break}Or(t,Rn,Fs);break;case 5:Or(t,Rn,Fs);break;default:throw Error(r(329))}}}return An(t,jt()),t.callbackNode===i?Ah.bind(null,t):null}function ju(t,s){var i=hi;return t.current.memoizedState.isDehydrated&&(Lr(t,s).flags|=256),t=Va(t,s),t!==2&&(s=Rn,Rn=i,s!==null&&_u(s)),t}function _u(t){Rn===null?Rn=t:Rn.push.apply(Rn,t)}function Ew(t){for(var s=t;;){if(s.flags&16384){var i=s.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var u=0;u<i.length;u++){var p=i[u],g=p.getSnapshot;p=p.value;try{if(!os(g(),p))return!1}catch{return!1}}}if(i=s.child,s.subtreeFlags&16384&&i!==null)i.return=s,s=i;else{if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function ar(t,s){for(s&=~Nu,s&=~za,t.suspendedLanes|=s,t.pingedLanes&=~s,t=t.expirationTimes;0<s;){var i=31-yn(s),u=1<<i;t[i]=-1,s&=~u}}function Ih(t){if((et&6)!==0)throw Error(r(327));go();var s=Nr(t,0);if((s&1)===0)return An(t,jt()),null;var i=Va(t,s);if(t.tag!==0&&i===2){var u=zo(t);u!==0&&(s=u,i=ju(t,u))}if(i===1)throw i=pi,Lr(t,0),ar(t,s),An(t,jt()),i;if(i===6)throw Error(r(345));return t.finishedWork=t.current.alternate,t.finishedLanes=s,Or(t,Rn,Fs),An(t,jt()),null}function Ru(t,s){var i=et;et|=1;try{return t(s)}finally{et=i,et===0&&(mo=jt()+500,ya&&er())}}function Mr(t){or!==null&&or.tag===0&&(et&6)===0&&go();var s=et;et|=1;var i=Xn.transition,u=Ze;try{if(Xn.transition=null,Ze=1,t)return t()}finally{Ze=u,Xn.transition=i,et=s,(et&6)===0&&er()}}function Au(){Fn=ho.current,yt(ho)}function Lr(t,s){t.finishedWork=null,t.finishedLanes=0;var i=t.timeoutHandle;if(i!==-1&&(t.timeoutHandle=-1,sw(i)),Ut!==null)for(i=Ut.return;i!==null;){var u=i;switch(Fc(u),u.tag){case 1:u=u.type.childContextTypes,u!=null&&ga();break;case 3:uo(),yt(En),yt(fn),Jc();break;case 5:Qc(u);break;case 4:uo();break;case 13:yt(At);break;case 19:yt(At);break;case 10:Kc(u.type._context);break;case 22:case 23:Au()}i=i.return}if(Jt=t,Ut=t=lr(t.current,null),an=Fn=s,Xt=0,pi=null,Nu=za=Dr=0,Rn=hi=null,Rr!==null){for(s=0;s<Rr.length;s++)if(i=Rr[s],u=i.interleaved,u!==null){i.interleaved=null;var p=u.next,g=i.pending;if(g!==null){var w=g.next;g.next=p,u.next=w}i.pending=u}Rr=null}return t}function Dh(t,s){do{var i=Ut;try{if(Vc(),ja.current=Ia,_a){for(var u=It.memoizedState;u!==null;){var p=u.queue;p!==null&&(p.pending=null),u=u.next}_a=!1}if(Ir=0,Zt=qt=It=null,ai=!1,li=0,bu.current=null,i===null||i.return===null){Xt=1,pi=s,Ut=null;break}e:{var g=t,w=i.return,_=i,D=s;if(s=an,_.flags|=32768,D!==null&&typeof D=="object"&&typeof D.then=="function"){var V=D,se=_,oe=se.tag;if((se.mode&1)===0&&(oe===0||oe===11||oe===15)){var ne=se.alternate;ne?(se.updateQueue=ne.updateQueue,se.memoizedState=ne.memoizedState,se.lanes=ne.lanes):(se.updateQueue=null,se.memoizedState=null)}var Ne=rh(w);if(Ne!==null){Ne.flags&=-257,oh(Ne,w,_,g,s),Ne.mode&1&&sh(g,V,s),s=Ne,D=V;var Ee=s.updateQueue;if(Ee===null){var Ae=new Set;Ae.add(D),s.updateQueue=Ae}else Ee.add(D);break e}else{if((s&1)===0){sh(g,V,s),Iu();break e}D=Error(r(426))}}else if(St&&_.mode&1){var Pt=rh(w);if(Pt!==null){(Pt.flags&65536)===0&&(Pt.flags|=256),oh(Pt,w,_,g,s),Wc(fo(D,_));break e}}g=D=fo(D,_),Xt!==4&&(Xt=2),hi===null?hi=[g]:hi.push(g),g=w;do{switch(g.tag){case 3:g.flags|=65536,s&=-s,g.lanes|=s;var W=th(g,D,s);jp(g,W);break e;case 1:_=D;var O=g.type,H=g.stateNode;if((g.flags&128)===0&&(typeof O.getDerivedStateFromError=="function"||H!==null&&typeof H.componentDidCatch=="function"&&(rr===null||!rr.has(H)))){g.flags|=65536,s&=-s,g.lanes|=s;var ue=nh(g,_,s);jp(g,ue);break e}}g=g.return}while(g!==null)}Oh(i)}catch(Ie){s=Ie,Ut===i&&i!==null&&(Ut=i=i.return);continue}break}while(!0)}function Mh(){var t=Pa.current;return Pa.current=Ia,t===null?Ia:t}function Iu(){(Xt===0||Xt===3||Xt===2)&&(Xt=4),Jt===null||(Dr&268435455)===0&&(za&268435455)===0||ar(Jt,an)}function Va(t,s){var i=et;et|=2;var u=Mh();(Jt!==t||an!==s)&&(Fs=null,Lr(t,s));do try{jw();break}catch(p){Dh(t,p)}while(!0);if(Vc(),et=i,Pa.current=u,Ut!==null)throw Error(r(261));return Jt=null,an=0,Xt}function jw(){for(;Ut!==null;)Lh(Ut)}function _w(){for(;Ut!==null&&!Ot();)Lh(Ut)}function Lh(t){var s=zh(t.alternate,t,Fn);t.memoizedProps=t.pendingProps,s===null?Oh(t):Ut=s,bu.current=null}function Oh(t){var s=t;do{var i=s.alternate;if(t=s.return,(s.flags&32768)===0){if(i=kw(i,s,Fn),i!==null){Ut=i;return}}else{if(i=Sw(i,s),i!==null){i.flags&=32767,Ut=i;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Xt=6,Ut=null;return}}if(s=s.sibling,s!==null){Ut=s;return}Ut=s=t}while(s!==null);Xt===0&&(Xt=5)}function Or(t,s,i){var u=Ze,p=Xn.transition;try{Xn.transition=null,Ze=1,Rw(t,s,i,u)}finally{Xn.transition=p,Ze=u}return null}function Rw(t,s,i,u){do go();while(or!==null);if((et&6)!==0)throw Error(r(327));i=t.finishedWork;var p=t.finishedLanes;if(i===null)return null;if(t.finishedWork=null,t.finishedLanes=0,i===t.current)throw Error(r(177));t.callbackNode=null,t.callbackPriority=0;var g=i.lanes|i.childLanes;if(ea(t,g),t===Jt&&(Ut=Jt=null,an=0),(i.subtreeFlags&2064)===0&&(i.flags&2064)===0||Ua||(Ua=!0,Fh(Hr,function(){return go(),null})),g=(i.flags&15990)!==0,(i.subtreeFlags&15990)!==0||g){g=Xn.transition,Xn.transition=null;var w=Ze;Ze=1;var _=et;et|=4,bu.current=null,Nw(t,i),Ch(i,t),Yx(Ic),na=!!Ac,Ic=Ac=null,t.current=i,Tw(i),ws(),et=_,Ze=w,Xn.transition=g}else t.current=i;if(Ua&&(Ua=!1,or=t,Ba=p),g=t.pendingLanes,g===0&&(rr=null),Vr(i.stateNode),An(t,jt()),s!==null)for(u=t.onRecoverableError,i=0;i<s.length;i++)p=s[i],u(p.value,{componentStack:p.stack,digest:p.digest});if(Fa)throw Fa=!1,t=Cu,Cu=null,t;return(Ba&1)!==0&&t.tag!==0&&go(),g=t.pendingLanes,(g&1)!==0?t===Eu?mi++:(mi=0,Eu=t):mi=0,er(),null}function go(){if(or!==null){var t=ce(Ba),s=Xn.transition,i=Ze;try{if(Xn.transition=null,Ze=16>t?16:t,or===null)var u=!1;else{if(t=or,or=null,Ba=0,(et&6)!==0)throw Error(r(331));var p=et;for(et|=4,Ce=t.current;Ce!==null;){var g=Ce,w=g.child;if((Ce.flags&16)!==0){var _=g.deletions;if(_!==null){for(var D=0;D<_.length;D++){var V=_[D];for(Ce=V;Ce!==null;){var se=Ce;switch(se.tag){case 0:case 11:case 15:fi(8,se,g)}var oe=se.child;if(oe!==null)oe.return=se,Ce=oe;else for(;Ce!==null;){se=Ce;var ne=se.sibling,Ne=se.return;if(kh(se),se===V){Ce=null;break}if(ne!==null){ne.return=Ne,Ce=ne;break}Ce=Ne}}}var Ee=g.alternate;if(Ee!==null){var Ae=Ee.child;if(Ae!==null){Ee.child=null;do{var Pt=Ae.sibling;Ae.sibling=null,Ae=Pt}while(Ae!==null)}}Ce=g}}if((g.subtreeFlags&2064)!==0&&w!==null)w.return=g,Ce=w;else e:for(;Ce!==null;){if(g=Ce,(g.flags&2048)!==0)switch(g.tag){case 0:case 11:case 15:fi(9,g,g.return)}var W=g.sibling;if(W!==null){W.return=g.return,Ce=W;break e}Ce=g.return}}var O=t.current;for(Ce=O;Ce!==null;){w=Ce;var H=w.child;if((w.subtreeFlags&2064)!==0&&H!==null)H.return=w,Ce=H;else e:for(w=O;Ce!==null;){if(_=Ce,(_.flags&2048)!==0)try{switch(_.tag){case 0:case 11:case 15:$a(9,_)}}catch(Ie){Lt(_,_.return,Ie)}if(_===w){Ce=null;break e}var ue=_.sibling;if(ue!==null){ue.return=_.return,Ce=ue;break e}Ce=_.return}}if(et=p,er(),On&&typeof On.onPostCommitFiberRoot=="function")try{On.onPostCommitFiberRoot(kr,t)}catch{}u=!0}return u}finally{Ze=i,Xn.transition=s}}return!1}function $h(t,s,i){s=fo(i,s),s=th(t,s,1),t=nr(t,s,1),s=kn(),t!==null&&(Tr(t,1,s),An(t,s))}function Lt(t,s,i){if(t.tag===3)$h(t,t,i);else for(;s!==null;){if(s.tag===3){$h(s,t,i);break}else if(s.tag===1){var u=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(rr===null||!rr.has(u))){t=fo(i,t),t=nh(s,t,1),s=nr(s,t,1),t=kn(),s!==null&&(Tr(s,1,t),An(s,t));break}}s=s.return}}function Aw(t,s,i){var u=t.pingCache;u!==null&&u.delete(s),s=kn(),t.pingedLanes|=t.suspendedLanes&i,Jt===t&&(an&i)===i&&(Xt===4||Xt===3&&(an&130023424)===an&&500>jt()-Tu?Lr(t,0):Nu|=i),An(t,s)}function Ph(t,s){s===0&&((t.mode&1)===0?s=1:(s=Gr,Gr<<=1,(Gr&130023424)===0&&(Gr=4194304)));var i=kn();t=$s(t,s),t!==null&&(Tr(t,s,i),An(t,i))}function Iw(t){var s=t.memoizedState,i=0;s!==null&&(i=s.retryLane),Ph(t,i)}function Dw(t,s){var i=0;switch(t.tag){case 13:var u=t.stateNode,p=t.memoizedState;p!==null&&(i=p.retryLane);break;case 19:u=t.stateNode;break;default:throw Error(r(314))}u!==null&&u.delete(s),Ph(t,i)}var zh;zh=function(t,s,i){if(t!==null)if(t.memoizedProps!==s.pendingProps||En.current)_n=!0;else{if((t.lanes&i)===0&&(s.flags&128)===0)return _n=!1,ww(t,s,i);_n=(t.flags&131072)!==0}else _n=!1,St&&(s.flags&1048576)!==0&&yp(s,wa,s.index);switch(s.lanes=0,s.tag){case 2:var u=s.type;La(t,s),t=s.pendingProps;var p=so(s,fn.current);co(s,i),p=nu(null,s,u,t,p,i);var g=su();return s.flags|=1,typeof p=="object"&&p!==null&&typeof p.render=="function"&&p.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,jn(u)?(g=!0,va(s)):g=!1,s.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,Xc(s),p.updater=Da,s.stateNode=p,p._reactInternals=s,cu(s,u,t,i),s=pu(null,s,u,!0,g,i)):(s.tag=0,St&&g&&zc(s),wn(null,s,p,i),s=s.child),s;case 16:u=s.elementType;e:{switch(La(t,s),t=s.pendingProps,p=u._init,u=p(u._payload),s.type=u,p=s.tag=Lw(u),t=as(u,t),p){case 0:s=fu(null,s,u,t,i);break e;case 1:s=dh(null,s,u,t,i);break e;case 11:s=ih(null,s,u,t,i);break e;case 14:s=ah(null,s,u,as(u.type,t),i);break e}throw Error(r(306,u,""))}return s;case 0:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:as(u,p),fu(t,s,u,p,i);case 1:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:as(u,p),dh(t,s,u,p,i);case 3:e:{if(fh(s),t===null)throw Error(r(387));u=s.pendingProps,g=s.memoizedState,p=g.element,Ep(t,s),Ca(s,u,null,i);var w=s.memoizedState;if(u=w.element,g.isDehydrated)if(g={element:u,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},s.updateQueue.baseState=g,s.memoizedState=g,s.flags&256){p=fo(Error(r(423)),s),s=ph(t,s,u,i,p);break e}else if(u!==p){p=fo(Error(r(424)),s),s=ph(t,s,u,i,p);break e}else for(zn=Qs(s.stateNode.containerInfo.firstChild),Pn=s,St=!0,is=null,i=Tp(s,null,u,i),s.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(io(),u===p){s=zs(t,s,i);break e}wn(t,s,u,i)}s=s.child}return s;case 5:return Rp(s),t===null&&Bc(s),u=s.type,p=s.pendingProps,g=t!==null?t.memoizedProps:null,w=p.children,Dc(u,p)?w=null:g!==null&&Dc(u,g)&&(s.flags|=32),uh(t,s),wn(t,s,w,i),s.child;case 6:return t===null&&Bc(s),null;case 13:return hh(t,s,i);case 4:return Yc(s,s.stateNode.containerInfo),u=s.pendingProps,t===null?s.child=ao(s,null,u,i):wn(t,s,u,i),s.child;case 11:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:as(u,p),ih(t,s,u,p,i);case 7:return wn(t,s,s.pendingProps,i),s.child;case 8:return wn(t,s,s.pendingProps.children,i),s.child;case 12:return wn(t,s,s.pendingProps.children,i),s.child;case 10:e:{if(u=s.type._context,p=s.pendingProps,g=s.memoizedProps,w=p.value,ht(ba,u._currentValue),u._currentValue=w,g!==null)if(os(g.value,w)){if(g.children===p.children&&!En.current){s=zs(t,s,i);break e}}else for(g=s.child,g!==null&&(g.return=s);g!==null;){var _=g.dependencies;if(_!==null){w=g.child;for(var D=_.firstContext;D!==null;){if(D.context===u){if(g.tag===1){D=Ps(-1,i&-i),D.tag=2;var V=g.updateQueue;if(V!==null){V=V.shared;var se=V.pending;se===null?D.next=D:(D.next=se.next,se.next=D),V.pending=D}}g.lanes|=i,D=g.alternate,D!==null&&(D.lanes|=i),Gc(g.return,i,s),_.lanes|=i;break}D=D.next}}else if(g.tag===10)w=g.type===s.type?null:g.child;else if(g.tag===18){if(w=g.return,w===null)throw Error(r(341));w.lanes|=i,_=w.alternate,_!==null&&(_.lanes|=i),Gc(w,i,s),w=g.sibling}else w=g.child;if(w!==null)w.return=g;else for(w=g;w!==null;){if(w===s){w=null;break}if(g=w.sibling,g!==null){g.return=w.return,w=g;break}w=w.return}g=w}wn(t,s,p.children,i),s=s.child}return s;case 9:return p=s.type,u=s.pendingProps.children,co(s,i),p=Gn(p),u=u(p),s.flags|=1,wn(t,s,u,i),s.child;case 14:return u=s.type,p=as(u,s.pendingProps),p=as(u.type,p),ah(t,s,u,p,i);case 15:return lh(t,s,s.type,s.pendingProps,i);case 17:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:as(u,p),La(t,s),s.tag=1,jn(u)?(t=!0,va(s)):t=!1,co(s,i),Jp(s,u,p),cu(s,u,p,i),pu(null,s,u,!0,t,i);case 19:return gh(t,s,i);case 22:return ch(t,s,i)}throw Error(r(156,s.tag))};function Fh(t,s){return xs(t,s)}function Mw(t,s,i,u){this.tag=t,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Yn(t,s,i,u){return new Mw(t,s,i,u)}function Du(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Lw(t){if(typeof t=="function")return Du(t)?1:0;if(t!=null){if(t=t.$$typeof,t===he)return 11;if(t===ve)return 14}return 2}function lr(t,s){var i=t.alternate;return i===null?(i=Yn(t.tag,s,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=s,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&14680064,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,s=t.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i}function Ka(t,s,i,u,p,g){var w=2;if(u=t,typeof t=="function")Du(t)&&(w=1);else if(typeof t=="string")w=5;else e:switch(t){case M:return $r(i.children,p,g,s);case F:w=8,p|=8;break;case Z:return t=Yn(12,i,s,p|2),t.elementType=Z,t.lanes=g,t;case ke:return t=Yn(13,i,s,p),t.elementType=ke,t.lanes=g,t;case re:return t=Yn(19,i,s,p),t.elementType=re,t.lanes=g,t;case ee:return Ga(i,p,g,s);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Q:w=10;break e;case J:w=9;break e;case he:w=11;break e;case ve:w=14;break e;case le:w=16,u=null;break e}throw Error(r(130,t==null?t:typeof t,""))}return s=Yn(w,i,s,p),s.elementType=t,s.type=u,s.lanes=g,s}function $r(t,s,i,u){return t=Yn(7,t,u,s),t.lanes=i,t}function Ga(t,s,i,u){return t=Yn(22,t,u,s),t.elementType=ee,t.lanes=i,t.stateNode={isHidden:!1},t}function Mu(t,s,i){return t=Yn(6,t,null,s),t.lanes=i,t}function Lu(t,s,i){return s=Yn(4,t.children!==null?t.children:[],t.key,s),s.lanes=i,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}function Ow(t,s,i,u,p){this.tag=s,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Uo(0),this.expirationTimes=Uo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Uo(0),this.identifierPrefix=u,this.onRecoverableError=p,this.mutableSourceEagerHydrationData=null}function Ou(t,s,i,u,p,g,w,_,D){return t=new Ow(t,s,i,_,D),s===1?(s=1,g===!0&&(s|=8)):s=0,g=Yn(3,null,null,s),t.current=g,g.stateNode=t,g.memoizedState={element:u,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xc(g),t}function $w(t,s,i){var u=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:G,key:u==null?null:""+u,children:t,containerInfo:s,implementation:i}}function Uh(t){if(!t)return Js;t=t._reactInternals;e:{if(We(t)!==t||t.tag!==1)throw Error(r(170));var s=t;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(jn(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(r(171))}if(t.tag===1){var i=t.type;if(jn(i))return mp(t,i,s)}return s}function Bh(t,s,i,u,p,g,w,_,D){return t=Ou(i,u,!0,t,p,g,w,_,D),t.context=Uh(null),i=t.current,u=kn(),p=ir(i),g=Ps(u,p),g.callback=s??null,nr(i,g,p),t.current.lanes=p,Tr(t,p,u),An(t,u),t}function qa(t,s,i,u){var p=s.current,g=kn(),w=ir(p);return i=Uh(i),s.context===null?s.context=i:s.pendingContext=i,s=Ps(g,w),s.payload={element:t},u=u===void 0?null:u,u!==null&&(s.callback=u),t=nr(p,s,w),t!==null&&(us(t,p,w,g),Ta(t,p,w)),w}function Xa(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Wh(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i<s?i:s}}function $u(t,s){Wh(t,s),(t=t.alternate)&&Wh(t,s)}function Pw(){return null}var Hh=typeof reportError=="function"?reportError:function(t){console.error(t)};function Pu(t){this._internalRoot=t}Ya.prototype.render=Pu.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(r(409));qa(t,s,null,null)},Ya.prototype.unmount=Pu.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;Mr(function(){qa(null,t,null,null)}),s[Ds]=null}};function Ya(t){this._internalRoot=t}Ya.prototype.unstable_scheduleHydration=function(t){if(t){var s=je();t={blockedOn:null,target:t,priority:s};for(var i=0;i<qs.length&&s!==0&&s<qs[i].priority;i++);qs.splice(i,0,t),i===0&&Rf(t)}};function zu(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Qa(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Vh(){}function zw(t,s,i,u,p){if(p){if(typeof u=="function"){var g=u;u=function(){var V=Xa(w);g.call(V)}}var w=Bh(s,u,t,0,null,!1,!1,"",Vh);return t._reactRootContainer=w,t[Ds]=w.current,Jo(t.nodeType===8?t.parentNode:t),Mr(),w}for(;p=t.lastChild;)t.removeChild(p);if(typeof u=="function"){var _=u;u=function(){var V=Xa(D);_.call(V)}}var D=Ou(t,0,!1,null,null,!1,!1,"",Vh);return t._reactRootContainer=D,t[Ds]=D.current,Jo(t.nodeType===8?t.parentNode:t),Mr(function(){qa(s,D,i,u)}),D}function Za(t,s,i,u,p){var g=i._reactRootContainer;if(g){var w=g;if(typeof p=="function"){var _=p;p=function(){var D=Xa(w);_.call(D)}}qa(s,w,t,p)}else w=zw(i,s,t,p,u);return Xa(w)}N=function(t){switch(t.tag){case 3:var s=t.stateNode;if(s.current.memoizedState.isDehydrated){var i=br(s.pendingLanes);i!==0&&(Gs(s,i|1),An(s,jt()),(et&6)===0&&(mo=jt()+500,er()))}break;case 13:Mr(function(){var u=$s(t,1);if(u!==null){var p=kn();us(u,t,1,p)}}),$u(t,1)}},B=function(t){if(t.tag===13){var s=$s(t,134217728);if(s!==null){var i=kn();us(s,t,134217728,i)}$u(t,134217728)}},te=function(t){if(t.tag===13){var s=ir(t),i=$s(t,s);if(i!==null){var u=kn();us(i,t,s,u)}$u(t,s)}},je=function(){return Ze},De=function(t,s){var i=Ze;try{return Ze=t,s()}finally{Ze=i}},Ft=function(t,s,i){switch(s){case"input":if(Te(t,i),s=i.name,i.type==="radio"&&s!=null){for(i=t;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<i.length;s++){var u=i[s];if(u!==t&&u.form===t.form){var p=ma(u);if(!p)throw Error(r(90));pe(u),Te(u,p)}}}break;case"textarea":Se(t,i);break;case"select":s=i.value,s!=null&&Tt(t,!!i.multiple,s,!1)}},kt=Ru,gt=Mr;var Fw={usingClientEntryPoint:!1,Events:[ni,to,ma,Et,Ht,Ru]},gi={findFiberByHostInstance:Cr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Uw={bundleType:gi.bundleType,version:gi.version,rendererPackageName:gi.rendererPackageName,rendererConfig:gi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:P.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=ys(t),t===null?null:t.stateNode},findFiberByHostInstance:gi.findFiberByHostInstance||Pw,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 Ja=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ja.isDisabled&&Ja.supportsFiber)try{kr=Ja.inject(Uw),On=Ja}catch{}}return In.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Fw,In.createPortal=function(t,s){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!zu(s))throw Error(r(200));return $w(t,s,null,i)},In.createRoot=function(t,s){if(!zu(t))throw Error(r(299));var i=!1,u="",p=Hh;return s!=null&&(s.unstable_strictMode===!0&&(i=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onRecoverableError!==void 0&&(p=s.onRecoverableError)),s=Ou(t,1,!1,null,null,i,!1,u,p),t[Ds]=s.current,Jo(t.nodeType===8?t.parentNode:t),new Pu(s)},In.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=ys(s),t=t===null?null:t.stateNode,t},In.flushSync=function(t){return Mr(t)},In.hydrate=function(t,s,i){if(!Qa(s))throw Error(r(200));return Za(null,t,s,!0,i)},In.hydrateRoot=function(t,s,i){if(!zu(t))throw Error(r(405));var u=i!=null&&i.hydratedSources||null,p=!1,g="",w=Hh;if(i!=null&&(i.unstable_strictMode===!0&&(p=!0),i.identifierPrefix!==void 0&&(g=i.identifierPrefix),i.onRecoverableError!==void 0&&(w=i.onRecoverableError)),s=Bh(s,null,t,1,i??null,p,!1,g,w),t[Ds]=s.current,Jo(t),u)for(t=0;t<u.length;t++)i=u[t],p=i._getVersion,p=p(i._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[i,p]:s.mutableSourceEagerHydrationData.push(i,p);return new Ya(s)},In.render=function(t,s,i){if(!Qa(s))throw Error(r(200));return Za(null,t,s,!1,i)},In.unmountComponentAtNode=function(t){if(!Qa(t))throw Error(r(40));return t._reactRootContainer?(Mr(function(){Za(null,null,t,!1,function(){t._reactRootContainer=null,t[Ds]=null})}),!0):!1},In.unstable_batchedUpdates=Ru,In.unstable_renderSubtreeIntoContainer=function(t,s,i,u){if(!Qa(i))throw Error(r(200));if(t==null||t._reactInternals===void 0)throw Error(r(38));return Za(t,s,i,!1,u)},In.version="18.3.1-next-f1338f8080-20240426",In}var Jh;function tv(){if(Jh)return Bu.exports;Jh=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Bu.exports=Yw(),Bu.exports}var em;function Qw(){if(em)return el;em=1;var e=tv();return el.createRoot=e.createRoot,el.hydrateRoot=e.hydrateRoot,el}var Zw=Qw();const Jw=ev(Zw),tm=e=>{let n;const r=new Set,o=(m,v)=>{const k=typeof m=="function"?m(n):m;if(!Object.is(k,n)){const y=n;n=v??(typeof k!="object"||k===null)?k:Object.assign({},n,k),r.forEach(S=>S(n,y))}},l=()=>n,f={setState:o,getState:l,getInitialState:()=>h,subscribe:m=>(r.add(m),()=>r.delete(m))},h=n=e(o,l,f);return f},e0=(e=>e?tm(e):tm),t0=e=>e;function n0(e,n=t0){const r=pt.useSyncExternalStore(e.subscribe,pt.useCallback(()=>n(e.getState()),[e,n]),pt.useCallback(()=>n(e.getInitialState()),[e,n]));return pt.useDebugValue(r),r}const s0=e=>{const n=e0(e),r=o=>n0(n,o);return Object.assign(r,n),r},r0=(e=>s0),nv="agentpane:machines",sv="agentpane:active-machine";function o0(e){return/^[a-z][a-z0-9-]{1,30}$/.test(e)}function rv(e){return`${e}.repoburg.com`}function ov(e){const n=/^([a-z][a-z0-9-]{1,30})\.repoburg\.com$/.exec(e);return n?n[1]:null}function iv(e,n){try{const r=localStorage.getItem(e);return r==null?n:JSON.parse(r)}catch{return n}}function av(e,n){try{localStorage.setItem(e,JSON.stringify(n))}catch{}}function i0(e){const{mahlas:n,hostname:r}=e??{};return typeof n=="string"&&o0(n)&&r===rv(n)}function lv(){const e=iv(nv,[]);return Array.isArray(e)?e.filter(i0):[]}function a0(e){const n={mahlas:e,hostname:rv(e),lastConnectedAt:new Date().toISOString()},r=lv(),o=[n,...r.filter(l=>l.mahlas!==e)];return av(nv,o),n}function l0(){const e=iv(sv,null);return e?lv().find(n=>n.mahlas===e)??null:null}function c0(e){av(sv,e)}function u0(){if(typeof window>"u")return;const e=new URLSearchParams(window.location.search).get("host");if(!e)return;const n=ov(e);n&&(a0(n),c0(n))}const nm="http://localhost:9998",d0=["agent.repoburg.com"];function bt(){if(typeof window>"u")return"";const e=new URLSearchParams(window.location.search),n=e.get("bport");if(n)return`http://localhost:${n}`;const r=e.get("host");if(r)return`https://${r}`;const o=window.location.hostname;if(d0.includes(o))return nm;if(ov(o))return"";const l=l0();return l?`https://${l.hostname}`:o==="localhost"||o==="127.0.0.1"||o==="0.0.0.0"?"":nm}function f0(e){const n=bt();return n?`${n.replace(/^http/,"ws")}${e}`:`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${e}`}const p0="/api";class Do extends Error{constructor(r,o,l){super(r);dt(this,"status");dt(this,"body");this.name="ApiError",this.status=o,this.body=l}}function js(e){var n;if(e instanceof Do){const r=(n=e.body)==null?void 0:n.error;if(typeof r=="string"&&r)return r}return e instanceof Error?e.message:String(e)}async function Wi(e,n,r){const o=await fetch(`${bt()}${p0}${n}`,{method:e,headers:r?{"Content-Type":"application/json"}:void 0,body:r?JSON.stringify(r):void 0});if(!o.ok){let l=`${o.status} ${o.statusText}`,c=null;try{c=await o.json();const d=c==null?void 0:c.error;typeof d=="string"&&d&&(l=`${l} — ${d}`)}catch{}throw new Do(`${e} ${n} failed: ${l}`,o.status,c)}return o.json()}function Nt(e){return Wi("GET",e)}function ot(e,n){return Wi("POST",e,n)}function ql(e){return Wi("DELETE",e)}function hs(e,n){return Wi("PATCH",e,n)}function h0(e,n){return Wi("PUT",e,n)}function m0(e){return`stream-text-${e}`}const ps=new Map;function Sl(e,n,r){return`${e}
42
+ ${n}
43
+ ${r}`}function g0(e,n,r,o){const l=Sl(e,n,r),c=ps.get(l);return c?(c.text+=o,c.text):(ps.set(l,{sessionId:e,turnId:n,itemId:r,text:o}),o)}function v0(e,n){for(const[o,l]of ps)(e===null||l.sessionId===e)&&ps.delete(o);const r=n.filter(o=>o&&typeof o.sessionId=="string"&&typeof o.turnId=="string"&&typeof o.itemId=="string"&&typeof o.text=="string");for(const o of r)ps.set(Sl(o.sessionId,o.turnId,o.itemId),{...o});return r}function Vu(e,n,r){var c;const o=r==null?void 0:r.external_item_id;if(!r||!o)return;const l=Sl(e,n,o);if(r.status==="in_progress"){const d=(c=r.data)==null?void 0:c.text;typeof d=="string"&&ps.set(l,{sessionId:e,turnId:n,itemId:o,text:d});return}ps.delete(l),r.type==="agent_message"&&ps.delete(Sl(e,n,m0(n)))}function yi(e,n){for(const[r,o]of ps)o.sessionId===e&&o.turnId===n&&ps.delete(r)}function cv(e,n,r){var f;const o=e.items??[];let l=-1;for(let h=o.length-1;h>=0;h--)if(o[h].external_item_id===n){l=h;break}if(l>=0){const h=o[l];if(h.status!=="in_progress"||((f=h.data)==null?void 0:f.text)===r)return e;const m=[...o];return m[l]={...h,data:{...h.data,text:r}},{...e,items:m,...h.type==="agent_message"?{agent_response:r}:{}}}const c=new Date().toISOString(),d={id:`delta-${n}`,turn_id:e.id,external_item_id:n,type:"agent_message",data:{text:r},status:"in_progress",created_at:c,updated_at:c};return{...e,items:[...o,d],agent_response:r}}function y0(e){var d;const n=[...ps.values()].filter(f=>f.sessionId===e.id);if(n.length===0)return e;const r=f=>{if(f.status!=="running")return f;let h=f;for(const m of n)m.turnId===f.id&&(h=cv(h,m.itemId,m.text));return h},o=(e.turns??[]).map(r),l=(d=e.threads)==null?void 0:d.map(f=>{const h=(f.turns??[]).map(r);return h.some((m,v)=>{var k;return m!==((k=f.turns)==null?void 0:k[v])})?{...f,turns:h}:f});return o.some((f,h)=>f!==e.turns[h])||(l==null?void 0:l.some((f,h)=>{var m;return f!==((m=e.threads)==null?void 0:m[h])}))?{...e,turns:o,...l?{threads:l}:{}}:e}function x0(){return Nt("/sessions")}function xi(e){return Nt(`/sessions/${e}?items=summary`).then(y0)}function w0(e,n){return Nt(`/sessions/${e}/turns/${n}`)}function Kd(e){return ot("/sessions",e)}function sm(e){return ql(`/sessions/${e}`)}function uv(e,n,r,o){return ot(`/sessions/${e}/turns`,{user_prompt:n,...r!=null&&r.length?{attachments:r}:{},...o!=null&&o.originAppId?{origin_app_id:o.originAppId}:{}})}function k0(e){return ot(`/sessions/${e}/cancel`)}function S0(e,n){return ot(`/sessions/${encodeURIComponent(e)}/tasks/${encodeURIComponent(n)}/stop`)}function b0(e,n){return ot(`/sessions/${e}/turns/${n}/resume`)}function N0(){return ot("/turns/resume-signed-out")}function T0(e,n){return hs(`/sessions/${e}`,{title:n})}function rm(e){return hs(`/sessions/${e}`,{lifecycle:"finished"})}function om(e){return hs(`/sessions/${e}`,{lifecycle:"working"})}function C0(e,n){return hs(`/sessions/${e}`,{starred:n})}function im(e){return hs(`/sessions/${e}`,{has_unreviewed:0})}function E0(e,n,r,o){const l={model:n,model_reasoning_effort:r};return o!==void 0&&(l.runtime_type=o),hs(`/sessions/${e}`,l)}function j0(e,n){return hs(`/sessions/${e}`,{runtime_config:n})}function _0(e,n){return ot(`/sessions/${e}/rewind`,{turn_id:n})}function R0(e){return ot(`/sessions/${e}/restore`,{})}function A0(e,n,r){return ot(`/sessions/${e}/branch`,{turn_id:n,title:r})}function dv(){return Nt("/workspaces")}function I0(e,n){return ot("/workspaces",{path:e,label:n})}function D0(e){return ot("/workspaces/hide",{path:e})}function M0(){return Nt("/workspaces/picker")}function am(e){return Nt(e?`/workspaces/browse?path=${encodeURIComponent(e)}`:"/workspaces/browse")}async function fv(){const e=await fetch(`${bt()}/api/pick-directory`);if(e.status===204)return{cancelled:!0};if(!e.ok)throw new Error(`GET /api/pick-directory failed: ${e.status} ${e.statusText}`);return e.json()}function pv(){return Nt("/folders")}function L0(e,n){return ot("/folders",{workspace_path:e,name:n})}function lm(e,n){return hs(`/folders/${e}`,n)}function O0(e){return ql(`/folders/${e}`)}function $0(e){return ot("/sessions/reorder",{moves:e})}function Ws(e){return e.status==="pending"||e.status==="running"}function hv(e){return!!(e!=null&&e.turns.some(Ws))}function Xl(e){return e?e.turns.some(Ws)||(e.threads??[]).some(n=>(n.turns??[]).some(Ws)):!1}const P0="s:",xd="a:",Ur=e=>`${P0}${e}`,Mi=e=>`${xd}${e}`;function gr(e){return{kind:e.startsWith(xd)?"app":"session",id:e.slice(xd.length)}}function Gd(e){return e.activeAppTabId!==null?Mi(e.activeAppTabId):e.activeSessionId===null?null:Ur(e.activeSessionId)}function mv(e,n,r){const o=[...n.map(Ur),...r.map(Mi)],l=new Set(o),c=e.filter(h=>l.has(h)),d=new Set(c),f=o.filter(h=>!d.has(h));return f.length===0&&c.length===e.length?e:[...c,...f]}function z0(e){return e.subscribe((n,r)=>{if(n.openTabs===r.openTabs&&n.openAppTabs===r.openAppTabs)return;const o=mv(n.tabOrder,n.openTabs,n.openAppTabs);o!==n.tabOrder&&e.setState({tabOrder:o})})}function cm(e,n,r){const o=e.indexOf(n);return e.slice(o+1).find(r)??e.slice(0,Math.max(o,0)).reverse().find(r)??null}function qd(e,n){const r=d=>!n.has(d),o=Gd(e);let{activeSessionId:l,activeAppTabId:c}=e;if(o!==null&&n.has(o)){const d=cm(e.tabOrder,o,r),f=d===null?null:gr(d);c=(f==null?void 0:f.kind)==="app"?f.id:null,(f==null?void 0:f.kind)==="session"&&(l=f.id)}if(l!==null&&n.has(Ur(l))){const d=h=>r(h)&&gr(h).kind==="session",f=cm(e.tabOrder,Ur(l),d);l=f===null?null:gr(f).id}return{activeSessionId:l,activeAppTabId:c}}function gv(e,n){if(e.tabOrder.includes(n))return!1;const{kind:r,id:o}=gr(n);return(r==="app"?e.apps:e.sessions).some(c=>c.id===o)}const vv=1;function yv(){let e="";try{e=bt()}catch{}return`agentpane:tabs:${e||window.location.origin}`}function Ku(e){return Array.isArray(e)&&e.every(n=>typeof n=="string")}function um(e){return e===null||typeof e=="string"}function F0(e){if(e==null)return null;let n;try{n=JSON.parse(e)}catch{return null}if(typeof n!="object"||n===null)return null;const r=n;return r.v!==vv||!Ku(r.openTabs)||!um(r.activeSessionId)||!Ku(r.openAppTabs)||!um(r.activeAppTabId)?null:{openTabs:r.openTabs,activeSessionId:r.activeSessionId,openAppTabs:r.openAppTabs,activeAppTabId:r.activeAppTabId,tabOrder:Ku(r.tabOrder)?r.tabOrder:[]}}const xv=[()=>window.sessionStorage,()=>window.localStorage];function U0(){const e=yv();for(const n of xv)try{const r=F0(n().getItem(e));if(r)return r}catch{}return null}function B0(e){const n=yv(),r=JSON.stringify({v:vv,openTabs:e.openTabs,activeSessionId:e.activeSessionId,openAppTabs:e.openAppTabs,activeAppTabId:e.activeAppTabId,tabOrder:e.tabOrder});for(const o of xv)try{o().setItem(n,r)}catch{}}function W0(e){return e.subscribe((n,r)=>{(n.openTabs!==r.openTabs||n.activeSessionId!==r.activeSessionId||n.openAppTabs!==r.openAppTabs||n.activeAppTabId!==r.activeAppTabId||n.tabOrder!==r.tabOrder)&&B0(n)})}function ji(e){return[...new Set(e)]}function H0(e,n,r,o){const l=v=>r===null||r.has(v),c=ji(((e==null?void 0:e.openTabs)??[]).filter(v=>n.has(v))),d=ji(((e==null?void 0:e.openAppTabs)??[]).filter(l));let f=(e==null?void 0:e.activeSessionId)??null;f!==null&&!n.has(f)&&(f=null),f!==null&&!c.includes(f)&&c.push(f),f??(f=c.at(-1)??null);let h=(e==null?void 0:e.activeAppTabId)??null;h!==null&&!l(h)&&(h=null),h!==null&&!d.includes(h)&&d.push(h),o!==null&&n.has(o)&&(c.includes(o)||c.push(o),f=o,h=null);const m=mv(ji((e==null?void 0:e.tabOrder)??[]),c,d);return{openTabs:c,activeSessionId:f,openAppTabs:d,activeAppTabId:h,tabOrder:m}}const Hs=new Map,Xd=new Map,Yl=new Map,bl=new Set,Yd=new Map,Ql=new Map;function V0(e,n,r=""){Hs.set(e,n),Xd.set(e,r)}function K0(e){Hs.delete(e),Xd.delete(e)}function fl(e,n){Yl.set(e,n)}function G0(e,n){n?bl.add(e):bl.delete(e)}function dm(e,n,r){const o=Yl.get(e);if(!o||bl.has(o))return;const l=Hs.get(o);l&&l({source:"agentpane-host",event:n,payload:r})}function fm(e,n){const r=Yl.get(e);if(!r||bl.has(r))return;const o=Hs.get(r);o&&o({source:"agentpane-host",event:"background_tasks",payload:{sessionId:e,tasks:n}})}function q0(e,n,r,o,l,c=null){if(typeof l=="string"&&l!==Xd.get(e))return;const d=Hs.get(e);d&&d({source:"agentpane-host",event:"tool_call",payload:{callId:n,tool:r,name:r,args:o,caller:c}})}function X0(e,n,r,o){const l=Yl.get(e);if(!l)return;const c=Hs.get(l);c&&c({source:"agentpane-host",event:"turn:delta",payload:{sessionId:e,turnId:n,itemId:r,delta:o}})}function Y0(e,n){Yd.set(e,n)}function Q0(e){Yd.delete(e)}function Z0(e,n){Ql.set(e,n)}function J0(e){Ql.delete(e)}function wv(e,n={}){const r=Ql.get(e);if(r){r(n);return}const o=Hs.get(e);o&&o({source:"agentpane-host",event:"state_changed",payload:{}})}function ek(){for(const e of new Set([...Hs.keys(),...Ql.keys()]))wv(e)}function tk(e){var r;const n=Hs.get(e);n&&n({source:"agentpane-host",event:"source:updated",payload:{}}),(r=Yd.get(e))==null||r()}const nk=(e,n)=>({wsConnected:!1,backgroundTasks:{},retryStates:{},signedOutTurns:{},setWsConnected:r=>e({wsConnected:r}),onTurnCreated:(r,o)=>{e(l=>{const c=l.sessionDetails[r];return!c||o.thread_id?{}:c.turns.some(d=>d.id===o.id)?{}:{sessionDetails:{...l.sessionDetails,[r]:{...c,turns:[...c.turns,{...o,items:[]}]}}}})},onTurnStarted:(r,o)=>{n().addLogEntry("DEBUG",`turn:started — ${o.slice(0,8)}`),e(l=>{const c=dr(l.sessions,r,()=>({is_running:1,status:"running"})),d=l.sessionDetails[r];if(!d)return{sessions:c};const f=d.turns.findIndex(h=>h.id===o);return{sessionDetails:{...l.sessionDetails,[r]:{...Sn(d,o,h=>({...h,status:"running"})),is_running:1,status:"running"}},sessions:c,activeTurnIndex:l.activeSessionId===r&&f>=0?f:l.activeTurnIndex}})},onItemStarted:(r,o,l)=>{n().addLogEntry("DEBUG",`item:started — ${l.type}`),e(c=>{const d=pm(l)?ur(c.retryStates,o):c.retryStates,f=c.sessionDetails[r];return f?{sessionDetails:{...c.sessionDetails,[r]:Sn(f,o,h=>qu(h,l))},retryStates:d}:{retryStates:d}})},onItemUpdated:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:Sn(d,o,f=>qu(f,l))}}:{}})},onItemCompleted:(r,o,l)=>{if(n().addLogEntry("DEBUG",`item:completed — ${l.type}`),l.type==="background_task"&&(l.status==="completed"||l.status==="failed")){const c=l.data||{},d=c.task_type||"unknown",f=c.description||"background task",m=d==="local_agent"?"Subagent":d==="local_bash"?"Monitor":"Task";l.status==="completed"?n().addToast("success",`${m} completed: ${f}`):c.status!=="stopped"&&n().addToast("error",`${m} failed: ${f}`)}e(c=>{const d=pm(l)?ur(c.retryStates,o):c.retryStates,f=c.sessionDetails[r];return f?{retryStates:d,sessionDetails:{...c.sessionDetails,[r]:Sn(f,o,h=>{var v,k;let m=qu(h,l);if(l.type==="agent_message"&&((v=l.data)!=null&&v.text)&&(m={...m,agent_response:l.data.text}),l.type==="reasoning"&&((k=l.data)!=null&&k.text)){const y=m.thoughts?m.thoughts+`
44
+ `+l.data.text:l.data.text;m={...m,thoughts:y}}return m})}}:{retryStates:d}})},onItemDelta:(r,o,l,c,d)=>{X0(r,o,l,c),e(f=>{const h=ur(f.retryStates,o),m=f.sessionDetails[r];return m?{sessionDetails:{...f.sessionDetails,[r]:Sn(m,o,v=>ik(v,l,c,d))},retryStates:h}:{retryStates:h}})},onItemText:(r,o,l,c)=>{e(d=>{const f=d.sessionDetails[r];if(!f)return{};const h=Sn(f,o,m=>m.status==="running"?cv(m,l,c):m);return{sessionDetails:{...d.sessionDetails,[r]:h}}})},onWidgetDelta:(r,o,l,c,d)=>{e(f=>{const h=ur(f.retryStates,o),m=f.sessionDetails[r];return m?{sessionDetails:{...f.sessionDetails,[r]:Sn(m,o,v=>ok(v,l,c,d))},retryStates:h}:{retryStates:h}})},onTurnCompleted:(r,o,l,c,d)=>{n().dropSignedOutTurn(o);const f=(l==null?void 0:l.input_tokens)??0,h=(l==null?void 0:l.output_tokens)??0;n().addLogEntry("INFO",`turn:completed — ${f} in / ${h} out`),dm(r,"turn:completed",{sessionId:r,turnId:o,response:d??null}),n().refreshApps(),e(m=>{const v=m.sessionDetails[r],k=v?Sn(v,o,C=>({...C,status:"completed",token_usage:l??C.token_usage??null,...d&&!C.agent_response?{agent_response:d}:{}})):null,y=Gu(k),S=y&&k?tl(k):"active",j=dr(m.sessions,r,C=>({is_running:y,status:S,has_unreviewed:c?1:C.has_unreviewed})),T=ur(m.retryStates,o);return k?{sessionDetails:{...m.sessionDetails,[r]:{...k,is_running:y,status:S,has_unreviewed:c?1:k.has_unreviewed}},sessions:j,retryStates:T}:{sessions:j,retryStates:T}})},onTokenUsageUpdated:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:Sn(d,o,f=>({...f,token_usage:l}))}}:{}})},onContextUsageUpdated:(r,o)=>{e(l=>{const c=l.sessionDetails[r];return c?{sessionDetails:{...l.sessionDetails,[r]:{...c,contextUsage:o}}}:{}})},onTurnFailed:(r,o,l,c)=>{n().dropSignedOutTurn(o),n().addLogEntry("ERROR",`turn:failed — ${l}`),n().addToast("error",`Turn failed — ${l}`),dm(r,"turn:failed",{sessionId:r,turnId:o,error:l}),e(d=>{const f=d.sessionDetails[r],h=l.includes("cancelled")||l.includes("aborted"),m=h?"aborted":"failed",v=f?Sn(f,o,T=>({...T,status:m,error:l,...c?{resume_state:c}:{},items:T.items.map(C=>C.status==="in_progress"?{...C,status:"failed"}:C)})):null,k=Gu(v),y=k&&v?tl(v):h?"active":"failed",S=dr(d.sessions,r,()=>({is_running:k,status:y})),j=ur(d.retryStates,o);return v?{sessionDetails:{...d.sessionDetails,[r]:{...v,is_running:k,status:y}},sessions:S,retryStates:j}:{sessions:S,retryStates:j}})},onTurnCancelled:(r,o)=>{n().dropSignedOutTurn(o),e(l=>{const c=l.sessionDetails[r],d=c?Sn(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,f=Gu(d),h=f&&d?tl(d):"active",m=dr(l.sessions,r,()=>({is_running:f,status:h})),v=ur(l.retryStates,o);return d?{sessionDetails:{...l.sessionDetails,[r]:{...d,is_running:f,status:h}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnInterrupted:(r,o,l)=>{n().addLogEntry("WARN",`turn:interrupted — ${l.reason}${l.detail?` (${l.detail})`:""}`),n().addToast("warn",sk(l.reason)),l.reason==="auth"?e(c=>({signedOutTurns:{...c.signedOutTurns,[o]:r}})):n().dropSignedOutTurn(o),e(c=>{const d=c.sessionDetails[r],f=d?Sn(d,o,k=>({...k,status:"pending",error:null,resume_state:"waiting",interrupt_reason:l.reason,interrupted_at:l.interruptedAt,resume_attempts:l.attempts,resume_at:l.resumeAt??null})):null,h=f?tl(f):"interrupted",m=dr(c.sessions,r,()=>({is_running:1,status:h})),v=ur(c.retryStates,o);return f?{sessionDetails:{...c.sessionDetails,[r]:{...f,is_running:1,status:h}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnResuming:(r,o,l)=>{n().dropSignedOutTurn(o),n().addLogEntry("INFO",`turn:resuming — ${o.slice(0,8)} (attempt ${l})`),e(c=>{const d=dr(c.sessions,r,()=>({is_running:1,status:"running"})),f=c.sessionDetails[r];return f?{sessionDetails:{...c.sessionDetails,[r]:{...Sn(f,o,h=>({...h,status:"running",error:null,resume_state:"resuming",resume_attempts:l})),is_running:1,status:"running"}},sessions:d}:{sessions:d}})},onTurnResumed:(r,o)=>{n().addLogEntry("INFO",`turn:resumed — ${o.slice(0,8)}`),n().addToast("success","Interrupted turn resumed"),e(l=>{const c=l.sessionDetails[r];return c?{sessionDetails:{...l.sessionDetails,[r]:Sn(c,o,d=>({...d,resume_state:"resumed"}))}}:{}})},onTurnRetrying:(r,o,l)=>{n().addLogEntry("WARN",`turn:retrying — ${r.slice(0,8)}/${o.slice(0,8)} attempt ${l.attempt}/${l.maxRetries} (${l.errorStatus??"no response"}${l.error?`, ${l.error}`:""})`),e(c=>({retryStates:{...c.retryStates,[o]:l}}))},onSessionTitle:(r,o)=>{e(l=>({sessions:l.sessions.map(c=>c.id===r?{...c,title:o}:c),sessionDetails:l.sessionDetails[r]?{...l.sessionDetails,[r]:{...l.sessionDetails[r],title:o}}:l.sessionDetails}))},onSessionTouched:r=>{e(o=>{const l=o.sessionDetails[r];return{sessions:dr(o.sessions,r,()=>({user_touched:1})),sessionDetails:l?{...o.sessionDetails,[r]:{...l,user_touched:1}}:o.sessionDetails}})},onSessionUpdated:r=>{const o={...r};delete o.is_running,delete o.status,e(l=>{const c=l.sessionDetails[r.id];return{sessions:dr(l.sessions,r.id,()=>o),sessionDetails:c?{...l.sessionDetails,[r.id]:{...c,...o}}:l.sessionDetails}})},onBackgroundTasksChanged:(r,o)=>{fm(r,o),e(l=>{if(o.length===0&&!l.backgroundTasks[r])return{};const c={...l.backgroundTasks};return o.length>0?c[r]=o:delete c[r],{backgroundTasks:c}})},onSignedOutTurnsSnapshot:r=>e({signedOutTurns:Object.fromEntries(r.map(o=>[o.turnId,o.sessionId]))}),dropSignedOutTurn:r=>{if(!(r in n().signedOutTurns))return;const o={...n().signedOutTurns};delete o[r],e({signedOutTurns:o})},onBackgroundTasksSnapshot:r=>{for(const[l,c]of Object.entries(r))fm(l,c);const o={};for(const[l,c]of Object.entries(r))c.length>0&&(o[l]=c);e({backgroundTasks:o})}});function sk(e){switch(e){case"network":return"Network error — the turn will resume when the connection is back";case"process_exit":return"The agent process stopped — resuming the turn";case"auth":return"Claude is signed out — the turn waits until you sign in again";case"usage_limit":return"Usage limit reached — the turn waits until it is over";default:return"The agent host restarted — resuming the turn"}}function tl(e){const n=[...e.turns,...(e.threads??[]).flatMap(r=>r.turns??[])].filter(Ws);return n.length>0&&n.every(r=>r.status==="pending"&&r.resume_state==="waiting")?"interrupted":"running"}function pm(e){return e.type!=="background_task"&&e.type!=="error"&&e.type!=="interruption"}function ur(e,n){if(!(n in e))return e;const r={...e};return delete r[n],r}function Gu(e){return e&&(e.turns.some(Ws)||(e.threads??[]).some(r=>(r.turns??[]).some(Ws)))?1:0}function dr(e,n,r){return e.some(o=>o.id===n)?e.map(o=>o.id===n?{...o,...r(o)}:o):e}function Sn(e,n,r){const o=(e.threads??[]).map(l=>(l.turns??[]).some(c=>c.id===n)?{...l,turns:(l.turns??[]).map(c=>c.id===n?r(c):c)}:l);return{...e,turns:e.turns.map(l=>l.id===n?r(l):l),threads:o}}function Qd(e,n){for(let r=e.length-1;r>=0;r--)if(e[r].external_item_id===n)return r;return-1}function qu(e,n){const r=Qd(e.items,n.external_item_id);if(r>=0){const c=[...e.items];return c[r]=n,{...e,items:c}}if(n.type==="agent_message"){const c=e.items.filter(d=>!(d.type==="agent_message"&&d.id.startsWith("delta-")));return{...e,items:[...c,n]}}const o=e.items;let l=o.length;if(e.deferred_item_count)for(;l>0&&o[l-1].created_at>n.created_at;)l--;return{...e,items:[...o.slice(0,l),n,...o.slice(l)]}}function rk(e,n){const r=c=>c.external_item_id??c.id,o=new Map(e.items.map(c=>[r(c),c])),l=n.map(c=>{var f;const d=o.get(r(c));return o.delete(r(c)),d&&((f=d.data)==null?void 0:f.partial)!==!0&&d.updated_at>c.updated_at?d:c});return{...e,items:[...l,...o.values()],deferred_item_count:0,deferred_tool_calls:0}}function ok(e,n,r,o){var f;const l=new Date().toISOString(),c=Qd(e.items,n);if(c>=0){const h=e.items[c];if(((f=h.data)==null?void 0:f.partial)!==!0||h.data.title===r&&h.data.html===o)return e;const m=[...e.items];return m[c]={...h,data:{...h.data,title:r,html:o},updated_at:l},{...e,items:m}}const d={id:`delta-${n}`,turn_id:e.id,external_item_id:n,type:"widget",data:{title:r,html:o,error:null,partial:!0},status:"in_progress",created_at:l,updated_at:l};return{...e,items:[...e.items,d]}}function ik(e,n,r,o){var d;const l=Qd(e.items,n);if(l>=0){const f=e.items[l],h=((d=f.data)==null?void 0:d.text)??"",m=o??h+r,v=[...e.items];return v[l]={...f,data:{...f.data,text:m}},{...e,items:v,agent_response:m}}const c={id:`delta-${n}`,turn_id:e.id,external_item_id:n,type:"agent_message",data:{text:o??r},status:"in_progress",created_at:new Date().toISOString(),updated_at:new Date().toISOString()};return{...e,items:[...e.items,c],agent_response:o??r}}function ak(){const e=new URLSearchParams(window.location.search);return{session:e.get("session"),thread:e.get("thread")}}function lk(){const e=new URL(window.location.href);!e.searchParams.has("session")&&!e.searchParams.has("thread")||(e.searchParams.delete("session"),e.searchParams.delete("thread"),window.history.replaceState(window.history.state,"",e))}let Xu=0;function hm(e){return e==="sidecar"?"sidecar":"turns"}async function ck(e,n){const r=await Promise.allSettled(e.map(c=>n(c))),o=new Map;let l=null;return r.forEach((c,d)=>{var f;c.status==="fulfilled"?o.set(e[d],c.value):l===null&&(l=((f=c.reason)==null?void 0:f.message)??"Request failed")}),{updated:o,firstError:l}}function uk(e,n){const r={...e.sessionDetails};n.forEach(h=>delete r[h]);const o={...e.backgroundTasks};n.forEach(h=>delete o[h]);const l=Object.fromEntries(Object.entries(e.signedOutTurns).filter(([,h])=>!n.has(h))),c=e.openTabs.filter(h=>!n.has(h)),d=qd(e,new Set([...n].map(Ur)));let f=e.activeTurnIndex;if(d.activeSessionId!==e.activeSessionId){const h=d.activeSessionId?r[d.activeSessionId]:null;f=h&&h.turns.length>0?h.turns.length-1:0}return{sessions:e.sessions.filter(h=>!n.has(h.id)),sessionDetails:r,backgroundTasks:o,signedOutTurns:l,openTabs:c,...d,activeTurnIndex:f}}function dk(e){const n={...e};return delete n.turns,delete n.threads,delete n.contextUsage,n}function mm(e,n,r){const o=n().activeSessionId;e(c=>uk(c,r));const l=n().activeSessionId;l&&l!==o&&n().selectSession(l,{keepAppView:!0})}async function gm(e,n,r,o,l){if(r.length===0)return;e({error:null});const{updated:c,firstError:d}=await ck(r,o);c.size>0&&e(h=>({sessions:h.sessions.map(m=>c.get(m.id)??m)}));const f=r.length-c.size;if(f===0)n().addToast("info",`${r.length} session${r.length===1?"":"s"} ${l}`);else{e({error:d});const h=l[0].toUpperCase()+l.slice(1);n().addToast(f===r.length?"error":"warn",`${h} ${c.size} of ${r.length} — ${f} failed`)}}const Yu=new Map,fk=(e,n)=>({sessions:[],sessionDetails:{},activeSessionId:null,openTabs:[],activeTurnIndex:0,submittingPrompt:null,quotedText:null,init:async()=>{const r=ak(),o=U0();try{const l=localStorage.getItem("agentpane:last-model-config");l&&e({lastModelConfig:JSON.parse(l)})}catch{}e({loading:!0,error:null});try{const l=n().loadApps(),[c,d,f]=await Promise.all([x0(),dv(),pv()]);e({sessions:c,workspaces:d,folders:f,loading:!1}),lk();const h=await l,m=H0(o,new Set(c.map(v=>v.id)),h?new Set(n().apps.map(v=>v.id)):null,r.session);e(v=>{const k=v.activeSessionId!==null||v.activeAppTabId!==null;return{openTabs:ji([...m.openTabs,...v.openTabs]),openAppTabs:ji([...m.openAppTabs,...v.openAppTabs]),tabOrder:m.tabOrder,activeAppTabId:k?v.activeAppTabId:m.activeAppTabId}}),m.activeSessionId&&!n().activeSessionId&&await n().selectSession(m.activeSessionId,{keepAppView:!0}),r.thread&&(e({deepLinkThreadId:r.thread}),n().switchRightTab("threads"))}catch(l){e({loading:!1,error:l.message})}},selectSession:async(r,o)=>{const l=++Xu,c=o!=null&&o.keepAppView?{}:{activeAppTabId:null},d=f=>f.includes(r)?f:[...f,r];if(n().sessionDetails[r]){const f=n().sessionDetails[r];e({activeSessionId:r,activeTurnIndex:f.turns.length>0?f.turns.length-1:0,activeRightTab:hm(n().activeRightTab),...c,openTabs:d(n().openTabs)}),f.has_unreviewed===1&&(im(r).catch(()=>{}),e(h=>({sessions:h.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...h.sessionDetails,[r]:{...f,has_unreviewed:0}}})));return}e({loading:!0,error:null});try{const f=await xi(r);if(l!==Xu){e(h=>({sessionDetails:{...h.sessionDetails,[r]:f},openTabs:d(h.openTabs),loading:!1}));return}e(h=>({sessionDetails:{...h.sessionDetails,[r]:f},activeSessionId:r,activeTurnIndex:f.turns.length>0?f.turns.length-1:0,activeRightTab:hm(h.activeRightTab),...c,openTabs:d(h.openTabs),loading:!1})),f.has_unreviewed===1&&(im(r).catch(()=>{}),e(h=>({sessions:h.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...h.sessionDetails,[r]:{...f,has_unreviewed:0}}})))}catch(f){e(l===Xu?{loading:!1,error:f.message}:{loading:!1})}},closeTab:r=>n().closeTabs([Ur(r)]),updateModelConfig:async(r,o,l)=>{const c=n().activeSessionId;if(c){e({error:null});try{const d=await E0(c,r,o,l),f={provider:d.runtime_type,model:d.model??"",reasoning:d.model_reasoning_effort??""};e({lastModelConfig:f}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(f)),e(h=>({sessions:h.sessions.map(m=>m.id===c?d:m),sessionDetails:h.sessionDetails[c]?{...h.sessionDetails,[c]:{...h.sessionDetails[c],model:d.model,model_reasoning_effort:d.model_reasoning_effort,external_thread_id:d.external_thread_id}}:h.sessionDetails})),await n().refreshActiveSession()}catch(d){e({error:d.message}),n().addToast("error",`Failed to update model — ${d.message}`)}}},createSession:async r=>{e({error:null});try{const o=await Kd(r);e(c=>({sessions:[o,...c.sessions],showNewSessionDialog:!1}));const l={provider:o.runtime_type,model:o.model??"",reasoning:o.model_reasoning_effort??""};e({lastModelConfig:l}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(l)),await n().selectSession(o.id),n().addLogEntry("INFO",`Session created — ${o.id.slice(0,8)}`),n().addToast("success",`Session created — ${o.title||o.id.slice(0,8)}`)}catch(o){e({error:o.message}),n().addToast("error",`Failed to create session — ${o.message}`)}},addSession:r=>{e(o=>({sessions:o.sessions.some(l=>l.id===r.id)?o.sessions:[r,...o.sessions]}))},revealSession:async r=>{let o=n().sessionDetails[r];if(!o){const l=await xi(r);e(c=>({sessionDetails:{...c.sessionDetails,[r]:l}})),o=l}n().sessions.some(l=>l.id===r)||n().addSession(dk(o)),await n().selectSession(r)},deleteSession:async r=>{var l;e({error:null});const o=(l=n().sessions.find(c=>c.id===r))==null?void 0:l.title;try{await sm(r),mm(e,n,new Set([r])),n().addLogEntry("INFO",`Session deleted — ${r.slice(0,8)}`),n().addToast("info",`Session "${o||r.slice(0,8)}" deleted`)}catch(c){e({error:c.message}),n().addToast("error",`Failed to delete session — ${c.message}`)}},renameSession:async(r,o)=>{e({error:null});try{const l=await T0(r,o.trim());e(c=>({sessions:c.sessions.map(d=>d.id===r?l:d),sessionDetails:c.sessionDetails[r]?{...c.sessionDetails,[r]:{...c.sessionDetails[r],title:l.title}}:c.sessionDetails}))}catch(l){e({error:l.message}),n().addToast("error",`Failed to rename session — ${l.message}`)}},markFinished:async r=>{e({error:null});try{const o=await rm(r);e(l=>({sessions:l.sessions.map(c=>c.id===r?o:c)})),n().addToast("info","Session marked as finished")}catch(o){e({error:o.message}),n().addToast("error",`Failed to mark as finished — ${o.message}`)}},markFinishedMany:async r=>{await gm(e,n,r,rm,"marked as finished")},toggleStar:async r=>{const o=n().sessions.find(l=>l.id===r);if(o){e({error:null});try{const l=await C0(r,o.starred?0:1);e(c=>({sessions:c.sessions.map(d=>d.id===r?l:d),sessionDetails:c.sessionDetails[r]?{...c.sessionDetails,[r]:{...c.sessionDetails[r],starred:l.starred}}:c.sessionDetails}))}catch(l){e({error:l.message}),n().addToast("error",`Failed to star session — ${l.message}`)}}},reopenSession:async r=>{e({error:null});try{const o=await om(r);e(l=>({sessions:l.sessions.map(c=>c.id===r?o:c)})),n().addToast("info","Session reopened")}catch(o){e({error:o.message}),n().addToast("error",`Failed to reopen session — ${o.message}`)}},reopenSessionMany:async r=>{await gm(e,n,r,om,"reopened")},deleteSessionMany:async r=>{if(r.length===0)return;e({error:null});const o=await Promise.allSettled(r.map(d=>sm(d))),l=new Set;if(o.forEach((d,f)=>{d.status==="fulfilled"&&l.add(r[f])}),l.size===0){e({error:"Failed to delete sessions"}),n().addToast("error","Failed to delete sessions");return}mm(e,n,l),n().addLogEntry("INFO",`${l.size} session${l.size===1?"":"s"} deleted`);const c=r.length-l.size;c===0?n().addToast("info",`${l.size} session${l.size===1?"":"s"} deleted`):(e({error:"One or more sessions failed to delete"}),n().addToast("warn",`Deleted ${l.size} of ${r.length} — ${c} failed`))},submitPrompt:async(r,o)=>{const l=n().activeSessionId;if(l){e({error:null,submittingPrompt:r}),e(c=>{const d=c.sessionDetails[l];return d?{sessionDetails:{...c.sessionDetails,[l]:{...d,is_running:1,status:"running"}},sessions:c.sessions.map(f=>f.id===l?{...f,is_running:1,status:"running"}:f)}:{}});try{const c=await uv(l,r,o);n().addLogEntry("INFO",`Turn submitted — "${r.slice(0,40)}"`),e(d=>{const f=d.sessionDetails[l];if(!f)return{submittingPrompt:null};const h=f.turns.findIndex(v=>v.id===c.id);if(h>=0)return{submittingPrompt:null,activeTurnIndex:h};const m={...c,items:[]};return{submittingPrompt:null,sessionDetails:{...d.sessionDetails,[l]:{...f,turns:[...f.turns,m]}},activeTurnIndex:f.turns.length}})}catch(c){e({submittingPrompt:null,error:c.message}),n().addLogEntry("ERROR",`Turn failed — ${c.message}`),n().addToast("error",`Failed to send prompt — ${c.message}`),e(d=>{const f=d.sessionDetails[l];if(!f)return{};const h=Xl(f)?1:0;return{sessionDetails:{...d.sessionDetails,[l]:{...f,is_running:h,status:h?"running":"active"}},sessions:d.sessions.map(m=>m.id===l?{...m,is_running:h,status:h?"running":"active"}:m)}})}}},cancelTurn:async()=>{const r=n().activeSessionId;if(r)try{await k0(r)}catch(o){e({error:o.message})}},rewindToTurn:async(r,o)=>{e({error:null});try{const l=await _0(r,o),c=await xi(r);e(d=>({sessionDetails:{...d.sessionDetails,[r]:c},sessions:d.sessions.map(f=>f.id===r?{...f,external_thread_id:l.external_thread_id,is_running:0,status:"active"}:f),activeTurnIndex:c.turns.length>0?c.turns.length-1:0})),n().addToast("info","Rewound to selected turn")}catch(l){e({error:l.message}),n().addToast("error",`Failed to rewind — ${l.message}`)}},restoreSession:async r=>{e({error:null});try{const o=await R0(r),l=await xi(r);e(c=>({sessionDetails:{...c.sessionDetails,[r]:l},sessions:c.sessions.map(d=>d.id===r?{...d,external_thread_id:o.external_thread_id,is_running:0,status:"active"}:d),activeTurnIndex:l.turns.length>0?l.turns.length-1:0})),n().addToast("info","Restored rewound session")}catch(o){e({error:o.message}),n().addToast("error",`Failed to restore — ${o.message}`)}},branchFromTurn:async(r,o,l)=>{e({error:null});try{const c=await A0(r,o,l);e(d=>({sessions:[c,...d.sessions]})),await n().selectSession(c.id),n().addToast("success","Branched from selected turn")}catch(c){e({error:c.message}),n().addToast("error",`Failed to branch — ${c.message}`)}},updateRuntimeConfig:async r=>{const o=n().activeSessionId;if(o){e({error:null});try{const l=await j0(o,JSON.stringify(r));e(c=>({sessions:c.sessions.map(d=>d.id===o?l:d),sessionDetails:c.sessionDetails[o]?{...c.sessionDetails,[o]:{...c.sessionDetails[o],runtime_config:l.runtime_config}}:c.sessionDetails}))}catch(l){e({error:l.message}),n().addToast("error",`Failed to update config — ${l.message}`)}}},refreshActiveSession:async()=>{const r=n().activeSessionId;if(r)try{const o=await xi(r);e(l=>({sessionDetails:{...l.sessionDetails,[r]:o},activeTurnIndex:o.turns.length>0?Math.min(l.activeTurnIndex,o.turns.length-1):0,sessions:l.sessions.map(c=>c.id===r?{...c,is_running:o.is_running,status:o.status}:c)}))}catch(o){e({error:o.message})}},loadDeferredItems:(r,o)=>{const l=Yu.get(o);if(l)return l;const c=w0(r,o).then(({items:d})=>(e(f=>{const h=f.sessionDetails[r];return h?{sessionDetails:{...f.sessionDetails,[r]:Sn(h,o,m=>rk(m,d))}}:{}}),!0)).catch(d=>(n().addToast("error",`Failed to load tool calls — ${d.message}`),!1)).finally(()=>Yu.delete(o));return Yu.set(o,c),c}});async function pk(e){const{sessions:n}=await Nt(`/claude-sessions?workspace=${encodeURIComponent(e)}`);return n}function hk(e,n){return ot(`/claude-sessions/${encodeURIComponent(e)}/import`,{workspace:n})}async function mk(e){const{sessions:n}=await Nt(`/codex-sessions?workspace=${encodeURIComponent(e)}`);return n}function gk(e,n){return ot(`/codex-sessions/${encodeURIComponent(e)}/import`,{workspace:n})}const wd=["claude","codex"],Zl={claude:"Claude Code",codex:"Codex"};function Qu(e){return`${e.runtime}:${e.id}`}function kv(e){const n=e.length===1?"session":"sessions";return new Set(e).size===1?`${e.length} ${Zl[e[0]]} ${n}`:`${e.length} ${n}`}const vk={claude:e=>pk(e),codex:e=>mk(e)},yk={claude:(e,n)=>hk(e,n),codex:(e,n)=>gk(e,n)};async function Sv(e){const n=await Promise.allSettled(wd.map(l=>vk[l](e))),r=[],o={};return n.forEach((l,c)=>{const d=wd[c];l.status==="fulfilled"?r.push(...l.value.map(f=>({...f,runtime:d}))):o[d]=js(l.reason)}),r.sort((l,c)=>l.last_modified<c.last_modified?1:l.last_modified>c.last_modified?-1:0),{sessions:r,errors:o}}function xk(e,n){return yk[e.runtime](e.id,n)}const vm={available:!0,reason:null};let Zu=null;const wk=(e,n)=>({workspaces:[],pickerSupport:null,loadPickerSupport:()=>{const r=n().pickerSupport;return r?Promise.resolve(r):(Zu??(Zu=M0().then(o=>typeof(o==null?void 0:o.available)!="boolean"?vm:(e({pickerSupport:o}),o)).catch(()=>vm).finally(()=>{Zu=null})),Zu)},createWorkspaceAt:async r=>{const o=await I0(r.trim());return e(l=>({workspaces:[...l.workspaces.filter(c=>c.id!==o.id),o]})),o},addWorkspace:async r=>{e({error:null});try{const o=await n().createWorkspaceAt(r);return n().addToast("success",`Workspace added — ${o.path}`),o}catch(o){return n().addToast("error",`Failed to add workspace — ${js(o)}`),null}},removeWorkspace:async r=>{e({error:null});try{await D0(r);const o=await dv();e({workspaces:o}),n().addToast("info","Workspace hidden")}catch(o){n().addToast("error",`Failed to hide workspace — ${o.message}`)}},createSessionInWorkspace:async r=>{e({error:null});try{const o=n().lastModelConfig,l=await Kd({cwd:r,runtime_type:(o==null?void 0:o.provider)??"codex",model:o==null?void 0:o.model,model_reasoning_effort:o==null?void 0:o.reasoning});e(c=>({sessions:[l,...c.sessions]})),await n().selectSession(l.id),n().addLogEntry("INFO",`Session created in ${r} — ${l.id.slice(0,8)}`),n().addToast("success",`Session created in ${r.split("/").pop()||r}`)}catch(o){e({error:o.message}),n().addToast("error",`Failed to create session — ${o.message}`)}},pickAndAddWorkspace:async()=>{if(!(await n().loadPickerSupport()).available){n().setShowAddWorkspaceDialog(!0);return}try{const o=await fv();if(o.cancelled||!o.path)return;await n().addWorkspace(o.path)}catch(o){n().addToast("error",`Failed to pick directory — ${o.message}`)}},importSessions:async(r,o)=>{const l=[],c=[],d=[];for(const f of[...o].reverse())try{l.unshift(await xk(f,r)),c.unshift(f.runtime)}catch(h){d.unshift({...f,error:js(h)})}if(l.length>0){e(h=>({sessions:[...l,...h.sessions]})),await n().selectSession(l[0].id);const f=kv(c);n().addLogEntry("INFO",`Imported ${f} into ${r}`),n().addToast("success",l.length===1?`Imported — ${l[0].title||`${Zl[c[0]]} session`}`:`Imported ${f}`)}return{imported:l,failed:d}}});function bv(e,n){const r=n?`?cwd=${encodeURIComponent(n)}`:"";return Nt(`/providers/${encodeURIComponent(e)}/models${r}`)}const ym="curl -fsSL https://repoburg.com/install.sh | bash",kk=2e3,Nv="agentpane:daemon-seen";function Sk(e=bt()){if(!e)return!1;try{const n=new URL(e);return n.protocol==="http:"&&(n.hostname==="localhost"||n.hostname==="127.0.0.1")}catch{return!1}}async function bk(e=bt()){try{return await fetch(`${e}/health`,{mode:"no-cors",cache:"no-store"}),!0}catch{return!1}}function Nk(){try{return localStorage.getItem(Nv)==="true"}catch{return!1}}function Tk(){try{localStorage.setItem(Nv,"true")}catch{}}function Ck(e){let n=!1,r=!1,o=!1,l=null;function c(){l!==null&&(clearTimeout(l),l=null)}async function d(){if(n||r)return;c(),r=!0;const m=await bk();if(r=!1,!n){if(m){Tk(),h(),e.onReady();return}o||(o=!0,e.onMissing()),l=setTimeout(()=>void d(),kk)}}function f(){document.visibilityState==="visible"&&d()}function h(){n=!0,c(),window.removeEventListener("focus",f),document.removeEventListener("visibilitychange",f)}return window.addEventListener("focus",f),document.addEventListener("visibilitychange",f),d(),h}const kd=160,Sd=480,Ek=240,Nl=220,jk=300,_k=600,Rk=36;function Tv(e,n){return n?`${e}
45
+ ${n}`:e}function Tl(){return typeof window>"u"?_k:Math.max(Nl,Math.round(window.innerWidth*.7))}const xm="agentpane:sidebar-width",wm="agentpane:right-panel-width",Ju="agentpane:right-panel-collapsed";function km(e,n,r,o){try{const l=localStorage.getItem(e);if(l==null)return o;const c=Number(l);return Number.isFinite(c)?Math.min(r,Math.max(n,c)):o}catch{return o}}function Ak(e){try{return localStorage.getItem(e)==="true"}catch{return!1}}function Sm(e,n){try{localStorage.setItem(e,String(n))}catch{}}const bm=200,Ik=(e,n)=>({activeRightTab:"turns",eventLog:[],loading:!1,error:null,showNewSessionDialog:!1,showAddWorkspaceDialog:!1,importSessionsWorkspace:null,showRemoteModal:!1,toasts:[],showCommandPalette:!1,lastModelConfig:null,modelLists:{},modelsLoading:{},showModelSelector:!1,sidebarWidth:km(xm,kd,Sd,Ek),rightPanelWidth:km(wm,Nl,Tl(),jk),rightPanelCollapsed:Ak(Ju),deepLinkThreadId:null,vscodeViewOpen:!1,vscodeState:"stopped",vscodeId:null,vscodeToken:null,usageViewOpen:!1,terminalViewOpen:!1,canGoBack:!1,canGoForward:!1,daemonStatus:Sk()?"checking":"ready",setActiveTurnIndex:r=>e({activeTurnIndex:r}),switchRightTab:r=>{n().rightPanelCollapsed&&Sm(Ju,!1),e({activeRightTab:r,rightPanelCollapsed:!1})},setShowNewSessionDialog:r=>e({showNewSessionDialog:r}),setShowAddWorkspaceDialog:r=>e({showAddWorkspaceDialog:r}),setImportSessionsWorkspace:r=>e({importSessionsWorkspace:r}),setShowRemoteModal:r=>e({showRemoteModal:r}),setShowCommandPalette:r=>e({showCommandPalette:r}),setShowModelSelector:r=>e({showModelSelector:r}),setDeepLinkThreadId:r=>e({deepLinkThreadId:r}),setSidebarWidth:r=>{const o=Math.min(Sd,Math.max(kd,Math.round(r)));e({sidebarWidth:o});try{localStorage.setItem(xm,String(o))}catch{}},setRightPanelWidth:r=>{const o=Math.min(Tl(),Math.max(Nl,Math.round(r)));e({rightPanelWidth:o});try{localStorage.setItem(wm,String(o))}catch{}},setRightPanelCollapsed:r=>{e({rightPanelCollapsed:r}),Sm(Ju,r)},toggleRightPanel:()=>n().setRightPanelCollapsed(!n().rightPanelCollapsed),toggleVscodeView:()=>{if(n().vscodeViewOpen){e({vscodeViewOpen:!1});return}e({vscodeViewOpen:!0,terminalViewOpen:!1,vscodeState:"starting",vscodeId:null,vscodeToken:null})},setVscodeView:(r,o,l)=>e({vscodeState:r,vscodeId:o,vscodeToken:l}),toggleUsageView:()=>e({usageViewOpen:!n().usageViewOpen,terminalViewOpen:!1}),toggleTerminalView:()=>e(n().terminalViewOpen?{terminalViewOpen:!1}:{terminalViewOpen:!0,vscodeViewOpen:!1,usageViewOpen:!1}),setDaemonStatus:r=>e({daemonStatus:r}),addToast:(r,o,l,c)=>{const d=Math.random().toString(36).slice(2,9);e(f=>({toasts:[...f.toasts,{id:d,type:r,message:o,undoAction:l,undoLabel:c}]}))},removeToast:r=>{e(o=>({toasts:o.toasts.filter(l=>l.id!==r)}))},addLogEntry:(r,o)=>{const l=new Date().toLocaleTimeString("en-GB",{hour12:!1});e(c=>{const d=[...c.eventLog,{time:l,level:r,message:o}];return d.length>bm&&d.splice(0,d.length-bm),{eventLog:d}})},loadModels:async(r,o)=>{const l=Tv(r,o);if(!n().modelsLoading[l]){e(c=>({modelsLoading:{...c.modelsLoading,[l]:!0}}));try{const c=await bv(r,o);c.length>0&&e(d=>({modelLists:{...d.modelLists,[l]:c}}))}catch{}finally{e(c=>{const d={...c.modelsLoading};return delete d[l],{modelsLoading:d}})}}}}),Dk=(e,n)=>({createThread:async(r,o)=>{try{await ot(`/sessions/${r}/threads`,o),n().addLogEntry("INFO",`Thread created — "${o.message.slice(0,40)}"`)}catch(l){n().addToast("error",`Failed to create thread — ${l.message}`)}},followupThread:async(r,o,l)=>{try{await ot(`/sessions/${r}/threads/${o}/followup`,{message:l}),n().addLogEntry("INFO",`Thread follow-up — "${l.slice(0,40)}"`)}catch(c){n().addToast("error",`Failed to send follow-up — ${c.message}`)}},cancelThreadTurn:async(r,o)=>{try{await ot(`/sessions/${r}/cancel?threadId=${encodeURIComponent(o)}`),n().addLogEntry("INFO","Thread turn cancelled")}catch(l){n().addToast("error",`Failed to cancel thread turn — ${l.message}`)}},resolveThread:async(r,o)=>{try{await hs(`/sessions/${r}/threads/${o}`,{status:"resolved"})}catch(l){n().addToast("error",`Failed to resolve thread — ${l.message}`)}},reopenThread:async(r,o)=>{try{await hs(`/sessions/${r}/threads/${o}`,{status:"open"})}catch(l){n().addToast("error",`Failed to reopen thread — ${l.message}`)}},shareThread:async(r,o,l)=>{try{const c=await ot(`/sessions/${r}/threads/${o}/summarize`,{directives:l}),d=`
46
+ [Shared from a resolved discussion thread — summary of its findings]
47
+
48
+ \`\`\`QUOTE
49
+ ${c.summary}
50
+ \`\`\`
51
+
52
+ `;return e({quotedText:d}),n().addLogEntry("INFO",`Thread shared to main session — "${c.summary.slice(0,40)}"`),n().addToast("success","Thread summary added to your input"),!0}catch(c){return n().addToast("error",`Failed to share thread — ${c.message}`),!1}},deleteThread:async(r,o)=>{try{await ql(`/sessions/${r}/threads/${o}`)}catch(l){n().addToast("error",`Failed to delete thread — ${l.message}`)}},askSidecar:async(r,o)=>{try{return await ot(`/sessions/${r}/sidecar`,{message:o}),n().addLogEntry("INFO",`Sidecar asked — "${o.slice(0,40)}"`),!0}catch(l){return n().addToast("error",`Failed to ask the sidecar — ${l.message}`),!1}},onThreadCreated:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:[...d.threads??[],{...o,turns:[{...l,items:[]}]}]}}}:{}})},onThreadFollowup:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:(d.threads??[]).map(f=>f.id===o?{...f,turns:[...f.turns??[],{...l,items:[]}]}:f)}}}:{}})},onThreadResolved:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];if(!d)return{};const f=(d.threads??[]).map(h=>h.id===o?{...h,status:l,resolved_at:l==="resolved"?new Date().toISOString():null}:h);return{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:f}}}})},onThreadDeleted:(r,o)=>{e(l=>{const c=l.sessionDetails[r];return c?{sessionDetails:{...l.sessionDetails,[r]:{...c,threads:(c.threads??[]).filter(d=>d.id!==o)}}}:{}})}}),Mk=(e,n)=>({folders:[],loadFolders:async()=>{const r=await pv();e({folders:r})},createSidebarFolder:async(r,o)=>{try{const l=await L0(r,o);return e(c=>({folders:[...c.folders,l]})),l}catch(l){return n().addToast("error",`Failed to create folder — ${l.message}`),null}},renameFolder:async(r,o)=>{try{const l=await lm(r,{name:o});e(c=>({folders:c.folders.map(d=>d.id===r?l:d)}))}catch(l){n().addToast("error",`Failed to rename folder — ${l.message}`)}},deleteFolder:async r=>{const o=n().folders,l=n().sessions;e(c=>({folders:c.folders.filter(d=>d.id!==r),sessions:c.sessions.map(d=>d.folder_id===r?{...d,folder_id:null}:d)}));try{await O0(r)}catch(c){e({folders:o,sessions:l}),n().addToast("error",`Failed to delete folder — ${c.message}`)}},applyMoves:async r=>{if(r.length===0)return;const o=n().sessions,l=new Map(r.map(c=>[c.id,c]));e(c=>({sessions:c.sessions.map(d=>{const f=l.get(d.id);return f?{...d,folder_id:f.folder_id,sort_order:f.sort_order}:d})}));try{await $0(r)}catch(c){e({sessions:o}),n().addToast("error",`Failed to save session order — ${c.message}`)}},reorderFolders:async r=>{const o=n().folders,l=new Map(r.map((c,d)=>[c,d]));e(c=>({folders:c.folders.map(d=>l.has(d.id)?{...d,sort_order:l.get(d.id)}:d)}));try{await Promise.all(r.map((c,d)=>lm(c,{sort_order:d})))}catch(c){e({folders:o}),n().addToast("error",`Failed to save folder order — ${c.message}`)}}});function Nm(){return Nt("/apps")}function Lk(){return Nt("/apps/root")}function Tm(e){return Nt(`/apps/${e}/source`)}function Cm(e,n=""){return Nt(`/apps/${e}/state?workspace=${encodeURIComponent(n)}`)}function Cv(e,n,r=""){return h0(`/apps/${e}/state?workspace=${encodeURIComponent(r)}`,n)}function Ok(e){return ql(`/apps/${e}`)}function $k(e){return Nt(`/apps/${e}/sessions`)}async function Em(e,n){try{return await Nt(`/apps/${e}/sessions/${encodeURIComponent(n)}`)}catch(r){if(r instanceof Do&&r.status===404)return null;throw r}}function Pk(e,n,r={}){const o=new URLSearchParams({workspace:n});return r.lifecycle&&o.set("lifecycle",r.lifecycle),typeof r.running=="boolean"&&o.set("running",String(r.running)),Nt(`/apps/${e}/workspace-sessions?${o}`)}async function zk(e,n,r){try{return await Nt(`/apps/${e}/workspace-sessions/${encodeURIComponent(r)}?workspace=${encodeURIComponent(n)}`)}catch(o){if(o instanceof Do&&o.status===404)return null;throw o}}function Fk(e,n){return ot(`/apps/${e}/sessions/${encodeURIComponent(n)}/cancel`)}function Uk(e,n,r){return hs(`/apps/${e}/sessions/${encodeURIComponent(n)}`,{lifecycle:r})}async function Bk(e,n,r,o){const l=await ot("/apps/mcp/call",{tool:`${e}__${r}`,args:o,workspace:n});if(!l.ok)throw new Error(l.error||`callTool: ${r} failed`);return l.result}function Wk(){return Nt("/apps/examples")}function Hk(e){return ot(`/apps/examples/${e}/install`,{})}function Vk(e){return ot("/apps",e)}async function Ev(e,n){let r=`${e.status} ${e.statusText}`,o=null;try{o=await e.json();const l=o==null?void 0:o.error;typeof l=="string"&&l&&(r=`${r} — ${l}`)}catch{}throw new Do(`${n} failed: ${r}`,e.status,o)}async function Kk(e,n,r={}){const o=new URLSearchParams({id:e});r.data&&o.set("data","1");const l=await fetch(`${bt()}/api/apps/import?${o}`,{method:"POST",headers:{"Content-Type":"application/zip"},body:n});return l.ok||await Ev(l,"Import"),await l.json()}async function Gk(e,n={}){const r=n.data?"?data=1":"",o=await fetch(`${bt()}/api/apps/${encodeURIComponent(e)}/export${r}`);return o.ok||await Ev(o,"Export"),o.blob()}function qk(e,n,r){return ot(`/apps/mcp/calls/${e}/result`,{result:n,error:null})}function Xk(e,n){return ot(`/apps/${e}/edit-session`,n)}function Yk(e,n){return ot(`/apps/${e}/files`,n)}async function Qk(e,n){const r=await fetch(`${bt()}/api/apps/${e}/files/${encodeURIComponent(n)}/meta`);if(r.status===404)return null;if(!r.ok)throw new Error(`GET /apps/${e}/files/${n}/meta failed: ${r.status} ${r.statusText}`);return await r.json()}async function Zk(e,n){const r=await fetch(`${bt()}/api/apps/${e}/files/${encodeURIComponent(n)}`);if(!r.ok)throw new Error(`GET /apps/${e}/files/${n} failed: ${r.status} ${r.statusText}`);return r.blob()}const pl=new Set;async function ed(e,n){pl.add(n),await e().loadApps();const r=e().apps.find(o=>o.id===n);e().openAppTab(n),e().addToast("success",`Mini app added: ${(r==null?void 0:r.title)??n}`)}const bd="agentpane:app-workspaces";function Jk(){try{const e=JSON.parse(localStorage.getItem(bd)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}const e1=(e,n)=>({apps:[],appsRootPath:null,openAppTabs:[],activeAppTabId:null,appCatalogOpen:!1,appExportId:null,appWorkspaces:Jk(),loadApps:async()=>{try{const[r,o]=await Promise.all([Nm(),Lk().catch(()=>null)]);return r.forEach(l=>pl.add(l.id)),e(o?{apps:r,appsRootPath:o.root}:{apps:r}),!0}catch{return!1}},refreshApps:async()=>{try{const r=await Nm();for(const o of r)pl.has(o.id)||(pl.add(o.id),n().addToast("success",`New mini app discovered: ${o.title}`));e({apps:r})}catch{}},openAppTab:r=>{e(o=>({activeAppTabId:r,openAppTabs:o.openAppTabs.includes(r)?o.openAppTabs:[...o.openAppTabs,r]}))},closeAppTab:r=>n().closeTabs([Mi(r)]),setActiveAppTab:r=>e({activeAppTabId:r}),openAppCatalog:()=>e({appCatalogOpen:!0}),closeAppCatalog:()=>e({appCatalogOpen:!1}),setAppWorkspace:(r,o)=>{e(l=>{const c={...l.appWorkspaces,[r]:o};try{localStorage.setItem(bd,JSON.stringify(c))}catch{}return{appWorkspaces:c}})},installExampleApp:async r=>{try{return await Hk(r),await ed(n,r),!0}catch(o){return n().addToast("error",`Failed to install app — ${o.message}`),!1}},createSkeletonApp:async r=>{try{return await Vk(r),await ed(n,r.id),!0}catch(o){return n().addToast("error",`Failed to create app — ${o.message}`),!1}},importAppZip:async(r,o,l)=>{try{const c=await Kk(r,o,l);if(await ed(n,r),c.data){const{instances:d,files:f}=c.data;n().addToast("success",`Imported ${r} with its data: ${d} state instance${d===1?"":"s"}, ${f} file${f===1?"":"s"}`)}return!0}catch(c){return n().addToast("error",`Failed to import app — ${js(c)}`),!1}},openAppExport:r=>e({appExportId:r}),closeAppExport:()=>e({appExportId:null}),exportApp:async(r,o)=>{try{const l=await Gk(r,o),c=URL.createObjectURL(l),d=document.createElement("a");return d.href=c,d.download=`${r}.zip`,document.body.appendChild(d),d.click(),d.remove(),setTimeout(()=>URL.revokeObjectURL(c),1e4),!0}catch(l){return n().addToast("error",`Failed to export app — ${js(l)}`),!1}},startAppEdit:async r=>{try{const o=n().lastModelConfig,l=await Xk(r,{runtime_type:o==null?void 0:o.provider,model:(o==null?void 0:o.model)??null,model_reasoning_effort:(o==null?void 0:o.reasoning)??null});n().sessions.some(c=>c.id===l.id)||e(c=>({sessions:[l,...c.sessions]})),await n().selectSession(l.id),n().addLogEntry("INFO",`App edit session opened for ${r}`)}catch(o){n().addToast("error",`Failed to open app edit session — ${o.message}`)}},toggleAppPin:async r=>{const o=n().apps.find(l=>l.id===r);if(o)try{await Cv(r,{pinned:!o.pinned}),await n().loadApps()}catch(l){n().addToast("error",`Failed to pin app — ${l.message}`)}},deleteApp:async r=>{try{await Ok(r);const o=n().activeSessionId;e(c=>{const d={...c.appWorkspaces};delete d[r];try{localStorage.setItem(bd,JSON.stringify(d))}catch{}return{apps:c.apps.filter(f=>f.id!==r),openAppTabs:c.openAppTabs.filter(f=>f!==r),...qd(c,new Set([Mi(r)])),appWorkspaces:d}});const l=n().activeSessionId;l&&l!==o&&n().selectSession(l,{keepAppView:!0}),n().addToast("success",`Mini app deleted: ${r}`)}catch(o){n().addToast("error",`Failed to delete app — ${o.message}`)}}}),t1=(e,n)=>({tabOrder:[],closedTabs:[],moveTab:(r,o)=>{const l=[...n().tabOrder],c=l.indexOf(r),d=l.indexOf(o);c===-1||d===-1||c===d||(l.splice(d,0,...l.splice(c,1)),e({tabOrder:l}))},closeTabs:r=>{const o=n(),l=new Set(r.filter(h=>o.tabOrder.includes(h)));if(l.size===0)return;const c=qd(o,l),d=o.tabOrder.map((h,m)=>({key:h,index:m})).filter(h=>l.has(h.key)).reverse();e({...c,openTabs:o.openTabs.filter(h=>!l.has(Ur(h))),openAppTabs:o.openAppTabs.filter(h=>!l.has(Mi(h))),tabOrder:o.tabOrder.filter(h=>!l.has(h)),closedTabs:[...o.closedTabs,...d].slice(-20)});const f=c.activeSessionId;f!==null&&f!==o.activeSessionId&&n().selectSession(f,{keepAppView:!0})},reopenClosedTab:()=>{const r=n(),o=[...r.closedTabs];let l=o.pop();for(;l&&!gv(r,l.key);)l=o.pop();if(!l){e({closedTabs:[]});return}const c=[...r.tabOrder];c.splice(l.index,0,l.key);const{kind:d,id:f}=gr(l.key);d==="app"?(e({closedTabs:o,tabOrder:c,openAppTabs:[...r.openAppTabs,f]}),n().openAppTab(f)):(e({closedTabs:o,tabOrder:c,openTabs:[...r.openTabs,f]}),n().selectSession(f))}}),jm=3e3,Bn={lagMs:100,longtaskBufferMs:50,longtaskLogMs:100,eventBufferMs:50,eventLogMs:100,keypressMs:100,wsPerSecLog:15,storePerSecLog:15,renderPerSecLog:6,frameGapMs:150},Wn=[];let Cl=0,Zd=0,El=0,Jd=0,jl=0,ef=0,tf=0;const Li=new Map,Oi=new Map;let jo=new Map,Co=0,_o=new Map,td=!1;function _l(e,n,r){if(Wn.push({t:Date.now(),cat:e,msg:n,ms:r}),Wn.length>jm){const o=Wn.length-jm;Wn.splice(0,o),Dn=Math.max(0,Dn-o)}}function Eo(e,n,r){_l(e,n,r),console.log(`[perf:${e}] ${n}`)}function jv(e){Eo("note",e)}function _v(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function n1(e,n){let r=jo.get(e);r||jo.set(e,r={n:0,bytes:0}),r.n++,r.bytes+=n;let o=Li.get(e);o||Li.set(e,o={n:0,bytes:0}),o.n++,o.bytes+=n}function s1(){Co++,tf++}function r1(e){_o.set(e,(_o.get(e)??0)+1),Oi.set(e,(Oi.get(e)??0)+1)}let hl=0;function o1(){hl=performance.now()}function i1(){const e=performance.now(),n=hl?e-hl:null;hl=0,requestAnimationFrame(()=>{if(n===null)return;const r=performance.now()-e+n;r>Bn.keypressMs&&Eo("input",`keystroke→paint ${Math.round(r)}ms (keydown→change ${Math.round(n)}ms, change→paint ${Math.round(performance.now()-e)}ms)`)})}const a1=5e3,Rv=500,_m=2e3;let Dn=0,nd=!1;function l1(e){return ot("/perf-log",{entries:e}).then(()=>{Dn+=e.length})}function c1(){if(nd||Dn>=Wn.length)return;const e=Wn.slice(Dn,Dn+Rv);e.length!==0&&(nd=!0,l1(e).catch(()=>{Wn.length-Dn>_m&&(Dn=Math.max(Dn,Wn.length-_m))}).finally(()=>{nd=!1}))}function Rm(){if(typeof navigator>"u"||typeof navigator.sendBeacon!="function"||Dn>=Wn.length)return;const e=Wn.slice(Dn,Dn+Rv);if(e.length!==0)try{const n=new Blob([JSON.stringify({entries:e})],{type:"application/json"});navigator.sendBeacon(`${bt()}/api/perf-log`,n),Dn+=e.length}catch{}}function u1(){let e=0;for(const o of jo.values())e+=o.n;const n=[];if(e>0){const o=[...jo.entries()].sort((l,c)=>c[1].n-l[1].n).map(([l,c])=>`${l}×${c.n}(${_v(c.bytes)})`).join(", ");n.push(`ws ${e}/s [${o}]`)}Co>0&&n.push(`store ${Co}/s`);const r=[..._o.entries()].sort((o,l)=>l[1]-o[1]).map(([o,l])=>`${o}×${l}`);if(r.length>0&&n.push(`renders ${r.join(" ")}`),n.length>0){const o=n.join(" · ");_l("stat",o);const l=[..._o.values()].some(c=>c>Bn.renderPerSecLog);(e>Bn.wsPerSecLog||Co>Bn.storePerSecLog||l)&&console.log(`[perf:stat] ${o}`)}jo=new Map,Co=0,_o=new Map}function d1(e){if(e instanceof Element){const n=e.id?`#${e.id}`:"",r=typeof e.className=="string"&&e.className?`.${e.className.trim().split(/\s+/)[0]}`:"";return`${e.tagName.toLowerCase()}${n}${r}`}return e?"window":"unknown"}function f1(){if(td||typeof window>"u")return()=>{};td=!0,Cl=Date.now();const e=[];let n=performance.now()+250;const r=window.setInterval(()=>{const c=performance.now(),d=c-n;n=c+250,d>Bn.lagMs&&(Zd++,El=Math.max(El,d),Eo("lag",`event loop blocked ${Math.round(d)}ms`))},250);if(e.push(()=>window.clearInterval(r)),typeof window.requestAnimationFrame=="function"){let c=performance.now(),d=0;const f=h=>{const m=h-c;c=h,m>Bn.frameGapMs&&Eo("lag",`frame gap ${Math.round(m)}ms`),d=window.requestAnimationFrame(f)};d=window.requestAnimationFrame(f),e.push(()=>window.cancelAnimationFrame(d))}if(typeof PerformanceObserver<"u"){try{const c=new PerformanceObserver(d=>{var f;for(const h of d.getEntries()){const m=h.duration;if(m<Bn.longtaskBufferMs)continue;Jd++,jl=Math.max(jl,m);const v=(f=h.attribution)==null?void 0:f[0],k=(v==null?void 0:v.containerName)||(v==null?void 0:v.name)||"unknown",y=`long task ${Math.round(m)}ms (${k})`;m>=Bn.longtaskLogMs?Eo("longtask",y,m):_l("longtask",y,m)}});c.observe({type:"longtask",buffered:!1}),e.push(()=>c.disconnect())}catch{}try{const c=new PerformanceObserver(d=>{for(const f of d.getEntries()){const h=f.duration,m=f.processingStart-f.startTime;ef++;const v=`${f.name} ${Math.round(h)}ms (input delay ${Math.round(m)}ms) on ${d1(f.target)}`;h>=Bn.eventLogMs?Eo("input",v,h):_l("input",v,h)}});c.observe({type:"event",durationThreshold:Bn.eventBufferMs}),e.push(()=>c.disconnect())}catch{}}const o=window.setInterval(u1,1e3);e.push(()=>window.clearInterval(o)),jv("perf logger session started");const l=window.setInterval(c1,a1);return e.push(()=>window.clearInterval(l)),window.addEventListener("beforeunload",Rm),e.push(()=>window.removeEventListener("beforeunload",Rm)),window.__agentPanePerf={dump:Av,reset:Iv},()=>{e.forEach(c=>c()),td=!1}}function Av(){const e=[],n=Cl?Math.round((Date.now()-Cl)/1e3):0;if(e.push("=== agent-pane perf report ==="),e.push(`uptime ${n}s · ${Wn.length} buffered entries`),e.push(`event-loop lag: ${Zd} blocks >${Bn.lagMs}ms (max ${Math.round(El)}ms)`),e.push(`long tasks: ${Jd} ≥${Bn.longtaskBufferMs}ms (max ${Math.round(jl)}ms)`),e.push(`slow input events (≥${Bn.eventBufferMs}ms): ${ef}`),e.push(`store updates: ${tf} total`),Li.size>0){e.push("ws messages by type (top 15):");for(const[r,o]of[...Li.entries()].sort((l,c)=>c[1].n-l[1].n).slice(0,15))e.push(` ${r}: ${o.n} msgs, ${_v(o.bytes)}`)}if(Oi.size>0){e.push("render counts by component:");for(const[r,o]of[...Oi.entries()].sort((l,c)=>c[1]-l[1]))e.push(` ${r}: ${o}`)}e.push("--- last 200 entries ---");for(const r of Wn.slice(-200))e.push(`${new Date(r.t).toISOString().slice(11,23)} [${r.cat}] ${r.msg}`);return e.join(`
53
+ `)}function Iv(){Wn.length=0,Dn=0,Cl=Date.now(),Zd=0,El=0,Jd=0,jl=0,ef=0,tf=0,Li.clear(),Oi.clear(),jo=new Map,Co=0,_o=new Map}const zt={start:f1,note:jv,trackWsEvent:n1,trackStoreUpdate:s1,trackRender:r1,markKeystroke:o1,markInputChange:i1,dump:Av,reset:Iv},R=r0()((...e)=>({...fk(...e),...wk(...e),...nk(...e),...Ik(...e),...Dk(...e),...Mk(...e),...e1(...e),...t1(...e)}));typeof window<"u"&&(R.subscribe(()=>zt.trackStoreUpdate()),z0(R),W0(R));const p1="modulepreload",h1=function(e){return"/"+e},Am={},m1=function(n,r,o){let l=Promise.resolve();if(r&&r.length>0){let d=function(m){return Promise.all(m.map(v=>Promise.resolve(v).then(k=>({status:"fulfilled",value:k}),k=>({status:"rejected",reason:k}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),h=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=d(r.map(m=>{if(m=h1(m),m in Am)return;Am[m]=!0;const v=m.endsWith(".css"),k=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${k}`))return;const y=document.createElement("link");if(y.rel=v?"stylesheet":p1,v||(y.as="script"),y.crossOrigin="",y.href=m,h&&y.setAttribute("nonce",h),document.head.appendChild(y),v)return new Promise((S,j)=>{y.addEventListener("load",S),y.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(d){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=d,window.dispatchEvent(f),!f.defaultPrevented)throw d}return l.then(d=>{for(const f of d||[])f.status==="rejected"&&c(f.reason);return n().catch(c)})};function Nd(e){switch(e){case"claude":return{iconClass:"ic-claude",iconText:"CL"};case"codex":return{iconClass:"ic-codex",iconText:"CX"};case"repoburg":return{iconClass:"ic-repoburg",iconText:"RB"};case"cursor":return{iconClass:"ic-cursor",iconText:"CR"};default:return{iconClass:"ic-codex",iconText:"CX"}}}function g1(e,n,r=!1,o="working",l=0){if(o==="finished")return"";if(e==="interrupted")return"interrupted";if(n)return"running";if(l>0)return"background";if(r&&e!=="failed")return"queued";switch(e){case"failed":return"error";case"aborted":return"paused";default:return"paused"}}function v1(e,n,r=!1,o="working",l=0){if(o==="finished")return"Finished";if(e==="interrupted")return"Interrupted";if(n)return"Running";if(l>0)return"Background";if(r&&e!=="failed")return"Review Pending";switch(e){case"failed":return"Failed";case"aborted":return"Aborted";case"active":return"Idle";case"completed":return"Completed";case"running":return"Running";default:return e}}function Jl(e,n=0){const r=e.is_running===1,o=e.lifecycle==="finished",l=Nd(e.runtime_type),c=g1(e.status,r,e.has_unreviewed===1,e.lifecycle,n),d=v1(e.status,r,e.has_unreviewed===1,e.lifecycle,n);return{dot:c,label:d,dotTitle:c==="background"?`${n} background task${n===1?"":"s"} running`:d,iconClass:l.iconClass,iconText:l.iconText,isRunning:r,isFinished:o,backgroundTaskCount:n}}function Hi(e,n,r=!0){x.useEffect(()=>{if(!r)return;function o(l){e.current&&!e.current.contains(l.target)&&n()}return document.addEventListener("mousedown",o),document.addEventListener("touchstart",o),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("touchstart",o)}},[e,n,r])}function Mo(e,n=!0){x.useEffect(()=>{if(!n)return;function r(o){o.key==="Escape"&&e()}return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,n])}function nf({status:e,size:n=6,title:r}){return a.jsx("span",{className:`status-dot ${e}`,style:n!==6?{width:n,height:n}:void 0,title:r})}function sf({iconClass:e,iconText:n,size:r=20}){return a.jsx("span",{className:`runtime-icon ${e}`,style:r!==20?{width:r,height:r,fontSize:r*.45}:void 0,children:n})}/**
54
+ * @license lucide-react v0.469.0 - ISC
55
+ *
56
+ * This source code is licensed under the ISC license.
57
+ * See the LICENSE file in the root directory of this source tree.
58
+ */const y1=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Dv=(...e)=>e.filter((n,r,o)=>!!n&&n.trim()!==""&&o.indexOf(n)===r).join(" ").trim();/**
59
+ * @license lucide-react v0.469.0 - ISC
60
+ *
61
+ * This source code is licensed under the ISC license.
62
+ * See the LICENSE file in the root directory of this source tree.
63
+ */var x1={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"};/**
64
+ * @license lucide-react v0.469.0 - ISC
65
+ *
66
+ * This source code is licensed under the ISC license.
67
+ * See the LICENSE file in the root directory of this source tree.
68
+ */const Mv=x.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:l="",children:c,iconNode:d,...f},h)=>x.createElement("svg",{ref:h,...x1,width:n,height:n,stroke:e,strokeWidth:o?Number(r)*24/Number(n):r,className:Dv("lucide",l),...f},[...d.map(([m,v])=>x.createElement(m,v)),...Array.isArray(c)?c:[c]]));/**
69
+ * @license lucide-react v0.469.0 - ISC
70
+ *
71
+ * This source code is licensed under the ISC license.
72
+ * See the LICENSE file in the root directory of this source tree.
73
+ */const ye=(e,n)=>{const r=x.forwardRef(({className:o,...l},c)=>x.createElement(Mv,{ref:c,iconNode:n,className:Dv(`lucide-${y1(e)}`,o),...l}));return r.displayName=`${e}`,r};/**
74
+ * @license lucide-react v0.469.0 - ISC
75
+ *
76
+ * This source code is licensed under the ISC license.
77
+ * See the LICENSE file in the root directory of this source tree.
78
+ */const w1=ye("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
79
+ * @license lucide-react v0.469.0 - ISC
80
+ *
81
+ * This source code is licensed under the ISC license.
82
+ * See the LICENSE file in the root directory of this source tree.
83
+ */const k1=ye("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
84
+ * @license lucide-react v0.469.0 - ISC
85
+ *
86
+ * This source code is licensed under the ISC license.
87
+ * See the LICENSE file in the root directory of this source tree.
88
+ */const Lv=ye("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
89
+ * @license lucide-react v0.469.0 - ISC
90
+ *
91
+ * This source code is licensed under the ISC license.
92
+ * See the LICENSE file in the root directory of this source tree.
93
+ */const S1=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"}]]);/**
94
+ * @license lucide-react v0.469.0 - ISC
95
+ *
96
+ * This source code is licensed under the ISC license.
97
+ * See the LICENSE file in the root directory of this source tree.
98
+ */const yr=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"}]]);/**
99
+ * @license lucide-react v0.469.0 - ISC
100
+ *
101
+ * This source code is licensed under the ISC license.
102
+ * See the LICENSE file in the root directory of this source tree.
103
+ */const b1=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"}]]);/**
104
+ * @license lucide-react v0.469.0 - ISC
105
+ *
106
+ * This source code is licensed under the ISC license.
107
+ * See the LICENSE file in the root directory of this source tree.
108
+ */const N1=ye("CassetteTape",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["circle",{cx:"8",cy:"10",r:"2",key:"1xl4ub"}],["path",{d:"M8 12h8",key:"1wcyev"}],["circle",{cx:"16",cy:"10",r:"2",key:"r14t7q"}],["path",{d:"m6 20 .7-2.9A1.4 1.4 0 0 1 8.1 16h7.8a1.4 1.4 0 0 1 1.4 1l.7 3",key:"l01ucn"}]]);/**
109
+ * @license lucide-react v0.469.0 - ISC
110
+ *
111
+ * This source code is licensed under the ISC license.
112
+ * See the LICENSE file in the root directory of this source tree.
113
+ */const _s=ye("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
114
+ * @license lucide-react v0.469.0 - ISC
115
+ *
116
+ * This source code is licensed under the ISC license.
117
+ * See the LICENSE file in the root directory of this source tree.
118
+ */const Ro=ye("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
119
+ * @license lucide-react v0.469.0 - ISC
120
+ *
121
+ * This source code is licensed under the ISC license.
122
+ * See the LICENSE file in the root directory of this source tree.
123
+ */const $i=ye("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
124
+ * @license lucide-react v0.469.0 - ISC
125
+ *
126
+ * This source code is licensed under the ISC license.
127
+ * See the LICENSE file in the root directory of this source tree.
128
+ */const ec=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"}]]);/**
129
+ * @license lucide-react v0.469.0 - ISC
130
+ *
131
+ * This source code is licensed under the ISC license.
132
+ * See the LICENSE file in the root directory of this source tree.
133
+ */const T1=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"}]]);/**
134
+ * @license lucide-react v0.469.0 - ISC
135
+ *
136
+ * This source code is licensed under the ISC license.
137
+ * See the LICENSE file in the root directory of this source tree.
138
+ */const Rl=ye("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
139
+ * @license lucide-react v0.469.0 - ISC
140
+ *
141
+ * This source code is licensed under the ISC license.
142
+ * See the LICENSE file in the root directory of this source tree.
143
+ */const C1=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"}]]);/**
144
+ * @license lucide-react v0.469.0 - ISC
145
+ *
146
+ * This source code is licensed under the ISC license.
147
+ * See the LICENSE file in the root directory of this source tree.
148
+ */const E1=ye("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
149
+ * @license lucide-react v0.469.0 - ISC
150
+ *
151
+ * This source code is licensed under the ISC license.
152
+ * See the LICENSE file in the root directory of this source tree.
153
+ */const j1=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"}]]);/**
154
+ * @license lucide-react v0.469.0 - ISC
155
+ *
156
+ * This source code is licensed under the ISC license.
157
+ * See the LICENSE file in the root directory of this source tree.
158
+ */const Ov=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"}]]);/**
159
+ * @license lucide-react v0.469.0 - ISC
160
+ *
161
+ * This source code is licensed under the ISC license.
162
+ * See the LICENSE file in the root directory of this source tree.
163
+ */const Im=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"}]]);/**
164
+ * @license lucide-react v0.469.0 - ISC
165
+ *
166
+ * This source code is licensed under the ISC license.
167
+ * See the LICENSE file in the root directory of this source tree.
168
+ */const Pi=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"}]]);/**
169
+ * @license lucide-react v0.469.0 - ISC
170
+ *
171
+ * This source code is licensed under the ISC license.
172
+ * See the LICENSE file in the root directory of this source tree.
173
+ */const _1=ye("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
174
+ * @license lucide-react v0.469.0 - ISC
175
+ *
176
+ * This source code is licensed under the ISC license.
177
+ * See the LICENSE file in the root directory of this source tree.
178
+ */const rf=ye("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
179
+ * @license lucide-react v0.469.0 - ISC
180
+ *
181
+ * This source code is licensed under the ISC license.
182
+ * See the LICENSE file in the root directory of this source tree.
183
+ */const $v=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"}]]);/**
184
+ * @license lucide-react v0.469.0 - ISC
185
+ *
186
+ * This source code is licensed under the ISC license.
187
+ * See the LICENSE file in the root directory of this source tree.
188
+ */const R1=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"}]]);/**
189
+ * @license lucide-react v0.469.0 - ISC
190
+ *
191
+ * This source code is licensed under the ISC license.
192
+ * See the LICENSE file in the root directory of this source tree.
193
+ */const Pv=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"}]]);/**
194
+ * @license lucide-react v0.469.0 - ISC
195
+ *
196
+ * This source code is licensed under the ISC license.
197
+ * See the LICENSE file in the root directory of this source tree.
198
+ */const A1=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"}]]);/**
199
+ * @license lucide-react v0.469.0 - ISC
200
+ *
201
+ * This source code is licensed under the ISC license.
202
+ * See the LICENSE file in the root directory of this source tree.
203
+ */const I1=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"}]]);/**
204
+ * @license lucide-react v0.469.0 - ISC
205
+ *
206
+ * This source code is licensed under the ISC license.
207
+ * See the LICENSE file in the root directory of this source tree.
208
+ */const sd=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"}]]);/**
209
+ * @license lucide-react v0.469.0 - ISC
210
+ *
211
+ * This source code is licensed under the ISC license.
212
+ * See the LICENSE file in the root directory of this source tree.
213
+ */const Al=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"}]]);/**
214
+ * @license lucide-react v0.469.0 - ISC
215
+ *
216
+ * This source code is licensed under the ISC license.
217
+ * See the LICENSE file in the root directory of this source tree.
218
+ */const zv=ye("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
219
+ * @license lucide-react v0.469.0 - ISC
220
+ *
221
+ * This source code is licensed under the ISC license.
222
+ * See the LICENSE file in the root directory of this source tree.
223
+ */const Fv=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"}]]);/**
224
+ * @license lucide-react v0.469.0 - ISC
225
+ *
226
+ * This source code is licensed under the ISC license.
227
+ * See the LICENSE file in the root directory of this source tree.
228
+ */const Uv=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"}]]);/**
229
+ * @license lucide-react v0.469.0 - ISC
230
+ *
231
+ * This source code is licensed under the ISC license.
232
+ * See the LICENSE file in the root directory of this source tree.
233
+ */const D1=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"}]]);/**
234
+ * @license lucide-react v0.469.0 - ISC
235
+ *
236
+ * This source code is licensed under the ISC license.
237
+ * See the LICENSE file in the root directory of this source tree.
238
+ */const M1=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"}]]);/**
239
+ * @license lucide-react v0.469.0 - ISC
240
+ *
241
+ * This source code is licensed under the ISC license.
242
+ * See the LICENSE file in the root directory of this source tree.
243
+ */const L1=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"}]]);/**
244
+ * @license lucide-react v0.469.0 - ISC
245
+ *
246
+ * This source code is licensed under the ISC license.
247
+ * See the LICENSE file in the root directory of this source tree.
248
+ */const Bv=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"}]]);/**
249
+ * @license lucide-react v0.469.0 - ISC
250
+ *
251
+ * This source code is licensed under the ISC license.
252
+ * See the LICENSE file in the root directory of this source tree.
253
+ */const O1=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"}]]);/**
254
+ * @license lucide-react v0.469.0 - ISC
255
+ *
256
+ * This source code is licensed under the ISC license.
257
+ * See the LICENSE file in the root directory of this source tree.
258
+ */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"}]]);/**
259
+ * @license lucide-react v0.469.0 - ISC
260
+ *
261
+ * This source code is licensed under the ISC license.
262
+ * See the LICENSE file in the root directory of this source tree.
263
+ */const P1=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"}]]);/**
264
+ * @license lucide-react v0.469.0 - ISC
265
+ *
266
+ * This source code is licensed under the ISC license.
267
+ * See the LICENSE file in the root directory of this source tree.
268
+ */const z1=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"}]]);/**
269
+ * @license lucide-react v0.469.0 - ISC
270
+ *
271
+ * This source code is licensed under the ISC license.
272
+ * See the LICENSE file in the root directory of this source tree.
273
+ */const sn=ye("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
274
+ * @license lucide-react v0.469.0 - ISC
275
+ *
276
+ * This source code is licensed under the ISC license.
277
+ * See the LICENSE file in the root directory of this source tree.
278
+ */const F1=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"}]]);/**
279
+ * @license lucide-react v0.469.0 - ISC
280
+ *
281
+ * This source code is licensed under the ISC license.
282
+ * See the LICENSE file in the root directory of this source tree.
283
+ */const U1=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"}]]);/**
284
+ * @license lucide-react v0.469.0 - ISC
285
+ *
286
+ * This source code is licensed under the ISC license.
287
+ * See the LICENSE file in the root directory of this source tree.
288
+ */const Wv=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"}]]);/**
289
+ * @license lucide-react v0.469.0 - ISC
290
+ *
291
+ * This source code is licensed under the ISC license.
292
+ * See the LICENSE file in the root directory of this source tree.
293
+ */const Hv=ye("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/**
294
+ * @license lucide-react v0.469.0 - ISC
295
+ *
296
+ * This source code is licensed under the ISC license.
297
+ * See the LICENSE file in the root directory of this source tree.
298
+ */const B1=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"}]]);/**
299
+ * @license lucide-react v0.469.0 - ISC
300
+ *
301
+ * This source code is licensed under the ISC license.
302
+ * See the LICENSE file in the root directory of this source tree.
303
+ */const Dm=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"}]]);/**
304
+ * @license lucide-react v0.469.0 - ISC
305
+ *
306
+ * This source code is licensed under the ISC license.
307
+ * See the LICENSE file in the root directory of this source tree.
308
+ */const W1=ye("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/**
309
+ * @license lucide-react v0.469.0 - ISC
310
+ *
311
+ * This source code is licensed under the ISC license.
312
+ * See the LICENSE file in the root directory of this source tree.
313
+ */const H1=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"}]]);/**
314
+ * @license lucide-react v0.469.0 - ISC
315
+ *
316
+ * This source code is licensed under the ISC license.
317
+ * See the LICENSE file in the root directory of this source tree.
318
+ */const V1=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"}]]);/**
319
+ * @license lucide-react v0.469.0 - ISC
320
+ *
321
+ * This source code is licensed under the ISC license.
322
+ * See the LICENSE file in the root directory of this source tree.
323
+ */const K1=ye("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
324
+ * @license lucide-react v0.469.0 - ISC
325
+ *
326
+ * This source code is licensed under the ISC license.
327
+ * See the LICENSE file in the root directory of this source tree.
328
+ */const G1=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"}]]);/**
329
+ * @license lucide-react v0.469.0 - ISC
330
+ *
331
+ * This source code is licensed under the ISC license.
332
+ * See the LICENSE file in the root directory of this source tree.
333
+ */const ml=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"}]]);/**
334
+ * @license lucide-react v0.469.0 - ISC
335
+ *
336
+ * This source code is licensed under the ISC license.
337
+ * See the LICENSE file in the root directory of this source tree.
338
+ */const q1=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"}]]);/**
339
+ * @license lucide-react v0.469.0 - ISC
340
+ *
341
+ * This source code is licensed under the ISC license.
342
+ * See the LICENSE file in the root directory of this source tree.
343
+ */const X1=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"}]]);/**
344
+ * @license lucide-react v0.469.0 - ISC
345
+ *
346
+ * This source code is licensed under the ISC license.
347
+ * See the LICENSE file in the root directory of this source tree.
348
+ */const mr=ye("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
349
+ * @license lucide-react v0.469.0 - ISC
350
+ *
351
+ * This source code is licensed under the ISC license.
352
+ * See the LICENSE file in the root directory of this source tree.
353
+ */const Vv=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"}]]);/**
354
+ * @license lucide-react v0.469.0 - ISC
355
+ *
356
+ * This source code is licensed under the ISC license.
357
+ * See the LICENSE file in the root directory of this source tree.
358
+ */const Mm=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"}]]);/**
359
+ * @license lucide-react v0.469.0 - ISC
360
+ *
361
+ * This source code is licensed under the ISC license.
362
+ * See the LICENSE file in the root directory of this source tree.
363
+ */const Y1=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"}]]);/**
364
+ * @license lucide-react v0.469.0 - ISC
365
+ *
366
+ * This source code is licensed under the ISC license.
367
+ * See the LICENSE file in the root directory of this source tree.
368
+ */const zi=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"}]]);/**
369
+ * @license lucide-react v0.469.0 - ISC
370
+ *
371
+ * This source code is licensed under the ISC license.
372
+ * See the LICENSE file in the root directory of this source tree.
373
+ */const Kv=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"}]]);/**
374
+ * @license lucide-react v0.469.0 - ISC
375
+ *
376
+ * This source code is licensed under the ISC license.
377
+ * See the LICENSE file in the root directory of this source tree.
378
+ */const Gv=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"}]]);/**
379
+ * @license lucide-react v0.469.0 - ISC
380
+ *
381
+ * This source code is licensed under the ISC license.
382
+ * See the LICENSE file in the root directory of this source tree.
383
+ */const Q1=ye("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
384
+ * @license lucide-react v0.469.0 - ISC
385
+ *
386
+ * This source code is licensed under the ISC license.
387
+ * See the LICENSE file in the root directory of this source tree.
388
+ */const Vi=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"}]]);/**
389
+ * @license lucide-react v0.469.0 - ISC
390
+ *
391
+ * This source code is licensed under the ISC license.
392
+ * See the LICENSE file in the root directory of this source tree.
393
+ */const Z1=ye("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/**
394
+ * @license lucide-react v0.469.0 - ISC
395
+ *
396
+ * This source code is licensed under the ISC license.
397
+ * See the LICENSE file in the root directory of this source tree.
398
+ */const J1=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"}]]);/**
399
+ * @license lucide-react v0.469.0 - ISC
400
+ *
401
+ * This source code is licensed under the ISC license.
402
+ * See the LICENSE file in the root directory of this source tree.
403
+ */const qv=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"}]]);/**
404
+ * @license lucide-react v0.469.0 - ISC
405
+ *
406
+ * This source code is licensed under the ISC license.
407
+ * See the LICENSE file in the root directory of this source tree.
408
+ */const xr=ye("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
409
+ * @license lucide-react v0.469.0 - ISC
410
+ *
411
+ * This source code is licensed under the ISC license.
412
+ * See the LICENSE file in the root directory of this source tree.
413
+ */const Il=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"}]]);/**
414
+ * @license lucide-react v0.469.0 - ISC
415
+ *
416
+ * This source code is licensed under the ISC license.
417
+ * See the LICENSE file in the root directory of this source tree.
418
+ */const tc=ye("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
419
+ * @license lucide-react v0.469.0 - ISC
420
+ *
421
+ * This source code is licensed under the ISC license.
422
+ * See the LICENSE file in the root directory of this source tree.
423
+ */const fs=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"}]]);/**
424
+ * @license lucide-react v0.469.0 - ISC
425
+ *
426
+ * This source code is licensed under the ISC license.
427
+ * See the LICENSE file in the root directory of this source tree.
428
+ */const nc=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"}]]);/**
429
+ * @license lucide-react v0.469.0 - ISC
430
+ *
431
+ * This source code is licensed under the ISC license.
432
+ * See the LICENSE file in the root directory of this source tree.
433
+ */const eS=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"}]]);/**
434
+ * @license lucide-react v0.469.0 - ISC
435
+ *
436
+ * This source code is licensed under the ISC license.
437
+ * See the LICENSE file in the root directory of this source tree.
438
+ */const tS=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"}]]);/**
439
+ * @license lucide-react v0.469.0 - ISC
440
+ *
441
+ * This source code is licensed under the ISC license.
442
+ * See the LICENSE file in the root directory of this source tree.
443
+ */const nS=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"}]]);/**
444
+ * @license lucide-react v0.469.0 - ISC
445
+ *
446
+ * This source code is licensed under the ISC license.
447
+ * See the LICENSE file in the root directory of this source tree.
448
+ */const Xv=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"}]]);/**
449
+ * @license lucide-react v0.469.0 - ISC
450
+ *
451
+ * This source code is licensed under the ISC license.
452
+ * See the LICENSE file in the root directory of this source tree.
453
+ */const sS=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"}]]);/**
454
+ * @license lucide-react v0.469.0 - ISC
455
+ *
456
+ * This source code is licensed under the ISC license.
457
+ * See the LICENSE file in the root directory of this source tree.
458
+ */const Nn=ye("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
459
+ * @license lucide-react v0.469.0 - ISC
460
+ *
461
+ * This source code is licensed under the ISC license.
462
+ * See the LICENSE file in the root directory of this source tree.
463
+ */const rS=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"}]]),oS=new Set(["path","circle","rect","line","ellipse","polyline","polygon"]),iS=new Set("d cx cy r rx ry x y width height x1 x2 y1 y2 points fill".split(" "));function aS(e){return e.filter(([n])=>oS.has(n)).map(([n,r],o)=>[n,{...Object.fromEntries(Object.entries(r).filter(([l])=>iS.has(l))),key:String(o)}])}function Lo({iconNode:e,size:n=14,className:r}){const o=x.useMemo(()=>e?aS(e):[],[e]);return o.length===0?a.jsx(Bv,{size:n,className:r,"aria-hidden":"true","data-testid":"app-icon-default"}):a.jsx(Mv,{iconNode:o,size:n,className:r,"aria-hidden":"true","data-testid":"app-icon"})}var Ci=tv();function lS(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return x.useMemo(()=>o=>{n.forEach(l=>l(o))},n)}const sc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Oo(e){const n=Object.prototype.toString.call(e);return n==="[object Window]"||n==="[object global]"}function of(e){return"nodeType"in e}function Tn(e){var n,r;return e?Oo(e)?e:of(e)&&(n=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?n:window:window}function af(e){const{Document:n}=Tn(e);return e instanceof n}function Ki(e){return Oo(e)?!1:e instanceof Tn(e).HTMLElement}function Yv(e){return e instanceof Tn(e).SVGElement}function $o(e){return e?Oo(e)?e.document:of(e)?af(e)?e:Ki(e)||Yv(e)?e.ownerDocument:document:document:document}const ms=sc?x.useLayoutEffect:x.useEffect;function rc(e){const n=x.useRef(e);return ms(()=>{n.current=e}),x.useCallback(function(){for(var r=arguments.length,o=new Array(r),l=0;l<r;l++)o[l]=arguments[l];return n.current==null?void 0:n.current(...o)},[])}function cS(){const e=x.useRef(null),n=x.useCallback((o,l)=>{e.current=setInterval(o,l)},[]),r=x.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[n,r]}function Fi(e,n){n===void 0&&(n=[e]);const r=x.useRef(e);return ms(()=>{r.current!==e&&(r.current=e)},n),r}function Gi(e,n){const r=x.useRef();return x.useMemo(()=>{const o=e(r.current);return r.current=o,o},[...n])}function Dl(e){const n=rc(e),r=x.useRef(null),o=x.useCallback(l=>{l!==r.current&&(n==null||n(l,r.current)),r.current=l},[]);return[r,o]}function Ml(e){const n=x.useRef();return x.useEffect(()=>{n.current=e},[e]),n.current}let rd={};function qi(e,n){return x.useMemo(()=>{if(n)return n;const r=rd[e]==null?0:rd[e]+1;return rd[e]=r,e+"-"+r},[e,n])}function Qv(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];return o.reduce((c,d)=>{const f=Object.entries(d);for(const[h,m]of f){const v=c[h];v!=null&&(c[h]=v+e*m)}return c},{...n})}}const Ao=Qv(1),Ll=Qv(-1);function uS(e){return"clientX"in e&&"clientY"in e}function oc(e){if(!e)return!1;const{KeyboardEvent:n}=Tn(e.target);return n&&e instanceof n}function dS(e){if(!e)return!1;const{TouchEvent:n}=Tn(e.target);return n&&e instanceof n}function Ol(e){if(dS(e)){if(e.touches&&e.touches.length){const{clientX:n,clientY:r}=e.touches[0];return{x:n,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:n,clientY:r}=e.changedTouches[0];return{x:n,y:r}}}return uS(e)?{x:e.clientX,y:e.clientY}:null}const Rs=Object.freeze({Translate:{toString(e){if(!e)return;const{x:n,y:r}=e;return"translate3d("+(n?Math.round(n):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:n,scaleY:r}=e;return"scaleX("+n+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Rs.Translate.toString(e),Rs.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:n,duration:r,easing:o}=e;return n+" "+r+"ms "+o}}}),Lm="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function fS(e){return e.matches(Lm)?e:e.querySelector(Lm)}const pS={display:"none"};function hS(e){let{id:n,value:r}=e;return pt.createElement("div",{id:n,style:pS},r)}function mS(e){let{id:n,announcement:r,ariaLiveType:o="assertive"}=e;const l={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return pt.createElement("div",{id:n,style:l,role:"status","aria-live":o,"aria-atomic":!0},r)}function gS(){const[e,n]=x.useState("");return{announce:x.useCallback(o=>{o!=null&&n(o)},[]),announcement:e}}const Zv=x.createContext(null);function vS(e){const n=x.useContext(Zv);x.useEffect(()=>{if(!n)throw new Error("useDndMonitor must be used within a children of <DndContext>");return n(e)},[e,n])}function yS(){const[e]=x.useState(()=>new Set),n=x.useCallback(o=>(e.add(o),()=>e.delete(o)),[e]);return[x.useCallback(o=>{let{type:l,event:c}=o;e.forEach(d=>{var f;return(f=d[l])==null?void 0:f.call(d,c)})},[e]),n]}const xS={draggable:`
464
+ To pick up a draggable item, press the space bar.
465
+ While dragging, use the arrow keys to move the item.
466
+ Press space again to drop the item in its new position, or press escape to cancel.
467
+ `},wS={onDragStart(e){let{active:n}=e;return"Picked up draggable item "+n.id+"."},onDragOver(e){let{active:n,over:r}=e;return r?"Draggable item "+n.id+" was moved over droppable area "+r.id+".":"Draggable item "+n.id+" is no longer over a droppable area."},onDragEnd(e){let{active:n,over:r}=e;return r?"Draggable item "+n.id+" was dropped over droppable area "+r.id:"Draggable item "+n.id+" was dropped."},onDragCancel(e){let{active:n}=e;return"Dragging was cancelled. Draggable item "+n.id+" was dropped."}};function kS(e){let{announcements:n=wS,container:r,hiddenTextDescribedById:o,screenReaderInstructions:l=xS}=e;const{announce:c,announcement:d}=gS(),f=qi("DndLiveRegion"),[h,m]=x.useState(!1);if(x.useEffect(()=>{m(!0)},[]),vS(x.useMemo(()=>({onDragStart(k){let{active:y}=k;c(n.onDragStart({active:y}))},onDragMove(k){let{active:y,over:S}=k;n.onDragMove&&c(n.onDragMove({active:y,over:S}))},onDragOver(k){let{active:y,over:S}=k;c(n.onDragOver({active:y,over:S}))},onDragEnd(k){let{active:y,over:S}=k;c(n.onDragEnd({active:y,over:S}))},onDragCancel(k){let{active:y,over:S}=k;c(n.onDragCancel({active:y,over:S}))}}),[c,n])),!h)return null;const v=pt.createElement(pt.Fragment,null,pt.createElement(hS,{id:o,value:l.draggable}),pt.createElement(mS,{id:f,announcement:d}));return r?Ci.createPortal(v,r):v}var Yt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Yt||(Yt={}));function $l(){}function Jv(e,n){return x.useMemo(()=>({sensor:e,options:n??{}}),[e,n])}function ey(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return x.useMemo(()=>[...n].filter(o=>o!=null),[...n])}const gs=Object.freeze({x:0,y:0});function SS(e,n){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function bS(e,n){const r=Ol(e);if(!r)return"0 0";const o={x:(r.x-n.left)/n.width*100,y:(r.y-n.top)/n.height*100};return o.x+"% "+o.y+"%"}function NS(e,n){let{data:{value:r}}=e,{data:{value:o}}=n;return r-o}function TS(e,n){let{data:{value:r}}=e,{data:{value:o}}=n;return o-r}function CS(e,n){if(!e||e.length===0)return null;const[r]=e;return r[n]}function Om(e,n,r){return n===void 0&&(n=e.left),r===void 0&&(r=e.top),{x:n+e.width*.5,y:r+e.height*.5}}const ty=e=>{let{collisionRect:n,droppableRects:r,droppableContainers:o}=e;const l=Om(n,n.left,n.top),c=[];for(const d of o){const{id:f}=d,h=r.get(f);if(h){const m=SS(Om(h),l);c.push({id:f,data:{droppableContainer:d,value:m}})}}return c.sort(NS)};function ES(e,n){const r=Math.max(n.top,e.top),o=Math.max(n.left,e.left),l=Math.min(n.left+n.width,e.left+e.width),c=Math.min(n.top+n.height,e.top+e.height),d=l-o,f=c-r;if(o<l&&r<c){const h=n.width*n.height,m=e.width*e.height,v=d*f,k=v/(h+m-v);return Number(k.toFixed(4))}return 0}const jS=e=>{let{collisionRect:n,droppableRects:r,droppableContainers:o}=e;const l=[];for(const c of o){const{id:d}=c,f=r.get(d);if(f){const h=ES(f,n);h>0&&l.push({id:d,data:{droppableContainer:c,value:h}})}}return l.sort(TS)};function _S(e,n,r){return{...e,scaleX:n&&r?n.width/r.width:1,scaleY:n&&r?n.height/r.height:1}}function ny(e,n){return e&&n?{x:e.left-n.left,y:e.top-n.top}:gs}function RS(e){return function(r){for(var o=arguments.length,l=new Array(o>1?o-1:0),c=1;c<o;c++)l[c-1]=arguments[c];return l.reduce((d,f)=>({...d,top:d.top+e*f.y,bottom:d.bottom+e*f.y,left:d.left+e*f.x,right:d.right+e*f.x}),{...r})}}const AS=RS(1);function sy(e){if(e.startsWith("matrix3d(")){const n=e.slice(9,-1).split(/, /);return{x:+n[12],y:+n[13],scaleX:+n[0],scaleY:+n[5]}}else if(e.startsWith("matrix(")){const n=e.slice(7,-1).split(/, /);return{x:+n[4],y:+n[5],scaleX:+n[0],scaleY:+n[3]}}return null}function IS(e,n,r){const o=sy(n);if(!o)return e;const{scaleX:l,scaleY:c,x:d,y:f}=o,h=e.left-d-(1-l)*parseFloat(r),m=e.top-f-(1-c)*parseFloat(r.slice(r.indexOf(" ")+1)),v=l?e.width/l:e.width,k=c?e.height/c:e.height;return{width:v,height:k,top:m,right:h+v,bottom:m+k,left:h}}const DS={ignoreTransform:!1};function Po(e,n){n===void 0&&(n=DS);let r=e.getBoundingClientRect();if(n.ignoreTransform){const{transform:m,transformOrigin:v}=Tn(e).getComputedStyle(e);m&&(r=IS(r,m,v))}const{top:o,left:l,width:c,height:d,bottom:f,right:h}=r;return{top:o,left:l,width:c,height:d,bottom:f,right:h}}function $m(e){return Po(e,{ignoreTransform:!0})}function MS(e){const n=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:n,bottom:r,width:n,height:r}}function LS(e,n){return n===void 0&&(n=Tn(e).getComputedStyle(e)),n.position==="fixed"}function OS(e,n){n===void 0&&(n=Tn(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(l=>{const c=n[l];return typeof c=="string"?r.test(c):!1})}function lf(e,n){const r=[];function o(l){if(n!=null&&r.length>=n||!l)return r;if(af(l)&&l.scrollingElement!=null&&!r.includes(l.scrollingElement))return r.push(l.scrollingElement),r;if(!Ki(l)||Yv(l)||r.includes(l))return r;const c=Tn(e).getComputedStyle(l);return l!==e&&OS(l,c)&&r.push(l),LS(l,c)?r:o(l.parentNode)}return e?o(e):r}function ry(e){const[n]=lf(e,1);return n??null}function od(e){return!sc||!e?null:Oo(e)?e:of(e)?af(e)||e===$o(e).scrollingElement?window:Ki(e)?e:null:null}function oy(e){return Oo(e)?e.scrollX:e.scrollLeft}function iy(e){return Oo(e)?e.scrollY:e.scrollTop}function Td(e){return{x:oy(e),y:iy(e)}}var rn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(rn||(rn={}));function ay(e){return!sc||!e?!1:e===document.scrollingElement}function ly(e){const n={x:0,y:0},r=ay(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},o={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},l=e.scrollTop<=n.y,c=e.scrollLeft<=n.x,d=e.scrollTop>=o.y,f=e.scrollLeft>=o.x;return{isTop:l,isLeft:c,isBottom:d,isRight:f,maxScroll:o,minScroll:n}}const $S={x:.2,y:.2};function PS(e,n,r,o,l){let{top:c,left:d,right:f,bottom:h}=r;o===void 0&&(o=10),l===void 0&&(l=$S);const{isTop:m,isBottom:v,isLeft:k,isRight:y}=ly(e),S={x:0,y:0},j={x:0,y:0},T={height:n.height*l.y,width:n.width*l.x};return!m&&c<=n.top+T.height?(S.y=rn.Backward,j.y=o*Math.abs((n.top+T.height-c)/T.height)):!v&&h>=n.bottom-T.height&&(S.y=rn.Forward,j.y=o*Math.abs((n.bottom-T.height-h)/T.height)),!y&&f>=n.right-T.width?(S.x=rn.Forward,j.x=o*Math.abs((n.right-T.width-f)/T.width)):!k&&d<=n.left+T.width&&(S.x=rn.Backward,j.x=o*Math.abs((n.left+T.width-d)/T.width)),{direction:S,speed:j}}function zS(e){if(e===document.scrollingElement){const{innerWidth:c,innerHeight:d}=window;return{top:0,left:0,right:c,bottom:d,width:c,height:d}}const{top:n,left:r,right:o,bottom:l}=e.getBoundingClientRect();return{top:n,left:r,right:o,bottom:l,width:e.clientWidth,height:e.clientHeight}}function cy(e){return e.reduce((n,r)=>Ao(n,Td(r)),gs)}function FS(e){return e.reduce((n,r)=>n+oy(r),0)}function US(e){return e.reduce((n,r)=>n+iy(r),0)}function uy(e,n){if(n===void 0&&(n=Po),!e)return;const{top:r,left:o,bottom:l,right:c}=n(e);ry(e)&&(l<=0||c<=0||r>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const BS=[["x",["left","right"],FS],["y",["top","bottom"],US]];class cf{constructor(n,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const o=lf(r),l=cy(o);this.rect={...n},this.width=n.width,this.height=n.height;for(const[c,d,f]of BS)for(const h of d)Object.defineProperty(this,h,{get:()=>{const m=f(o),v=l[c]-m;return this.rect[h]+v},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class _i{constructor(n){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...r)})},this.target=n}add(n,r,o){var l;(l=this.target)==null||l.addEventListener(n,r,o),this.listeners.push([n,r,o])}}function WS(e){const{EventTarget:n}=Tn(e);return e instanceof n?e:$o(e)}function id(e,n){const r=Math.abs(e.x),o=Math.abs(e.y);return typeof n=="number"?Math.sqrt(r**2+o**2)>n:"x"in n&&"y"in n?r>n.x&&o>n.y:"x"in n?r>n.x:"y"in n?o>n.y:!1}var Jn;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Jn||(Jn={}));function Pm(e){e.preventDefault()}function HS(e){e.stopPropagation()}var rt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(rt||(rt={}));const dy={start:[rt.Space,rt.Enter],cancel:[rt.Esc],end:[rt.Space,rt.Enter,rt.Tab]},VS=(e,n)=>{let{currentCoordinates:r}=n;switch(e.code){case rt.Right:return{...r,x:r.x+25};case rt.Left:return{...r,x:r.x-25};case rt.Down:return{...r,y:r.y+25};case rt.Up:return{...r,y:r.y-25}}};class fy{constructor(n){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=n;const{event:{target:r}}=n;this.props=n,this.listeners=new _i($o(r)),this.windowListeners=new _i(Tn(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Jn.Resize,this.handleCancel),this.windowListeners.add(Jn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Jn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:n,onStart:r}=this.props,o=n.node.current;o&&uy(o),r(gs)}handleKeyDown(n){if(oc(n)){const{active:r,context:o,options:l}=this.props,{keyboardCodes:c=dy,coordinateGetter:d=VS,scrollBehavior:f="smooth"}=l,{code:h}=n;if(c.end.includes(h)){this.handleEnd(n);return}if(c.cancel.includes(h)){this.handleCancel(n);return}const{collisionRect:m}=o.current,v=m?{x:m.left,y:m.top}:gs;this.referenceCoordinates||(this.referenceCoordinates=v);const k=d(n,{active:r,context:o.current,currentCoordinates:v});if(k){const y=Ll(k,v),S={x:0,y:0},{scrollableAncestors:j}=o.current;for(const T of j){const C=n.code,{isTop:b,isRight:A,isLeft:$,isBottom:P,maxScroll:z,minScroll:G}=ly(T),M=zS(T),F={x:Math.min(C===rt.Right?M.right-M.width/2:M.right,Math.max(C===rt.Right?M.left:M.left+M.width/2,k.x)),y:Math.min(C===rt.Down?M.bottom-M.height/2:M.bottom,Math.max(C===rt.Down?M.top:M.top+M.height/2,k.y))},Z=C===rt.Right&&!A||C===rt.Left&&!$,Q=C===rt.Down&&!P||C===rt.Up&&!b;if(Z&&F.x!==k.x){const J=T.scrollLeft+y.x,he=C===rt.Right&&J<=z.x||C===rt.Left&&J>=G.x;if(he&&!y.y){T.scrollTo({left:J,behavior:f});return}he?S.x=T.scrollLeft-J:S.x=C===rt.Right?T.scrollLeft-z.x:T.scrollLeft-G.x,S.x&&T.scrollBy({left:-S.x,behavior:f});break}else if(Q&&F.y!==k.y){const J=T.scrollTop+y.y,he=C===rt.Down&&J<=z.y||C===rt.Up&&J>=G.y;if(he&&!y.x){T.scrollTo({top:J,behavior:f});return}he?S.y=T.scrollTop-J:S.y=C===rt.Down?T.scrollTop-z.y:T.scrollTop-G.y,S.y&&T.scrollBy({top:-S.y,behavior:f});break}}this.handleMove(n,Ao(Ll(k,this.referenceCoordinates),S))}}}handleMove(n,r){const{onMove:o}=this.props;n.preventDefault(),o(r)}handleEnd(n){const{onEnd:r}=this.props;n.preventDefault(),this.detach(),r()}handleCancel(n){const{onCancel:r}=this.props;n.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}fy.activators=[{eventName:"onKeyDown",handler:(e,n,r)=>{let{keyboardCodes:o=dy,onActivation:l}=n,{active:c}=r;const{code:d}=e.nativeEvent;if(o.start.includes(d)){const f=c.activatorNode.current;return f&&e.target!==f?!1:(e.preventDefault(),l==null||l({event:e.nativeEvent}),!0)}return!1}}];function zm(e){return!!(e&&"distance"in e)}function Fm(e){return!!(e&&"delay"in e)}class uf{constructor(n,r,o){var l;o===void 0&&(o=WS(n.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=n,this.events=r;const{event:c}=n,{target:d}=c;this.props=n,this.events=r,this.document=$o(d),this.documentListeners=new _i(this.document),this.listeners=new _i(o),this.windowListeners=new _i(Tn(d)),this.initialCoordinates=(l=Ol(c))!=null?l:gs,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:n,props:{options:{activationConstraint:r,bypassActivationConstraint:o}}}=this;if(this.listeners.add(n.move.name,this.handleMove,{passive:!1}),this.listeners.add(n.end.name,this.handleEnd),n.cancel&&this.listeners.add(n.cancel.name,this.handleCancel),this.windowListeners.add(Jn.Resize,this.handleCancel),this.windowListeners.add(Jn.DragStart,Pm),this.windowListeners.add(Jn.VisibilityChange,this.handleCancel),this.windowListeners.add(Jn.ContextMenu,Pm),this.documentListeners.add(Jn.Keydown,this.handleKeydown),r){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Fm(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(zm(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(n,r){const{active:o,onPending:l}=this.props;l(o,n,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:n}=this,{onStart:r}=this.props;n&&(this.activated=!0,this.documentListeners.add(Jn.Click,HS,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Jn.SelectionChange,this.removeTextSelection),r(n))}handleMove(n){var r;const{activated:o,initialCoordinates:l,props:c}=this,{onMove:d,options:{activationConstraint:f}}=c;if(!l)return;const h=(r=Ol(n))!=null?r:gs,m=Ll(l,h);if(!o&&f){if(zm(f)){if(f.tolerance!=null&&id(m,f.tolerance))return this.handleCancel();if(id(m,f.distance))return this.handleStart()}if(Fm(f)&&id(m,f.tolerance))return this.handleCancel();this.handlePending(f,m);return}n.cancelable&&n.preventDefault(),d(h)}handleEnd(){const{onAbort:n,onEnd:r}=this.props;this.detach(),this.activated||n(this.props.active),r()}handleCancel(){const{onAbort:n,onCancel:r}=this.props;this.detach(),this.activated||n(this.props.active),r()}handleKeydown(n){n.code===rt.Esc&&this.handleCancel()}removeTextSelection(){var n;(n=this.document.getSelection())==null||n.removeAllRanges()}}const KS={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ic extends uf{constructor(n){const{event:r}=n,o=$o(r.target);super(n,KS,o)}}ic.activators=[{eventName:"onPointerDown",handler:(e,n)=>{let{nativeEvent:r}=e,{onActivation:o}=n;return!r.isPrimary||r.button!==0?!1:(o==null||o({event:r}),!0)}}];const GS={move:{name:"mousemove"},end:{name:"mouseup"}};var Cd;(function(e){e[e.RightClick=2]="RightClick"})(Cd||(Cd={}));class qS extends uf{constructor(n){super(n,GS,$o(n.event.target))}}qS.activators=[{eventName:"onMouseDown",handler:(e,n)=>{let{nativeEvent:r}=e,{onActivation:o}=n;return r.button===Cd.RightClick?!1:(o==null||o({event:r}),!0)}}];const ad={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class XS extends uf{constructor(n){super(n,ad)}static setup(){return window.addEventListener(ad.move.name,n,{capture:!1,passive:!1}),function(){window.removeEventListener(ad.move.name,n)};function n(){}}}XS.activators=[{eventName:"onTouchStart",handler:(e,n)=>{let{nativeEvent:r}=e,{onActivation:o}=n;const{touches:l}=r;return l.length>1?!1:(o==null||o({event:r}),!0)}}];var Ri;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ri||(Ri={}));var Pl;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Pl||(Pl={}));function YS(e){let{acceleration:n,activator:r=Ri.Pointer,canScroll:o,draggingRect:l,enabled:c,interval:d=5,order:f=Pl.TreeOrder,pointerCoordinates:h,scrollableAncestors:m,scrollableAncestorRects:v,delta:k,threshold:y}=e;const S=ZS({delta:k,disabled:!c}),[j,T]=cS(),C=x.useRef({x:0,y:0}),b=x.useRef({x:0,y:0}),A=x.useMemo(()=>{switch(r){case Ri.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case Ri.DraggableRect:return l}},[r,l,h]),$=x.useRef(null),P=x.useCallback(()=>{const G=$.current;if(!G)return;const M=C.current.x*b.current.x,F=C.current.y*b.current.y;G.scrollBy(M,F)},[]),z=x.useMemo(()=>f===Pl.TreeOrder?[...m].reverse():m,[f,m]);x.useEffect(()=>{if(!c||!m.length||!A){T();return}for(const G of z){if((o==null?void 0:o(G))===!1)continue;const M=m.indexOf(G),F=v[M];if(!F)continue;const{direction:Z,speed:Q}=PS(G,F,A,n,y);for(const J of["x","y"])S[J][Z[J]]||(Q[J]=0,Z[J]=0);if(Q.x>0||Q.y>0){T(),$.current=G,j(P,d),C.current=Q,b.current=Z;return}}C.current={x:0,y:0},b.current={x:0,y:0},T()},[n,P,o,T,c,d,JSON.stringify(A),JSON.stringify(S),j,m,z,v,JSON.stringify(y)])}const QS={x:{[rn.Backward]:!1,[rn.Forward]:!1},y:{[rn.Backward]:!1,[rn.Forward]:!1}};function ZS(e){let{delta:n,disabled:r}=e;const o=Ml(n);return Gi(l=>{if(r||!o||!l)return QS;const c={x:Math.sign(n.x-o.x),y:Math.sign(n.y-o.y)};return{x:{[rn.Backward]:l.x[rn.Backward]||c.x===-1,[rn.Forward]:l.x[rn.Forward]||c.x===1},y:{[rn.Backward]:l.y[rn.Backward]||c.y===-1,[rn.Forward]:l.y[rn.Forward]||c.y===1}}},[r,n,o])}function JS(e,n){const r=n!=null?e.get(n):void 0,o=r?r.node.current:null;return Gi(l=>{var c;return n==null?null:(c=o??l)!=null?c:null},[o,n])}function eb(e,n){return x.useMemo(()=>e.reduce((r,o)=>{const{sensor:l}=o,c=l.activators.map(d=>({eventName:d.eventName,handler:n(d.handler,o)}));return[...r,...c]},[]),[e,n])}var Ui;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ui||(Ui={}));var Ed;(function(e){e.Optimized="optimized"})(Ed||(Ed={}));const Um=new Map;function tb(e,n){let{dragging:r,dependencies:o,config:l}=n;const[c,d]=x.useState(null),{frequency:f,measure:h,strategy:m}=l,v=x.useRef(e),k=C(),y=Fi(k),S=x.useCallback(function(b){b===void 0&&(b=[]),!y.current&&d(A=>A===null?b:A.concat(b.filter($=>!A.includes($))))},[y]),j=x.useRef(null),T=Gi(b=>{if(k&&!r)return Um;if(!b||b===Um||v.current!==e||c!=null){const A=new Map;for(let $ of e){if(!$)continue;if(c&&c.length>0&&!c.includes($.id)&&$.rect.current){A.set($.id,$.rect.current);continue}const P=$.node.current,z=P?new cf(h(P),P):null;$.rect.current=z,z&&A.set($.id,z)}return A}return b},[e,c,r,k,h]);return x.useEffect(()=>{v.current=e},[e]),x.useEffect(()=>{k||S()},[r,k]),x.useEffect(()=>{c&&c.length>0&&d(null)},[JSON.stringify(c)]),x.useEffect(()=>{k||typeof f!="number"||j.current!==null||(j.current=setTimeout(()=>{S(),j.current=null},f))},[f,k,S,...o]),{droppableRects:T,measureDroppableContainers:S,measuringScheduled:c!=null};function C(){switch(m){case Ui.Always:return!1;case Ui.BeforeDragging:return r;default:return!r}}}function df(e,n){return Gi(r=>e?r||(typeof n=="function"?n(e):e):null,[n,e])}function nb(e,n){return df(e,n)}function sb(e){let{callback:n,disabled:r}=e;const o=rc(n),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 ac(e){let{callback:n,disabled:r}=e;const o=rc(n),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 rb(e){return new cf(Po(e),e)}function Bm(e,n,r){n===void 0&&(n=rb);const[o,l]=x.useState(null);function c(){l(h=>{if(!e)return null;if(e.isConnected===!1){var m;return(m=h??r)!=null?m:null}const v=n(e);return JSON.stringify(h)===JSON.stringify(v)?h:v})}const d=sb({callback(h){if(e)for(const m of h){const{type:v,target:k}=m;if(v==="childList"&&k instanceof HTMLElement&&k.contains(e)){c();break}}}}),f=ac({callback:c});return ms(()=>{c(),e?(f==null||f.observe(e),d==null||d.observe(document.body,{childList:!0,subtree:!0})):(f==null||f.disconnect(),d==null||d.disconnect())},[e]),o}function ob(e){const n=df(e);return ny(e,n)}const Wm=[];function ib(e){const n=x.useRef(e),r=Gi(o=>e?o&&o!==Wm&&e&&n.current&&e.parentNode===n.current.parentNode?o:lf(e):Wm,[e]);return x.useEffect(()=>{n.current=e},[e]),r}function ab(e){const[n,r]=x.useState(null),o=x.useRef(e),l=x.useCallback(c=>{const d=od(c.target);d&&r(f=>f?(f.set(d,Td(d)),new Map(f)):null)},[]);return x.useEffect(()=>{const c=o.current;if(e!==c){d(c);const f=e.map(h=>{const m=od(h);return m?(m.addEventListener("scroll",l,{passive:!0}),[m,Td(m)]):null}).filter(h=>h!=null);r(f.length?new Map(f):null),o.current=e}return()=>{d(e),d(c)};function d(f){f.forEach(h=>{const m=od(h);m==null||m.removeEventListener("scroll",l)})}},[l,e]),x.useMemo(()=>e.length?n?Array.from(n.values()).reduce((c,d)=>Ao(c,d),gs):cy(e):gs,[e,n])}function Hm(e,n){n===void 0&&(n=[]);const r=x.useRef(null);return x.useEffect(()=>{r.current=null},n),x.useEffect(()=>{const o=e!==gs;o&&!r.current&&(r.current=e),!o&&r.current&&(r.current=null)},[e]),r.current?Ll(e,r.current):gs}function lb(e){x.useEffect(()=>{if(!sc)return;const n=e.map(r=>{let{sensor:o}=r;return o.setup==null?void 0:o.setup()});return()=>{for(const r of n)r==null||r()}},e.map(n=>{let{sensor:r}=n;return r}))}function cb(e,n){return x.useMemo(()=>e.reduce((r,o)=>{let{eventName:l,handler:c}=o;return r[l]=d=>{c(d,n)},r},{}),[e,n])}function py(e){return x.useMemo(()=>e?MS(e):null,[e])}const Vm=[];function ub(e,n){n===void 0&&(n=Po);const[r]=e,o=py(r?Tn(r):null),[l,c]=x.useState(Vm);function d(){c(()=>e.length?e.map(h=>ay(h)?o:new cf(n(h),h)):Vm)}const f=ac({callback:d});return ms(()=>{f==null||f.disconnect(),d(),e.forEach(h=>f==null?void 0:f.observe(h))},[e]),l}function hy(e){if(!e)return null;if(e.children.length>1)return e;const n=e.children[0];return Ki(n)?n:e}function db(e){let{measure:n}=e;const[r,o]=x.useState(null),l=x.useCallback(m=>{for(const{target:v}of m)if(Ki(v)){o(k=>{const y=n(v);return k?{...k,width:y.width,height:y.height}:y});break}},[n]),c=ac({callback:l}),d=x.useCallback(m=>{const v=hy(m);c==null||c.disconnect(),v&&(c==null||c.observe(v)),o(v?n(v):null)},[n,c]),[f,h]=Dl(d);return x.useMemo(()=>({nodeRef:f,rect:r,setRef:h}),[r,f,h])}const fb=[{sensor:ic,options:{}},{sensor:fy,options:{}}],pb={current:{}},gl={draggable:{measure:$m},droppable:{measure:$m,strategy:Ui.WhileDragging,frequency:Ed.Optimized},dragOverlay:{measure:Po}};class Ai extends Map{get(n){var r;return n!=null&&(r=super.get(n))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(n=>{let{disabled:r}=n;return!r})}getNodeFor(n){var r,o;return(r=(o=this.get(n))==null?void 0:o.node.current)!=null?r:void 0}}const hb={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ai,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:$l},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:gl,measureDroppableContainers:$l,windowRect:null,measuringScheduled:!1},my={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:$l,draggableNodes:new Map,over:null,measureDroppableContainers:$l},Xi=x.createContext(my),gy=x.createContext(hb);function mb(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ai}}}function gb(e,n){switch(n.type){case Yt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:n.initialCoordinates,active:n.active}};case Yt.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:n.coordinates.x-e.draggable.initialCoordinates.x,y:n.coordinates.y-e.draggable.initialCoordinates.y}}};case Yt.DragEnd:case Yt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Yt.RegisterDroppable:{const{element:r}=n,{id:o}=r,l=new Ai(e.droppable.containers);return l.set(o,r),{...e,droppable:{...e.droppable,containers:l}}}case Yt.SetDroppableDisabled:{const{id:r,key:o,disabled:l}=n,c=e.droppable.containers.get(r);if(!c||o!==c.key)return e;const d=new Ai(e.droppable.containers);return d.set(r,{...c,disabled:l}),{...e,droppable:{...e.droppable,containers:d}}}case Yt.UnregisterDroppable:{const{id:r,key:o}=n,l=e.droppable.containers.get(r);if(!l||o!==l.key)return e;const c=new Ai(e.droppable.containers);return c.delete(r),{...e,droppable:{...e.droppable,containers:c}}}default:return e}}function vb(e){let{disabled:n}=e;const{active:r,activatorEvent:o,draggableNodes:l}=x.useContext(Xi),c=Ml(o),d=Ml(r==null?void 0:r.id);return x.useEffect(()=>{if(!n&&!o&&c&&d!=null){if(!oc(c)||document.activeElement===c.target)return;const f=l.get(d);if(!f)return;const{activatorNode:h,node:m}=f;if(!h.current&&!m.current)return;requestAnimationFrame(()=>{for(const v of[h.current,m.current]){if(!v)continue;const k=fS(v);if(k){k.focus();break}}})}},[o,n,l,d,c]),null}function vy(e,n){let{transform:r,...o}=n;return e!=null&&e.length?e.reduce((l,c)=>c({transform:l,...o}),r):r}function yb(e){return x.useMemo(()=>({draggable:{...gl.draggable,...e==null?void 0:e.draggable},droppable:{...gl.droppable,...e==null?void 0:e.droppable},dragOverlay:{...gl.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function xb(e){let{activeNode:n,measure:r,initialRect:o,config:l=!0}=e;const c=x.useRef(!1),{x:d,y:f}=typeof l=="boolean"?{x:l,y:l}:l;ms(()=>{if(!d&&!f||!n){c.current=!1;return}if(c.current||!o)return;const m=n==null?void 0:n.node.current;if(!m||m.isConnected===!1)return;const v=r(m),k=ny(v,o);if(d||(k.x=0),f||(k.y=0),c.current=!0,Math.abs(k.x)>0||Math.abs(k.y)>0){const y=ry(m);y&&y.scrollBy({top:k.y,left:k.x})}},[n,d,f,o,r])}const lc=x.createContext({...gs,scaleX:1,scaleY:1});var pr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(pr||(pr={}));const yy=x.memo(function(n){var r,o,l,c;let{id:d,accessibility:f,autoScroll:h=!0,children:m,sensors:v=fb,collisionDetection:k=jS,measuring:y,modifiers:S,...j}=n;const T=x.useReducer(gb,void 0,mb),[C,b]=T,[A,$]=yS(),[P,z]=x.useState(pr.Uninitialized),G=P===pr.Initialized,{draggable:{active:M,nodes:F,translate:Z},droppable:{containers:Q}}=C,J=M!=null?F.get(M):null,he=x.useRef({initial:null,translated:null}),ke=x.useMemo(()=>{var ct;return M!=null?{id:M,data:(ct=J==null?void 0:J.data)!=null?ct:pb,rect:he}:null},[M,J]),re=x.useRef(null),[ve,le]=x.useState(null),[ee,X]=x.useState(null),ie=Fi(j,Object.values(j)),K=qi("DndDescribedBy",d),E=x.useMemo(()=>Q.getEnabled(),[Q]),L=yb(y),{droppableRects:de,measureDroppableContainers:U,measuringScheduled:me}=tb(E,{dragging:G,dependencies:[Z.x,Z.y],config:L.droppable}),Y=JS(F,M),xe=x.useMemo(()=>ee?Ol(ee):null,[ee]),we=Cn(),Me=nb(Y,L.draggable.measure);xb({activeNode:M!=null?F.get(M):null,config:we.layoutShiftCompensation,initialRect:Me,measure:L.draggable.measure});const _e=Bm(Y,L.draggable.measure,Me),ge=Bm(Y?Y.parentElement:null),pe=x.useRef({activatorEvent:null,active:null,activeNode:Y,collisionRect:null,collisions:null,droppableRects:de,draggableNodes:F,draggingNode:null,draggingNodeRect:null,droppableContainers:Q,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Xe=Q.getNodeFor((r=pe.current.over)==null?void 0:r.id),Re=db({measure:L.dragOverlay.measure}),at=(o=Re.nodeRef.current)!=null?o:Y,He=G?(l=Re.rect)!=null?l:_e:null,Te=!!(Re.nodeRef.current&&Re.rect),Ue=ob(Te?null:_e),Ke=py(at?Tn(at):null),lt=ib(G?Xe??Y:null),Tt=ub(lt),Wt=vy(S,{transform:{x:Z.x-Ue.x,y:Z.y-Ue.y,scaleX:1,scaleY:1},activatorEvent:ee,active:ke,activeNodeRect:_e,containerNodeRect:ge,draggingNodeRect:He,over:pe.current.over,overlayNodeRect:Re.rect,scrollableAncestors:lt,scrollableAncestorRects:Tt,windowRect:Ke}),q=xe?Ao(xe,Z):null,Se=ab(lt),Pe=Hm(Se),Ye=Hm(Se,[_e]),xt=Ao(Wt,Pe),wt=He?AS(He,Wt):null,Dt=ke&&wt?k({active:ke,collisionRect:wt,droppableRects:de,droppableContainers:E,pointerCoordinates:q}):null,un=CS(Dt,"id"),[Ct,Mn]=x.useState(null),Ln=Te?Wt:Ao(Wt,Ye),ts=_S(Ln,(c=Ct==null?void 0:Ct.rect)!=null?c:null,_e),ns=x.useRef(null),ss=x.useCallback((ct,mt)=>{let{sensor:Et,options:Ht}=mt;if(re.current==null)return;const kt=F.get(re.current);if(!kt)return;const gt=ct.nativeEvent,ft=new Et({active:re.current,activeNode:kt,event:gt,options:Ht,context:pe,onAbort(ut){if(!F.get(ut))return;const{onDragAbort:Mt}=ie.current,I={id:ut};Mt==null||Mt(I),A({type:"onDragAbort",event:I})},onPending(ut,Qt,Mt,I){if(!F.get(ut))return;const{onDragPending:ae}=ie.current,be={id:ut,constraint:Qt,initialCoordinates:Mt,offset:I};ae==null||ae(be),A({type:"onDragPending",event:be})},onStart(ut){const Qt=re.current;if(Qt==null)return;const Mt=F.get(Qt);if(!Mt)return;const{onDragStart:I}=ie.current,fe={activatorEvent:gt,active:{id:Qt,data:Mt.data,rect:he}};Ci.unstable_batchedUpdates(()=>{I==null||I(fe),z(pr.Initializing),b({type:Yt.DragStart,initialCoordinates:ut,active:Qt}),A({type:"onDragStart",event:fe}),le(ns.current),X(gt)})},onMove(ut){b({type:Yt.DragMove,coordinates:ut})},onEnd:Vt(Yt.DragEnd),onCancel:Vt(Yt.DragCancel)});ns.current=ft;function Vt(ut){return async function(){const{active:Mt,collisions:I,over:fe,scrollAdjustedTranslate:ae}=pe.current;let be=null;if(Mt&&ae){const{cancelDrop:Fe}=ie.current;be={activatorEvent:gt,active:Mt,collisions:I,delta:ae,over:fe},ut===Yt.DragEnd&&typeof Fe=="function"&&await Promise.resolve(Fe(be))&&(ut=Yt.DragCancel)}re.current=null,Ci.unstable_batchedUpdates(()=>{b({type:ut}),z(pr.Uninitialized),Mn(null),le(null),X(null),ns.current=null;const Fe=ut===Yt.DragEnd?"onDragEnd":"onDragCancel";if(be){const Qe=ie.current[Fe];Qe==null||Qe(be),A({type:Fe,event:be})}})}}},[F]),rs=x.useCallback((ct,mt)=>(Et,Ht)=>{const kt=Et.nativeEvent,gt=F.get(Ht);if(re.current!==null||!gt||kt.dndKit||kt.defaultPrevented)return;const ft={active:gt};ct(Et,mt.options,ft)===!0&&(kt.dndKit={capturedBy:mt.sensor},re.current=Ht,ss(Et,mt))},[F,ss]),vn=eb(v,rs);lb(v),ms(()=>{_e&&P===pr.Initializing&&z(pr.Initialized)},[_e,P]),x.useEffect(()=>{const{onDragMove:ct}=ie.current,{active:mt,activatorEvent:Et,collisions:Ht,over:kt}=pe.current;if(!mt||!Et)return;const gt={active:mt,activatorEvent:Et,collisions:Ht,delta:{x:xt.x,y:xt.y},over:kt};Ci.unstable_batchedUpdates(()=>{ct==null||ct(gt),A({type:"onDragMove",event:gt})})},[xt.x,xt.y]),x.useEffect(()=>{const{active:ct,activatorEvent:mt,collisions:Et,droppableContainers:Ht,scrollAdjustedTranslate:kt}=pe.current;if(!ct||re.current==null||!mt||!kt)return;const{onDragOver:gt}=ie.current,ft=Ht.get(un),Vt=ft&&ft.rect.current?{id:ft.id,rect:ft.rect.current,data:ft.data,disabled:ft.disabled}:null,ut={active:ct,activatorEvent:mt,collisions:Et,delta:{x:kt.x,y:kt.y},over:Vt};Ci.unstable_batchedUpdates(()=>{Mn(Vt),gt==null||gt(ut),A({type:"onDragOver",event:ut})})},[un]),ms(()=>{pe.current={activatorEvent:ee,active:ke,activeNode:Y,collisionRect:wt,collisions:Dt,droppableRects:de,draggableNodes:F,draggingNode:at,draggingNodeRect:He,droppableContainers:Q,over:Ct,scrollableAncestors:lt,scrollAdjustedTranslate:xt},he.current={initial:He,translated:wt}},[ke,Y,Dt,wt,F,at,He,de,Q,Ct,lt,xt]),YS({...we,delta:Z,draggingRect:wt,pointerCoordinates:q,scrollableAncestors:lt,scrollableAncestorRects:Tt});const dn=x.useMemo(()=>({active:ke,activeNode:Y,activeNodeRect:_e,activatorEvent:ee,collisions:Dt,containerNodeRect:ge,dragOverlay:Re,draggableNodes:F,droppableContainers:Q,droppableRects:de,over:Ct,measureDroppableContainers:U,scrollableAncestors:lt,scrollableAncestorRects:Tt,measuringConfiguration:L,measuringScheduled:me,windowRect:Ke}),[ke,Y,_e,ee,Dt,ge,Re,F,Q,de,Ct,U,lt,Tt,L,me,Ke]),Ft=x.useMemo(()=>({activatorEvent:ee,activators:vn,active:ke,activeNodeRect:_e,ariaDescribedById:{draggable:K},dispatch:b,draggableNodes:F,over:Ct,measureDroppableContainers:U}),[ee,vn,ke,_e,b,K,F,Ct,U]);return pt.createElement(Zv.Provider,{value:$},pt.createElement(Xi.Provider,{value:Ft},pt.createElement(gy.Provider,{value:dn},pt.createElement(lc.Provider,{value:ts},m)),pt.createElement(vb,{disabled:(f==null?void 0:f.restoreFocus)===!1})),pt.createElement(kS,{...f,hiddenTextDescribedById:K}));function Cn(){const ct=(ve==null?void 0:ve.autoScrollEnabled)===!1,mt=typeof h=="object"?h.enabled===!1:h===!1,Et=G&&!ct&&!mt;return typeof h=="object"?{...h,enabled:Et}:{enabled:Et}}}),wb=x.createContext(null),Km="button",kb="Draggable";function Sb(e){let{id:n,data:r,disabled:o=!1,attributes:l}=e;const c=qi(kb),{activators:d,activatorEvent:f,active:h,activeNodeRect:m,ariaDescribedById:v,draggableNodes:k,over:y}=x.useContext(Xi),{role:S=Km,roleDescription:j="draggable",tabIndex:T=0}=l??{},C=(h==null?void 0:h.id)===n,b=x.useContext(C?lc:wb),[A,$]=Dl(),[P,z]=Dl(),G=cb(d,n),M=Fi(r);ms(()=>(k.set(n,{id:n,key:c,node:A,activatorNode:P,data:M}),()=>{const Z=k.get(n);Z&&Z.key===c&&k.delete(n)}),[k,n]);const F=x.useMemo(()=>({role:S,tabIndex:T,"aria-disabled":o,"aria-pressed":C&&S===Km?!0:void 0,"aria-roledescription":j,"aria-describedby":v.draggable}),[o,S,T,C,j,v.draggable]);return{active:h,activatorEvent:f,activeNodeRect:m,attributes:F,isDragging:C,listeners:o?void 0:G,node:A,over:y,setNodeRef:$,setActivatorNodeRef:z,transform:b}}function xy(){return x.useContext(gy)}const bb="Droppable",Nb={timeout:25};function wy(e){let{data:n,disabled:r=!1,id:o,resizeObserverConfig:l}=e;const c=qi(bb),{active:d,dispatch:f,over:h,measureDroppableContainers:m}=x.useContext(Xi),v=x.useRef({disabled:r}),k=x.useRef(!1),y=x.useRef(null),S=x.useRef(null),{disabled:j,updateMeasurementsFor:T,timeout:C}={...Nb,...l},b=Fi(T??o),A=x.useCallback(()=>{if(!k.current){k.current=!0;return}S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{m(Array.isArray(b.current)?b.current:[b.current]),S.current=null},C)},[C]),$=ac({callback:A,disabled:j||!d}),P=x.useCallback((F,Z)=>{$&&(Z&&($.unobserve(Z),k.current=!1),F&&$.observe(F))},[$]),[z,G]=Dl(P),M=Fi(n);return x.useEffect(()=>{!$||!z.current||($.disconnect(),k.current=!1,$.observe(z.current))},[z,$]),x.useEffect(()=>(f({type:Yt.RegisterDroppable,element:{id:o,key:c,disabled:r,node:z,rect:y,data:M}}),()=>f({type:Yt.UnregisterDroppable,key:c,id:o})),[o]),x.useEffect(()=>{r!==v.current.disabled&&(f({type:Yt.SetDroppableDisabled,id:o,key:c,disabled:r}),v.current.disabled=r)},[o,c,r,f]),{active:d,rect:y,isOver:(h==null?void 0:h.id)===o,node:z,over:h,setNodeRef:G}}function Tb(e){let{animation:n,children:r}=e;const[o,l]=x.useState(null),[c,d]=x.useState(null),f=Ml(r);return!r&&!o&&f&&l(f),ms(()=>{if(!c)return;const h=o==null?void 0:o.key,m=o==null?void 0:o.props.id;if(h==null||m==null){l(null);return}Promise.resolve(n(m,c)).then(()=>{l(null)})},[n,o,c]),pt.createElement(pt.Fragment,null,r,o?x.cloneElement(o,{ref:d}):null)}const Cb={x:0,y:0,scaleX:1,scaleY:1};function Eb(e){let{children:n}=e;return pt.createElement(Xi.Provider,{value:my},pt.createElement(lc.Provider,{value:Cb},n))}const jb={position:"fixed",touchAction:"none"},_b=e=>oc(e)?"transform 250ms ease":void 0,Rb=x.forwardRef((e,n)=>{let{as:r,activatorEvent:o,adjustScale:l,children:c,className:d,rect:f,style:h,transform:m,transition:v=_b}=e;if(!f)return null;const k=l?m:{...m,scaleX:1,scaleY:1},y={...jb,width:f.width,height:f.height,top:f.top,left:f.left,transform:Rs.Transform.toString(k),transformOrigin:l&&o?bS(o,f):void 0,transition:typeof v=="function"?v(o):v,...h};return pt.createElement(r,{className:d,style:y,ref:n},c)}),Ab=e=>n=>{let{active:r,dragOverlay:o}=n;const l={},{styles:c,className:d}=e;if(c!=null&&c.active)for(const[f,h]of Object.entries(c.active))h!==void 0&&(l[f]=r.node.style.getPropertyValue(f),r.node.style.setProperty(f,h));if(c!=null&&c.dragOverlay)for(const[f,h]of Object.entries(c.dragOverlay))h!==void 0&&o.node.style.setProperty(f,h);return d!=null&&d.active&&r.node.classList.add(d.active),d!=null&&d.dragOverlay&&o.node.classList.add(d.dragOverlay),function(){for(const[h,m]of Object.entries(l))r.node.style.setProperty(h,m);d!=null&&d.active&&r.node.classList.remove(d.active)}},Ib=e=>{let{transform:{initial:n,final:r}}=e;return[{transform:Rs.Transform.toString(n)},{transform:Rs.Transform.toString(r)}]},Db={duration:250,easing:"ease",keyframes:Ib,sideEffects:Ab({styles:{active:{opacity:"0"}}})};function Mb(e){let{config:n,draggableNodes:r,droppableContainers:o,measuringConfiguration:l}=e;return rc((c,d)=>{if(n===null)return;const f=r.get(c);if(!f)return;const h=f.node.current;if(!h)return;const m=hy(d);if(!m)return;const{transform:v}=Tn(d).getComputedStyle(d),k=sy(v);if(!k)return;const y=typeof n=="function"?n:Lb(n);return uy(h,l.draggable.measure),y({active:{id:c,data:f.data,node:h,rect:l.draggable.measure(h)},draggableNodes:r,dragOverlay:{node:d,rect:l.dragOverlay.measure(m)},droppableContainers:o,measuringConfiguration:l,transform:k})})}function Lb(e){const{duration:n,easing:r,sideEffects:o,keyframes:l}={...Db,...e};return c=>{let{active:d,dragOverlay:f,transform:h,...m}=c;if(!n)return;const v={x:f.rect.left-d.rect.left,y:f.rect.top-d.rect.top},k={scaleX:h.scaleX!==1?d.rect.width*h.scaleX/f.rect.width:1,scaleY:h.scaleY!==1?d.rect.height*h.scaleY/f.rect.height:1},y={x:h.x-v.x,y:h.y-v.y,...k},S=l({...m,active:d,dragOverlay:f,transform:{initial:h,final:y}}),[j]=S,T=S[S.length-1];if(JSON.stringify(j)===JSON.stringify(T))return;const C=o==null?void 0:o({active:d,dragOverlay:f,...m}),b=f.node.animate(S,{duration:n,easing:r,fill:"forwards"});return new Promise(A=>{b.onfinish=()=>{C==null||C(),A()}})}}let Gm=0;function Ob(e){return x.useMemo(()=>{if(e!=null)return Gm++,Gm},[e])}const $b=pt.memo(e=>{let{adjustScale:n=!1,children:r,dropAnimation:o,style:l,transition:c,modifiers:d,wrapperElement:f="div",className:h,zIndex:m=999}=e;const{activatorEvent:v,active:k,activeNodeRect:y,containerNodeRect:S,draggableNodes:j,droppableContainers:T,dragOverlay:C,over:b,measuringConfiguration:A,scrollableAncestors:$,scrollableAncestorRects:P,windowRect:z}=xy(),G=x.useContext(lc),M=Ob(k==null?void 0:k.id),F=vy(d,{activatorEvent:v,active:k,activeNodeRect:y,containerNodeRect:S,draggingNodeRect:C.rect,over:b,overlayNodeRect:C.rect,scrollableAncestors:$,scrollableAncestorRects:P,transform:G,windowRect:z}),Z=df(y),Q=Mb({config:o,draggableNodes:j,droppableContainers:T,measuringConfiguration:A}),J=Z?C.setRef:void 0;return pt.createElement(Eb,null,pt.createElement(Tb,{animation:Q},k&&M?pt.createElement(Rb,{key:M,id:k.id,ref:J,as:f,activatorEvent:v,adjustScale:n,className:h,transition:c,rect:Z,style:{zIndex:m,...l},transform:F},r):null))});function ky(e,n,r){const o=e.slice();return o.splice(r<0?o.length+r:r,0,o.splice(n,1)[0]),o}function Pb(e,n){return e.reduce((r,o,l)=>{const c=n.get(o);return c&&(r[l]=c),r},Array(e.length))}function nl(e){return e!==null&&e>=0}function zb(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}function Fb(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const sl={scaleX:1,scaleY:1},Ub=e=>{var n;let{rects:r,activeNodeRect:o,activeIndex:l,overIndex:c,index:d}=e;const f=(n=r[l])!=null?n:o;if(!f)return null;const h=Bb(r,d,l);if(d===l){const m=r[c];return m?{x:l<c?m.left+m.width-(f.left+f.width):m.left-f.left,y:0,...sl}:null}return d>l&&d<=c?{x:-f.width-h,y:0,...sl}:d<l&&d>=c?{x:f.width+h,y:0,...sl}:{x:0,y:0,...sl}};function Bb(e,n,r){const o=e[n],l=e[n-1],c=e[n+1];return!o||!l&&!c?0:r<n?l?o.left-(l.left+l.width):c.left-(o.left+o.width):c?c.left-(o.left+o.width):o.left-(l.left+l.width)}const Sy=e=>{let{rects:n,activeIndex:r,overIndex:o,index:l}=e;const c=ky(n,o,r),d=n[l],f=c[l];return!f||!d?null:{x:f.left-d.left,y:f.top-d.top,scaleX:f.width/d.width,scaleY:f.height/d.height}},rl={scaleX:1,scaleY:1},qm=e=>{var n;let{activeIndex:r,activeNodeRect:o,index:l,rects:c,overIndex:d}=e;const f=(n=c[r])!=null?n:o;if(!f)return null;if(l===r){const m=c[d];return m?{x:0,y:r<d?m.top+m.height-(f.top+f.height):m.top-f.top,...rl}:null}const h=Wb(c,l,r);return l>r&&l<=d?{x:0,y:-f.height-h,...rl}:l<r&&l>=d?{x:0,y:f.height+h,...rl}:{x:0,y:0,...rl}};function Wb(e,n,r){const o=e[n],l=e[n-1],c=e[n+1];return o?r<n?l?o.top-(l.top+l.height):c?c.top-(o.top+o.height):0:c?c.top-(o.top+o.height):l?o.top-(l.top+l.height):0:0}const by="Sortable",Ny=pt.createContext({activeIndex:-1,containerId:by,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Sy,disabled:{draggable:!1,droppable:!1}});function jd(e){let{children:n,id:r,items:o,strategy:l=Sy,disabled:c=!1}=e;const{active:d,dragOverlay:f,droppableRects:h,over:m,measureDroppableContainers:v}=xy(),k=qi(by,r),y=f.rect!==null,S=x.useMemo(()=>o.map(G=>typeof G=="object"&&"id"in G?G.id:G),[o]),j=d!=null,T=d?S.indexOf(d.id):-1,C=m?S.indexOf(m.id):-1,b=x.useRef(S),A=!zb(S,b.current),$=C!==-1&&T===-1||A,P=Fb(c);ms(()=>{A&&j&&v(S)},[A,S,j,v]),x.useEffect(()=>{b.current=S},[S]);const z=x.useMemo(()=>({activeIndex:T,containerId:k,disabled:P,disableTransforms:$,items:S,overIndex:C,useDragOverlay:y,sortedRects:Pb(S,h),strategy:l}),[T,k,P.draggable,P.droppable,$,S,C,h,y,l]);return pt.createElement(Ny.Provider,{value:z},n)}const Hb=e=>{let{id:n,items:r,activeIndex:o,overIndex:l}=e;return ky(r,o,l).indexOf(n)},Vb=e=>{let{containerId:n,isSorting:r,wasDragging:o,index:l,items:c,newIndex:d,previousItems:f,previousContainerId:h,transition:m}=e;return!m||!o||f!==c&&l===d?!1:r?!0:d!==l&&n===h},Kb={duration:200,easing:"ease"},Ty="transform",Gb=Rs.Transition.toString({property:Ty,duration:0,easing:"linear"}),qb={roleDescription:"sortable"};function Xb(e){let{disabled:n,index:r,node:o,rect:l}=e;const[c,d]=x.useState(null),f=x.useRef(r);return ms(()=>{if(!n&&r!==f.current&&o.current){const h=l.current;if(h){const m=Po(o.current,{ignoreTransform:!0}),v={x:h.left-m.left,y:h.top-m.top,scaleX:h.width/m.width,scaleY:h.height/m.height};(v.x||v.y)&&d(v)}}r!==f.current&&(f.current=r)},[n,r,o,l]),x.useEffect(()=>{c&&d(null)},[c]),c}function ff(e){let{animateLayoutChanges:n=Vb,attributes:r,disabled:o,data:l,getNewIndex:c=Hb,id:d,strategy:f,resizeObserverConfig:h,transition:m=Kb}=e;const{items:v,containerId:k,activeIndex:y,disabled:S,disableTransforms:j,sortedRects:T,overIndex:C,useDragOverlay:b,strategy:A}=x.useContext(Ny),$=Yb(o,S),P=v.indexOf(d),z=x.useMemo(()=>({sortable:{containerId:k,index:P,items:v},...l}),[k,l,P,v]),G=x.useMemo(()=>v.slice(v.indexOf(d)),[v,d]),{rect:M,node:F,isOver:Z,setNodeRef:Q}=wy({id:d,data:z,disabled:$.droppable,resizeObserverConfig:{updateMeasurementsFor:G,...h}}),{active:J,activatorEvent:he,activeNodeRect:ke,attributes:re,setNodeRef:ve,listeners:le,isDragging:ee,over:X,setActivatorNodeRef:ie,transform:K}=Sb({id:d,data:z,attributes:{...qb,...r},disabled:$.draggable}),E=lS(Q,ve),L=!!J,de=L&&!j&&nl(y)&&nl(C),U=!b&&ee,me=U&&de?K:null,xe=de?me??(f??A)({rects:T,activeNodeRect:ke,activeIndex:y,overIndex:C,index:P}):null,we=nl(y)&&nl(C)?c({id:d,items:v,activeIndex:y,overIndex:C}):P,Me=J==null?void 0:J.id,_e=x.useRef({activeId:Me,items:v,newIndex:we,containerId:k}),ge=v!==_e.current.items,pe=n({active:J,containerId:k,isDragging:ee,isSorting:L,id:d,index:P,items:v,newIndex:_e.current.newIndex,previousItems:_e.current.items,previousContainerId:_e.current.containerId,transition:m,wasDragging:_e.current.activeId!=null}),Xe=Xb({disabled:!pe,index:P,node:F,rect:M});return x.useEffect(()=>{L&&_e.current.newIndex!==we&&(_e.current.newIndex=we),k!==_e.current.containerId&&(_e.current.containerId=k),v!==_e.current.items&&(_e.current.items=v)},[L,we,k,v]),x.useEffect(()=>{if(Me===_e.current.activeId)return;if(Me!=null&&_e.current.activeId==null){_e.current.activeId=Me;return}const at=setTimeout(()=>{_e.current.activeId=Me},50);return()=>clearTimeout(at)},[Me]),{active:J,activeIndex:y,attributes:re,data:z,rect:M,index:P,newIndex:we,items:v,isOver:Z,isSorting:L,isDragging:ee,listeners:le,node:F,overIndex:C,over:X,setNodeRef:E,setActivatorNodeRef:ie,setDroppableNodeRef:Q,setDraggableNodeRef:ve,transform:Xe??xe,transition:Re()};function Re(){if(Xe||ge&&_e.current.newIndex===P)return Gb;if(!(U&&!oc(he)||!m)&&(L||pe))return Rs.Transition.toString({...m,property:Ty})}}function Yb(e,n){var r,o;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:n.draggable,droppable:(o=e==null?void 0:e.droppable)!=null?o:n.droppable}}rt.Down,rt.Right,rt.Up,rt.Left;function ol(e){const[n,r]=x.useState(()=>{try{const l=localStorage.getItem(e);if(l==null)return new Set;const c=JSON.parse(l);return Array.isArray(c)?new Set(c.filter(d=>typeof d=="string")):new Set}catch{return new Set}}),o=x.useCallback(l=>{r(c=>{const d=l(new Set(c));try{localStorage.setItem(e,JSON.stringify([...d]))}catch{}return d})},[e]);return[n,o]}function Qb(e,n=!1){const[r,o]=x.useState(()=>{try{const c=localStorage.getItem(e);return c==="1"?!0:c==="0"?!1:n}catch{return n}}),l=x.useCallback(c=>{o(c);try{localStorage.setItem(e,c?"1":"0")}catch{}},[e]);return[r,l]}async function Bi(e){try{return await navigator.clipboard.writeText(e),!0}catch{try{const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select();const r=document.execCommand("copy");return document.body.removeChild(n),r}catch{return!1}}}function Zb(e){return e.origin_app_id!=null&&!e.user_touched&&!e.starred}const _d="(no directory)";function vr(e){return e.replaceAll("\\","/").replace(/\/+$/,"")}function Rd(e,n){if(!n||!e.cwd)return!1;const r=vr(e.cwd),o=vr(n);return r.startsWith(`${o}/`)}function Jb(e,n){const r=new Map;for(const d of n){const f=d.cwd||_d,h=r.get(f)??[];h.push(d),r.set(f,h)}const o=new Set,l=new Set(e.filter(d=>d.deleted===1).map(d=>d.path)),c=[];for(const d of e){if(d.deleted===1){o.add(d.path);continue}o.add(d.path),c.push({path:d.path,label:d.label||d.path.split("/").pop()||d.path,sessions:r.get(d.path)??[],workspace:d})}for(const[d,f]of r)o.has(d)||l.has(d)||c.push({path:d,label:d===_d?"Other":d.split("/").pop()||d,sessions:f,workspace:null});return c}function eN(e,n,r){if(n.length===0)return!1;const o=new Set(e.filter(l=>l.deleted===1).map(l=>l.path));return n.some(l=>!Rd(l,r)&&!o.has(l.cwd||_d))}function zl(e){return[...e].sort((n,r)=>r.sort_order-n.sort_order||(n.created_at<r.created_at?1:-1))}function Xm(e,n,r,o){const l=n.map(c=>({folder:c,sessions:e.sessions.filter(d=>d.folder_id===c.id),finishedKey:`folder:${c.id}:finished`,hidden:o.has(c.id)}));return l.push({folder:null,sessions:e.sessions.filter(c=>!(c.folder_id&&r.has(c.folder_id))),finishedKey:`${e.path}:finished`,hidden:!1}),l}function Ym(e,n){return{working:zl(e.sessions.filter(r=>r.lifecycle!=="finished")),finished:zl(e.sessions.filter(r=>r.lifecycle==="finished")),finishedCollapsed:n.has(e.finishedKey)}}function il(e,n){return e.folder_id&&n.has(e.folder_id)?e.folder_id:null}function tN(e){const n=new Set(e.map(o=>o.name));if(!n.has("New Folder"))return"New Folder";let r=2;for(;n.has(`New Folder ${r}`);)r++;return`New Folder ${r}`}function Qm({id:e,children:n,className:r}){const{setNodeRef:o,isOver:l}=wy({id:e});return a.jsx("div",{ref:o,className:`${r??""}${l?" drop-over":""}`,children:n})}function pf({inputRef:e,value:n,onChange:r,onConfirm:o,onCancel:l}){return a.jsx("input",{ref:e,className:"tree-rename-input",value:n,onChange:c=>r(c.target.value),onClick:c=>c.stopPropagation(),onPointerDown:c=>c.stopPropagation(),onKeyDown:c=>{c.key==="Enter"&&o(),c.key==="Escape"&&l()},onBlur:o})}function nN({s:e,backgroundTaskCount:n,isActive:r,isSelected:o,originApp:l,renaming:c,renameValue:d,renameRef:f,onRenameValue:h,onRenameConfirm:m,onRenameCancel:v,onSelect:k,onCtxMenu:y,onToggleStar:S}){const{attributes:j,listeners:T,setNodeRef:C,transform:b,transition:A,isDragging:$}=ff({id:`s:${e.id}`}),P=Jl(e,n);return a.jsxs("div",{ref:C,style:{transform:Rs.Transform.toString(b),transition:A},className:`tree-item ${r?"active":""}${o?" selected":""} ${P.isFinished?"tree-item-finished":""}${$?" dragging":""}${e.starred?" tree-item-starred":""}`,...j,...T,onClick:k,onContextMenu:y,children:[a.jsx(sf,{iconClass:P.iconClass,iconText:P.iconText,size:16}),l&&a.jsx("span",{className:"tree-app-badge",title:"Created by a mini app",children:a.jsx(Lo,{iconNode:l.iconNode,size:10})}),c?a.jsx(pf,{inputRef:f,value:d,onChange:h,onConfirm:m,onCancel:v}):a.jsx("span",{className:"tree-label",children:e.title||e.id.slice(0,8)}),!c&&a.jsx("button",{className:`star-btn${e.starred?" starred":""}`,title:e.starred?"Unstar session":"Star session",onClick:z=>{z.stopPropagation(),S()},onPointerDown:z=>z.stopPropagation(),children:a.jsx(Il,{size:10,fill:e.starred?"currentColor":"none"})}),P.dot&&a.jsx(nf,{status:P.dot,title:P.dotTitle})]})}function sN({folder:e,count:n,collapsed:r,renaming:o,renameValue:l,renameRef:c,onRenameValue:d,onRenameConfirm:f,onRenameCancel:h,onToggle:m,onCtxMenu:v,children:k}){const{attributes:y,listeners:S,setNodeRef:j,transform:T,transition:C,isDragging:b,over:A}=ff({id:`f:${e.id}`}),$=A!=null&&String(A.id).startsWith("s:");return a.jsxs("div",{ref:j,style:{transform:Rs.Transform.toString(T),transition:C},className:`tree-folder ${r?"collapsed":""}${b?" dragging":""}`,children:[a.jsx("div",{className:`tree-folder-header${$?" drop-over":""}`,...y,...S,onClick:()=>{o||m()},onContextMenu:v,children:o?a.jsx(pf,{inputRef:c,value:l,onChange:d,onConfirm:f,onCancel:h}):a.jsxs(a.Fragment,{children:[a.jsx(Ro,{size:8,className:"tree-chevron"}),a.jsx(Al,{size:12}),a.jsx("span",{className:"tree-folder-label",children:e.name}),a.jsx("span",{className:"tree-count",children:n})]})}),!r&&a.jsx("div",{className:"tree-folder-children",children:k})]})}function rN(){const e=R(I=>I.sessions),n=R(I=>I.backgroundTasks),r=R(I=>I.workspaces),o=R(I=>I.folders),l=R(I=>I.activeSessionId),c=R(I=>I.selectSession),d=R(I=>I.deleteSession),f=R(I=>I.removeWorkspace),h=R(I=>I.createSessionInWorkspace),m=R(I=>I.pickAndAddWorkspace),v=R(I=>I.setImportSessionsWorkspace),k=R(I=>I.renameSession),y=R(I=>I.markFinished),S=R(I=>I.markFinishedMany),j=R(I=>I.toggleStar),T=R(I=>I.reopenSession),C=R(I=>I.reopenSessionMany),b=R(I=>I.deleteSessionMany),A=R(I=>I.createSidebarFolder),$=R(I=>I.renameFolder),P=R(I=>I.deleteFolder),z=R(I=>I.applyMoves),G=R(I=>I.reorderFolders),M=R(I=>I.apps),F=R(I=>I.appsRootPath),Z=R(I=>I.activeAppTabId),Q=R(I=>I.openAppTab),J=R(I=>I.startAppEdit),he=R(I=>I.toggleAppPin),ke=R(I=>I.deleteApp),re=R(I=>I.openAppExport),ve=R(I=>I.openAppCatalog),[le,ee]=ol("agentpane:sidebar-ws-collapsed"),[X,ie]=ol("agentpane:sidebar-sub-collapsed"),[K,E]=ol("agentpane:sidebar-folders-collapsed"),[L,de]=ol("agentpane:sidebar-app-edits-collapsed"),[U,me]=Qb("agentpane:sidebar-hide-auto-sessions"),[Y,xe]=x.useState(null),[we,Me]=x.useState(null),[_e,ge]=x.useState(""),[pe,Xe]=x.useState(null),[Re,at]=x.useState(new Set),[He,Te]=x.useState(null),Ue=x.useRef(null),Ke=x.useRef(null),lt=x.useRef(null),Tt=x.useRef(!1),Wt=ey(Jv(ic,{activationConstraint:{distance:5}}));function q(){at(new Set),Te(null)}Hi(Ue,()=>xe(null),!!Y),Mo(()=>{xe(null),q()},!!Y||Re.size>0),x.useLayoutEffect(()=>{const I=Ue.current;if(!Y||!I)return;const fe=8,{offsetWidth:ae,offsetHeight:be}=I,Fe=Y.x+ae>window.innerWidth-fe?Math.max(fe,Y.x-ae):Y.x,Qe=Y.y+be>window.innerHeight-fe?Math.max(fe,Y.y-be):Y.y;I.style.left=`${Fe}px`,I.style.top=`${Qe}px`},[Y]);const Se=x.useMemo(()=>new Map(e.map(I=>[I.id,I])),[e]),Pe=x.useMemo(()=>new Map(o.map(I=>[I.id,I])),[o]),Ye=x.useMemo(()=>{const I=new Map;for(const fe of[...o].sort((ae,be)=>ae.sort_order-be.sort_order)){const ae=I.get(fe.workspace_path)??[];ae.push(fe),I.set(fe.workspace_path,ae)}return I},[o]);function xt(I){ee(fe=>{const ae=new Set(fe);return ae.has(I)?ae.delete(I):ae.add(I),ae})}function wt(I){ie(fe=>{const ae=new Set(fe);return ae.has(I)?ae.delete(I):ae.add(I),ae})}function Dt(I){E(fe=>{const ae=new Set(fe);return ae.has(I)?ae.delete(I):ae.add(I),ae})}function un(){me(!U),q()}function Ct(I){de(fe=>{const ae=new Set(fe);return ae.has(I)?ae.delete(I):ae.add(I),ae})}x.useEffect(()=>{we&&Ke.current&&(Ke.current.focus(),Ke.current.select())},[we]),x.useEffect(()=>{var I,fe,ae;Tt.current||!l||(Tt.current=!0,(ae=(fe=(I=lt.current)==null?void 0:I.querySelector(".tree-item.active, .sidebar-app-edit-row.active"))==null?void 0:fe.scrollIntoView)==null||ae.call(fe,{block:"nearest"}))},[l]);function Mn(I,fe,ae,be=""){Me({kind:I,id:fe}),ge(ae||be)}function Ln(){if(we){const I=_e.trim();I&&(we.kind==="session"?k(we.id,I):$(we.id,I))}Me(null)}function ts(){Me(null),ge("")}async function ns(I){const fe=tN(Ye.get(I)??[]),ae=await A(I,fe);ae&&Mn("folder",ae.id,ae.name)}function ss(I){const fe=String(I.active.id);if(fe.startsWith("s:")){const ae=Se.get(fe.slice(2));ae&&Xe({kind:"session",label:ae.title||ae.id.slice(0,8)})}else if(fe.startsWith("f:")){const ae=Pe.get(fe.slice(2));ae&&Xe({kind:"folder",label:ae.name})}}function rs(I){Xe(null);const{active:fe,over:ae}=I;if(!ae)return;const be=String(fe.id),Fe=String(ae.id);if(be.startsWith("s:")){const Qe=Se.get(be.slice(2));if(!Qe)return;const Be=Qe.cwd||"(no directory)",Kt=il(Qe,Pe);let We,Gt;if(Fe.startsWith("f:")){const st=Pe.get(Fe.slice(2));if(!st)return;We=st.workspace_path,Gt=st.id}else if(Fe.startsWith("s:")){const st=Se.get(Fe.slice(2));if(!st)return;We=st.cwd||"(no directory)",Gt=il(st,Pe)}else if(Fe.startsWith("c:")){const st=Fe.slice(2),Ot=st.lastIndexOf("|");We=st.slice(0,Ot);const ws=st.slice(Ot+1);Gt=ws==="root"?null:ws}else return;if(We!==Be)return;const vs=zl(e.filter(st=>(st.cwd||"(no directory)")===We&&il(st,Pe)===Gt)),As=vs.filter(st=>st.id!==Qe.id);let ys=As.length;if(Fe.startsWith("s:")){const st=As.findIndex(Ot=>Ot.id===Fe.slice(2));st>=0&&(ys=st)}const Hn=[...As.slice(0,ys),Qe,...As.slice(ys)],xs=[];if(Gt===Kt){if(Hn.length===vs.length&&Hn.every((st,Ot)=>st.id===vs[Ot].id))return;Hn.forEach((st,Ot)=>xs.push({id:st.id,folder_id:Gt,sort_order:Hn.length-1-Ot}))}else{const st=zl(e.filter(Ot=>(Ot.cwd||"(no directory)")===Be&&il(Ot,Pe)===Kt)).filter(Ot=>Ot.id!==Qe.id);st.forEach((Ot,ws)=>xs.push({id:Ot.id,folder_id:Kt,sort_order:st.length-1-ws})),Hn.forEach((Ot,ws)=>xs.push({id:Ot.id,folder_id:Gt,sort_order:Hn.length-1-ws}))}z(xs);return}if(be.startsWith("f:")){if(!Fe.startsWith("f:"))return;const Qe=Pe.get(be.slice(2)),Be=Pe.get(Fe.slice(2));if(!Qe||!Be||Qe.id===Be.id||Qe.workspace_path!==Be.workspace_path)return;const Kt=(Ye.get(Qe.workspace_path)??[]).map(vs=>vs.id),We=Kt.indexOf(Qe.id),Gt=Kt.indexOf(Be.id);Kt.splice(Gt,0,...Kt.splice(We,1)),G(Kt)}}const vn=F?e.filter(I=>!Rd(I,F)):e,dn=new Set(U?vn.filter(I=>Zb(I)&&I.id!==l).map(I=>I.id):[]),Ft=Jb(r,dn.size>0?vn.filter(I=>!dn.has(I.id)):vn),Cn=x.useMemo(()=>{const I=new Map;if(!F)return I;const fe=vr(F);for(const ae of e){if(!Rd(ae,F))continue;const be=vr(ae.cwd).slice(fe.length+1).split("/")[0],Fe=I.get(be)??[];Fe.push(ae),I.set(be,Fe)}return I},[e,F]);function ct(I){return{folder:null,sessions:Cn.get(I)??[],finishedKey:`app:${I}:finished`,hidden:L.has(I)}}const mt=[],Et=I=>{if(I.hidden)return;const{working:fe,finished:ae,finishedCollapsed:be}=Ym(I,X);mt.push(...fe.map(Fe=>Fe.id)),be||mt.push(...ae.map(Fe=>Fe.id))};for(const I of Ft){if(le.has(I.path))continue;const fe=Ye.get(I.path)??[],ae=new Set(fe.map(be=>be.id));Xm(I,fe,ae,K).forEach(Et)}M.forEach(I=>Et(ct(I.id)));const Ht=e.filter(I=>Re.has(I.id)),kt=Ht.filter(I=>I.lifecycle!=="finished").map(I=>I.id),gt=Ht.filter(I=>I.lifecycle==="finished").map(I=>I.id);function ft(I,fe){if(fe.metaKey||fe.ctrlKey){fe.preventDefault(),Te(I.id),at(ae=>{const be=new Set(ae);return be.has(I.id)?be.delete(I.id):be.add(I.id),be});return}if(fe.shiftKey){fe.preventDefault();const ae=He??I.id;Te(ae);const be=mt.indexOf(ae),Fe=mt.indexOf(I.id);if(be>=0&&Fe>=0){const[Qe,Be]=be<Fe?[be,Fe]:[Fe,be];at(new Set(mt.slice(Qe,Be+1)))}return}q(),Te(I.id),c(I.id)}function Vt(I,fe){fe.preventDefault();const ae=Re.has(I.id)&&Re.size>1;Re.has(I.id)||(at(new Set),Te(I.id)),xe({x:fe.clientX,y:fe.clientY,type:"session",sessionId:I.id,sessionTitle:I.title,sessionLifecycle:I.lifecycle,sessionExternalId:I.external_thread_id,multi:ae})}function ut(I){var ae;const fe=I.origin_app_id?M.find(be=>be.id===I.origin_app_id):null;return a.jsx(nN,{s:I,backgroundTaskCount:((ae=n[I.id])==null?void 0:ae.length)??0,isActive:l===I.id,isSelected:Re.has(I.id),originApp:fe??null,renaming:(we==null?void 0:we.kind)==="session"&&we.id===I.id,renameValue:_e,renameRef:Ke,onRenameValue:ge,onRenameConfirm:Ln,onRenameCancel:ts,onSelect:be=>ft(I,be),onToggleStar:()=>j(I.id),onCtxMenu:be=>Vt(I,be)},I.id)}function Qt(I){var ae;const fe=Jl(I,((ae=n[I.id])==null?void 0:ae.length)??0);return a.jsxs("div",{className:`sidebar-app-edit-row${l===I.id?" active":""}${Re.has(I.id)?" selected":""}${fe.isFinished?" tree-item-finished":""}`,title:"App edit session — click to open",onClick:be=>ft(I,be),onContextMenu:be=>Vt(I,be),children:[a.jsx(sf,{iconClass:fe.iconClass,iconText:fe.iconText,size:14}),(we==null?void 0:we.kind)==="session"&&we.id===I.id?a.jsx(pf,{inputRef:Ke,value:_e,onChange:ge,onConfirm:Ln,onCancel:ts}):a.jsx("span",{className:"tree-label",children:I.title||I.id.slice(0,8)}),fe.dot&&a.jsx(nf,{status:fe.dot,title:fe.dotTitle})]},I.id)}function Mt(I,fe="workspace"){const{working:ae,finished:be,finishedCollapsed:Fe}=Ym(I,X),Qe=fe==="workspace"?ut:Qt,Be=a.jsxs(a.Fragment,{children:[ae.length===0&&be.length===0?a.jsx("div",{className:"tree-empty",children:"No sessions"}):ae.map(Qe),be.length>0&&a.jsxs("div",{className:`tree-subgroup ${Fe?"collapsed":""}`,children:[a.jsxs("div",{className:"tree-subgroup-header",onClick:()=>wt(I.finishedKey),children:[a.jsx(Ro,{size:8,className:"tree-chevron"}),a.jsx("span",{className:"tree-subgroup-label",children:"Finished"}),a.jsx("span",{className:"tree-subgroup-count",children:be.length})]}),!Fe&&a.jsx("div",{className:"tree-subgroup-items",children:be.map(Qe)})]})]});if(fe==="app")return Be;const Kt=[...ae,...be].map(We=>`s:${We.id}`);return a.jsx(jd,{items:Kt,strategy:qm,children:Be})}return a.jsxs("div",{className:"ide-sidebar",ref:lt,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${U?" active":""}`,title:U?`Show automatic sessions (${dn.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":U?"Show automatic sessions":"Hide automatic sessions","aria-pressed":U,onClick:un,children:U?a.jsx(S1,{size:14}):a.jsx(yr,{size:14})}),a.jsx("button",{className:"sidebar-add",title:"Add workspace",onClick:()=>m(),children:a.jsx(mr,{size:14})})]})]}),a.jsxs(yy,{sensors:Wt,collisionDetection:ty,onDragStart:ss,onDragEnd:rs,children:[Ft.length===0?a.jsx("div",{className:"empty-state",style:{padding:"16px"},children:"No workspaces yet. Click + to add one."}):Ft.map(I=>{const fe=le.has(I.path),ae=Ye.get(I.path)??[],be=new Set(ae.map(Be=>Be.id)),Fe=Xm(I,ae,be,K),Qe=Fe[Fe.length-1];return a.jsxs("div",{className:`tree-section ${fe?"collapsed":""}`,children:[a.jsxs("div",{className:"tree-section-header",onClick:()=>xt(I.path),onContextMenu:Be=>{Be.preventDefault(),xe({x:Be.clientX,y:Be.clientY,type:"workspace",path:I.path})},children:[a.jsx(Ro,{size:9,className:"tree-chevron"}),a.jsx(Al,{size:14}),a.jsx("span",{className:"tree-section-label",children:I.label}),a.jsx("button",{className:"tree-section-add",title:"New session in this workspace",onClick:Be=>{Be.stopPropagation(),h(I.path)},children:a.jsx(mr,{size:11})}),a.jsx("button",{className:"tree-section-add",title:"New folder in this workspace",onClick:Be=>{Be.stopPropagation(),ns(I.path)},children:a.jsx(sd,{size:11})}),a.jsx("span",{className:"tree-count",children:I.sessions.length})]}),!fe&&a.jsxs("div",{className:"tree-children",children:[a.jsx(jd,{items:ae.map(Be=>`f:${Be.id}`),strategy:qm,children:Fe.filter(Be=>Be.folder).map(Be=>a.jsx(sN,{folder:Be.folder,count:Be.sessions.length,collapsed:Be.hidden,renaming:(we==null?void 0:we.kind)==="folder"&&we.id===Be.folder.id,renameValue:_e,renameRef:Ke,onRenameValue:ge,onRenameConfirm:Ln,onRenameCancel:ts,onToggle:()=>Dt(Be.folder.id),onCtxMenu:Kt=>{Kt.preventDefault(),xe({x:Kt.clientX,y:Kt.clientY,type:"folder",folderId:Be.folder.id,folderName:Be.folder.name})},children:a.jsx(Qm,{id:`c:${I.path}|${Be.folder.id}`,children:Mt(Be)})},Be.folder.id))}),a.jsx(Qm,{id:`c:${I.path}|root`,children:Mt(Qe)})]})]},I.path)}),a.jsx($b,{children:pe&&a.jsxs("div",{className:"drag-overlay",children:[pe.kind==="folder"&&a.jsx(Al,{size:12}),a.jsx("span",{children:pe.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:()=>ve(),children:a.jsx(mr,{size:14})})]}),M.length===0&&a.jsx("div",{className:"tree-empty",children:"No apps yet"}),M.map(I=>{const fe=ct(I.id),ae=fe.sessions.length>0&&!fe.hidden;return a.jsxs("div",{className:"sidebar-app-block",children:[a.jsxs("div",{className:`sidebar-app-row${Z===I.id?" active":""}`,title:I.description??void 0,onClick:()=>Q(I.id),onContextMenu:be=>{be.preventDefault(),xe({x:be.clientX,y:be.clientY,type:"app",appId:I.id,appPinned:I.pinned})},children:[fe.sessions.length>0&&a.jsx("button",{className:`sidebar-app-chevron${ae?"":" closed"}`,title:"Edit sessions of this app",onClick:be=>{be.stopPropagation(),Ct(I.id)},children:a.jsx(Ro,{size:10,className:"tree-chevron"})}),a.jsx(Lo,{iconNode:I.iconNode,size:14,className:"sidebar-app-icon"}),a.jsx("span",{className:"tree-label",children:I.title}),fe.sessions.length>0&&a.jsx("span",{className:"sidebar-app-count",children:fe.sessions.length}),I.pinned&&a.jsx(Il,{size:10,className:"sidebar-app-pin",fill:"currentColor"})]}),ae&&a.jsx("div",{className:"sidebar-app-edits",children:Mt(fe,"app")})]},I.id)})]}),a.jsxs("div",{className:"sidebar-footer",onClick:()=>m(),children:[a.jsx(sd,{size:14}),a.jsx("span",{children:"Add workspace"})]}),Y&&a.jsxs("div",{ref:Ue,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:()=>{h(Y.path),xe(null)},children:[a.jsx(mr,{size:12})," New Session"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{ns(Y.path),xe(null)},children:[a.jsx(sd,{size:12})," New Folder"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{v(Y.path),xe(null)},children:[a.jsx(Uv,{size:12})," Import Sessions…"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{f(Y.path),xe(null)},children:[a.jsx(fs,{size:12})," Hide Workspace"]})]}),Y.type==="folder"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{Mn("folder",Y.folderId,Y.folderName??""),xe(null)},children:[a.jsx(ml,{size:12})," Rename Folder"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{P(Y.folderId),xe(null)},children:[a.jsx(fs,{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:()=>{Mn("session",Y.sessionId,Y.sessionTitle??""),xe(null)},children:[a.jsx(ml,{size:12})," Rename"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{y(Y.sessionId),xe(null)},children:[a.jsx(Rl,{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&&(Bi(Y.sessionExternalId),xe(null))},children:[a.jsx(Pi,{size:12})," Copy Session ID"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{d(Y.sessionId),xe(null)},children:[a.jsx(fs,{size:12})," Delete Session"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{T(Y.sessionId),xe(null)},children:[a.jsx(zi,{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&&(Bi(Y.sessionExternalId),xe(null))},children:[a.jsx(Pi,{size:12})," Copy Session ID"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{d(Y.sessionId),xe(null)},children:[a.jsx(fs,{size:12})," Delete Session"]})]})}),Y.type==="session"&&Y.multi&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-header",children:[Ht.length," sessions selected"]}),kt.length>0&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{S(kt),xe(null),q()},children:[a.jsx(Rl,{size:12})," Mark ",kt.length," as Finished"]}),gt.length>0&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{C(gt),xe(null),q()},children:[a.jsx(zi,{size:12})," Reopen ",gt.length]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{b([...Re]),xe(null),q()},children:[a.jsx(fs,{size:12})," Delete ",Ht.length," Sessions"]})]}),Y.type==="app"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{J(Y.appId),xe(null)},children:[a.jsx(ml,{size:12})," Edit App"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{he(Y.appId),xe(null)},children:[a.jsx(Il,{size:12})," ",Y.appPinned?"Unpin":"Pin"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{re(Y.appId),xe(null)},children:[a.jsx(rf,{size:12})," Export App…"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{ke(Y.appId),xe(null)},children:[a.jsx(fs,{size:12})," Delete App"]})]})]})]})}const al=4,oN=({transform:e})=>({...e,y:0});function Zm({tabKey:e,title:n,active:r,icon:o,badge:l,onSelect:c,onClose:d,onMenu:f}){const{attributes:h,listeners:m,setNodeRef:v,transform:k,transition:y,isDragging:S}=ff({id:e});return a.jsxs("div",{ref:v,style:{transform:Rs.Translate.toString(k),transition:y},className:`ide-tab ${r?"active":""} ${S?"dragging":""}`,title:n,...h,...m,onClick:c,onMouseDown:j=>{j.button===1&&j.preventDefault()},onAuxClick:j=>{j.button===1&&d()},onContextMenu:j=>{j.preventDefault(),j.stopPropagation(),f(j.clientX,j.clientY)},children:[o,n,l,a.jsx("span",{className:"ide-tab-close",onClick:j=>{j.stopPropagation(),d()},children:a.jsx(Nn,{size:12})})]})}function iN({menu:e,tabs:n,onDone:r}){const o=R(k=>k.closeTabs),l=R(k=>k.reopenClosedTab),c=R(k=>k.closedTabs.some(y=>gv(k,y.key))),d=x.useRef(null),[f,h]=x.useState({left:e.x,top:e.y});Hi(d,r,!0),Mo(r,!0),x.useLayoutEffect(()=>{if(!d.current)return;const{width:k,height:y}=d.current.getBoundingClientRect();h({left:Math.max(al,Math.min(e.x,window.innerWidth-k-al)),top:Math.max(al,Math.min(e.y,window.innerHeight-y-al))})},[e.x,e.y]);const m=e.key!==null&&n.includes(e.key)?e.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",...f,zIndex:500},children:[m!==null&&a.jsxs(a.Fragment,{children:[v("Close",()=>o([m])),v("Close Others",()=>o(n.filter(k=>k!==m)),n.length<2),v("Close to the Right",()=>o(n.slice(n.indexOf(m)+1)),n.at(-1)===m),v("Close All",()=>o(n))]}),v("Reopen Closed Tab",l,!c)]})}function aN(){const e=R(z=>z.tabOrder),n=R(z=>z.activeSessionId),r=R(z=>z.sessions),o=R(z=>z.backgroundTasks),l=R(z=>z.selectSession),c=R(z=>z.closeTab),d=R(z=>z.setShowNewSessionDialog),f=R(z=>z.apps),h=R(z=>z.activeAppTabId),m=R(z=>z.openAppTab),v=R(z=>z.closeAppTab),k=R(z=>z.moveTab),[y,S]=x.useState(null),j=x.useRef(null),T=ey(Jv(ic,{activationConstraint:{distance:5}})),C=Gd({activeSessionId:n,activeAppTabId:h});x.useEffect(()=>{var z,G,M;(M=(G=(z=j.current)==null?void 0:z.querySelector(".ide-tab.active"))==null?void 0:G.scrollIntoView)==null||M.call(G,{block:"nearest",inline:"nearest"})},[C]);const b=e.filter(z=>{const{kind:G,id:M}=gr(z);return G==="app"||r.some(F=>F.id===M)}),A=({active:z,over:G})=>{G&&k(String(z.id),String(G.id))},$=z=>{z.preventDefault(),S({x:z.clientX,y:z.clientY,key:null})},P=z=>{var J;const{kind:G,id:M}=gr(z),F=(he,ke)=>S({x:he,y:ke,key:z});if(G==="app"){const he=f.find(ke=>ke.id===M);return a.jsx(Zm,{tabKey:z,title:(he==null?void 0:he.title)??M,active:h===M,icon:a.jsx(Lo,{iconNode:he==null?void 0:he.iconNode,size:12,className:"miniapp-tab-icon"}),onSelect:()=>m(M),onClose:()=>v(M),onMenu:F},z)}const Z=r.find(he=>he.id===M);if(!Z)return null;const Q=Jl(Z,((J=o[M])==null?void 0:J.length)??0);return a.jsx(Zm,{tabKey:z,title:Z.title||M.slice(0,8),active:n===M&&h==null,icon:a.jsx(sf,{iconClass:Q.iconClass,iconText:Q.iconText,size:14}),badge:Q.dot&&a.jsx(nf,{status:Q.dot,title:Q.dotTitle}),onSelect:()=>void l(M),onClose:()=>c(M),onMenu:F},z)};return a.jsxs(yy,{sensors:T,collisionDetection:ty,modifiers:[oN],onDragEnd:A,children:[a.jsx(jd,{items:b,strategy:Ub,children:a.jsxs("div",{ref:j,className:"ide-tabs",onContextMenu:$,onWheel:z=>{z.deltaX===0&&(z.currentTarget.scrollLeft+=z.deltaY)},children:[b.map(P),a.jsx("div",{className:"ide-tab-add",title:"New Session",onClick:()=>d(!0),children:a.jsx(mr,{size:14})})]})}),y&&a.jsx(iN,{menu:y,tabs:b,onDone:()=>S(null)})]})}function hf(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Wr=hf();function Cy(e){Wr=e}var Ii={exec:()=>null};function it(e,n=""){let r=typeof e=="string"?e:e.source;const o={replace:(l,c)=>{let d=typeof c=="string"?c:c.source;return d=d.replace(bn.caret,"$1"),r=r.replace(l,d),o},getRegex:()=>new RegExp(r,n)};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:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},lN=/^(?:[ \t]*(?:\n|$))+/,cN=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,uN=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Yi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,dN=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,mf=/(?:[*+-]|\d{1,9}[.)])/,Ey=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,jy=it(Ey).replace(/bull/g,mf).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(),fN=it(Ey).replace(/bull/g,mf).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(),gf=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,pN=/^[^\n]+/,vf=/(?!\s*\])(?:\\.|[^\[\]\\])+/,hN=it(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",vf).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),mN=it(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,mf).getRegex(),cc="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",yf=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,gN=it("^ {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",yf).replace("tag",cc).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),_y=it(gf).replace("hr",Yi).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",cc).getRegex(),vN=it(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",_y).getRegex(),xf={blockquote:vN,code:cN,def:hN,fences:uN,heading:dN,hr:Yi,html:gN,lheading:jy,list:mN,newline:lN,paragraph:_y,table:Ii,text:pN},Jm=it("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Yi).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",cc).getRegex(),yN={...xf,lheading:fN,table:Jm,paragraph:it(gf).replace("hr",Yi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Jm).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cc).getRegex()},xN={...xf,html:it(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",yf).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:Ii,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:it(gf).replace("hr",Yi).replace("heading",` *#{1,6} *[^
468
+ ]`).replace("lheading",jy).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},wN=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,kN=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ry=/^( {2,}|\\)\n(?!\s*$)/,SN=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,uc=/[\p{P}\p{S}]/u,wf=/[\s\p{P}\p{S}]/u,Ay=/[^\s\p{P}\p{S}]/u,bN=it(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,wf).getRegex(),Iy=/(?!~)[\p{P}\p{S}]/u,NN=/(?!~)[\s\p{P}\p{S}]/u,TN=/(?:[^\s\p{P}\p{S}]|~)/u,CN=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Dy=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,EN=it(Dy,"u").replace(/punct/g,uc).getRegex(),jN=it(Dy,"u").replace(/punct/g,Iy).getRegex(),My="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",_N=it(My,"gu").replace(/notPunctSpace/g,Ay).replace(/punctSpace/g,wf).replace(/punct/g,uc).getRegex(),RN=it(My,"gu").replace(/notPunctSpace/g,TN).replace(/punctSpace/g,NN).replace(/punct/g,Iy).getRegex(),AN=it("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ay).replace(/punctSpace/g,wf).replace(/punct/g,uc).getRegex(),IN=it(/\\(punct)/,"gu").replace(/punct/g,uc).getRegex(),DN=it(/^<(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(),MN=it(yf).replace("(?:-->|$)","-->").getRegex(),LN=it("^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",MN).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Fl=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ON=it(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Fl).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ly=it(/^!?\[(label)\]\[(ref)\]/).replace("label",Fl).replace("ref",vf).getRegex(),Oy=it(/^!?\[(ref)\](?:\[\])?/).replace("ref",vf).getRegex(),$N=it("reflink|nolink(?!\\()","g").replace("reflink",Ly).replace("nolink",Oy).getRegex(),kf={_backpedal:Ii,anyPunctuation:IN,autolink:DN,blockSkip:CN,br:Ry,code:kN,del:Ii,emStrongLDelim:EN,emStrongRDelimAst:_N,emStrongRDelimUnd:AN,escape:wN,link:ON,nolink:Oy,punctuation:bN,reflink:Ly,reflinkSearch:$N,tag:LN,text:SN,url:Ii},PN={...kf,link:it(/^!?\[(label)\]\((.*?)\)/).replace("label",Fl).getRegex(),reflink:it(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Fl).getRegex()},Ad={...kf,emStrongRDelimAst:RN,emStrongLDelim:jN,url:it(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},zN={...Ad,br:it(Ry).replace("{2,}","*").getRegex(),text:it(Ad.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ll={normal:xf,gfm:yN,pedantic:xN},wi={normal:kf,gfm:Ad,breaks:zN,pedantic:PN},FN={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},eg=e=>FN[e];function Es(e,n){if(n){if(bn.escapeTest.test(e))return e.replace(bn.escapeReplace,eg)}else if(bn.escapeTestNoEncode.test(e))return e.replace(bn.escapeReplaceNoEncode,eg);return e}function tg(e){try{e=encodeURI(e).replace(bn.percentDecode,"%")}catch{return null}return e}function ng(e,n){var c;const r=e.replace(bn.findPipe,(d,f,h)=>{let m=!1,v=f;for(;--v>=0&&h[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(),n)if(o.length>n)o.splice(n);else for(;o.length<n;)o.push("");for(;l<o.length;l++)o[l]=o[l].trim().replace(bn.slashPipe,"|");return o}function ki(e,n,r){const o=e.length;if(o===0)return"";let l=0;for(;l<o&&e.charAt(o-l-1)===n;)l++;return e.slice(0,o-l)}function UN(e,n){if(e.indexOf(n[1])===-1)return-1;let r=0;for(let o=0;o<e.length;o++)if(e[o]==="\\")o++;else if(e[o]===n[0])r++;else if(e[o]===n[1]&&(r--,r<0))return o;return r>0?-2:-1}function sg(e,n,r,o,l){const c=n.href,d=n.title||null,f=e[1].replace(l.other.outputLinkReplace,"$1");o.state.inLink=!0;const h={type:e[0].charAt(0)==="!"?"image":"link",raw:r,href:c,title:d,text:f,tokens:o.inlineTokens(f)};return o.state.inLink=!1,h}function BN(e,n,r){const o=e.match(r.other.indentCodeCompensation);if(o===null)return n;const l=o[1];return n.split(`
469
+ `).map(c=>{const d=c.match(r.other.beginningSpace);if(d===null)return c;const[f]=d;return f.length>=l.length?c.slice(l.length):c}).join(`
470
+ `)}var Ul=class{constructor(e){dt(this,"options");dt(this,"rules");dt(this,"lexer");this.options=e||Wr}space(e){const n=this.rules.block.newline.exec(e);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(e){const n=this.rules.block.code.exec(e);if(n){const r=n[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?r:ki(r,`
471
+ `)}}}fences(e){const n=this.rules.block.fences.exec(e);if(n){const r=n[0],o=BN(r,n[3]||"",this.rules);return{type:"code",raw:r,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:o}}}heading(e){const n=this.rules.block.heading.exec(e);if(n){let r=n[2].trim();if(this.rules.other.endingHash.test(r)){const o=ki(r,"#");(this.options.pedantic||!o||this.rules.other.endingSpaceChar.test(o))&&(r=o.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){const n=this.rules.block.hr.exec(e);if(n)return{type:"hr",raw:ki(n[0],`
472
+ `)}}blockquote(e){const n=this.rules.block.blockquote.exec(e);if(n){let r=ki(n[0],`
473
+ `).split(`
474
+ `),o="",l="";const c=[];for(;r.length>0;){let d=!1;const f=[];let h;for(h=0;h<r.length;h++)if(this.rules.other.blockquoteStart.test(r[h]))f.push(r[h]),d=!0;else if(!d)f.push(r[h]);else break;r=r.slice(h);const m=f.join(`
475
+ `),v=m.replace(this.rules.other.blockquoteSetextReplace,`
476
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");o=o?`${o}
477
+ ${m}`:m,l=l?`${l}
478
+ ${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,j=S.raw+`
479
+ `+r.join(`
480
+ `),T=this.blockquote(j);c[c.length-1]=T,o=o.substring(0,o.length-S.raw.length)+T.raw,l=l.substring(0,l.length-S.text.length)+T.text;break}else if((y==null?void 0:y.type)==="list"){const S=y,j=S.raw+`
481
+ `+r.join(`
482
+ `),T=this.list(j);c[c.length-1]=T,o=o.substring(0,o.length-y.raw.length)+T.raw,l=l.substring(0,l.length-S.raw.length)+T.raw,r=j.substring(c.at(-1).raw.length).split(`
483
+ `);continue}}return{type:"blockquote",raw:o,tokens:c,text:l}}}list(e){let n=this.rules.block.list.exec(e);if(n){let r=n[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(;e;){let h=!1,m="",v="";if(!(n=c.exec(e))||this.rules.block.hr.test(e))break;m=n[0],e=e.substring(m.length);let k=n[2].split(`
484
+ `,1)[0].replace(this.rules.other.listReplaceTabs,b=>" ".repeat(3*b.length)),y=e.split(`
485
+ `,1)[0],S=!k.trim(),j=0;if(this.options.pedantic?(j=2,v=k.trimStart()):S?j=n[1].length+1:(j=n[2].search(this.rules.other.nonSpaceChar),j=j>4?1:j,v=k.slice(j),j+=n[1].length),S&&this.rules.other.blankLine.test(y)&&(m+=y+`
486
+ `,e=e.substring(y.length+1),h=!0),!h){const b=this.rules.other.nextBulletRegex(j),A=this.rules.other.hrRegex(j),$=this.rules.other.fencesBeginRegex(j),P=this.rules.other.headingBeginRegex(j),z=this.rules.other.htmlBeginRegex(j);for(;e;){const G=e.split(`
487
+ `,1)[0];let M;if(y=G,this.options.pedantic?(y=y.replace(this.rules.other.listReplaceNesting," "),M=y):M=y.replace(this.rules.other.tabCharGlobal," "),$.test(y)||P.test(y)||z.test(y)||b.test(y)||A.test(y))break;if(M.search(this.rules.other.nonSpaceChar)>=j||!y.trim())v+=`
488
+ `+M.slice(j);else{if(S||k.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||$.test(k)||P.test(k)||A.test(k))break;v+=`
489
+ `+y}!S&&!y.trim()&&(S=!0),m+=G+`
490
+ `,e=e.substring(G.length+1),k=M.slice(j)}}l.loose||(d?l.loose=!0:this.rules.other.doubleBlankLine.test(m)&&(d=!0));let T=null,C;this.options.gfm&&(T=this.rules.other.listIsTask.exec(v),T&&(C=T[0]!=="[ ] ",v=v.replace(this.rules.other.listReplaceTask,""))),l.items.push({type:"list_item",raw:m,task:!!T,checked:C,loose:!1,text:v,tokens:[]}),l.raw+=m}const f=l.items.at(-1);if(f)f.raw=f.raw.trimEnd(),f.text=f.text.trimEnd();else return;l.raw=l.raw.trimEnd();for(let h=0;h<l.items.length;h++)if(this.lexer.state.top=!1,l.items[h].tokens=this.lexer.blockTokens(l.items[h].text,[]),!l.loose){const m=l.items[h].tokens.filter(k=>k.type==="space"),v=m.length>0&&m.some(k=>this.rules.other.anyLine.test(k.raw));l.loose=v}if(l.loose)for(let h=0;h<l.items.length;h++)l.items[h].loose=!0;return l}}html(e){const n=this.rules.block.html.exec(e);if(n)return{type:"html",block:!0,raw:n[0],pre:n[1]==="pre"||n[1]==="script"||n[1]==="style",text:n[0]}}def(e){const n=this.rules.block.def.exec(e);if(n){const r=n[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),o=n[2]?n[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",l=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):n[3];return{type:"def",tag:r,raw:n[0],href:o,title:l}}}table(e){var d;const n=this.rules.block.table.exec(e);if(!n||!this.rules.other.tableDelimiter.test(n[2]))return;const r=ng(n[1]),o=n[2].replace(this.rules.other.tableAlignChars,"").split("|"),l=(d=n[3])!=null&&d.trim()?n[3].replace(this.rules.other.tableRowBlankLine,"").split(`
491
+ `):[],c={type:"table",raw:n[0],header:[],align:[],rows:[]};if(r.length===o.length){for(const f of o)this.rules.other.tableAlignRight.test(f)?c.align.push("right"):this.rules.other.tableAlignCenter.test(f)?c.align.push("center"):this.rules.other.tableAlignLeft.test(f)?c.align.push("left"):c.align.push(null);for(let f=0;f<r.length;f++)c.header.push({text:r[f],tokens:this.lexer.inline(r[f]),header:!0,align:c.align[f]});for(const f of l)c.rows.push(ng(f,c.header.length).map((h,m)=>({text:h,tokens:this.lexer.inline(h),header:!1,align:c.align[m]})));return c}}lheading(e){const n=this.rules.block.lheading.exec(e);if(n)return{type:"heading",raw:n[0],depth:n[2].charAt(0)==="="?1:2,text:n[1],tokens:this.lexer.inline(n[1])}}paragraph(e){const n=this.rules.block.paragraph.exec(e);if(n){const r=n[1].charAt(n[1].length-1)===`
492
+ `?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:r,tokens:this.lexer.inline(r)}}}text(e){const n=this.rules.block.text.exec(e);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(e){const n=this.rules.inline.escape.exec(e);if(n)return{type:"escape",raw:n[0],text:n[1]}}tag(e){const n=this.rules.inline.tag.exec(e);if(n)return!this.lexer.state.inLink&&this.rules.other.startATag.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(e){const n=this.rules.inline.link.exec(e);if(n){const r=n[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;const c=ki(r.slice(0,-1),"\\");if((r.length-c.length)%2===0)return}else{const c=UN(n[2],"()");if(c===-2)return;if(c>-1){const f=(n[0].indexOf("!")===0?5:4)+n[1].length+c;n[2]=n[2].substring(0,c),n[0]=n[0].substring(0,f).trim(),n[3]=""}}let o=n[2],l="";if(this.options.pedantic){const c=this.rules.other.pedanticHrefTitle.exec(o);c&&(o=c[1],l=c[3])}else l=n[3]?n[3].slice(1,-1):"";return o=o.trim(),this.rules.other.startAngleBracket.test(o)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?o=o.slice(1):o=o.slice(1,-1)),sg(n,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:l&&l.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer,this.rules)}}reflink(e,n){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){const o=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),l=n[o.toLowerCase()];if(!l){const c=r[0].charAt(0);return{type:"text",raw:c,text:c}}return sg(r,l,r[0],this.lexer,this.rules)}}emStrong(e,n,r=""){let o=this.rules.inline.emStrongLDelim.exec(e);if(!o||o[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(o[1]||o[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const c=[...o[0]].length-1;let d,f,h=c,m=0;const v=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(v.lastIndex=0,n=n.slice(-1*e.length+c);(o=v.exec(n))!=null;){if(d=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!d)continue;if(f=[...d].length,o[3]||o[4]){h+=f;continue}else if((o[5]||o[6])&&c%3&&!((c+f)%3)){m+=f;continue}if(h-=f,h>0)continue;f=Math.min(f,f+h+m);const k=[...o[0]][0].length,y=e.slice(0,c+o.index+k+f);if(Math.min(c,f)%2){const j=y.slice(1,-1);return{type:"em",raw:y,text:j,tokens:this.lexer.inlineTokens(j)}}const S=y.slice(2,-2);return{type:"strong",raw:y,text:S,tokens:this.lexer.inlineTokens(S)}}}}codespan(e){const n=this.rules.inline.code.exec(e);if(n){let r=n[2].replace(this.rules.other.newLineCharGlobal," ");const o=this.rules.other.nonSpaceChar.test(r),l=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return o&&l&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:n[0],text:r}}}br(e){const n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}}del(e){const n=this.rules.inline.del.exec(e);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(e){const n=this.rules.inline.autolink.exec(e);if(n){let r,o;return n[2]==="@"?(r=n[1],o="mailto:"+r):(r=n[1],o=r),{type:"link",raw:n[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}url(e){var r;let n;if(n=this.rules.inline.url.exec(e)){let o,l;if(n[2]==="@")o=n[0],l="mailto:"+o;else{let c;do c=n[0],n[0]=((r=this.rules.inline._backpedal.exec(n[0]))==null?void 0:r[0])??"";while(c!==n[0]);o=n[0],n[1]==="www."?l="http://"+n[0]:l=n[0]}return{type:"link",raw:n[0],text:o,href:l,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(e){const n=this.rules.inline.text.exec(e);if(n){const r=this.lexer.state.inRawBlock;return{type:"text",raw:n[0],text:n[0],escaped:r}}}},Us=class Id{constructor(n){dt(this,"tokens");dt(this,"options");dt(this,"state");dt(this,"tokenizer");dt(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=n||Wr,this.options.tokenizer=this.options.tokenizer||new Ul,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:ll.normal,inline:wi.normal};this.options.pedantic?(r.block=ll.pedantic,r.inline=wi.pedantic):this.options.gfm&&(r.block=ll.gfm,this.options.breaks?r.inline=wi.breaks:r.inline=wi.gfm),this.tokenizer.rules=r}static get rules(){return{block:ll,inline:wi}}static lex(n,r){return new Id(r).lex(n)}static lexInline(n,r){return new Id(r).inlineTokens(n)}lex(n){n=n.replace(bn.carriageReturn,`
493
+ `),this.blockTokens(n,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){const o=this.inlineQueue[r];this.inlineTokens(o.src,o.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(n,r=[],o=!1){var l,c,d;for(this.options.pedantic&&(n=n.replace(bn.tabCharGlobal," ").replace(bn.spaceLine,""));n;){let f;if((c=(l=this.options.extensions)==null?void 0:l.block)!=null&&c.some(m=>(f=m.call({lexer:this},n,r))?(n=n.substring(f.raw.length),r.push(f),!0):!1))continue;if(f=this.tokenizer.space(n)){n=n.substring(f.raw.length);const m=r.at(-1);f.raw.length===1&&m!==void 0?m.raw+=`
494
+ `:r.push(f);continue}if(f=this.tokenizer.code(n)){n=n.substring(f.raw.length);const m=r.at(-1);(m==null?void 0:m.type)==="paragraph"||(m==null?void 0:m.type)==="text"?(m.raw+=`
495
+ `+f.raw,m.text+=`
496
+ `+f.text,this.inlineQueue.at(-1).src=m.text):r.push(f);continue}if(f=this.tokenizer.fences(n)){n=n.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.heading(n)){n=n.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.hr(n)){n=n.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.blockquote(n)){n=n.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.list(n)){n=n.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.html(n)){n=n.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.def(n)){n=n.substring(f.raw.length);const m=r.at(-1);(m==null?void 0:m.type)==="paragraph"||(m==null?void 0:m.type)==="text"?(m.raw+=`
497
+ `+f.raw,m.text+=`
498
+ `+f.raw,this.inlineQueue.at(-1).src=m.text):this.tokens.links[f.tag]||(this.tokens.links[f.tag]={href:f.href,title:f.title});continue}if(f=this.tokenizer.table(n)){n=n.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.lheading(n)){n=n.substring(f.raw.length),r.push(f);continue}let h=n;if((d=this.options.extensions)!=null&&d.startBlock){let m=1/0;const v=n.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&&(h=n.substring(0,m+1))}if(this.state.top&&(f=this.tokenizer.paragraph(h))){const m=r.at(-1);o&&(m==null?void 0:m.type)==="paragraph"?(m.raw+=`
499
+ `+f.raw,m.text+=`
500
+ `+f.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):r.push(f),o=h.length!==n.length,n=n.substring(f.raw.length);continue}if(f=this.tokenizer.text(n)){n=n.substring(f.raw.length);const m=r.at(-1);(m==null?void 0:m.type)==="text"?(m.raw+=`
501
+ `+f.raw,m.text+=`
502
+ `+f.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):r.push(f);continue}if(n){const m="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return this.state.top=!0,r}inline(n,r=[]){return this.inlineQueue.push({src:n,tokens:r}),r}inlineTokens(n,r=[]){var f,h,m;let o=n,l=null;if(this.tokens.links){const v=Object.keys(this.tokens.links);if(v.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(o))!=null;)v.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(l=this.tokenizer.rules.inline.anyPunctuation.exec(o))!=null;)o=o.slice(0,l.index)+"++"+o.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(l=this.tokenizer.rules.inline.blockSkip.exec(o))!=null;)o=o.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let c=!1,d="";for(;n;){c||(d=""),c=!1;let v;if((h=(f=this.options.extensions)==null?void 0:f.inline)!=null&&h.some(y=>(v=y.call({lexer:this},n,r))?(n=n.substring(v.raw.length),r.push(v),!0):!1))continue;if(v=this.tokenizer.escape(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.tag(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.link(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(v.raw.length);const 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(n,o,d)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.codespan(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.br(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.del(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.autolink(n)){n=n.substring(v.raw.length),r.push(v);continue}if(!this.state.inLink&&(v=this.tokenizer.url(n))){n=n.substring(v.raw.length),r.push(v);continue}let k=n;if((m=this.options.extensions)!=null&&m.startInline){let y=1/0;const S=n.slice(1);let j;this.options.extensions.startInline.forEach(T=>{j=T.call({lexer:this},S),typeof j=="number"&&j>=0&&(y=Math.min(y,j))}),y<1/0&&y>=0&&(k=n.substring(0,y+1))}if(v=this.tokenizer.inlineText(k)){n=n.substring(v.raw.length),v.raw.slice(-1)!=="_"&&(d=v.raw.slice(-1)),c=!0;const y=r.at(-1);(y==null?void 0:y.type)==="text"?(y.raw+=v.raw,y.text+=v.text):r.push(v);continue}if(n){const y="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(y);break}else throw new Error(y)}}return r}},Bl=class{constructor(e){dt(this,"options");dt(this,"parser");this.options=e||Wr}space(e){return""}code({text:e,lang:n,escaped:r}){var c;const o=(c=(n||"").match(bn.notSpaceStart))==null?void 0:c[0],l=e.replace(bn.endingNewline,"")+`
503
+ `;return o?'<pre><code class="language-'+Es(o)+'">'+(r?l:Es(l,!0))+`</code></pre>
504
+ `:"<pre><code>"+(r?l:Es(l,!0))+`</code></pre>
505
+ `}blockquote({tokens:e}){return`<blockquote>
506
+ ${this.parser.parse(e)}</blockquote>
507
+ `}html({text:e}){return e}heading({tokens:e,depth:n}){return`<h${n}>${this.parser.parseInline(e)}</h${n}>
508
+ `}hr(e){return`<hr>
509
+ `}list(e){const n=e.ordered,r=e.start;let o="";for(let d=0;d<e.items.length;d++){const f=e.items[d];o+=this.listitem(f)}const l=n?"ol":"ul",c=n&&r!==1?' start="'+r+'"':"";return"<"+l+c+`>
510
+ `+o+"</"+l+`>
511
+ `}listitem(e){var r;let n="";if(e.task){const o=this.checkbox({checked:!!e.checked});e.loose?((r=e.tokens[0])==null?void 0:r.type)==="paragraph"?(e.tokens[0].text=o+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=o+" "+Es(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:o+" ",text:o+" ",escaped:!0}):n+=o+" "}return n+=this.parser.parse(e.tokens,!!e.loose),`<li>${n}</li>
512
+ `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
513
+ `}table(e){let n="",r="";for(let l=0;l<e.header.length;l++)r+=this.tablecell(e.header[l]);n+=this.tablerow({text:r});let o="";for(let l=0;l<e.rows.length;l++){const c=e.rows[l];r="";for(let d=0;d<c.length;d++)r+=this.tablecell(c[d]);o+=this.tablerow({text:r})}return o&&(o=`<tbody>${o}</tbody>`),`<table>
514
+ <thead>
515
+ `+n+`</thead>
516
+ `+o+`</table>
517
+ `}tablerow({text:e}){return`<tr>
518
+ ${e}</tr>
519
+ `}tablecell(e){const n=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+n+`</${r}>
520
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Es(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:n,tokens:r}){const o=this.parser.parseInline(r),l=tg(e);if(l===null)return o;e=l;let c='<a href="'+e+'"';return n&&(c+=' title="'+Es(n)+'"'),c+=">"+o+"</a>",c}image({href:e,title:n,text:r,tokens:o}){o&&(r=this.parser.parseInline(o,this.parser.textRenderer));const l=tg(e);if(l===null)return Es(r);e=l;let c=`<img src="${e}" alt="${r}"`;return n&&(c+=` title="${Es(n)}"`),c+=">",c}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Es(e.text)}},Sf=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},Bs=class Dd{constructor(n){dt(this,"options");dt(this,"renderer");dt(this,"textRenderer");this.options=n||Wr,this.options.renderer=this.options.renderer||new Bl,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Sf}static parse(n,r){return new Dd(r).parse(n)}static parseInline(n,r){return new Dd(r).parseInline(n)}parse(n,r=!0){var l,c;let o="";for(let d=0;d<n.length;d++){const f=n[d];if((c=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&c[f.type]){const m=f,v=this.options.extensions.renderers[m.type].call({parser:this},m);if(v!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(m.type)){o+=v||"";continue}}const h=f;switch(h.type){case"space":{o+=this.renderer.space(h);continue}case"hr":{o+=this.renderer.hr(h);continue}case"heading":{o+=this.renderer.heading(h);continue}case"code":{o+=this.renderer.code(h);continue}case"table":{o+=this.renderer.table(h);continue}case"blockquote":{o+=this.renderer.blockquote(h);continue}case"list":{o+=this.renderer.list(h);continue}case"html":{o+=this.renderer.html(h);continue}case"paragraph":{o+=this.renderer.paragraph(h);continue}case"text":{let m=h,v=this.renderer.text(m);for(;d+1<n.length&&n[d+1].type==="text";)m=n[++d],v+=`
521
+ `+this.renderer.text(m);r?o+=this.renderer.paragraph({type:"paragraph",raw:v,text:v,tokens:[{type:"text",raw:v,text:v,escaped:!0}]}):o+=v;continue}default:{const m='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}parseInline(n,r=this.renderer){var l,c;let o="";for(let d=0;d<n.length;d++){const f=n[d];if((c=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&c[f.type]){const m=this.options.extensions.renderers[f.type].call({parser:this},f);if(m!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(f.type)){o+=m||"";continue}}const h=f;switch(h.type){case"escape":{o+=r.text(h);break}case"html":{o+=r.html(h);break}case"link":{o+=r.link(h);break}case"image":{o+=r.image(h);break}case"strong":{o+=r.strong(h);break}case"em":{o+=r.em(h);break}case"codespan":{o+=r.codespan(h);break}case"br":{o+=r.br(h);break}case"del":{o+=r.del(h);break}case"text":{o+=r.text(h);break}default:{const m='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}},yd,vl=(yd=class{constructor(e){dt(this,"options");dt(this,"block");this.options=e||Wr}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?Us.lex:Us.lexInline}provideParser(){return this.block?Bs.parse:Bs.parseInline}},dt(yd,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),yd),WN=class{constructor(...e){dt(this,"defaults",hf());dt(this,"options",this.setOptions);dt(this,"parse",this.parseMarkdown(!0));dt(this,"parseInline",this.parseMarkdown(!1));dt(this,"Parser",Bs);dt(this,"Renderer",Bl);dt(this,"TextRenderer",Sf);dt(this,"Lexer",Us);dt(this,"Tokenizer",Ul);dt(this,"Hooks",vl);this.use(...e)}walkTokens(e,n){var o,l;let r=[];for(const c of e)switch(r=r.concat(n.call(this,c)),c.type){case"table":{const d=c;for(const f of d.header)r=r.concat(this.walkTokens(f.tokens,n));for(const f of d.rows)for(const h of f)r=r.concat(this.walkTokens(h.tokens,n));break}case"list":{const d=c;r=r.concat(this.walkTokens(d.items,n));break}default:{const d=c;(l=(o=this.defaults.extensions)==null?void 0:o.childTokens)!=null&&l[d.type]?this.defaults.extensions.childTokens[d.type].forEach(f=>{const h=d[f].flat(1/0);r=r.concat(this.walkTokens(h,n))}):d.tokens&&(r=r.concat(this.walkTokens(d.tokens,n)))}}return r}use(...e){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{const o={...r};if(o.async=this.defaults.async||o.async||!1,r.extensions&&(r.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){const c=n.renderers[l.name];c?n.renderers[l.name]=function(...d){let f=l.renderer.apply(this,d);return f===!1&&(f=c.apply(this,d)),f}:n.renderers[l.name]=l.renderer}if("tokenizer"in l){if(!l.level||l.level!=="block"&&l.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const c=n[l.level];c?c.unshift(l.tokenizer):n[l.level]=[l.tokenizer],l.start&&(l.level==="block"?n.startBlock?n.startBlock.push(l.start):n.startBlock=[l.start]:l.level==="inline"&&(n.startInline?n.startInline.push(l.start):n.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(n.childTokens[l.name]=l.childTokens)}),o.extensions=n),r.renderer){const l=this.defaults.renderer||new Bl(this.defaults);for(const c in r.renderer){if(!(c in l))throw new Error(`renderer '${c}' does not exist`);if(["options","parser"].includes(c))continue;const d=c,f=r.renderer[d],h=l[d];l[d]=(...m)=>{let v=f.apply(l,m);return v===!1&&(v=h.apply(l,m)),v||""}}o.renderer=l}if(r.tokenizer){const l=this.defaults.tokenizer||new Ul(this.defaults);for(const c in r.tokenizer){if(!(c in l))throw new Error(`tokenizer '${c}' does not exist`);if(["options","rules","lexer"].includes(c))continue;const d=c,f=r.tokenizer[d],h=l[d];l[d]=(...m)=>{let v=f.apply(l,m);return v===!1&&(v=h.apply(l,m)),v}}o.tokenizer=l}if(r.hooks){const l=this.defaults.hooks||new vl;for(const c in r.hooks){if(!(c in l))throw new Error(`hook '${c}' does not exist`);if(["options","block"].includes(c))continue;const d=c,f=r.hooks[d],h=l[d];vl.passThroughHooks.has(c)?l[d]=m=>{if(this.defaults.async)return Promise.resolve(f.call(l,m)).then(k=>h.call(l,k));const v=f.call(l,m);return h.call(l,v)}:l[d]=(...m)=>{let v=f.apply(l,m);return v===!1&&(v=h.apply(l,m)),v}}o.hooks=l}if(r.walkTokens){const l=this.defaults.walkTokens,c=r.walkTokens;o.walkTokens=function(d){let f=[];return f.push(c.call(this,d)),l&&(f=f.concat(l.call(this,d))),f}}this.defaults={...this.defaults,...o}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,n){return Us.lex(e,n??this.defaults)}parser(e,n){return Bs.parse(e,n??this.defaults)}parseMarkdown(e){return(r,o)=>{const l={...o},c={...this.defaults,...l},d=this.onError(!!c.silent,!!c.async);if(this.defaults.async===!0&&l.async===!1)return d(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return d(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return d(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));c.hooks&&(c.hooks.options=c,c.hooks.block=e);const f=c.hooks?c.hooks.provideLexer():e?Us.lex:Us.lexInline,h=c.hooks?c.hooks.provideParser():e?Bs.parse:Bs.parseInline;if(c.async)return Promise.resolve(c.hooks?c.hooks.preprocess(r):r).then(m=>f(m,c)).then(m=>c.hooks?c.hooks.processAllTokens(m):m).then(m=>c.walkTokens?Promise.all(this.walkTokens(m,c.walkTokens)).then(()=>m):m).then(m=>h(m,c)).then(m=>c.hooks?c.hooks.postprocess(m):m).catch(d);try{c.hooks&&(r=c.hooks.preprocess(r));let m=f(r,c);c.hooks&&(m=c.hooks.processAllTokens(m)),c.walkTokens&&this.walkTokens(m,c.walkTokens);let v=h(m,c);return c.hooks&&(v=c.hooks.postprocess(v)),v}catch(m){return d(m)}}}onError(e,n){return r=>{if(r.message+=`
522
+ Please report this to https://github.com/markedjs/marked.`,e){const o="<p>An error occurred:</p><pre>"+Es(r.message+"",!0)+"</pre>";return n?Promise.resolve(o):o}if(n)return Promise.reject(r);throw r}}},Br=new WN;function qe(e,n){return Br.parse(e,n)}qe.options=qe.setOptions=function(e){return Br.setOptions(e),qe.defaults=Br.defaults,Cy(qe.defaults),qe};qe.getDefaults=hf;qe.defaults=Wr;qe.use=function(...e){return Br.use(...e),qe.defaults=Br.defaults,Cy(qe.defaults),qe};qe.walkTokens=function(e,n){return Br.walkTokens(e,n)};qe.parseInline=Br.parseInline;qe.Parser=Bs;qe.parser=Bs.parse;qe.Renderer=Bl;qe.TextRenderer=Sf;qe.Lexer=Us;qe.lexer=Us.lex;qe.Tokenizer=Ul;qe.Hooks=vl;qe.parse=qe;qe.options;qe.setOptions;qe.use;qe.walkTokens;qe.parseInline;Bs.parse;Us.lex;/*! @license DOMPurify 3.4.13 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.13/LICENSE */function rg(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=Array(n);r<n;r++)o[r]=e[r];return o}function HN(e){if(Array.isArray(e))return e}function VN(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,l,c,d,f=[],h=!0,m=!1;try{if(c=(r=r.call(e)).next,n!==0)for(;!(h=(o=c.call(r)).done)&&(f.push(o.value),f.length!==n);h=!0);}catch(v){m=!0,l=v}finally{try{if(!h&&r.return!=null&&(d=r.return(),Object(d)!==d))return}finally{if(m)throw l}}return f}}function KN(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
523
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function GN(e,n){return HN(e)||VN(e,n)||qN(e,n)||KN()}function qN(e,n){if(e){if(typeof e=="string")return rg(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?rg(e,n):void 0}}const $y=Object.entries,og=Object.setPrototypeOf,XN=Object.isFrozen,YN=Object.getPrototypeOf,QN=Object.getOwnPropertyDescriptor;let ln=Object.freeze,cn=Object.seal,So=Object.create,Py=typeof Reflect<"u"&&Reflect,Md=Py.apply,Ld=Py.construct;ln||(ln=function(n){return n});cn||(cn=function(n){return n});Md||(Md=function(n,r){for(var o=arguments.length,l=new Array(o>2?o-2:0),c=2;c<o;c++)l[c-2]=arguments[c];return n.apply(r,l)});Ld||(Ld=function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];return new n(...o)});const vo=Bt(Array.prototype.forEach),ZN=Bt(Array.prototype.lastIndexOf),ig=Bt(Array.prototype.pop),yo=Bt(Array.prototype.push),JN=Bt(Array.prototype.splice),hr=Array.isArray,Ei=Bt(String.prototype.toLowerCase),ld=Bt(String.prototype.toString),ag=Bt(String.prototype.match),Si=Bt(String.prototype.replace),lg=Bt(String.prototype.indexOf),eT=Bt(String.prototype.trim),tT=Bt(Number.prototype.toString),nT=Bt(Boolean.prototype.toString),cg=typeof BigInt>"u"?null:Bt(BigInt.prototype.toString),ug=typeof Symbol>"u"?null:Bt(Symbol.prototype.toString),nn=Bt(Object.prototype.hasOwnProperty),bi=Bt(Object.prototype.toString),tn=Bt(RegExp.prototype.test),Pr=sT(TypeError);function Bt(e){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];return Md(e,n,o)}}function sT(e){return function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return Ld(e,r)}}function Ge(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ei;if(og&&og(e,null),!hr(n))return e;let o=n.length;for(;o--;){let l=n[o];if(typeof l=="string"){const c=r(l);c!==l&&(XN(n)||(n[o]=c),l=c)}e[l]=!0}return e}function rT(e){for(let n=0;n<e.length;n++)nn(e,n)||(e[n]=null);return e}function gn(e){const n=So(null);for(const o of $y(e)){var r=GN(o,2);const l=r[0],c=r[1];nn(e,l)&&(hr(c)?n[l]=rT(c):c&&typeof c=="object"&&c.constructor===Object?n[l]=gn(c):n[l]=c)}return n}function oT(e){switch(typeof e){case"string":return e;case"number":return tT(e);case"boolean":return nT(e);case"bigint":return cg?cg(e):"0";case"symbol":return ug?ug(e):"Symbol()";case"undefined":return bi(e);case"function":case"object":{if(e===null)return bi(e);const n=e,r=ds(n,"toString");if(typeof r=="function"){const o=r(n);return typeof o=="string"?o:bi(o)}return bi(e)}default:return bi(e)}}function ds(e,n){for(;e!==null;){const o=QN(e,n);if(o){if(o.get)return Bt(o.get);if(typeof o.value=="function")return Bt(o.value)}e=YN(e)}function r(){return null}return r}function iT(e){try{return tn(e,""),!0}catch{return!1}}const dg=ln(["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"]),cd=ln(["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"]),ud=ln(["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"]),aT=ln(["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"]),dd=ln(["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"]),lT=ln(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),fg=ln(["#text"]),pg=ln(["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"]),fd=ln(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),hg=ln(["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"]),cl=ln(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),cT=cn(/{{[\w\W]*|^[\w\W]*}}/g),uT=cn(/<%[\w\W]*|^[\w\W]*%>/g),dT=cn(/\${[\w\W]*/g),fT=cn(/^data-[\-\w.\u00B7-\uFFFF]+$/),pT=cn(/^aria-[\-\w]+$/),mg=cn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),hT=cn(/^(?:\w+script|data):/i),mT=cn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),gT=cn(/^html$/i),vT=cn(/^[a-z][.\w]*(-[.\w]+)+$/i),gg=cn(/<[/\w!]/g),vg=cn(/<[/\w]/g),yT=cn(/<\/no(script|embed|frames)/i),xT=cn(/\/>/i),Un={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},wT=function(){return typeof window>"u"?null:window},kT=function(n,r){if(typeof n!="object"||typeof n.createPolicy!="function")return null;let o=null;const l="data-tt-policy-suffix";r&&r.hasAttribute(l)&&(o=r.getAttribute(l));const c="dompurify"+(o?"#"+o:"");try{return n.createPolicy(c,{createHTML(d){return d},createScriptURL(d){return d}})}catch{return console.warn("TrustedTypes policy "+c+" could not be created."),null}},yg=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},fr=function(n,r,o,l){return nn(n,r)&&hr(n[r])?Ge(l.base?gn(l.base):{},n[r],l.transform):o};function zy(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:wT();const n=ce=>zy(ce);if(n.version="3.4.13",n.removed=[],!e||!e.document||e.document.nodeType!==Un.document||!e.Element)return n.isSupported=!1,n;let r=e.document;const o=r,l=o.currentScript;e.DocumentFragment;const c=e.HTMLTemplateElement,d=e.Node,f=e.Element,h=e.NodeFilter,m=e.NamedNodeMap;m===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const v=e.DOMParser,k=e.trustedTypes,y=f.prototype,S=ds(y,"cloneNode"),j=ds(y,"remove"),T=ds(y,"nextSibling"),C=ds(y,"childNodes"),b=ds(y,"parentNode"),A=ds(y,"shadowRoot"),$=ds(y,"attributes"),P=d&&d.prototype?ds(d.prototype,"nodeType"):null,z=d&&d.prototype?ds(d.prototype,"nodeName"):null,G=d&&d.prototype?ds(d.prototype,"ownerDocument"):null;if(typeof c=="function"){const ce=r.createElement("template");ce.content&&ce.content.ownerDocument&&(r=ce.content.ownerDocument)}let M,F="",Z,Q=!1,J=0;const he=function(){if(J>0)throw Pr('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.')},ke=function(N){he(),J++;try{return M.createHTML(N)}finally{J--}},re=function(N){he(),J++;try{return M.createScriptURL(N)}finally{J--}},ve=function(){return Q||(Z=kT(k,l),Q=!0),Z},le=r,ee=le.implementation,X=le.createNodeIterator,ie=le.createDocumentFragment,K=le.getElementsByTagName,E=o.importNode;let L=yg();n.isSupported=typeof $y=="function"&&typeof b=="function"&&ee&&ee.createHTMLDocument!==void 0;const de=cT,U=uT,me=dT,Y=fT,xe=pT,we=hT,Me=mT,_e=vT;let ge=mg,pe=null;const Xe=Ge({},[...dg,...cd,...ud,...dd,...fg]);let Re=null;const at=Ge({},[...pg,...fd,...hg,...cl]);let He=Object.seal(So(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}})),Te=null,Ue=null;const Ke=Object.seal(So(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let lt=!0,Tt=!0,Wt=!1,q=!0,Se=!1,Pe=!0,Ye=!1,xt=!1,wt=null,Dt=null,un=!1,Ct=!1,Mn=!1,Ln=!1,ts=!0,ns=!1;const ss="user-content-";let rs=!0,vn=!1,dn={},Ft=null;const Cn=Ge({},["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 ct=null;const mt=Ge({},["audio","video","img","source","image","track"]);let Et=null;const Ht=Ge({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),kt="http://www.w3.org/1998/Math/MathML",gt="http://www.w3.org/2000/svg",ft="http://www.w3.org/1999/xhtml";let Vt=ft,ut=!1,Qt=null;const Mt=Ge({},[kt,gt,ft],ld),I=ln(["mi","mo","mn","ms","mtext"]);let fe=Ge({},I);const ae=ln(["annotation-xml"]);let be=Ge({},ae);const Fe=Ge({},["title","style","font","a","script"]);let Qe=null;const Be=["application/xhtml+xml","text/html"],Kt="text/html";let We=null,Gt=null;const vs=r.createElement("form"),As=function(N){return N instanceof RegExp||N instanceof Function},ys=function(){let N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Gt&&Gt===N)return;(!N||typeof N!="object")&&(N={}),N=gn(N),Qe=Be.indexOf(N.PARSER_MEDIA_TYPE)===-1?Kt:N.PARSER_MEDIA_TYPE,We=Qe==="application/xhtml+xml"?ld:Ei,pe=fr(N,"ALLOWED_TAGS",Xe,{transform:We}),Re=fr(N,"ALLOWED_ATTR",at,{transform:We}),Qt=fr(N,"ALLOWED_NAMESPACES",Mt,{transform:ld}),Et=fr(N,"ADD_URI_SAFE_ATTR",Ht,{transform:We,base:Ht}),ct=fr(N,"ADD_DATA_URI_TAGS",mt,{transform:We,base:mt}),Ft=fr(N,"FORBID_CONTENTS",Cn,{transform:We}),Te=fr(N,"FORBID_TAGS",gn({}),{transform:We}),Ue=fr(N,"FORBID_ATTR",gn({}),{transform:We}),dn=nn(N,"USE_PROFILES")?N.USE_PROFILES&&typeof N.USE_PROFILES=="object"?gn(N.USE_PROFILES):N.USE_PROFILES:!1,lt=N.ALLOW_ARIA_ATTR!==!1,Tt=N.ALLOW_DATA_ATTR!==!1,Wt=N.ALLOW_UNKNOWN_PROTOCOLS||!1,q=N.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Se=N.SAFE_FOR_TEMPLATES||!1,Pe=N.SAFE_FOR_XML!==!1,Ye=N.WHOLE_DOCUMENT||!1,Ct=N.RETURN_DOM||!1,Mn=N.RETURN_DOM_FRAGMENT||!1,Ln=N.RETURN_TRUSTED_TYPE||!1,un=N.FORCE_BODY||!1,ts=N.SANITIZE_DOM!==!1,ns=N.SANITIZE_NAMED_PROPS||!1,rs=N.KEEP_CONTENT!==!1,vn=N.IN_PLACE||!1,ge=iT(N.ALLOWED_URI_REGEXP)?N.ALLOWED_URI_REGEXP:mg,Vt=typeof N.NAMESPACE=="string"?N.NAMESPACE:ft,fe=nn(N,"MATHML_TEXT_INTEGRATION_POINTS")&&N.MATHML_TEXT_INTEGRATION_POINTS&&typeof N.MATHML_TEXT_INTEGRATION_POINTS=="object"?gn(N.MATHML_TEXT_INTEGRATION_POINTS):Ge({},I),be=nn(N,"HTML_INTEGRATION_POINTS")&&N.HTML_INTEGRATION_POINTS&&typeof N.HTML_INTEGRATION_POINTS=="object"?gn(N.HTML_INTEGRATION_POINTS):Ge({},ae);const B=nn(N,"CUSTOM_ELEMENT_HANDLING")&&N.CUSTOM_ELEMENT_HANDLING&&typeof N.CUSTOM_ELEMENT_HANDLING=="object"?gn(N.CUSTOM_ELEMENT_HANDLING):So(null);if(He=So(null),nn(B,"tagNameCheck")&&As(B.tagNameCheck)&&(He.tagNameCheck=B.tagNameCheck),nn(B,"attributeNameCheck")&&As(B.attributeNameCheck)&&(He.attributeNameCheck=B.attributeNameCheck),nn(B,"allowCustomizedBuiltInElements")&&typeof B.allowCustomizedBuiltInElements=="boolean"&&(He.allowCustomizedBuiltInElements=B.allowCustomizedBuiltInElements),cn(He),Se&&(Tt=!1),Mn&&(Ct=!0),dn&&(pe=Ge({},fg),Re=So(null),dn.html===!0&&(Ge(pe,dg),Ge(Re,pg)),dn.svg===!0&&(Ge(pe,cd),Ge(Re,fd),Ge(Re,cl)),dn.svgFilters===!0&&(Ge(pe,ud),Ge(Re,fd),Ge(Re,cl)),dn.mathMl===!0&&(Ge(pe,dd),Ge(Re,hg),Ge(Re,cl))),Ke.tagCheck=null,Ke.attributeCheck=null,nn(N,"ADD_TAGS")&&(typeof N.ADD_TAGS=="function"?Ke.tagCheck=N.ADD_TAGS:hr(N.ADD_TAGS)&&(pe===Xe&&(pe=gn(pe)),Ge(pe,N.ADD_TAGS,We))),nn(N,"ADD_ATTR")&&(typeof N.ADD_ATTR=="function"?Ke.attributeCheck=N.ADD_ATTR:hr(N.ADD_ATTR)&&(Re===at&&(Re=gn(Re)),Ge(Re,N.ADD_ATTR,We))),nn(N,"ADD_URI_SAFE_ATTR")&&hr(N.ADD_URI_SAFE_ATTR)&&Ge(Et,N.ADD_URI_SAFE_ATTR,We),nn(N,"FORBID_CONTENTS")&&hr(N.FORBID_CONTENTS)&&(Ft===Cn&&(Ft=gn(Ft)),Ge(Ft,N.FORBID_CONTENTS,We)),nn(N,"ADD_FORBID_CONTENTS")&&hr(N.ADD_FORBID_CONTENTS)&&(Ft===Cn&&(Ft=gn(Ft)),Ge(Ft,N.ADD_FORBID_CONTENTS,We)),rs&&(pe["#text"]=!0),Ye&&Ge(pe,["html","head","body"]),pe.table&&(Ge(pe,["tbody"]),delete Te.tbody),N.TRUSTED_TYPES_POLICY){if(typeof N.TRUSTED_TYPES_POLICY.createHTML!="function")throw Pr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof N.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Pr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const te=M;M=N.TRUSTED_TYPES_POLICY;try{F=ke("")}catch(je){throw M=te,je}}else N.TRUSTED_TYPES_POLICY===null?(M=void 0,F=""):(M===void 0&&(M=ve()),M&&typeof F=="string"&&(F=ke("")));ln&&ln(N),Gt=N},Hn=Ge({},[...cd,...ud,...aT]),xs=Ge({},[...dd,...lT]),st=function(N,B,te){return B.namespaceURI===ft?N==="svg":B.namespaceURI===kt?N==="svg"&&(te==="annotation-xml"||fe[te]):!!Hn[N]},Ot=function(N,B,te){return B.namespaceURI===ft?N==="math":B.namespaceURI===gt?N==="math"&&be[te]:!!xs[N]},ws=function(N,B,te){return B.namespaceURI===gt&&!be[te]||B.namespaceURI===kt&&!fe[te]?!1:!xs[N]&&(Fe[N]||!Hn[N])},jt=function(N){let B=b(N);(!B||!B.tagName)&&(B={namespaceURI:Vt,tagName:"template"});const te=Ei(N.tagName),je=Ei(B.tagName);return Qt[N.namespaceURI]?N.namespaceURI===gt?st(te,B,je):N.namespaceURI===kt?Ot(te,B,je):N.namespaceURI===ft?ws(te,B,je):!!(Qe==="application/xhtml+xml"&&Qt[N.namespaceURI]):!1},ks=function(N){yo(n.removed,{element:N});try{b(N).removeChild(N)}catch{if(j(N),!b(N))throw Pr("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Vs=function(N){wr(N);const B=C(N);if(B){const je=[];vo(B,De=>{yo(je,De)}),vo(je,De=>{try{j(De)}catch{}})}const te=$(N);if(te)for(let je=te.length-1;je>=0;--je){const De=te[je],ze=De&&De.name;if(typeof ze=="string")try{N.removeAttribute(ze)}catch{}}},Ss=function(N,B){try{yo(n.removed,{attribute:B.getAttributeNode(N),from:B})}catch{yo(n.removed,{attribute:null,from:B})}if(B.removeAttribute(N),N==="is")if(Ct||Mn)try{ks(B)}catch{}else try{B.setAttribute(N,"")}catch{}},Hr=function(N){const B=$(N);if(B)for(let te=B.length-1;te>=0;--te){const je=B[te],De=je&&je.name;if(!(typeof De!="string"||Re[We(De)]))try{N.removeAttribute(De)}catch{}}},wr=function(N){const B=[N];for(;B.length>0;){const te=B.pop();(P?P(te):te.nodeType)===Un.element&&Hr(te);const De=C(te);if(De)for(let ze=De.length-1;ze>=0;--ze)B.push(De[ze])}},Qi=function(N){if(!Pe)return;const B=[N];for(;B.length>0;){const te=B.pop(),je=P?P(te):te.nodeType;if(je===Un.processingInstruction||je===Un.comment&&tn(vg,te.data)){try{j(te)}catch{}continue}if(je===Un.element){const ze=te,Je=We(z?z(te):te.nodeName);try{ze.hasAttribute&&ze.hasAttribute("patchsrc")&&ze.removeAttribute("patchsrc"),ze.hasAttribute&&ze.hasAttribute("for")&&Je!=="label"&&Je!=="output"&&ze.removeAttribute("for")}catch{}}const De=C(te);if(De)for(let ze=De.length-1;ze>=0;--ze)B.push(De[ze])}},kr=function(N){let B=null,te=null;if(un)N="<remove></remove>"+N;else{const ze=ag(N,/^[\r\n\t ]+/);te=ze&&ze[0]}Qe==="application/xhtml+xml"&&Vt===ft&&(N='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+N+"</body></html>");const je=M?ke(N):N;if(Vt===ft)try{B=new v().parseFromString(je,Qe)}catch{}if(!B||!B.documentElement){B=ee.createDocument(Vt,"template",null);try{B.documentElement.innerHTML=ut?F:je}catch{}}const De=B.body||B.documentElement;return N&&te&&De.insertBefore(r.createTextNode(te),De.childNodes[0]||null),Vt===ft?K.call(B,Ye?"html":"body")[0]:Ye?B.documentElement:De},On=function(N){const B=G?G(N):N.ownerDocument;return X.call(B||N,N,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Vr=function(N){return N=Si(N,de," "),N=Si(N,U," "),N=Si(N,me," "),N},yn=function(N){var B;N.normalize();const te=G?G(N):N.ownerDocument,je=X.call(te||N,N,h.SHOW_TEXT|h.SHOW_COMMENT|h.SHOW_CDATA_SECTION|h.SHOW_PROCESSING_INSTRUCTION,null);let De=je.nextNode();for(;De;)De.data=Vr(De.data),De=je.nextNode();const ze=(B=N.querySelectorAll)===null||B===void 0?void 0:B.call(N,"template");ze&&vo(ze,Je=>{Ks(Je.content)&&yn(Je.content)})},Kr=function(N){const B=z?z(N):null;return typeof B!="string"||We(B)!=="form"?!1:typeof N.nodeName!="string"||typeof N.textContent!="string"||typeof N.removeChild!="function"||N.attributes!==$(N)||typeof N.removeAttribute!="function"||typeof N.setAttribute!="function"||typeof N.namespaceURI!="string"||typeof N.insertBefore!="function"||typeof N.hasChildNodes!="function"||N.nodeType!==P(N)||N.childNodes!==C(N)},Ks=function(N){if(!P||typeof N!="object"||N===null)return!1;try{return P(N)===Un.documentFragment}catch{return!1}},Sr=function(N){if(!P||typeof N!="object"||N===null)return!1;try{return typeof P(N)=="number"}catch{return!1}};function xn(ce,N,B){ce.length!==0&&vo(ce,te=>{te.call(n,N,B,Gt)})}const Gr=function(N,B){return!!(Pe&&N.hasChildNodes()&&!Sr(N.firstElementChild)&&tn(gg,N.textContent)&&tn(gg,N.innerHTML)||Pe&&N.namespaceURI===ft&&B==="style"&&Sr(N.firstElementChild)||N.nodeType===Un.processingInstruction||Pe&&N.nodeType===Un.comment&&tn(vg,N.data))},br=function(N,B,te){if(!Te[B]&&Fo(B)&&(He.tagNameCheck instanceof RegExp&&tn(He.tagNameCheck,B)||He.tagNameCheck instanceof Function&&He.tagNameCheck(B)))return!1;if(rs&&!Ft[B]){const je=b(N),De=C(N);if(De&&je){const ze=De.length;for(let Je=ze-1;Je>=0;--Je){const tt=N===te?S(De[Je],!0):De[Je];je.insertBefore(tt,T(N))}}}return ks(N),!0},Nr=function(N,B,te,je){return N.length===0?B:B===te||B===je?gn(B):B},Zi=function(N,B){if(xn(L.beforeSanitizeElements,N,null),N!==B&&b(N)===null)return vn&&wr(N),!0;if(Kr(N))return ks(N),!0;const te=We(z?z(N):N.nodeName);if(pe=Nr(L.uponSanitizeElement,pe,Xe,wt),xn(L.uponSanitizeElement,N,{tagName:te,allowedTags:pe}),N!==B&&b(N)===null)return vn&&wr(N),!0;if(Gr(N,te))return ks(N),!0;if(Te[te]||!(Ke.tagCheck instanceof Function&&Ke.tagCheck(te))&&!pe[te]){const De=br(N,te,B);return De===!1&&xn(L.afterSanitizeElements,N,null),De}if((P?P(N):N.nodeType)===Un.element&&!jt(N)||(te==="noscript"||te==="noembed"||te==="noframes")&&tn(yT,N.innerHTML))return ks(N),!0;if(Se&&N.nodeType===Un.text){const De=Vr(N.textContent);N.textContent!==De&&(yo(n.removed,{element:N.cloneNode()}),N.textContent=De)}return xn(L.afterSanitizeElements,N,null),!1},Ji=function(N,B,te){if(Ue[B]||Pe&&B==="patchsrc"||Pe&&B==="for"&&N!=="label"&&N!=="output"||ts&&(B==="id"||B==="name")&&(te in r||te in vs))return!1;const je=Re[B]||Ke.attributeCheck instanceof Function&&Ke.attributeCheck(B,N);if(!(Tt&&tn(Y,B))){if(!(lt&&tn(xe,B))){if(je){if(!Et[B]){if(!tn(ge,Si(te,Me,""))){if(!((B==="src"||B==="xlink:href"||B==="href")&&N!=="script"&&lg(te,"data:")===0&&ct[N])){if(!(Wt&&!tn(we,Si(te,Me,"")))){if(te)return!1}}}}}else if(!(Fo(N)&&(He.tagNameCheck instanceof RegExp&&tn(He.tagNameCheck,N)||He.tagNameCheck instanceof Function&&He.tagNameCheck(N))&&(He.attributeNameCheck instanceof RegExp&&tn(He.attributeNameCheck,B)||He.attributeNameCheck instanceof Function&&He.attributeNameCheck(B,N))||B==="is"&&He.allowCustomizedBuiltInElements&&(He.tagNameCheck instanceof RegExp&&tn(He.tagNameCheck,te)||He.tagNameCheck instanceof Function&&He.tagNameCheck(te))))return!1}}return!0},zo=Ge({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Fo=function(N){return!zo[Ei(N)]&&tn(_e,N)},Uo=function(N,B,te,je){if(M&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!te)switch(k.getAttributeType(N,B)){case"TrustedHTML":return ke(je);case"TrustedScriptURL":return re(je)}return je},Tr=function(N,B,te,je){try{te?N.setAttributeNS(te,B,je):N.setAttribute(B,je),Kr(N)?ks(N):ig(n.removed)}catch{Ss(B,N)}},ea=function(N){xn(L.beforeSanitizeAttributes,N,null);const B=N.attributes;if(!B||Kr(N))return;Re=Nr(L.uponSanitizeAttribute,Re,at,Dt);const te={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Re,forceKeepAttr:void 0};let je=B.length;const De=We(N.nodeName);for(;je--;){const ze=B[je],Je=ze.name,tt=ze.namespaceURI,_t=ze.value,Rt=We(Je),Is=_t;let $t=Je==="value"?Is:eT(Is);if(te.attrName=Rt,te.attrValue=$t,te.keepAttr=!0,te.forceKeepAttr=void 0,xn(L.uponSanitizeAttribute,N,te),$t=te.attrValue,ns&&(Rt==="id"||Rt==="name")&&lg($t,ss)!==0&&(Ss(Je,N),$t=ss+$t),Pe&&tn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,$t)){Ss(Je,N);continue}if(Rt==="attributename"&&ag($t,"href")){Ss(Je,N);continue}if(!te.forceKeepAttr){if(!te.keepAttr){Ss(Je,N);continue}if(!q&&tn(xT,$t)){Ss(Je,N);continue}if(Se&&($t=Vr($t)),!Ji(De,Rt,$t)){Ss(Je,N);continue}$t=Uo(De,Rt,tt,$t),$t!==Is&&Tr(N,Je,tt,$t)}}xn(L.afterSanitizeAttributes,N,null)},Gs=function(N){let B=null;const te=On(N);for(xn(L.beforeSanitizeShadowDOM,N,null);B=te.nextNode();)if(xn(L.uponSanitizeShadowNode,B,null),Zi(B,N),ea(B),Ks(B.content)&&Gs(B.content),(P?P(B):B.nodeType)===Un.element){const De=A(B);Ks(De)&&(Ze(De),Gs(De))}xn(L.afterSanitizeShadowDOM,N,null)},Ze=function(N){const B=[{node:N,shadow:null}];for(;B.length>0;){const te=B.pop();if(te.shadow){Gs(te.shadow);continue}const je=te.node,ze=(P?P(je):je.nodeType)===Un.element,Je=C(je);if(Je)for(let tt=Je.length-1;tt>=0;--tt)B.push({node:Je[tt],shadow:null});if(ze){const tt=z?z(je):null;if(typeof tt=="string"&&We(tt)==="template"){const _t=je.content;Ks(_t)&&B.push({node:_t,shadow:null})}}if(ze){const tt=A(je);Ks(tt)&&B.push({node:null,shadow:tt},{node:tt,shadow:null})}}};return n.sanitize=function(ce){let N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},B=null,te=null,je=null,De=null;if(ut=!ce,ut&&(ce="<!-->"),typeof ce!="string"&&!Sr(ce)&&(ce=oT(ce),typeof ce!="string"))throw Pr("dirty is not a string, aborting");if(!n.isSupported)return ce;xt?(pe=wt,Re=Dt):ys(N),(L.uponSanitizeElement.length>0||L.uponSanitizeAttribute.length>0)&&(pe=gn(pe)),L.uponSanitizeAttribute.length>0&&(Re=gn(Re)),n.removed=[];const ze=vn&&typeof ce!="string"&&Sr(ce);if(ze){Qi(ce);const _t=z?z(ce):ce.nodeName;if(typeof _t=="string"){const Rt=We(_t);if(!pe[Rt]||Te[Rt])throw Vs(ce),Pr("root node is forbidden and cannot be sanitized in-place")}if(Kr(ce))throw Vs(ce),Pr("root node is clobbered and cannot be sanitized in-place");try{Ze(ce)}catch(Rt){throw Vs(ce),Rt}}else if(Sr(ce))B=kr("<!---->"),te=B.ownerDocument.importNode(ce,!0),te.nodeType===Un.element&&te.nodeName==="BODY"||te.nodeName==="HTML"?B=te:B.appendChild(te),Ze(te);else{if(!Ct&&!Se&&!Ye&&ce.indexOf("<")===-1)return M&&Ln?ke(ce):ce;if(B=kr(ce),!B)return Ct?null:Ln?F:""}B&&un&&ks(B.firstChild);const Je=ze?ce:B;try{const _t=On(Je);for(;je=_t.nextNode();)Zi(je,Je),ea(je),Ks(je.content)&&Gs(je.content)}catch(_t){throw ze&&(Vs(ce),vo(n.removed,Rt=>{Rt.element&&wr(Rt.element)})),_t}if(ze)return vo(n.removed,_t=>{_t.element&&wr(_t.element)}),Se&&yn(ce),ce;if(Ct){if(Se&&yn(B),Mn)for(De=ie.call(B.ownerDocument);B.firstChild;)De.appendChild(B.firstChild);else De=B;return(Re.shadowroot||Re.shadowrootmode)&&(De=E.call(o,De,!0)),De}let tt=Ye?B.outerHTML:B.innerHTML;return Ye&&pe["!doctype"]&&B.ownerDocument&&B.ownerDocument.doctype&&B.ownerDocument.doctype.name&&tn(gT,B.ownerDocument.doctype.name)&&(tt="<!DOCTYPE "+B.ownerDocument.doctype.name+`>
524
+ `+tt),Se&&(tt=Vr(tt)),M&&Ln?ke(tt):tt},n.setConfig=function(){let ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ys(ce),xt=!0,wt=pe,Dt=Re},n.clearConfig=function(){Gt=null,xt=!1,wt=null,Dt=null,M=Z,F=""},n.isValidAttribute=function(ce,N,B){Gt||ys({});const te=We(ce),je=We(N);return Ji(te,je,B)},n.addHook=function(ce,N){typeof N=="function"&&nn(L,ce)&&yo(L[ce],N)},n.removeHook=function(ce,N){if(nn(L,ce)){if(N!==void 0){const B=ZN(L[ce],N);return B===-1?void 0:JN(L[ce],B,1)[0]}return ig(L[ce])}},n.removeHooks=function(ce){nn(L,ce)&&(L[ce]=[])},n.removeAllHooks=function(){L=yg()},n}var bf=zy();const ST=new Set(["command_execution","file_change","mcp_tool_call","web_search"]),bT=100;function xg(e){return ST.has(e.type)}function NT({items:e,runtimeType:n,turn:r,threads:o=[]}){const[l,c]=x.useState(!1),[d,f]=x.useState(!1);if(e.length===0)return null;const h=e.length,m=d?0:Math.max(0,h-bT),v=m>0?e.slice(m):e;return a.jsxs("div",{className:"tool-calls",children:[a.jsxs("div",{className:"tool-calls-header",onClick:()=>c(k=>!k),children:[a.jsx("span",{className:"tool-calls-icon",children:a.jsx(sS,{size:12})}),a.jsxs("span",{className:"tool-calls-summary",children:[h," tool call",h>1?"s":""]}),a.jsx($i,{size:14,className:"tool-calls-chevron",style:{transform:l?"rotate(90deg)":"none"}})]}),l&&a.jsxs("div",{className:"tool-calls-body",children:[m>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>f(!0),children:["Show ",m," earlier tool call",m>1?"s":""]})}),v.map(k=>a.jsx(zr,{item:k,runtimeType:n,turn:r,threads:o},k.id))]})]})}qe.setOptions({breaks:!0,gfm:!0});function TT(e){const n=qe.parse(e);return bf.sanitize(n)}function wg(e,n){var l;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o=0;for(;r.nextNode();){const c=r.currentNode,d=((l=c.textContent)==null?void 0:l.length)??0;if(o+d>n)return{node:c,offset:n-o};o+=d}return null}function CT(e,n,r){const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),l=[];for(;o.nextNode();){const c=o.currentNode;if(!c.textContent||c.textContent.trim()==="")continue;const d=document.createRange();d.selectNodeContents(c),!(d.compareBoundaryPoints(Range.START_TO_END,n)<=0)&&(d.compareBoundaryPoints(Range.END_TO_START,n)>=0||l.push(c))}for(const c of l){const d=c.length;let f=0,h=d;if(c===n.startContainer&&(f=Math.min(n.startOffset,d)),c===n.endContainer&&(h=Math.min(n.endOffset,d)),f>=h)continue;h<d&&c.splitText(h);const m=f>0?c.splitText(f):c,v=r(),k=m.parentNode;k&&(k.insertBefore(v,m),v.appendChild(m))}}function ET(e,n){e.querySelectorAll("mark[data-thread-id]").forEach(r=>{const o=r.parentNode;if(!o)return;const l=document.createTextNode(r.textContent||"");o.replaceChild(l,r),o.normalize()});for(const r of n){if(r.start_offset===null||r.end_offset===null)continue;const o=wg(e,r.start_offset),l=wg(e,r.end_offset);if(!o||!l)continue;const c=document.createRange();c.setStart(o.node,o.offset),c.setEnd(l.node,l.offset),CT(e,c,()=>{const d=document.createElement("mark");return d.setAttribute("data-thread-id",r.id),r.status==="resolved"&&d.classList.add("thread-mark-resolved"),d})}}function jT(e){const n=window.getSelection();if(!n||n.rangeCount===0)return null;const r=n.getRangeAt(0);if(r.collapsed||!e.contains(r.commonAncestorContainer))return null;const o=document.createRange();o.setStart(e,0),o.setEnd(r.startContainer,r.startOffset);const l=o.toString().length,c=r.toString();return{start:l,end:l+c.length,text:c}}function _T({itemId:e,turnId:n,sessionId:r,content:o,threads:l}){const c=x.useRef(null),d=x.useRef(null),f=x.useRef(null),h=x.useRef(""),m=x.useRef(0),[v,k]=x.useState(!1),[y,S]=x.useState({x:0,y:0}),[j,T]=x.useState(!1),[C,b]=x.useState({x:0,y:0}),[A,$]=x.useState(""),[P,z]=x.useState(null),[G,M]=x.useState(!1),F=R(K=>K.createThread),Z=R(K=>K.switchRightTab),Q=R(K=>Xl(K.sessionDetails[r])),J=x.useCallback(async()=>{await Bi(o||""),M(!0),setTimeout(()=>M(!1),1500)},[o]),he=x.useCallback(()=>{var E;if(!P)return;const K=`
525
+ \`\`\`QUOTE
526
+ ${P.text}
527
+ \`\`\`
528
+
529
+ `;R.setState({quotedText:K}),k(!1),z(null),(E=window.getSelection())==null||E.removeAllRanges()},[P]),ke=x.useMemo(()=>TT(o||"…"),[o]),re=x.useMemo(()=>l.filter(K=>K.item_id===e),[l,e]);x.useEffect(()=>{c.current&&ET(c.current,re)},[ke,re]),x.useEffect(()=>{h.current=A},[A]),x.useEffect(()=>{function K(E){d.current&&!d.current.contains(E.target)&&(k(!1),h.current.trim()||T(!1))}return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[]);const ve=x.useCallback(()=>{k(!1),h.current.trim()||T(!1)},[]),le=x.useCallback(()=>{const K=c.current;if(!K)return;const E=jT(K);if(E&&E.text.trim().length>0){const L=window.getSelection();if(L&&L.rangeCount>0&&L.anchorNode&&L.focusNode){const U=L.getRangeAt(0).getBoundingClientRect(),me=28,Y=6,xe=170;let we=!1;try{const ge=document.createRange();ge.setStart(L.focusNode,L.focusOffset),ge.setEnd(L.focusNode,L.focusOffset);const pe=document.createRange();pe.setStart(L.anchorNode,L.anchorOffset),pe.setEnd(L.anchorNode,L.anchorOffset),we=pe.compareBoundaryPoints(Range.START_TO_START,ge)>0}catch{we=!1}let Me=U.top-me-Y;Me<8&&(Me=U.bottom+Y);let _e=we?U.left-xe:U.right;_e=Math.max(8,Math.min(_e,window.innerWidth-xe-8)),S({x:_e,y:Me}),k(!0),z(E)}}else k(!1)},[]);x.useEffect(()=>{function K(E){const L=E.target;L&&(L.closest(".selection-actions")||L.closest(".thread-create-popover"))||le()}return document.addEventListener("mouseup",K),()=>document.removeEventListener("mouseup",K)},[le]);const ee=x.useCallback(()=>{k(!1),T(!0),b({x:y.x,y:y.y})},[y]);x.useLayoutEffect(()=>{if(!j)return;const K=f.current;if(!K)return;const E=K.offsetWidth,L=K.offsetHeight,de=8;let U=y.x,me=y.y;U-E<de&&(U=E+de),U>window.innerWidth-de&&(U=window.innerWidth-de),me<de&&(me=de),me+L>window.innerHeight-de&&(me=window.innerHeight-L-de),b({x:U,y:me})},[j,y]);const X=x.useCallback(async()=>{var K;Q||!P||!A.trim()||(await F(r,{itemId:e,turnId:n,startOffset:P.start,endOffset:P.end,selectedText:P.text,message:A.trim()}),$(""),T(!1),z(null),(K=window.getSelection())==null||K.removeAllRanges(),Z("threads"))},[P,A,F,r,e,n,Z,Q]),ie=x.useCallback(K=>{const E=K.target;if(E.tagName==="MARK"&&E.hasAttribute("data-thread-id")){K.preventDefault(),Z("threads");const L=E.getAttribute("data-thread-id");setTimeout(()=>{const de=document.getElementById(`thread-${L}`);de&&(de.scrollIntoView({behavior:"smooth",block:"center"}),de.classList.add("thread-card-highlighted"),setTimeout(()=>de.classList.remove("thread-card-highlighted"),1500))},100)}},[Z]);return a.jsxs("div",{className:"copy-text-wrapper",style:{position:"relative"},ref:d,children:[a.jsx("div",{ref:c,dangerouslySetInnerHTML:{__html:ke},onMouseDown:ve,onClick:ie}),a.jsx("button",{className:`copy-text-btn${G?" copied":""}`,onClick:J,title:G?"Copied":"Copy message","aria-label":"Copy message text",children:G?a.jsx(_s,{size:14}):a.jsx(Pi,{size:14})}),v&&!j&&a.jsxs("div",{className:"selection-actions",style:{left:y.x,top:y.y},children:[!Q&&a.jsxs("button",{className:"discuss-button",onClick:ee,title:"Start a discussion about this text",children:[a.jsx(U1,{size:14}),a.jsx("span",{children:"Discuss"})]}),a.jsxs("button",{className:"discuss-button",onClick:he,title:"Quote this text in your message",children:[a.jsx(Vv,{size:14}),a.jsx("span",{children:"Quote"})]})]}),j&&a.jsxs("div",{ref:f,className:"thread-create-popover",style:{left:C.x,top:C.y},children:[a.jsxs("div",{className:"thread-create-header",children:[a.jsxs("span",{className:"thread-create-quote",children:['"',P==null?void 0:P.text.slice(0,80),P&&P.text.length>80?"…":"",'"']}),a.jsx("button",{className:"thread-create-close",onClick:()=>{T(!1),z(null)},children:a.jsx(Nn,{size:14})})]}),a.jsx("textarea",{className:"thread-create-input",placeholder:"Ask about this text…",value:A,onChange:K=>$(K.target.value),autoFocus:!0,rows:2,onKeyDown:K=>{if(K.key==="Enter"&&(K.metaKey||K.ctrlKey)&&(K.preventDefault(),X()),K.key==="Escape")if(h.current.trim()){const E=Date.now();m.current&&E-m.current<400?(m.current=0,T(!1),z(null)):m.current=E}else T(!1),z(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:X,disabled:!A.trim()||Q,title:Q?"Wait for the running turn to finish first":void 0,children:[a.jsx(Vi,{size:13}),a.jsx("span",{children:"Send"})]})]})]})]})}const kg=x.memo(_T),Wl=new Map,Fy=new Set,Od=new Set,Sg=new Map;function Uy(){Od.forEach(e=>e())}function By(e,n){return`${e}:${n}`}function RT(e,n,r,o,l){var h;const c=By(n,r),d=Wl.get(e)??new Map,f=new Map(d);((h=f.get(c))==null?void 0:h.answer)===l?f.delete(c):f.set(c,{itemIndex:n,groupIndex:r,question:o,answer:l}),Wl.set(e,f),Uy()}function AT(e){Wl.delete(e),Uy()}function IT(e){Fy.add(e),AT(e)}function DT(e){const n=x.useCallback(r=>(Od.add(r),()=>{Od.delete(r)}),[]);return x.useSyncExternalStore(n,()=>Wl.get(e)??Sg,()=>Sg)}function MT(e){return[...e].sort((n,r)=>n.itemIndex-r.itemIndex||n.groupIndex-r.groupIndex).map(n=>`> ${n.question}
530
+ ${n.answer}`).join(`
531
+
532
+ `)}function bg({item:e,turn:n}){var S;const r=e.data??{},o=x.useMemo(()=>Array.isArray(r.groups)?r.groups.filter(j=>!!j&&Array.isArray(j.selections)&&j.selections.length>0):[],[r.groups]),l=DT(n.id),c=R(j=>n.session_id?j.sessionDetails[n.session_id]:null),d=R(j=>j.activeSessionId),f=n.items.filter(j=>j.type==="ask_user"||j.type==="final_result").findIndex(j=>j.id===e.id),h=c?((S=c.turns[c.turns.length-1])==null?void 0:S.id)===n.id:!0,m=Fy.has(n.id),v=m||hv(c)||!h||n.session_id!==d,k=(j,T,C)=>{v||RT(n.id,f,j,T,C)},y=()=>{const j=[...l.values()];if(j.length===0)return;const T=MT(j);IT(n.id),R.getState().submitPrompt(T)};return a.jsxs("div",{className:"render-content ask-user-card",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(C1,{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((j,T)=>a.jsxs("div",{className:"ask-user-group",children:[j.question&&a.jsx("div",{className:"ask-user-question",children:j.question}),a.jsx("div",{className:"ask-user-options",children:j.selections.map(C=>{var A;const b=((A=l.get(By(f,T)))==null?void 0:A.answer)===C;return a.jsx("button",{type:"button",className:`ask-user-option ${b?"selected":""}`,disabled:v,onClick:()=>k(T,j.question,C),children:C},C)})})]},T)),v?m&&a.jsx("div",{className:"ask-user-submitted",children:"Answer sent"}):a.jsxs("button",{type:"button",className:"ask-user-send",disabled:l.size===0,onClick:y,children:[a.jsx(Vi,{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 LT={host_shutdown:"host shutdown",host_restart:"host restart",process_exit:"agent process stopped",network:"network error",auth:"signed out",usage_limit:"usage limit"};function yl(e){return e&&LT[e]||"interrupted"}function Hl(e){if(!e)return"";const n=new Date(e);return Number.isNaN(n.getTime())?"":n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function OT(e){switch(e.interrupt_reason){case"network":return"Interrupted — network error. Will resume when the connection is back.";case"auth":return"Interrupted — Claude is signed out. Sign in again from a terminal, then resume.";case"usage_limit":{const n=Hl(e.resume_at);return n?`Usage limit reached — resumes at ${n}.`:"Usage limit reached — resume once it is over."}case"process_exit":return"Interrupted — the agent process stopped. Resuming automatically…";case"host_shutdown":return"Interrupted — the agent host shut down. Resuming automatically…";default:return"Interrupted — the agent host restarted. Resuming automatically…"}}function $T(e){return e.items.filter(n=>n.type==="interruption").map(n=>n.data)}function PT({item:e}){const n=e.data,r=Hl(n.interrupted_at);let o="";switch(n.outcome){case"waiting":o="waiting to resume";break;case"resuming":o="resuming…";break;case"resumed":o=n.resumed_at?`resumed ${Hl(n.resumed_at)}`:"resumed";break;case"cancelled":o="stopped";break;case"unsupported":o="cannot be resumed";break;default:o="not resumed"}return a.jsx("div",{className:"interruption-marker",title:n.detail??void 0,children:a.jsxs("span",{children:["Interrupted",r?` ${r}`:""," (",yl(n.reason),") · ",o]})})}function zT({turn:e,label:n}){const[r,o]=x.useState(!1),l=R(d=>d.addToast),c=()=>{o(!0),b0(e.session_id,e.id).catch(d=>l("error",`Could not resume the turn — ${d.message}`)).finally(()=>o(!1))};return a.jsxs("button",{type:"button",className:"banner-action",onClick:c,disabled:r,children:[a.jsx(Kv,{size:12}),n]})}function FT({turn:e}){const n=e.resume_state;if(!n||n==="cancelled"||n==="resumed")return null;const r=e.interrupt_reason,o=$T(e),l=o[o.length-1],c=Hl(e.interrupted_at??(l==null?void 0:l.interrupted_at));let d,f=null,h=null;switch(n){case"waiting":{const m=r==="usage_limit"&&!e.resume_at;d=OT(e),f=m?(l==null?void 0:l.detail)??null:null,h=r==="auth"||m?"Resume":"Resume now";break}case"resuming":d=`Interrupted (${yl(r)}) — resuming from where it left off…`;break;case"gave_up":{const m=Math.max(o.length,1);d=`Interrupted ${m===1?"once":`${m} times`} — automatic resume stopped.`,f=e.error&&!e.error.startsWith("Automatic resume stopped")?e.error:null,h="Resume";break}case"skipped":d=`Interrupted${c?` ${c}`:""} (${yl(r)}) — too long ago to resume automatically.`,h="Resume";break;default:d=`Interrupted (${yl(r)}) — this turn cannot be resumed.`,f=e.error}return a.jsxs("div",{className:"interruption-banner","data-state":n,children:[a.jsx("span",{className:"banner-icon",children:r==="network"?a.jsx(Xv,{size:12}):a.jsx(ec,{size:12})}),a.jsxs("span",{className:"banner-text",children:[d,f&&a.jsx("span",{className:"banner-detail",children:f})]}),h&&a.jsx(zT,{turn:e,label:h})]})}function UT({turnId:e}){const n=R(o=>o.retryStates[e]);if(!n)return null;const r=n.errorStatus?`API error ${n.errorStatus}`:"Connection problem";return a.jsxs("div",{className:"retry-banner",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(Xv,{size:12})}),a.jsxs("span",{className:"banner-text",children:[r," — retrying (attempt ",n.attempt," of ",n.maxRetries,")…"]})]})}const BT='(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):(global=global||self,global.morphdom=factory())})(this,function(){"use strict";var DOCUMENT_FRAGMENT_NODE=11;function morphAttrs(fromNode,toNode){var toNodeAttrs=toNode.attributes;var attr;var attrName;var attrNamespaceURI;var attrValue;var fromValue;if(toNode.nodeType===DOCUMENT_FRAGMENT_NODE||fromNode.nodeType===DOCUMENT_FRAGMENT_NODE){return}for(var i=toNodeAttrs.length-1;i>=0;i--){attr=toNodeAttrs[i];attrName=attr.name;attrNamespaceURI=attr.namespaceURI;attrValue=attr.value;if(attrNamespaceURI){attrName=attr.localName||attrName;fromValue=fromNode.getAttributeNS(attrNamespaceURI,attrName);if(fromValue!==attrValue){if(attr.prefix==="xmlns"){attrName=attr.name}fromNode.setAttributeNS(attrNamespaceURI,attrName,attrValue)}}else{fromValue=fromNode.getAttribute(attrName);if(fromValue!==attrValue){fromNode.setAttribute(attrName,attrValue)}}}var fromNodeAttrs=fromNode.attributes;for(var d=fromNodeAttrs.length-1;d>=0;d--){attr=fromNodeAttrs[d];attrName=attr.name;attrNamespaceURI=attr.namespaceURI;if(attrNamespaceURI){attrName=attr.localName||attrName;if(!toNode.hasAttributeNS(attrNamespaceURI,attrName)){fromNode.removeAttributeNS(attrNamespaceURI,attrName)}}else{if(!toNode.hasAttribute(attrName)){fromNode.removeAttribute(attrName)}}}}var range;var NS_XHTML="http://www.w3.org/1999/xhtml";var doc=typeof document==="undefined"?undefined:document;var HAS_TEMPLATE_SUPPORT=!!doc&&"content"in doc.createElement("template");var HAS_RANGE_SUPPORT=!!doc&&doc.createRange&&"createContextualFragment"in doc.createRange();function createFragmentFromTemplate(str){var template=doc.createElement("template");template.innerHTML=str;return template.content.childNodes[0]}function createFragmentFromRange(str){if(!range){range=doc.createRange();range.selectNode(doc.body)}var fragment=range.createContextualFragment(str);return fragment.childNodes[0]}function createFragmentFromWrap(str){var fragment=doc.createElement("body");fragment.innerHTML=str;return fragment.childNodes[0]}function toElement(str){str=str.trim();if(HAS_TEMPLATE_SUPPORT){return createFragmentFromTemplate(str)}else if(HAS_RANGE_SUPPORT){return createFragmentFromRange(str)}return createFragmentFromWrap(str)}function compareNodeNames(fromEl,toEl){var fromNodeName=fromEl.nodeName;var toNodeName=toEl.nodeName;var fromCodeStart,toCodeStart;if(fromNodeName===toNodeName){return true}fromCodeStart=fromNodeName.charCodeAt(0);toCodeStart=toNodeName.charCodeAt(0);if(fromCodeStart<=90&&toCodeStart>=97){return fromNodeName===toNodeName.toUpperCase()}else if(toCodeStart<=90&&fromCodeStart>=97){return toNodeName===fromNodeName.toUpperCase()}else{return false}}function createElementNS(name,namespaceURI){return!namespaceURI||namespaceURI===NS_XHTML?doc.createElement(name):doc.createElementNS(namespaceURI,name)}function moveChildren(fromEl,toEl){var curChild=fromEl.firstChild;while(curChild){var nextChild=curChild.nextSibling;toEl.appendChild(curChild);curChild=nextChild}return toEl}function syncBooleanAttrProp(fromEl,toEl,name){if(fromEl[name]!==toEl[name]){fromEl[name]=toEl[name];if(fromEl[name]){fromEl.setAttribute(name,"")}else{fromEl.removeAttribute(name)}}}var specialElHandlers={OPTION:function(fromEl,toEl){var parentNode=fromEl.parentNode;if(parentNode){var parentName=parentNode.nodeName.toUpperCase();if(parentName==="OPTGROUP"){parentNode=parentNode.parentNode;parentName=parentNode&&parentNode.nodeName.toUpperCase()}if(parentName==="SELECT"&&!parentNode.hasAttribute("multiple")){if(fromEl.hasAttribute("selected")&&!toEl.selected){fromEl.setAttribute("selected","selected");fromEl.removeAttribute("selected")}parentNode.selectedIndex=-1}}syncBooleanAttrProp(fromEl,toEl,"selected")},INPUT:function(fromEl,toEl){syncBooleanAttrProp(fromEl,toEl,"checked");syncBooleanAttrProp(fromEl,toEl,"disabled");if(fromEl.value!==toEl.value){fromEl.value=toEl.value}if(!toEl.hasAttribute("value")){fromEl.removeAttribute("value")}},TEXTAREA:function(fromEl,toEl){var newValue=toEl.value;if(fromEl.value!==newValue){fromEl.value=newValue}var firstChild=fromEl.firstChild;if(firstChild){var oldValue=firstChild.nodeValue;if(oldValue==newValue||!newValue&&oldValue==fromEl.placeholder){return}firstChild.nodeValue=newValue}},SELECT:function(fromEl,toEl){if(!toEl.hasAttribute("multiple")){var selectedIndex=-1;var i=0;var curChild=fromEl.firstChild;var optgroup;var nodeName;while(curChild){nodeName=curChild.nodeName&&curChild.nodeName.toUpperCase();if(nodeName==="OPTGROUP"){optgroup=curChild;curChild=optgroup.firstChild;if(!curChild){curChild=optgroup.nextSibling;optgroup=null}}else{if(nodeName==="OPTION"){if(curChild.hasAttribute("selected")){selectedIndex=i;break}i++}curChild=curChild.nextSibling;if(!curChild&&optgroup){curChild=optgroup.nextSibling;optgroup=null}}}fromEl.selectedIndex=selectedIndex}}};var ELEMENT_NODE=1;var DOCUMENT_FRAGMENT_NODE$1=11;var TEXT_NODE=3;var COMMENT_NODE=8;function noop(){}function defaultGetNodeKey(node){if(node){return node.getAttribute&&node.getAttribute("id")||node.id}}function morphdomFactory(morphAttrs){return function morphdom(fromNode,toNode,options){if(!options){options={}}if(typeof toNode==="string"){if(fromNode.nodeName==="#document"||fromNode.nodeName==="HTML"){var toNodeHtml=toNode;toNode=doc.createElement("html");toNode.innerHTML=toNodeHtml}else if(fromNode.nodeName==="BODY"){var toNodeBody=toNode;toNode=doc.createElement("html");toNode.innerHTML=toNodeBody;var bodyElement=toNode.querySelector("body");if(bodyElement){toNode=bodyElement}}else{toNode=toElement(toNode)}}else if(toNode.nodeType===DOCUMENT_FRAGMENT_NODE$1){toNode=toNode.firstElementChild}var getNodeKey=options.getNodeKey||defaultGetNodeKey;var onBeforeNodeAdded=options.onBeforeNodeAdded||noop;var onNodeAdded=options.onNodeAdded||noop;var onBeforeElUpdated=options.onBeforeElUpdated||noop;var onElUpdated=options.onElUpdated||noop;var onBeforeNodeDiscarded=options.onBeforeNodeDiscarded||noop;var onNodeDiscarded=options.onNodeDiscarded||noop;var onBeforeElChildrenUpdated=options.onBeforeElChildrenUpdated||noop;var skipFromChildren=options.skipFromChildren||noop;var addChild=options.addChild||function(parent,child){return parent.appendChild(child)};var childrenOnly=options.childrenOnly===true;var fromNodesLookup=Object.create(null);var keyedRemovalList=[];function addKeyedRemoval(key){keyedRemovalList.push(key)}function walkDiscardedChildNodes(node,skipKeyedNodes){if(node.nodeType===ELEMENT_NODE){var curChild=node.firstChild;while(curChild){var key=undefined;if(skipKeyedNodes&&(key=getNodeKey(curChild))){addKeyedRemoval(key)}else{onNodeDiscarded(curChild);if(curChild.firstChild){walkDiscardedChildNodes(curChild,skipKeyedNodes)}}curChild=curChild.nextSibling}}}function removeNode(node,parentNode,skipKeyedNodes){if(onBeforeNodeDiscarded(node)===false){return}if(parentNode){parentNode.removeChild(node)}onNodeDiscarded(node);walkDiscardedChildNodes(node,skipKeyedNodes)}function indexTree(node){if(node.nodeType===ELEMENT_NODE||node.nodeType===DOCUMENT_FRAGMENT_NODE$1){var curChild=node.firstChild;while(curChild){var key=getNodeKey(curChild);if(key){fromNodesLookup[key]=curChild}indexTree(curChild);curChild=curChild.nextSibling}}}indexTree(fromNode);function handleNodeAdded(el){onNodeAdded(el);var curChild=el.firstChild;while(curChild){var nextSibling=curChild.nextSibling;var key=getNodeKey(curChild);if(key){var unmatchedFromEl=fromNodesLookup[key];if(unmatchedFromEl&&compareNodeNames(curChild,unmatchedFromEl)){curChild.parentNode.replaceChild(unmatchedFromEl,curChild);morphEl(unmatchedFromEl,curChild)}else{handleNodeAdded(curChild)}}else{handleNodeAdded(curChild)}curChild=nextSibling}}function cleanupFromEl(fromEl,curFromNodeChild,curFromNodeKey){while(curFromNodeChild){var fromNextSibling=curFromNodeChild.nextSibling;if(curFromNodeKey=getNodeKey(curFromNodeChild)){addKeyedRemoval(curFromNodeKey)}else{removeNode(curFromNodeChild,fromEl,true)}curFromNodeChild=fromNextSibling}}function morphEl(fromEl,toEl,childrenOnly){var toElKey=getNodeKey(toEl);if(toElKey){delete fromNodesLookup[toElKey]}if(!childrenOnly){var beforeUpdateResult=onBeforeElUpdated(fromEl,toEl);if(beforeUpdateResult===false){return}else if(beforeUpdateResult instanceof HTMLElement){fromEl=beforeUpdateResult;indexTree(fromEl)}morphAttrs(fromEl,toEl);onElUpdated(fromEl);if(onBeforeElChildrenUpdated(fromEl,toEl)===false){return}}if(fromEl.nodeName!=="TEXTAREA"){morphChildren(fromEl,toEl)}else{specialElHandlers.TEXTAREA(fromEl,toEl)}}function morphChildren(fromEl,toEl){var skipFrom=skipFromChildren(fromEl,toEl);var curToNodeChild=toEl.firstChild;var curFromNodeChild=fromEl.firstChild;var curToNodeKey;var curFromNodeKey;var fromNextSibling;var toNextSibling;var matchingFromEl;outer:while(curToNodeChild){toNextSibling=curToNodeChild.nextSibling;curToNodeKey=getNodeKey(curToNodeChild);while(!skipFrom&&curFromNodeChild){fromNextSibling=curFromNodeChild.nextSibling;if(curToNodeChild.isSameNode&&curToNodeChild.isSameNode(curFromNodeChild)){curToNodeChild=toNextSibling;curFromNodeChild=fromNextSibling;continue outer}curFromNodeKey=getNodeKey(curFromNodeChild);var curFromNodeType=curFromNodeChild.nodeType;var isCompatible=undefined;if(curFromNodeType===curToNodeChild.nodeType){if(curFromNodeType===ELEMENT_NODE){if(curToNodeKey){if(curToNodeKey!==curFromNodeKey){if(matchingFromEl=fromNodesLookup[curToNodeKey]){if(fromNextSibling===matchingFromEl){isCompatible=false}else{fromEl.insertBefore(matchingFromEl,curFromNodeChild);if(curFromNodeKey){addKeyedRemoval(curFromNodeKey)}else{removeNode(curFromNodeChild,fromEl,true)}curFromNodeChild=matchingFromEl;curFromNodeKey=getNodeKey(curFromNodeChild)}}else{isCompatible=false}}}else if(curFromNodeKey){isCompatible=false}isCompatible=isCompatible!==false&&compareNodeNames(curFromNodeChild,curToNodeChild);if(isCompatible){morphEl(curFromNodeChild,curToNodeChild)}}else if(curFromNodeType===TEXT_NODE||curFromNodeType==COMMENT_NODE){isCompatible=true;if(curFromNodeChild.nodeValue!==curToNodeChild.nodeValue){curFromNodeChild.nodeValue=curToNodeChild.nodeValue}}}if(isCompatible){curToNodeChild=toNextSibling;curFromNodeChild=fromNextSibling;continue outer}if(curFromNodeKey){addKeyedRemoval(curFromNodeKey)}else{removeNode(curFromNodeChild,fromEl,true)}curFromNodeChild=fromNextSibling}if(curToNodeKey&&(matchingFromEl=fromNodesLookup[curToNodeKey])&&compareNodeNames(matchingFromEl,curToNodeChild)){if(!skipFrom){addChild(fromEl,matchingFromEl)}morphEl(matchingFromEl,curToNodeChild)}else{var onBeforeNodeAddedResult=onBeforeNodeAdded(curToNodeChild);if(onBeforeNodeAddedResult!==false){if(onBeforeNodeAddedResult){curToNodeChild=onBeforeNodeAddedResult}if(curToNodeChild.actualize){curToNodeChild=curToNodeChild.actualize(fromEl.ownerDocument||doc)}addChild(fromEl,curToNodeChild);handleNodeAdded(curToNodeChild)}}curToNodeChild=toNextSibling;curFromNodeChild=fromNextSibling}cleanupFromEl(fromEl,curFromNodeChild,curFromNodeKey);var specialElHandler=specialElHandlers[fromEl.nodeName];if(specialElHandler){specialElHandler(fromEl,toEl)}}var morphedNode=fromNode;var morphedNodeType=morphedNode.nodeType;var toNodeType=toNode.nodeType;if(!childrenOnly){if(morphedNodeType===ELEMENT_NODE){if(toNodeType===ELEMENT_NODE){if(!compareNodeNames(fromNode,toNode)){onNodeDiscarded(fromNode);morphedNode=moveChildren(fromNode,createElementNS(toNode.nodeName,toNode.namespaceURI))}}else{morphedNode=toNode}}else if(morphedNodeType===TEXT_NODE||morphedNodeType===COMMENT_NODE){if(toNodeType===morphedNodeType){if(morphedNode.nodeValue!==toNode.nodeValue){morphedNode.nodeValue=toNode.nodeValue}return morphedNode}else{morphedNode=toNode}}}if(morphedNode===toNode){onNodeDiscarded(fromNode)}else{if(toNode.isSameNode&&toNode.isSameNode(morphedNode)){return}morphEl(morphedNode,toNode,childrenOnly);if(keyedRemovalList){for(var i=0,len=keyedRemovalList.length;i<len;i++){var elToRemove=fromNodesLookup[keyedRemovalList[i]];if(elToRemove){removeNode(elToRemove,elToRemove.parentNode,false)}}}}if(!childrenOnly&&morphedNode!==fromNode&&fromNode.parentNode){if(morphedNode.actualize){morphedNode=morphedNode.actualize(fromNode.ownerDocument||doc)}fromNode.parentNode.replaceChild(morphedNode,fromNode)}return morphedNode}}var morphdom=morphdomFactory(morphAttrs);return morphdom});',WT=["https://cdnjs.cloudflare.com","https://cdn.jsdelivr.net","https://unpkg.com","https://esm.sh"],Wy="agentpane-widget",Hy="agentpane-pane",Vy="allow-scripts allow-popups allow-popups-to-escape-sandbox",Ni=WT.join(" "),Ky=["default-src 'none'",`script-src 'unsafe-inline' 'unsafe-eval' ${Ni}`,`style-src 'unsafe-inline' ${Ni}`,`img-src data: blob: ${Ni}`,`font-src data: ${Ni}`,`connect-src ${Ni}`,"media-src data: blob:","frame-src 'none'","form-action 'none'","base-uri 'none'"].join("; ");function Gy(){const e=typeof document<"u"?getComputedStyle(document.documentElement):null,n=(r,o)=>(e==null?void 0:e.getPropertyValue(r).trim())||o;return{"--color-text-primary":n("--text","#1c1b18"),"--color-text-secondary":n("--text-2","#54504a"),"--color-text-muted":n("--text-3","#78736c"),"--color-background-primary":n("--canvas","#fdfdfc"),"--color-background-secondary":n("--surface-0","#f8f7f5"),"--color-border":n("--border","#e2e0db"),"--color-accent":n("--accent","#d97706"),"--font-sans":n("--font-sans","'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"),"--font-mono":n("--font-mono","'JetBrains Mono', 'SF Mono', 'Fira Code', monospace"),"--radius":n("--r-lg","8px"),"--color-series-1":"#2a78d6","--color-series-2":"#eb6834","--color-series-3":"#1baf7a","--color-series-4":"#eda100","--color-series-5":"#e87ba4","--color-series-6":"#008300","--color-series-7":"#6250d6","--color-series-8":"#e34948","--color-good":"#0ca30c","--color-warning":"#fab219","--color-serious":"#ec835a","--color-critical":"#d03b3b"}}const qy=`window.addEventListener('click', function (e) {
533
+ if (e.defaultPrevented || e.button !== 0) return;
534
+ var a = e.target && e.target.closest ? e.target.closest('a[href]') : null;
535
+ if (!a) return;
536
+ var href = (a.getAttribute('href') || '').trim();
537
+ if (href.charAt(0) === '#' || /^javascript:/i.test(href)) return;
538
+ e.preventDefault();
539
+ if (!/^https?:\\/\\//i.test(href)) return;
540
+ try {
541
+ window.open(new URL(href).href, '_blank', 'noopener,noreferrer');
542
+ } catch (err) {}
543
+ });`,HT=`(function () {
544
+ var SELF = '${Wy}';
545
+ var PANE = '${Hy}';
546
+ var SCRIPT_TIMEOUT_MS = 15000;
547
+ var root = document.getElementById('root');
548
+ var finished = false;
549
+ var lastHtml = null;
550
+
551
+ function post(msg) {
552
+ msg.source = SELF;
553
+ parent.postMessage(msg, '*');
554
+ }
555
+
556
+ function parse(html, keepScripts) {
557
+ var tmp = document.createElement('div');
558
+ tmp.innerHTML = html;
559
+ if (!keepScripts) {
560
+ var scripts = tmp.querySelectorAll('script');
561
+ for (var i = 0; i < scripts.length; i++) scripts[i].remove();
562
+ }
563
+ return tmp;
564
+ }
565
+
566
+ function morph(html, isFinal) {
567
+ var added = new Set();
568
+ morphdom(root, parse(html, isFinal), {
569
+ childrenOnly: true,
570
+ onBeforeElUpdated: function (from, to) { return !from.isEqualNode(to); },
571
+ onNodeAdded: function (node) {
572
+ added.add(node);
573
+ if (!isFinal && node.nodeType === 1 && node.animate && !added.has(node.parentNode)) {
574
+ node.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 220, easing: 'ease-out' });
575
+ }
576
+ return node;
577
+ },
578
+ });
579
+ }
580
+
581
+ // Scripts parsed by innerHTML never run; replace each with a fresh copy.
582
+ function runScripts(done) {
583
+ var scripts = Array.prototype.slice.call(root.querySelectorAll('script'));
584
+ var i = 0;
585
+ function next() {
586
+ if (i >= scripts.length) return done();
587
+ var old = scripts[i++];
588
+ var s = document.createElement('script');
589
+ for (var a = 0; a < old.attributes.length; a++) s.setAttribute(old.attributes[a].name, old.attributes[a].value);
590
+ s.text = old.textContent || '';
591
+ if (!old.src) {
592
+ old.replaceWith(s);
593
+ return next();
594
+ }
595
+ s.async = false;
596
+ var settled = false;
597
+ var timer = setTimeout(go, SCRIPT_TIMEOUT_MS);
598
+ function go() {
599
+ if (settled) return;
600
+ settled = true;
601
+ clearTimeout(timer);
602
+ next();
603
+ }
604
+ s.onload = go;
605
+ s.onerror = function () {
606
+ post({ type: 'error', message: 'Could not load ' + old.src });
607
+ go();
608
+ };
609
+ old.replaceWith(s);
610
+ }
611
+ next();
612
+ }
613
+
614
+ function finish() {
615
+ document.dispatchEvent(new Event('DOMContentLoaded', { bubbles: true }));
616
+ window.dispatchEvent(new Event('load'));
617
+ }
618
+
619
+ window.addEventListener('message', function (e) {
620
+ if (e.source !== parent) return;
621
+ var msg = e.data;
622
+ if (!msg || msg.source !== PANE || msg.type !== 'content' || finished) return;
623
+ var html = typeof msg.html === 'string' ? msg.html : '';
624
+ var isFinal = msg.final === true;
625
+ if (!isFinal && html === lastHtml) return;
626
+ lastHtml = html;
627
+ morph(html, isFinal);
628
+ if (isFinal) {
629
+ finished = true;
630
+ runScripts(finish);
631
+ }
632
+ });
633
+
634
+ window.addEventListener('error', function (e) {
635
+ var message = String(e.message || 'Script error');
636
+ // Benign: a layout change inside a ResizeObserver callback.
637
+ if (/ResizeObserver loop/.test(message)) return;
638
+ post({ type: 'error', message: message });
639
+ });
640
+
641
+ ${qy}
642
+
643
+ // The frame is as tall as the document's content: the bottom of the
644
+ // lowest in-flow child of <body> (#root, or what a script appended), plus
645
+ // the body's own padding, border and margin below it. Not the viewport or
646
+ // a box styled height: 100% — those follow the frame itself.
647
+ function px(style, prop) {
648
+ return parseFloat(style.getPropertyValue(prop)) || 0;
649
+ }
650
+ function contentHeight() {
651
+ var bottom = 0;
652
+ var children = document.body.children;
653
+ for (var i = 0; i < children.length; i++) {
654
+ var child = children[i];
655
+ if (child.tagName === 'SCRIPT') continue;
656
+ var style = getComputedStyle(child);
657
+ if (style.position === 'absolute' || style.position === 'fixed' || style.display === 'none') continue;
658
+ bottom = Math.max(bottom, child.getBoundingClientRect().bottom + px(style, 'margin-bottom'));
659
+ }
660
+ var body = getComputedStyle(document.body);
661
+ return bottom + window.scrollY + px(body, 'padding-bottom') + px(body, 'border-bottom-width') + px(body, 'margin-bottom');
662
+ }
663
+ var lastHeight = -1;
664
+ function reportHeight() {
665
+ var h = Math.ceil(contentHeight());
666
+ if (h === lastHeight) return;
667
+ lastHeight = h;
668
+ post({ type: 'height', height: h });
669
+ }
670
+ var sizes = new ResizeObserver(reportHeight);
671
+ sizes.observe(root);
672
+ sizes.observe(document.body);
673
+ // Elements a script adds next to #root count too.
674
+ new MutationObserver(function (records) {
675
+ for (var r = 0; r < records.length; r++) {
676
+ for (var n = 0; n < records[r].addedNodes.length; n++) {
677
+ if (records[r].addedNodes[n].nodeType === 1) sizes.observe(records[r].addedNodes[n]);
678
+ }
679
+ }
680
+ reportHeight();
681
+ }).observe(document.body, { childList: true });
682
+ reportHeight();
683
+ post({ type: 'ready' });
684
+ })();`;function $d(e){return`<script>${e.replace(/<\/script/gi,"<\\/script")}<\/script>`}function VT(){const e=Object.entries(Gy()).map(([n,r])=>`${n}: ${r};`).join(" ");return["<!DOCTYPE html>","<html><head>",'<meta charset="utf-8">',`<meta http-equiv="Content-Security-Policy" content="${Ky}">`,"<style>",`:root { ${e} color-scheme: light; }`,"html, body { margin: 0; padding: 0; background: transparent; overflow: hidden; }","body { font: 14px/1.5 var(--font-sans); color: var(--color-text-primary); -webkit-font-smoothing: antialiased; }","#root { position: relative; display: flow-root; }","*, *::before, *::after { box-sizing: border-box; }","</style>",$d(BT),'</head><body><div id="root"></div>',$d(HT),"</body></html>"].join(`
685
+ `)}let Ng=null;function KT(){return Ng??(Ng=VT()),Ng}const GT=4e3,qT=3,bo=new Map,XT=500;function YT(e,n){if(bo.delete(e),bo.set(e,n),bo.size>XT){const r=bo.keys().next().value;r!==void 0&&bo.delete(r)}}function QT({widgetId:e,title:n,html:r,final:o,onError:l}){const c=x.useRef(null),[d,f]=x.useState(()=>bo.get(e)??0),h=x.useRef({html:r,final:o});h.current={html:r,final:o};const m=x.useRef(l);m.current=l;const v=x.useRef(0),k=x.useRef(null),y=x.useCallback(()=>{var C;const S=(C=c.current)==null?void 0:C.contentWindow;if(!S||v.current===0||v.current>qT)return;const j=h.current,T=k.current;T&&(T.final||T.html===j.html&&T.final===j.final)||(k.current=j,S.postMessage({source:Hy,type:"content",html:j.html,final:j.final},"*"))},[]);return x.useEffect(()=>{function S(j){var b;const T=c.current;if(!T||j.source!==T.contentWindow)return;const C=j.data;if(!(!C||typeof C!="object"||C.source!==Wy))if(C.type==="ready")v.current+=1,k.current=null,y();else if(C.type==="height"&&typeof C.height=="number"&&Number.isFinite(C.height)){const A=Math.min(GT,Math.max(0,Math.ceil(C.height)));f(A),YT(e,A)}else C.type==="error"&&typeof C.message=="string"&&((b=m.current)==null||b.call(m,C.message.slice(0,500)))}return window.addEventListener("message",S),()=>window.removeEventListener("message",S)},[e,y]),x.useEffect(()=>{y()},[r,o,y]),a.jsx("iframe",{ref:c,className:"widget-frame",sandbox:Vy,srcDoc:KT(),title:n||"Widget",style:{height:`${d}px`}})}const ZT=720,JT=20;function Pd(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function eC(e,n){const r=Object.entries(Gy()).map(([o,l])=>`${o}: ${l};`).join(" ");return["<!DOCTYPE html>","<html><head>",'<meta charset="utf-8">',`<meta http-equiv="Content-Security-Policy" content="${Ky}">`,'<meta name="viewport" content="width=device-width, initial-scale=1">',`<title>${Pd(e||"Widget")}</title>`,"<style>",`:root { ${r} color-scheme: light; }`,"html { background: var(--color-background-primary); }","body { margin: 0; padding: 32px 24px; font: 14px/1.5 var(--font-sans); color: var(--color-text-primary); -webkit-font-smoothing: antialiased; }",`#root { position: relative; display: flow-root; max-width: ${ZT}px; margin: 0 auto; }`,"*, *::before, *::after { box-sizing: border-box; }","</style>",$d(qy),'</head><body><div id="root">',n,"</div></body></html>"].join(`
686
+ `)}function tC(e,n){const r=Pd(e||"Widget");return["<!DOCTYPE html>","<html><head>",'<meta charset="utf-8">','<meta name="viewport" content="width=device-width, initial-scale=1">',`<title>${r}</title>`,"<style>html, body { margin: 0; height: 100%; } iframe { display: block; width: 100%; height: 100%; border: 0; }</style>","</head><body>",`<iframe sandbox="${Vy}" title="${r}" srcdoc="${Pd(eC(e,n))}"></iframe>`,"</body></html>"].join(`
687
+ `)}const xo=new Map;function nC(e,n,r){const o=tC(n,r);let l=xo.get(e);l&&l.doc!==o&&(URL.revokeObjectURL(l.url),l=void 0),l??(l={doc:o,url:URL.createObjectURL(new Blob([o],{type:"text/html;charset=utf-8"}))}),xo.delete(e),xo.set(e,l);for(const[d,f]of xo){if(xo.size<=JT)break;URL.revokeObjectURL(f.url),xo.delete(d)}const c=window.open(l.url,"_blank");c&&(c.opener=null)}function sC({item:e}){const[n,r]=x.useState(null),o=e.data??{},l=typeof o.title=="string"?o.title.trim():"",c=typeof o.html=="string"?o.html:"",d=o.partial===!0,f=typeof o.error=="string"&&o.error?o.error:null,h=e.external_item_id??e.id;return a.jsxs("div",{className:"render-content widget-card",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(Z1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:l||"Visual"}),d&&a.jsx("span",{className:"turn-header-meta",children:"drawing…"}),f&&a.jsx("span",{className:"turn-header-meta",style:{color:"var(--red)"},children:"failed"}),!d&&c.trim()!==""&&a.jsx("button",{type:"button",className:"widget-open-btn",title:"Open in a new tab","aria-label":"Open in a new tab",onClick:()=>nC(h,l,c),children:a.jsx($v,{size:14})})]}),c.trim()?a.jsx(QT,{widgetId:h,title:l,html:c,final:!d,onError:r}):!f&&a.jsx("div",{className:"widget-placeholder",children:d?"Drawing…":"Nothing to show"}),f&&a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:f})}),n&&!f&&a.jsxs("div",{className:"widget-script-error",title:n,children:["Script error: ",n]})]})}function Vl(e){return`Message from ${(e==null?void 0:e.trim())||"another session"}`}function Nf(e){return(e??[]).filter(n=>n.task_type!=="local_agent").length}function Tf(e){switch(e){case"local_agent":return"subagent";case"local_bash":return"monitor";case"background_terminal":return"command";default:return"task"}}function Xy(e,n){switch(Tf(e)){case"subagent":return`Subagent${n?`: ${n}`:""}`;case"monitor":return"Monitor";case"command":return"Background command";default:return"Background Task"}}const rC={subagent:yr,monitor:Gv,command:tc,task:Ov};qe.setOptions({breaks:!0,gfm:!0});const oC=10,iC=100;function Yy({name:e,body:n}){return a.jsxs("div",{className:"render-content peer-message",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--purple)",color:"#fff"},children:a.jsx(Hv,{size:14})}),a.jsx("span",{className:"turn-header-title",children:Vl(e)})]}),a.jsx("p",{className:"user-message",children:n})]})}function aC({attachments:e}){const[n,r]=x.useState(null);return x.useEffect(()=>{if(!n)return;function o(l){l.key==="Escape"&&r(null)}return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[n]),!Array.isArray(e)||e.length===0?null:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"attachment-pills",children:e.map((o,l)=>{const c=o.media_type.startsWith("image/"),d=`data:${o.media_type};base64,${o.data}`;return a.jsxs("span",{className:"attachment-pill",title:o.name,onClick:c?()=>r(d):void 0,style:c?{cursor:"pointer"}:void 0,children:[c?a.jsx("img",{src:d,alt:o.name,className:"attachment-pill-thumb"}):a.jsx(Pv,{size:12,className:"attachment-pill-icon"}),a.jsx("span",{className:"attachment-pill-name",children:o.name})]},l)})}),n&&a.jsx("div",{className:"image-preview-modal",onClick:()=>r(null),children:a.jsxs("div",{className:"image-preview-content",onClick:o=>o.stopPropagation(),children:[a.jsx("img",{src:n,alt:"preview"}),a.jsx("button",{className:"image-preview-close",onClick:()=>r(null),children:a.jsx(Nn,{size:20})})]})})]})}function lC(e){const n=qe.parse(e);return bf.sanitize(n)}function Tg(e){var n;return(n=e.data)!=null&&n.text?e.data.text:""}function cC(e){const n=e.match(/^\/bin\/\w+\s+-\w+\s+"(.*)"$/s);return n?n[1]:e}const Cg='<script>(function(){function report(){var h=Math.max(document.documentElement.scrollHeight,document.body?document.body.scrollHeight:0);if(h>0)parent.postMessage(Math.ceil(h),"*");}window.addEventListener("load",report);new ResizeObserver(report).observe(document.documentElement);report();})();<\/script>';function uC(e){return/<\/body>/i.test(e)?e.replace(/<\/body>/i,`${Cg}</body>`):e+Cg}function dC({html:e}){const[n,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:uC(e),title:"HTML content",style:{width:"100%",height:`${n}px`,border:"1px solid var(--border)",borderRadius:"var(--r-md)",background:"#fff",marginTop:"8px"}})}const Eg=1e4;function fC({item:e,runtimeType:n,turn:r,threads:o}){var f,h,m,v,k,y,S,j,T,C;const l=e.status==="in_progress",[c,d]=x.useState(!1);switch(e.type){case"agent_message":{const{iconClass:b,iconText:A}=Nd(n??"codex");return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:`turn-header-icon ${b}`,children:A}),a.jsx("span",{className:"turn-header-title",children:"Agent"}),l&&a.jsx("span",{className:"turn-header-meta",children:"writing…"})]}),a.jsx(kg,{itemId:e.id,turnId:r.id,sessionId:r.session_id,content:Tg(e)||"…",threads:o,runtimeType:n})]})}case"reasoning":return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(b1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Reasoning"})]}),a.jsx("div",{dangerouslySetInnerHTML:{__html:lC(Tg(e))}})]});case"command_execution":{const b=e.data||{},A=cC(b.command||""),$=b.aggregated_output||"",P=b.exit_code,z=l?"running…":P!==null?`exit ${P}`:"",G=$.length>Eg,M=G&&!c?$.slice(0,Eg)+`
688
+ … (truncated, click to expand)`:$;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(tc,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Command"}),z&&a.jsx("span",{className:"turn-header-meta",children:z})]}),a.jsx("pre",{className:"cmd-block",children:a.jsx("code",{children:A})}),$&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"cmd-output",children:a.jsx("code",{children:M})}),G&&a.jsx("button",{className:"cmd-output-toggle",onClick:()=>d(F=>!F),children:c?"Show less":`Show full output (${($.length/1024).toFixed(0)}KB)`})]})]})}case"file_change":{const b=(f=e.data)==null?void 0:f.changes,A=Array.isArray(b)?b:[],$=`${A.length} file${A.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(R1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"File Changes"}),a.jsx("span",{className:"turn-header-meta",children:$})]}),a.jsx("div",{className:"file-change-list",children:A.map((P,z)=>{const G=P.kind==="add"?"A":P.kind==="delete"?"D":"M",M=P.kind==="add"?"fc-add":P.kind==="delete"?"fc-del":"fc-mod";return a.jsxs("div",{className:"file-change",children:[a.jsx("span",{className:`fc-status ${M}`,children:G}),a.jsx("span",{className:"fc-name",children:P.path})]},z)})})]})}case"mcp_tool_call":{const b=e.data||{},A=b.tool||"mcp";if(A==="Agent"){const Q=b.arguments,J=(Q==null?void 0:Q.description)||(Q==null?void 0:Q.prompt)||"Subagent",he=e.status==="failed",ke=l?"running…":he?"failed":"done";return a.jsxs("div",{className:"agent-call-card",children:[a.jsx("span",{className:"agent-call-icon",children:a.jsx(yr,{size:14})}),a.jsx("span",{className:"agent-call-desc",children:J}),a.jsx("span",{className:`agent-call-status ${l?"running":he?"failed":"done"}`,children:ke})]})}const $=b.server||"",P=b.arguments,z=b.result,G=b.error,M=e.status==="failed"||!!G,F=l?"running…":M?"failed":"done",Z=((h=z==null?void 0:z.content)==null?void 0:h.filter(Q=>Q.type==="text").map(Q=>Q.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(X1,{size:14})}),a.jsxs("span",{className:"turn-header-title",children:["MCP: ",A]}),$&&a.jsx("span",{className:"turn-header-meta",children:$}),a.jsx("span",{className:"turn-header-meta",style:M?{color:"var(--red)"}:void 0,children:F})]}),P&&Object.keys(P).length>0&&a.jsx("div",{className:"mcp-args",children:Object.entries(P).map(([Q,J])=>a.jsxs("div",{className:"mcp-arg",children:[a.jsx("span",{className:"mcp-arg-key",children:Q}),Q==="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)})]},Q))}),Z.length>0&&Z.map((Q,J)=>a.jsx("pre",{className:"cmd-output",children:a.jsx("code",{children:Q})},J)),G&&a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:G})})]})}case"web_search":{const b=((m=e.data)==null?void 0:m.query)||"";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(Q1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Web Search"})]}),a.jsx("p",{className:"user-message",children:b})]})}case"todo_list":{const b=((v=e.data)==null?void 0:v.items)||[];return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(P1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Todo List"})]}),a.jsx("ul",{className:"todo-list",children:b.map((A,$)=>a.jsxs("li",{className:A.completed?"todo-done":"todo-pending",children:[A.completed?a.jsx(_s,{size:14}):a.jsx(xr,{size:14})," ",A.text]},$))})]})}case"ask_user":return a.jsx(bg,{item:e,turn:r});case"final_result":{const b=e.data??{},A=b.text||"",$=b.html||null,P=Array.isArray(b.groups)?b.groups.filter(M=>!!M&&Array.isArray(M.selections)&&M.selections.length>0):[],{iconClass:z,iconText:G}=Nd(n??"codex");return a.jsxs(a.Fragment,{children:[(A||$)&&a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:`turn-header-icon ${z}`,children:G}),a.jsx("span",{className:"turn-header-title",children:"Agent"})]}),A&&a.jsx(kg,{itemId:e.id,turnId:r.id,sessionId:r.session_id,content:A,threads:o,runtimeType:n}),$&&a.jsx(dC,{html:$})]}),P.length>0&&a.jsx(bg,{item:e,turn:r})]})}case"background_task":{const b=e.data||{},A=b.task_type||"unknown",$=b.subagent_type||null,P=b.description||"",z=b.status||"running",G=b.last_tool_name||null,M=b.token_count||null,F=rC[Tf(A)],Z=Xy(A,$),Q=z==="running"?"running…":z==="completed"?"done":z==="failed"?"failed":z==="stopped"?"stopped":z,J=e.status==="failed"||z==="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(F,{size:14})}),a.jsx("span",{className:"turn-header-title",children:Z}),a.jsx("span",{className:"turn-header-meta",style:J?{color:"var(--red)"}:void 0,children:Q})]}),P&&a.jsx("p",{className:"user-message",style:{fontSize:"13px"},children:P}),G&&l&&a.jsxs("div",{className:"cmd-output",style:{color:"var(--text-3)",fontSize:"12px"},children:["last tool: ",G,M!=null&&` · ${M.toLocaleString()} tokens`]}),a.jsx("div",{className:"cmd-output",style:{color:"var(--text-muted)",fontSize:"11px"},children:"Output available in Tasks panel — click the status bar indicator or the Tasks tab."})]})}case"context_compaction":{const b=((k=e.data)==null?void 0:k.trigger)??"auto",A=typeof((y=e.data)==null?void 0:y.pre_tokens)=="number"?e.data.pre_tokens:null,$=typeof((S=e.data)==null?void 0:S.post_tokens)=="number"?e.data.post_tokens:null,P=b==="manual"?"Context compacted (/compact)":"Context auto-compacted",z=A!==null&&$!==null?`${A.toLocaleString()} → ${$.toLocaleString()} tokens (${A>0?Math.round((1-$/A)*100):0}% reduction)`:A!==null?`${A.toLocaleString()} tokens before`:$!==null?`${$.toLocaleString()} tokens after`:null;return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(B1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:P})]}),z&&a.jsx("div",{className:"cmd-output",style:{color:"var(--text-3)"},children:z})]})}case"interruption":return a.jsx(PT,{item:e});case"peer_message":return a.jsx(Yy,{name:(j=e.data)==null?void 0:j.name,body:((T=e.data)==null?void 0:T.body)??""});case"widget":return a.jsx(sC,{item:e});case"error":{const b=((C=e.data)==null?void 0:C.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(ec,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Error"})]}),a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:b})})]})}default:return null}}const zr=x.memo(fC,(e,n)=>e.item===n.item&&e.runtimeType===n.runtimeType&&e.threads===n.threads&&e.turn.id===n.turn.id);function pC(e){return e.type==="widget"?`widget-${e.external_item_id??e.id}`:e.id}function hC({turn:e,runtimeType:n,threads:r=[]}){zt.trackRender("TurnContent");const[o,l]=x.useState(!1),[c,d]=x.useState(!1),[f,h]=x.useState(!1),[m,v]=x.useState(!1),k=R(U=>U.loadDeferredItems),y=e.items.some(U=>U.type==="background_task"&&U.status==="in_progress");x.useEffect(()=>{e.status==="running"||e.status==="pending"?l(!0):e.status==="completed"&&!y&&l(!1)},[e.status,y]);const S=e.deferred_item_count??0,j=Ws(e),T=x.useRef(j);x.useEffect(()=>{const U=T.current&&!j&&e.status==="completed"&&!y;if(T.current=j,U||!o||S===0||m||j&&!c)return;let me=!1;return k(e.session_id,e.id).then(Y=>{!Y&&!me&&v(!0)}),()=>{me=!0}},[o,S,m,j,c,e.status,y,k,e.session_id,e.id]);let C=-1;for(let U=e.items.length-1;U>=0;U--)if(e.items[U].type==="agent_message"){C=U;break}const b=C>=0,A=b?e.items.slice(0,C):e.items,$=e.items.some(U=>U.type==="final_result"||U.type==="ask_user"),P=!b&&e.status==="completed"&&e.agent_response&&!$?{id:`response-${e.id}`,turn_id:e.id,external_item_id:`response-${e.id}`,type:"agent_message",data:{text:e.agent_response},status:"completed",created_at:e.created_at,updated_at:e.updated_at}:null,z=A.filter(U=>{var me;return!(U.type==="reasoning"&&(!((me=U.data)!=null&&me.text)||U.data.text===""))}),G=e.items.some(U=>{var me;return U.type==="interruption"&&((me=U.data)==null?void 0:me.reason)==="auth"}),M=e.items.some(U=>{var me;return U.type==="interruption"&&((me=U.data)==null?void 0:me.reason)==="usage_limit"}),F=z.filter(U=>{var me,Y;return!(U.type==="background_task"||U.type==="ask_user"||U.type==="final_result"||U.type==="widget"||U.type==="context_compaction"||U.type==="peer_message"||G&&U.type==="error"&&((me=U.data)==null?void 0:me.error)==="authentication_failed"||M&&U.type==="error"&&((Y=U.data)==null?void 0:Y.error)==="rate_limit")}),Z=c?0:Math.max(0,F.length-iC),Q=Z>0?F.slice(Z):F,J=[];let he=null;for(const U of Q)U.type==="agent_message"?(he&&J.push(he),he={agentMessage:U,toolItems:[],otherItems:[]}):U.type==="interruption"||U.type==="error"?(he&&J.push(he),J.push({agentMessage:null,toolItems:[],otherItems:[U]}),he=null):(he||(he={agentMessage:null,toolItems:[],otherItems:[]}),xg(U)?he.toolItems.push(U):he.otherItems.push(U));he&&J.push(he);const ke=e.status==="running"||e.status==="pending",re=U=>{var me;return U.type==="widget"&&(ke||((me=U.data)==null?void 0:me.partial)!==!0)},ve=b?e.items[C]:P,le=[...A.filter(U=>re(U)||U.type==="context_compaction"||U.type==="peer_message"),...ve?[ve]:[],...b?e.items.slice(C+1).filter(U=>U.type!=="ask_user"&&U.type!=="background_task"&&U.type!=="final_result"&&(U.type!=="widget"||re(U))):[]],ee=e.items.filter(U=>U.type==="background_task"),X=f?0:Math.max(0,ee.length-oC),ie=X>0?ee.slice(X):ee,K=F.filter(U=>xg(U)).length+(e.deferred_tool_calls??0),E=K>0||j&&(F.length>0||S>0),L=e.status==="pending"&&e.resume_state==="waiting",de=e.resume_state==="gave_up"||e.resume_state==="skipped"||e.resume_state==="unsupported";return a.jsxs("div",{className:"turn-group",children:[e.origin==="peer"?a.jsx(Yy,{name:e.origin_name,body:e.user_prompt}):a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--amber)",color:"#fff"},children:"U"}),a.jsx("span",{className:"turn-header-title",children:"You"})]}),a.jsx("p",{className:"user-message",children:e.user_prompt}),Array.isArray(e.attachments)&&e.attachments.length>0&&a.jsx(aC,{attachments:e.attachments})]}),E&&a.jsxs("div",{className:"tool-calls",children:[a.jsxs("div",{className:"tool-calls-header",onClick:()=>l(U=>!U),children:[a.jsx("span",{className:"tool-calls-icon",children:a.jsx(L1,{size:12})}),a.jsx("span",{className:"tool-calls-summary",children:K>0?`${K} tool call${K>1?"s":""}`:L?"interrupted":"thinking…"}),a.jsx($i,{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"}):j&&!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||j)&&a.jsxs(a.Fragment,{children:[S===0&&Z>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>d(!0),children:["Show ",Z," earlier step",Z>1?"s":""]})}),J.map((U,me)=>a.jsxs("div",{className:"intermediate-segment",children:[U.agentMessage&&a.jsx(zr,{item:U.agentMessage,runtimeType:n,turn:e,threads:r}),U.otherItems.map(Y=>a.jsx(zr,{item:Y,runtimeType:n,turn:e,threads:r},Y.id)),U.toolItems.length>0&&a.jsx(NT,{items:U.toolItems,runtimeType:n,turn:e,threads:r})]},me))]})]})]}),X>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>h(!0),children:["Show ",X," earlier background task",X>1?"s":""]})}),ie.map(U=>a.jsx(zr,{item:U,runtimeType:n,turn:e,threads:r},`task-${U.id}`)),le.map(U=>a.jsx(zr,{item:U,runtimeType:n,turn:e,threads:r},pC(U))),e.items.filter(U=>U.type==="final_result").map(U=>a.jsx(zr,{item:U,runtimeType:n,turn:e,threads:r},`final-${U.id}`)),e.items.filter(U=>U.type==="ask_user").map(U=>a.jsx(zr,{item:U,runtimeType:n,turn:e,threads:r},`ask-${U.id}`)),e.items.length===0&&!e.error&&(e.status==="pending"||e.status==="running")&&a.jsx("div",{className:"render-content",children:a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:e.status==="running"?"Agent is thinking…":"Waiting to start…"})}),e.error&&!de&&a.jsx("div",{className:"render-content",children:a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:e.error})})}),e.status==="running"&&a.jsx(UT,{turnId:e.id}),a.jsx(FT,{turn:e}),e.status==="aborted"&&a.jsxs("div",{className:"aborted-banner",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(xr,{size:12})}),a.jsx("span",{className:"banner-text",children:"Turn stopped — work generated so far is kept."})]})]})}const mC=x.memo(hC),gC=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.userAgent)?"⌘K":"Ctrl+K";function vC(){const e=R(b=>b.workspaces),n=R(b=>b.loadPickerSupport),r=R(b=>b.pickAndAddWorkspace),o=R(b=>b.createSessionInWorkspace),l=R(b=>b.setImportSessionsWorkspace);x.useEffect(()=>{n()},[n]);const c=e.filter(b=>b.deleted===0),[d,f]=x.useState(null),h=c.find(b=>b.path===d)??c[c.length-1]??null,m=(h==null?void 0:h.path)??null,[v,k]=x.useState(null);x.useEffect(()=>{if(!m)return;let b=!1;return Sv(m).then(({sessions:A})=>{b||k({path:m,runtimes:A.map($=>$.runtime)})}),()=>{b=!0}},[m]);const y=v&&v.path===m?v.runtimes:[],S=y.length,[j,T]=x.useState(!1);async function C(b){T(!0);try{await o(b)}finally{T(!1)}}return a.jsx("div",{className:"render-scroll welcome-scroll",children:a.jsxs("main",{className:"welcome","aria-labelledby":"welcome-title",children:[a.jsx("h1",{className:"welcome-title",id:"welcome-title",children:"Welcome to Repoburg"}),a.jsx("p",{className:"welcome-lead",children:"Run Claude Code and Codex agents on your projects, side by side. Each session works in a workspace: one of your project folders."}),a.jsxs("ol",{className:"welcome-steps",children:[a.jsxs("li",{className:`welcome-step${h?" done":" current"}`,children:[a.jsx("span",{className:"welcome-step-mark","aria-hidden":"true",children:h?a.jsx(_s,{size:13}):"1"}),a.jsxs("div",{className:"welcome-step-body",children:[a.jsx("h2",{className:"welcome-step-title",children:"Add a workspace"}),h?a.jsx("p",{className:"welcome-step-text",children:a.jsx("code",{title:h.path,children:h.path})}):a.jsxs("button",{className:"dialog-btn-create welcome-primary",onClick:()=>void r(),children:[a.jsx(I1,{size:14})," Open folder…"]})]})]}),a.jsxs("li",{className:`welcome-step${h?" current":" upcoming"}`,children:[a.jsx("span",{className:"welcome-step-mark","aria-hidden":"true",children:"2"}),a.jsxs("div",{className:"welcome-step-body",children:[a.jsx("h2",{className:"welcome-step-title",children:"Start your first session"}),h&&m?a.jsxs(a.Fragment,{children:[c.length>1&&a.jsxs("label",{className:"welcome-step-text welcome-target",children:["In",a.jsx("select",{className:"dialog-input dialog-select",value:m,onChange:b=>f(b.target.value),children:c.map(b=>a.jsx("option",{value:b.path,children:b.label||b.path},b.id))})]}),a.jsxs("div",{className:"welcome-actions",children:[a.jsxs("button",{className:"dialog-btn-create welcome-primary",disabled:j,onClick:()=>void C(m),children:[a.jsx(mr,{size:14})," New session"]}),S>0&&a.jsxs("button",{className:"dialog-btn-cancel",onClick:()=>l(m),children:[a.jsx(Uv,{size:14})," Import ",kv(y)]})]}),S>0&&a.jsxs("p",{className:"welcome-step-text",children:["Sessions you started with ",a.jsx("code",{children:"claude"})," or ",a.jsx("code",{children:"codex"})," in this folder continue right where they left off."]})]}):a.jsx("p",{className:"welcome-step-text",children:"Then start an agent session in it."})]})]})]}),a.jsxs("p",{className:"welcome-tip",children:["Later: right-click a workspace to import its Claude Code and Codex sessions, and press"," ",a.jsx("kbd",{children:gC})," for the command palette."]})]})})}const yC=[],ul=50;function xC(){zt.trackRender("RenderArea");const e=R(S=>S.activeSessionId),n=R(S=>S.activeSessionId?S.sessionDetails[S.activeSessionId]:null),r=R(S=>S.submittingPrompt),o=R(S=>S.loading),l=R(S=>!S.activeSessionId&&!eN(S.workspaces,S.sessions,S.appsRootPath)),c=(n==null?void 0:n.turns)??[],d=(n==null?void 0:n.threads)??yC,f=x.useRef(null),[h,m]=x.useState(ul);x.useEffect(()=>{m(ul)},[e]);const v=c.filter(S=>!S.thread_id),k=Math.max(0,v.length-h),y=v.slice(k);return x.useEffect(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},[e,c.length]),o&&!n?a.jsx("div",{className:"render-scroll",children:a.jsxs("div",{className:"skeleton-bars",children:[a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"})]})}):n?a.jsxs("div",{className:"render-scroll",ref:f,children:[r&&a.jsx("div",{className:"turn-block",children:a.jsxs("div",{className:"turn-group",children:[a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--amber)",color:"#fff"},children:"U"}),a.jsx("span",{className:"turn-header-title",children:"You"})]}),a.jsx("p",{className:"user-message",children:r})]}),a.jsx("div",{className:"render-content",children:a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:"Sending…"})})]})}),c.length===0&&!r&&a.jsx("div",{className:"empty-state",children:"No turns yet. Send a message below to start."}),k>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>m(S=>S+ul),children:["Show ",Math.min(ul,k)," earlier turns (",k," hidden)"]})}),y.map((S,j)=>a.jsx("div",{id:`turn-${k+j}`,className:"turn-block",children:a.jsx(mC,{turn:S,runtimeType:n.runtime_type,threads:d})},S.id))]}):l?a.jsx(vC,{}):a.jsx("div",{className:"render-scroll",children:a.jsx("div",{className:"empty-state",children:"No session selected"})})}const wC=x.memo(xC),kC=[{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 SC(e){return e.map(n=>({id:n.name,label:`/${n.name}`,hint:n.description,capability:null,insertAsText:!0}))}function bC(e,n,r=[]){const o=[...kC,...SC(r)],l=new Set;return o.filter(c=>!(l.has(c.label)||(l.add(c.label),c.capability&&!n[c.capability])||e&&!c.label.toLowerCase().includes(e.toLowerCase())))}function NC({commands:e,selectedIndex:n,onSelect:r,onHover:o}){return a.jsxs("div",{className:"slash-popup",children:[a.jsx("div",{className:"slash-popup-header",children:"Commands"}),e.length===0&&a.jsx("div",{className:"slash-popup-empty",children:"No matching commands"}),e.map((l,c)=>a.jsxs("div",{className:`slash-popup-item ${c===n?"selected":""}`,onMouseEnter:()=>o(c),onClick:()=>r(l),children:[a.jsx("span",{className:"slash-popup-label",children:l.label}),a.jsx("span",{className:"slash-popup-hint",children:l.hint})]},l.id))]})}function pd({title:e,options:n,currentValue:r,onSelect:o,onClose:l}){return a.jsxs("div",{className:"slash-popup",children:[a.jsxs("div",{className:"slash-popup-header",children:[a.jsx("button",{className:"slash-popup-back",onClick:l,children:"← Back"}),a.jsx("span",{children:e})]}),n.map(c=>a.jsxs("div",{className:`slash-popup-item ${c.value===r?"selected":""}`,onClick:()=>o(c.value),children:[a.jsxs("div",{className:"slash-popup-item-main",children:[a.jsx("span",{className:"slash-popup-label",children:c.label}),c.description&&a.jsx("span",{className:"slash-popup-hint",children:c.description})]}),c.value===r&&a.jsx("span",{className:"slash-popup-check",children:"✓"})]},c.value))]})}function TC(e){return Nt("/skills")}function CC({filter:e,onSelect:n,onClose:r}){const[o,l]=x.useState([]),[c,d]=x.useState(!0),[f,h]=x.useState(0),m=x.useRef(null);x.useEffect(()=>{TC().then(l).catch(()=>l([])).finally(()=>d(!1))},[]);const v=o.filter(k=>k.name.toLowerCase().includes(e.toLowerCase())||k.description.toLowerCase().includes(e.toLowerCase()));return x.useEffect(()=>{h(0)},[e]),x.useEffect(()=>{function k(y){y.key==="ArrowDown"?(y.preventDefault(),h(S=>Math.min(S+1,v.length-1))):y.key==="ArrowUp"?(y.preventDefault(),h(S=>Math.max(S-1,0))):y.key==="Enter"?(y.preventDefault(),v[f]&&n(v[f])):y.key==="Escape"&&(y.preventDefault(),r())}return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[v,f,n,r]),a.jsxs("div",{className:"slash-popup",ref:m,children:[a.jsxs("div",{className:"slash-popup-header",children:[a.jsx("button",{className:"slash-popup-back",onClick:r,children:"← Back"}),a.jsx("span",{children:"Skills"})]}),c&&a.jsx("div",{className:"slash-popup-empty",children:"Loading skills…"}),!c&&v.length===0&&a.jsx("div",{className:"slash-popup-empty",children:"No matching skills"}),v.map((k,y)=>a.jsxs("div",{className:`slash-popup-item ${y===f?"selected":""}`,onMouseEnter:()=>h(y),onClick:()=>n(k),children:[a.jsxs("div",{className:"slash-popup-item-main",children:[a.jsx("span",{className:"slash-popup-label",children:k.name}),k.description&&a.jsx("span",{className:"slash-popup-hint",children:k.description})]}),!!k.metadata.isSystem&&a.jsx("span",{className:"slash-popup-hint",children:"system"})]},k.id))]})}function Qy(){return Nt("/providers")}function EC(e,n){const r=n?`?cwd=${encodeURIComponent(n)}`:"";return Nt(`/providers/${e}/commands${r}`)}const jC={dynamicModels:!1,skills:!1,plugins:!1,mcpServers:!1,imageAttachments:!1,sandbox:!1,webSearch:!1,networkAccess:!1,fileReferences:!1};function _C(e){const[n,r]=x.useState([]),[o,l]=x.useState(!0);x.useEffect(()=>{Qy().then(r).catch(()=>r([])).finally(()=>l(!1))},[]);const c=n.find(d=>d.id===e)??null;return{provider:c,capabilities:(c==null?void 0:c.capabilities)??jC,loading:o}}const wo=32,hd=200;function jg(e){if(!e)return{};try{return JSON.parse(e)}catch{return{}}}function _g(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}let Rg=0;function RC(){return Rg+=1,`att-${Date.now()}-${Rg}`}function AC(){zt.trackRender("CommandInputBar");const[e,n]=x.useState(""),r=x.useRef(null),o=x.useRef(wo),l=x.useRef(null),{submitPrompt:c,cancelTurn:d,updateRuntimeConfig:f,setShowModelSelector:h}=R(),m=R(q=>q.activeSessionId),v=R(q=>q.activeSessionId?q.sessionDetails[q.activeSessionId]:null),k=R(q=>q.quotedText),y=hv(v),S=!!(v!=null&&v.turns.some(q=>q.status==="pending"&&q.resume_state==="waiting")),j=!m,{capabilities:T}=_C(v==null?void 0:v.runtime_type),C=(v==null?void 0:v.runtime_type)??null,b=T.imageAttachments,[A,$]=x.useState([]),[P,z]=x.useState(!1),[G,M]=x.useState(null),[F,Z]=x.useState([]);x.useEffect(()=>{if(!C){Z([]);return}let q=!1;return EC(C,(v==null?void 0:v.cwd)??void 0).then(Se=>{q||Z(Se)}).catch(()=>{q||Z([])}),()=>{q=!0}},[C,v==null?void 0:v.cwd]);const[Q,J]=x.useState(!1),[he,ke]=x.useState(""),[re,ve]=x.useState(0),[le,ee]=x.useState(void 0),[X,ie]=x.useState(!1),[K,E]=x.useState(""),[L,de]=x.useState([]),U=Q?bC(he,T,F):[];x.useEffect(()=>{k!==null&&(n(q=>q+k),setTimeout(()=>{if(r.current){pe(),r.current.focus();const q=r.current.value.length;r.current.setSelectionRange(q,q)}},0),R.setState({quotedText:null}))},[k]),x.useEffect(()=>{if(!y)return;function q(Se){Se.key==="Escape"&&(Se.preventDefault(),d())}return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[y,d]),x.useEffect(()=>{J(!1),ee(void 0),ie(!1),de([]),$(q=>{for(const Se of q)Se.previewUrl&&URL.revokeObjectURL(Se.previewUrl);return[]})},[m]),x.useEffect(()=>{if(!G)return;function q(Se){Se.key==="Escape"&&(Se.preventDefault(),M(null))}return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[G]);const me=x.useCallback(q=>{if(!q)return;const Se=Array.from(q);for(const Pe of Se){const Ye=new FileReader;Ye.onload=()=>{const wt=Ye.result.split(",")[1]??"",Dt=Pe.type.startsWith("image/")?URL.createObjectURL(Pe):void 0;$(un=>[...un,{id:RC(),name:Pe.name,media_type:Pe.type||"application/octet-stream",data:wt,previewUrl:Dt,size:Pe.size}])},Ye.readAsDataURL(Pe)}},[]),Y=x.useCallback(q=>{$(Se=>{const Pe=Se.find(Ye=>Ye.id===q);return Pe!=null&&Pe.previewUrl&&URL.revokeObjectURL(Pe.previewUrl),Se.filter(Ye=>Ye.id!==q)})},[]),xe=x.useCallback(q=>{q.preventDefault(),q.stopPropagation(),!(!b||y)&&z(!0)},[b,y]),we=x.useCallback(q=>{q.preventDefault(),q.stopPropagation(),z(!1)},[]),Me=x.useCallback(q=>{q.preventDefault(),q.stopPropagation(),z(!1),!(!b||y)&&me(q.dataTransfer.files)},[b,y,me]),_e=x.useCallback(q=>{var Ye;if(!b)return;const Se=(Ye=q.clipboardData)==null?void 0:Ye.items;if(!Se)return;const Pe=[];for(let xt=0;xt<Se.length;xt++){const wt=Se[xt];if(wt.type.startsWith("image/")){const Dt=wt.getAsFile();Dt&&Pe.push(Dt)}}Pe.length>0&&(q.preventDefault(),me(Pe))},[b,me]);function ge(q){const Se=r.current;Se&&(Se.style.height=`${q}px`,o.current=q)}function pe(){const q=r.current;if(q){if(q.scrollHeight>q.clientHeight){const Se=Math.min(q.scrollHeight,hd);Se!==o.current&&ge(Se);return}o.current>wo&&(q.style.height="auto",ge(Math.min(q.scrollHeight,hd)))}}function Xe(){const q=e.trim();if(!q||y)return;let Se=q;L.length>0&&(Se=`${L.map(xt=>`$${xt.name}`).join(" ")}
689
+
690
+ ${q}`);const Pe=A.map(({id:Ye,previewUrl:xt,size:wt,...Dt})=>Dt);n(""),de([]),ge(wo),J(!1),ee(void 0),ie(!1);for(const Ye of A)Ye.previewUrl&&URL.revokeObjectURL(Ye.previewUrl);$([]),c(Se,Pe.length>0?Pe:void 0)}function Re(q){if(q.insertAsText){const Se=`/${q.id} `;n(Se),J(!1),ee(void 0),requestAnimationFrame(()=>{if(r.current){r.current.focus();const Pe=Se.length;r.current.setSelectionRange(Pe,Pe),pe()}});return}q.subPopup?ee(q.subPopup):q.id==="skills"?(ie(!0),E(""),J(!1),n("")):q.id==="model"?(h(!0),J(!1),n("")):(J(!1),n(""))}function at(q){de(Se=>[...Se,q]),ie(!1),n(""),ge(wo)}function He(q){const Se=jg(v==null?void 0:v.runtime_config);le==="sandbox"?Se.sandboxMode=q:le==="websearch"?Se.webSearchMode=q:le==="network"&&(Se.networkAccessEnabled=q==="true"),f(Se),ee(void 0),J(!1),n(""),ge(wo)}function Te(q){if(zt.markKeystroke(),Q&&!le){if(q.key==="ArrowDown"){q.preventDefault(),ve(Se=>Math.min(Se+1,U.length-1));return}if(q.key==="ArrowUp"){q.preventDefault(),ve(Se=>Math.max(Se-1,0));return}if(q.key==="Enter"){q.preventDefault(),U[re]&&Re(U[re]);return}if(q.key==="Escape"){q.preventDefault(),J(!1),n("");return}}if(le&&q.key==="Escape"){q.preventDefault(),ee(void 0);return}if(q.key==="Enter"&&(q.metaKey||q.ctrlKey)&&!y){q.preventDefault(),Xe();return}q.key==="Escape"&&y&&(q.preventDefault(),d())}function Ue(q){zt.markInputChange();const Se=q.target.value;n(Se),pe(),Se.startsWith("/")&&!Se.includes(" ")&&!y?(J(!0),ke(Se.slice(1)),ve(0)):(J(!1),ee(void 0)),Se.startsWith("$")&&!y?(ie(!0),E(Se.slice(1))):Se.startsWith("$")||ie(!1)}const Ke=jg(v==null?void 0:v.runtime_config),lt=[{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"}],Tt=[{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"}],Wt=[{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${P?" drag-over":""}`,onDragOver:xe,onDragLeave:we,onDrop:Me,children:[Q&&!le&&a.jsx(NC,{commands:U,selectedIndex:re,onSelect:Re,onHover:ve}),Q&&le==="sandbox"&&a.jsx(pd,{title:"Sandbox Mode",options:lt,currentValue:Ke.sandboxMode,onSelect:He,onClose:()=>ee(void 0)}),Q&&le==="websearch"&&a.jsx(pd,{title:"Web Search",options:Tt,currentValue:Ke.webSearchMode,onSelect:He,onClose:()=>ee(void 0)}),Q&&le==="network"&&a.jsx(pd,{title:"Network Access",options:Wt,currentValue:Ke.networkAccessEnabled===!0?"true":"false",onSelect:He,onClose:()=>ee(void 0)}),X&&a.jsx(CC,{filter:K,onSelect:at,onClose:()=>{ie(!1),n("")}}),L.length>0&&a.jsx("div",{className:"skill-badges",children:L.map(q=>a.jsxs("span",{className:"skill-badge",children:["$",q.name,a.jsx("button",{className:"skill-badge-remove",onClick:()=>de(Se=>Se.filter(Pe=>Pe.id!==q.id)),children:"×"})]},q.id))}),A.length>0&&a.jsx("div",{className:"attachment-preview-area",children:A.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:()=>M(q),style:{cursor:"pointer"}}):a.jsx(Pv,{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:_g(q.size)})]}),a.jsx("button",{className:"attachment-remove",onClick:()=>Y(q.id),title:"Remove attachment",children:a.jsx(Nn,{size:14})})]},q.id))}),b&&!y&&!j&&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=>{me(q.target.files),q.target.value=""}}),a.jsxs("div",{className:"cmd-input-row",children:[b&&!y&&!j&&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(G1,{size:16})}),a.jsx("textarea",{ref:r,className:"cmd-textarea",placeholder:j?"Select or create a session…":S?"Interrupted — waiting to resume…":y?"Agent is running…":"Type a message… Use / for commands",autoComplete:"off",value:e,disabled:y||j,rows:1,style:{minHeight:wo,maxHeight:hd},onChange:Ue,onKeyDown:Te,onPaste:_e}),y?a.jsx("button",{className:"cmd-stop-btn",onClick:()=>d(),title:"Stop (Esc)",children:a.jsx(xr,{size:15})}):a.jsx("button",{className:"cmd-send-btn",onClick:Xe,disabled:!e.trim()||j,title:"Send (⌘↵)",children:a.jsx(Lv,{size:16})})]}),G&&a.jsx("div",{className:"image-preview-modal",onClick:()=>M(null),children:a.jsxs("div",{className:"image-preview-content",onClick:q=>q.stopPropagation(),children:[a.jsx("img",{src:G.previewUrl,alt:G.name}),a.jsxs("div",{className:"image-preview-info",children:[a.jsx("span",{children:G.name}),a.jsx("span",{children:_g(G.size)})]}),a.jsx("button",{className:"image-preview-close",onClick:()=>M(null),children:a.jsx(Nn,{size:20})})]})})]})}function IC(){const e=R(C=>C.activeSessionId),n=R(C=>C.activeSessionId?C.sessionDetails[C.activeSessionId]:null),r=R(C=>C.activeTurnIndex),o=R(C=>C.setActiveTurnIndex),l=R(C=>C.rewindToTurn),c=R(C=>C.restoreSession),d=R(C=>C.branchFromTurn),f=(n==null?void 0:n.turns)??[],h=Xl(n),m=!!(n!=null&&n.rewound_at_turn_id),v=(n==null?void 0:n.runtime_type)==="repoburg",k=v?"Rewind to this turn? Runtime history after this point is PERMANENTLY deleted and cannot be restored.":"Rewind to this turn? Hidden turns can be restored later.",[y,S]=x.useState(null),j=x.useRef(null);if(Hi(j,()=>S(null),!!y),Mo(()=>S(null),!!y),f.length===0)return a.jsx("div",{className:"empty-state",children:"No turns yet"});function T(C){o(C),requestAnimationFrame(()=>{var b;(b=document.getElementById(`turn-${C}`))==null||b.scrollIntoView({behavior:"smooth",block:"start"})})}return a.jsxs("div",{className:"right-section",children:[a.jsx("div",{className:"right-section-title",children:"Conversation"}),f.map((C,b)=>{const A=b===r,$=C.user_prompt.length>50?C.user_prompt.slice(0,50)+"…":C.user_prompt,P=C.status==="running"||C.status==="pending";return a.jsx("div",{children:a.jsxs("div",{className:`turn-item ${A?"active":""}`,onClick:()=>T(b),onContextMenu:z=>{z.preventDefault(),S({x:z.clientX,y:z.clientY,turnId:C.id,turnIndex:b,isLast:b===f.length-1,isSlashCommand:C.user_prompt.trimStart().startsWith("/")})},children:[C.origin==="peer"?a.jsx("span",{className:"turn-item-icon",style:{background:"var(--purple)",color:"#fff"},title:Vl(C.origin_name),children:a.jsx(Hv,{size:12})}):a.jsx("span",{className:"turn-item-icon",style:{background:"var(--amber)",color:"#fff"},children:a.jsx(nS,{size:12})}),a.jsx("span",{className:"turn-item-label",children:$}),P&&a.jsx("span",{className:"turn-item-status",children:C.status==="pending"&&C.resume_state==="waiting"?"interrupted":"running…"})]})},C.id)}),y&&a.jsxs("div",{ref:j,className:"ctx-menu",style:{position:"fixed",left:y.x,top:y.y,zIndex:500},children:[a.jsxs("div",{className:`ctx-menu-item ${y.isLast||h||y.isSlashCommand?"ctx-disabled":""}`,onClick:()=>{y.isLast||h||y.isSlashCommand||(window.confirm(k)&&l(e,y.turnId),S(null))},children:[a.jsx(Y1,{size:12})," Rewind to Here",y.isSlashCommand?" (slash command)":""]}),m&&!v&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{c(e),S(null)},children:[a.jsx(zi,{size:12})," Restore Rewind"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{d(e,y.turnId),S(null)},children:[a.jsx(Fv,{size:12})," Branch from Here"]})]})]})}const DC={subagent:yr,monitor:Gv,command:tc,task:Ov},Ag=2e4;function MC(e){const n=[];return e.forEach((r,o)=>{var l;for(const c of r.items)if(c.type==="background_task"){if((((l=c.data)==null?void 0:l.task_type)||"unknown")==="local_agent")continue;n.push({item:c,turnIndex:o,turnPrompt:r.user_prompt})}}),n}function LC({entry:e,sessionId:n}){const{item:r,turnIndex:o,turnPrompt:l}=e,c=R(ee=>ee.addToast),[d,f]=x.useState(!1),h=r.data||{},m=h.task_type||"unknown",v=h.subagent_type||null,k=h.description||"",y=h.summary||null,S=h.last_tool_name||null,j=h.token_count||null,T=h.output||"",C=r.status==="in_progress",b=h.status||"running",A=!C&&b==="running"?"stopped":b,$=h.task_id||null,P=DC[Tf(m)],z=Xy(m,v),G=A==="running"?"running…":A==="completed"?"done":A==="failed"?"failed":A==="stopped"?"stopped":A,M=A==="failed"||r.status==="failed"&&A!=="stopped",[F,Z]=x.useState(C),[Q,J]=x.useState(!1),he=x.useRef(null);x.useEffect(()=>{C&&Z(!0)},[C]),x.useEffect(()=>{F&&C&&he.current&&(he.current.scrollTop=he.current.scrollHeight)},[F,C,T]);const ke=T.length>Ag,re=ke&&!Q?T.slice(0,Ag)+`
691
+ … (truncated, click to expand)`:T,ve=C?null:A==="completed"?a.jsx(_s,{size:12}):M?a.jsx(ec,{size:12}):a.jsx(xr,{size:12});async function le(ee){if(ee.stopPropagation(),!(!n||!$||d)){f(!0);try{await S0(n,$)}catch(X){c("error",`Could not stop the task — ${X.message}`)}finally{f(!1)}}}return a.jsxs("div",{className:`task-card ${C?"task-running":""} ${M?"task-failed":""}`,children:[a.jsxs("div",{className:"task-card-header",onClick:()=>Z(ee=>!ee),style:{cursor:"pointer"},children:[a.jsx("span",{className:"task-card-icon",children:a.jsx(P,{size:14})}),a.jsx("span",{className:"task-card-type",children:z}),a.jsxs("span",{className:`task-card-status ${M?"task-status-failed":C?"task-status-running":"task-status-done"}`,children:[ve," ",G]}),C&&$&&n&&a.jsxs("button",{className:"task-card-stop",onClick:le,disabled:d,title:"Stop this task","aria-label":"Stop task",children:[a.jsx(xr,{size:10})," ",d?"Stopping…":"Stop"]}),a.jsx($i,{size:14,className:"task-card-chevron",style:{transform:F?"rotate(90deg)":"none",marginLeft:"auto"}})]}),k&&a.jsx("div",{className:"task-card-desc",children:k}),C&&S&&a.jsxs("div",{className:"task-card-meta",children:["last tool: ",S,j!=null&&` · ${j.toLocaleString()} tokens`]}),F&&a.jsxs("div",{className:"task-card-body",children:[T?a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"cmd-output task-output",ref:he,children:a.jsx("code",{children:re})}),ke&&a.jsx("button",{className:"cmd-output-toggle",onClick:()=>J(ee=>!ee),children:Q?"Show less":`Show full output (${(T.length/1024).toFixed(0)}KB)`})]}):y?a.jsx("pre",{className:"cmd-output task-output",children:a.jsx("code",{children:y})}):C?a.jsx("div",{className:"task-card-placeholder",children:"Waiting for output…"}):a.jsx("div",{className:"task-card-placeholder",children:"No output captured."}),a.jsxs("div",{className:"task-card-context",title:l,children:["from turn ",o+1,": ",l.length>60?l.slice(0,60)+"…":l]})]})]})}const OC=x.memo(LC);function $C(){const e=R(f=>f.activeSessionId),n=R(f=>f.activeSessionId?f.sessionDetails[f.activeSessionId]:null),r=R(f=>f.activeSessionId?f.backgroundTasks[f.activeSessionId]:void 0),o=(n==null?void 0:n.turns)??[],l=MC(o),c=[...l].sort((f,h)=>{const m=f.item.status==="in_progress",v=h.item.status==="in_progress";return m&&!v?-1:!m&&v?1:h.turnIndex-f.turnIndex}),d=Nf(r);return l.length===0?a.jsx("div",{className:"empty-state",children:"No background tasks yet"}):a.jsxs("div",{className:"right-section",children:[a.jsxs("div",{className:"right-section-title",children:["Background Tasks (",l.length,")",d>0&&a.jsxs("span",{className:"task-count-badge",style:{color:"var(--amber)"},children:[" ",d," running"]})]}),c.map(f=>a.jsx(OC,{entry:f,sessionId:e},f.item.id))]})}const PC=x.memo($C),zC="Your job is to answer questions about this session:",Ig="Understand the user's question below, read the session file given above, and answer.",FC=new Set(["claude","codex"]);function UC(e){return FC.has(e)}function Cf(e){return e.kind==="sidecar"}function BC(e){const n=(e??[]).filter(Cf);return n.length?n[n.length-1]:null}function WC(e){if(!e.startsWith(zC))return e;const n=e.indexOf(Ig);return n<0?e:e.slice(n+Ig.length).replace(/^\n+/,"")}function HC({thread:e,onClose:n}){const{activeSessionId:r,resolveThread:o,shareThread:l}=R(),[c,d]=x.useState(""),[f,h]=x.useState(!1),[m,v]=x.useState(!1);async function k(){if(!r||f)return;h(!0),await l(r,e.id,c)?n():h(!1)}async function y(){!r||m||(v(!0),await o(r,e.id),n())}const S=f||m;return a.jsx("div",{className:"dialog-overlay",onClick:S?void 0:n,children:a.jsxs("div",{className:"dialog",onClick:j=>j.stopPropagation(),children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"Resolve thread"}),a.jsx("button",{className:"dialog-close",onClick:n,disabled:S,children:a.jsx(Nn,{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:j=>d(j.target.value),rows:3,disabled:S,autoFocus:!0})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:n,disabled:S,children:"Cancel"}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:y,disabled:S,title:"Resolve without sharing",children:[m?a.jsx(sn,{size:13,className:"spin"}):a.jsx(Rl,{size:13}),"Resolve only"]}),a.jsxs("button",{className:"dialog-btn-create",onClick:k,disabled:S,children:[f?a.jsx(sn,{size:13,className:"spin"}):a.jsx(J1,{size:13}),f?"Summarizing…":"Share & Resolve"]})]})]})})}const Dg=[];qe.setOptions({breaks:!0,gfm:!0});function VC(e){const n=qe.parse(e);return bf.sanitize(n)}function KC(e){var n,r,o;if(e.type==="agent_message"||e.type==="final_result"){const l=(n=e.data)==null?void 0:n.text;return typeof l=="string"&&l?l:null}if(e.type==="ask_user"){const l=Array.isArray((r=e.data)==null?void 0:r.groups)?e.data.groups:[],c=[(o=e.data)==null?void 0:o.question,...l.map(d=>d.question)].filter(d=>typeof d=="string"&&!!d);return c.length?c.join(`
692
+
693
+ `):null}return null}function GC(e){const n=e.match(/^\[Quoting from your previous response\]:\n> .*\n\n([\s\S]*)$/);return n?n[1]:e}function Zy({turn:e,formatPrompt:n=GC}){var d,f;const r=e.origin==="peer",o=r?e.user_prompt:n(e.user_prompt),l=[];for(const h of e.items){if(h.type==="peer_message"){const v=(d=h.data)==null?void 0:d.body;typeof v=="string"&&v&&l.push({peer:!0,text:v,name:(f=h.data)==null?void 0:f.name});continue}const m=KC(h);m!==null&&l.push({peer:!1,text:m})}const c=l.some(h=>!h.peer);return!c&&e.status==="completed"&&e.agent_response&&l.push({peer:!1,text:e.agent_response}),a.jsxs("div",{className:"thread-card-turn",children:[r?a.jsxs("div",{className:"thread-card-user-message thread-card-peer-message",children:[a.jsx("div",{className:"thread-card-peer-label",children:Vl(e.origin_name)}),o]}):a.jsx("div",{className:"thread-card-user-message",children:o}),l.map((h,m)=>h.peer?a.jsxs("div",{className:"thread-card-user-message thread-card-peer-message",children:[a.jsx("div",{className:"thread-card-peer-label",children:Vl(h.name)}),h.text]},m):a.jsx("div",{className:"thread-card-ai-response",dangerouslySetInnerHTML:{__html:VC(h.text)}},m)),!c&&(e.status==="pending"||e.status==="running")&&a.jsx("div",{className:"thread-card-pending",children:e.status==="running"?"AI is responding…":"Waiting…"}),e.status==="failed"&&a.jsx("div",{className:"thread-card-pending",children:e.error||"Turn failed"})]})}function qC({thread:e,threadTurns:n,onStop:r,onResolve:o,onReopen:l,onDelete:c,onFollowup:d,onLocate:f}){var ke,re,ve;const[h,m]=x.useState(""),[v,k]=x.useState(!0),y=x.useRef(null),S=x.useRef(null),[j,T]=x.useState(!1),[C,b]=x.useState({x:0,y:0}),[A,$]=x.useState(""),P=n.some(Ws),z=28,G=120,M=x.useRef(z);x.useEffect(()=>{const le=S.current;le&&(le.scrollTop=le.scrollHeight)},[n.length,v]);function F(le){const ee=y.current;ee&&(ee.style.height=`${le}px`,M.current=le)}function Z(){const le=y.current;if(le){if(le.scrollHeight>le.clientHeight){const ee=Math.min(le.scrollHeight,G);ee!==M.current&&F(ee);return}M.current>z&&(le.style.height="auto",F(Math.min(le.scrollHeight,G)))}}const Q=x.useCallback(()=>{T(!1)},[]),J=x.useCallback(()=>{const le=S.current;if(!le)return;const ee=window.getSelection();if(!ee||ee.rangeCount===0||ee.isCollapsed){T(!1);return}const X=ee.getRangeAt(0);if(!le.contains(X.commonAncestorContainer)){T(!1);return}const ie=X.commonAncestorContainer.nodeType===Node.TEXT_NODE?X.commonAncestorContainer.parentElement:X.commonAncestorContainer;if(!(ie!=null&&ie.closest(".thread-card-ai-response"))){T(!1);return}const K=ee.toString();if(!K.trim()){T(!1);return}const E=X.getBoundingClientRect(),L=28,de=6,U=170;let me=!1;if(ee.anchorNode&&ee.focusNode)try{const we=document.createRange();we.setStart(ee.focusNode,ee.focusOffset),we.setEnd(ee.focusNode,ee.focusOffset);const Me=document.createRange();Me.setStart(ee.anchorNode,ee.anchorOffset),Me.setEnd(ee.anchorNode,ee.anchorOffset),me=Me.compareBoundaryPoints(Range.START_TO_START,we)>0}catch{me=!1}let Y=E.top-L-de;Y<8&&(Y=E.bottom+de);let xe=me?E.left-U:E.right;xe=Math.max(8,Math.min(xe,window.innerWidth-U-8)),b({x:xe,y:Y}),$(K),T(!0)},[]);x.useEffect(()=>{function le(ee){const X=ee.target;X&&X.closest(".selection-actions")||J()}return document.addEventListener("mouseup",le),()=>document.removeEventListener("mouseup",le)},[J]);const he=x.useCallback(()=>{var ee;const le=`
694
+ \`\`\`QUOTE
695
+ ${A}
696
+ \`\`\`
697
+
698
+ `;m(X=>X+le),T(!1),$(""),(ee=window.getSelection())==null||ee.removeAllRanges(),setTimeout(()=>{if(y.current){Z(),y.current.focus();const X=y.current.value.length;y.current.setSelectionRange(X,X)}},0)},[A]);return a.jsxs("div",{className:`thread-card ${e.status==="resolved"?"thread-resolved":""}`,id:`thread-${e.id}`,children:[a.jsxs("div",{className:"thread-card-header",onClick:()=>k(le=>!le),children:[a.jsx("div",{className:"thread-card-quote",children:e.selected_text===null?((ve=(re=(ke=e.turns)==null?void 0:ke[0])==null?void 0:re.user_prompt)==null?void 0:ve.slice(0,100))||"Quick question":`“${e.selected_text.slice(0,100)}${e.selected_text.length>100?"…":""}”`}),a.jsxs("div",{className:"thread-card-header-right",children:[e.selected_text!==null&&a.jsx("button",{className:"thread-locate-btn",onClick:le=>{le.stopPropagation(),f()},title:"Scroll to text",children:a.jsx(W1,{size:12})}),a.jsx("span",{className:`thread-status-badge ${e.status==="open"?"thread-status-open":"thread-status-resolved"}`,children:e.status==="open"?"Open":"Resolved"})]})]}),v&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"thread-card-conversation",ref:S,onMouseDown:Q,children:[n.map(le=>a.jsx(Zy,{turn:le},le.id)),n.length===0&&a.jsx("div",{className:"thread-card-placeholder",children:"No messages yet."})]}),j&&a.jsx("div",{className:"selection-actions",style:{left:C.x,top:C.y},children:a.jsxs("button",{className:"discuss-button",onClick:he,title:"Quote this text in your follow-up",children:[a.jsx(Vv,{size:14}),a.jsx("span",{children:"Quote"})]})}),e.status==="open"&&a.jsxs("div",{className:"thread-card-followup",children:[a.jsx("textarea",{ref:y,className:"thread-card-followup-input",placeholder:P?"Agent is running…":"Type a follow-up…",value:h,onChange:le=>{zt.markInputChange(),m(le.target.value),Z()},disabled:P,rows:1,style:{minHeight:z,maxHeight:G},onKeyDown:le=>{zt.markKeystroke(),le.key==="Enter"&&(le.metaKey||le.ctrlKey)&&!P&&h.trim()&&(le.preventDefault(),d(h.trim()),m(""),F(z))}}),a.jsx("button",{className:"thread-card-followup-send",disabled:P||!h.trim(),onClick:()=>{d(h.trim()),m("")},children:a.jsx(Vi,{size:13})}),P&&a.jsx("button",{className:"thread-card-followup-stop",onClick:r,title:"Stop this thread's turn (Esc)",children:a.jsx(xr,{size:13})})]}),a.jsxs("div",{className:"thread-card-actions",children:[e.status==="open"?a.jsxs("button",{className:"thread-action-btn",onClick:o,title:"Resolve thread",children:[a.jsx(Rl,{size:13})," Resolve"]}):a.jsxs("button",{className:"thread-action-btn",onClick:l,title:"Reopen thread",children:[a.jsx(zi,{size:13})," Reopen"]}),a.jsxs("button",{className:"thread-action-btn thread-action-danger",onClick:c,title:"Delete thread",children:[a.jsx(fs,{size:13})," Delete"]})]})]})]})}function XC(){zt.trackRender("ThreadsPanel");const e=R(b=>b.activeSessionId),n=R(b=>{var A;return b.activeSessionId?((A=b.sessionDetails[b.activeSessionId])==null?void 0:A.threads)??Dg:Dg}),r=x.useMemo(()=>n.filter(b=>!Cf(b)),[n]),o=R(b=>b.followupThread),l=R(b=>b.cancelThreadTurn),c=R(b=>b.reopenThread),d=R(b=>b.deleteThread),f=R(b=>b.deepLinkThreadId),h=R(b=>b.setDeepLinkThreadId),[m,v]=x.useState("open"),[k,y]=x.useState(null);x.useEffect(()=>{if(!f)return;const b=f;h(null),v($=>r.some(P=>P.id===b&&P.status==="open")?$:"all");const A=setTimeout(()=>{const $=document.getElementById(`thread-${b}`);$&&($.scrollIntoView({behavior:"smooth",block:"center"}),$.classList.add("thread-card-highlighted"),setTimeout(()=>$.classList.remove("thread-card-highlighted"),1500))},100);return()=>clearTimeout(A)},[f,h,r]);const S=r.filter(b=>m==="open"?b.status==="open":m==="resolved"?b.status==="resolved":!0),j=r.filter(b=>b.status==="open").length,T=r.filter(b=>b.status==="resolved").length;function C(b){setTimeout(()=>{const A=document.querySelector(`mark[data-thread-id="${b}"]`);A&&(A.scrollIntoView({behavior:"smooth",block:"center"}),A.classList.add("thread-mark-flash"),setTimeout(()=>A.classList.remove("thread-mark-flash"),1500))},50)}return e?r.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx(Wv,{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 (",j,")"]}),a.jsxs("button",{className:`thread-filter-tab ${m==="resolved"?"active":""}`,onClick:()=>v("resolved"),children:["Resolved (",T,")"]}),a.jsxs("button",{className:`thread-filter-tab ${m==="all"?"active":""}`,onClick:()=>v("all"),children:["All (",r.length,")"]})]}),S.length===0?a.jsxs("div",{className:"empty-state",style:{padding:"20px 0"},children:["No ",m," threads."]}):S.map(b=>a.jsx(qC,{thread:b,threadTurns:b.turns??[],onStop:()=>l(e,b.id),onResolve:()=>y(b),onReopen:()=>c(e,b.id),onDelete:()=>d(e,b.id),onFollowup:A=>o(e,b.id,A),onLocate:()=>C(b.id)},b.id)),k&&a.jsx(HC,{thread:k,onClose:()=>y(null)})]}):a.jsx("div",{className:"empty-state",children:"No session selected"})}function YC(){const e=R(f=>f.apps),n=R(f=>f.activeAppTabId),r=R(f=>f.openAppTab),o=R(f=>f.startAppEdit),l=R(f=>f.toggleAppPin),c=R(f=>f.deleteApp),d=R(f=>f.openAppExport);return e.length===0?a.jsx("div",{className:"empty-state",style:{padding:"16px"},children:"No mini apps yet. Add one with the + button in the sidebar Apps section."}):a.jsx("div",{className:"apps-panel",children:e.map(f=>a.jsxs("div",{className:`apps-panel-row${n===f.id?" active":""}`,onClick:()=>r(f.id),title:f.description??void 0,children:[a.jsx(Lo,{iconNode:f.iconNode,size:14,className:"sidebar-app-icon"}),a.jsxs("div",{className:"apps-panel-info",children:[a.jsx("span",{className:"apps-panel-title",children:f.title}),f.description&&a.jsx("span",{className:"apps-panel-desc",children:f.description})]}),a.jsx("button",{className:"apps-panel-action",title:"Edit app with the agent",onClick:h=>{h.stopPropagation(),o(f.id)},children:a.jsx(ml,{size:12})}),a.jsx("button",{className:`apps-panel-action${f.pinned?" pinned":""}`,title:f.pinned?"Unpin app":"Pin app (sorts first)",onClick:h=>{h.stopPropagation(),l(f.id)},children:a.jsx(Il,{size:12,fill:f.pinned?"currentColor":"none"})}),a.jsx("button",{className:"apps-panel-action",title:"Export app (.zip)",onClick:h=>{h.stopPropagation(),d(f.id)},children:a.jsx(rf,{size:12})}),a.jsx("button",{className:"apps-panel-action apps-panel-danger",title:"Delete app",onClick:h=>{h.stopPropagation(),c(f.id)},children:a.jsx(fs,{size:12})})]},f.id))})}const QC=24;function ZC(){zt.trackRender("SidecarPanel");const e=R(b=>b.activeSessionId),n=R(b=>{var A;return b.activeSessionId?(A=b.sessionDetails[b.activeSessionId])==null?void 0:A.runtime_type:void 0}),r=R(b=>{var A;return b.activeSessionId?BC((A=b.sessionDetails[b.activeSessionId])==null?void 0:A.threads):null}),o=R(b=>b.askSidecar),l=R(b=>b.cancelThreadTurn),c=R(b=>b.deleteThread),[d,f]=x.useState(""),[h,m]=x.useState(!1),v=x.useRef(null),k=x.useRef(!0),y=(r==null?void 0:r.turns)??[],S=y[y.length-1],j=y.some(Ws);if(x.useEffect(()=>{k.current=!0},[e,y.length]),x.useEffect(()=>{const b=v.current;b&&k.current&&(b.scrollTop=b.scrollHeight)},[e,y.length,S==null?void 0:S.items.length,S==null?void 0:S.status]),!e||!n)return a.jsx("div",{className:"empty-state",children:"No session selected"});if(!UC(n))return a.jsxs("div",{className:"empty-state",children:[a.jsx(yr,{size:24,style:{opacity:.3,marginBottom:8}}),a.jsxs("div",{children:["The sidecar is not available for ",n," sessions yet."]})]});const T=!j&&!h&&d.trim().length>0;async function C(){if(!e||!T)return;m(!0);const b=await o(e,d.trim());m(!1),b&&f("")}return a.jsxs("div",{className:"sidecar-panel",children:[a.jsx("div",{ref:v,className:"sidecar-conversation",onScroll:b=>{const A=b.currentTarget;k.current=A.scrollHeight-A.scrollTop-A.clientHeight<=QC},children:y.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx(yr,{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(b=>a.jsx(Zy,{turn:b,formatPrompt:WC},b.id))}),a.jsxs("div",{className:"sidecar-footer",children:[a.jsxs("div",{className:"thread-card-followup",children:[a.jsx("textarea",{className:"thread-card-followup-input","aria-label":"Ask the sidecar",placeholder:j?"Sidecar is answering…":"Ask about this session… (⌘/Ctrl+Enter)",value:d,rows:2,disabled:j,onChange:b=>{zt.markInputChange(),f(b.target.value)},onKeyDown:b=>{zt.markKeystroke(),b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),C())}}),j&&r?a.jsx("button",{className:"thread-card-followup-stop",title:"Stop the answer","aria-label":"Stop the answer",onClick:()=>l(e,r.id),children:a.jsx(xr,{size:13})}):a.jsx("button",{className:"thread-card-followup-send",title:"Ask","aria-label":"Ask",disabled:!T,onClick:()=>void C(),children:a.jsx(Vi,{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:j,onClick:()=>c(e,r.id),children:[a.jsx(fs,{size:13})," Clear"]})})]})]})}function JC(){var h;zt.trackRender("RightPanel");const e=R(m=>m.activeRightTab),n=R(m=>m.switchRightTab),r=R(m=>m.rightPanelCollapsed),o=R(m=>m.toggleRightPanel),l=R(m=>m.activeSessionId?m.sessionDetails[m.activeSessionId]:null),c=R(m=>m.activeSessionId?Nf(m.backgroundTasks[m.activeSessionId]):0),d=((h=l==null?void 0:l.threads)==null?void 0:h.filter(m=>m.status==="open"&&!Cf(m)).length)??0,f=[{id:"turns",label:"Turns",icon:$1},{id:"sidecar",label:"Sidecar",icon:yr},{id:"tasks",label:"Tasks",icon:O1,badge:c||void 0},{id:"threads",label:"Threads",icon:Wv,badge:d||void 0},{id:"apps",label:"Apps",icon:Bv}];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(V1,{size:15})}),a.jsx("div",{className:"right-rail-divider"}),f.map(m=>{const v=m.icon,k=m.badge?`${m.label} (${m.badge})`:m.label;return a.jsxs("button",{type:"button",className:`right-icon-btn right-rail-tab ${e===m.id?"active":""}`,title:k,"aria-label":k,onClick:()=>n(m.id),children:[a.jsx(v,{size:15}),m.badge?a.jsx("span",{className:"right-tab-badge",children:m.badge}):null]},m.id)})]}):a.jsxs("div",{className:"ide-right",children:[a.jsxs("div",{className:"right-header",children:[a.jsx("div",{className:"right-tabs",children:f.map(m=>a.jsxs("div",{className:`right-tab ${e===m.id?"active":""}`,onClick:()=>n(m.id),children:[m.label,m.badge?a.jsx("span",{className:"right-tab-badge",children:m.badge}):null]},m.id))}),a.jsx("button",{type:"button",className:"right-icon-btn right-collapse-btn",title:"Collapse panel","aria-label":"Collapse panel","aria-expanded":!0,onClick:o,children:a.jsx(H1,{size:14})})]}),a.jsxs("div",{className:"right-content",children:[e==="turns"&&a.jsx(IC,{}),e==="sidecar"&&a.jsx(ZC,{}),e==="tasks"&&a.jsx(PC,{}),e==="threads"&&a.jsx(XC,{}),e==="apps"&&a.jsx(YC,{})]})]})}function Kl(e){return Nt(`/vscode-web/status?folder=${encodeURIComponent(e??"")}`)}function Jy(e){return ot("/vscode-web/start",{folder:e})}function eE(e){return ot("/vscode-web/heartbeat",{id:e})}const tE=1e3,nE=12e4;function sE(){const e=bt();return e===""||e===window.location.origin}function ex(e){var r;const n=e.activeSessionId?e.sessions.find(o=>o.id===e.activeSessionId):null;return n!=null&&n.cwd?n.cwd:((r=e.workspaces.find(o=>o.deleted===0))==null?void 0:r.path)??null}function tx(e,n,r){return`${bt()}/vscode/${e}/?tkn=${n}${r?`&folder=${encodeURIComponent(r)}`:""}`}async function rE(e){let n=await Kl(e);(n.state==="stopped"||n.state==="error")&&(n=await Jy(e));const r=Date.now()+nE;for(;n.state==="starting"&&Date.now()<r;)await new Promise(o=>setTimeout(o,tE)),n=await Kl(e);return n}function md(e,n){try{e.document.title="VS Code",e.document.body.style.cssText="margin:0;height:100vh;display:flex;align-items:center;justify-content:center;font:14px system-ui,sans-serif;color:#555",e.document.body.textContent=n}catch{}}function oE(e,n){const r=window.open("","_blank");if(!r){n();return}r.opener=null,md(r,"Starting VS Code — first start downloads the server component (~20 s)…"),rE(e).then(o=>{r.closed||(o.state==="running"&&o.id&&o.token?r.location.replace(tx(o.id,o.token,e)):md(r,`VS Code could not start${o.error?`: ${o.error}`:"."}`))}).catch(o=>{r.closed||md(r,`VS Code could not start: ${o.message}`)})}const Qn={low:{effort:"low",label:"Low"},medium:{effort:"medium",label:"Medium"},high:{effort:"high",label:"High"}},zd=[{id:"codex",label:"Codex",available:!0,models:[]},{id:"claude",label:"Claude",available:!0,models:[]},{id:"repoburg",label:"Repoburg",available:!0,models:[{slug:"ollama/glm-5.3:cloud",displayName:"GLM-5.3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[Qn.low,Qn.medium,Qn.high]},{slug:"ollama/glm-5.3-flash:cloud",displayName:"GLM-5.3 Flash",description:"Ollama Cloud — fast",defaultReasoning:"medium",reasoningLevels:[Qn.low,Qn.medium,Qn.high]},{slug:"ollama/minimax-m3:cloud",displayName:"MiniMax M3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[Qn.low,Qn.medium,Qn.high]},{slug:"ollama/deepseek-v4-pro:cloud",displayName:"DeepSeek V4 Pro",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[Qn.low,Qn.medium,Qn.high]}]}];function iE(e){return zd.find(n=>n.id===e)}function aE(e){const n=iE(e);return(n==null?void 0:n.models)??[]}function nx(e,n){const r=e?Tv(e,n):"",o=R(h=>r?h.modelLists[r]:void 0),l=R(h=>r?!!h.modelsLoading[r]:!1),c=R(h=>h.loadModels),d=x.useCallback(()=>{e&&c(e,n??void 0)},[e,n,c]);return x.useEffect(d,[d]),{models:o??(e?aE(e):[]),loading:l,refresh:d}}function lE(){var he,ke;const{activeSessionId:e,sessions:n,updateModelConfig:r}=R(),o=R(re=>re.showModelSelector),l=R(re=>re.setShowModelSelector),c=n.find(re=>re.id===e),{models:d,loading:f,refresh:h}=nx(c==null?void 0:c.runtime_type,c==null?void 0:c.cwd),[m,v]=x.useState(!1),k=x.useRef(null);if(Hi(k,()=>v(!1),m),Mo(()=>v(!1),m),x.useEffect(()=>{o&&(v(!0),l(!1))},[o,l]),x.useEffect(()=>{m&&h()},[m,h]),!c)return null;const y=c.runtime_type,S=c.model??"",j=c.model_reasoning_effort??"",T=[...d];S&&!T.some(re=>re.slug===S)&&T.unshift({slug:S,displayName:S,description:"Custom model",defaultReasoning:((he=d[0])==null?void 0:he.defaultReasoning)??"medium",reasoningLevels:((ke=d[0])==null?void 0:ke.reasoningLevels)??[]});function C(re){return T.find(ve=>ve.slug===re)}function b(re){var ve;return((ve=C(re))==null?void 0:ve.reasoningLevels)??[]}function A(re){var ve;return(ve=C(re))==null?void 0:ve.defaultReasoning}const $=zd.find(re=>re.id===y),P=C(S),z=S?b(S):[],G=($==null?void 0:$.label)??y,M=(P==null?void 0:P.displayName)??(S||"Default"),F=z.find(re=>re.effort===j),Z=(F==null?void 0:F.label)??(j||"Default");function Q(re){var X;const ve=b(re),ee=ve.some(ie=>ie.effort===j)?j:A(re)??((X=ve[0])==null?void 0:X.effort)??"";r(re,ee),v(!1)}function J(re){r(S,re),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:G}),a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-model",children:M}),Z!=="Default"&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-reasoning",children:Z})]}),a.jsx(Ro,{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"}),zd.map(re=>a.jsxs("div",{className:`model-selector-item ${re.id===y?"selected":""} ${re.available?"":"disabled"}`,onClick:()=>{if(re.available){if(re.id===y){v(!1);return}r("","",re.id)}},children:[a.jsx("span",{children:re.label}),!re.available&&a.jsxs("span",{className:"model-selector-coming-soon",children:[a.jsx(F1,{size:10})," Soon"]}),re.id===y&&a.jsx(_s,{size:12})]},re.id))]}),a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Model"}),f&&T.length===0&&a.jsx("div",{className:"model-selector-empty",children:"Loading models…"}),!f&&T.length===0&&a.jsx("div",{className:"model-selector-empty",children:"No models available"}),T.map(re=>a.jsxs("div",{className:`model-selector-item ${re.slug===S?"selected":""}`,onClick:()=>Q(re.slug),children:[a.jsxs("div",{className:"model-selector-item-main",children:[a.jsx("span",{className:"model-selector-item-name",children:re.displayName}),a.jsx("span",{className:"model-selector-item-desc",children:re.description})]}),re.slug===S&&a.jsx(_s,{size:12})]},re.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(re=>a.jsxs("div",{className:`model-selector-item ${re.effort===j?"selected":""}`,onClick:()=>J(re.effort),children:[a.jsx("span",{children:re.label}),re.effort===j&&a.jsx(_s,{size:12})]},re.effort))]})]})]})}const cE=new Set(["localhost","127.0.0.1","[::1]"]);function uE(){const e=bt()||window.location.origin;let n;try{n=new URL(e).hostname}catch{return null}return cE.has(n)?`${e}/tabtape/`:null}function Ti(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6===0?0:1)}M`:e>=1e3?`${Math.round(e/1e3)}K`:String(e)}function Mg(){const e=R(r=>r.canGoBack),n=R(r=>r.canGoForward);return a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"sb-item sb-btn",title:"Back","aria-label":"Back",disabled:!e,onClick:()=>window.history.back(),children:a.jsx(w1,{size:14})}),a.jsx("button",{className:"sb-item sb-btn",title:"Forward","aria-label":"Forward",disabled:!n,onClick:()=>window.history.forward(),children:a.jsx(k1,{size:14})})]})}function Lg(){const e=R(n=>n.setShowRemoteModal);return a.jsxs("div",{className:"sb-item",style:{cursor:"pointer"},title:"Remote access — make this machine remote",onClick:()=>e(!0),children:[a.jsx(rS,{size:14})," Repoburg"]})}function Og(){const e=R(r=>r.usageViewOpen),n=R(r=>r.toggleUsageView);return a.jsxs("button",{className:`sb-item sb-btn${e?" sb-item-active":""}`,title:e?"Back to the agent view":"Usage Center",onClick:n,children:[a.jsx(zv,{size:14})," Usage"]})}function $g(){const e=R(o=>o.vscodeViewOpen),n=R(o=>o.toggleVscodeView);function r(){if(e||sE()){n();return}const o=R.getState();oE(ex(o),()=>o.addToast("error","The browser blocked the VS Code tab — allow pop-ups for this site and try again."))}return a.jsxs("button",{className:`sb-item sb-btn${e?" sb-item-active":""}`,title:e?"Back to the agent view":"Open VS Code",onClick:r,children:[a.jsx(j1,{size:14})," Code"]})}function Pg(){const e=R(r=>r.terminalViewOpen),n=R(r=>r.toggleTerminalView);return a.jsxs("button",{className:`sb-item sb-btn${e?" sb-item-active":""}`,title:e?"Back to the agent view":"Open a terminal",onClick:n,children:[a.jsx(qv,{size:14})," Terminal"]})}function zg(){const e=uE();return e?a.jsxs(a.Fragment,{children:[a.jsxs("a",{className:"sb-item sb-btn sb-link",href:e,target:"_blank",rel:"noopener noreferrer",title:"Open tabtape in a new tab",children:[a.jsx(N1,{size:14})," tabtape"]}),a.jsx("div",{className:"sb-divider",children:"|"})]}):null}function dE(){zt.trackRender("StatusBar");const e=R(v=>v.activeSessionId),n=R(v=>e?v.sessions.find(k=>k.id===e)??null:null),r=R(v=>e?v.sessionDetails[e]??null:null),o=R(v=>e?v.backgroundTasks[e]:void 0),l=R(v=>v.wsConnected),c=R(v=>v.switchRightTab),d=(r==null?void 0:r.contextUsage)??null;if(!n)return a.jsxs("div",{className:"ide-statusbar",children:[a.jsx(Mg,{}),a.jsx(Lg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx($g,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Pg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Og,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(zg,{}),a.jsx("div",{className:"sb-item",title:l?"WebSocket connected":"WebSocket disconnected",children:l?"Live":"Offline"}),a.jsx("div",{className:"sb-spacer"}),a.jsxs("div",{className:"sb-item",children:[a.jsx(Im,{size:14})," K"]})]});const f=o??[],h=Jl(n,f.length),m=Nf(f);return a.jsxs("div",{className:"ide-statusbar",children:[a.jsx(Mg,{}),a.jsx(Lg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx($g,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Pg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Og,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(zg,{}),a.jsx(lE,{}),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(tc,{size:14})," ",m]})]}),a.jsx("div",{className:"sb-spacer"}),a.jsx("div",{className:"sb-item",title:l?"WebSocket connected":"WebSocket disconnected",children:l?"Live":"Offline"}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx("div",{className:"sb-item",style:h.dot==="background"?{color:"var(--purple)"}:n.status==="failed"?{color:"var(--red)"}:void 0,title:h.dot==="background"?h.dotTitle:void 0,children:h.label}),d&&a.jsx(fE,{usage:d}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsxs("div",{className:"sb-item",children:[a.jsx(Im,{size:14})," K"]})]})}function fE({usage:e}){const n=e.percentage>=85?"var(--red)":e.percentage>=60?"var(--amber)":"var(--green)",r=`${Ti(e.totalTokens)} / ${Ti(e.contextWindow)} tokens`+(e.autoCompactThreshold?` · auto-compacts at ${Ti(e.autoCompactThreshold)}`:"");return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx("div",{className:"sb-context",title:r,children:a.jsxs("span",{className:"sb-context-text",style:{color:n},children:[Math.round(e.percentage),"% / ",Ti(e.totalTokens)," / ",Ti(e.contextWindow)]})})]})}const pE=1e3,hE=5*6e4;function mE({children:e}){const n=R(r=>r.toggleVscodeView);return a.jsxs("div",{className:"vscode-view vscode-view--loading",children:[e,a.jsx("button",{className:"dialog-close vscode-view-close",title:"Close VS Code view","aria-label":"Close VS Code view",onClick:n,children:a.jsx(Nn,{size:16})})]})}function gE(){const e=R(y=>y.vscodeState),n=R(y=>y.vscodeId),r=R(y=>y.vscodeToken),o=R(y=>y.setVscodeView),l=R(ex),[c,d]=x.useState(!1),[f,h]=x.useState(0),m=x.useRef(null),v=tx(n??"",r??"",l);x.useEffect(()=>{let y=!1;function S(){m.current&&(clearInterval(m.current),m.current=null)}async function j(){try{let C=await Kl(l);if((C.state==="stopped"||C.state==="error")&&(C=await Jy(l)),y||(o(C.state,C.id,C.token),C.state==="running"||C.state==="error"))return;m.current=setInterval(async()=>{const b=await Kl(l);y||(o(b.state,b.id,b.token),(b.state==="running"||b.state==="error"||b.state==="stopped")&&S())},pE)}catch{y||o("error",null,null)}}j();const T=setInterval(()=>{const C=R.getState().vscodeId;C&&eE(C).catch(()=>{})},hE);return()=>{y=!0,S(),clearInterval(T)}},[f,l,o]);function k(){d(!1),o("starting",null,null),h(y=>y+1)}return e!=="running"||!r||!n?a.jsx(mE,{children:e==="error"?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"VS Code could not start."}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:k,children:[a.jsx(zi,{size:14})," Retry"]})]}):a.jsxs("span",{className:"vscode-view-hint",children:[a.jsx(sn,{size:16,className:"spin"})," Starting VS Code — first start downloads the server component (~20 s)."]})}):a.jsxs("div",{className:"vscode-view",children:[!c&&a.jsxs("div",{className:"vscode-view-overlay",children:[a.jsx(sn,{size:16,className:"spin"})," Loading VS Code…"]}),a.jsx("iframe",{src:v,title:"VS Code",className:"vscode-view-frame",onLoad:()=>d(!0)},n)]})}function vE(e){const n=new URLSearchParams;return e.since&&n.set("since",e.since),e.until&&n.set("until",e.until),n.set("tz",e.timezone),e.fresh&&n.set("fresh","1"),Nt(`/usage/report?${n.toString()}`)}const yE=[{id:"today",label:"Today"},{id:"7d",label:"7 days"},{id:"30d",label:"30 days"},{id:"month",label:"This month"},{id:"all",label:"All"}];function No(e){return Math.round(e).toLocaleString("en-US")}function es(e){return`$${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function To(e){return new Intl.NumberFormat("en-US",{notation:"compact",maximumSignificantDigits:3}).format(e)}function Ef(e){const n=e.startsWith("anthropic/claude-")?e.slice(17):e.startsWith("claude-")?e.slice(7):e,r=n.split("-");return r.length>=3&&r[r.length-1].length===8?r.slice(0,-1).join("-"):n}const xE={claude:"Claude",codex:"Codex",repoburg:"Repoburg",opencode:"OpenCode",amp:"Amp",droid:"Droid",gemini:"Gemini",copilot:"Copilot",pi:"pi",kimi:"Kimi",qwen:"Qwen"};function xl(e){return xE[e]??e.charAt(0).toUpperCase()+e.slice(1)}const Gl=e=>String(e).padStart(2,"0");function dc(e){return`${e.getFullYear()}-${Gl(e.getMonth()+1)}-${Gl(e.getDate())}`}function wE(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:`${dc(n)} ${Gl(n.getHours())}:${Gl(n.getMinutes())}`}function Fg(e,n=new Date){if(e==="all")return{since:null,until:null};const r=new Date(n.getFullYear(),n.getMonth(),n.getDate());return e==="7d"?r.setDate(r.getDate()-6):e==="30d"?r.setDate(r.getDate()-29):e==="month"&&r.setDate(1),{since:dc(r),until:null}}function Ug(e){const n=new Date(`${e}T00:00:00Z`);return n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+6)%7),n.toISOString().slice(0,10)}function jf(e,n){const r=[],o=new Date(`${e}T00:00:00Z`),l=new Date(`${n}T00:00:00Z`);for(;o<=l&&r.length<3700;)r.push(o.toISOString().slice(0,10)),o.setUTCDate(o.getUTCDate()+1);return r}const kE=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Fd(e){const n=/^(\d{4})-(\d{2})(?:-(\d{2}))?$/.exec(e);if(!n)return e;const r=kE[Number(n[2])-1]??n[2];return n[3]?`${r} ${Number(n[3])}`:`${r} ${n[1]}`}function SE(e,n=Date.now()){const r=Math.max(0,Math.round((n-Date.parse(e))/1e3));if(r<45)return"just now";const o=Math.round(r/60);if(o<60)return`${o} min ago`;const l=Math.round(o/60);return l<24?`${l} h ago`:dc(new Date(e))}const Fr=7,bE=92;function sx(e,n){const r=n.indexOf(e);return r>=0&&r<Fr?r:Fr}function wl(e){return e<Fr?`var(--usage-series-${e+1})`:"var(--usage-series-other)"}function NE(e,n){return jf(Ug(e),Ug(n)).filter((r,o)=>o%7===0)}function TE(e,n){const{daily:r}=e;if(r.length===0)return null;const o=e.window.since??r[0].period,l=r[r.length-1].period,c=e.window.until??(n>l?n:l),d=jf(o,c);if(d.length<2)return null;const f=d.length>bE,h=new Map((f?e.weekly:r).map(y=>[y.period,y])),m=new Map,v=(f?NE(o,c):d).map(y=>{const S=h.get(y),j=new Map;let T=0;for(const A of(S==null?void 0:S.breakdown)??[]){if(A.cost_usd<=0)continue;const $=sx(A.model,e.model_order),P=j.get($)??{slot:$,label:$<Fr?Ef(A.model):"Other",cost:0};P.cost+=A.cost_usd,T+=A.cost_usd,j.set($,P)}const C=((S==null?void 0:S.cost_usd)??0)-T;if(C>.005){const A=j.get(Fr)??{slot:Fr,label:"Other",cost:0};A.cost+=C,j.set(Fr,A)}const b=[...j.values()].sort((A,$)=>A.slot-$.slot);for(const A of b)m.set(A.slot,A.label);return{period:y,label:f?`Week of ${Fd(y)}`:Fd(y),total:b.reduce((A,$)=>A+$.cost,0),segments:b}});if(!v.some(y=>y.total>0))return null;const k=[...m.entries()].sort((y,S)=>y[0]-S[0]).map(([y,S])=>({slot:y,label:S}));return{unit:f?"week":"day",columns:v,series:k}}function CE(e){if(!(e>0))return[0,1];if(e<.01)return[0,.01];const n=e/4,r=10**Math.floor(Math.log10(n)),o=n/r,l=(o<=1?1:o<=2?2:o<=2.5?2.5:o<=5?5:10)*r,c=[];for(let d=0;d*l<e+l*1e-9||c.length<2;d++)c.push(d*l);return c[c.length-1]<e&&c.push(c.length*l),c}function EE(e,n){if(e>=1e4)return`$${To(e)}`;let r=0;for(;r<3&&Math.abs(Math.round(n*10**r)-n*10**r)>1e-9;)r++;return`$${e.toLocaleString("en-US",{minimumFractionDigits:r,maximumFractionDigits:r})}`}const ko=e=>`${e}%`;function jE({data:e}){const{columns:n,series:r,unit:o}=e,[l,c]=x.useState(null),d=x.useMemo(()=>CE(Math.max(...n.map(T=>T.total))),[n]),f=d[d.length-1],h=d[1]-d[0],m=n.reduce((T,C,b)=>C.total>n[T].total?b:T,0),v=Math.max(1,Math.ceil(n.length/8)),k=n.length,y=T=>{const C={ArrowLeft:-1,ArrowRight:1,Home:-k,End:k};T.key in C&&(T.preventDefault(),c(b=>Math.min(k-1,Math.max(0,(b??k-1)+C[T.key]))))},S=l===null?null:n[l],j=l===null?0:(l+.5)/k*100;return a.jsxs("div",{className:"usage-chart",children:[a.jsxs("div",{className:"usage-chart-head",children:[a.jsx("div",{className:"usage-section-title",children:o==="week"?"Weekly cost (USD)":"Daily cost (USD)"}),r.length>=2&&a.jsx("ul",{className:"usage-legend","aria-label":"Models",children:r.map(T=>a.jsxs("li",{className:"usage-legend-item",children:[a.jsx("span",{className:"usage-swatch",style:{background:wl(T.slot)}}),T.label]},T.slot))})]}),a.jsxs("div",{className:"usage-plot-wrap",children:[a.jsx("div",{className:"usage-yaxis","aria-hidden":"true",children:d.map(T=>a.jsx("span",{className:"usage-ytick",style:{bottom:ko(T/f*100)},children:EE(T,h)},T))}),a.jsxs("div",{className:"usage-plot",role:"group",tabIndex:0,"aria-label":`${o==="week"?"Weekly":"Daily"} cost chart. Arrow keys move between ${o}s.`,onKeyDown:y,onFocus:()=>c(T=>T??k-1),onBlur:()=>c(null),onMouseLeave:()=>c(null),children:[d.map(T=>a.jsx("div",{className:`usage-gridline${T===0?" usage-gridline-base":""}`,style:{bottom:ko(T/f*100)}},T)),a.jsx("div",{className:"usage-cols",children:n.map((T,C)=>a.jsxs("div",{className:`usage-col${l===C?" usage-col-active":""}`,"data-period":T.period,onMouseEnter:()=>c(C),children:[C===m&&T.total>0&&l!==C&&a.jsx("span",{className:"usage-peak",style:{bottom:`calc(${ko(T.total/f*100)} + 3px)`},children:es(T.total)}),T.total>0&&a.jsx("div",{className:"usage-bar",style:{height:ko(T.total/f*100)},children:T.segments.map(b=>a.jsx("div",{className:"usage-seg",style:{flexGrow:b.cost,background:wl(b.slot)}},b.slot))})]},T.period))}),S&&a.jsxs("div",{className:"usage-tooltip",role:"status",style:{left:ko(j),transform:j<20?"translateX(-12px)":j>80?"translateX(calc(-100% + 12px))":"translateX(-50%)"},children:[a.jsxs("div",{className:"usage-tooltip-head",children:[a.jsx("span",{children:S.label}),a.jsx("strong",{children:es(S.total)})]}),S.segments.length===0&&a.jsx("div",{className:"usage-tooltip-empty",children:"No usage"}),[...S.segments].sort((T,C)=>C.cost-T.cost).map(T=>a.jsxs("div",{className:"usage-tooltip-line",children:[a.jsx("span",{className:"usage-swatch",style:{background:wl(T.slot)}}),a.jsx("span",{className:"usage-tooltip-model",children:T.label}),a.jsx("span",{children:es(T.cost)})]},T.slot))]})]}),a.jsx("div",{}),a.jsx("div",{className:"usage-xaxis","aria-hidden":"true",children:n.map((T,C)=>(k-1-C)%v===0?a.jsx("span",{className:"usage-xtick",style:{left:ko((C+.5)/k*100),transform:C===0&&k>1?"translateX(-30%)":C===k-1?"translateX(-70%)":"translateX(-50%)"},children:Fd(T.period)},T.period):null)})]})]})}const Bg=[{id:"daily",label:"Daily",column:"Date"},{id:"weekly",label:"Weekly",column:"Week"},{id:"monthly",label:"Monthly",column:"Month"},{id:"session",label:"Session",column:"Session"}],_E={weekly:"Weeks start on Monday.",session:"Sessions last active in this range, with their whole usage."},gd=50,RE={input_tokens:0,output_tokens:0,cache_creation_tokens:0,cache_read_tokens:0,total_tokens:0,cost_usd:0};function AE(e){return e.reduce((n,r)=>({input_tokens:n.input_tokens+r.input_tokens,output_tokens:n.output_tokens+r.output_tokens,cache_creation_tokens:n.cache_creation_tokens+r.cache_creation_tokens,cache_read_tokens:n.cache_read_tokens+r.cache_read_tokens,total_tokens:n.total_tokens+r.total_tokens,cost_usd:n.cost_usd+r.cost_usd}),RE)}function vd({t:e}){return a.jsxs(a.Fragment,{children:[a.jsx("td",{className:"usage-num",children:No(e.input_tokens)}),a.jsx("td",{className:"usage-num",children:No(e.output_tokens)}),a.jsx("td",{className:"usage-num",children:No(e.cache_creation_tokens)}),a.jsx("td",{className:"usage-num",children:No(e.cache_read_tokens)}),a.jsx("td",{className:"usage-num",children:No(e.total_tokens)}),a.jsx("td",{className:"usage-num usage-cost",children:es(e.cost_usd)})]})}function IE({models:e,order:n}){return a.jsx("span",{className:"usage-models",children:e.map(r=>a.jsxs("span",{className:"usage-model",title:r,children:[a.jsx("span",{className:"usage-swatch",style:{background:wl(sx(r,n))}}),Ef(r)]},r))})}function DE({row:e,onOpen:n}){const r=e.pane_session;if(!r)return a.jsx("span",{className:"usage-session-id usage-session-id-main",title:e.period,children:e.period});const o=r.title||"Untitled session";return a.jsxs("span",{className:"usage-session",children:[a.jsxs("span",{className:"usage-session-title",children:[a.jsx("button",{className:"usage-session-link",title:`Open "${o}"`,onClick:()=>n(r.id),children:o}),r.kind==="discussion"&&a.jsx("span",{className:"usage-tag",children:"discussion"})]}),a.jsx("span",{className:"usage-session-id",title:e.period,children:e.period})]})}function ME({report:e,onOpenSession:n}){var j;const[r,o]=x.useState("daily"),[l,c]=x.useState(!1),[d,f]=x.useState(!1),h=r==="session",m=h?e.sessions:e[r],v=h&&!d?m.slice(0,gd):m,k=h?AE(e.sessions):e.totals,y=h?10:9,S=_E[r];return a.jsxs("div",{className:"usage-table-wrap",children:[a.jsxs("div",{className:"usage-table-head",children:[a.jsx("div",{className:"usage-tabs",role:"tablist","aria-label":"Report",children:Bg.map(T=>a.jsx("button",{role:"tab","aria-selected":r===T.id,className:`usage-tab${r===T.id?" usage-tab-active":""}`,onClick:()=>o(T.id),children:T.label},T.id))}),S&&a.jsx("span",{className:"usage-table-note",children:S}),a.jsxs("label",{className:"usage-check",title:"One line per agent and model, like ccusage --breakdown",children:[a.jsx("input",{type:"checkbox",checked:l,onChange:T=>c(T.target.checked)}),"Breakdown"]})]}),a.jsx("div",{className:"usage-table-scroll",role:"tabpanel",children:a.jsxs("table",{className:"usage-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:(j=Bg.find(T=>T.id===r))==null?void 0:j.column}),a.jsx("th",{children:"Agent"}),a.jsx("th",{children:"Models"}),a.jsx("th",{className:"usage-num",children:"Input"}),a.jsx("th",{className:"usage-num",children:"Output"}),a.jsx("th",{className:"usage-num",children:"Cache Create"}),a.jsx("th",{className:"usage-num",children:"Cache Read"}),a.jsx("th",{className:"usage-num",children:"Total Tokens"}),a.jsx("th",{className:"usage-num",children:"Cost (USD)"}),h&&a.jsx("th",{children:"Last Activity"})]})}),a.jsxs("tbody",{children:[m.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:y,className:"usage-empty",children:"No usage in this range."})}),v.map(T=>{const C=h?T:null;return a.jsxs(x.Fragment,{children:[a.jsxs("tr",{className:"usage-row",children:[a.jsx("td",{className:"usage-period",children:C?a.jsx(DE,{row:C,onOpen:n}):T.period}),a.jsx("td",{children:C?xl(C.agent):T.agents.map(xl).join(", ")}),a.jsx("td",{children:a.jsx(IE,{models:T.models,order:e.model_order})}),a.jsx(vd,{t:T}),C&&a.jsx("td",{className:"usage-when",children:C.last_activity?wE(C.last_activity):"—"})]}),l&&T.breakdown.map(b=>a.jsxs("tr",{className:"usage-sub",children:[a.jsx("td",{}),a.jsx("td",{children:xl(b.agent)}),a.jsxs("td",{title:b.model,children:[a.jsx("span",{className:"usage-branch",children:"└─"})," ",Ef(b.model)]}),a.jsx(vd,{t:b}),C&&a.jsx("td",{})]},`${b.agent}\0${b.model}`))]},T.period)})]}),m.length>0&&a.jsx("tfoot",{children:a.jsxs("tr",{className:"usage-total",children:[a.jsx("td",{children:"Total"}),a.jsx("td",{}),a.jsx("td",{}),a.jsx(vd,{t:k}),h&&a.jsx("td",{})]})})]})}),h&&m.length>gd&&a.jsx("button",{className:"usage-more",onClick:()=>f(T=>!T),children:d?`Show the top ${gd}`:`Show all ${m.length} sessions`})]})}const rx="agentpane:usage-budget",LE=6e4;function OE(){try{const e=Number(localStorage.getItem(rx));return Number.isFinite(e)&&e>0?e:0}catch{return 0}}function $E(e){try{localStorage.setItem(rx,String(e))}catch{}}function PE(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function kl({label:e,value:n,title:r,children:o}){return a.jsxs("div",{className:"usage-kpi",children:[a.jsx("div",{className:"usage-kpi-label",children:e}),a.jsx("div",{className:"usage-kpi-value",title:r,children:n}),o]})}function zE({spent:e}){const[n,r]=x.useState(OE),o=n>0?e/n:0,l=o>=1?"over":o>=.8?"near":"ok",c=d=>{const f=Number(d.replace(",",".")),h=Number.isFinite(f)&&f>0?f:0;r(h),$E(h)};return a.jsxs(kl,{label:"This month",value:es(e),children:[n>0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:`usage-meter usage-meter-${l}`,role:"meter","aria-label":"Monthly budget used","aria-valuemin":0,"aria-valuemax":n,"aria-valuenow":Math.min(e,n),children:a.jsx("div",{className:"usage-meter-fill",style:{width:`${Math.min(100,o*100)}%`}})}),a.jsx("div",{className:`usage-kpi-sub${l==="over"?" usage-over":""}`,children:l==="over"?a.jsxs(a.Fragment,{children:[a.jsx(nc,{size:11})," ",es(e-n)," over the ",es(n)," budget"]}):`${es(n-e)} left of ${es(n)}`})]}):a.jsx("div",{className:"usage-kpi-sub",children:"No monthly budget set"}),a.jsxs("div",{className:"usage-budget",children:[a.jsx("label",{htmlFor:"usage-budget-input",children:"Monthly budget (USD)"}),a.jsx("input",{id:"usage-budget-input",type:"number",min:"0",step:"1",defaultValue:n>0?n:"",placeholder:"none",onBlur:d=>c(d.target.value),onKeyDown:d=>{d.key==="Enter"&&c(d.currentTarget.value)}})]})]})}const FE=(e,n)=>e.since===n.since&&e.until===n.until;function UE(){const e=R($=>$.toggleUsageView),n=R($=>$.selectSession),[r,o]=x.useState("30d"),[l,c]=x.useState(null),[d,f]=x.useState(null),[h,m]=x.useState(!1),v=x.useMemo(PE,[]),k=x.useRef(0),y=x.useCallback($=>{const P=++k.current,{since:z,until:G}=Fg(r),M=async F=>{const Z=await vE({since:z,until:G,timezone:v,fresh:F});P===k.current&&(c(Z),f(null),!F&&Z.generated_at&&Date.now()-Date.parse(Z.generated_at)>LE&&await M(!0))};m(!0),M($).catch(F=>{P===k.current&&f(F.message)}).finally(()=>{P===k.current&&m(!1)})},[r,v]);x.useEffect(()=>{y(!1)},[y]),x.useEffect(()=>()=>{k.current++},[]);const S=$=>{e(),n($)},j=dc(new Date),T=x.useMemo(()=>l?TE(l,j):null,[l,j]),C=h&&l!==null&&!FE(l.window,Fg(r)),b=l==null?void 0:l.totals,A=l&&l.daily.length>0?jf(l.window.since??l.daily[0].period,l.window.until??j).length:0;return a.jsxs("div",{className:"usage-view",children:[a.jsxs("div",{className:"usage-header",children:[a.jsxs("div",{className:"usage-title",children:[a.jsx(zv,{size:18})," Usage Center"]}),a.jsxs("div",{className:"usage-controls",children:[yE.map($=>a.jsx("button",{className:`usage-range-btn${r===$.id?" usage-range-btn-active":""}`,"aria-pressed":r===$.id,onClick:()=>o($.id),children:$.label},$.id)),a.jsx("button",{className:"usage-range-btn usage-refresh",onClick:()=>y(!0),title:"Read the logs again (runs ccusage)","aria-label":"Refresh",children:a.jsx(Mm,{size:13,className:h?"spin":void 0})}),a.jsx("button",{className:"dialog-close",title:"Close usage view","aria-label":"Close usage view",onClick:e,children:a.jsx(Nn,{size:16})})]})]}),d&&a.jsxs("div",{className:"usage-error",children:["Could not load usage data: ",d]}),!l&&!d&&a.jsxs("div",{className:"usage-loading",children:[a.jsx(Mm,{size:14,className:"spin"})," Reading the Claude Code and Codex logs with ccusage…"]}),l&&b&&a.jsxs("div",{className:`usage-body${C?" usage-body-stale":""}`,"aria-busy":h,children:[l.source.ccusage_error&&a.jsxs("div",{className:"usage-warning",role:"alert",children:[a.jsx(nc,{size:13}),a.jsxs("span",{children:["ccusage could not read the Claude Code and Codex logs, so only Repoburg calls are counted:"," ",l.source.ccusage_error]})]}),a.jsxs("div",{className:"usage-kpis",children:[a.jsx(kl,{label:"Cost (USD)",value:es(b.cost_usd),children:a.jsx("div",{className:"usage-kpi-sub",children:l.by_agent.length===0?"No usage in this range":l.by_agent.map($=>`${xl($.agent)} ${es($.cost_usd)}`).join(" · ")})}),a.jsx(zE,{spent:l.month_to_date_cost_usd}),a.jsxs(kl,{label:"Total tokens",value:To(b.total_tokens),title:`${No(b.total_tokens)} tokens`,children:[a.jsxs("div",{className:"usage-kpi-sub",children:["Input ",To(b.input_tokens)," · Output ",To(b.output_tokens)]}),a.jsxs("div",{className:"usage-kpi-sub",children:["Cache Create ",To(b.cache_creation_tokens)," · Cache Read"," ",To(b.cache_read_tokens)]})]}),a.jsx(kl,{label:"Daily average",value:A>0?es(b.cost_usd/A):"—",children:a.jsx("div",{className:"usage-kpi-sub",children:A>0?`over ${A} ${A===1?"day":"days"} · ${l.daily.length} with usage`:"No usage in this range"})})]}),T&&a.jsx(jE,{data:T}),a.jsx(ME,{report:l,onOpenSession:S}),l.unpriced_models.length>0&&a.jsxs("div",{className:"usage-note",children:["No price for these Repoburg models, counted as $0: ",l.unpriced_models.join(", ")]}),a.jsxs("div",{className:"usage-source",children:["Claude Code and Codex costs by"," ",a.jsx("a",{href:"https://github.com/ryoppippi/ccusage",target:"_blank",rel:"noreferrer",children:"ccusage"}),l.source.ccusage_version?` ${l.source.ccusage_version}`:""," with LiteLLM prices · Repoburg calls priced by AgentPane · days in ",l.timezone,l.generated_at&&` · logs read ${SE(l.generated_at)}`]})]})]})}const Wg="claude auth login";function BE(){const e=R(f=>Object.keys(f.signedOutTurns).length),n=R(f=>f.terminalViewOpen),r=R(f=>f.toggleTerminalView),o=R(f=>f.addToast),[l,c]=x.useState(!1);if(e===0)return null;const d=()=>{c(!0),N0().catch(f=>o("error",`Could not resume the turns — ${js(f)}`)).finally(()=>c(!1))};return a.jsxs("div",{className:"signed-out-band",role:"status",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(M1,{size:12})}),a.jsxs("span",{className:"banner-text",children:["Claude is signed out — ",e===1?"1 turn is":`${e} turns are`," waiting. Run"," ",a.jsx("code",{children:Wg})," in a terminal, then resume."]}),a.jsxs("button",{type:"button",className:"banner-action",onClick:()=>void Bi(Wg),children:[a.jsx(Pi,{size:12}),"Copy"]}),!n&&a.jsxs("button",{type:"button",className:"banner-action",onClick:r,children:[a.jsx(qv,{size:12}),"Open terminal"]}),a.jsxs("button",{type:"button",className:"banner-action",onClick:d,disabled:l,children:[a.jsx(Kv,{size:12}),e===1?"Resume turn":"Resume turns"]})]})}const Hg=/^[a-f0-9]{64}\.(?:png|jpg|gif|webp)$/,WE=/^(?:https?:\/\/[^/?#]+)?\/api\/apps\/([^/?#]+)\/files\/([^/?#]+)$/i,HE={png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp"};function ox(){return bt()||window.location.origin}function ix(e,n){let r=n;if(r&&typeof r=="object"){const d=r;r=typeof d.id=="string"?d.id:d.url}if(typeof r!="string")return null;const o=r.trim();if(Hg.test(o))return o;const l=WE.exec(o);if(!l)return null;let c;try{c=decodeURIComponent(l[1])}catch{return null}return c===e&&Hg.test(l[2])?l[2]:null}function Vg(e){return/^https?:\/\//i.test(e.url)?e:{...e,url:`${ox()}${e.url}`}}function VE(e){return HE[e.slice(e.lastIndexOf(".")+1)]??"application/octet-stream"}function ax(e){return new Promise((n,r)=>{const o=new FileReader;o.onload=()=>{const l=String(o.result??"");n(l.slice(l.indexOf(",")+1))},o.onerror=()=>r(o.error??new Error("Could not read the file")),o.readAsDataURL(e)})}function KE(e,n){const r=/^data:([^;,]*)(?:;[^;,]*)*;base64,/i.exec(e);return r?{type:n||r[1]||void 0,data:e.slice(r[0].length)}:{type:n,data:e}}async function lx(e){if(e instanceof Blob){const n=e.name;return{name:typeof n=="string"&&n?n:void 0,type:e.type||void 0,data:await ax(e)}}if(e&&typeof e=="object"&&typeof e.data=="string"){const n=e;return{name:typeof n.name=="string"&&n.name?n.name:void 0,type:typeof n.type=="string"&&n.type?n.type:void 0,data:n.data}}return null}async function GE(e){const n=await lx(e);if(!n)throw new Error("uploadFile: expected a Blob/File or { name, type, data }");return n}async function qE(e,n,r){if(n==null)return[];if(!Array.isArray(n))throw new Error("submitTurn: attachments must be an array");const o=[];for(let l=0;l<n.length;l++){const c=n[l],d=await lx(c);if(d){const{type:m,data:v}=KE(d.data,d.type);if(!m)throw new Error(`submitTurn: attachment ${l+1} has no type`);o.push({name:d.name??`attachment-${l+1}`,media_type:m,data:v});continue}const f=ix(e,c);if(!f)throw new Error(`submitTurn: attachment ${l+1} is not a file of this app`);const h=await r(f);o.push({name:f,media_type:VE(f),data:await ax(h)})}return o}const XE=`function (config) {
699
+ var nextId = 1;
700
+ var pending = new Map();
701
+ var listeners = [];
702
+ // Absolute http(s) URL, or null. Relative and #fragment hrefs are not
703
+ // external and keep their in-frame behavior.
704
+ function externalUrl(raw) {
705
+ if (typeof raw !== 'string' || !/^\\s*https?:\\/\\//i.test(raw)) return null;
706
+ try { return new URL(raw.trim()).href; } catch (err) { return null; }
707
+ }
708
+ // New browser tab. The sandbox lets popups escape it, so the page loads
709
+ // like any other tab; noopener leaves it no handle back to this frame.
710
+ function openTab(url) {
711
+ window.open(url, '_blank', 'noopener,noreferrer');
712
+ }
713
+ // A plain external link would navigate THIS frame: the app disappears and
714
+ // most sites refuse to be framed anyway. Open it in a new tab instead.
715
+ // Bubble phase on window, so the app's own handlers run first and can
716
+ // still claim the click with preventDefault(). Modifier clicks and
717
+ // target="_blank" links already open a tab natively.
718
+ window.addEventListener('click', function (e) {
719
+ if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
720
+ var a = e.target && e.target.closest ? e.target.closest('a[href]') : null;
721
+ if (!a) return;
722
+ var target = (a.getAttribute('target') || '').toLowerCase();
723
+ if (target && target !== '_self' && target !== '_parent' && target !== '_top') return;
724
+ var url = externalUrl(a.getAttribute('href'));
725
+ if (!url) return;
726
+ e.preventDefault();
727
+ openTab(url);
728
+ });
729
+ // Stored files: <apiOrigin>/api/apps/<app-id>/files/<id>. Same reference
730
+ // rules as the pane (utils/appFiles.ts): an id, a file URL of this app on
731
+ // any origin, or an object carrying id/url.
732
+ var FILE_ID_RE = /^[a-f0-9]{64}\\.(?:png|jpg|gif|webp)$/;
733
+ var FILE_URL_RE = /^(?:https?:\\/\\/[^\\/?#]+)?\\/api\\/apps\\/([^\\/?#]+)\\/files\\/([^\\/?#]+)$/i;
734
+ function fileRefId(ref) {
735
+ if (ref && typeof ref === 'object') ref = typeof ref.id === 'string' ? ref.id : ref.url;
736
+ if (typeof ref !== 'string') return null;
737
+ var s = ref.trim();
738
+ if (FILE_ID_RE.test(s)) return s;
739
+ var m = FILE_URL_RE.exec(s);
740
+ if (!m) return null;
741
+ var owner;
742
+ try { owner = decodeURIComponent(m[1]); } catch (err) { return null; }
743
+ return owner === config.appId && FILE_ID_RE.test(m[2]) ? m[2] : null;
744
+ }
745
+ function fileUrl(ref) {
746
+ var id = fileRefId(ref);
747
+ if (!id) return typeof ref === 'string' ? ref : '';
748
+ return config.apiOrigin + '/api/apps/' + encodeURIComponent(config.appId) + '/files/' + id;
749
+ }
750
+ window.addEventListener('message', function (e) {
751
+ var msg = e.data;
752
+ if (!msg || msg.source !== 'agentpane-host') return;
753
+ if (msg.id != null && pending.has(msg.id)) {
754
+ var p = pending.get(msg.id);
755
+ pending.delete(msg.id);
756
+ if (msg.ok) {
757
+ p.resolve(msg.result);
758
+ } else {
759
+ var err = new Error(msg.error || 'bridge error');
760
+ // code 'conflict': setState's ifVersion is stale; state = the stored copy.
761
+ if (msg.code) err.code = msg.code;
762
+ if (msg.state) err.state = msg.state;
763
+ p.reject(err);
764
+ }
765
+ } else if (msg.event) {
766
+ for (var i = 0; i < listeners.length; i++) {
767
+ try { listeners[i](msg.event, msg.payload); } catch (err) { /* app error */ }
768
+ }
769
+ }
770
+ });
771
+ function call(method, params) {
772
+ return new Promise(function (resolve, reject) {
773
+ var id = nextId++;
774
+ pending.set(id, { resolve: resolve, reject: reject });
775
+ try {
776
+ parent.postMessage({ source: 'agentpane-app', id: id, method: method, params: params || null }, '*');
777
+ } catch (err) {
778
+ // Params that cannot be cloned (functions, DOM nodes, ...).
779
+ pending.delete(id);
780
+ reject(err);
781
+ }
782
+ });
783
+ }
784
+ window.AgentPane = {
785
+ getApp: function () { return call('getApp'); },
786
+ getState: function () { return call('getState'); },
787
+ setState: function (data, opts) {
788
+ var params = { data: data };
789
+ if (opts && typeof opts.ifVersion === 'number') params.ifVersion = opts.ifVersion;
790
+ return call('setState', params);
791
+ },
792
+ createSession: function (opts) { return call('createSession', opts); },
793
+ submitTurn: function (sessionId, prompt, opts) {
794
+ var params = { sessionId: sessionId, prompt: prompt };
795
+ if (opts && opts.attachments != null) params.attachments = opts.attachments;
796
+ return call('submitTurn', params);
797
+ },
798
+ getSession: function (sessionId) { return call('getSession', { sessionId: sessionId }); },
799
+ listSessions: function (opts) {
800
+ var params = {};
801
+ if (opts && (opts.lifecycle === 'working' || opts.lifecycle === 'finished')) params.lifecycle = opts.lifecycle;
802
+ if (opts && typeof opts.running === 'boolean') params.running = opts.running;
803
+ return call('listSessions', params);
804
+ },
805
+ getSessionInfo: function (sessionId) { return call('getSessionInfo', { sessionId: sessionId }); },
806
+ cancelTurn: function (sessionId) { return call('cancelTurn', { sessionId: sessionId }); },
807
+ setSessionLifecycle: function (sessionId, lifecycle) { return call('setSessionLifecycle', { sessionId: sessionId, lifecycle: lifecycle }); },
808
+ callTool: function (tool, args) { return call('callTool', { tool: tool, args: args }); },
809
+ listProviders: function () { return call('listProviders'); },
810
+ listModels: function (runtime, cwd) { return call('listModels', { runtime: runtime, cwd: cwd }); },
811
+ pickDirectory: function () { return call('pickDirectory'); },
812
+ onTurnCompleted: function (cb) { listeners.push(function (event, payload) { if (event === 'turn:completed' || event === 'turn:failed') cb(event, payload); }); },
813
+ onTurnDelta: function (cb) { listeners.push(function (event, payload) { if (event === 'turn:delta' && payload) cb(payload); }); },
814
+ onToolCall: function (cb) { listeners.push(function (event, payload) { if (event === 'tool_call' && payload) cb(payload); }); },
815
+ onStateChanged: function (cb) { listeners.push(function (event, payload) { if (event === 'state_changed') cb(payload || {}); }); },
816
+ onBackgroundTasks: function (cb) { listeners.push(function (event, payload) { if (event === 'background_tasks' && payload) cb(payload); }); },
817
+ resolveToolCall: function (callId, result) { return call('resolveToolCall', { callId: callId, result: result }); },
818
+ openSession: function (sessionId) { return call('openSession', { sessionId: sessionId }); },
819
+ openUrl: function (url) {
820
+ var href = externalUrl(url);
821
+ if (!href) return Promise.reject(new Error('openUrl: expected an absolute http(s) URL, got ' + JSON.stringify(url)));
822
+ try { openTab(href); } catch (err) { return Promise.reject(err); }
823
+ return Promise.resolve({ ok: true });
824
+ },
825
+ uploadFile: function (file) { return call('uploadFile', { file: file }); },
826
+ getFile: function (ref) { return call('getFile', { ref: ref }); },
827
+ fileUrl: fileUrl
828
+ };
829
+ // Runtime error reporting — surface compile checks' blind side to the pane.
830
+ window.addEventListener('error', function (e) {
831
+ parent.postMessage({
832
+ source: 'agentpane-app', report: 'error',
833
+ message: e.message || 'Unknown error',
834
+ stack: (e.error && e.error.stack) || '',
835
+ line: e.lineno || 0, col: e.colno || 0
836
+ }, '*');
837
+ });
838
+ window.addEventListener('unhandledrejection', function (e) {
839
+ var r = e.reason;
840
+ var msg = r && (r.message || String(r)) || 'unknown';
841
+ parent.postMessage({
842
+ source: 'agentpane-app', report: 'error',
843
+ message: 'Unhandled promise rejection: ' + msg,
844
+ stack: (r && r.stack) || '', line: 0, col: 0
845
+ }, '*');
846
+ });
847
+ }`;function YE(e){return`(${XE})(${JSON.stringify(e)});`}function Kg(e){return e.replace(/<\/script/gi,"<\\/script")}function QE(e,n){const r=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(r,"gi");let l=-1,c;for(;(c=o.exec(e))!==null;)l=c.index;return l}function Gg(e,n,r){const o=QE(e,n);return o===-1?e+r:e.slice(0,o)+r+e.slice(o)}function ZE(e,n,r){let o=e;const l=`<script>${Kg(n)}<\/script>`;if(/<\/head>/i.test(o)?o=Gg(o,"</head>",l):/<html[^>]*>/i.test(o)?o=o.replace(/(<html[^>]*>)/i,`$1<head>${l}</head>`):o=`${l}${o}`,r){const c=`<script>${Kg(r)}<\/script>`;o=Gg(o,"</body>",c)}return o}function JE(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?`tab-${e.randomUUID()}`:`tab-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function ej(e){var r;if(!(e instanceof Do)||e.status!==409)return null;const n=(r=e.body)==null?void 0:r.state;return n&&typeof n=="object"?n:null}function tj({appId:e,workspace:n=""}){const r=x.useRef(null),o=x.useRef({pinned:!1,data:null}),[l,c]=x.useState(null),[d,f]=x.useState(null),[h,m]=x.useState([]);x.useEffect(()=>{let S=!0;const j=JE(),T=b=>{const A=o.current.version;typeof b.version=="number"&&typeof A=="number"&&b.version<A||(o.current=b)};V0(e,b=>{var A,$;return($=(A=r.current)==null?void 0:A.contentWindow)==null?void 0:$.postMessage(b,"*")},n);const C=async b=>{var M,F,Z,Q,J,he,ke,re,ve,le,ee,X,ie,K,E,L,de,U,me,Y,xe,we,Me,_e;if(b.source!==((M=r.current)==null?void 0:M.contentWindow))return;const A=b.data;if(!A||A.source!=="agentpane-app")return;if(A.report==="error"){const ge={message:String(A.message??"Unknown error"),stack:String(A.stack??"")};m(pe=>{const Xe=pe[pe.length-1];return Xe&&Xe.message===ge.message?pe:[...pe,ge].slice(-20)});return}if(typeof A.method!="string")return;let $=!0,P,z,G=null;try{switch(A.method){case"getApp":P={id:e,workspace:n};break;case"getState":try{const ge=await Cm(e,n);T(ge),P=ge}catch{P=o.current}break;case"setState":{const ge=((F=A.params)==null?void 0:F.data)??null,pe=(Z=A.params)==null?void 0:Z.ifVersion,Xe={data:ge,writer:j};typeof pe=="number"&&(Xe.ifVersion=pe);try{const Re=await Cv(e,Xe,n);T(Re),P=Re}catch(Re){if(G=ej(Re),!G)throw Re;T(G);const at=Re.body;throw new Error(typeof(at==null?void 0:at.error)=="string"?at.error:"App state changed since that version")}break}case"createSession":{const ge=A.params??{},pe=await Kd({title:typeof ge.title=="string"?ge.title:void 0,runtime_type:typeof ge.runtime_type=="string"?ge.runtime_type:void 0,model:typeof ge.model=="string"?ge.model:void 0,model_reasoning_effort:typeof ge.model_reasoning_effort=="string"?ge.model_reasoning_effort:void 0,cwd:typeof ge.cwd=="string"?ge.cwd:void 0,origin_app_id:e,origin_app_workspace:n});fl(pe.id,e),R.getState().addSession(pe),P=pe;break}case"submitTurn":{const ge=String(((Q=A.params)==null?void 0:Q.sessionId)??"");if(!await Em(e,ge))throw new Error(`submitTurn: ${ge} is not a session of this app`);const pe=String(((J=A.params)==null?void 0:J.prompt)??""),Xe=await qE(e,(he=A.params)==null?void 0:he.attachments,at=>Zk(e,at)),Re=await uv(ge,pe,Xe.length?Xe:void 0,{originAppId:e});fl(ge,e),P=Re;break}case"getSession":{P=await Em(e,String(((ke=A.params)==null?void 0:ke.sessionId)??""));break}case"listSessions":{const ge=(re=A.params)==null?void 0:re.lifecycle,pe=(ve=A.params)==null?void 0:ve.running;P=await Pk(e,n,{lifecycle:ge==="working"||ge==="finished"?ge:void 0,running:typeof pe=="boolean"?pe:void 0});break}case"getSessionInfo":{P=await zk(e,n,String(((le=A.params)==null?void 0:le.sessionId)??""));break}case"cancelTurn":{P=await Fk(e,String(((ee=A.params)==null?void 0:ee.sessionId)??""));break}case"setSessionLifecycle":{P=await Uk(e,String(((X=A.params)==null?void 0:X.sessionId)??""),String(((ie=A.params)==null?void 0:ie.lifecycle)??""));break}case"callTool":{const ge=(K=A.params)==null?void 0:K.args;P=await Bk(e,n,String(((E=A.params)==null?void 0:E.tool)??""),ge&&typeof ge=="object"?ge:{});break}case"listProviders":{P=await Qy();break}case"listModels":{const ge=typeof((L=A.params)==null?void 0:L.runtime)=="string"?A.params.runtime.trim():"";if(!ge)throw new Error("listModels: runtime is required");const pe=(de=A.params)==null?void 0:de.cwd;P=await bv(ge,typeof pe=="string"&&pe?pe:void 0);break}case"pickDirectory":{if(R.getState().activeAppTabId!==e)throw new Error("pickDirectory: the app is not on screen — call it from a click in the app");P=await fv();break}case"resolveToolCall":{const ge=String(((U=A.params)==null?void 0:U.callId)??""),pe=(me=A.params)==null?void 0:me.result;await qk(ge,pe),P={ok:!0};break}case"openSession":{if(R.getState().activeAppTabId!==e)throw new Error("openSession: the app is not on screen — call it from a click in the app");const ge=typeof((Y=A.params)==null?void 0:Y.sessionId)=="string"?A.params.sessionId.trim():"";if(!ge)throw new Error("openSession: sessionId is required");try{await R.getState().revealSession(ge)}catch(pe){throw new Error(`openSession: ${pe instanceof Error?pe.message:String(pe)}`)}P={ok:!0};break}case"uploadFile":{const ge=await GE((xe=A.params)==null?void 0:xe.file);try{P=Vg(await Yk(e,ge))}catch(pe){throw new Error(`uploadFile: ${pe instanceof Error?pe.message:String(pe)}`)}break}case"getFile":{const ge=ix(e,(we=A.params)==null?void 0:we.ref),pe=ge?await Qk(e,ge):null;P=pe?Vg(pe):null;break}default:throw new Error(`Unknown bridge method: ${A.method}`)}}catch(ge){$=!1,z=ge instanceof Error?ge.message:String(ge)}(_e=(Me=r.current)==null?void 0:Me.contentWindow)==null||_e.postMessage(G?{source:"agentpane-host",id:A.id,ok:$,error:z,code:"conflict",state:G}:{source:"agentpane-host",id:A.id,ok:$,result:P,error:z},"*")};return window.addEventListener("message",C),Z0(e,b=>{var A,$;typeof b.workspace=="string"&&b.workspace!==n||b.writer!==j&&(($=(A=r.current)==null?void 0:A.contentWindow)==null||$.postMessage({source:"agentpane-host",event:"state_changed",payload:typeof b.version=="number"?{version:b.version}:{}},"*"))}),Y0(e,()=>{Tm(e).then(b=>{S&&(c(b),m([]))}).catch(()=>{})}),(async()=>{try{const[b,A,$]=await Promise.all([Tm(e),Cm(e,n),$k(e).catch(()=>[])]);if(!S)return;o.current=A,$.forEach(P=>fl(P.id,e)),c(b)}catch(b){S&&f(b instanceof Error?b.message:String(b))}})(),()=>{S=!1,K0(e),Q0(e),J0(e),window.removeEventListener("message",C)}},[e,n]),x.useEffect(()=>{l&&G0(e,l.manifest.headlessSessions===!0)},[e,l]);const v=x.useMemo(()=>l?ZE(l.html,YE({appId:e,apiOrigin:ox()}),l.js):"",[l,e]);if(d)return a.jsxs("div",{className:"empty-state",style:{padding:"24px"},children:["Mini app failed to load: ",d]});if(!v)return a.jsx("div",{className:"empty-state",style:{padding:"24px"},children:"Loading mini app…"});const k=(l==null?void 0:l.diagnostics)??[],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,j)=>a.jsxs("div",{className:"miniapp-diag",children:[S.file,":",S.line,":",S.column," — ",S.message]},j))]}),a.jsx("iframe",{ref:r,className:"miniapp-frame",sandbox:"allow-scripts allow-popups allow-popups-to-escape-sandbox",allow:"loopback-network; local-network; local-network-access",title:`Mini app: ${e}`,srcDoc:v}),h.length>0&&a.jsx("div",{className:"miniapp-rt-errors","data-testid":"miniapp-rt-errors",children:h.map((S,j)=>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})]},j))})]})}function nj({appId:e,active:n}){const r=R(y=>y.apps),o=R(y=>y.workspaces),l=R(y=>y.appWorkspaces),c=R(y=>y.setAppWorkspace),d=R(y=>y.setActiveAppTab),f=R(y=>y.startAppEdit),h=r.find(y=>y.id===e),m=l[e]??"",v=o.filter(y=>y.deleted!==1),k=m!==""&&!v.some(y=>y.path===m)?m:null;return a.jsxs("div",{className:`miniapp-view ${n?"":"miniapp-view-hidden"}`,children:[a.jsxs("div",{className:"miniapp-header",children:[a.jsx(Lo,{iconNode:h==null?void 0:h.iconNode,size:14,className:"miniapp-header-icon"}),a.jsx("span",{className:"miniapp-header-title",children:(h==null?void 0:h.title)??e}),a.jsxs("select",{className:"miniapp-workspace-select",title:"Workspace this app instance is bound to (state and pinning are scoped per workspace)",value:m,onChange:y=>c(e,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 f(e),children:[a.jsx(q1,{size:13}),"Edit"]}),a.jsx("button",{className:"miniapp-header-close",title:"Close app",onClick:()=>d(null),children:a.jsx(Nn,{size:14})})]}),a.jsx("div",{className:"miniapp-body",children:a.jsx(tj,{appId:e,workspace:m},`${e}:${m}`)})]})}function sj({side:e,minWidth:n,maxWidth:r,getWidth:o,setWidth:l}){const[c,d]=x.useState(!1),f=x.useRef(0),h=x.useRef(0),m=x.useCallback(y=>{const S=y.clientX-f.current,j=e==="left"?h.current+S:h.current-S,T=Math.min(r,Math.max(n,j));l(T)},[e,n,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,j;y.preventDefault(),y.stopPropagation();try{(j=(S=y.currentTarget)==null?void 0:S.setPointerCapture)==null||j.call(S,y.pointerId)}catch{}f.current=y.clientX,h.current=o(),d(!0),document.body.classList.add("is-resizing"),window.addEventListener("pointermove",m),window.addEventListener("pointerup",v)},[o,m,v]),dragging:c}}function qg({side:e,minWidth:n,maxWidth:r,getWidth:o,setWidth:l}){const{onPointerDown:c,dragging:d}=sj({side:e,minWidth:n,maxWidth:r,getWidth:o,setWidth:l});return a.jsx("div",{className:`resize-handle ${e}${d?" dragging":""}`,onPointerDown:c,role:"separator","aria-orientation":"vertical","aria-label":`Resize ${e} panel`,"data-resizing":d?"":void 0})}const rj=x.lazy(()=>m1(()=>import("./TerminalView-D3fkOngy.js"),__vite__mapDeps([0,1])));function oj(){zt.trackRender("IdeWorkspace");const e=R(S=>S.sidebarWidth),n=R(S=>S.rightPanelWidth),r=R(S=>S.setSidebarWidth),o=R(S=>S.setRightPanelWidth),l=R(S=>S.rightPanelCollapsed),c=R(S=>S.vscodeViewOpen),d=R(S=>S.usageViewOpen),f=R(S=>S.terminalViewOpen),[h,m]=x.useState(!1);f&&!h&&m(!0);const v=R(S=>S.activeAppTabId),k=R(S=>S.openAppTabs);x.useEffect(()=>{const S=()=>{const j=Tl(),{rightPanelWidth:T,setRightPanelWidth:C}=R.getState();T>j&&C(j)};return window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const y=l?`${e}px 6px 1fr ${Rk}px`:`${e}px 6px 1fr 6px ${n}px`;return a.jsxs("div",{className:"ide-root",children:[a.jsx(BE,{}),a.jsxs("div",{className:`ide-layout ${c||d||f?"ide-hidden":""}`,style:{gridTemplateColumns:y},children:[a.jsx(rN,{}),a.jsx(qg,{side:"left",minWidth:kd,maxWidth:Sd,getWidth:()=>R.getState().sidebarWidth,setWidth:r}),a.jsxs("div",{className:"ide-center",children:[a.jsx(aN,{}),a.jsxs("div",{className:"ide-render",children:[k.map(S=>a.jsx(nj,{appId:S,active:v===S},S)),v==null&&a.jsx(wC,{})]}),a.jsx(AC,{})]}),!l&&a.jsx(qg,{side:"right",minWidth:Nl,maxWidth:Tl(),getWidth:()=>R.getState().rightPanelWidth,setWidth:o}),a.jsx(JC,{})]}),c&&a.jsx(gE,{}),d&&a.jsx(UE,{}),h&&a.jsx(x.Suspense,{fallback:null,children:a.jsx(rj,{visible:f})}),a.jsx(dE,{})]})}function ij(){var z,G;const{showNewSessionDialog:e,setShowNewSessionDialog:n,createSession:r,lastModelConfig:o}=R(),l=(o==null?void 0:o.provider)??"codex",c=(o==null?void 0:o.model)??"",d=(o==null?void 0:o.reasoning)??"",[f,h]=x.useState(""),[m,v]=x.useState(c),[k,y]=x.useState(d),[S,j]=x.useState(""),{models:T}=nx(e?l:null);if(!e)return null;const C=M=>T.find(F=>F.slug===M),b=m?((z=C(m))==null?void 0:z.reasoningLevels)??[]:[];function A(){r({title:f.trim()||void 0,model:m||void 0,model_reasoning_effort:k||void 0,cwd:S.trim()||void 0,runtime_type:l}),h(""),j("")}function $(M){M.key==="Escape"&&n(!1)}function P(M){var Q,J,he;v(M);const F=((Q=C(M))==null?void 0:Q.reasoningLevels)??[];F.some(ke=>ke.effort===k)||y(((J=C(M))==null?void 0:J.defaultReasoning)??((he=F[0])==null?void 0:he.effort)??"")}return a.jsx("div",{className:"dialog-overlay",onClick:()=>n(!1),children:a.jsxs("div",{className:"dialog",onClick:M=>M.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:()=>n(!1),children:a.jsx(Nn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[a.jsxs("label",{className:"dialog-label",children:["Title (optional)",a.jsx("input",{className:"dialog-input",type:"text",value:f,onChange:M=>h(M.target.value),placeholder:"e.g. refactor auth module",autoFocus:!0})]}),a.jsxs("label",{className:"dialog-label",children:["Model",a.jsxs("select",{className:"dialog-input dialog-select",value:m,onChange:M=>P(M.target.value),children:[a.jsx("option",{value:"",children:"Default (Codex picks)"}),T.map(M=>a.jsxs("option",{value:M.slug,children:[M.displayName," — ",M.description]},M.slug))]})]}),b.length>0&&a.jsxs("label",{className:"dialog-label",children:["Thinking Level",a.jsxs("select",{className:"dialog-input dialog-select",value:k,onChange:M=>y(M.target.value),children:[a.jsxs("option",{value:"",children:["Default (",(G=C(m))==null?void 0:G.defaultReasoning,")"]}),b.map(M=>a.jsx("option",{value:M.effort,children:M.label},M.effort))]})]}),a.jsxs("label",{className:"dialog-label",children:["Working Directory (optional)",a.jsx("input",{className:"dialog-input",type:"text",value:S,onChange:M=>j(M.target.value),placeholder:"e.g. /Users/me/projects/my-app"})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:()=>n(!1),children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:A,children:"Create"})]})]})})}function aj(e,n){const r=n!==""&&(e===n||e.startsWith(`${n}/`)),o=[r?{label:"~",path:n}:{label:"/",path:"/"}],l=e.slice(r?n.length:0);let c=o[0].path;for(const d of l.split("/").filter(Boolean))c=c==="/"?`/${d}`:`${c}/${d}`,o.push({label:d,path:c});return o}function lj(e){const n=e.filter(l=>l.deleted===0).at(-1);if(!n)return;const r=vr(n.path),o=r.lastIndexOf("/");return o>0?r.slice(0,o):void 0}function cj(){return R(n=>n.showAddWorkspaceDialog)?a.jsx(uj,{}):null}function uj(){var M;const e=R(F=>F.setShowAddWorkspaceDialog),n=R(F=>F.workspaces),r=R(F=>F.createWorkspaceAt),o=R(F=>F.addToast),[l,c]=x.useState(null),[d,f]=x.useState(!0),[h,m]=x.useState(null),[v,k]=x.useState(!1),y=x.useRef(0),[S]=x.useState(()=>lj(R.getState().workspaces)),j=x.useRef(null),T=x.useCallback(()=>{v||e(!1)},[v,e]);Mo(T);const C=x.useCallback(async(F,Z=!1)=>{const Q=++y.current;f(!0);let J=null,he=null;try{J=await am(F)}catch(ke){if(he=js(ke),Z&&F)try{J=await am(),he=null}catch(re){he=js(re)}}Q===y.current&&(J&&c(J),m(he),f(!1))},[]);x.useEffect(()=>{C(S,!0)},[C,S]);const b=l==null?void 0:l.path;x.useEffect(()=>{j.current&&(j.current.scrollTop=0)},[b]);const A=new Set(n.filter(F=>F.deleted===0).map(F=>vr(F.path)));async function $(F){if(!v){k(!0),m(null);try{const Z=await r(F);e(!1),o("success",`Workspace added — ${Z.path}`)}catch(Z){m(js(Z)),k(!1)}}}const P=l?aj(l.path,l.home):[],z=((M=P.at(-1))==null?void 0:M.label)??"",G=l!==null&&A.has(vr(l.path));return a.jsx("div",{className:"dialog-overlay",onClick:T,children:a.jsxs("div",{className:"dialog folder-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"folder-dialog-title",onClick:F=>F.stopPropagation(),children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",id:"folder-dialog-title",children:"Add workspace"}),a.jsx("button",{className:"dialog-close",onClick:T,"aria-label":"Close",disabled:v,children:a.jsx(Nn,{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 C(l.parent),disabled:!(l!=null&&l.parent),"aria-label":"Parent folder",title:"Parent folder",children:a.jsx(Lv,{size:14})}),a.jsx("nav",{className:"folder-crumbs","aria-label":"Folder path",children:P.map((F,Z)=>a.jsxs(x.Fragment,{children:[Z>0&&a.jsx($i,{size:12,className:"folder-crumb-sep","aria-hidden":"true"}),Z===P.length-1?a.jsx("span",{className:"folder-crumb current","aria-current":"location",title:F.path,children:F.label}):a.jsx("button",{className:"folder-crumb",onClick:()=>void C(F.path),title:F.path,children:F.label})]},F.path))}),d&&l&&a.jsx(sn,{size:14,className:"spin folder-spinner","aria-label":"Loading"})]}),a.jsx("ul",{ref:j,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(F=>a.jsxs("li",{className:"folder-item",children:[a.jsxs("button",{className:"folder-row",onClick:()=>void C(F.path),title:F.path,"aria-label":F.git?`${F.name} (git repository)`:F.name,children:[F.git?a.jsx(A1,{size:15,className:"folder-icon git","aria-hidden":"true"}):a.jsx(Al,{size:15,className:"folder-icon","aria-hidden":"true"}),a.jsx("span",{className:"folder-name",children:F.name}),a.jsx($i,{size:13,className:"folder-chevron","aria-hidden":"true"})]}),A.has(vr(F.path))?a.jsx("span",{className:"folder-tag",children:"Added"}):a.jsx("button",{className:"folder-add",onClick:()=>void $(F.path),disabled:v,"aria-label":`Add ${F.name}`,children:"Add"})]},F.path)):d&&a.jsxs("li",{className:"folder-empty",role:"status",children:[a.jsx(sn,{size:14,className:"spin"})," Loading folders…"]})}),(l==null?void 0:l.truncated)&&a.jsxs("p",{className:"folder-note",children:["Showing the first ",l.folders.length," folders."]}),h&&a.jsx("p",{className:"folder-error",role:"alert",children:h})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:T,disabled:v,children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:()=>l&&void $(l.path),disabled:!l||d||v||G,children:v?"Adding…":G?"Already added":`Add “${z}”`})]})]})})}const Ud=6e4,Bd=60*Ud,dl=24*Bd;function dj(e,n=Date.now()){const r=Date.parse(e);if(Number.isNaN(r))return"";const o=Math.max(0,n-r);return o<Ud?"just now":o<Bd?`${Math.floor(o/Ud)} min ago`:o<dl?`${Math.floor(o/Bd)} h ago`:o<2*dl?"yesterday":o<7*dl?`${Math.floor(o/dl)} days ago`:new Date(r).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function fj(){const e=R(n=>n.importSessionsWorkspace);return e?a.jsx(pj,{workspace:e},e):null}function pj({workspace:e}){const n=R(M=>M.setImportSessionsWorkspace),r=R(M=>M.importSessions),[o,l]=x.useState(null),[c,d]=x.useState(null),[f,h]=x.useState({}),[m,v]=x.useState(new Set),[k,y]=x.useState(!1),[S,j]=x.useState(new Map),T=x.useCallback(()=>{k||n(null)},[k,n]);Mo(T),x.useEffect(()=>{let M=!1;return Sv(e).then(({sessions:F,errors:Z})=>{if(M)return;const Q=Object.values(Z);if(Q.length===wd.length){d([...new Set(Q)].join("; "));return}l(F),h(Z)}).catch(F=>{M||d(js(F))}),()=>{M=!0}},[e]);function C(M){v(F=>{const Z=new Set(F);return Z.has(M)?Z.delete(M):Z.add(M),Z})}const b=o??[],A=M=>Qu({runtime:M.runtime,id:M.session_id}),$=b.length>0&&b.every(M=>m.has(A(M)));async function P(){const M=b.filter(Q=>m.has(A(Q))).map(Q=>({runtime:Q.runtime,id:Q.session_id}));if(M.length===0)return;y(!0);const{failed:F}=await r(e,M);if(y(!1),F.length===0){n(null);return}const Z=new Set(F.map(Qu));l(Q=>(Q??[]).filter(J=>!m.has(A(J))||Z.has(A(J)))),v(Z),j(new Map(F.map(Q=>[Qu(Q),Q.error])))}const z=e.split("/").pop()||e,G=m.size;return a.jsx("div",{className:"dialog-overlay",onClick:T,children:a.jsxs("div",{className:"dialog import-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"import-dialog-title",onClick:M=>M.stopPropagation(),children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",id:"import-dialog-title",children:"Import sessions"}),a.jsx("button",{className:"dialog-close",onClick:T,"aria-label":"Close",disabled:k,children:a.jsx(Nn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[a.jsxs("p",{className:"dialog-hint",children:["Sessions you started with ",a.jsx("code",{children:"claude"})," or ",a.jsx("code",{children:"codex"})," in"," ",a.jsx("strong",{title:e,children:z}),", in a terminal or an IDE. An imported session keeps its history and continues the same conversation."]}),c?a.jsxs("p",{className:"import-error",role:"alert",children:["Could not list the sessions — ",c]}):o===null?a.jsxs("div",{className:"import-loading",role:"status",children:[a.jsx(sn,{size:14,className:"spin"})," Looking for sessions…"]}):o.length===0?a.jsxs("div",{className:"import-empty",children:["No Claude Code or Codex sessions to import here. Sessions you start with ",a.jsx("code",{children:"claude"})," or"," ",a.jsx("code",{children:"codex"})," in this folder will show up here.",a.jsx(Xg,{errors:f})]}):a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"import-select-all",children:[a.jsx("input",{type:"checkbox",checked:$,disabled:k,onChange:()=>v($?new Set:new Set(b.map(A)))}),"Select all (",o.length,")"]}),a.jsx("ul",{className:"import-list",children:o.map(M=>{const F=A(M),Z=S.get(F);return a.jsx("li",{children:a.jsxs("label",{className:`import-row${m.has(F)?" selected":""}`,children:[a.jsx("input",{type:"checkbox",checked:m.has(F),disabled:k,onChange:()=>C(F)}),a.jsxs("span",{className:"import-row-main",children:[a.jsx("span",{className:"import-row-title",title:M.title,children:M.title}),a.jsxs("span",{className:"import-row-meta",children:[a.jsx("span",{className:`import-row-runtime ${M.runtime}`,children:Zl[M.runtime]}),a.jsx("span",{title:new Date(M.last_modified).toLocaleString(),children:dj(M.last_modified)}),M.git_branch&&a.jsxs("span",{className:"import-row-branch",title:"Git branch",children:[a.jsx(Fv,{size:10})," ",M.git_branch]})]}),M.recently_active&&a.jsxs("span",{className:"import-row-warn",children:[a.jsx(nc,{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."]}),Z&&a.jsx("span",{className:"import-row-error",role:"alert",children:Z})]})]})},F)})}),a.jsx(Xg,{errors:f})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:T,disabled:k,children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:()=>void P(),disabled:G===0||k,children:k?a.jsxs(a.Fragment,{children:[a.jsx(sn,{size:12,className:"spin"})," Importing…"]}):G>1?`Import ${G} sessions`:"Import"})]})]})})}function Xg({errors:e}){const n=Object.entries(e);return n.length===0?null:a.jsx(a.Fragment,{children:n.map(([r,o])=>a.jsxs("p",{className:"import-note",children:["Could not list the ",Zl[r]," sessions — ",o]},r))})}const hj=50*1024*1024;function mj(e){const n=e.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"");return/^[a-z0-9]/.test(n)?n:""}function gj(e){return mj(e.replace(/\.zip$/i,"").replace(/\s*\(\d+\)$/,""))}const vj=new TextEncoder().encode(".agentpane-data/data.json");async function yj(e){const n=new Uint8Array(await e.arrayBuffer()),r=vj;e:for(let o=0;o<=n.length-r.length;o++){for(let l=0;l<r.length;l++)if(n[o+l]!==r[l])continue e;return!0}return!1}function xj(){const{appCatalogOpen:e,closeAppCatalog:n,apps:r,installExampleApp:o,createSkeletonApp:l,importAppZip:c}=R(),[d,f]=x.useState("examples"),[h,m]=x.useState(null),[v,k]=x.useState(null),[y,S]=x.useState(!1),[j,T]=x.useState(""),[C,b]=x.useState(""),[A,$]=x.useState(""),[P,z]=x.useState(""),[G,M]=x.useState(null),[F,Z]=x.useState(null),[Q,J]=x.useState(""),[he,ke]=x.useState(null);if(x.useEffect(()=>{e&&(m(null),Wk().then(m).catch(()=>m([])))},[e]),!e)return null;const re=new Set(r.map(E=>E.id));async function ve(E){k(E);try{await o(E)&&n()}finally{k(null)}}async function le(){if(y)return;const E=j.trim(),L=C.trim();if(!(!E||!L)){S(!0);try{await l({id:E,title:L,description:A.trim()||void 0,icon:P.trim()||void 0})&&(T(""),b(""),$(""),z(""),n())}finally{S(!1)}}}async function ee(E){var de;const L=((de=E.target.files)==null?void 0:de[0])??null;if(Z(null),M(null),ke(null),!!L){if(!/\.zip$/i.test(L.name)){Z("Choose a .zip file.");return}if(L.size>hj){Z("The archive is larger than 50 MB.");return}J(gj(L.name)),ke(await yj(L).catch(()=>!1)?!0:null),M(L)}}async function X(){if(!(y||!G||!Q.trim())){S(!0);try{await c(Q.trim(),G,{data:he===!0})&&(M(null),J(""),n())}finally{S(!1)}}}function ie(E){E.key==="Escape"&&n()}const K=[{key:"examples",label:"Examples"},{key:"new",label:"New App"},{key:"import",label:"Import"}];return a.jsx("div",{className:"dialog-overlay",onClick:n,children:a.jsxs("div",{className:"dialog app-catalog",onClick:E=>E.stopPropagation(),onKeyDown:ie,children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"Add Mini App"}),a.jsx("button",{className:"dialog-close",onClick:n,children:"✕"})]}),a.jsx("div",{className:"catalog-tabs",children:K.map(E=>a.jsx("button",{className:`catalog-tab${d===E.key?" active":""}`,onClick:()=>f(E.key),children:E.label},E.key))}),a.jsxs("div",{className:"dialog-body catalog-body",children:[d==="examples"&&a.jsx("div",{className:"catalog-examples",children:h===null?a.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"Loading examples…"}):h.length===0?a.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"No example apps available."}):h.map(E=>{const L=re.has(E.id);return a.jsxs("div",{className:"example-row",children:[a.jsx(Lo,{iconNode:E.iconNode,size:14,className:"sidebar-app-icon"}),a.jsxs("div",{className:"example-info",children:[a.jsx("span",{className:"example-title",children:E.title}),E.description&&a.jsx("span",{className:"example-desc",children:E.description})]}),a.jsx("button",{className:"example-install",disabled:L||v===E.id,onClick:()=>ve(E.id),title:L?"Already installed":"Install this example",children:L?"Installed":v===E.id?"Installing…":"Install"})]},E.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:j,onChange:E=>T(E.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:C,onChange:E=>b(E.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:A,onChange:E=>$(E.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:P,onChange:E=>z(E.target.value),placeholder:"e.g. notebook-pen",spellCheck:!1,autoCapitalize:"off"})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:y||!j.trim()||!C.trim(),onClick:le,children:[a.jsx(mr,{size:13})," Create App"]})]}),d==="import"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"catalog-upload-hint",children:"Choose a mini app archive (.zip), as Export downloads it. A missing manifest.json is generated from the app id."}),a.jsx("input",{type:"file",accept:".zip,application/zip","aria-label":"App archive",onChange:E=>void ee(E)}),F&&a.jsx("div",{className:"catalog-upload-error",children:F}),G&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["App id",a.jsx("input",{className:"dialog-input",type:"text",value:Q,onChange:E=>J(E.target.value)})]}),a.jsxs("div",{className:"catalog-upload-summary",children:[G.name," (",Math.max(1,Math.round(G.size/1024))," KB)"]}),he!==null&&a.jsxs("label",{className:"app-export-option",children:[a.jsx("input",{type:"checkbox",checked:he,onChange:E=>ke(E.target.checked)}),a.jsxs("span",{children:["Import data",a.jsx("span",{className:"app-export-option-hint",children:"The archive carries the app’s saved state and stored files."})]})]})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:y||!G||!Q.trim(),onClick:X,children:[a.jsx(tS,{size:13})," ",y?"Importing…":"Import App"]})]})]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:n,children:"Close"})})]})})}function wj(){var k;const e=R(y=>y.appExportId),n=R(y=>y.apps),r=R(y=>y.closeAppExport),o=R(y=>y.exportApp),[l,c]=x.useState(!1),[d,f]=x.useState(!1);if(x.useEffect(()=>{c(!1)},[e]),!e)return null;const h=e,m=((k=n.find(y=>y.id===h))==null?void 0:k.title)??h;async function v(){if(!d){f(!0);try{await o(h,{data:l})&&r()}finally{f(!1)}}}return a.jsx("div",{className:"dialog-overlay",onClick:r,children:a.jsxs("div",{className:"dialog app-export",role:"dialog","aria-label":"Export Mini App",onClick:y=>y.stopPropagation(),onKeyDown:y=>{y.key==="Escape"&&r()},children:[a.jsxs("div",{className:"dialog-header",children:[a.jsxs("span",{className:"dialog-title",children:["Export ",m]}),a.jsx("button",{className:"dialog-close",onClick:r,children:"✕"})]}),a.jsxs("div",{className:"dialog-body catalog-body",children:[a.jsxs("div",{className:"catalog-upload-hint",children:["Downloads the app’s files as ",a.jsxs("code",{children:[h,".zip"]}),". Import it from Add Mini App → Import."]}),a.jsxs("label",{className:"app-export-option",children:[a.jsx("input",{type:"checkbox",checked:l,onChange:y=>c(y.target.checked),autoFocus:!0}),a.jsxs("span",{children:["Include data",a.jsx("span",{className:"app-export-option-hint",children:"The app’s saved state (global and per workspace) and the files it stored. It may hold private content."})]})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:d,onClick:v,children:[a.jsx(rf,{size:13})," ",d?"Exporting…":l?"Export with data":"Export"]})]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:r,children:"Cancel"})})]})})}function kj(){const e=R(k=>k.showCommandPalette),n=R(k=>k.setShowCommandPalette),r=R(),[o,l]=x.useState(""),[c,d]=x.useState(0),f=x.useRef(null),h=x.useMemo(()=>{const k=r.activeSessionId?r.sessionDetails[r.activeSessionId]:null,y=Xl(k);return[{id:"new-session",label:"New Session",hint:"Create a new Codex session",icon:mr,action:()=>r.setShowNewSessionDialog(!0),available:!0},{id:"delete-session",label:"Delete Session",hint:"Delete the active session",icon:fs,action:()=>{r.activeSessionId&&r.deleteSession(r.activeSessionId)},available:!!r.activeSessionId},{id:"send-message",label:"Send Message",hint:"Focus the message input",icon:Vi,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:xr,action:()=>r.cancelTurn(),available:y},{id:"tab-turns",label:"Switch to Turns Tab",hint:"View conversation timeline",icon:z1,action:()=>r.switchRightTab("turns"),available:!!r.activeSessionId},{id:"tab-sidecar",label:"Ask Sidecar",hint:"Ask about this session — status, blockers, what is left",icon:yr,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:K1,action:()=>r.toggleRightPanel(),available:!0},{id:"close-tab",label:"Close Tab",hint:"Close the active session tab",icon:Nn,action:()=>{r.activeSessionId&&r.closeTab(r.activeSessionId)},available:!!r.activeSessionId}]},[r]),m=x.useMemo(()=>{const k=o.toLowerCase().trim(),y=h.filter(S=>S.available);return k?y.filter(S=>S.label.toLowerCase().includes(k)||S.hint.toLowerCase().includes(k)):y},[h,o]);x.useEffect(()=>{e&&(l(""),d(0),setTimeout(()=>{var k;return(k=f.current)==null?void 0:k.focus()},50))},[e]);function v(k){if(k.key==="ArrowDown")k.preventDefault(),d(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(),n(!1))}else k.key==="Escape"&&n(!1)}return e?a.jsx("div",{className:"palette-overlay",onClick:()=>n(!1),children:a.jsxs("div",{className:"palette",onClick:k=>k.stopPropagation(),children:[a.jsxs("div",{className:"palette-search",children:[a.jsx("input",{ref:f,type:"text",placeholder:"Type a command…",value:o,onChange:k=>{l(k.target.value),d(0)},onKeyDown:v}),a.jsx("span",{className:"palette-esc",children:"ESC"})]}),m.length===0?a.jsx("div",{className:"palette-empty",children:"No matching commands"}):a.jsx("div",{className:"palette-list",children:m.map((k,y)=>{const S=k.icon;return a.jsxs("div",{className:`palette-item ${y===c?"selected":""}`,onClick:()=>{k.action(),n(!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(_1,{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 Yg=/^[a-z][a-z0-9-]{1,30}$/,Sj=2e3,bj=2e3;function Nj(){const{showRemoteModal:e,setShowRemoteModal:n,selectSession:r}=R(),[o,l]=x.useState(null),[c,d]=x.useState(null),[f,h]=x.useState(!1),[m,v]=x.useState(!1),[k,y]=x.useState(!1),[S,j]=x.useState(!1),[T,C]=x.useState("main"),[b,A]=x.useState(null),[$,P]=x.useState(null),[z,G]=x.useState(!1),[M,F]=x.useState(null),[Z,Q]=x.useState({kind:"setup"}),[J,he]=x.useState(""),[ke,re]=x.useState(!1),[ve,le]=x.useState(null),ee=x.useRef(null);Hi(ee,()=>j(!1),S);const X=m||k,ie=x.useCallback(async()=>{h(!0),d(null);try{const Te=await fetch(`${bt()}/remote/status`,{headers:{Accept:"application/json"}});if(!Te.ok)throw new Error(`status ${Te.status}`);l(await Te.json())}catch{l(null),d("Machine management is only available from this machine's local pane.")}finally{h(!1)}},[]),K=x.useCallback(async()=>{try{const Te=await fetch(`${bt()}/auth/status`,{headers:{Accept:"application/json"}});if(!Te.ok)throw new Error(`auth status ${Te.status}`);const Ue=await Te.json();return A(Ue),Ue}catch{return null}},[]);x.useEffect(()=>{e&&(C("main"),le(null),P(null),F(null),ie(),K())},[e,ie,K]);const E=ve!==null&&ve.state==="running";x.useEffect(()=>{if(!E)return;const Te=setInterval(async()=>{try{const Ue=await fetch(`${bt()}/remote/enable`,{headers:{Accept:"application/json"}});Ue.ok&&le(await Ue.json())}catch{}},Sj);return()=>clearInterval(Te)},[E]);const L=T==="login"&&($==null?void 0:$.state)==="pending";if(x.useEffect(()=>{if(!L)return;const Te=setInterval(async()=>{const Ue=await K();Ue&&(Ue.status==="authorized"?(clearInterval(Te),P(null),Y()):Ue.login&&Ue.login.state!=="pending"&&P(Ue.login))},bj);return()=>clearInterval(Te)},[L,K,Z]),x.useEffect(()=>{(ve==null?void 0:ve.state)==="needs_login"&&(Q({kind:"enable",mahlas:ve.mahlas??J}),le(null),C("login"))},[ve,J]),!e)return null;const de=!!(o!=null&&o.tunnel.provisioned)&&!!(o!=null&&o.service.running)&&!!(o!=null&&o.connection.ok);function U(Te){Te.key==="Escape"&&n(!1)}async function me(){const Te=b??await K();(Te==null?void 0:Te.status)==="authorized"?C("setup"):(Q({kind:"setup"}),C("login"))}function Y(){const Te=Z;Q({kind:"setup"}),Te.kind==="enable"?_e(Te.mahlas):Te.kind==="remove"?(C("main"),Re()):C("setup")}async function xe(){G(!0),F(null);const Te=window.open("about:blank","_blank");try{const Ue=await fetch(`${bt()}/auth/initiate`,{method:"POST"}),Ke=await Ue.json().catch(()=>({}));if(!Ue.ok)throw new Error(Ke.error??`initiate ${Ue.status}`);P(Ke),Te&&(Te.opener=null,Te.location.href=Ke.loginUrl)}catch(Ue){Te==null||Te.close(),F(Ue.message||"Could not start the sign-in.")}finally{G(!1)}}function we(){($==null?void 0:$.state)==="pending"&&fetch(`${bt()}/auth/cancel`,{method:"POST"}).catch(()=>{}),P(null),F(null),C("main")}async function Me(){await fetch(`${bt()}/auth/logout`,{method:"POST"}).catch(()=>{}),A(null),Q({kind:"setup"}),P(null),C("login")}async function _e(Te){if(Yg.test(Te)){re(!0);try{const Ue=await fetch(`${bt()}/remote/enable`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mahlas:Te})});if(!Ue.ok)throw new Error(`enable ${Ue.status}`);le(await Ue.json()),C("setup")}catch{d("Could not start the setup — check the daemon logs.")}finally{re(!1)}}}function ge(){ve!=null&&ve.troubleshootingSessionId&&(r(ve.troubleshootingSessionId),n(!1))}async function pe(){v(!0);try{await fetch(`${bt()}/remote/disable`,{method:"POST"}),await ie()}catch{d("Could not stop the tunnel service — check the service logs.")}finally{v(!1)}}async function Xe(){j(!1),window.confirm(`Remove the tunnel completely?
848
+
849
+ This deletes the Cloudflare tunnel, its DNS record and sign-in sessions, and this machine's remote state. The mahlas is released.
850
+
851
+ This cannot be undone.`)&&await Re()}async function Re(){y(!0);try{const Te=await fetch(`${bt()}/remote/uninstall`,{method:"DELETE"});if(Te.status===401){Q({kind:"remove"}),C("login");return}if(!Te.ok)throw new Error(`uninstall ${Te.status}`);await ie()}catch{d("Could not remove the tunnel — check the daemon logs.")}finally{y(!1)}}function at(){const Te=($==null?void 0:$.state)==="pending",Ue=$!==null&&$.state!=="pending";return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"dialog-hint",children:Z.kind==="setup"?"Remote access needs a Repoburg account, so that only you can open this machine from the web.":"The Repoburg account on this machine has expired. Sign in again to continue."}),!Te&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:"dialog-btn-create",style:{width:"100%"},onClick:()=>void xe(),disabled:z,children:[z?a.jsx(sn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Continue with Google"]}),a.jsx("div",{className:"dialog-label",style:{opacity:.7,marginTop:-4},children:"The first sign-in creates your account."})]}),Te&&$&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"dialog-hint",style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(sn,{size:14,className:"spin"})," Finish signing in in the browser tab that opened."]}),a.jsx("div",{className:"dialog-hint",children:"Approve only if the page shows this code:"}),a.jsx("div",{style:{padding:"8px 0",textAlign:"center",fontFamily:"var(--font-mono)",fontSize:18,letterSpacing:"0.15em",background:"var(--surface-2)",borderRadius:"var(--r-sm)"},"data-testid":"login-code",children:$.userCode}),a.jsxs("a",{className:"dialog-hint",href:$.loginUrl,target:"_blank",rel:"noreferrer",style:{display:"inline-flex",alignItems:"center",gap:4,color:"var(--accent)"},children:["Open the sign-in page again ",a.jsx($v,{size:12})]})]}),(M||Ue&&($==null?void 0:$.error))&&a.jsx("div",{className:"dialog-label",style:{color:"var(--red)"},children:M??($==null?void 0:$.error)}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:we,children:"Back"})})]})}function He(){if(!ve)return a.jsxs(a.Fragment,{children:[(b==null?void 0:b.email)&&a.jsxs("div",{className:"dialog-hint",children:["Signed in as ",a.jsx("strong",{children:b.email})," — only this account can open the machine."," ",a.jsx("button",{type:"button",onClick:()=>void Me(),style:{background:"none",border:"none",padding:0,color:"inherit",textDecoration:"underline",cursor:"pointer",font:"inherit"},children:"Use another account"})]}),a.jsxs("label",{className:"dialog-label",children:["Machine name (mahlas)",a.jsx("input",{className:"dialog-input",value:J,onChange:lt=>he(lt.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:()=>C("main"),children:"Back"}),a.jsxs("button",{className:"dialog-btn-create",disabled:!Yg.test(J)||ke,onClick:()=>void _e(J),children:[ke?a.jsx(sn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Start setup"]})]})]});const Te=["detect","provision","install","verify","ready"],Ue=Te.indexOf(ve.step),Ke=ve.state==="ready";return a.jsxs(a.Fragment,{children:[ve.state==="running"&&a.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(sn,{size:14,className:"spin"})," Setting up the remote tunnel…"]}),ve.state==="ready"&&a.jsxs("div",{className:"dialog-label",style:{color:"var(--green)",display:"flex",alignItems:"center",gap:6},children:[a.jsx(_s,{size:14})," Setup complete — you can close this window."]}),ve.state==="ready"&&ve.hostname&&a.jsxs("div",{className:"dialog-label",children:["This machine is accessible at"," ",a.jsx("a",{href:`https://${ve.hostname}`,target:"_blank",rel:"noreferrer",children:ve.hostname})]}),a.jsx("ol",{className:"dialog-label",style:{margin:"4px 0",paddingLeft:0,listStyle:"none"},children:Te.map((lt,Tt)=>{const Wt=Ke||Ue>-1&&Tt<Ue,q=!Ke&&Tt===Ue&&ve.state==="running";return a.jsxs("li",{style:{display:"flex",alignItems:"center",gap:6,opacity:Wt||q?1:.4,color:Wt?"var(--green)":void 0},children:[Wt?a.jsx(_s,{size:13}):q?a.jsx(sn,{size:13,className:"spin"}):a.jsx(E1,{size:9,style:{marginLeft:2,marginRight:2}}),lt]},lt)})}),ve.logs.length>0&&a.jsx("div",{className:"dialog-label",style:{opacity:.7,fontSize:12,whiteSpace:"pre-wrap"},children:ve.logs.slice(-3).map(lt=>lt.message).join(`
852
+ `)}),ve.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:ge,children:"Open troubleshooting session"})})]}),ve.state==="failed"&&a.jsxs("div",{className:"dialog-label",style:{color:"var(--red)"},children:["Setup failed: ",ve.error]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:()=>void ie(),children:"Refresh status"})})]})}return a.jsx("div",{className:"dialog-overlay",onClick:()=>n(!1),children:a.jsxs("div",{className:"dialog",onClick:Te=>Te.stopPropagation(),onKeyDown:U,children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"Remote Access"}),a.jsx("button",{className:"dialog-close",onClick:()=>n(!1),children:a.jsx(Nn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[f&&a.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(sn,{size:14,className:"spin"})," Loading machine status…"]}),c&&a.jsx("div",{className:"dialog-label",style:{color:"var(--red)"},children:c}),T==="login"?at():T==="setup"?He():a.jsxs(a.Fragment,{children:[de&&(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 pe(),disabled:X,children:[m?a.jsx(sn,{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:()=>j(Te=>!Te),disabled:X,"aria-label":"More tunnel actions","aria-haspopup":"menu","aria-expanded":S,children:k?a.jsx(sn,{size:14,className:"spin"}):a.jsx(Ro,{size:14})}),S&&a.jsx("div",{ref:ee,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 Xe(),children:[a.jsx(fs,{size:12})," Remove tunnel"]})})]})]}),!de&&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 _e(o.tunnel.mahlas),disabled:ke,children:[ke?a.jsx(sn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):a.jsx(Dm,{size:16,style:{verticalAlign:"middle",marginRight:6}}),"Resume tunnel connection"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:"dialog-btn-create",style:{width:"100%"},onClick:()=>void me(),children:[a.jsx(Dm,{size:16,style:{verticalAlign:"middle",marginRight:6}}),"Make this machine remote"]}),a.jsx("div",{className:"dialog-label",style:{opacity:.7,marginTop:-4},children:"The daemon sets everything up and shows the progress here."})]})})]})]})]})})}const Tj={success:T1,error:ec,info:D1,warn:nc},Cj=4e3;function Ej({toast:e}){const n=R(d=>d.removeToast),r=Tj[e.type],o=x.useRef(null);x.useEffect(()=>{function d(){o.current=setTimeout(()=>n(e.id),Cj)}return d(),()=>{o.current&&clearTimeout(o.current)}},[e.id,n]);function l(){o.current&&(clearTimeout(o.current),o.current=null)}function c(){o.current=setTimeout(()=>n(e.id),2e3)}return a.jsxs("div",{className:`toast toast-${e.type}`,onMouseEnter:l,onMouseLeave:c,children:[a.jsx(r,{size:16}),a.jsx("span",{className:"toast-message",children:e.message}),e.undoAction&&a.jsxs("button",{className:"toast-undo",onClick:()=>{var d;(d=e.undoAction)==null||d.call(e),n(e.id)},children:[a.jsx(eS,{size:12})," ",e.undoLabel||"Undo"]}),a.jsx("button",{className:"toast-close",onClick:()=>n(e.id),children:a.jsx(Nn,{size:14})})]})}function jj(){const e=R(n=>n.toasts);return e.length===0?null:a.jsx("div",{className:"toast-container",children:e.map(n=>a.jsx(Ej,{toast:n},n.id))})}function _j(){const[e]=x.useState(Nk),[n,r]=x.useState(!1),[o,l]=x.useState(!1),c=x.useRef(void 0);x.useEffect(()=>()=>clearTimeout(c.current),[]);async function d(){await Bi(ym)&&(r(!0),l(!0),clearTimeout(c.current),c.current=setTimeout(()=>r(!1),1500))}return a.jsxs("main",{className:"daemon-download",children:[a.jsx("h1",{className:"daemon-download-title",children:"Repoburg"}),e&&a.jsx("p",{className:"daemon-download-text",children:"Open the Repoburg app to continue."}),a.jsxs("div",{className:"daemon-download-install",children:[e&&a.jsx("p",{className:"daemon-download-label",children:"Not installed? Run this in Terminal:"}),a.jsxs("div",{className:"daemon-download-cmd",onCopy:()=>l(!0),children:[a.jsx("span",{className:"daemon-download-prompt","aria-hidden":"true",children:"$"}),a.jsx("code",{children:ym}),a.jsx("button",{type:"button",className:`daemon-download-copy${n?" copied":""}`,onClick:()=>void d(),"aria-label":"Copy the install command",title:n?"Copied":"Copy",children:n?a.jsx(_s,{size:15}):a.jsx(Pi,{size:15})})]}),!e&&a.jsx("p",{className:"daemon-download-meta",children:"Apple Silicon · macOS 13+"})]}),o&&a.jsx("p",{className:"daemon-download-hint",children:"Paste it into Terminal and press Return. Repoburg installs and opens in your menu bar."}),(e||o)&&a.jsxs("p",{className:"daemon-download-waiting",role:"status",children:[a.jsx(sn,{size:13,className:"spin"}),"Waiting for Repoburg to start…"]})]})}let Zn=null,Io=null,Di=1e3;const Rj=1e4;function Wd(){Zn&&(Zn.readyState===WebSocket.OPEN||Zn.readyState===WebSocket.CONNECTING)||(Zn=new WebSocket(f0("/ws")),Zn.onopen=()=>{const e=Di>1e3;if(Di=1e3,R.getState().setWsConnected(!0),R.getState().addLogEntry("INFO","WebSocket connected"),e){ek();const n=R.getState();n.activeSessionId&&(n.refreshActiveSession(),n.addToast("info","WebSocket reconnected — session state reconciled"))}},Zn.onclose=()=>{R.getState().setWsConnected(!1),R.getState().addLogEntry("WARN","WebSocket disconnected"),R.getState().addToast("warn","WebSocket disconnected — reconnecting…"),Ij()},Zn.onerror=()=>{},Zn.onmessage=e=>{try{const n=JSON.parse(e.data);zt.trackWsEvent(typeof n.event=="string"?n.event:"unknown",typeof e.data=="string"?e.data.length:0);const r=Dj[n.event];r&&r(n.data)}catch{}})}function Aj(){Io&&(clearTimeout(Io),Io=null),Zn&&(Zn.onclose=null,Zn.close(),Zn=null),R.getState().setWsConnected(!1)}function Ij(){Io||(Io=window.setTimeout(()=>{Io=null,Wd()},Di),Di=Math.min(Di*2,Rj))}const Dj={"turn:created":e=>{const n=e;R.getState().onTurnCreated(n.sessionId,n.turn)},"turn:started":e=>{const n=e;zt.note(`turn:started — ${n.turnId.slice(0,8)}`),R.getState().onTurnStarted(n.sessionId,n.turnId)},"item:started":e=>{const n=e;Vu(n.sessionId,n.turnId,n.item),R.getState().onItemStarted(n.sessionId,n.turnId,n.item)},"item:updated":e=>{const n=e;Vu(n.sessionId,n.turnId,n.item),R.getState().onItemUpdated(n.sessionId,n.turnId,n.item)},"item:completed":e=>{const n=e;Vu(n.sessionId,n.turnId,n.item),R.getState().onItemCompleted(n.sessionId,n.turnId,n.item)},"item:delta":e=>{const n=e,r=g0(n.sessionId,n.turnId,n.itemId,n.delta);R.getState().onItemDelta(n.sessionId,n.turnId,n.itemId,n.delta,r)},"streams:snapshot":e=>{const n=e,r=R.getState();for(const o of v0(n.sessionId??null,Array.isArray(n.streams)?n.streams:[]))r.onItemText(o.sessionId,o.turnId,o.itemId,o.text)},"widget:delta":e=>{const n=e;typeof n.itemId!="string"||typeof n.html!="string"||R.getState().onWidgetDelta(n.sessionId,n.turnId,n.itemId,typeof n.title=="string"?n.title:"",n.html)},"turn:completed":e=>{const n=e;zt.note(`turn:completed — ${n.turnId.slice(0,8)}`),yi(n.sessionId,n.turnId),R.getState().onTurnCompleted(n.sessionId,n.turnId,n.usage,n.hasUnreviewed,n.response??void 0)},"turn:tokenUsage":e=>{const n=e;R.getState().onTokenUsageUpdated(n.sessionId,n.turnId,n.usage)},"turn:contextUsage":e=>{const n=e,r={totalTokens:n.totalTokens,contextWindow:n.contextWindow,percentage:n.percentage,...n.autoCompactThreshold?{autoCompactThreshold:n.autoCompactThreshold}:{}};R.getState().onContextUsageUpdated(n.sessionId,r)},"turn:failed":e=>{const n=e;yi(n.sessionId,n.turnId),R.getState().onTurnFailed(n.sessionId,n.turnId,n.error,n.resumeState)},"turn:interrupted":e=>{const n=e;zt.note(`turn:interrupted — ${n.turnId.slice(0,8)} (${n.reason})`),yi(n.sessionId,n.turnId),R.getState().onTurnInterrupted(n.sessionId,n.turnId,{reason:n.reason,interruptedAt:n.interruptedAt,attempts:n.attempts,detail:n.detail??null,resumeAt:n.resumeAt??null})},"turn:resuming":e=>{const n=e;yi(n.sessionId,n.turnId),R.getState().onTurnResuming(n.sessionId,n.turnId,n.attempt)},"turn:resumed":e=>{const n=e;R.getState().onTurnResumed(n.sessionId,n.turnId)},"turn:retrying":e=>{const n=e;R.getState().onTurnRetrying(n.sessionId,n.turnId,{attempt:n.attempt,maxRetries:n.maxRetries,retryDelayMs:n.retryDelayMs,errorStatus:n.errorStatus??null,error:n.error??null})},"turn:cancelled":e=>{const n=e;yi(n.sessionId,n.turnId),R.getState().onTurnCancelled(n.sessionId,n.turnId)},"session:title":e=>{const n=e;R.getState().onSessionTitle(n.sessionId,n.title)},"session:touched":e=>{const n=e;R.getState().onSessionTouched(n.sessionId)},"session:created":e=>{const{session:n}=e;n.origin_app_id&&fl(n.id,n.origin_app_id),R.getState().addSession(n)},"session:resync":e=>{const n=e,r=R.getState();r.activeSessionId===n.sessionId&&r.refreshActiveSession()},"session:updated":e=>{const n=e;R.getState().onSessionUpdated(n.session)},background_tasks:e=>{const n=e;zt.note(`background_tasks — ${n.tasks.length} live (${n.tasks.map(r=>r.task_type).join(", ")||"none"})`),R.getState().onBackgroundTasksChanged(n.sessionId,n.tasks)},"background_tasks:snapshot":e=>{const n=e;R.getState().onBackgroundTasksSnapshot(n.sessions??{})},"signed_out_turns:snapshot":e=>{const n=e;R.getState().onSignedOutTurnsSnapshot(n.turns??[])},"thread:created":e=>{const n=e;R.getState().onThreadCreated(n.sessionId,n.thread,n.turn)},"thread:followup":e=>{const n=e;R.getState().onThreadFollowup(n.sessionId,n.threadId,n.turn)},"thread:resolved":e=>{const n=e;R.getState().onThreadResolved(n.sessionId,n.threadId,n.status)},"thread:deleted":e=>{const n=e;R.getState().onThreadDeleted(n.sessionId,n.threadId)},"app:tool_call":e=>{const n=e;q0(n.appId,n.callId,n.tool,n.args??{},n.workspace,n.caller)},"app:source:updated":e=>{tk(e.appId),R.getState().refreshApps()},"app:state_changed":e=>{const{appId:n,...r}=e;wv(n,r)}};function Mj(){const e=R(n=>n.init);return x.useEffect(()=>{u0();function n(){e(),Wd()}const{daemonStatus:r,setDaemonStatus:o}=R.getState();let l=null;r==="ready"?n():l=Ck({onMissing:()=>o("missing"),onReady:()=>{o("ready"),n()}});function c(){if(document.visibilityState!=="visible")return;const d=R.getState(),f=d.activeSessionId;if(!f)return;const h=d.sessionDetails[f];d.wsConnected||Wd(),h&&h.is_running===1&&(d.refreshActiveSession(),d.addLogEntry("INFO","Tab returned — reconciling session state"))}return document.addEventListener("visibilitychange",c),()=>{l==null||l(),Aj(),document.removeEventListener("visibilitychange",c)}},[e]),null}const cx="agentpaneView";function Hd(e){return{tab:Gd(e),vscode:e.vscodeViewOpen,usage:e.usageViewOpen,terminal:e.terminalViewOpen}}function ux(e,n){return e.tab===n.tab&&e.vscode===n.vscode&&e.usage===n.usage&&e.terminal===n.terminal}function Qg(e){return e.tab===null&&!e.vscode&&!e.usage&&!e.terminal}function Zg(e,n){return n.tab!==null&&!e.tabOrder.includes(n.tab)?!1:!ux(n,Hd(e))}function Jg(e){const n=e==null?void 0:e[cx];return typeof(n==null?void 0:n.index)!="number"?null:{...n,view:{...n.view,terminal:!!n.view.terminal}}}function Lj(e,n){e.getState().vscodeViewOpen!==n.vscode&&e.getState().toggleVscodeView(),e.getState().usageViewOpen!==n.usage&&e.getState().toggleUsageView(),e.getState().terminalViewOpen!==n.terminal&&e.getState().toggleTerminalView();const r=e.getState();if(n.tab===null)return;const{kind:o,id:l}=gr(n.tab);o==="app"?r.openAppTab(l):r.activeSessionId===l?r.setActiveAppTab(null):r.selectSession(l)}function Oj(e){let n=Jg(window.history.state)??{index:0,newest:0,view:Hd(e.getState())},r=n.newest,o=!1;const l=new Map([[n.index,n.view]]),c=y=>{const S=e.getState();for(let j=n.index+y;j>=0&&j<=r;j+=y){const T=l.get(j);if(!T||Zg(S,T))return!0}return!1},d=()=>{const y=c(-1),S=c(1),j=e.getState();(j.canGoBack!==y||j.canGoForward!==S)&&e.setState({canGoBack:y,canGoForward:S})},f=()=>({[cx]:{...n,newest:r}}),h=()=>{window.history.replaceState({...window.history.state,...f()},"")},m=y=>{if(l.set(n.index,n.view),Qg(n.view))n={...n,view:y},h();else{n={index:n.index+1,newest:n.index+1,view:y},r=n.index;for(const S of l.keys())S>r&&l.delete(S);window.history.pushState(f(),"")}l.set(n.index,y)},v=y=>{const S=Jg(y.state);if(!S)return;l.set(S.index,S.view),r=Math.max(r,S.index);const j=e.getState(),T=Math.sign(S.index-n.index);if(T!==0&&!Zg(j,S.view)){const C=S.index+T;window.history.go(C<0||C>r?n.index-S.index:T);return}n=S,h(),o=!0;try{Lj(e,S.view)}finally{o=!1}d()};h(),d(),window.addEventListener("popstate",v);const k=e.subscribe((y,S)=>{const j=y.activeSessionId!==S.activeSessionId||y.activeAppTabId!==S.activeAppTabId||y.vscodeViewOpen!==S.vscodeViewOpen||y.usageViewOpen!==S.usageViewOpen||y.terminalViewOpen!==S.terminalViewOpen;if(!(!j&&y.tabOrder===S.tabOrder)){if(j&&!o){const T=Hd(y);!Qg(T)&&!ux(T,n.view)&&m(T)}d()}});return()=>{k(),window.removeEventListener("popstate",v)}}function $j(){const e=R(c=>c.loading),n=R(c=>c.error),r=R(c=>c.sessions),o=R(c=>c.daemonStatus),l=R(c=>c.setShowCommandPalette);return x.useEffect(()=>zt.start(),[]),x.useEffect(()=>Oj(R),[]),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(Mj,{}),o==="missing"?a.jsx(_j,{}):o==="checking"||e&&r.length===0?a.jsx("div",{className:"empty-state",children:"Loading sessions…"}):n&&r.length===0?a.jsxs("div",{className:"empty-state",children:["Error: ",n]}):a.jsxs(a.Fragment,{children:[a.jsx(oj,{}),a.jsx(ij,{}),a.jsx(cj,{}),a.jsx(fj,{}),a.jsx(xj,{}),a.jsx(wj,{}),a.jsx(Nj,{}),a.jsx(kj,{}),a.jsx(jj,{})]})]})}Jw.createRoot(document.getElementById("root")).render(a.jsx(pt.StrictMode,{children:a.jsx($j,{})}));export{zi as R,Nn as X,f0 as b,ye as c,a as j,x as r,R as u};