repoburg 1.3.294 → 1.3.296

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,829 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalView-BLFbzxTg.js","assets/TerminalView-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
2
+ var ew=Object.defineProperty;var tw=(t,r,s)=>r in t?ew(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s;var ot=(t,r,s)=>tw(t,typeof r!="symbol"?r+"":r,s);(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(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"&&i(d)}).observe(document,{childList:!0,subtree:!0});function s(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 i(l){if(l.ep)return;l.ep=!0;const c=s(l);fetch(l.href,c)}})();function Tg(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Nu={exports:{}},ui={},Tu={exports:{}},We={};/**
3
+ * @license React
4
+ * react.production.min.js
5
+ *
6
+ * Copyright (c) Facebook, Inc. and its affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var wh;function nw(){if(wh)return We;wh=1;var t=Symbol.for("react.element"),r=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),d=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),k=Symbol.iterator;function x(D){return D===null||typeof D!="object"?null:(D=k&&D[k]||D["@@iterator"],typeof D=="function"?D:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,C={};function T(D,P,ce){this.props=D,this.context=P,this.refs=C,this.updater=ce||S}T.prototype.isReactComponent={},T.prototype.setState=function(D,P){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,P,"setState")},T.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function j(){}j.prototype=T.prototype;function E(D,P,ce){this.props=D,this.context=P,this.refs=C,this.updater=ce||S}var H=E.prototype=new j;H.constructor=E,N(H,T.prototype),H.isPureReactComponent=!0;var I=Array.isArray,L=Object.prototype.hasOwnProperty,q={current:null},K={key:!0,ref:!0,__self:!0,__source:!0};function $(D,P,ce){var B,X={},le=null,Ne=null;if(P!=null)for(B in P.ref!==void 0&&(Ne=P.ref),P.key!==void 0&&(le=""+P.key),P)L.call(P,B)&&!K.hasOwnProperty(B)&&(X[B]=P[B]);var re=arguments.length-2;if(re===1)X.children=ce;else if(1<re){for(var he=Array(re),Se=0;Se<re;Se++)he[Se]=arguments[Se+2];X.children=he}if(D&&D.defaultProps)for(B in re=D.defaultProps,re)X[B]===void 0&&(X[B]=re[B]);return{$$typeof:t,type:D,key:le,ref:Ne,props:X,_owner:q.current}}function te(D,P){return{$$typeof:t,type:D.type,key:P,ref:D.ref,props:D.props,_owner:D._owner}}function me(D){return typeof D=="object"&&D!==null&&D.$$typeof===t}function ue(D){var P={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(ce){return P[ce]})}var ye=/\/+/g;function be(D,P){return typeof D=="object"&&D!==null&&D.key!=null?ue(""+D.key):P.toString(36)}function Me(D,P,ce,B,X){var le=typeof D;(le==="undefined"||le==="boolean")&&(D=null);var Ne=!1;if(D===null)Ne=!0;else switch(le){case"string":case"number":Ne=!0;break;case"object":switch(D.$$typeof){case t:case r:Ne=!0}}if(Ne)return Ne=D,X=X(Ne),D=B===""?"."+be(Ne,0):B,I(X)?(ce="",D!=null&&(ce=D.replace(ye,"$&/")+"/"),Me(X,P,ce,"",function(Se){return Se})):X!=null&&(me(X)&&(X=te(X,ce+(!X.key||Ne&&Ne.key===X.key?"":(""+X.key).replace(ye,"$&/")+"/")+D)),P.push(X)),1;if(Ne=0,B=B===""?".":B+":",I(D))for(var re=0;re<D.length;re++){le=D[re];var he=B+be(le,re);Ne+=Me(le,P,ce,he,X)}else if(he=x(D),typeof he=="function")for(D=he.call(D),re=0;!(le=D.next()).done;)le=le.value,he=B+be(le,re++),Ne+=Me(le,P,ce,he,X);else if(le==="object")throw P=String(D),Error("Objects are not valid as a React child (found: "+(P==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":P)+"). If you meant to render a collection of children, use an array instead.");return Ne}function Z(D,P,ce){if(D==null)return D;var B=[],X=0;return Me(D,B,"","",function(le){return P.call(ce,le,X++)}),B}function oe(D){if(D._status===-1){var P=D._result;P=P(),P.then(function(ce){(D._status===0||D._status===-1)&&(D._status=1,D._result=ce)},function(ce){(D._status===0||D._status===-1)&&(D._status=2,D._result=ce)}),D._status===-1&&(D._status=0,D._result=P)}if(D._status===1)return D._result.default;throw D._result}var ie={current:null},z={transition:null},Q={ReactCurrentDispatcher:ie,ReactCurrentBatchConfig:z,ReactCurrentOwner:q};function G(){throw Error("act(...) is not supported in production builds of React.")}return We.Children={map:Z,forEach:function(D,P,ce){Z(D,function(){P.apply(this,arguments)},ce)},count:function(D){var P=0;return Z(D,function(){P++}),P},toArray:function(D){return Z(D,function(P){return P})||[]},only:function(D){if(!me(D))throw Error("React.Children.only expected to receive a single React element child.");return D}},We.Component=T,We.Fragment=s,We.Profiler=l,We.PureComponent=E,We.StrictMode=i,We.Suspense=g,We.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Q,We.act=G,We.cloneElement=function(D,P,ce){if(D==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+D+".");var B=N({},D.props),X=D.key,le=D.ref,Ne=D._owner;if(P!=null){if(P.ref!==void 0&&(le=P.ref,Ne=q.current),P.key!==void 0&&(X=""+P.key),D.type&&D.type.defaultProps)var re=D.type.defaultProps;for(he in P)L.call(P,he)&&!K.hasOwnProperty(he)&&(B[he]=P[he]===void 0&&re!==void 0?re[he]:P[he])}var he=arguments.length-2;if(he===1)B.children=ce;else if(1<he){re=Array(he);for(var Se=0;Se<he;Se++)re[Se]=arguments[Se+2];B.children=re}return{$$typeof:t,type:D.type,key:X,ref:le,props:B,_owner:Ne}},We.createContext=function(D){return D={$$typeof:d,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},D.Provider={$$typeof:c,_context:D},D.Consumer=D},We.createElement=$,We.createFactory=function(D){var P=$.bind(null,D);return P.type=D,P},We.createRef=function(){return{current:null}},We.forwardRef=function(D){return{$$typeof:p,render:D}},We.isValidElement=me,We.lazy=function(D){return{$$typeof:v,_payload:{_status:-1,_result:D},_init:oe}},We.memo=function(D,P){return{$$typeof:m,type:D,compare:P===void 0?null:P}},We.startTransition=function(D){var P=z.transition;z.transition={};try{D()}finally{z.transition=P}},We.unstable_act=G,We.useCallback=function(D,P){return ie.current.useCallback(D,P)},We.useContext=function(D){return ie.current.useContext(D)},We.useDebugValue=function(){},We.useDeferredValue=function(D){return ie.current.useDeferredValue(D)},We.useEffect=function(D,P){return ie.current.useEffect(D,P)},We.useId=function(){return ie.current.useId()},We.useImperativeHandle=function(D,P,ce){return ie.current.useImperativeHandle(D,P,ce)},We.useInsertionEffect=function(D,P){return ie.current.useInsertionEffect(D,P)},We.useLayoutEffect=function(D,P){return ie.current.useLayoutEffect(D,P)},We.useMemo=function(D,P){return ie.current.useMemo(D,P)},We.useReducer=function(D,P,ce){return ie.current.useReducer(D,P,ce)},We.useRef=function(D){return ie.current.useRef(D)},We.useState=function(D){return ie.current.useState(D)},We.useSyncExternalStore=function(D,P,ce){return ie.current.useSyncExternalStore(D,P,ce)},We.useTransition=function(){return ie.current.useTransition()},We.version="18.3.1",We}var kh;function Sd(){return kh||(kh=1,Tu.exports=nw()),Tu.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 Sh;function rw(){if(Sh)return ui;Sh=1;var t=Sd(),r=Symbol.for("react.element"),s=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,l=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function d(p,g,m){var v,k={},x=null,S=null;m!==void 0&&(x=""+m),g.key!==void 0&&(x=""+g.key),g.ref!==void 0&&(S=g.ref);for(v in g)i.call(g,v)&&!c.hasOwnProperty(v)&&(k[v]=g[v]);if(p&&p.defaultProps)for(v in g=p.defaultProps,g)k[v]===void 0&&(k[v]=g[v]);return{$$typeof:r,type:p,key:x,ref:S,props:k,_owner:l.current}}return ui.Fragment=s,ui.jsx=d,ui.jsxs=d,ui}var bh;function sw(){return bh||(bh=1,Nu.exports=rw()),Nu.exports}var a=sw(),y=Sd();const lt=Tg(y);var Ka={},Cu={exports:{}},An={},Eu={exports:{}},ju={};/**
19
+ * @license React
20
+ * scheduler.production.min.js
21
+ *
22
+ * Copyright (c) Facebook, Inc. and its affiliates.
23
+ *
24
+ * This source code is licensed under the MIT license found in the
25
+ * LICENSE file in the root directory of this source tree.
26
+ */var Nh;function ow(){return Nh||(Nh=1,(function(t){function r(z,Q){var G=z.length;z.push(Q);e:for(;0<G;){var D=G-1>>>1,P=z[D];if(0<l(P,Q))z[D]=Q,z[G]=P,G=D;else break e}}function s(z){return z.length===0?null:z[0]}function i(z){if(z.length===0)return null;var Q=z[0],G=z.pop();if(G!==Q){z[0]=G;e:for(var D=0,P=z.length,ce=P>>>1;D<ce;){var B=2*(D+1)-1,X=z[B],le=B+1,Ne=z[le];if(0>l(X,G))le<P&&0>l(Ne,X)?(z[D]=Ne,z[le]=G,D=le):(z[D]=X,z[B]=G,D=B);else if(le<P&&0>l(Ne,G))z[D]=Ne,z[le]=G,D=le;else break e}}return Q}function l(z,Q){var G=z.sortIndex-Q.sortIndex;return G!==0?G:z.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;t.unstable_now=function(){return c.now()}}else{var d=Date,p=d.now();t.unstable_now=function(){return d.now()-p}}var g=[],m=[],v=1,k=null,x=3,S=!1,N=!1,C=!1,T=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function H(z){for(var Q=s(m);Q!==null;){if(Q.callback===null)i(m);else if(Q.startTime<=z)i(m),Q.sortIndex=Q.expirationTime,r(g,Q);else break;Q=s(m)}}function I(z){if(C=!1,H(z),!N)if(s(g)!==null)N=!0,oe(L);else{var Q=s(m);Q!==null&&ie(I,Q.startTime-z)}}function L(z,Q){N=!1,C&&(C=!1,j($),$=-1),S=!0;var G=x;try{for(H(Q),k=s(g);k!==null&&(!(k.expirationTime>Q)||z&&!ue());){var D=k.callback;if(typeof D=="function"){k.callback=null,x=k.priorityLevel;var P=D(k.expirationTime<=Q);Q=t.unstable_now(),typeof P=="function"?k.callback=P:k===s(g)&&i(g),H(Q)}else i(g);k=s(g)}if(k!==null)var ce=!0;else{var B=s(m);B!==null&&ie(I,B.startTime-Q),ce=!1}return ce}finally{k=null,x=G,S=!1}}var q=!1,K=null,$=-1,te=5,me=-1;function ue(){return!(t.unstable_now()-me<te)}function ye(){if(K!==null){var z=t.unstable_now();me=z;var Q=!0;try{Q=K(!0,z)}finally{Q?be():(q=!1,K=null)}}else q=!1}var be;if(typeof E=="function")be=function(){E(ye)};else if(typeof MessageChannel<"u"){var Me=new MessageChannel,Z=Me.port2;Me.port1.onmessage=ye,be=function(){Z.postMessage(null)}}else be=function(){T(ye,0)};function oe(z){K=z,q||(q=!0,be())}function ie(z,Q){$=T(function(){z(t.unstable_now())},Q)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(z){z.callback=null},t.unstable_continueExecution=function(){N||S||(N=!0,oe(L))},t.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):te=0<z?Math.floor(1e3/z):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_getFirstCallbackNode=function(){return s(g)},t.unstable_next=function(z){switch(x){case 1:case 2:case 3:var Q=3;break;default:Q=x}var G=x;x=Q;try{return z()}finally{x=G}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(z,Q){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var G=x;x=z;try{return Q()}finally{x=G}},t.unstable_scheduleCallback=function(z,Q,G){var D=t.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?D+G:D):G=D,z){case 1:var P=-1;break;case 2:P=250;break;case 5:P=1073741823;break;case 4:P=1e4;break;default:P=5e3}return P=G+P,z={id:v++,callback:Q,priorityLevel:z,startTime:G,expirationTime:P,sortIndex:-1},G>D?(z.sortIndex=G,r(m,z),s(g)===null&&z===s(m)&&(C?(j($),$=-1):C=!0,ie(I,G-D))):(z.sortIndex=P,r(g,z),N||S||(N=!0,oe(L))),z},t.unstable_shouldYield=ue,t.unstable_wrapCallback=function(z){var Q=x;return function(){var G=x;x=Q;try{return z.apply(this,arguments)}finally{x=G}}}})(ju)),ju}var Th;function iw(){return Th||(Th=1,Eu.exports=ow()),Eu.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 Ch;function aw(){if(Ch)return An;Ch=1;var t=Sd(),r=iw();function s(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,o=1;o<arguments.length;o++)n+="&args[]="+encodeURIComponent(arguments[o]);return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,l={};function c(e,n){d(e,n),d(e+"Capture",n)}function d(e,n){for(l[e]=n,e=0;e<n.length;e++)i.add(n[e])}var p=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),g=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,v={},k={};function x(e){return g.call(k,e)?!0:g.call(v,e)?!1:m.test(e)?k[e]=!0:(v[e]=!0,!1)}function S(e,n,o,u){if(o!==null&&o.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return u?!1:o!==null?!o.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function N(e,n,o,u){if(n===null||typeof n>"u"||S(e,n,o,u))return!0;if(u)return!1;if(o!==null)switch(o.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function C(e,n,o,u,f,h,w){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=u,this.attributeNamespace=f,this.mustUseProperty=o,this.propertyName=e,this.type=n,this.sanitizeURL=h,this.removeEmptyString=w}var T={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){T[e]=new C(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];T[n]=new C(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){T[e]=new C(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){T[e]=new C(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){T[e]=new C(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){T[e]=new C(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){T[e]=new C(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){T[e]=new C(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){T[e]=new C(e,5,!1,e.toLowerCase(),null,!1,!1)});var j=/[\-:]([a-z])/g;function E(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var n=e.replace(j,E);T[n]=new C(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(j,E);T[n]=new C(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(j,E);T[n]=new C(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){T[e]=new C(e,1,!1,e.toLowerCase(),null,!1,!1)}),T.xlinkHref=new C("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){T[e]=new C(e,1,!1,e.toLowerCase(),null,!0,!0)});function H(e,n,o,u){var f=T.hasOwnProperty(n)?T[n]:null;(f!==null?f.type!==0:u||!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(N(n,o,f,u)&&(o=null),u||f===null?x(n)&&(o===null?e.removeAttribute(n):e.setAttribute(n,""+o)):f.mustUseProperty?e[f.propertyName]=o===null?f.type===3?!1:"":o:(n=f.attributeName,u=f.attributeNamespace,o===null?e.removeAttribute(n):(f=f.type,o=f===3||f===4&&o===!0?"":""+o,u?e.setAttributeNS(u,n,o):e.setAttribute(n,o))))}var I=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,L=Symbol.for("react.element"),q=Symbol.for("react.portal"),K=Symbol.for("react.fragment"),$=Symbol.for("react.strict_mode"),te=Symbol.for("react.profiler"),me=Symbol.for("react.provider"),ue=Symbol.for("react.context"),ye=Symbol.for("react.forward_ref"),be=Symbol.for("react.suspense"),Me=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),oe=Symbol.for("react.lazy"),ie=Symbol.for("react.offscreen"),z=Symbol.iterator;function Q(e){return e===null||typeof e!="object"?null:(e=z&&e[z]||e["@@iterator"],typeof e=="function"?e:null)}var G=Object.assign,D;function P(e){if(D===void 0)try{throw Error()}catch(o){var n=o.stack.trim().match(/\n( *(at )?)/);D=n&&n[1]||""}return`
35
+ `+D+e}var ce=!1;function B(e,n){if(!e||ce)return"";ce=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(n)if(n=function(){throw Error()},Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(n,[])}catch(V){var u=V}Reflect.construct(e,[],n)}else{try{n.call()}catch(V){u=V}e.call(n.prototype)}else{try{throw Error()}catch(V){u=V}e()}}catch(V){if(V&&u&&typeof V.stack=="string"){for(var f=V.stack.split(`
36
+ `),h=u.stack.split(`
37
+ `),w=f.length-1,_=h.length-1;1<=w&&0<=_&&f[w]!==h[_];)_--;for(;1<=w&&0<=_;w--,_--)if(f[w]!==h[_]){if(w!==1||_!==1)do if(w--,_--,0>_||f[w]!==h[_]){var M=`
38
+ `+f[w].replace(" at new "," at ");return e.displayName&&M.includes("<anonymous>")&&(M=M.replace("<anonymous>",e.displayName)),M}while(1<=w&&0<=_);break}}}finally{ce=!1,Error.prepareStackTrace=o}return(e=e?e.displayName||e.name:"")?P(e):""}function X(e){switch(e.tag){case 5:return P(e.type);case 16:return P("Lazy");case 13:return P("Suspense");case 19:return P("SuspenseList");case 0:case 2:case 15:return e=B(e.type,!1),e;case 11:return e=B(e.type.render,!1),e;case 1:return e=B(e.type,!0),e;default:return""}}function le(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case K:return"Fragment";case q:return"Portal";case te:return"Profiler";case $:return"StrictMode";case be:return"Suspense";case Me:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ue:return(e.displayName||"Context")+".Consumer";case me:return(e._context.displayName||"Context")+".Provider";case ye:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Z:return n=e.displayName||null,n!==null?n:le(e.type)||"Memo";case oe:n=e._payload,e=e._init;try{return le(e(n))}catch{}}return null}function Ne(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return le(n);case 8:return n===$?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function re(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function he(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Se(e){var n=he(e)?"checked":"value",o=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),u=""+e[n];if(!e.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var f=o.get,h=o.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(w){u=""+w,h.call(this,w)}}),Object.defineProperty(e,n,{enumerable:o.enumerable}),{getValue:function(){return u},setValue:function(w){u=""+w},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function He(e){e._valueTracker||(e._valueTracker=Se(e))}function _e(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var o=n.getValue(),u="";return e&&(u=he(e)?e.checked?"true":"false":e.value),e=u,e!==o?(n.setValue(e),!0):!1}function ct(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function $e(e,n){var o=n.checked;return G({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??e._wrapperState.initialChecked})}function en(e,n){var o=n.defaultValue==null?"":n.defaultValue,u=n.checked!=null?n.checked:n.defaultChecked;o=re(n.value!=null?n.value:o),e._wrapperState={initialChecked:u,initialValue:o,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Fe(e,n){n=n.checked,n!=null&&H(e,"checked",n,!1)}function Ht(e,n){Fe(e,n);var o=re(n.value),u=n.type;if(o!=null)u==="number"?(o===0&&e.value===""||e.value!=o)&&(e.value=""+o):e.value!==""+o&&(e.value=""+o);else if(u==="submit"||u==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?wt(e,n.type,o):n.hasOwnProperty("defaultValue")&&wt(e,n.type,re(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function tn(e,n,o){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var u=n.type;if(!(u!=="submit"&&u!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,o||n===e.value||(e.value=n),e.defaultValue=n}o=e.name,o!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,o!==""&&(e.name=o)}function wt(e,n,o){(n!=="number"||ct(e.ownerDocument)!==e)&&(o==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+o&&(e.defaultValue=""+o))}var Ct=Array.isArray;function zt(e,n,o,u){if(e=e.options,n){n={};for(var f=0;f<o.length;f++)n["$"+o[f]]=!0;for(o=0;o<e.length;o++)f=n.hasOwnProperty("$"+e[o].value),e[o].selected!==f&&(e[o].selected=f),f&&u&&(e[o].defaultSelected=!0)}else{for(o=""+re(o),n=null,f=0;f<e.length;f++){if(e[f].value===o){e[f].selected=!0,u&&(e[f].defaultSelected=!0);return}n!==null||e[f].disabled||(n=e[f])}n!==null&&(n.selected=!0)}}function Lt(e,n){if(n.dangerouslySetInnerHTML!=null)throw Error(s(91));return G({},n,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Y(e,n){var o=n.value;if(o==null){if(o=n.children,n=n.defaultValue,o!=null){if(n!=null)throw Error(s(92));if(Ct(o)){if(1<o.length)throw Error(s(93));o=o[0]}n=o}n==null&&(n=""),o=n}e._wrapperState={initialValue:re(o)}}function ge(e,n){var o=re(n.value),u=re(n.defaultValue);o!=null&&(o=""+o,o!==e.value&&(e.value=o),n.defaultValue==null&&e.defaultValue!==o&&(e.defaultValue=o)),u!=null&&(e.defaultValue=""+u)}function Ue(e){var n=e.textContent;n===e._wrapperState.initialValue&&n!==""&&n!==null&&(e.value=n)}function nt(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function mt(e,n){return e==null||e==="http://www.w3.org/1999/xhtml"?nt(n):e==="http://www.w3.org/2000/svg"&&n==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var gt,Et=(function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(n,o,u,f){MSApp.execUnsafeLocalFunction(function(){return e(n,o,u,f)})}:e})(function(e,n){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=n;else{for(gt=gt||document.createElement("div"),gt.innerHTML="<svg>"+n.valueOf().toString()+"</svg>",n=gt.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function an(e,n){if(n){var o=e.firstChild;if(o&&o===e.lastChild&&o.nodeType===3){o.nodeValue=n;return}}e.textContent=n}var dt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Mn=["Webkit","ms","Moz","O"];Object.keys(dt).forEach(function(e){Mn.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),dt[n]=dt[e]})});function Ln(e,n,o){return n==null||typeof n=="boolean"||n===""?"":o||typeof n!="number"||n===0||dt.hasOwnProperty(e)&&dt[e]?(""+n).trim():n+"px"}function hr(e,n){e=e.style;for(var o in n)if(n.hasOwnProperty(o)){var u=o.indexOf("--")===0,f=Ln(o,n[o],u);o==="float"&&(o="cssFloat"),u?e.setProperty(o,f):e[o]=f}}var mr=G({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 tr(e,n){if(n){if(mr[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(s(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(s(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(s(61))}if(n.style!=null&&typeof n.style!="object")throw Error(s(62))}}function On(e,n){if(e.indexOf("-")===-1)return typeof n.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var gn=null;function ln(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Vt=null,vn=null,Qe=null;function jt(e){if(e=Xo(e)){if(typeof Vt!="function")throw Error(s(280));var n=e.stateNode;n&&(n=aa(n),Vt(e.stateNode,e.type,n))}}function ft(e){vn?Qe?Qe.push(e):Qe=[e]:vn=e}function Kt(){if(vn){var e=vn,n=Qe;if(Qe=vn=null,jt(e),n)for(e=0;e<n.length;e++)jt(n[e])}}function vt(e,n){return e(n)}function yt(){}var at=!1;function Gt(e,n,o){if(at)return e(n,o);at=!0;try{return vt(e,n,o)}finally{at=!1,(vn!==null||Qe!==null)&&(yt(),Kt())}}function st(e,n){var o=e.stateNode;if(o===null)return null;var u=aa(o);if(u===null)return null;o=u[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(e=e.type,u=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!u;break e;default:e=!1}if(e)return null;if(o&&typeof o!="function")throw Error(s(231,n,typeof o));return o}var Ot=!1;if(p)try{var R={};Object.defineProperty(R,"passive",{get:function(){Ot=!0}}),window.addEventListener("test",R,R),window.removeEventListener("test",R,R)}catch{Ot=!1}function pe(e,n,o,u,f,h,w,_,M){var V=Array.prototype.slice.call(arguments,3);try{n.apply(o,V)}catch(ne){this.onError(ne)}}var ae=!1,we=null,Le=!1,Ge=null,Oe={onError:function(e){ae=!0,we=e}};function Ft(e,n,o,u,f,h,w,_,M){ae=!1,we=null,pe.apply(Oe,arguments)}function Pn(e,n,o,u,f,h,w,_,M){if(Ft.apply(this,arguments),ae){if(ae){var V=we;ae=!1,we=null}else throw Error(s(198));Le||(Le=!0,Ge=V)}}function Be(e){var n=e,o=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(o=n.return),e=n.return;while(e)}return n.tag===3?o:null}function yn(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function Er(e){if(Be(e)!==e)throw Error(s(188))}function Ur(e){var n=e.alternate;if(!n){if(n=Be(e),n===null)throw Error(s(188));return n!==e?null:e}for(var o=e,u=n;;){var f=o.return;if(f===null)break;var h=f.alternate;if(h===null){if(u=f.return,u!==null){o=u;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===o)return Er(f),e;if(h===u)return Er(f),n;h=h.sibling}throw Error(s(188))}if(o.return!==u.return)o=f,u=h;else{for(var w=!1,_=f.child;_;){if(_===o){w=!0,o=f,u=h;break}if(_===u){w=!0,u=f,o=h;break}_=_.sibling}if(!w){for(_=h.child;_;){if(_===o){w=!0,o=h,u=f;break}if(_===u){w=!0,u=h,o=f;break}_=_.sibling}if(!w)throw Error(s(189))}}if(o.alternate!==u)throw Error(s(190))}if(o.tag!==3)throw Error(s(188));return o.stateNode.current===o?e:n}function $n(e){return e=Ur(e),e!==null?gr(e):null}function gr(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var n=gr(e);if(n!==null)return n;e=e.sibling}return null}var Ze=r.unstable_scheduleCallback,_t=r.unstable_cancelCallback,vr=r.unstable_shouldYield,Xl=r.unstable_requestPaint,kt=r.unstable_now,yr=r.unstable_getCurrentPriorityLevel,Br=r.unstable_ImmediatePriority,xr=r.unstable_UserBlockingPriority,Bs=r.unstable_NormalPriority,gs=r.unstable_LowPriority,Wi=r.unstable_IdlePriority,vs=null,zn=null;function Ws(e){if(zn&&typeof zn.onCommitFiberRoot=="function")try{zn.onCommitFiberRoot(vs,e,void 0,(e.current.flags&128)===128)}catch{}}var xn=Math.clz32?Math.clz32:ys,Hs=Math.log,Wr=Math.LN2;function ys(e){return e>>>=0,e===0?32:31-(Hs(e)/Wr|0)|0}var wn=64,Vs=4194304;function xs(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ws(e,n){var o=e.pendingLanes;if(o===0)return 0;var u=0,f=e.suspendedLanes,h=e.pingedLanes,w=o&268435455;if(w!==0){var _=w&~f;_!==0?u=xs(_):(h&=w,h!==0&&(u=xs(h)))}else w=o&~f,w!==0?u=xs(w):h!==0&&(u=xs(h));if(u===0)return 0;if(n!==0&&n!==u&&(n&f)===0&&(f=u&-u,h=n&-n,f>=h||f===16&&(h&4194240)!==0))return n;if((u&4)!==0&&(u|=o&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=u;0<n;)o=31-xn(n),f=1<<o,u|=e[o],n&=~f;return u}function Hi(e,n){switch(e){case 1:case 2:case 4:return n+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Vi(e,n){for(var o=e.suspendedLanes,u=e.pingedLanes,f=e.expirationTimes,h=e.pendingLanes;0<h;){var w=31-xn(h),_=1<<w,M=f[w];M===-1?((_&o)===0||(_&u)!==0)&&(f[w]=Hi(_,n)):M<=n&&(e.expiredLanes|=_),h&=~_}}function Io(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Do(){var e=wn;return wn<<=1,(wn&4194240)===0&&(wn=64),e}function Mo(e){for(var n=[],o=0;31>o;o++)n.push(e);return n}function ks(e,n,o){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-xn(n),e[n]=o}function Ki(e,n){var o=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var u=e.eventTimes;for(e=e.expirationTimes;0<o;){var f=31-xn(o),h=1<<f;n[f]=0,u[f]=-1,e[f]=-1,o&=~h}}function Hr(e,n){var o=e.entangledLanes|=n;for(e=e.entanglements;o;){var u=31-xn(o),f=1<<u;f&n|e[u]&n&&(e[u]|=n),o&=~f}}var qe=0;function de(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var b,F,J,Ce,Re,ze=!1,Xe=[],Je=null,St=null,bt=null,jr=new Map,At=new Map,Vr=[],Sy="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 nf(e,n){switch(e){case"focusin":case"focusout":Je=null;break;case"dragenter":case"dragleave":St=null;break;case"mouseover":case"mouseout":bt=null;break;case"pointerover":case"pointerout":jr.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":At.delete(n.pointerId)}}function Lo(e,n,o,u,f,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:o,eventSystemFlags:u,nativeEvent:h,targetContainers:[f]},n!==null&&(n=Xo(n),n!==null&&F(n)),e):(e.eventSystemFlags|=u,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function by(e,n,o,u,f){switch(n){case"focusin":return Je=Lo(Je,e,n,o,u,f),!0;case"dragenter":return St=Lo(St,e,n,o,u,f),!0;case"mouseover":return bt=Lo(bt,e,n,o,u,f),!0;case"pointerover":var h=f.pointerId;return jr.set(h,Lo(jr.get(h)||null,e,n,o,u,f)),!0;case"gotpointercapture":return h=f.pointerId,At.set(h,Lo(At.get(h)||null,e,n,o,u,f)),!0}return!1}function rf(e){var n=Ss(e.target);if(n!==null){var o=Be(n);if(o!==null){if(n=o.tag,n===13){if(n=yn(o),n!==null){e.blockedOn=n,Re(e.priority,function(){J(o)});return}}else if(n===3&&o.stateNode.current.memoizedState.isDehydrated){e.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Gi(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var o=Ql(e.domEventName,e.eventSystemFlags,n[0],e.nativeEvent);if(o===null){o=e.nativeEvent;var u=new o.constructor(o.type,o);gn=u,o.target.dispatchEvent(u),gn=null}else return n=Xo(o),n!==null&&F(n),e.blockedOn=o,!1;n.shift()}return!0}function sf(e,n,o){Gi(e)&&o.delete(n)}function Ny(){ze=!1,Je!==null&&Gi(Je)&&(Je=null),St!==null&&Gi(St)&&(St=null),bt!==null&&Gi(bt)&&(bt=null),jr.forEach(sf),At.forEach(sf)}function Oo(e,n){e.blockedOn===n&&(e.blockedOn=null,ze||(ze=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,Ny)))}function Po(e){function n(f){return Oo(f,e)}if(0<Xe.length){Oo(Xe[0],e);for(var o=1;o<Xe.length;o++){var u=Xe[o];u.blockedOn===e&&(u.blockedOn=null)}}for(Je!==null&&Oo(Je,e),St!==null&&Oo(St,e),bt!==null&&Oo(bt,e),jr.forEach(n),At.forEach(n),o=0;o<Vr.length;o++)u=Vr[o],u.blockedOn===e&&(u.blockedOn=null);for(;0<Vr.length&&(o=Vr[0],o.blockedOn===null);)rf(o),o.blockedOn===null&&Vr.shift()}var Ks=I.ReactCurrentBatchConfig,qi=!0;function Ty(e,n,o,u){var f=qe,h=Ks.transition;Ks.transition=null;try{qe=1,Yl(e,n,o,u)}finally{qe=f,Ks.transition=h}}function Cy(e,n,o,u){var f=qe,h=Ks.transition;Ks.transition=null;try{qe=4,Yl(e,n,o,u)}finally{qe=f,Ks.transition=h}}function Yl(e,n,o,u){if(qi){var f=Ql(e,n,o,u);if(f===null)hc(e,n,u,Xi,o),nf(e,u);else if(by(f,e,n,o,u))u.stopPropagation();else if(nf(e,u),n&4&&-1<Sy.indexOf(e)){for(;f!==null;){var h=Xo(f);if(h!==null&&b(h),h=Ql(e,n,o,u),h===null&&hc(e,n,u,Xi,o),h===f)break;f=h}f!==null&&u.stopPropagation()}else hc(e,n,u,null,o)}}var Xi=null;function Ql(e,n,o,u){if(Xi=null,e=ln(u),e=Ss(e),e!==null)if(n=Be(e),n===null)e=null;else if(o=n.tag,o===13){if(e=yn(n),e!==null)return e;e=null}else if(o===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null);return Xi=e,null}function of(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(yr()){case Br:return 1;case xr:return 4;case Bs:case gs:return 16;case Wi:return 536870912;default:return 16}default:return 16}}var Kr=null,Zl=null,Yi=null;function af(){if(Yi)return Yi;var e,n=Zl,o=n.length,u,f="value"in Kr?Kr.value:Kr.textContent,h=f.length;for(e=0;e<o&&n[e]===f[e];e++);var w=o-e;for(u=1;u<=w&&n[o-u]===f[h-u];u++);return Yi=f.slice(e,1<u?1-u:void 0)}function Qi(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function Zi(){return!0}function lf(){return!1}function Fn(e){function n(o,u,f,h,w){this._reactName=o,this._targetInst=f,this.type=u,this.nativeEvent=h,this.target=w,this.currentTarget=null;for(var _ in e)e.hasOwnProperty(_)&&(o=e[_],this[_]=o?o(h):h[_]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?Zi:lf,this.isPropagationStopped=lf,this}return G(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=Zi)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=Zi)},persist:function(){},isPersistent:Zi}),n}var Gs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Jl=Fn(Gs),$o=G({},Gs,{view:0,detail:0}),Ey=Fn($o),ec,tc,zo,Ji=G({},$o,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:rc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==zo&&(zo&&e.type==="mousemove"?(ec=e.screenX-zo.screenX,tc=e.screenY-zo.screenY):tc=ec=0,zo=e),ec)},movementY:function(e){return"movementY"in e?e.movementY:tc}}),cf=Fn(Ji),jy=G({},Ji,{dataTransfer:0}),_y=Fn(jy),Ry=G({},$o,{relatedTarget:0}),nc=Fn(Ry),Ay=G({},Gs,{animationName:0,elapsedTime:0,pseudoElement:0}),Iy=Fn(Ay),Dy=G({},Gs,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),My=Fn(Dy),Ly=G({},Gs,{data:0}),uf=Fn(Ly),Oy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Py={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"},$y={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function zy(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=$y[e])?!!n[e]:!1}function rc(){return zy}var Fy=G({},$o,{key:function(e){if(e.key){var n=Oy[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Qi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Py[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:rc,charCode:function(e){return e.type==="keypress"?Qi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Qi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Uy=Fn(Fy),By=G({},Ji,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),df=Fn(By),Wy=G({},$o,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:rc}),Hy=Fn(Wy),Vy=G({},Gs,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ky=Fn(Vy),Gy=G({},Ji,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),qy=Fn(Gy),Xy=[9,13,27,32],sc=p&&"CompositionEvent"in window,Fo=null;p&&"documentMode"in document&&(Fo=document.documentMode);var Yy=p&&"TextEvent"in window&&!Fo,ff=p&&(!sc||Fo&&8<Fo&&11>=Fo),pf=" ",hf=!1;function mf(e,n){switch(e){case"keyup":return Xy.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var qs=!1;function Qy(e,n){switch(e){case"compositionend":return gf(n);case"keypress":return n.which!==32?null:(hf=!0,pf);case"textInput":return e=n.data,e===pf&&hf?null:e;default:return null}}function Zy(e,n){if(qs)return e==="compositionend"||!sc&&mf(e,n)?(e=af(),Yi=Zl=Kr=null,qs=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return ff&&n.locale!=="ko"?null:n.data;default:return null}}var Jy={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 vf(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Jy[e.type]:n==="textarea"}function yf(e,n,o,u){ft(u),n=sa(n,"onChange"),0<n.length&&(o=new Jl("onChange","change",null,o,u),e.push({event:o,listeners:n}))}var Uo=null,Bo=null;function ex(e){Of(e,0)}function ea(e){var n=Js(e);if(_e(n))return e}function tx(e,n){if(e==="change")return n}var xf=!1;if(p){var oc;if(p){var ic="oninput"in document;if(!ic){var wf=document.createElement("div");wf.setAttribute("oninput","return;"),ic=typeof wf.oninput=="function"}oc=ic}else oc=!1;xf=oc&&(!document.documentMode||9<document.documentMode)}function kf(){Uo&&(Uo.detachEvent("onpropertychange",Sf),Bo=Uo=null)}function Sf(e){if(e.propertyName==="value"&&ea(Bo)){var n=[];yf(n,Bo,e,ln(e)),Gt(ex,n)}}function nx(e,n,o){e==="focusin"?(kf(),Uo=n,Bo=o,Uo.attachEvent("onpropertychange",Sf)):e==="focusout"&&kf()}function rx(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ea(Bo)}function sx(e,n){if(e==="click")return ea(n)}function ox(e,n){if(e==="input"||e==="change")return ea(n)}function ix(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var nr=typeof Object.is=="function"?Object.is:ix;function Wo(e,n){if(nr(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var o=Object.keys(e),u=Object.keys(n);if(o.length!==u.length)return!1;for(u=0;u<o.length;u++){var f=o[u];if(!g.call(n,f)||!nr(e[f],n[f]))return!1}return!0}function bf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Nf(e,n){var o=bf(e);e=0;for(var u;o;){if(o.nodeType===3){if(u=e+o.textContent.length,e<=n&&u>=n)return{node:o,offset:n-e};e=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=bf(o)}}function Tf(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Tf(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Cf(){for(var e=window,n=ct();n instanceof e.HTMLIFrameElement;){try{var o=typeof n.contentWindow.location.href=="string"}catch{o=!1}if(o)e=n.contentWindow;else break;n=ct(e.document)}return n}function ac(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function ax(e){var n=Cf(),o=e.focusedElem,u=e.selectionRange;if(n!==o&&o&&o.ownerDocument&&Tf(o.ownerDocument.documentElement,o)){if(u!==null&&ac(o)){if(n=u.start,e=u.end,e===void 0&&(e=n),"selectionStart"in o)o.selectionStart=n,o.selectionEnd=Math.min(e,o.value.length);else if(e=(n=o.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var f=o.textContent.length,h=Math.min(u.start,f);u=u.end===void 0?h:Math.min(u.end,f),!e.extend&&h>u&&(f=u,u=h,h=f),f=Nf(o,h);var w=Nf(o,u);f&&w&&(e.rangeCount!==1||e.anchorNode!==f.node||e.anchorOffset!==f.offset||e.focusNode!==w.node||e.focusOffset!==w.offset)&&(n=n.createRange(),n.setStart(f.node,f.offset),e.removeAllRanges(),h>u?(e.addRange(n),e.extend(w.node,w.offset)):(n.setEnd(w.node,w.offset),e.addRange(n)))}}for(n=[],e=o;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<n.length;o++)e=n[o],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var lx=p&&"documentMode"in document&&11>=document.documentMode,Xs=null,lc=null,Ho=null,cc=!1;function Ef(e,n,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;cc||Xs==null||Xs!==ct(u)||(u=Xs,"selectionStart"in u&&ac(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}),Ho&&Wo(Ho,u)||(Ho=u,u=sa(lc,"onSelect"),0<u.length&&(n=new Jl("onSelect","select",null,n,o),e.push({event:n,listeners:u}),n.target=Xs)))}function ta(e,n){var o={};return o[e.toLowerCase()]=n.toLowerCase(),o["Webkit"+e]="webkit"+n,o["Moz"+e]="moz"+n,o}var Ys={animationend:ta("Animation","AnimationEnd"),animationiteration:ta("Animation","AnimationIteration"),animationstart:ta("Animation","AnimationStart"),transitionend:ta("Transition","TransitionEnd")},uc={},jf={};p&&(jf=document.createElement("div").style,"AnimationEvent"in window||(delete Ys.animationend.animation,delete Ys.animationiteration.animation,delete Ys.animationstart.animation),"TransitionEvent"in window||delete Ys.transitionend.transition);function na(e){if(uc[e])return uc[e];if(!Ys[e])return e;var n=Ys[e],o;for(o in n)if(n.hasOwnProperty(o)&&o in jf)return uc[e]=n[o];return e}var _f=na("animationend"),Rf=na("animationiteration"),Af=na("animationstart"),If=na("transitionend"),Df=new Map,Mf="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 Gr(e,n){Df.set(e,n),c(n,[e])}for(var dc=0;dc<Mf.length;dc++){var fc=Mf[dc],cx=fc.toLowerCase(),ux=fc[0].toUpperCase()+fc.slice(1);Gr(cx,"on"+ux)}Gr(_f,"onAnimationEnd"),Gr(Rf,"onAnimationIteration"),Gr(Af,"onAnimationStart"),Gr("dblclick","onDoubleClick"),Gr("focusin","onFocus"),Gr("focusout","onBlur"),Gr(If,"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 Vo="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(" "),dx=new Set("cancel close invalid load scroll toggle".split(" ").concat(Vo));function Lf(e,n,o){var u=e.type||"unknown-event";e.currentTarget=o,Pn(u,n,void 0,e),e.currentTarget=null}function Of(e,n){n=(n&4)!==0;for(var o=0;o<e.length;o++){var u=e[o],f=u.event;u=u.listeners;e:{var h=void 0;if(n)for(var w=u.length-1;0<=w;w--){var _=u[w],M=_.instance,V=_.currentTarget;if(_=_.listener,M!==h&&f.isPropagationStopped())break e;Lf(f,_,V),h=M}else for(w=0;w<u.length;w++){if(_=u[w],M=_.instance,V=_.currentTarget,_=_.listener,M!==h&&f.isPropagationStopped())break e;Lf(f,_,V),h=M}}}if(Le)throw e=Ge,Le=!1,Ge=null,e}function pt(e,n){var o=n[wc];o===void 0&&(o=n[wc]=new Set);var u=e+"__bubble";o.has(u)||(Pf(n,e,2,!1),o.add(u))}function pc(e,n,o){var u=0;n&&(u|=4),Pf(o,e,u,n)}var ra="_reactListening"+Math.random().toString(36).slice(2);function Ko(e){if(!e[ra]){e[ra]=!0,i.forEach(function(o){o!=="selectionchange"&&(dx.has(o)||pc(o,!1,e),pc(o,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[ra]||(n[ra]=!0,pc("selectionchange",!1,n))}}function Pf(e,n,o,u){switch(of(n)){case 1:var f=Ty;break;case 4:f=Cy;break;default:f=Yl}o=f.bind(null,n,o,e),f=void 0,!Ot||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),u?f!==void 0?e.addEventListener(n,o,{capture:!0,passive:f}):e.addEventListener(n,o,!0):f!==void 0?e.addEventListener(n,o,{passive:f}):e.addEventListener(n,o,!1)}function hc(e,n,o,u,f){var h=u;if((n&1)===0&&(n&2)===0&&u!==null)e:for(;;){if(u===null)return;var w=u.tag;if(w===3||w===4){var _=u.stateNode.containerInfo;if(_===f||_.nodeType===8&&_.parentNode===f)break;if(w===4)for(w=u.return;w!==null;){var M=w.tag;if((M===3||M===4)&&(M=w.stateNode.containerInfo,M===f||M.nodeType===8&&M.parentNode===f))return;w=w.return}for(;_!==null;){if(w=Ss(_),w===null)return;if(M=w.tag,M===5||M===6){u=h=w;continue e}_=_.parentNode}}u=u.return}Gt(function(){var V=h,ne=ln(o),se=[];e:{var ee=Df.get(e);if(ee!==void 0){var xe=Jl,Te=e;switch(e){case"keypress":if(Qi(o)===0)break e;case"keydown":case"keyup":xe=Uy;break;case"focusin":Te="focus",xe=nc;break;case"focusout":Te="blur",xe=nc;break;case"beforeblur":case"afterblur":xe=nc;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":xe=cf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":xe=_y;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":xe=Hy;break;case _f:case Rf:case Af:xe=Iy;break;case If:xe=Ky;break;case"scroll":xe=Ey;break;case"wheel":xe=qy;break;case"copy":case"cut":case"paste":xe=My;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":xe=df}var Ee=(n&4)!==0,It=!Ee&&e==="scroll",U=Ee?ee!==null?ee+"Capture":null:ee;Ee=[];for(var O=V,W;O!==null;){W=O;var fe=W.stateNode;if(W.tag===5&&fe!==null&&(W=fe,U!==null&&(fe=st(O,U),fe!=null&&Ee.push(Go(O,fe,W)))),It)break;O=O.return}0<Ee.length&&(ee=new xe(ee,Te,null,o,ne),se.push({event:ee,listeners:Ee}))}}if((n&7)===0){e:{if(ee=e==="mouseover"||e==="pointerover",xe=e==="mouseout"||e==="pointerout",ee&&o!==gn&&(Te=o.relatedTarget||o.fromElement)&&(Ss(Te)||Te[_r]))break e;if((xe||ee)&&(ee=ne.window===ne?ne:(ee=ne.ownerDocument)?ee.defaultView||ee.parentWindow:window,xe?(Te=o.relatedTarget||o.toElement,xe=V,Te=Te?Ss(Te):null,Te!==null&&(It=Be(Te),Te!==It||Te.tag!==5&&Te.tag!==6)&&(Te=null)):(xe=null,Te=V),xe!==Te)){if(Ee=cf,fe="onMouseLeave",U="onMouseEnter",O="mouse",(e==="pointerout"||e==="pointerover")&&(Ee=df,fe="onPointerLeave",U="onPointerEnter",O="pointer"),It=xe==null?ee:Js(xe),W=Te==null?ee:Js(Te),ee=new Ee(fe,O+"leave",xe,o,ne),ee.target=It,ee.relatedTarget=W,fe=null,Ss(ne)===V&&(Ee=new Ee(U,O+"enter",Te,o,ne),Ee.target=W,Ee.relatedTarget=It,fe=Ee),It=fe,xe&&Te)t:{for(Ee=xe,U=Te,O=0,W=Ee;W;W=Qs(W))O++;for(W=0,fe=U;fe;fe=Qs(fe))W++;for(;0<O-W;)Ee=Qs(Ee),O--;for(;0<W-O;)U=Qs(U),W--;for(;O--;){if(Ee===U||U!==null&&Ee===U.alternate)break t;Ee=Qs(Ee),U=Qs(U)}Ee=null}else Ee=null;xe!==null&&$f(se,ee,xe,Ee,!1),Te!==null&&It!==null&&$f(se,It,Te,Ee,!0)}}e:{if(ee=V?Js(V):window,xe=ee.nodeName&&ee.nodeName.toLowerCase(),xe==="select"||xe==="input"&&ee.type==="file")var je=tx;else if(vf(ee))if(xf)je=ox;else{je=rx;var Ie=nx}else(xe=ee.nodeName)&&xe.toLowerCase()==="input"&&(ee.type==="checkbox"||ee.type==="radio")&&(je=sx);if(je&&(je=je(e,V))){yf(se,je,o,ne);break e}Ie&&Ie(e,ee,V),e==="focusout"&&(Ie=ee._wrapperState)&&Ie.controlled&&ee.type==="number"&&wt(ee,"number",ee.value)}switch(Ie=V?Js(V):window,e){case"focusin":(vf(Ie)||Ie.contentEditable==="true")&&(Xs=Ie,lc=V,Ho=null);break;case"focusout":Ho=lc=Xs=null;break;case"mousedown":cc=!0;break;case"contextmenu":case"mouseup":case"dragend":cc=!1,Ef(se,o,ne);break;case"selectionchange":if(lx)break;case"keydown":case"keyup":Ef(se,o,ne)}var De;if(sc)e:{switch(e){case"compositionstart":var Pe="onCompositionStart";break e;case"compositionend":Pe="onCompositionEnd";break e;case"compositionupdate":Pe="onCompositionUpdate";break e}Pe=void 0}else qs?mf(e,o)&&(Pe="onCompositionEnd"):e==="keydown"&&o.keyCode===229&&(Pe="onCompositionStart");Pe&&(ff&&o.locale!=="ko"&&(qs||Pe!=="onCompositionStart"?Pe==="onCompositionEnd"&&qs&&(De=af()):(Kr=ne,Zl="value"in Kr?Kr.value:Kr.textContent,qs=!0)),Ie=sa(V,Pe),0<Ie.length&&(Pe=new uf(Pe,e,null,o,ne),se.push({event:Pe,listeners:Ie}),De?Pe.data=De:(De=gf(o),De!==null&&(Pe.data=De)))),(De=Yy?Qy(e,o):Zy(e,o))&&(V=sa(V,"onBeforeInput"),0<V.length&&(ne=new uf("onBeforeInput","beforeinput",null,o,ne),se.push({event:ne,listeners:V}),ne.data=De))}Of(se,n)})}function Go(e,n,o){return{instance:e,listener:n,currentTarget:o}}function sa(e,n){for(var o=n+"Capture",u=[];e!==null;){var f=e,h=f.stateNode;f.tag===5&&h!==null&&(f=h,h=st(e,o),h!=null&&u.unshift(Go(e,h,f)),h=st(e,n),h!=null&&u.push(Go(e,h,f))),e=e.return}return u}function Qs(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function $f(e,n,o,u,f){for(var h=n._reactName,w=[];o!==null&&o!==u;){var _=o,M=_.alternate,V=_.stateNode;if(M!==null&&M===u)break;_.tag===5&&V!==null&&(_=V,f?(M=st(o,h),M!=null&&w.unshift(Go(o,M,_))):f||(M=st(o,h),M!=null&&w.push(Go(o,M,_)))),o=o.return}w.length!==0&&e.push({event:n,listeners:w})}var fx=/\r\n?/g,px=/\u0000|\uFFFD/g;function zf(e){return(typeof e=="string"?e:""+e).replace(fx,`
39
+ `).replace(px,"")}function oa(e,n,o){if(n=zf(n),zf(e)!==n&&o)throw Error(s(425))}function ia(){}var mc=null,gc=null;function vc(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var yc=typeof setTimeout=="function"?setTimeout:void 0,hx=typeof clearTimeout=="function"?clearTimeout:void 0,Ff=typeof Promise=="function"?Promise:void 0,mx=typeof queueMicrotask=="function"?queueMicrotask:typeof Ff<"u"?function(e){return Ff.resolve(null).then(e).catch(gx)}:yc;function gx(e){setTimeout(function(){throw e})}function xc(e,n){var o=n,u=0;do{var f=o.nextSibling;if(e.removeChild(o),f&&f.nodeType===8)if(o=f.data,o==="/$"){if(u===0){e.removeChild(f),Po(n);return}u--}else o!=="$"&&o!=="$?"&&o!=="$!"||u++;o=f}while(o);Po(n)}function qr(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?")break;if(n==="/$")return null}}return e}function Uf(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var o=e.data;if(o==="$"||o==="$!"||o==="$?"){if(n===0)return e;n--}else o==="/$"&&n++}e=e.previousSibling}return null}var Zs=Math.random().toString(36).slice(2),wr="__reactFiber$"+Zs,qo="__reactProps$"+Zs,_r="__reactContainer$"+Zs,wc="__reactEvents$"+Zs,vx="__reactListeners$"+Zs,yx="__reactHandles$"+Zs;function Ss(e){var n=e[wr];if(n)return n;for(var o=e.parentNode;o;){if(n=o[_r]||o[wr]){if(o=n.alternate,n.child!==null||o!==null&&o.child!==null)for(e=Uf(e);e!==null;){if(o=e[wr])return o;e=Uf(e)}return n}e=o,o=e.parentNode}return null}function Xo(e){return e=e[wr]||e[_r],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Js(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(s(33))}function aa(e){return e[qo]||null}var kc=[],eo=-1;function Xr(e){return{current:e}}function ht(e){0>eo||(e.current=kc[eo],kc[eo]=null,eo--)}function ut(e,n){eo++,kc[eo]=e.current,e.current=n}var Yr={},cn=Xr(Yr),Cn=Xr(!1),bs=Yr;function to(e,n){var o=e.type.contextTypes;if(!o)return Yr;var u=e.stateNode;if(u&&u.__reactInternalMemoizedUnmaskedChildContext===n)return u.__reactInternalMemoizedMaskedChildContext;var f={},h;for(h in o)f[h]=n[h];return u&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=f),f}function En(e){return e=e.childContextTypes,e!=null}function la(){ht(Cn),ht(cn)}function Bf(e,n,o){if(cn.current!==Yr)throw Error(s(168));ut(cn,n),ut(Cn,o)}function Wf(e,n,o){var u=e.stateNode;if(n=n.childContextTypes,typeof u.getChildContext!="function")return o;u=u.getChildContext();for(var f in u)if(!(f in n))throw Error(s(108,Ne(e)||"Unknown",f));return G({},o,u)}function ca(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Yr,bs=cn.current,ut(cn,e),ut(Cn,Cn.current),!0}function Hf(e,n,o){var u=e.stateNode;if(!u)throw Error(s(169));o?(e=Wf(e,n,bs),u.__reactInternalMemoizedMergedChildContext=e,ht(Cn),ht(cn),ut(cn,e)):ht(Cn),ut(Cn,o)}var Rr=null,ua=!1,Sc=!1;function Vf(e){Rr===null?Rr=[e]:Rr.push(e)}function xx(e){ua=!0,Vf(e)}function Qr(){if(!Sc&&Rr!==null){Sc=!0;var e=0,n=qe;try{var o=Rr;for(qe=1;e<o.length;e++){var u=o[e];do u=u(!0);while(u!==null)}Rr=null,ua=!1}catch(f){throw Rr!==null&&(Rr=Rr.slice(e+1)),Ze(Br,Qr),f}finally{qe=n,Sc=!1}}return null}var no=[],ro=0,da=null,fa=0,Gn=[],qn=0,Ns=null,Ar=1,Ir="";function Ts(e,n){no[ro++]=fa,no[ro++]=da,da=e,fa=n}function Kf(e,n,o){Gn[qn++]=Ar,Gn[qn++]=Ir,Gn[qn++]=Ns,Ns=e;var u=Ar;e=Ir;var f=32-xn(u)-1;u&=~(1<<f),o+=1;var h=32-xn(n)+f;if(30<h){var w=f-f%5;h=(u&(1<<w)-1).toString(32),u>>=w,f-=w,Ar=1<<32-xn(n)+f|o<<f|u,Ir=h+e}else Ar=1<<h|o<<f|u,Ir=e}function bc(e){e.return!==null&&(Ts(e,1),Kf(e,1,0))}function Nc(e){for(;e===da;)da=no[--ro],no[ro]=null,fa=no[--ro],no[ro]=null;for(;e===Ns;)Ns=Gn[--qn],Gn[qn]=null,Ir=Gn[--qn],Gn[qn]=null,Ar=Gn[--qn],Gn[qn]=null}var Un=null,Bn=null,xt=!1,rr=null;function Gf(e,n){var o=Zn(5,null,null,0);o.elementType="DELETED",o.stateNode=n,o.return=e,n=e.deletions,n===null?(e.deletions=[o],e.flags|=16):n.push(o)}function qf(e,n){switch(e.tag){case 5:var o=e.type;return n=n.nodeType!==1||o.toLowerCase()!==n.nodeName.toLowerCase()?null:n,n!==null?(e.stateNode=n,Un=e,Bn=qr(n.firstChild),!0):!1;case 6:return n=e.pendingProps===""||n.nodeType!==3?null:n,n!==null?(e.stateNode=n,Un=e,Bn=null,!0):!1;case 13:return n=n.nodeType!==8?null:n,n!==null?(o=Ns!==null?{id:Ar,overflow:Ir}:null,e.memoizedState={dehydrated:n,treeContext:o,retryLane:1073741824},o=Zn(18,null,null,0),o.stateNode=n,o.return=e,e.child=o,Un=e,Bn=null,!0):!1;default:return!1}}function Tc(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Cc(e){if(xt){var n=Bn;if(n){var o=n;if(!qf(e,n)){if(Tc(e))throw Error(s(418));n=qr(o.nextSibling);var u=Un;n&&qf(e,n)?Gf(u,o):(e.flags=e.flags&-4097|2,xt=!1,Un=e)}}else{if(Tc(e))throw Error(s(418));e.flags=e.flags&-4097|2,xt=!1,Un=e}}}function Xf(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Un=e}function pa(e){if(e!==Un)return!1;if(!xt)return Xf(e),xt=!0,!1;var n;if((n=e.tag!==3)&&!(n=e.tag!==5)&&(n=e.type,n=n!=="head"&&n!=="body"&&!vc(e.type,e.memoizedProps)),n&&(n=Bn)){if(Tc(e))throw Yf(),Error(s(418));for(;n;)Gf(e,n),n=qr(n.nextSibling)}if(Xf(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));e:{for(e=e.nextSibling,n=0;e;){if(e.nodeType===8){var o=e.data;if(o==="/$"){if(n===0){Bn=qr(e.nextSibling);break e}n--}else o!=="$"&&o!=="$!"&&o!=="$?"||n++}e=e.nextSibling}Bn=null}}else Bn=Un?qr(e.stateNode.nextSibling):null;return!0}function Yf(){for(var e=Bn;e;)e=qr(e.nextSibling)}function so(){Bn=Un=null,xt=!1}function Ec(e){rr===null?rr=[e]:rr.push(e)}var wx=I.ReactCurrentBatchConfig;function Yo(e,n,o){if(e=o.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(o._owner){if(o=o._owner,o){if(o.tag!==1)throw Error(s(309));var u=o.stateNode}if(!u)throw Error(s(147,e));var f=u,h=""+e;return n!==null&&n.ref!==null&&typeof n.ref=="function"&&n.ref._stringRef===h?n.ref:(n=function(w){var _=f.refs;w===null?delete _[h]:_[h]=w},n._stringRef=h,n)}if(typeof e!="string")throw Error(s(284));if(!o._owner)throw Error(s(290,e))}return e}function ha(e,n){throw e=Object.prototype.toString.call(n),Error(s(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e))}function Qf(e){var n=e._init;return n(e._payload)}function Zf(e){function n(U,O){if(e){var W=U.deletions;W===null?(U.deletions=[O],U.flags|=16):W.push(O)}}function o(U,O){if(!e)return null;for(;O!==null;)n(U,O),O=O.sibling;return null}function u(U,O){for(U=new Map;O!==null;)O.key!==null?U.set(O.key,O):U.set(O.index,O),O=O.sibling;return U}function f(U,O){return U=os(U,O),U.index=0,U.sibling=null,U}function h(U,O,W){return U.index=W,e?(W=U.alternate,W!==null?(W=W.index,W<O?(U.flags|=2,O):W):(U.flags|=2,O)):(U.flags|=1048576,O)}function w(U){return e&&U.alternate===null&&(U.flags|=2),U}function _(U,O,W,fe){return O===null||O.tag!==6?(O=yu(W,U.mode,fe),O.return=U,O):(O=f(O,W),O.return=U,O)}function M(U,O,W,fe){var je=W.type;return je===K?ne(U,O,W.props.children,fe,W.key):O!==null&&(O.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===oe&&Qf(je)===O.type)?(fe=f(O,W.props),fe.ref=Yo(U,O,W),fe.return=U,fe):(fe=$a(W.type,W.key,W.props,null,U.mode,fe),fe.ref=Yo(U,O,W),fe.return=U,fe)}function V(U,O,W,fe){return O===null||O.tag!==4||O.stateNode.containerInfo!==W.containerInfo||O.stateNode.implementation!==W.implementation?(O=xu(W,U.mode,fe),O.return=U,O):(O=f(O,W.children||[]),O.return=U,O)}function ne(U,O,W,fe,je){return O===null||O.tag!==7?(O=Ds(W,U.mode,fe,je),O.return=U,O):(O=f(O,W),O.return=U,O)}function se(U,O,W){if(typeof O=="string"&&O!==""||typeof O=="number")return O=yu(""+O,U.mode,W),O.return=U,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case L:return W=$a(O.type,O.key,O.props,null,U.mode,W),W.ref=Yo(U,null,O),W.return=U,W;case q:return O=xu(O,U.mode,W),O.return=U,O;case oe:var fe=O._init;return se(U,fe(O._payload),W)}if(Ct(O)||Q(O))return O=Ds(O,U.mode,W,null),O.return=U,O;ha(U,O)}return null}function ee(U,O,W,fe){var je=O!==null?O.key:null;if(typeof W=="string"&&W!==""||typeof W=="number")return je!==null?null:_(U,O,""+W,fe);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case L:return W.key===je?M(U,O,W,fe):null;case q:return W.key===je?V(U,O,W,fe):null;case oe:return je=W._init,ee(U,O,je(W._payload),fe)}if(Ct(W)||Q(W))return je!==null?null:ne(U,O,W,fe,null);ha(U,W)}return null}function xe(U,O,W,fe,je){if(typeof fe=="string"&&fe!==""||typeof fe=="number")return U=U.get(W)||null,_(O,U,""+fe,je);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case L:return U=U.get(fe.key===null?W:fe.key)||null,M(O,U,fe,je);case q:return U=U.get(fe.key===null?W:fe.key)||null,V(O,U,fe,je);case oe:var Ie=fe._init;return xe(U,O,W,Ie(fe._payload),je)}if(Ct(fe)||Q(fe))return U=U.get(W)||null,ne(O,U,fe,je,null);ha(O,fe)}return null}function Te(U,O,W,fe){for(var je=null,Ie=null,De=O,Pe=O=0,Yt=null;De!==null&&Pe<W.length;Pe++){De.index>Pe?(Yt=De,De=null):Yt=De.sibling;var et=ee(U,De,W[Pe],fe);if(et===null){De===null&&(De=Yt);break}e&&De&&et.alternate===null&&n(U,De),O=h(et,O,Pe),Ie===null?je=et:Ie.sibling=et,Ie=et,De=Yt}if(Pe===W.length)return o(U,De),xt&&Ts(U,Pe),je;if(De===null){for(;Pe<W.length;Pe++)De=se(U,W[Pe],fe),De!==null&&(O=h(De,O,Pe),Ie===null?je=De:Ie.sibling=De,Ie=De);return xt&&Ts(U,Pe),je}for(De=u(U,De);Pe<W.length;Pe++)Yt=xe(De,U,Pe,W[Pe],fe),Yt!==null&&(e&&Yt.alternate!==null&&De.delete(Yt.key===null?Pe:Yt.key),O=h(Yt,O,Pe),Ie===null?je=Yt:Ie.sibling=Yt,Ie=Yt);return e&&De.forEach(function(is){return n(U,is)}),xt&&Ts(U,Pe),je}function Ee(U,O,W,fe){var je=Q(W);if(typeof je!="function")throw Error(s(150));if(W=je.call(W),W==null)throw Error(s(151));for(var Ie=je=null,De=O,Pe=O=0,Yt=null,et=W.next();De!==null&&!et.done;Pe++,et=W.next()){De.index>Pe?(Yt=De,De=null):Yt=De.sibling;var is=ee(U,De,et.value,fe);if(is===null){De===null&&(De=Yt);break}e&&De&&is.alternate===null&&n(U,De),O=h(is,O,Pe),Ie===null?je=is:Ie.sibling=is,Ie=is,De=Yt}if(et.done)return o(U,De),xt&&Ts(U,Pe),je;if(De===null){for(;!et.done;Pe++,et=W.next())et=se(U,et.value,fe),et!==null&&(O=h(et,O,Pe),Ie===null?je=et:Ie.sibling=et,Ie=et);return xt&&Ts(U,Pe),je}for(De=u(U,De);!et.done;Pe++,et=W.next())et=xe(De,U,Pe,et.value,fe),et!==null&&(e&&et.alternate!==null&&De.delete(et.key===null?Pe:et.key),O=h(et,O,Pe),Ie===null?je=et:Ie.sibling=et,Ie=et);return e&&De.forEach(function(Jx){return n(U,Jx)}),xt&&Ts(U,Pe),je}function It(U,O,W,fe){if(typeof W=="object"&&W!==null&&W.type===K&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case L:e:{for(var je=W.key,Ie=O;Ie!==null;){if(Ie.key===je){if(je=W.type,je===K){if(Ie.tag===7){o(U,Ie.sibling),O=f(Ie,W.props.children),O.return=U,U=O;break e}}else if(Ie.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===oe&&Qf(je)===Ie.type){o(U,Ie.sibling),O=f(Ie,W.props),O.ref=Yo(U,Ie,W),O.return=U,U=O;break e}o(U,Ie);break}else n(U,Ie);Ie=Ie.sibling}W.type===K?(O=Ds(W.props.children,U.mode,fe,W.key),O.return=U,U=O):(fe=$a(W.type,W.key,W.props,null,U.mode,fe),fe.ref=Yo(U,O,W),fe.return=U,U=fe)}return w(U);case q:e:{for(Ie=W.key;O!==null;){if(O.key===Ie)if(O.tag===4&&O.stateNode.containerInfo===W.containerInfo&&O.stateNode.implementation===W.implementation){o(U,O.sibling),O=f(O,W.children||[]),O.return=U,U=O;break e}else{o(U,O);break}else n(U,O);O=O.sibling}O=xu(W,U.mode,fe),O.return=U,U=O}return w(U);case oe:return Ie=W._init,It(U,O,Ie(W._payload),fe)}if(Ct(W))return Te(U,O,W,fe);if(Q(W))return Ee(U,O,W,fe);ha(U,W)}return typeof W=="string"&&W!==""||typeof W=="number"?(W=""+W,O!==null&&O.tag===6?(o(U,O.sibling),O=f(O,W),O.return=U,U=O):(o(U,O),O=yu(W,U.mode,fe),O.return=U,U=O),w(U)):o(U,O)}return It}var oo=Zf(!0),Jf=Zf(!1),ma=Xr(null),ga=null,io=null,jc=null;function _c(){jc=io=ga=null}function Rc(e){var n=ma.current;ht(ma),e._currentValue=n}function Ac(e,n,o){for(;e!==null;){var u=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,u!==null&&(u.childLanes|=n)):u!==null&&(u.childLanes&n)!==n&&(u.childLanes|=n),e===o)break;e=e.return}}function ao(e,n){ga=e,jc=io=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&n)!==0&&(jn=!0),e.firstContext=null)}function Xn(e){var n=e._currentValue;if(jc!==e)if(e={context:e,memoizedValue:n,next:null},io===null){if(ga===null)throw Error(s(308));io=e,ga.dependencies={lanes:0,firstContext:e}}else io=io.next=e;return n}var Cs=null;function Ic(e){Cs===null?Cs=[e]:Cs.push(e)}function ep(e,n,o,u){var f=n.interleaved;return f===null?(o.next=o,Ic(n)):(o.next=f.next,f.next=o),n.interleaved=o,Dr(e,u)}function Dr(e,n){e.lanes|=n;var o=e.alternate;for(o!==null&&(o.lanes|=n),o=e,e=e.return;e!==null;)e.childLanes|=n,o=e.alternate,o!==null&&(o.childLanes|=n),o=e,e=e.return;return o.tag===3?o.stateNode:null}var Zr=!1;function Dc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function tp(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Mr(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function Jr(e,n,o){var u=e.updateQueue;if(u===null)return null;if(u=u.shared,(Ye&2)!==0){var f=u.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),u.pending=n,Dr(e,o)}return f=u.interleaved,f===null?(n.next=n,Ic(u)):(n.next=f.next,f.next=n),u.interleaved=n,Dr(e,o)}function va(e,n,o){if(n=n.updateQueue,n!==null&&(n=n.shared,(o&4194240)!==0)){var u=n.lanes;u&=e.pendingLanes,o|=u,n.lanes=o,Hr(e,o)}}function np(e,n){var o=e.updateQueue,u=e.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var f=null,h=null;if(o=o.firstBaseUpdate,o!==null){do{var w={eventTime:o.eventTime,lane:o.lane,tag:o.tag,payload:o.payload,callback:o.callback,next:null};h===null?f=h=w:h=h.next=w,o=o.next}while(o!==null);h===null?f=h=n:h=h.next=n}else f=h=n;o={baseState:u.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:u.shared,effects:u.effects},e.updateQueue=o;return}e=o.lastBaseUpdate,e===null?o.firstBaseUpdate=n:e.next=n,o.lastBaseUpdate=n}function ya(e,n,o,u){var f=e.updateQueue;Zr=!1;var h=f.firstBaseUpdate,w=f.lastBaseUpdate,_=f.shared.pending;if(_!==null){f.shared.pending=null;var M=_,V=M.next;M.next=null,w===null?h=V:w.next=V,w=M;var ne=e.alternate;ne!==null&&(ne=ne.updateQueue,_=ne.lastBaseUpdate,_!==w&&(_===null?ne.firstBaseUpdate=V:_.next=V,ne.lastBaseUpdate=M))}if(h!==null){var se=f.baseState;w=0,ne=V=M=null,_=h;do{var ee=_.lane,xe=_.eventTime;if((u&ee)===ee){ne!==null&&(ne=ne.next={eventTime:xe,lane:0,tag:_.tag,payload:_.payload,callback:_.callback,next:null});e:{var Te=e,Ee=_;switch(ee=n,xe=o,Ee.tag){case 1:if(Te=Ee.payload,typeof Te=="function"){se=Te.call(xe,se,ee);break e}se=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Ee.payload,ee=typeof Te=="function"?Te.call(xe,se,ee):Te,ee==null)break e;se=G({},se,ee);break e;case 2:Zr=!0}}_.callback!==null&&_.lane!==0&&(e.flags|=64,ee=f.effects,ee===null?f.effects=[_]:ee.push(_))}else xe={eventTime:xe,lane:ee,tag:_.tag,payload:_.payload,callback:_.callback,next:null},ne===null?(V=ne=xe,M=se):ne=ne.next=xe,w|=ee;if(_=_.next,_===null){if(_=f.shared.pending,_===null)break;ee=_,_=ee.next,ee.next=null,f.lastBaseUpdate=ee,f.shared.pending=null}}while(!0);if(ne===null&&(M=se),f.baseState=M,f.firstBaseUpdate=V,f.lastBaseUpdate=ne,n=f.shared.interleaved,n!==null){f=n;do w|=f.lane,f=f.next;while(f!==n)}else h===null&&(f.shared.lanes=0);_s|=w,e.lanes=w,e.memoizedState=se}}function rp(e,n,o){if(e=n.effects,n.effects=null,e!==null)for(n=0;n<e.length;n++){var u=e[n],f=u.callback;if(f!==null){if(u.callback=null,u=o,typeof f!="function")throw Error(s(191,f));f.call(u)}}}var Qo={},kr=Xr(Qo),Zo=Xr(Qo),Jo=Xr(Qo);function Es(e){if(e===Qo)throw Error(s(174));return e}function Mc(e,n){switch(ut(Jo,n),ut(Zo,e),ut(kr,Qo),e=n.nodeType,e){case 9:case 11:n=(n=n.documentElement)?n.namespaceURI:mt(null,"");break;default:e=e===8?n.parentNode:n,n=e.namespaceURI||null,e=e.tagName,n=mt(n,e)}ht(kr),ut(kr,n)}function lo(){ht(kr),ht(Zo),ht(Jo)}function sp(e){Es(Jo.current);var n=Es(kr.current),o=mt(n,e.type);n!==o&&(ut(Zo,e),ut(kr,o))}function Lc(e){Zo.current===e&&(ht(kr),ht(Zo))}var Nt=Xr(0);function xa(e){for(var n=e;n!==null;){if(n.tag===13){var o=n.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||o.data==="$?"||o.data==="$!"))return n}else if(n.tag===19&&n.memoizedProps.revealOrder!==void 0){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Oc=[];function Pc(){for(var e=0;e<Oc.length;e++)Oc[e]._workInProgressVersionPrimary=null;Oc.length=0}var wa=I.ReactCurrentDispatcher,$c=I.ReactCurrentBatchConfig,js=0,Tt=null,Ut=null,qt=null,ka=!1,ei=!1,ti=0,kx=0;function un(){throw Error(s(321))}function zc(e,n){if(n===null)return!1;for(var o=0;o<n.length&&o<e.length;o++)if(!nr(e[o],n[o]))return!1;return!0}function Fc(e,n,o,u,f,h){if(js=h,Tt=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,wa.current=e===null||e.memoizedState===null?Tx:Cx,e=o(u,f),ei){h=0;do{if(ei=!1,ti=0,25<=h)throw Error(s(301));h+=1,qt=Ut=null,n.updateQueue=null,wa.current=Ex,e=o(u,f)}while(ei)}if(wa.current=Na,n=Ut!==null&&Ut.next!==null,js=0,qt=Ut=Tt=null,ka=!1,n)throw Error(s(300));return e}function Uc(){var e=ti!==0;return ti=0,e}function Sr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qt===null?Tt.memoizedState=qt=e:qt=qt.next=e,qt}function Yn(){if(Ut===null){var e=Tt.alternate;e=e!==null?e.memoizedState:null}else e=Ut.next;var n=qt===null?Tt.memoizedState:qt.next;if(n!==null)qt=n,Ut=e;else{if(e===null)throw Error(s(310));Ut=e,e={memoizedState:Ut.memoizedState,baseState:Ut.baseState,baseQueue:Ut.baseQueue,queue:Ut.queue,next:null},qt===null?Tt.memoizedState=qt=e:qt=qt.next=e}return qt}function ni(e,n){return typeof n=="function"?n(e):n}function Bc(e){var n=Yn(),o=n.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=e;var u=Ut,f=u.baseQueue,h=o.pending;if(h!==null){if(f!==null){var w=f.next;f.next=h.next,h.next=w}u.baseQueue=f=h,o.pending=null}if(f!==null){h=f.next,u=u.baseState;var _=w=null,M=null,V=h;do{var ne=V.lane;if((js&ne)===ne)M!==null&&(M=M.next={lane:0,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),u=V.hasEagerState?V.eagerState:e(u,V.action);else{var se={lane:ne,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null};M===null?(_=M=se,w=u):M=M.next=se,Tt.lanes|=ne,_s|=ne}V=V.next}while(V!==null&&V!==h);M===null?w=u:M.next=_,nr(u,n.memoizedState)||(jn=!0),n.memoizedState=u,n.baseState=w,n.baseQueue=M,o.lastRenderedState=u}if(e=o.interleaved,e!==null){f=e;do h=f.lane,Tt.lanes|=h,_s|=h,f=f.next;while(f!==e)}else f===null&&(o.lanes=0);return[n.memoizedState,o.dispatch]}function Wc(e){var n=Yn(),o=n.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=e;var u=o.dispatch,f=o.pending,h=n.memoizedState;if(f!==null){o.pending=null;var w=f=f.next;do h=e(h,w.action),w=w.next;while(w!==f);nr(h,n.memoizedState)||(jn=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),o.lastRenderedState=h}return[h,u]}function op(){}function ip(e,n){var o=Tt,u=Yn(),f=n(),h=!nr(u.memoizedState,f);if(h&&(u.memoizedState=f,jn=!0),u=u.queue,Hc(cp.bind(null,o,u,e),[e]),u.getSnapshot!==n||h||qt!==null&&qt.memoizedState.tag&1){if(o.flags|=2048,ri(9,lp.bind(null,o,u,f,n),void 0,null),Xt===null)throw Error(s(349));(js&30)!==0||ap(o,n,f)}return f}function ap(e,n,o){e.flags|=16384,e={getSnapshot:n,value:o},n=Tt.updateQueue,n===null?(n={lastEffect:null,stores:null},Tt.updateQueue=n,n.stores=[e]):(o=n.stores,o===null?n.stores=[e]:o.push(e))}function lp(e,n,o,u){n.value=o,n.getSnapshot=u,up(n)&&dp(e)}function cp(e,n,o){return o(function(){up(n)&&dp(e)})}function up(e){var n=e.getSnapshot;e=e.value;try{var o=n();return!nr(e,o)}catch{return!0}}function dp(e){var n=Dr(e,1);n!==null&&ar(n,e,1,-1)}function fp(e){var n=Sr();return typeof e=="function"&&(e=e()),n.memoizedState=n.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ni,lastRenderedState:e},n.queue=e,e=e.dispatch=Nx.bind(null,Tt,e),[n.memoizedState,e]}function ri(e,n,o,u){return e={tag:e,create:n,destroy:o,deps:u,next:null},n=Tt.updateQueue,n===null?(n={lastEffect:null,stores:null},Tt.updateQueue=n,n.lastEffect=e.next=e):(o=n.lastEffect,o===null?n.lastEffect=e.next=e:(u=o.next,o.next=e,e.next=u,n.lastEffect=e)),e}function pp(){return Yn().memoizedState}function Sa(e,n,o,u){var f=Sr();Tt.flags|=e,f.memoizedState=ri(1|n,o,void 0,u===void 0?null:u)}function ba(e,n,o,u){var f=Yn();u=u===void 0?null:u;var h=void 0;if(Ut!==null){var w=Ut.memoizedState;if(h=w.destroy,u!==null&&zc(u,w.deps)){f.memoizedState=ri(n,o,h,u);return}}Tt.flags|=e,f.memoizedState=ri(1|n,o,h,u)}function hp(e,n){return Sa(8390656,8,e,n)}function Hc(e,n){return ba(2048,8,e,n)}function mp(e,n){return ba(4,2,e,n)}function gp(e,n){return ba(4,4,e,n)}function vp(e,n){if(typeof n=="function")return e=e(),n(e),function(){n(null)};if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function yp(e,n,o){return o=o!=null?o.concat([e]):null,ba(4,4,vp.bind(null,n,e),o)}function Vc(){}function xp(e,n){var o=Yn();n=n===void 0?null:n;var u=o.memoizedState;return u!==null&&n!==null&&zc(n,u[1])?u[0]:(o.memoizedState=[e,n],e)}function wp(e,n){var o=Yn();n=n===void 0?null:n;var u=o.memoizedState;return u!==null&&n!==null&&zc(n,u[1])?u[0]:(e=e(),o.memoizedState=[e,n],e)}function kp(e,n,o){return(js&21)===0?(e.baseState&&(e.baseState=!1,jn=!0),e.memoizedState=o):(nr(o,n)||(o=Do(),Tt.lanes|=o,_s|=o,e.baseState=!0),n)}function Sx(e,n){var o=qe;qe=o!==0&&4>o?o:4,e(!0);var u=$c.transition;$c.transition={};try{e(!1),n()}finally{qe=o,$c.transition=u}}function Sp(){return Yn().memoizedState}function bx(e,n,o){var u=rs(e);if(o={lane:u,action:o,hasEagerState:!1,eagerState:null,next:null},bp(e))Np(n,o);else if(o=ep(e,n,o,u),o!==null){var f=Sn();ar(o,e,u,f),Tp(o,n,u)}}function Nx(e,n,o){var u=rs(e),f={lane:u,action:o,hasEagerState:!1,eagerState:null,next:null};if(bp(e))Np(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var w=n.lastRenderedState,_=h(w,o);if(f.hasEagerState=!0,f.eagerState=_,nr(_,w)){var M=n.interleaved;M===null?(f.next=f,Ic(n)):(f.next=M.next,M.next=f),n.interleaved=f;return}}catch{}finally{}o=ep(e,n,f,u),o!==null&&(f=Sn(),ar(o,e,u,f),Tp(o,n,u))}}function bp(e){var n=e.alternate;return e===Tt||n!==null&&n===Tt}function Np(e,n){ei=ka=!0;var o=e.pending;o===null?n.next=n:(n.next=o.next,o.next=n),e.pending=n}function Tp(e,n,o){if((o&4194240)!==0){var u=n.lanes;u&=e.pendingLanes,o|=u,n.lanes=o,Hr(e,o)}}var Na={readContext:Xn,useCallback:un,useContext:un,useEffect:un,useImperativeHandle:un,useInsertionEffect:un,useLayoutEffect:un,useMemo:un,useReducer:un,useRef:un,useState:un,useDebugValue:un,useDeferredValue:un,useTransition:un,useMutableSource:un,useSyncExternalStore:un,useId:un,unstable_isNewReconciler:!1},Tx={readContext:Xn,useCallback:function(e,n){return Sr().memoizedState=[e,n===void 0?null:n],e},useContext:Xn,useEffect:hp,useImperativeHandle:function(e,n,o){return o=o!=null?o.concat([e]):null,Sa(4194308,4,vp.bind(null,n,e),o)},useLayoutEffect:function(e,n){return Sa(4194308,4,e,n)},useInsertionEffect:function(e,n){return Sa(4,2,e,n)},useMemo:function(e,n){var o=Sr();return n=n===void 0?null:n,e=e(),o.memoizedState=[e,n],e},useReducer:function(e,n,o){var u=Sr();return n=o!==void 0?o(n):n,u.memoizedState=u.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},u.queue=e,e=e.dispatch=bx.bind(null,Tt,e),[u.memoizedState,e]},useRef:function(e){var n=Sr();return e={current:e},n.memoizedState=e},useState:fp,useDebugValue:Vc,useDeferredValue:function(e){return Sr().memoizedState=e},useTransition:function(){var e=fp(!1),n=e[0];return e=Sx.bind(null,e[1]),Sr().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,o){var u=Tt,f=Sr();if(xt){if(o===void 0)throw Error(s(407));o=o()}else{if(o=n(),Xt===null)throw Error(s(349));(js&30)!==0||ap(u,n,o)}f.memoizedState=o;var h={value:o,getSnapshot:n};return f.queue=h,hp(cp.bind(null,u,h,e),[e]),u.flags|=2048,ri(9,lp.bind(null,u,h,o,n),void 0,null),o},useId:function(){var e=Sr(),n=Xt.identifierPrefix;if(xt){var o=Ir,u=Ar;o=(u&~(1<<32-xn(u)-1)).toString(32)+o,n=":"+n+"R"+o,o=ti++,0<o&&(n+="H"+o.toString(32)),n+=":"}else o=kx++,n=":"+n+"r"+o.toString(32)+":";return e.memoizedState=n},unstable_isNewReconciler:!1},Cx={readContext:Xn,useCallback:xp,useContext:Xn,useEffect:Hc,useImperativeHandle:yp,useInsertionEffect:mp,useLayoutEffect:gp,useMemo:wp,useReducer:Bc,useRef:pp,useState:function(){return Bc(ni)},useDebugValue:Vc,useDeferredValue:function(e){var n=Yn();return kp(n,Ut.memoizedState,e)},useTransition:function(){var e=Bc(ni)[0],n=Yn().memoizedState;return[e,n]},useMutableSource:op,useSyncExternalStore:ip,useId:Sp,unstable_isNewReconciler:!1},Ex={readContext:Xn,useCallback:xp,useContext:Xn,useEffect:Hc,useImperativeHandle:yp,useInsertionEffect:mp,useLayoutEffect:gp,useMemo:wp,useReducer:Wc,useRef:pp,useState:function(){return Wc(ni)},useDebugValue:Vc,useDeferredValue:function(e){var n=Yn();return Ut===null?n.memoizedState=e:kp(n,Ut.memoizedState,e)},useTransition:function(){var e=Wc(ni)[0],n=Yn().memoizedState;return[e,n]},useMutableSource:op,useSyncExternalStore:ip,useId:Sp,unstable_isNewReconciler:!1};function sr(e,n){if(e&&e.defaultProps){n=G({},n),e=e.defaultProps;for(var o in e)n[o]===void 0&&(n[o]=e[o]);return n}return n}function Kc(e,n,o,u){n=e.memoizedState,o=o(u,n),o=o==null?n:G({},n,o),e.memoizedState=o,e.lanes===0&&(e.updateQueue.baseState=o)}var Ta={isMounted:function(e){return(e=e._reactInternals)?Be(e)===e:!1},enqueueSetState:function(e,n,o){e=e._reactInternals;var u=Sn(),f=rs(e),h=Mr(u,f);h.payload=n,o!=null&&(h.callback=o),n=Jr(e,h,f),n!==null&&(ar(n,e,f,u),va(n,e,f))},enqueueReplaceState:function(e,n,o){e=e._reactInternals;var u=Sn(),f=rs(e),h=Mr(u,f);h.tag=1,h.payload=n,o!=null&&(h.callback=o),n=Jr(e,h,f),n!==null&&(ar(n,e,f,u),va(n,e,f))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var o=Sn(),u=rs(e),f=Mr(o,u);f.tag=2,n!=null&&(f.callback=n),n=Jr(e,f,u),n!==null&&(ar(n,e,u,o),va(n,e,u))}};function Cp(e,n,o,u,f,h,w){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(u,h,w):n.prototype&&n.prototype.isPureReactComponent?!Wo(o,u)||!Wo(f,h):!0}function Ep(e,n,o){var u=!1,f=Yr,h=n.contextType;return typeof h=="object"&&h!==null?h=Xn(h):(f=En(n)?bs:cn.current,u=n.contextTypes,h=(u=u!=null)?to(e,f):Yr),n=new n(o,h),e.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,n.updater=Ta,e.stateNode=n,n._reactInternals=e,u&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=f,e.__reactInternalMemoizedMaskedChildContext=h),n}function jp(e,n,o,u){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(o,u),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(o,u),n.state!==e&&Ta.enqueueReplaceState(n,n.state,null)}function Gc(e,n,o,u){var f=e.stateNode;f.props=o,f.state=e.memoizedState,f.refs={},Dc(e);var h=n.contextType;typeof h=="object"&&h!==null?f.context=Xn(h):(h=En(n)?bs:cn.current,f.context=to(e,h)),f.state=e.memoizedState,h=n.getDerivedStateFromProps,typeof h=="function"&&(Kc(e,n,h,o),f.state=e.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(n=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),n!==f.state&&Ta.enqueueReplaceState(f,f.state,null),ya(e,o,f,u),f.state=e.memoizedState),typeof f.componentDidMount=="function"&&(e.flags|=4194308)}function co(e,n){try{var o="",u=n;do o+=X(u),u=u.return;while(u);var f=o}catch(h){f=`
40
+ Error generating stack: `+h.message+`
41
+ `+h.stack}return{value:e,source:n,stack:f,digest:null}}function qc(e,n,o){return{value:e,source:null,stack:o??null,digest:n??null}}function Xc(e,n){try{console.error(n.value)}catch(o){setTimeout(function(){throw o})}}var jx=typeof WeakMap=="function"?WeakMap:Map;function _p(e,n,o){o=Mr(-1,o),o.tag=3,o.payload={element:null};var u=n.value;return o.callback=function(){Ia||(Ia=!0,uu=u),Xc(e,n)},o}function Rp(e,n,o){o=Mr(-1,o),o.tag=3;var u=e.type.getDerivedStateFromError;if(typeof u=="function"){var f=n.value;o.payload=function(){return u(f)},o.callback=function(){Xc(e,n)}}var h=e.stateNode;return h!==null&&typeof h.componentDidCatch=="function"&&(o.callback=function(){Xc(e,n),typeof u!="function"&&(ts===null?ts=new Set([this]):ts.add(this));var w=n.stack;this.componentDidCatch(n.value,{componentStack:w!==null?w:""})}),o}function Ap(e,n,o){var u=e.pingCache;if(u===null){u=e.pingCache=new jx;var f=new Set;u.set(n,f)}else f=u.get(n),f===void 0&&(f=new Set,u.set(n,f));f.has(o)||(f.add(o),e=Bx.bind(null,e,n,o),n.then(e,e))}function Ip(e){do{var n;if((n=e.tag===13)&&(n=e.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return e;e=e.return}while(e!==null);return null}function Dp(e,n,o,u,f){return(e.mode&1)===0?(e===n?e.flags|=65536:(e.flags|=128,o.flags|=131072,o.flags&=-52805,o.tag===1&&(o.alternate===null?o.tag=17:(n=Mr(-1,1),n.tag=2,Jr(o,n,1))),o.lanes|=1),e):(e.flags|=65536,e.lanes=f,e)}var _x=I.ReactCurrentOwner,jn=!1;function kn(e,n,o,u){n.child=e===null?Jf(n,null,o,u):oo(n,e.child,o,u)}function Mp(e,n,o,u,f){o=o.render;var h=n.ref;return ao(n,f),u=Fc(e,n,o,u,h,f),o=Uc(),e!==null&&!jn?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~f,Lr(e,n,f)):(xt&&o&&bc(n),n.flags|=1,kn(e,n,u,f),n.child)}function Lp(e,n,o,u,f){if(e===null){var h=o.type;return typeof h=="function"&&!vu(h)&&h.defaultProps===void 0&&o.compare===null&&o.defaultProps===void 0?(n.tag=15,n.type=h,Op(e,n,h,u,f)):(e=$a(o.type,null,u,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,(e.lanes&f)===0){var w=h.memoizedProps;if(o=o.compare,o=o!==null?o:Wo,o(w,u)&&e.ref===n.ref)return Lr(e,n,f)}return n.flags|=1,e=os(h,u),e.ref=n.ref,e.return=n,n.child=e}function Op(e,n,o,u,f){if(e!==null){var h=e.memoizedProps;if(Wo(h,u)&&e.ref===n.ref)if(jn=!1,n.pendingProps=u=h,(e.lanes&f)!==0)(e.flags&131072)!==0&&(jn=!0);else return n.lanes=e.lanes,Lr(e,n,f)}return Yc(e,n,o,u,f)}function Pp(e,n,o){var u=n.pendingProps,f=u.children,h=e!==null?e.memoizedState:null;if(u.mode==="hidden")if((n.mode&1)===0)n.memoizedState={baseLanes:0,cachePool:null,transitions:null},ut(fo,Wn),Wn|=o;else{if((o&1073741824)===0)return e=h!==null?h.baseLanes|o:o,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:e,cachePool:null,transitions:null},n.updateQueue=null,ut(fo,Wn),Wn|=e,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},u=h!==null?h.baseLanes:o,ut(fo,Wn),Wn|=u}else h!==null?(u=h.baseLanes|o,n.memoizedState=null):u=o,ut(fo,Wn),Wn|=u;return kn(e,n,f,o),n.child}function $p(e,n){var o=n.ref;(e===null&&o!==null||e!==null&&e.ref!==o)&&(n.flags|=512,n.flags|=2097152)}function Yc(e,n,o,u,f){var h=En(o)?bs:cn.current;return h=to(n,h),ao(n,f),o=Fc(e,n,o,u,h,f),u=Uc(),e!==null&&!jn?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~f,Lr(e,n,f)):(xt&&u&&bc(n),n.flags|=1,kn(e,n,o,f),n.child)}function zp(e,n,o,u,f){if(En(o)){var h=!0;ca(n)}else h=!1;if(ao(n,f),n.stateNode===null)Ea(e,n),Ep(n,o,u),Gc(n,o,u,f),u=!0;else if(e===null){var w=n.stateNode,_=n.memoizedProps;w.props=_;var M=w.context,V=o.contextType;typeof V=="object"&&V!==null?V=Xn(V):(V=En(o)?bs:cn.current,V=to(n,V));var ne=o.getDerivedStateFromProps,se=typeof ne=="function"||typeof w.getSnapshotBeforeUpdate=="function";se||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(_!==u||M!==V)&&jp(n,w,u,V),Zr=!1;var ee=n.memoizedState;w.state=ee,ya(n,u,w,f),M=n.memoizedState,_!==u||ee!==M||Cn.current||Zr?(typeof ne=="function"&&(Kc(n,o,ne,u),M=n.memoizedState),(_=Zr||Cp(n,o,_,u,ee,M,V))?(se||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(n.flags|=4194308)):(typeof w.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=u,n.memoizedState=M),w.props=u,w.state=M,w.context=V,u=_):(typeof w.componentDidMount=="function"&&(n.flags|=4194308),u=!1)}else{w=n.stateNode,tp(e,n),_=n.memoizedProps,V=n.type===n.elementType?_:sr(n.type,_),w.props=V,se=n.pendingProps,ee=w.context,M=o.contextType,typeof M=="object"&&M!==null?M=Xn(M):(M=En(o)?bs:cn.current,M=to(n,M));var xe=o.getDerivedStateFromProps;(ne=typeof xe=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(_!==se||ee!==M)&&jp(n,w,u,M),Zr=!1,ee=n.memoizedState,w.state=ee,ya(n,u,w,f);var Te=n.memoizedState;_!==se||ee!==Te||Cn.current||Zr?(typeof xe=="function"&&(Kc(n,o,xe,u),Te=n.memoizedState),(V=Zr||Cp(n,o,V,u,ee,Te,M)||!1)?(ne||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(u,Te,M),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(u,Te,M)),typeof w.componentDidUpdate=="function"&&(n.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof w.componentDidUpdate!="function"||_===e.memoizedProps&&ee===e.memoizedState||(n.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&ee===e.memoizedState||(n.flags|=1024),n.memoizedProps=u,n.memoizedState=Te),w.props=u,w.state=Te,w.context=M,u=V):(typeof w.componentDidUpdate!="function"||_===e.memoizedProps&&ee===e.memoizedState||(n.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&ee===e.memoizedState||(n.flags|=1024),u=!1)}return Qc(e,n,o,u,h,f)}function Qc(e,n,o,u,f,h){$p(e,n);var w=(n.flags&128)!==0;if(!u&&!w)return f&&Hf(n,o,!1),Lr(e,n,h);u=n.stateNode,_x.current=n;var _=w&&typeof o.getDerivedStateFromError!="function"?null:u.render();return n.flags|=1,e!==null&&w?(n.child=oo(n,e.child,null,h),n.child=oo(n,null,_,h)):kn(e,n,_,h),n.memoizedState=u.state,f&&Hf(n,o,!0),n.child}function Fp(e){var n=e.stateNode;n.pendingContext?Bf(e,n.pendingContext,n.pendingContext!==n.context):n.context&&Bf(e,n.context,!1),Mc(e,n.containerInfo)}function Up(e,n,o,u,f){return so(),Ec(f),n.flags|=256,kn(e,n,o,u),n.child}var Zc={dehydrated:null,treeContext:null,retryLane:0};function Jc(e){return{baseLanes:e,cachePool:null,transitions:null}}function Bp(e,n,o){var u=n.pendingProps,f=Nt.current,h=!1,w=(n.flags&128)!==0,_;if((_=w)||(_=e!==null&&e.memoizedState===null?!1:(f&2)!==0),_?(h=!0,n.flags&=-129):(e===null||e.memoizedState!==null)&&(f|=1),ut(Nt,f&1),e===null)return Cc(n),e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((n.mode&1)===0?n.lanes=1:e.data==="$!"?n.lanes=8:n.lanes=1073741824,null):(w=u.children,e=u.fallback,h?(u=n.mode,h=n.child,w={mode:"hidden",children:w},(u&1)===0&&h!==null?(h.childLanes=0,h.pendingProps=w):h=za(w,u,0,null),e=Ds(e,u,o,null),h.return=n,e.return=n,h.sibling=e,n.child=h,n.child.memoizedState=Jc(o),n.memoizedState=Zc,e):eu(n,w));if(f=e.memoizedState,f!==null&&(_=f.dehydrated,_!==null))return Rx(e,n,w,u,_,f,o);if(h){h=u.fallback,w=n.mode,f=e.child,_=f.sibling;var M={mode:"hidden",children:u.children};return(w&1)===0&&n.child!==f?(u=n.child,u.childLanes=0,u.pendingProps=M,n.deletions=null):(u=os(f,M),u.subtreeFlags=f.subtreeFlags&14680064),_!==null?h=os(_,h):(h=Ds(h,w,o,null),h.flags|=2),h.return=n,u.return=n,u.sibling=h,n.child=u,u=h,h=n.child,w=e.child.memoizedState,w=w===null?Jc(o):{baseLanes:w.baseLanes|o,cachePool:null,transitions:w.transitions},h.memoizedState=w,h.childLanes=e.childLanes&~o,n.memoizedState=Zc,u}return h=e.child,e=h.sibling,u=os(h,{mode:"visible",children:u.children}),(n.mode&1)===0&&(u.lanes=o),u.return=n,u.sibling=null,e!==null&&(o=n.deletions,o===null?(n.deletions=[e],n.flags|=16):o.push(e)),n.child=u,n.memoizedState=null,u}function eu(e,n){return n=za({mode:"visible",children:n},e.mode,0,null),n.return=e,e.child=n}function Ca(e,n,o,u){return u!==null&&Ec(u),oo(n,e.child,null,o),e=eu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Rx(e,n,o,u,f,h,w){if(o)return n.flags&256?(n.flags&=-257,u=qc(Error(s(422))),Ca(e,n,w,u)):n.memoizedState!==null?(n.child=e.child,n.flags|=128,null):(h=u.fallback,f=n.mode,u=za({mode:"visible",children:u.children},f,0,null),h=Ds(h,f,w,null),h.flags|=2,u.return=n,h.return=n,u.sibling=h,n.child=u,(n.mode&1)!==0&&oo(n,e.child,null,w),n.child.memoizedState=Jc(w),n.memoizedState=Zc,h);if((n.mode&1)===0)return Ca(e,n,w,null);if(f.data==="$!"){if(u=f.nextSibling&&f.nextSibling.dataset,u)var _=u.dgst;return u=_,h=Error(s(419)),u=qc(h,u,void 0),Ca(e,n,w,u)}if(_=(w&e.childLanes)!==0,jn||_){if(u=Xt,u!==null){switch(w&-w){case 4:f=2;break;case 16:f=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:f=32;break;case 536870912:f=268435456;break;default:f=0}f=(f&(u.suspendedLanes|w))!==0?0:f,f!==0&&f!==h.retryLane&&(h.retryLane=f,Dr(e,f),ar(u,e,f,-1))}return gu(),u=qc(Error(s(421))),Ca(e,n,w,u)}return f.data==="$?"?(n.flags|=128,n.child=e.child,n=Wx.bind(null,e),f._reactRetry=n,null):(e=h.treeContext,Bn=qr(f.nextSibling),Un=n,xt=!0,rr=null,e!==null&&(Gn[qn++]=Ar,Gn[qn++]=Ir,Gn[qn++]=Ns,Ar=e.id,Ir=e.overflow,Ns=n),n=eu(n,u.children),n.flags|=4096,n)}function Wp(e,n,o){e.lanes|=n;var u=e.alternate;u!==null&&(u.lanes|=n),Ac(e.return,n,o)}function tu(e,n,o,u,f){var h=e.memoizedState;h===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:u,tail:o,tailMode:f}:(h.isBackwards=n,h.rendering=null,h.renderingStartTime=0,h.last=u,h.tail=o,h.tailMode=f)}function Hp(e,n,o){var u=n.pendingProps,f=u.revealOrder,h=u.tail;if(kn(e,n,u.children,o),u=Nt.current,(u&2)!==0)u=u&1|2,n.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Wp(e,o,n);else if(e.tag===19)Wp(e,o,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}u&=1}if(ut(Nt,u),(n.mode&1)===0)n.memoizedState=null;else switch(f){case"forwards":for(o=n.child,f=null;o!==null;)e=o.alternate,e!==null&&xa(e)===null&&(f=o),o=o.sibling;o=f,o===null?(f=n.child,n.child=null):(f=o.sibling,o.sibling=null),tu(n,!1,f,o,h);break;case"backwards":for(o=null,f=n.child,n.child=null;f!==null;){if(e=f.alternate,e!==null&&xa(e)===null){n.child=f;break}e=f.sibling,f.sibling=o,o=f,f=e}tu(n,!0,o,null,h);break;case"together":tu(n,!1,null,null,void 0);break;default:n.memoizedState=null}return n.child}function Ea(e,n){(n.mode&1)===0&&e!==null&&(e.alternate=null,n.alternate=null,n.flags|=2)}function Lr(e,n,o){if(e!==null&&(n.dependencies=e.dependencies),_s|=n.lanes,(o&n.childLanes)===0)return null;if(e!==null&&n.child!==e.child)throw Error(s(153));if(n.child!==null){for(e=n.child,o=os(e,e.pendingProps),n.child=o,o.return=n;e.sibling!==null;)e=e.sibling,o=o.sibling=os(e,e.pendingProps),o.return=n;o.sibling=null}return n.child}function Ax(e,n,o){switch(n.tag){case 3:Fp(n),so();break;case 5:sp(n);break;case 1:En(n.type)&&ca(n);break;case 4:Mc(n,n.stateNode.containerInfo);break;case 10:var u=n.type._context,f=n.memoizedProps.value;ut(ma,u._currentValue),u._currentValue=f;break;case 13:if(u=n.memoizedState,u!==null)return u.dehydrated!==null?(ut(Nt,Nt.current&1),n.flags|=128,null):(o&n.child.childLanes)!==0?Bp(e,n,o):(ut(Nt,Nt.current&1),e=Lr(e,n,o),e!==null?e.sibling:null);ut(Nt,Nt.current&1);break;case 19:if(u=(o&n.childLanes)!==0,(e.flags&128)!==0){if(u)return Hp(e,n,o);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),ut(Nt,Nt.current),u)break;return null;case 22:case 23:return n.lanes=0,Pp(e,n,o)}return Lr(e,n,o)}var Vp,nu,Kp,Gp;Vp=function(e,n){for(var o=n.child;o!==null;){if(o.tag===5||o.tag===6)e.appendChild(o.stateNode);else if(o.tag!==4&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===n)break;for(;o.sibling===null;){if(o.return===null||o.return===n)return;o=o.return}o.sibling.return=o.return,o=o.sibling}},nu=function(){},Kp=function(e,n,o,u){var f=e.memoizedProps;if(f!==u){e=n.stateNode,Es(kr.current);var h=null;switch(o){case"input":f=$e(e,f),u=$e(e,u),h=[];break;case"select":f=G({},f,{value:void 0}),u=G({},u,{value:void 0}),h=[];break;case"textarea":f=Lt(e,f),u=Lt(e,u),h=[];break;default:typeof f.onClick!="function"&&typeof u.onClick=="function"&&(e.onclick=ia)}tr(o,u);var w;o=null;for(V in f)if(!u.hasOwnProperty(V)&&f.hasOwnProperty(V)&&f[V]!=null)if(V==="style"){var _=f[V];for(w in _)_.hasOwnProperty(w)&&(o||(o={}),o[w]="")}else V!=="dangerouslySetInnerHTML"&&V!=="children"&&V!=="suppressContentEditableWarning"&&V!=="suppressHydrationWarning"&&V!=="autoFocus"&&(l.hasOwnProperty(V)?h||(h=[]):(h=h||[]).push(V,null));for(V in u){var M=u[V];if(_=f!=null?f[V]:void 0,u.hasOwnProperty(V)&&M!==_&&(M!=null||_!=null))if(V==="style")if(_){for(w in _)!_.hasOwnProperty(w)||M&&M.hasOwnProperty(w)||(o||(o={}),o[w]="");for(w in M)M.hasOwnProperty(w)&&_[w]!==M[w]&&(o||(o={}),o[w]=M[w])}else o||(h||(h=[]),h.push(V,o)),o=M;else V==="dangerouslySetInnerHTML"?(M=M?M.__html:void 0,_=_?_.__html:void 0,M!=null&&_!==M&&(h=h||[]).push(V,M)):V==="children"?typeof M!="string"&&typeof M!="number"||(h=h||[]).push(V,""+M):V!=="suppressContentEditableWarning"&&V!=="suppressHydrationWarning"&&(l.hasOwnProperty(V)?(M!=null&&V==="onScroll"&&pt("scroll",e),h||_===M||(h=[])):(h=h||[]).push(V,M))}o&&(h=h||[]).push("style",o);var V=h;(n.updateQueue=V)&&(n.flags|=4)}},Gp=function(e,n,o,u){o!==u&&(n.flags|=4)};function si(e,n){if(!xt)switch(e.tailMode){case"hidden":n=e.tail;for(var o=null;n!==null;)n.alternate!==null&&(o=n),n=n.sibling;o===null?e.tail=null:o.sibling=null;break;case"collapsed":o=e.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:u.sibling=null}}function dn(e){var n=e.alternate!==null&&e.alternate.child===e.child,o=0,u=0;if(n)for(var f=e.child;f!==null;)o|=f.lanes|f.childLanes,u|=f.subtreeFlags&14680064,u|=f.flags&14680064,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)o|=f.lanes|f.childLanes,u|=f.subtreeFlags,u|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=u,e.childLanes=o,n}function Ix(e,n,o){var u=n.pendingProps;switch(Nc(n),n.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dn(n),null;case 1:return En(n.type)&&la(),dn(n),null;case 3:return u=n.stateNode,lo(),ht(Cn),ht(cn),Pc(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(e===null||e.child===null)&&(pa(n)?n.flags|=4:e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,rr!==null&&(pu(rr),rr=null))),nu(e,n),dn(n),null;case 5:Lc(n);var f=Es(Jo.current);if(o=n.type,e!==null&&n.stateNode!=null)Kp(e,n,o,u,f),e.ref!==n.ref&&(n.flags|=512,n.flags|=2097152);else{if(!u){if(n.stateNode===null)throw Error(s(166));return dn(n),null}if(e=Es(kr.current),pa(n)){u=n.stateNode,o=n.type;var h=n.memoizedProps;switch(u[wr]=n,u[qo]=h,e=(n.mode&1)!==0,o){case"dialog":pt("cancel",u),pt("close",u);break;case"iframe":case"object":case"embed":pt("load",u);break;case"video":case"audio":for(f=0;f<Vo.length;f++)pt(Vo[f],u);break;case"source":pt("error",u);break;case"img":case"image":case"link":pt("error",u),pt("load",u);break;case"details":pt("toggle",u);break;case"input":en(u,h),pt("invalid",u);break;case"select":u._wrapperState={wasMultiple:!!h.multiple},pt("invalid",u);break;case"textarea":Y(u,h),pt("invalid",u)}tr(o,h),f=null;for(var w in h)if(h.hasOwnProperty(w)){var _=h[w];w==="children"?typeof _=="string"?u.textContent!==_&&(h.suppressHydrationWarning!==!0&&oa(u.textContent,_,e),f=["children",_]):typeof _=="number"&&u.textContent!==""+_&&(h.suppressHydrationWarning!==!0&&oa(u.textContent,_,e),f=["children",""+_]):l.hasOwnProperty(w)&&_!=null&&w==="onScroll"&&pt("scroll",u)}switch(o){case"input":He(u),tn(u,h,!0);break;case"textarea":He(u),Ue(u);break;case"select":case"option":break;default:typeof h.onClick=="function"&&(u.onclick=ia)}u=f,n.updateQueue=u,u!==null&&(n.flags|=4)}else{w=f.nodeType===9?f:f.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=nt(o)),e==="http://www.w3.org/1999/xhtml"?o==="script"?(e=w.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof u.is=="string"?e=w.createElement(o,{is:u.is}):(e=w.createElement(o),o==="select"&&(w=e,u.multiple?w.multiple=!0:u.size&&(w.size=u.size))):e=w.createElementNS(e,o),e[wr]=n,e[qo]=u,Vp(e,n,!1,!1),n.stateNode=e;e:{switch(w=On(o,u),o){case"dialog":pt("cancel",e),pt("close",e),f=u;break;case"iframe":case"object":case"embed":pt("load",e),f=u;break;case"video":case"audio":for(f=0;f<Vo.length;f++)pt(Vo[f],e);f=u;break;case"source":pt("error",e),f=u;break;case"img":case"image":case"link":pt("error",e),pt("load",e),f=u;break;case"details":pt("toggle",e),f=u;break;case"input":en(e,u),f=$e(e,u),pt("invalid",e);break;case"option":f=u;break;case"select":e._wrapperState={wasMultiple:!!u.multiple},f=G({},u,{value:void 0}),pt("invalid",e);break;case"textarea":Y(e,u),f=Lt(e,u),pt("invalid",e);break;default:f=u}tr(o,f),_=f;for(h in _)if(_.hasOwnProperty(h)){var M=_[h];h==="style"?hr(e,M):h==="dangerouslySetInnerHTML"?(M=M?M.__html:void 0,M!=null&&Et(e,M)):h==="children"?typeof M=="string"?(o!=="textarea"||M!=="")&&an(e,M):typeof M=="number"&&an(e,""+M):h!=="suppressContentEditableWarning"&&h!=="suppressHydrationWarning"&&h!=="autoFocus"&&(l.hasOwnProperty(h)?M!=null&&h==="onScroll"&&pt("scroll",e):M!=null&&H(e,h,M,w))}switch(o){case"input":He(e),tn(e,u,!1);break;case"textarea":He(e),Ue(e);break;case"option":u.value!=null&&e.setAttribute("value",""+re(u.value));break;case"select":e.multiple=!!u.multiple,h=u.value,h!=null?zt(e,!!u.multiple,h,!1):u.defaultValue!=null&&zt(e,!!u.multiple,u.defaultValue,!0);break;default:typeof f.onClick=="function"&&(e.onclick=ia)}switch(o){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}}u&&(n.flags|=4)}n.ref!==null&&(n.flags|=512,n.flags|=2097152)}return dn(n),null;case 6:if(e&&n.stateNode!=null)Gp(e,n,e.memoizedProps,u);else{if(typeof u!="string"&&n.stateNode===null)throw Error(s(166));if(o=Es(Jo.current),Es(kr.current),pa(n)){if(u=n.stateNode,o=n.memoizedProps,u[wr]=n,(h=u.nodeValue!==o)&&(e=Un,e!==null))switch(e.tag){case 3:oa(u.nodeValue,o,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&oa(u.nodeValue,o,(e.mode&1)!==0)}h&&(n.flags|=4)}else u=(o.nodeType===9?o:o.ownerDocument).createTextNode(u),u[wr]=n,n.stateNode=u}return dn(n),null;case 13:if(ht(Nt),u=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(xt&&Bn!==null&&(n.mode&1)!==0&&(n.flags&128)===0)Yf(),so(),n.flags|=98560,h=!1;else if(h=pa(n),u!==null&&u.dehydrated!==null){if(e===null){if(!h)throw Error(s(318));if(h=n.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(s(317));h[wr]=n}else so(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;dn(n),h=!1}else rr!==null&&(pu(rr),rr=null),h=!0;if(!h)return n.flags&65536?n:null}return(n.flags&128)!==0?(n.lanes=o,n):(u=u!==null,u!==(e!==null&&e.memoizedState!==null)&&u&&(n.child.flags|=8192,(n.mode&1)!==0&&(e===null||(Nt.current&1)!==0?Bt===0&&(Bt=3):gu())),n.updateQueue!==null&&(n.flags|=4),dn(n),null);case 4:return lo(),nu(e,n),e===null&&Ko(n.stateNode.containerInfo),dn(n),null;case 10:return Rc(n.type._context),dn(n),null;case 17:return En(n.type)&&la(),dn(n),null;case 19:if(ht(Nt),h=n.memoizedState,h===null)return dn(n),null;if(u=(n.flags&128)!==0,w=h.rendering,w===null)if(u)si(h,!1);else{if(Bt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(w=xa(e),w!==null){for(n.flags|=128,si(h,!1),u=w.updateQueue,u!==null&&(n.updateQueue=u,n.flags|=4),n.subtreeFlags=0,u=o,o=n.child;o!==null;)h=o,e=u,h.flags&=14680066,w=h.alternate,w===null?(h.childLanes=0,h.lanes=e,h.child=null,h.subtreeFlags=0,h.memoizedProps=null,h.memoizedState=null,h.updateQueue=null,h.dependencies=null,h.stateNode=null):(h.childLanes=w.childLanes,h.lanes=w.lanes,h.child=w.child,h.subtreeFlags=0,h.deletions=null,h.memoizedProps=w.memoizedProps,h.memoizedState=w.memoizedState,h.updateQueue=w.updateQueue,h.type=w.type,e=w.dependencies,h.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),o=o.sibling;return ut(Nt,Nt.current&1|2),n.child}e=e.sibling}h.tail!==null&&kt()>po&&(n.flags|=128,u=!0,si(h,!1),n.lanes=4194304)}else{if(!u)if(e=xa(w),e!==null){if(n.flags|=128,u=!0,o=e.updateQueue,o!==null&&(n.updateQueue=o,n.flags|=4),si(h,!0),h.tail===null&&h.tailMode==="hidden"&&!w.alternate&&!xt)return dn(n),null}else 2*kt()-h.renderingStartTime>po&&o!==1073741824&&(n.flags|=128,u=!0,si(h,!1),n.lanes=4194304);h.isBackwards?(w.sibling=n.child,n.child=w):(o=h.last,o!==null?o.sibling=w:n.child=w,h.last=w)}return h.tail!==null?(n=h.tail,h.rendering=n,h.tail=n.sibling,h.renderingStartTime=kt(),n.sibling=null,o=Nt.current,ut(Nt,u?o&1|2:o&1),n):(dn(n),null);case 22:case 23:return mu(),u=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==u&&(n.flags|=8192),u&&(n.mode&1)!==0?(Wn&1073741824)!==0&&(dn(n),n.subtreeFlags&6&&(n.flags|=8192)):dn(n),null;case 24:return null;case 25:return null}throw Error(s(156,n.tag))}function Dx(e,n){switch(Nc(n),n.tag){case 1:return En(n.type)&&la(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return lo(),ht(Cn),ht(cn),Pc(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 5:return Lc(n),null;case 13:if(ht(Nt),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(s(340));so()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return ht(Nt),null;case 4:return lo(),null;case 10:return Rc(n.type._context),null;case 22:case 23:return mu(),null;case 24:return null;default:return null}}var ja=!1,fn=!1,Mx=typeof WeakSet=="function"?WeakSet:Set,ke=null;function uo(e,n){var o=e.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(u){Rt(e,n,u)}else o.current=null}function ru(e,n,o){try{o()}catch(u){Rt(e,n,u)}}var qp=!1;function Lx(e,n){if(mc=qi,e=Cf(),ac(e)){if("selectionStart"in e)var o={start:e.selectionStart,end:e.selectionEnd};else e:{o=(o=e.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var f=u.anchorOffset,h=u.focusNode;u=u.focusOffset;try{o.nodeType,h.nodeType}catch{o=null;break e}var w=0,_=-1,M=-1,V=0,ne=0,se=e,ee=null;t:for(;;){for(var xe;se!==o||f!==0&&se.nodeType!==3||(_=w+f),se!==h||u!==0&&se.nodeType!==3||(M=w+u),se.nodeType===3&&(w+=se.nodeValue.length),(xe=se.firstChild)!==null;)ee=se,se=xe;for(;;){if(se===e)break t;if(ee===o&&++V===f&&(_=w),ee===h&&++ne===u&&(M=w),(xe=se.nextSibling)!==null)break;se=ee,ee=se.parentNode}se=xe}o=_===-1||M===-1?null:{start:_,end:M}}else o=null}o=o||{start:0,end:0}}else o=null;for(gc={focusedElem:e,selectionRange:o},qi=!1,ke=n;ke!==null;)if(n=ke,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,ke=e;else for(;ke!==null;){n=ke;try{var Te=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(Te!==null){var Ee=Te.memoizedProps,It=Te.memoizedState,U=n.stateNode,O=U.getSnapshotBeforeUpdate(n.elementType===n.type?Ee:sr(n.type,Ee),It);U.__reactInternalSnapshotBeforeUpdate=O}break;case 3:var W=n.stateNode.containerInfo;W.nodeType===1?W.textContent="":W.nodeType===9&&W.documentElement&&W.removeChild(W.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(s(163))}}catch(fe){Rt(n,n.return,fe)}if(e=n.sibling,e!==null){e.return=n.return,ke=e;break}ke=n.return}return Te=qp,qp=!1,Te}function oi(e,n,o){var u=n.updateQueue;if(u=u!==null?u.lastEffect:null,u!==null){var f=u=u.next;do{if((f.tag&e)===e){var h=f.destroy;f.destroy=void 0,h!==void 0&&ru(n,o,h)}f=f.next}while(f!==u)}}function _a(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var o=n=n.next;do{if((o.tag&e)===e){var u=o.create;o.destroy=u()}o=o.next}while(o!==n)}}function su(e){var n=e.ref;if(n!==null){var o=e.stateNode;switch(e.tag){case 5:e=o;break;default:e=o}typeof n=="function"?n(e):n.current=e}}function Xp(e){var n=e.alternate;n!==null&&(e.alternate=null,Xp(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[wr],delete n[qo],delete n[wc],delete n[vx],delete n[yx])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Yp(e){return e.tag===5||e.tag===3||e.tag===4}function Qp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Yp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ou(e,n,o){var u=e.tag;if(u===5||u===6)e=e.stateNode,n?o.nodeType===8?o.parentNode.insertBefore(e,n):o.insertBefore(e,n):(o.nodeType===8?(n=o.parentNode,n.insertBefore(e,o)):(n=o,n.appendChild(e)),o=o._reactRootContainer,o!=null||n.onclick!==null||(n.onclick=ia));else if(u!==4&&(e=e.child,e!==null))for(ou(e,n,o),e=e.sibling;e!==null;)ou(e,n,o),e=e.sibling}function iu(e,n,o){var u=e.tag;if(u===5||u===6)e=e.stateNode,n?o.insertBefore(e,n):o.appendChild(e);else if(u!==4&&(e=e.child,e!==null))for(iu(e,n,o),e=e.sibling;e!==null;)iu(e,n,o),e=e.sibling}var nn=null,or=!1;function es(e,n,o){for(o=o.child;o!==null;)Zp(e,n,o),o=o.sibling}function Zp(e,n,o){if(zn&&typeof zn.onCommitFiberUnmount=="function")try{zn.onCommitFiberUnmount(vs,o)}catch{}switch(o.tag){case 5:fn||uo(o,n);case 6:var u=nn,f=or;nn=null,es(e,n,o),nn=u,or=f,nn!==null&&(or?(e=nn,o=o.stateNode,e.nodeType===8?e.parentNode.removeChild(o):e.removeChild(o)):nn.removeChild(o.stateNode));break;case 18:nn!==null&&(or?(e=nn,o=o.stateNode,e.nodeType===8?xc(e.parentNode,o):e.nodeType===1&&xc(e,o),Po(e)):xc(nn,o.stateNode));break;case 4:u=nn,f=or,nn=o.stateNode.containerInfo,or=!0,es(e,n,o),nn=u,or=f;break;case 0:case 11:case 14:case 15:if(!fn&&(u=o.updateQueue,u!==null&&(u=u.lastEffect,u!==null))){f=u=u.next;do{var h=f,w=h.destroy;h=h.tag,w!==void 0&&((h&2)!==0||(h&4)!==0)&&ru(o,n,w),f=f.next}while(f!==u)}es(e,n,o);break;case 1:if(!fn&&(uo(o,n),u=o.stateNode,typeof u.componentWillUnmount=="function"))try{u.props=o.memoizedProps,u.state=o.memoizedState,u.componentWillUnmount()}catch(_){Rt(o,n,_)}es(e,n,o);break;case 21:es(e,n,o);break;case 22:o.mode&1?(fn=(u=fn)||o.memoizedState!==null,es(e,n,o),fn=u):es(e,n,o);break;default:es(e,n,o)}}function Jp(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var o=e.stateNode;o===null&&(o=e.stateNode=new Mx),n.forEach(function(u){var f=Hx.bind(null,e,u);o.has(u)||(o.add(u),u.then(f,f))})}}function ir(e,n){var o=n.deletions;if(o!==null)for(var u=0;u<o.length;u++){var f=o[u];try{var h=e,w=n,_=w;e:for(;_!==null;){switch(_.tag){case 5:nn=_.stateNode,or=!1;break e;case 3:nn=_.stateNode.containerInfo,or=!0;break e;case 4:nn=_.stateNode.containerInfo,or=!0;break e}_=_.return}if(nn===null)throw Error(s(160));Zp(h,w,f),nn=null,or=!1;var M=f.alternate;M!==null&&(M.return=null),f.return=null}catch(V){Rt(f,n,V)}}if(n.subtreeFlags&12854)for(n=n.child;n!==null;)eh(n,e),n=n.sibling}function eh(e,n){var o=e.alternate,u=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(ir(n,e),br(e),u&4){try{oi(3,e,e.return),_a(3,e)}catch(Ee){Rt(e,e.return,Ee)}try{oi(5,e,e.return)}catch(Ee){Rt(e,e.return,Ee)}}break;case 1:ir(n,e),br(e),u&512&&o!==null&&uo(o,o.return);break;case 5:if(ir(n,e),br(e),u&512&&o!==null&&uo(o,o.return),e.flags&32){var f=e.stateNode;try{an(f,"")}catch(Ee){Rt(e,e.return,Ee)}}if(u&4&&(f=e.stateNode,f!=null)){var h=e.memoizedProps,w=o!==null?o.memoizedProps:h,_=e.type,M=e.updateQueue;if(e.updateQueue=null,M!==null)try{_==="input"&&h.type==="radio"&&h.name!=null&&Fe(f,h),On(_,w);var V=On(_,h);for(w=0;w<M.length;w+=2){var ne=M[w],se=M[w+1];ne==="style"?hr(f,se):ne==="dangerouslySetInnerHTML"?Et(f,se):ne==="children"?an(f,se):H(f,ne,se,V)}switch(_){case"input":Ht(f,h);break;case"textarea":ge(f,h);break;case"select":var ee=f._wrapperState.wasMultiple;f._wrapperState.wasMultiple=!!h.multiple;var xe=h.value;xe!=null?zt(f,!!h.multiple,xe,!1):ee!==!!h.multiple&&(h.defaultValue!=null?zt(f,!!h.multiple,h.defaultValue,!0):zt(f,!!h.multiple,h.multiple?[]:"",!1))}f[qo]=h}catch(Ee){Rt(e,e.return,Ee)}}break;case 6:if(ir(n,e),br(e),u&4){if(e.stateNode===null)throw Error(s(162));f=e.stateNode,h=e.memoizedProps;try{f.nodeValue=h}catch(Ee){Rt(e,e.return,Ee)}}break;case 3:if(ir(n,e),br(e),u&4&&o!==null&&o.memoizedState.isDehydrated)try{Po(n.containerInfo)}catch(Ee){Rt(e,e.return,Ee)}break;case 4:ir(n,e),br(e);break;case 13:ir(n,e),br(e),f=e.child,f.flags&8192&&(h=f.memoizedState!==null,f.stateNode.isHidden=h,!h||f.alternate!==null&&f.alternate.memoizedState!==null||(cu=kt())),u&4&&Jp(e);break;case 22:if(ne=o!==null&&o.memoizedState!==null,e.mode&1?(fn=(V=fn)||ne,ir(n,e),fn=V):ir(n,e),br(e),u&8192){if(V=e.memoizedState!==null,(e.stateNode.isHidden=V)&&!ne&&(e.mode&1)!==0)for(ke=e,ne=e.child;ne!==null;){for(se=ke=ne;ke!==null;){switch(ee=ke,xe=ee.child,ee.tag){case 0:case 11:case 14:case 15:oi(4,ee,ee.return);break;case 1:uo(ee,ee.return);var Te=ee.stateNode;if(typeof Te.componentWillUnmount=="function"){u=ee,o=ee.return;try{n=u,Te.props=n.memoizedProps,Te.state=n.memoizedState,Te.componentWillUnmount()}catch(Ee){Rt(u,o,Ee)}}break;case 5:uo(ee,ee.return);break;case 22:if(ee.memoizedState!==null){rh(se);continue}}xe!==null?(xe.return=ee,ke=xe):rh(se)}ne=ne.sibling}e:for(ne=null,se=e;;){if(se.tag===5){if(ne===null){ne=se;try{f=se.stateNode,V?(h=f.style,typeof h.setProperty=="function"?h.setProperty("display","none","important"):h.display="none"):(_=se.stateNode,M=se.memoizedProps.style,w=M!=null&&M.hasOwnProperty("display")?M.display:null,_.style.display=Ln("display",w))}catch(Ee){Rt(e,e.return,Ee)}}}else if(se.tag===6){if(ne===null)try{se.stateNode.nodeValue=V?"":se.memoizedProps}catch(Ee){Rt(e,e.return,Ee)}}else if((se.tag!==22&&se.tag!==23||se.memoizedState===null||se===e)&&se.child!==null){se.child.return=se,se=se.child;continue}if(se===e)break e;for(;se.sibling===null;){if(se.return===null||se.return===e)break e;ne===se&&(ne=null),se=se.return}ne===se&&(ne=null),se.sibling.return=se.return,se=se.sibling}}break;case 19:ir(n,e),br(e),u&4&&Jp(e);break;case 21:break;default:ir(n,e),br(e)}}function br(e){var n=e.flags;if(n&2){try{e:{for(var o=e.return;o!==null;){if(Yp(o)){var u=o;break e}o=o.return}throw Error(s(160))}switch(u.tag){case 5:var f=u.stateNode;u.flags&32&&(an(f,""),u.flags&=-33);var h=Qp(e);iu(e,h,f);break;case 3:case 4:var w=u.stateNode.containerInfo,_=Qp(e);ou(e,_,w);break;default:throw Error(s(161))}}catch(M){Rt(e,e.return,M)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Ox(e,n,o){ke=e,th(e)}function th(e,n,o){for(var u=(e.mode&1)!==0;ke!==null;){var f=ke,h=f.child;if(f.tag===22&&u){var w=f.memoizedState!==null||ja;if(!w){var _=f.alternate,M=_!==null&&_.memoizedState!==null||fn;_=ja;var V=fn;if(ja=w,(fn=M)&&!V)for(ke=f;ke!==null;)w=ke,M=w.child,w.tag===22&&w.memoizedState!==null?sh(f):M!==null?(M.return=w,ke=M):sh(f);for(;h!==null;)ke=h,th(h),h=h.sibling;ke=f,ja=_,fn=V}nh(e)}else(f.subtreeFlags&8772)!==0&&h!==null?(h.return=f,ke=h):nh(e)}}function nh(e){for(;ke!==null;){var n=ke;if((n.flags&8772)!==0){var o=n.alternate;try{if((n.flags&8772)!==0)switch(n.tag){case 0:case 11:case 15:fn||_a(5,n);break;case 1:var u=n.stateNode;if(n.flags&4&&!fn)if(o===null)u.componentDidMount();else{var f=n.elementType===n.type?o.memoizedProps:sr(n.type,o.memoizedProps);u.componentDidUpdate(f,o.memoizedState,u.__reactInternalSnapshotBeforeUpdate)}var h=n.updateQueue;h!==null&&rp(n,h,u);break;case 3:var w=n.updateQueue;if(w!==null){if(o=null,n.child!==null)switch(n.child.tag){case 5:o=n.child.stateNode;break;case 1:o=n.child.stateNode}rp(n,w,o)}break;case 5:var _=n.stateNode;if(o===null&&n.flags&4){o=_;var M=n.memoizedProps;switch(n.type){case"button":case"input":case"select":case"textarea":M.autoFocus&&o.focus();break;case"img":M.src&&(o.src=M.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(n.memoizedState===null){var V=n.alternate;if(V!==null){var ne=V.memoizedState;if(ne!==null){var se=ne.dehydrated;se!==null&&Po(se)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(s(163))}fn||n.flags&512&&su(n)}catch(ee){Rt(n,n.return,ee)}}if(n===e){ke=null;break}if(o=n.sibling,o!==null){o.return=n.return,ke=o;break}ke=n.return}}function rh(e){for(;ke!==null;){var n=ke;if(n===e){ke=null;break}var o=n.sibling;if(o!==null){o.return=n.return,ke=o;break}ke=n.return}}function sh(e){for(;ke!==null;){var n=ke;try{switch(n.tag){case 0:case 11:case 15:var o=n.return;try{_a(4,n)}catch(M){Rt(n,o,M)}break;case 1:var u=n.stateNode;if(typeof u.componentDidMount=="function"){var f=n.return;try{u.componentDidMount()}catch(M){Rt(n,f,M)}}var h=n.return;try{su(n)}catch(M){Rt(n,h,M)}break;case 5:var w=n.return;try{su(n)}catch(M){Rt(n,w,M)}}}catch(M){Rt(n,n.return,M)}if(n===e){ke=null;break}var _=n.sibling;if(_!==null){_.return=n.return,ke=_;break}ke=n.return}}var Px=Math.ceil,Ra=I.ReactCurrentDispatcher,au=I.ReactCurrentOwner,Qn=I.ReactCurrentBatchConfig,Ye=0,Xt=null,Pt=null,rn=0,Wn=0,fo=Xr(0),Bt=0,ii=null,_s=0,Aa=0,lu=0,ai=null,_n=null,cu=0,po=1/0,Or=null,Ia=!1,uu=null,ts=null,Da=!1,ns=null,Ma=0,li=0,du=null,La=-1,Oa=0;function Sn(){return(Ye&6)!==0?kt():La!==-1?La:La=kt()}function rs(e){return(e.mode&1)===0?1:(Ye&2)!==0&&rn!==0?rn&-rn:wx.transition!==null?(Oa===0&&(Oa=Do()),Oa):(e=qe,e!==0||(e=window.event,e=e===void 0?16:of(e.type)),e)}function ar(e,n,o,u){if(50<li)throw li=0,du=null,Error(s(185));ks(e,o,u),((Ye&2)===0||e!==Xt)&&(e===Xt&&((Ye&2)===0&&(Aa|=o),Bt===4&&ss(e,rn)),Rn(e,u),o===1&&Ye===0&&(n.mode&1)===0&&(po=kt()+500,ua&&Qr()))}function Rn(e,n){var o=e.callbackNode;Vi(e,n);var u=ws(e,e===Xt?rn:0);if(u===0)o!==null&&_t(o),e.callbackNode=null,e.callbackPriority=0;else if(n=u&-u,e.callbackPriority!==n){if(o!=null&&_t(o),n===1)e.tag===0?xx(ih.bind(null,e)):Vf(ih.bind(null,e)),mx(function(){(Ye&6)===0&&Qr()}),o=null;else{switch(de(u)){case 1:o=Br;break;case 4:o=xr;break;case 16:o=Bs;break;case 536870912:o=Wi;break;default:o=Bs}o=hh(o,oh.bind(null,e))}e.callbackPriority=n,e.callbackNode=o}}function oh(e,n){if(La=-1,Oa=0,(Ye&6)!==0)throw Error(s(327));var o=e.callbackNode;if(ho()&&e.callbackNode!==o)return null;var u=ws(e,e===Xt?rn:0);if(u===0)return null;if((u&30)!==0||(u&e.expiredLanes)!==0||n)n=Pa(e,u);else{n=u;var f=Ye;Ye|=2;var h=lh();(Xt!==e||rn!==n)&&(Or=null,po=kt()+500,As(e,n));do try{Fx();break}catch(_){ah(e,_)}while(!0);_c(),Ra.current=h,Ye=f,Pt!==null?n=0:(Xt=null,rn=0,n=Bt)}if(n!==0){if(n===2&&(f=Io(e),f!==0&&(u=f,n=fu(e,f))),n===1)throw o=ii,As(e,0),ss(e,u),Rn(e,kt()),o;if(n===6)ss(e,u);else{if(f=e.current.alternate,(u&30)===0&&!$x(f)&&(n=Pa(e,u),n===2&&(h=Io(e),h!==0&&(u=h,n=fu(e,h))),n===1))throw o=ii,As(e,0),ss(e,u),Rn(e,kt()),o;switch(e.finishedWork=f,e.finishedLanes=u,n){case 0:case 1:throw Error(s(345));case 2:Is(e,_n,Or);break;case 3:if(ss(e,u),(u&130023424)===u&&(n=cu+500-kt(),10<n)){if(ws(e,0)!==0)break;if(f=e.suspendedLanes,(f&u)!==u){Sn(),e.pingedLanes|=e.suspendedLanes&f;break}e.timeoutHandle=yc(Is.bind(null,e,_n,Or),n);break}Is(e,_n,Or);break;case 4:if(ss(e,u),(u&4194240)===u)break;for(n=e.eventTimes,f=-1;0<u;){var w=31-xn(u);h=1<<w,w=n[w],w>f&&(f=w),u&=~h}if(u=f,u=kt()-u,u=(120>u?120:480>u?480:1080>u?1080:1920>u?1920:3e3>u?3e3:4320>u?4320:1960*Px(u/1960))-u,10<u){e.timeoutHandle=yc(Is.bind(null,e,_n,Or),u);break}Is(e,_n,Or);break;case 5:Is(e,_n,Or);break;default:throw Error(s(329))}}}return Rn(e,kt()),e.callbackNode===o?oh.bind(null,e):null}function fu(e,n){var o=ai;return e.current.memoizedState.isDehydrated&&(As(e,n).flags|=256),e=Pa(e,n),e!==2&&(n=_n,_n=o,n!==null&&pu(n)),e}function pu(e){_n===null?_n=e:_n.push.apply(_n,e)}function $x(e){for(var n=e;;){if(n.flags&16384){var o=n.updateQueue;if(o!==null&&(o=o.stores,o!==null))for(var u=0;u<o.length;u++){var f=o[u],h=f.getSnapshot;f=f.value;try{if(!nr(h(),f))return!1}catch{return!1}}}if(o=n.child,n.subtreeFlags&16384&&o!==null)o.return=n,n=o;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function ss(e,n){for(n&=~lu,n&=~Aa,e.suspendedLanes|=n,e.pingedLanes&=~n,e=e.expirationTimes;0<n;){var o=31-xn(n),u=1<<o;e[o]=-1,n&=~u}}function ih(e){if((Ye&6)!==0)throw Error(s(327));ho();var n=ws(e,0);if((n&1)===0)return Rn(e,kt()),null;var o=Pa(e,n);if(e.tag!==0&&o===2){var u=Io(e);u!==0&&(n=u,o=fu(e,u))}if(o===1)throw o=ii,As(e,0),ss(e,n),Rn(e,kt()),o;if(o===6)throw Error(s(345));return e.finishedWork=e.current.alternate,e.finishedLanes=n,Is(e,_n,Or),Rn(e,kt()),null}function hu(e,n){var o=Ye;Ye|=1;try{return e(n)}finally{Ye=o,Ye===0&&(po=kt()+500,ua&&Qr())}}function Rs(e){ns!==null&&ns.tag===0&&(Ye&6)===0&&ho();var n=Ye;Ye|=1;var o=Qn.transition,u=qe;try{if(Qn.transition=null,qe=1,e)return e()}finally{qe=u,Qn.transition=o,Ye=n,(Ye&6)===0&&Qr()}}function mu(){Wn=fo.current,ht(fo)}function As(e,n){e.finishedWork=null,e.finishedLanes=0;var o=e.timeoutHandle;if(o!==-1&&(e.timeoutHandle=-1,hx(o)),Pt!==null)for(o=Pt.return;o!==null;){var u=o;switch(Nc(u),u.tag){case 1:u=u.type.childContextTypes,u!=null&&la();break;case 3:lo(),ht(Cn),ht(cn),Pc();break;case 5:Lc(u);break;case 4:lo();break;case 13:ht(Nt);break;case 19:ht(Nt);break;case 10:Rc(u.type._context);break;case 22:case 23:mu()}o=o.return}if(Xt=e,Pt=e=os(e.current,null),rn=Wn=n,Bt=0,ii=null,lu=Aa=_s=0,_n=ai=null,Cs!==null){for(n=0;n<Cs.length;n++)if(o=Cs[n],u=o.interleaved,u!==null){o.interleaved=null;var f=u.next,h=o.pending;if(h!==null){var w=h.next;h.next=f,u.next=w}o.pending=u}Cs=null}return e}function ah(e,n){do{var o=Pt;try{if(_c(),wa.current=Na,ka){for(var u=Tt.memoizedState;u!==null;){var f=u.queue;f!==null&&(f.pending=null),u=u.next}ka=!1}if(js=0,qt=Ut=Tt=null,ei=!1,ti=0,au.current=null,o===null||o.return===null){Bt=1,ii=n,Pt=null;break}e:{var h=e,w=o.return,_=o,M=n;if(n=rn,_.flags|=32768,M!==null&&typeof M=="object"&&typeof M.then=="function"){var V=M,ne=_,se=ne.tag;if((ne.mode&1)===0&&(se===0||se===11||se===15)){var ee=ne.alternate;ee?(ne.updateQueue=ee.updateQueue,ne.memoizedState=ee.memoizedState,ne.lanes=ee.lanes):(ne.updateQueue=null,ne.memoizedState=null)}var xe=Ip(w);if(xe!==null){xe.flags&=-257,Dp(xe,w,_,h,n),xe.mode&1&&Ap(h,V,n),n=xe,M=V;var Te=n.updateQueue;if(Te===null){var Ee=new Set;Ee.add(M),n.updateQueue=Ee}else Te.add(M);break e}else{if((n&1)===0){Ap(h,V,n),gu();break e}M=Error(s(426))}}else if(xt&&_.mode&1){var It=Ip(w);if(It!==null){(It.flags&65536)===0&&(It.flags|=256),Dp(It,w,_,h,n),Ec(co(M,_));break e}}h=M=co(M,_),Bt!==4&&(Bt=2),ai===null?ai=[h]:ai.push(h),h=w;do{switch(h.tag){case 3:h.flags|=65536,n&=-n,h.lanes|=n;var U=_p(h,M,n);np(h,U);break e;case 1:_=M;var O=h.type,W=h.stateNode;if((h.flags&128)===0&&(typeof O.getDerivedStateFromError=="function"||W!==null&&typeof W.componentDidCatch=="function"&&(ts===null||!ts.has(W)))){h.flags|=65536,n&=-n,h.lanes|=n;var fe=Rp(h,_,n);np(h,fe);break e}}h=h.return}while(h!==null)}uh(o)}catch(je){n=je,Pt===o&&o!==null&&(Pt=o=o.return);continue}break}while(!0)}function lh(){var e=Ra.current;return Ra.current=Na,e===null?Na:e}function gu(){(Bt===0||Bt===3||Bt===2)&&(Bt=4),Xt===null||(_s&268435455)===0&&(Aa&268435455)===0||ss(Xt,rn)}function Pa(e,n){var o=Ye;Ye|=2;var u=lh();(Xt!==e||rn!==n)&&(Or=null,As(e,n));do try{zx();break}catch(f){ah(e,f)}while(!0);if(_c(),Ye=o,Ra.current=u,Pt!==null)throw Error(s(261));return Xt=null,rn=0,Bt}function zx(){for(;Pt!==null;)ch(Pt)}function Fx(){for(;Pt!==null&&!vr();)ch(Pt)}function ch(e){var n=ph(e.alternate,e,Wn);e.memoizedProps=e.pendingProps,n===null?uh(e):Pt=n,au.current=null}function uh(e){var n=e;do{var o=n.alternate;if(e=n.return,(n.flags&32768)===0){if(o=Ix(o,n,Wn),o!==null){Pt=o;return}}else{if(o=Dx(o,n),o!==null){o.flags&=32767,Pt=o;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Bt=6,Pt=null;return}}if(n=n.sibling,n!==null){Pt=n;return}Pt=n=e}while(n!==null);Bt===0&&(Bt=5)}function Is(e,n,o){var u=qe,f=Qn.transition;try{Qn.transition=null,qe=1,Ux(e,n,o,u)}finally{Qn.transition=f,qe=u}return null}function Ux(e,n,o,u){do ho();while(ns!==null);if((Ye&6)!==0)throw Error(s(327));o=e.finishedWork;var f=e.finishedLanes;if(o===null)return null;if(e.finishedWork=null,e.finishedLanes=0,o===e.current)throw Error(s(177));e.callbackNode=null,e.callbackPriority=0;var h=o.lanes|o.childLanes;if(Ki(e,h),e===Xt&&(Pt=Xt=null,rn=0),(o.subtreeFlags&2064)===0&&(o.flags&2064)===0||Da||(Da=!0,hh(Bs,function(){return ho(),null})),h=(o.flags&15990)!==0,(o.subtreeFlags&15990)!==0||h){h=Qn.transition,Qn.transition=null;var w=qe;qe=1;var _=Ye;Ye|=4,au.current=null,Lx(e,o),eh(o,e),ax(gc),qi=!!mc,gc=mc=null,e.current=o,Ox(o),Xl(),Ye=_,qe=w,Qn.transition=h}else e.current=o;if(Da&&(Da=!1,ns=e,Ma=f),h=e.pendingLanes,h===0&&(ts=null),Ws(o.stateNode),Rn(e,kt()),n!==null)for(u=e.onRecoverableError,o=0;o<n.length;o++)f=n[o],u(f.value,{componentStack:f.stack,digest:f.digest});if(Ia)throw Ia=!1,e=uu,uu=null,e;return(Ma&1)!==0&&e.tag!==0&&ho(),h=e.pendingLanes,(h&1)!==0?e===du?li++:(li=0,du=e):li=0,Qr(),null}function ho(){if(ns!==null){var e=de(Ma),n=Qn.transition,o=qe;try{if(Qn.transition=null,qe=16>e?16:e,ns===null)var u=!1;else{if(e=ns,ns=null,Ma=0,(Ye&6)!==0)throw Error(s(331));var f=Ye;for(Ye|=4,ke=e.current;ke!==null;){var h=ke,w=h.child;if((ke.flags&16)!==0){var _=h.deletions;if(_!==null){for(var M=0;M<_.length;M++){var V=_[M];for(ke=V;ke!==null;){var ne=ke;switch(ne.tag){case 0:case 11:case 15:oi(8,ne,h)}var se=ne.child;if(se!==null)se.return=ne,ke=se;else for(;ke!==null;){ne=ke;var ee=ne.sibling,xe=ne.return;if(Xp(ne),ne===V){ke=null;break}if(ee!==null){ee.return=xe,ke=ee;break}ke=xe}}}var Te=h.alternate;if(Te!==null){var Ee=Te.child;if(Ee!==null){Te.child=null;do{var It=Ee.sibling;Ee.sibling=null,Ee=It}while(Ee!==null)}}ke=h}}if((h.subtreeFlags&2064)!==0&&w!==null)w.return=h,ke=w;else e:for(;ke!==null;){if(h=ke,(h.flags&2048)!==0)switch(h.tag){case 0:case 11:case 15:oi(9,h,h.return)}var U=h.sibling;if(U!==null){U.return=h.return,ke=U;break e}ke=h.return}}var O=e.current;for(ke=O;ke!==null;){w=ke;var W=w.child;if((w.subtreeFlags&2064)!==0&&W!==null)W.return=w,ke=W;else e:for(w=O;ke!==null;){if(_=ke,(_.flags&2048)!==0)try{switch(_.tag){case 0:case 11:case 15:_a(9,_)}}catch(je){Rt(_,_.return,je)}if(_===w){ke=null;break e}var fe=_.sibling;if(fe!==null){fe.return=_.return,ke=fe;break e}ke=_.return}}if(Ye=f,Qr(),zn&&typeof zn.onPostCommitFiberRoot=="function")try{zn.onPostCommitFiberRoot(vs,e)}catch{}u=!0}return u}finally{qe=o,Qn.transition=n}}return!1}function dh(e,n,o){n=co(o,n),n=_p(e,n,1),e=Jr(e,n,1),n=Sn(),e!==null&&(ks(e,1,n),Rn(e,n))}function Rt(e,n,o){if(e.tag===3)dh(e,e,o);else for(;n!==null;){if(n.tag===3){dh(n,e,o);break}else if(n.tag===1){var u=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(ts===null||!ts.has(u))){e=co(o,e),e=Rp(n,e,1),n=Jr(n,e,1),e=Sn(),n!==null&&(ks(n,1,e),Rn(n,e));break}}n=n.return}}function Bx(e,n,o){var u=e.pingCache;u!==null&&u.delete(n),n=Sn(),e.pingedLanes|=e.suspendedLanes&o,Xt===e&&(rn&o)===o&&(Bt===4||Bt===3&&(rn&130023424)===rn&&500>kt()-cu?As(e,0):lu|=o),Rn(e,n)}function fh(e,n){n===0&&((e.mode&1)===0?n=1:(n=Vs,Vs<<=1,(Vs&130023424)===0&&(Vs=4194304)));var o=Sn();e=Dr(e,n),e!==null&&(ks(e,n,o),Rn(e,o))}function Wx(e){var n=e.memoizedState,o=0;n!==null&&(o=n.retryLane),fh(e,o)}function Hx(e,n){var o=0;switch(e.tag){case 13:var u=e.stateNode,f=e.memoizedState;f!==null&&(o=f.retryLane);break;case 19:u=e.stateNode;break;default:throw Error(s(314))}u!==null&&u.delete(n),fh(e,o)}var ph;ph=function(e,n,o){if(e!==null)if(e.memoizedProps!==n.pendingProps||Cn.current)jn=!0;else{if((e.lanes&o)===0&&(n.flags&128)===0)return jn=!1,Ax(e,n,o);jn=(e.flags&131072)!==0}else jn=!1,xt&&(n.flags&1048576)!==0&&Kf(n,fa,n.index);switch(n.lanes=0,n.tag){case 2:var u=n.type;Ea(e,n),e=n.pendingProps;var f=to(n,cn.current);ao(n,o),f=Fc(null,n,u,e,f,o);var h=Uc();return n.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,En(u)?(h=!0,ca(n)):h=!1,n.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,Dc(n),f.updater=Ta,n.stateNode=f,f._reactInternals=n,Gc(n,u,e,o),n=Qc(null,n,u,!0,h,o)):(n.tag=0,xt&&h&&bc(n),kn(null,n,f,o),n=n.child),n;case 16:u=n.elementType;e:{switch(Ea(e,n),e=n.pendingProps,f=u._init,u=f(u._payload),n.type=u,f=n.tag=Kx(u),e=sr(u,e),f){case 0:n=Yc(null,n,u,e,o);break e;case 1:n=zp(null,n,u,e,o);break e;case 11:n=Mp(null,n,u,e,o);break e;case 14:n=Lp(null,n,u,sr(u.type,e),o);break e}throw Error(s(306,u,""))}return n;case 0:return u=n.type,f=n.pendingProps,f=n.elementType===u?f:sr(u,f),Yc(e,n,u,f,o);case 1:return u=n.type,f=n.pendingProps,f=n.elementType===u?f:sr(u,f),zp(e,n,u,f,o);case 3:e:{if(Fp(n),e===null)throw Error(s(387));u=n.pendingProps,h=n.memoizedState,f=h.element,tp(e,n),ya(n,u,null,o);var w=n.memoizedState;if(u=w.element,h.isDehydrated)if(h={element:u,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){f=co(Error(s(423)),n),n=Up(e,n,u,o,f);break e}else if(u!==f){f=co(Error(s(424)),n),n=Up(e,n,u,o,f);break e}else for(Bn=qr(n.stateNode.containerInfo.firstChild),Un=n,xt=!0,rr=null,o=Jf(n,null,u,o),n.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(so(),u===f){n=Lr(e,n,o);break e}kn(e,n,u,o)}n=n.child}return n;case 5:return sp(n),e===null&&Cc(n),u=n.type,f=n.pendingProps,h=e!==null?e.memoizedProps:null,w=f.children,vc(u,f)?w=null:h!==null&&vc(u,h)&&(n.flags|=32),$p(e,n),kn(e,n,w,o),n.child;case 6:return e===null&&Cc(n),null;case 13:return Bp(e,n,o);case 4:return Mc(n,n.stateNode.containerInfo),u=n.pendingProps,e===null?n.child=oo(n,null,u,o):kn(e,n,u,o),n.child;case 11:return u=n.type,f=n.pendingProps,f=n.elementType===u?f:sr(u,f),Mp(e,n,u,f,o);case 7:return kn(e,n,n.pendingProps,o),n.child;case 8:return kn(e,n,n.pendingProps.children,o),n.child;case 12:return kn(e,n,n.pendingProps.children,o),n.child;case 10:e:{if(u=n.type._context,f=n.pendingProps,h=n.memoizedProps,w=f.value,ut(ma,u._currentValue),u._currentValue=w,h!==null)if(nr(h.value,w)){if(h.children===f.children&&!Cn.current){n=Lr(e,n,o);break e}}else for(h=n.child,h!==null&&(h.return=n);h!==null;){var _=h.dependencies;if(_!==null){w=h.child;for(var M=_.firstContext;M!==null;){if(M.context===u){if(h.tag===1){M=Mr(-1,o&-o),M.tag=2;var V=h.updateQueue;if(V!==null){V=V.shared;var ne=V.pending;ne===null?M.next=M:(M.next=ne.next,ne.next=M),V.pending=M}}h.lanes|=o,M=h.alternate,M!==null&&(M.lanes|=o),Ac(h.return,o,n),_.lanes|=o;break}M=M.next}}else if(h.tag===10)w=h.type===n.type?null:h.child;else if(h.tag===18){if(w=h.return,w===null)throw Error(s(341));w.lanes|=o,_=w.alternate,_!==null&&(_.lanes|=o),Ac(w,o,n),w=h.sibling}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===n){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}kn(e,n,f.children,o),n=n.child}return n;case 9:return f=n.type,u=n.pendingProps.children,ao(n,o),f=Xn(f),u=u(f),n.flags|=1,kn(e,n,u,o),n.child;case 14:return u=n.type,f=sr(u,n.pendingProps),f=sr(u.type,f),Lp(e,n,u,f,o);case 15:return Op(e,n,n.type,n.pendingProps,o);case 17:return u=n.type,f=n.pendingProps,f=n.elementType===u?f:sr(u,f),Ea(e,n),n.tag=1,En(u)?(e=!0,ca(n)):e=!1,ao(n,o),Ep(n,u,f),Gc(n,u,f,o),Qc(null,n,u,!0,e,o);case 19:return Hp(e,n,o);case 22:return Pp(e,n,o)}throw Error(s(156,n.tag))};function hh(e,n){return Ze(e,n)}function Vx(e,n,o,u){this.tag=e,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zn(e,n,o,u){return new Vx(e,n,o,u)}function vu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Kx(e){if(typeof e=="function")return vu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ye)return 11;if(e===Z)return 14}return 2}function os(e,n){var o=e.alternate;return o===null?(o=Zn(e.tag,n,e.key,e.mode),o.elementType=e.elementType,o.type=e.type,o.stateNode=e.stateNode,o.alternate=e,e.alternate=o):(o.pendingProps=n,o.type=e.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=e.flags&14680064,o.childLanes=e.childLanes,o.lanes=e.lanes,o.child=e.child,o.memoizedProps=e.memoizedProps,o.memoizedState=e.memoizedState,o.updateQueue=e.updateQueue,n=e.dependencies,o.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},o.sibling=e.sibling,o.index=e.index,o.ref=e.ref,o}function $a(e,n,o,u,f,h){var w=2;if(u=e,typeof e=="function")vu(e)&&(w=1);else if(typeof e=="string")w=5;else e:switch(e){case K:return Ds(o.children,f,h,n);case $:w=8,f|=8;break;case te:return e=Zn(12,o,n,f|2),e.elementType=te,e.lanes=h,e;case be:return e=Zn(13,o,n,f),e.elementType=be,e.lanes=h,e;case Me:return e=Zn(19,o,n,f),e.elementType=Me,e.lanes=h,e;case ie:return za(o,f,h,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case me:w=10;break e;case ue:w=9;break e;case ye:w=11;break e;case Z:w=14;break e;case oe:w=16,u=null;break e}throw Error(s(130,e==null?e:typeof e,""))}return n=Zn(w,o,n,f),n.elementType=e,n.type=u,n.lanes=h,n}function Ds(e,n,o,u){return e=Zn(7,e,u,n),e.lanes=o,e}function za(e,n,o,u){return e=Zn(22,e,u,n),e.elementType=ie,e.lanes=o,e.stateNode={isHidden:!1},e}function yu(e,n,o){return e=Zn(6,e,null,n),e.lanes=o,e}function xu(e,n,o){return n=Zn(4,e.children!==null?e.children:[],e.key,n),n.lanes=o,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function Gx(e,n,o,u,f){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Mo(0),this.expirationTimes=Mo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mo(0),this.identifierPrefix=u,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function wu(e,n,o,u,f,h,w,_,M){return e=new Gx(e,n,o,_,M),n===1?(n=1,h===!0&&(n|=8)):n=0,h=Zn(3,null,null,n),e.current=h,h.stateNode=e,h.memoizedState={element:u,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},Dc(h),e}function qx(e,n,o){var u=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:q,key:u==null?null:""+u,children:e,containerInfo:n,implementation:o}}function mh(e){if(!e)return Yr;e=e._reactInternals;e:{if(Be(e)!==e||e.tag!==1)throw Error(s(170));var n=e;do{switch(n.tag){case 3:n=n.stateNode.context;break e;case 1:if(En(n.type)){n=n.stateNode.__reactInternalMemoizedMergedChildContext;break e}}n=n.return}while(n!==null);throw Error(s(171))}if(e.tag===1){var o=e.type;if(En(o))return Wf(e,o,n)}return n}function gh(e,n,o,u,f,h,w,_,M){return e=wu(o,u,!0,e,f,h,w,_,M),e.context=mh(null),o=e.current,u=Sn(),f=rs(o),h=Mr(u,f),h.callback=n??null,Jr(o,h,f),e.current.lanes=f,ks(e,f,u),Rn(e,u),e}function Fa(e,n,o,u){var f=n.current,h=Sn(),w=rs(f);return o=mh(o),n.context===null?n.context=o:n.pendingContext=o,n=Mr(h,w),n.payload={element:e},u=u===void 0?null:u,u!==null&&(n.callback=u),e=Jr(f,n,w),e!==null&&(ar(e,f,w,h),va(e,f,w)),w}function Ua(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function vh(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var o=e.retryLane;e.retryLane=o!==0&&o<n?o:n}}function ku(e,n){vh(e,n),(e=e.alternate)&&vh(e,n)}function Xx(){return null}var yh=typeof reportError=="function"?reportError:function(e){console.error(e)};function Su(e){this._internalRoot=e}Ba.prototype.render=Su.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(s(409));Fa(e,n,null,null)},Ba.prototype.unmount=Su.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Rs(function(){Fa(null,e,null,null)}),n[_r]=null}};function Ba(e){this._internalRoot=e}Ba.prototype.unstable_scheduleHydration=function(e){if(e){var n=Ce();e={blockedOn:null,target:e,priority:n};for(var o=0;o<Vr.length&&n!==0&&n<Vr[o].priority;o++);Vr.splice(o,0,e),o===0&&rf(e)}};function bu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Wa(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function xh(){}function Yx(e,n,o,u,f){if(f){if(typeof u=="function"){var h=u;u=function(){var V=Ua(w);h.call(V)}}var w=gh(n,u,e,0,null,!1,!1,"",xh);return e._reactRootContainer=w,e[_r]=w.current,Ko(e.nodeType===8?e.parentNode:e),Rs(),w}for(;f=e.lastChild;)e.removeChild(f);if(typeof u=="function"){var _=u;u=function(){var V=Ua(M);_.call(V)}}var M=wu(e,0,!1,null,null,!1,!1,"",xh);return e._reactRootContainer=M,e[_r]=M.current,Ko(e.nodeType===8?e.parentNode:e),Rs(function(){Fa(n,M,o,u)}),M}function Ha(e,n,o,u,f){var h=o._reactRootContainer;if(h){var w=h;if(typeof f=="function"){var _=f;f=function(){var M=Ua(w);_.call(M)}}Fa(n,w,e,f)}else w=Yx(o,n,e,f,u);return Ua(w)}b=function(e){switch(e.tag){case 3:var n=e.stateNode;if(n.current.memoizedState.isDehydrated){var o=xs(n.pendingLanes);o!==0&&(Hr(n,o|1),Rn(n,kt()),(Ye&6)===0&&(po=kt()+500,Qr()))}break;case 13:Rs(function(){var u=Dr(e,1);if(u!==null){var f=Sn();ar(u,e,1,f)}}),ku(e,1)}},F=function(e){if(e.tag===13){var n=Dr(e,134217728);if(n!==null){var o=Sn();ar(n,e,134217728,o)}ku(e,134217728)}},J=function(e){if(e.tag===13){var n=rs(e),o=Dr(e,n);if(o!==null){var u=Sn();ar(o,e,n,u)}ku(e,n)}},Ce=function(){return qe},Re=function(e,n){var o=qe;try{return qe=e,n()}finally{qe=o}},Vt=function(e,n,o){switch(n){case"input":if(Ht(e,o),n=o.name,o.type==="radio"&&n!=null){for(o=e;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll("input[name="+JSON.stringify(""+n)+'][type="radio"]'),n=0;n<o.length;n++){var u=o[n];if(u!==e&&u.form===e.form){var f=aa(u);if(!f)throw Error(s(90));_e(u),Ht(u,f)}}}break;case"textarea":ge(e,o);break;case"select":n=o.value,n!=null&&zt(e,!!o.multiple,n,!1)}},vt=hu,yt=Rs;var Qx={usingClientEntryPoint:!1,Events:[Xo,Js,aa,ft,Kt,hu]},ci={findFiberByHostInstance:Ss,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Zx={bundleType:ci.bundleType,version:ci.version,rendererPackageName:ci.rendererPackageName,rendererConfig:ci.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:I.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=$n(e),e===null?null:e.stateNode},findFiberByHostInstance:ci.findFiberByHostInstance||Xx,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 Va=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Va.isDisabled&&Va.supportsFiber)try{vs=Va.inject(Zx),zn=Va}catch{}}return An.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Qx,An.createPortal=function(e,n){var o=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!bu(n))throw Error(s(200));return qx(e,n,null,o)},An.createRoot=function(e,n){if(!bu(e))throw Error(s(299));var o=!1,u="",f=yh;return n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(u=n.identifierPrefix),n.onRecoverableError!==void 0&&(f=n.onRecoverableError)),n=wu(e,1,!1,null,null,o,!1,u,f),e[_r]=n.current,Ko(e.nodeType===8?e.parentNode:e),new Su(n)},An.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(s(188)):(e=Object.keys(e).join(","),Error(s(268,e)));return e=$n(n),e=e===null?null:e.stateNode,e},An.flushSync=function(e){return Rs(e)},An.hydrate=function(e,n,o){if(!Wa(n))throw Error(s(200));return Ha(null,e,n,!0,o)},An.hydrateRoot=function(e,n,o){if(!bu(e))throw Error(s(405));var u=o!=null&&o.hydratedSources||null,f=!1,h="",w=yh;if(o!=null&&(o.unstable_strictMode===!0&&(f=!0),o.identifierPrefix!==void 0&&(h=o.identifierPrefix),o.onRecoverableError!==void 0&&(w=o.onRecoverableError)),n=gh(n,null,e,1,o??null,f,!1,h,w),e[_r]=n.current,Ko(e),u)for(e=0;e<u.length;e++)o=u[e],f=o._getVersion,f=f(o._source),n.mutableSourceEagerHydrationData==null?n.mutableSourceEagerHydrationData=[o,f]:n.mutableSourceEagerHydrationData.push(o,f);return new Ba(n)},An.render=function(e,n,o){if(!Wa(n))throw Error(s(200));return Ha(null,e,n,!1,o)},An.unmountComponentAtNode=function(e){if(!Wa(e))throw Error(s(40));return e._reactRootContainer?(Rs(function(){Ha(null,null,e,!1,function(){e._reactRootContainer=null,e[_r]=null})}),!0):!1},An.unstable_batchedUpdates=hu,An.unstable_renderSubtreeIntoContainer=function(e,n,o,u){if(!Wa(o))throw Error(s(200));if(e==null||e._reactInternals===void 0)throw Error(s(38));return Ha(e,n,o,!1,u)},An.version="18.3.1-next-f1338f8080-20240426",An}var Eh;function Cg(){if(Eh)return Cu.exports;Eh=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(r){console.error(r)}}return t(),Cu.exports=aw(),Cu.exports}var jh;function lw(){if(jh)return Ka;jh=1;var t=Cg();return Ka.createRoot=t.createRoot,Ka.hydrateRoot=t.hydrateRoot,Ka}var cw=lw();const uw=Tg(cw),_h=t=>{let r;const s=new Set,i=(m,v)=>{const k=typeof m=="function"?m(r):m;if(!Object.is(k,r)){const x=r;r=v??(typeof k!="object"||k===null)?k:Object.assign({},r,k),s.forEach(S=>S(r,x))}},l=()=>r,p={setState:i,getState:l,getInitialState:()=>g,subscribe:m=>(s.add(m),()=>s.delete(m))},g=r=t(i,l,p);return p},dw=(t=>t?_h(t):_h),fw=t=>t;function pw(t,r=fw){const s=lt.useSyncExternalStore(t.subscribe,lt.useCallback(()=>r(t.getState()),[t,r]),lt.useCallback(()=>r(t.getInitialState()),[t,r]));return lt.useDebugValue(s),s}const hw=t=>{const r=dw(t),s=i=>pw(r,i);return Object.assign(s,r),s},mw=(t=>hw),Eg="agentpane:machines",jg="agentpane:active-machine";function gw(t){return/^[a-z][a-z0-9-]{1,30}$/.test(t)}function _g(t){return`${t}.repoburg.com`}function Rg(t){const r=/^([a-z][a-z0-9-]{1,30})\.repoburg\.com$/.exec(t);return r?r[1]:null}function Ag(t,r){try{const s=localStorage.getItem(t);return s==null?r:JSON.parse(s)}catch{return r}}function Ig(t,r){try{localStorage.setItem(t,JSON.stringify(r))}catch{}}function vw(t){const{mahlas:r,hostname:s}=t??{};return typeof r=="string"&&gw(r)&&s===_g(r)}function Dg(){const t=Ag(Eg,[]);return Array.isArray(t)?t.filter(vw):[]}function yw(t){const r={mahlas:t,hostname:_g(t),lastConnectedAt:new Date().toISOString()},s=Dg(),i=[r,...s.filter(l=>l.mahlas!==t)];return Ig(Eg,i),r}function xw(){const t=Ag(jg,null);return t?Dg().find(r=>r.mahlas===t)??null:null}function ww(t){Ig(jg,t)}function kw(){if(typeof window>"u")return;const t=new URLSearchParams(window.location.search).get("host");if(!t)return;const r=Rg(t);r&&(yw(r),ww(r))}const Rh="http://localhost:9998",Sw=["agent.repoburg.com"];function mn(){if(typeof window>"u")return"";const t=new URLSearchParams(window.location.search),r=t.get("bport");if(r)return`http://localhost:${r}`;const s=t.get("host");if(s)return`https://${s}`;const i=window.location.hostname;if(Sw.includes(i))return Rh;if(Rg(i))return"";const l=xw();return l?`https://${l.hostname}`:i==="localhost"||i==="127.0.0.1"||i==="0.0.0.0"?"":Rh}function bw(t){const r=mn();return r?`${r.replace(/^http/,"ws")}${t}`:`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${t}`}const Nw="/api";class Ml extends Error{constructor(s,i,l){super(s);ot(this,"status");ot(this,"body");this.name="ApiError",this.status=i,this.body=l}}function Ps(t){var r;if(t instanceof Ml){const s=(r=t.body)==null?void 0:r.error;if(typeof s=="string"&&s)return s}return t instanceof Error?t.message:String(t)}async function Li(t,r,s){const i=await fetch(`${mn()}${Nw}${r}`,{method:t,headers:s?{"Content-Type":"application/json"}:void 0,body:s?JSON.stringify(s):void 0});if(!i.ok){let l=`${i.status} ${i.statusText}`,c=null;try{c=await i.json();const d=c==null?void 0:c.error;typeof d=="string"&&d&&(l=`${l} — ${d}`)}catch{}throw new Ml(`${t} ${r} failed: ${l}`,i.status,c)}return i.json()}function Mt(t){return Li("GET",t)}function it(t,r){return Li("POST",t,r)}function Ll(t){return Li("DELETE",t)}function dr(t,r){return Li("PATCH",t,r)}function Tw(t,r){return Li("PUT",t,r)}function Cw(){return Mt("/sessions")}function di(t){return Mt(`/sessions/${t}?items=summary`)}function Ew(t,r){return Mt(`/sessions/${t}/turns/${r}`)}function bd(t){return it("/sessions",t)}function Ah(t){return Ll(`/sessions/${t}`)}function Mg(t,r,s,i){return it(`/sessions/${t}/turns`,{user_prompt:r,...s!=null&&s.length?{attachments:s}:{},...i!=null&&i.originAppId?{origin_app_id:i.originAppId}:{}})}function jw(t){return it(`/sessions/${t}/cancel`)}function _w(t,r){return it(`/sessions/${t}/turns/${r}/resume`)}function Rw(){return it("/turns/resume-signed-out")}function Aw(t,r){return dr(`/sessions/${t}`,{title:r})}function Ih(t){return dr(`/sessions/${t}`,{lifecycle:"finished"})}function Dh(t){return dr(`/sessions/${t}`,{lifecycle:"working"})}function Iw(t,r){return dr(`/sessions/${t}`,{starred:r})}function Mh(t){return dr(`/sessions/${t}`,{has_unreviewed:0})}function Dw(t,r,s,i){const l={model:r,model_reasoning_effort:s};return i!==void 0&&(l.runtime_type=i),dr(`/sessions/${t}`,l)}function Mw(t,r){return dr(`/sessions/${t}`,{runtime_config:r})}function Lw(t,r){return it(`/sessions/${t}/rewind`,{turn_id:r})}function Ow(t){return it(`/sessions/${t}/restore`,{})}function Pw(t,r,s){return it(`/sessions/${t}/branch`,{turn_id:r,title:s})}function Lg(){return Mt("/workspaces")}function $w(t,r){return it("/workspaces",{path:t,label:r})}function zw(t){return it("/workspaces/hide",{path:t})}function Fw(){return Mt("/workspaces/picker")}function Lh(t){return Mt(t?`/workspaces/browse?path=${encodeURIComponent(t)}`:"/workspaces/browse")}async function Og(){const t=await fetch(`${mn()}/api/pick-directory`);if(t.status===204)return{cancelled:!0};if(!t.ok)throw new Error(`GET /api/pick-directory failed: ${t.status} ${t.statusText}`);return t.json()}function Pg(){return Mt("/folders")}function Uw(t,r){return it("/folders",{workspace_path:t,name:r})}function Oh(t,r){return dr(`/folders/${t}`,r)}function Bw(t){return Ll(`/folders/${t}`)}function Ww(t){return it("/sessions/reorder",{moves:t})}function zr(t){return t.status==="pending"||t.status==="running"}function $g(t){return!!(t!=null&&t.turns.some(zr))}function Ol(t){return t?t.turns.some(zr)||(t.threads??[]).some(r=>(r.turns??[]).some(zr)):!1}const Hw="s:",Zu="a:",$s=t=>`${Hw}${t}`,Ci=t=>`${Zu}${t}`;function ps(t){return{kind:t.startsWith(Zu)?"app":"session",id:t.slice(Zu.length)}}function Nd(t){return t.activeAppTabId!==null?Ci(t.activeAppTabId):t.activeSessionId===null?null:$s(t.activeSessionId)}function zg(t,r,s){const i=[...r.map($s),...s.map(Ci)],l=new Set(i),c=t.filter(g=>l.has(g)),d=new Set(c),p=i.filter(g=>!d.has(g));return p.length===0&&c.length===t.length?t:[...c,...p]}function Vw(t){return t.subscribe((r,s)=>{if(r.openTabs===s.openTabs&&r.openAppTabs===s.openAppTabs)return;const i=zg(r.tabOrder,r.openTabs,r.openAppTabs);i!==r.tabOrder&&t.setState({tabOrder:i})})}function Ph(t,r,s){const i=t.indexOf(r);return t.slice(i+1).find(s)??t.slice(0,Math.max(i,0)).reverse().find(s)??null}function Td(t,r){const s=d=>!r.has(d),i=Nd(t);let{activeSessionId:l,activeAppTabId:c}=t;if(i!==null&&r.has(i)){const d=Ph(t.tabOrder,i,s),p=d===null?null:ps(d);c=(p==null?void 0:p.kind)==="app"?p.id:null,(p==null?void 0:p.kind)==="session"&&(l=p.id)}if(l!==null&&r.has($s(l))){const d=g=>s(g)&&ps(g).kind==="session",p=Ph(t.tabOrder,$s(l),d);l=p===null?null:ps(p).id}return{activeSessionId:l,activeAppTabId:c}}function Fg(t,r){if(t.tabOrder.includes(r))return!1;const{kind:s,id:i}=ps(r);return(s==="app"?t.apps:t.sessions).some(c=>c.id===i)}const Ug=1;function Bg(){let t="";try{t=mn()}catch{}return`agentpane:tabs:${t||window.location.origin}`}function _u(t){return Array.isArray(t)&&t.every(r=>typeof r=="string")}function $h(t){return t===null||typeof t=="string"}function Kw(t){if(t==null)return null;let r;try{r=JSON.parse(t)}catch{return null}if(typeof r!="object"||r===null)return null;const s=r;return s.v!==Ug||!_u(s.openTabs)||!$h(s.activeSessionId)||!_u(s.openAppTabs)||!$h(s.activeAppTabId)?null:{openTabs:s.openTabs,activeSessionId:s.activeSessionId,openAppTabs:s.openAppTabs,activeAppTabId:s.activeAppTabId,tabOrder:_u(s.tabOrder)?s.tabOrder:[]}}const Wg=[()=>window.sessionStorage,()=>window.localStorage];function Gw(){const t=Bg();for(const r of Wg)try{const s=Kw(r().getItem(t));if(s)return s}catch{}return null}function qw(t){const r=Bg(),s=JSON.stringify({v:Ug,openTabs:t.openTabs,activeSessionId:t.activeSessionId,openAppTabs:t.openAppTabs,activeAppTabId:t.activeAppTabId,tabOrder:t.tabOrder});for(const i of Wg)try{i().setItem(r,s)}catch{}}function Xw(t){return t.subscribe((r,s)=>{(r.openTabs!==s.openTabs||r.activeSessionId!==s.activeSessionId||r.openAppTabs!==s.openAppTabs||r.activeAppTabId!==s.activeAppTabId||r.tabOrder!==s.tabOrder)&&qw(r)})}function wi(t){return[...new Set(t)]}function Yw(t,r,s,i){const l=v=>s===null||s.has(v),c=wi(((t==null?void 0:t.openTabs)??[]).filter(v=>r.has(v))),d=wi(((t==null?void 0:t.openAppTabs)??[]).filter(l));let p=(t==null?void 0:t.activeSessionId)??null;p!==null&&!r.has(p)&&(p=null),p!==null&&!c.includes(p)&&c.push(p),p??(p=c.at(-1)??null);let g=(t==null?void 0:t.activeAppTabId)??null;g!==null&&!l(g)&&(g=null),g!==null&&!d.includes(g)&&d.push(g),i!==null&&r.has(i)&&(c.includes(i)||c.push(i),p=i,g=null);const m=zg(wi((t==null?void 0:t.tabOrder)??[]),c,d);return{openTabs:c,activeSessionId:p,openAppTabs:d,activeAppTabId:g,tabOrder:m}}const Fr=new Map,Cd=new Map,Pl=new Map,fl=new Set,Ed=new Map,$l=new Map;function Qw(t,r,s=""){Fr.set(t,r),Cd.set(t,s)}function Zw(t){Fr.delete(t),Cd.delete(t)}function ol(t,r){Pl.set(t,r)}function Jw(t,r){r?fl.add(t):fl.delete(t)}function zh(t,r,s){const i=Pl.get(t);if(!i||fl.has(i))return;const l=Fr.get(i);l&&l({source:"agentpane-host",event:r,payload:s})}function Fh(t,r){const s=Pl.get(t);if(!s||fl.has(s))return;const i=Fr.get(s);i&&i({source:"agentpane-host",event:"background_tasks",payload:{sessionId:t,tasks:r}})}function e0(t,r,s,i,l,c=null){if(typeof l=="string"&&l!==Cd.get(t))return;const d=Fr.get(t);d&&d({source:"agentpane-host",event:"tool_call",payload:{callId:r,tool:s,name:s,args:i,caller:c}})}function t0(t,r,s,i){const l=Pl.get(t);if(!l)return;const c=Fr.get(l);c&&c({source:"agentpane-host",event:"turn:delta",payload:{sessionId:t,turnId:r,itemId:s,delta:i}})}function n0(t,r){Ed.set(t,r)}function r0(t){Ed.delete(t)}function s0(t,r){$l.set(t,r)}function o0(t){$l.delete(t)}function Hg(t,r={}){const s=$l.get(t);if(s){s(r);return}const i=Fr.get(t);i&&i({source:"agentpane-host",event:"state_changed",payload:{}})}function i0(){for(const t of new Set([...Fr.keys(),...$l.keys()]))Hg(t)}function a0(t){var s;const r=Fr.get(t);r&&r({source:"agentpane-host",event:"source:updated",payload:{}}),(s=Ed.get(t))==null||s()}const l0=(t,r)=>({wsConnected:!1,backgroundTasks:{},retryStates:{},signedOutTurns:{},setWsConnected:s=>t({wsConnected:s}),onTurnCreated:(s,i)=>{t(l=>{const c=l.sessionDetails[s];return!c||i.thread_id?{}:c.turns.some(d=>d.id===i.id)?{}:{sessionDetails:{...l.sessionDetails,[s]:{...c,turns:[...c.turns,{...i,items:[]}]}}}})},onTurnStarted:(s,i)=>{r().addLogEntry("DEBUG",`turn:started — ${i.slice(0,8)}`),t(l=>{const c=ls(l.sessions,s,()=>({is_running:1,status:"running"})),d=l.sessionDetails[s];if(!d)return{sessions:c};const p=d.turns.findIndex(g=>g.id===i);return{sessionDetails:{...l.sessionDetails,[s]:{...In(d,i,g=>({...g,status:"running"})),is_running:1,status:"running"}},sessions:c,activeTurnIndex:l.activeSessionId===s&&p>=0?p:l.activeTurnIndex}})},onItemStarted:(s,i,l)=>{r().addLogEntry("DEBUG",`item:started — ${l.type}`),t(c=>{const d=Uh(l)?as(c.retryStates,i):c.retryStates,p=c.sessionDetails[s];return p?{sessionDetails:{...c.sessionDetails,[s]:In(p,i,g=>Au(g,l))},retryStates:d}:{retryStates:d}})},onItemUpdated:(s,i,l)=>{t(c=>{const d=c.sessionDetails[s];return d?{sessionDetails:{...c.sessionDetails,[s]:In(d,i,p=>Au(p,l))}}:{}})},onItemCompleted:(s,i,l)=>{if(r().addLogEntry("DEBUG",`item:completed — ${l.type}`),l.type==="background_task"&&(l.status==="completed"||l.status==="failed")){const c=l.data||{},d=c.task_type||"unknown",p=c.description||"background task",m=d==="local_agent"?"Subagent":d==="local_bash"?"Monitor":"Task";l.status==="completed"?r().addToast("success",`${m} completed: ${p}`):c.status!=="stopped"&&r().addToast("error",`${m} failed: ${p}`)}t(c=>{const d=Uh(l)?as(c.retryStates,i):c.retryStates,p=c.sessionDetails[s];return p?{retryStates:d,sessionDetails:{...c.sessionDetails,[s]:In(p,i,g=>{var v,k;let m=Au(g,l);if(l.type==="agent_message"&&((v=l.data)!=null&&v.text)&&(m={...m,agent_response:l.data.text}),l.type==="reasoning"&&((k=l.data)!=null&&k.text)){const x=m.thoughts?m.thoughts+`
42
+ `+l.data.text:l.data.text;m={...m,thoughts:x}}return m})}}:{retryStates:d}})},onItemDelta:(s,i,l,c)=>{t0(s,i,l,c),t(d=>{const p=as(d.retryStates,i),g=d.sessionDetails[s];return g?{sessionDetails:{...d.sessionDetails,[s]:In(g,i,m=>f0(m,l,c))},retryStates:p}:{retryStates:p}})},onWidgetDelta:(s,i,l,c,d)=>{t(p=>{const g=as(p.retryStates,i),m=p.sessionDetails[s];return m?{sessionDetails:{...p.sessionDetails,[s]:In(m,i,v=>d0(v,l,c,d))},retryStates:g}:{retryStates:g}})},onTurnCompleted:(s,i,l,c,d)=>{r().dropSignedOutTurn(i);const p=(l==null?void 0:l.input_tokens)??0,g=(l==null?void 0:l.output_tokens)??0;r().addLogEntry("INFO",`turn:completed — ${p} in / ${g} out`),zh(s,"turn:completed",{sessionId:s,turnId:i,response:d??null}),r().refreshApps(),t(m=>{const v=m.sessionDetails[s],k=v?In(v,i,T=>({...T,status:"completed",token_usage:l??T.token_usage??null,...d&&!T.agent_response?{agent_response:d}:{}})):null,x=Ru(k),S=x&&k?Ga(k):"active",N=ls(m.sessions,s,T=>({is_running:x,status:S,has_unreviewed:c?1:T.has_unreviewed})),C=as(m.retryStates,i);return k?{sessionDetails:{...m.sessionDetails,[s]:{...k,is_running:x,status:S,has_unreviewed:c?1:k.has_unreviewed}},sessions:N,retryStates:C}:{sessions:N,retryStates:C}})},onTokenUsageUpdated:(s,i,l)=>{t(c=>{const d=c.sessionDetails[s];return d?{sessionDetails:{...c.sessionDetails,[s]:In(d,i,p=>({...p,token_usage:l}))}}:{}})},onContextUsageUpdated:(s,i)=>{t(l=>{const c=l.sessionDetails[s];return c?{sessionDetails:{...l.sessionDetails,[s]:{...c,contextUsage:i}}}:{}})},onTurnFailed:(s,i,l,c)=>{r().dropSignedOutTurn(i),r().addLogEntry("ERROR",`turn:failed — ${l}`),r().addToast("error",`Turn failed — ${l}`),zh(s,"turn:failed",{sessionId:s,turnId:i,error:l}),t(d=>{const p=d.sessionDetails[s],g=l.includes("cancelled")||l.includes("aborted"),m=g?"aborted":"failed",v=p?In(p,i,C=>({...C,status:m,error:l,...c?{resume_state:c}:{},items:C.items.map(T=>T.status==="in_progress"?{...T,status:"failed"}:T)})):null,k=Ru(v),x=k&&v?Ga(v):g?"active":"failed",S=ls(d.sessions,s,()=>({is_running:k,status:x})),N=as(d.retryStates,i);return v?{sessionDetails:{...d.sessionDetails,[s]:{...v,is_running:k,status:x}},sessions:S,retryStates:N}:{sessions:S,retryStates:N}})},onTurnCancelled:(s,i)=>{r().dropSignedOutTurn(i),t(l=>{const c=l.sessionDetails[s],d=c?In(c,i,k=>({...k,status:"aborted",...k.resume_state==="waiting"||k.resume_state==="resuming"?{resume_state:"cancelled"}:{},items:k.items.map(x=>x.status==="in_progress"?{...x,status:"completed"}:x)})):null,p=Ru(d),g=p&&d?Ga(d):"active",m=ls(l.sessions,s,()=>({is_running:p,status:g})),v=as(l.retryStates,i);return d?{sessionDetails:{...l.sessionDetails,[s]:{...d,is_running:p,status:g}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnInterrupted:(s,i,l)=>{r().addLogEntry("WARN",`turn:interrupted — ${l.reason}${l.detail?` (${l.detail})`:""}`),r().addToast("warn",c0(l.reason)),l.reason==="auth"?t(c=>({signedOutTurns:{...c.signedOutTurns,[i]:s}})):r().dropSignedOutTurn(i),t(c=>{const d=c.sessionDetails[s],p=d?In(d,i,k=>({...k,status:"pending",error:null,resume_state:"waiting",interrupt_reason:l.reason,interrupted_at:l.interruptedAt,resume_attempts:l.attempts,resume_at:l.resumeAt??null})):null,g=p?Ga(p):"interrupted",m=ls(c.sessions,s,()=>({is_running:1,status:g})),v=as(c.retryStates,i);return p?{sessionDetails:{...c.sessionDetails,[s]:{...p,is_running:1,status:g}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnResuming:(s,i,l)=>{r().dropSignedOutTurn(i),r().addLogEntry("INFO",`turn:resuming — ${i.slice(0,8)} (attempt ${l})`),t(c=>{const d=ls(c.sessions,s,()=>({is_running:1,status:"running"})),p=c.sessionDetails[s];return p?{sessionDetails:{...c.sessionDetails,[s]:{...In(p,i,g=>({...g,status:"running",error:null,resume_state:"resuming",resume_attempts:l})),is_running:1,status:"running"}},sessions:d}:{sessions:d}})},onTurnResumed:(s,i)=>{r().addLogEntry("INFO",`turn:resumed — ${i.slice(0,8)}`),r().addToast("success","Interrupted turn resumed"),t(l=>{const c=l.sessionDetails[s];return c?{sessionDetails:{...l.sessionDetails,[s]:In(c,i,d=>({...d,resume_state:"resumed"}))}}:{}})},onTurnRetrying:(s,i,l)=>{r().addLogEntry("WARN",`turn:retrying — ${s.slice(0,8)}/${i.slice(0,8)} attempt ${l.attempt}/${l.maxRetries} (${l.errorStatus??"no response"}${l.error?`, ${l.error}`:""})`),t(c=>({retryStates:{...c.retryStates,[i]:l}}))},onSessionTitle:(s,i)=>{t(l=>({sessions:l.sessions.map(c=>c.id===s?{...c,title:i}:c),sessionDetails:l.sessionDetails[s]?{...l.sessionDetails,[s]:{...l.sessionDetails[s],title:i}}:l.sessionDetails}))},onSessionTouched:s=>{t(i=>{const l=i.sessionDetails[s];return{sessions:ls(i.sessions,s,()=>({user_touched:1})),sessionDetails:l?{...i.sessionDetails,[s]:{...l,user_touched:1}}:i.sessionDetails}})},onSessionUpdated:s=>{const i={...s};delete i.is_running,delete i.status,t(l=>{const c=l.sessionDetails[s.id];return{sessions:ls(l.sessions,s.id,()=>i),sessionDetails:c?{...l.sessionDetails,[s.id]:{...c,...i}}:l.sessionDetails}})},onBackgroundTasksChanged:(s,i)=>{Fh(s,i),t(l=>{if(i.length===0&&!l.backgroundTasks[s])return{};const c={...l.backgroundTasks};return i.length>0?c[s]=i:delete c[s],{backgroundTasks:c}})},onSignedOutTurnsSnapshot:s=>t({signedOutTurns:Object.fromEntries(s.map(i=>[i.turnId,i.sessionId]))}),dropSignedOutTurn:s=>{if(!(s in r().signedOutTurns))return;const i={...r().signedOutTurns};delete i[s],t({signedOutTurns:i})},onBackgroundTasksSnapshot:s=>{for(const[l,c]of Object.entries(s))Fh(l,c);const i={};for(const[l,c]of Object.entries(s))c.length>0&&(i[l]=c);t({backgroundTasks:i})}});function c0(t){switch(t){case"network":return"Network error — the turn will resume when the connection is back";case"process_exit":return"The agent process stopped — resuming the turn";case"auth":return"Claude is signed out — the turn waits until you sign in again";case"usage_limit":return"Usage limit reached — the turn waits until it is over";default:return"The agent host restarted — resuming the turn"}}function Ga(t){const r=[...t.turns,...(t.threads??[]).flatMap(s=>s.turns??[])].filter(zr);return r.length>0&&r.every(s=>s.status==="pending"&&s.resume_state==="waiting")?"interrupted":"running"}function Uh(t){return t.type!=="background_task"&&t.type!=="error"&&t.type!=="interruption"}function as(t,r){if(!(r in t))return t;const s={...t};return delete s[r],s}function Ru(t){return t&&(t.turns.some(zr)||(t.threads??[]).some(s=>(s.turns??[]).some(zr)))?1:0}function ls(t,r,s){return t.some(i=>i.id===r)?t.map(i=>i.id===r?{...i,...s(i)}:i):t}function In(t,r,s){const i=(t.threads??[]).map(l=>(l.turns??[]).some(c=>c.id===r)?{...l,turns:(l.turns??[]).map(c=>c.id===r?s(c):c)}:l);return{...t,turns:t.turns.map(l=>l.id===r?s(l):l),threads:i}}function jd(t,r){for(let s=t.length-1;s>=0;s--)if(t[s].external_item_id===r)return s;return-1}function Au(t,r){const s=jd(t.items,r.external_item_id);if(s>=0){const c=[...t.items];return c[s]=r,{...t,items:c}}if(r.type==="agent_message"){const c=t.items.filter(d=>!(d.type==="agent_message"&&d.id.startsWith("delta-")));return{...t,items:[...c,r]}}const i=t.items;let l=i.length;if(t.deferred_item_count)for(;l>0&&i[l-1].created_at>r.created_at;)l--;return{...t,items:[...i.slice(0,l),r,...i.slice(l)]}}function u0(t,r){const s=c=>c.external_item_id??c.id,i=new Map(t.items.map(c=>[s(c),c])),l=r.map(c=>{var p;const d=i.get(s(c));return i.delete(s(c)),d&&((p=d.data)==null?void 0:p.partial)!==!0&&d.updated_at>c.updated_at?d:c});return{...t,items:[...l,...i.values()],deferred_item_count:0,deferred_tool_calls:0}}function d0(t,r,s,i){var p;const l=new Date().toISOString(),c=jd(t.items,r);if(c>=0){const g=t.items[c];if(((p=g.data)==null?void 0:p.partial)!==!0||g.data.title===s&&g.data.html===i)return t;const m=[...t.items];return m[c]={...g,data:{...g.data,title:s,html:i},updated_at:l},{...t,items:m}}const d={id:`delta-${r}`,turn_id:t.id,external_item_id:r,type:"widget",data:{title:s,html:i,error:null,partial:!0},status:"in_progress",created_at:l,updated_at:l};return{...t,items:[...t.items,d]}}function f0(t,r,s){var c;const i=jd(t.items,r);if(i>=0){const d=t.items[i],g=(((c=d.data)==null?void 0:c.text)??"")+s,m=[...t.items];return m[i]={...d,data:{...d.data,text:g}},{...t,items:m,agent_response:g}}const l={id:`delta-${r}`,turn_id:t.id,external_item_id:r,type:"agent_message",data:{text:s},status:"in_progress",created_at:new Date().toISOString(),updated_at:new Date().toISOString()};return{...t,items:[...t.items,l],agent_response:s}}function p0(){const t=new URLSearchParams(window.location.search);return{session:t.get("session"),thread:t.get("thread")}}function h0(){const t=new URL(window.location.href);!t.searchParams.has("session")&&!t.searchParams.has("thread")||(t.searchParams.delete("session"),t.searchParams.delete("thread"),window.history.replaceState(window.history.state,"",t))}let Iu=0;function Bh(t){return t==="sidecar"?"sidecar":"turns"}async function m0(t,r){const s=await Promise.allSettled(t.map(c=>r(c))),i=new Map;let l=null;return s.forEach((c,d)=>{var p;c.status==="fulfilled"?i.set(t[d],c.value):l===null&&(l=((p=c.reason)==null?void 0:p.message)??"Request failed")}),{updated:i,firstError:l}}function g0(t,r){const s={...t.sessionDetails};r.forEach(g=>delete s[g]);const i={...t.backgroundTasks};r.forEach(g=>delete i[g]);const l=Object.fromEntries(Object.entries(t.signedOutTurns).filter(([,g])=>!r.has(g))),c=t.openTabs.filter(g=>!r.has(g)),d=Td(t,new Set([...r].map($s)));let p=t.activeTurnIndex;if(d.activeSessionId!==t.activeSessionId){const g=d.activeSessionId?s[d.activeSessionId]:null;p=g&&g.turns.length>0?g.turns.length-1:0}return{sessions:t.sessions.filter(g=>!r.has(g.id)),sessionDetails:s,backgroundTasks:i,signedOutTurns:l,openTabs:c,...d,activeTurnIndex:p}}function v0(t){const r={...t};return delete r.turns,delete r.threads,delete r.contextUsage,r}function Wh(t,r,s){const i=r().activeSessionId;t(c=>g0(c,s));const l=r().activeSessionId;l&&l!==i&&r().selectSession(l,{keepAppView:!0})}async function Hh(t,r,s,i,l){if(s.length===0)return;t({error:null});const{updated:c,firstError:d}=await m0(s,i);c.size>0&&t(g=>({sessions:g.sessions.map(m=>c.get(m.id)??m)}));const p=s.length-c.size;if(p===0)r().addToast("info",`${s.length} session${s.length===1?"":"s"} ${l}`);else{t({error:d});const g=l[0].toUpperCase()+l.slice(1);r().addToast(p===s.length?"error":"warn",`${g} ${c.size} of ${s.length} — ${p} failed`)}}const Du=new Map,y0=(t,r)=>({sessions:[],sessionDetails:{},activeSessionId:null,openTabs:[],activeTurnIndex:0,submittingPrompt:null,quotedText:null,init:async()=>{const s=p0(),i=Gw();try{const l=localStorage.getItem("agentpane:last-model-config");l&&t({lastModelConfig:JSON.parse(l)})}catch{}t({loading:!0,error:null});try{const l=r().loadApps(),[c,d,p]=await Promise.all([Cw(),Lg(),Pg()]);t({sessions:c,workspaces:d,folders:p,loading:!1}),h0();const g=await l,m=Yw(i,new Set(c.map(v=>v.id)),g?new Set(r().apps.map(v=>v.id)):null,s.session);t(v=>{const k=v.activeSessionId!==null||v.activeAppTabId!==null;return{openTabs:wi([...m.openTabs,...v.openTabs]),openAppTabs:wi([...m.openAppTabs,...v.openAppTabs]),tabOrder:m.tabOrder,activeAppTabId:k?v.activeAppTabId:m.activeAppTabId}}),m.activeSessionId&&!r().activeSessionId&&await r().selectSession(m.activeSessionId,{keepAppView:!0}),s.thread&&(t({deepLinkThreadId:s.thread}),r().switchRightTab("threads"))}catch(l){t({loading:!1,error:l.message})}},selectSession:async(s,i)=>{const l=++Iu,c=i!=null&&i.keepAppView?{}:{activeAppTabId:null},d=p=>p.includes(s)?p:[...p,s];if(r().sessionDetails[s]){const p=r().sessionDetails[s];t({activeSessionId:s,activeTurnIndex:p.turns.length>0?p.turns.length-1:0,activeRightTab:Bh(r().activeRightTab),...c,openTabs:d(r().openTabs)}),p.has_unreviewed===1&&(Mh(s).catch(()=>{}),t(g=>({sessions:g.sessions.map(m=>m.id===s?{...m,has_unreviewed:0}:m),sessionDetails:{...g.sessionDetails,[s]:{...p,has_unreviewed:0}}})));return}t({loading:!0,error:null});try{const p=await di(s);if(l!==Iu){t(g=>({sessionDetails:{...g.sessionDetails,[s]:p},openTabs:d(g.openTabs),loading:!1}));return}t(g=>({sessionDetails:{...g.sessionDetails,[s]:p},activeSessionId:s,activeTurnIndex:p.turns.length>0?p.turns.length-1:0,activeRightTab:Bh(g.activeRightTab),...c,openTabs:d(g.openTabs),loading:!1})),p.has_unreviewed===1&&(Mh(s).catch(()=>{}),t(g=>({sessions:g.sessions.map(m=>m.id===s?{...m,has_unreviewed:0}:m),sessionDetails:{...g.sessionDetails,[s]:{...p,has_unreviewed:0}}})))}catch(p){t(l===Iu?{loading:!1,error:p.message}:{loading:!1})}},closeTab:s=>r().closeTabs([$s(s)]),updateModelConfig:async(s,i,l)=>{const c=r().activeSessionId;if(c){t({error:null});try{const d=await Dw(c,s,i,l),p={provider:d.runtime_type,model:d.model??"",reasoning:d.model_reasoning_effort??""};t({lastModelConfig:p}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(p)),t(g=>({sessions:g.sessions.map(m=>m.id===c?d:m),sessionDetails:g.sessionDetails[c]?{...g.sessionDetails,[c]:{...g.sessionDetails[c],model:d.model,model_reasoning_effort:d.model_reasoning_effort,external_thread_id:d.external_thread_id}}:g.sessionDetails})),await r().refreshActiveSession()}catch(d){t({error:d.message}),r().addToast("error",`Failed to update model — ${d.message}`)}}},createSession:async s=>{t({error:null});try{const i=await bd(s);t(c=>({sessions:[i,...c.sessions],showNewSessionDialog:!1}));const l={provider:i.runtime_type,model:i.model??"",reasoning:i.model_reasoning_effort??""};t({lastModelConfig:l}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(l)),await r().selectSession(i.id),r().addLogEntry("INFO",`Session created — ${i.id.slice(0,8)}`),r().addToast("success",`Session created — ${i.title||i.id.slice(0,8)}`)}catch(i){t({error:i.message}),r().addToast("error",`Failed to create session — ${i.message}`)}},addSession:s=>{t(i=>({sessions:i.sessions.some(l=>l.id===s.id)?i.sessions:[s,...i.sessions]}))},revealSession:async s=>{let i=r().sessionDetails[s];if(!i){const l=await di(s);t(c=>({sessionDetails:{...c.sessionDetails,[s]:l}})),i=l}r().sessions.some(l=>l.id===s)||r().addSession(v0(i)),await r().selectSession(s)},deleteSession:async s=>{var l;t({error:null});const i=(l=r().sessions.find(c=>c.id===s))==null?void 0:l.title;try{await Ah(s),Wh(t,r,new Set([s])),r().addLogEntry("INFO",`Session deleted — ${s.slice(0,8)}`),r().addToast("info",`Session "${i||s.slice(0,8)}" deleted`)}catch(c){t({error:c.message}),r().addToast("error",`Failed to delete session — ${c.message}`)}},renameSession:async(s,i)=>{t({error:null});try{const l=await Aw(s,i.trim());t(c=>({sessions:c.sessions.map(d=>d.id===s?l:d),sessionDetails:c.sessionDetails[s]?{...c.sessionDetails,[s]:{...c.sessionDetails[s],title:l.title}}:c.sessionDetails}))}catch(l){t({error:l.message}),r().addToast("error",`Failed to rename session — ${l.message}`)}},markFinished:async s=>{t({error:null});try{const i=await Ih(s);t(l=>({sessions:l.sessions.map(c=>c.id===s?i:c)})),r().addToast("info","Session marked as finished")}catch(i){t({error:i.message}),r().addToast("error",`Failed to mark as finished — ${i.message}`)}},markFinishedMany:async s=>{await Hh(t,r,s,Ih,"marked as finished")},toggleStar:async s=>{const i=r().sessions.find(l=>l.id===s);if(i){t({error:null});try{const l=await Iw(s,i.starred?0:1);t(c=>({sessions:c.sessions.map(d=>d.id===s?l:d),sessionDetails:c.sessionDetails[s]?{...c.sessionDetails,[s]:{...c.sessionDetails[s],starred:l.starred}}:c.sessionDetails}))}catch(l){t({error:l.message}),r().addToast("error",`Failed to star session — ${l.message}`)}}},reopenSession:async s=>{t({error:null});try{const i=await Dh(s);t(l=>({sessions:l.sessions.map(c=>c.id===s?i:c)})),r().addToast("info","Session reopened")}catch(i){t({error:i.message}),r().addToast("error",`Failed to reopen session — ${i.message}`)}},reopenSessionMany:async s=>{await Hh(t,r,s,Dh,"reopened")},deleteSessionMany:async s=>{if(s.length===0)return;t({error:null});const i=await Promise.allSettled(s.map(d=>Ah(d))),l=new Set;if(i.forEach((d,p)=>{d.status==="fulfilled"&&l.add(s[p])}),l.size===0){t({error:"Failed to delete sessions"}),r().addToast("error","Failed to delete sessions");return}Wh(t,r,l),r().addLogEntry("INFO",`${l.size} session${l.size===1?"":"s"} deleted`);const c=s.length-l.size;c===0?r().addToast("info",`${l.size} session${l.size===1?"":"s"} deleted`):(t({error:"One or more sessions failed to delete"}),r().addToast("warn",`Deleted ${l.size} of ${s.length} — ${c} failed`))},submitPrompt:async(s,i)=>{const l=r().activeSessionId;if(l){t({error:null,submittingPrompt:s}),t(c=>{const d=c.sessionDetails[l];return d?{sessionDetails:{...c.sessionDetails,[l]:{...d,is_running:1,status:"running"}},sessions:c.sessions.map(p=>p.id===l?{...p,is_running:1,status:"running"}:p)}:{}});try{const c=await Mg(l,s,i);r().addLogEntry("INFO",`Turn submitted — "${s.slice(0,40)}"`),t(d=>{const p=d.sessionDetails[l];if(!p)return{submittingPrompt:null};const g=p.turns.findIndex(v=>v.id===c.id);if(g>=0)return{submittingPrompt:null,activeTurnIndex:g};const m={...c,items:[]};return{submittingPrompt:null,sessionDetails:{...d.sessionDetails,[l]:{...p,turns:[...p.turns,m]}},activeTurnIndex:p.turns.length}})}catch(c){t({submittingPrompt:null,error:c.message}),r().addLogEntry("ERROR",`Turn failed — ${c.message}`),r().addToast("error",`Failed to send prompt — ${c.message}`),t(d=>{const p=d.sessionDetails[l];if(!p)return{};const g=Ol(p)?1:0;return{sessionDetails:{...d.sessionDetails,[l]:{...p,is_running:g,status:g?"running":"active"}},sessions:d.sessions.map(m=>m.id===l?{...m,is_running:g,status:g?"running":"active"}:m)}})}}},cancelTurn:async()=>{const s=r().activeSessionId;if(s)try{await jw(s)}catch(i){t({error:i.message})}},rewindToTurn:async(s,i)=>{t({error:null});try{const l=await Lw(s,i),c=await di(s);t(d=>({sessionDetails:{...d.sessionDetails,[s]:c},sessions:d.sessions.map(p=>p.id===s?{...p,external_thread_id:l.external_thread_id,is_running:0,status:"active"}:p),activeTurnIndex:c.turns.length>0?c.turns.length-1:0})),r().addToast("info","Rewound to selected turn")}catch(l){t({error:l.message}),r().addToast("error",`Failed to rewind — ${l.message}`)}},restoreSession:async s=>{t({error:null});try{const i=await Ow(s),l=await di(s);t(c=>({sessionDetails:{...c.sessionDetails,[s]:l},sessions:c.sessions.map(d=>d.id===s?{...d,external_thread_id:i.external_thread_id,is_running:0,status:"active"}:d),activeTurnIndex:l.turns.length>0?l.turns.length-1:0})),r().addToast("info","Restored rewound session")}catch(i){t({error:i.message}),r().addToast("error",`Failed to restore — ${i.message}`)}},branchFromTurn:async(s,i,l)=>{t({error:null});try{const c=await Pw(s,i,l);t(d=>({sessions:[c,...d.sessions]})),await r().selectSession(c.id),r().addToast("success","Branched from selected turn")}catch(c){t({error:c.message}),r().addToast("error",`Failed to branch — ${c.message}`)}},updateRuntimeConfig:async s=>{const i=r().activeSessionId;if(i){t({error:null});try{const l=await Mw(i,JSON.stringify(s));t(c=>({sessions:c.sessions.map(d=>d.id===i?l:d),sessionDetails:c.sessionDetails[i]?{...c.sessionDetails,[i]:{...c.sessionDetails[i],runtime_config:l.runtime_config}}:c.sessionDetails}))}catch(l){t({error:l.message}),r().addToast("error",`Failed to update config — ${l.message}`)}}},refreshActiveSession:async()=>{const s=r().activeSessionId;if(s)try{const i=await di(s);t(l=>({sessionDetails:{...l.sessionDetails,[s]:i},activeTurnIndex:i.turns.length>0?Math.min(l.activeTurnIndex,i.turns.length-1):0,sessions:l.sessions.map(c=>c.id===s?{...c,is_running:i.is_running,status:i.status}:c)}))}catch(i){t({error:i.message})}},loadDeferredItems:(s,i)=>{const l=Du.get(i);if(l)return l;const c=Ew(s,i).then(({items:d})=>(t(p=>{const g=p.sessionDetails[s];return g?{sessionDetails:{...p.sessionDetails,[s]:In(g,i,m=>u0(m,d))}}:{}}),!0)).catch(d=>(r().addToast("error",`Failed to load tool calls — ${d.message}`),!1)).finally(()=>Du.delete(i));return Du.set(i,c),c}});async function Vg(t){const{sessions:r}=await Mt(`/claude-sessions?workspace=${encodeURIComponent(t)}`);return r}function x0(t,r){return it(`/claude-sessions/${encodeURIComponent(t)}/import`,{workspace:r})}const Vh={available:!0,reason:null};let Mu=null;const w0=(t,r)=>({workspaces:[],pickerSupport:null,loadPickerSupport:()=>{const s=r().pickerSupport;return s?Promise.resolve(s):(Mu??(Mu=Fw().then(i=>typeof(i==null?void 0:i.available)!="boolean"?Vh:(t({pickerSupport:i}),i)).catch(()=>Vh).finally(()=>{Mu=null})),Mu)},createWorkspaceAt:async s=>{const i=await $w(s.trim());return t(l=>({workspaces:[...l.workspaces.filter(c=>c.id!==i.id),i]})),i},addWorkspace:async s=>{t({error:null});try{const i=await r().createWorkspaceAt(s);return r().addToast("success",`Workspace added — ${i.path}`),i}catch(i){return r().addToast("error",`Failed to add workspace — ${Ps(i)}`),null}},removeWorkspace:async s=>{t({error:null});try{await zw(s);const i=await Lg();t({workspaces:i}),r().addToast("info","Workspace hidden")}catch(i){r().addToast("error",`Failed to hide workspace — ${i.message}`)}},createSessionInWorkspace:async s=>{t({error:null});try{const i=r().lastModelConfig,l=await bd({cwd:s,runtime_type:(i==null?void 0:i.provider)??"codex",model:i==null?void 0:i.model,model_reasoning_effort:i==null?void 0:i.reasoning});t(c=>({sessions:[l,...c.sessions]})),await r().selectSession(l.id),r().addLogEntry("INFO",`Session created in ${s} — ${l.id.slice(0,8)}`),r().addToast("success",`Session created in ${s.split("/").pop()||s}`)}catch(i){t({error:i.message}),r().addToast("error",`Failed to create session — ${i.message}`)}},pickAndAddWorkspace:async()=>{if(!(await r().loadPickerSupport()).available){r().setShowAddWorkspaceDialog(!0);return}try{const i=await Og();if(i.cancelled||!i.path)return;await r().addWorkspace(i.path)}catch(i){r().addToast("error",`Failed to pick directory — ${i.message}`)}},importClaudeSessions:async(s,i)=>{const l=[],c=[];for(const d of[...i].reverse())try{l.unshift(await x0(d,s))}catch(p){c.unshift({id:d,error:Ps(p)})}return l.length>0&&(t(d=>({sessions:[...l,...d.sessions]})),await r().selectSession(l[0].id),r().addLogEntry("INFO",`Imported ${l.length} Claude Code session(s) into ${s}`),r().addToast("success",l.length===1?`Imported — ${l[0].title||"Claude Code session"}`:`Imported ${l.length} Claude Code sessions`)),{imported:l,failed:c}}});function Kg(t,r){const s=r?`?cwd=${encodeURIComponent(r)}`:"";return Mt(`/providers/${encodeURIComponent(t)}/models${s}`)}const Kh="curl -fsSL https://repoburg.com/install.sh | bash",k0=2e3,Gg="agentpane:daemon-seen";function S0(t=mn()){if(!t)return!1;try{const r=new URL(t);return r.protocol==="http:"&&(r.hostname==="localhost"||r.hostname==="127.0.0.1")}catch{return!1}}async function b0(t=mn()){try{return await fetch(`${t}/health`,{mode:"no-cors",cache:"no-store"}),!0}catch{return!1}}function N0(){try{return localStorage.getItem(Gg)==="true"}catch{return!1}}function T0(){try{localStorage.setItem(Gg,"true")}catch{}}function C0(t){let r=!1,s=!1,i=!1,l=null;function c(){l!==null&&(clearTimeout(l),l=null)}async function d(){if(r||s)return;c(),s=!0;const m=await b0();if(s=!1,!r){if(m){T0(),g(),t.onReady();return}i||(i=!0,t.onMissing()),l=setTimeout(()=>void d(),k0)}}function p(){document.visibilityState==="visible"&&d()}function g(){r=!0,c(),window.removeEventListener("focus",p),document.removeEventListener("visibilitychange",p)}return window.addEventListener("focus",p),document.addEventListener("visibilitychange",p),d(),g}const Ju=160,ed=480,E0=240,pl=220,j0=300,_0=600,R0=36;function hl(){return typeof window>"u"?_0:Math.max(pl,Math.round(window.innerWidth*.7))}const Gh="agentpane:sidebar-width",qh="agentpane:right-panel-width",Lu="agentpane:right-panel-collapsed";function Xh(t,r,s,i){try{const l=localStorage.getItem(t);if(l==null)return i;const c=Number(l);return Number.isFinite(c)?Math.min(s,Math.max(r,c)):i}catch{return i}}function A0(t){try{return localStorage.getItem(t)==="true"}catch{return!1}}function Yh(t,r){try{localStorage.setItem(t,String(r))}catch{}}const Qh=200,I0=(t,r)=>({activeRightTab:"turns",eventLog:[],loading:!1,error:null,showNewSessionDialog:!1,showAddWorkspaceDialog:!1,importSessionsWorkspace:null,showRemoteModal:!1,toasts:[],showCommandPalette:!1,lastModelConfig:null,models:[],modelsLoading:!1,showModelSelector:!1,sidebarWidth:Xh(Gh,Ju,ed,E0),rightPanelWidth:Xh(qh,pl,hl(),j0),rightPanelCollapsed:A0(Lu),deepLinkThreadId:null,vscodeViewOpen:!1,vscodeState:"stopped",vscodeId:null,vscodeToken:null,usageViewOpen:!1,terminalViewOpen:!1,canGoBack:!1,canGoForward:!1,daemonStatus:S0()?"checking":"ready",setActiveTurnIndex:s=>t({activeTurnIndex:s}),switchRightTab:s=>{r().rightPanelCollapsed&&Yh(Lu,!1),t({activeRightTab:s,rightPanelCollapsed:!1})},setShowNewSessionDialog:s=>t({showNewSessionDialog:s}),setShowAddWorkspaceDialog:s=>t({showAddWorkspaceDialog:s}),setImportSessionsWorkspace:s=>t({importSessionsWorkspace:s}),setShowRemoteModal:s=>t({showRemoteModal:s}),setShowCommandPalette:s=>t({showCommandPalette:s}),setShowModelSelector:s=>t({showModelSelector:s}),setDeepLinkThreadId:s=>t({deepLinkThreadId:s}),setSidebarWidth:s=>{const i=Math.min(ed,Math.max(Ju,Math.round(s)));t({sidebarWidth:i});try{localStorage.setItem(Gh,String(i))}catch{}},setRightPanelWidth:s=>{const i=Math.min(hl(),Math.max(pl,Math.round(s)));t({rightPanelWidth:i});try{localStorage.setItem(qh,String(i))}catch{}},setRightPanelCollapsed:s=>{t({rightPanelCollapsed:s}),Yh(Lu,s)},toggleRightPanel:()=>r().setRightPanelCollapsed(!r().rightPanelCollapsed),toggleVscodeView:()=>{if(r().vscodeViewOpen){t({vscodeViewOpen:!1});return}t({vscodeViewOpen:!0,terminalViewOpen:!1,vscodeState:"starting",vscodeId:null,vscodeToken:null})},setVscodeView:(s,i,l)=>t({vscodeState:s,vscodeId:i,vscodeToken:l}),toggleUsageView:()=>t({usageViewOpen:!r().usageViewOpen,terminalViewOpen:!1}),toggleTerminalView:()=>t(r().terminalViewOpen?{terminalViewOpen:!1}:{terminalViewOpen:!0,vscodeViewOpen:!1,usageViewOpen:!1}),setDaemonStatus:s=>t({daemonStatus:s}),addToast:(s,i,l,c)=>{const d=Math.random().toString(36).slice(2,9);t(p=>({toasts:[...p.toasts,{id:d,type:s,message:i,undoAction:l,undoLabel:c}]}))},removeToast:s=>{t(i=>({toasts:i.toasts.filter(l=>l.id!==s)}))},addLogEntry:(s,i)=>{const l=new Date().toLocaleTimeString("en-GB",{hour12:!1});t(c=>{const d=[...c.eventLog,{time:l,level:s,message:i}];return d.length>Qh&&d.splice(0,d.length-Qh),{eventLog:d}})},loadModels:async(s,i)=>{if(!r().modelsLoading){t({modelsLoading:!0,models:[]});try{const l=await Kg(s,i);t({models:l,modelsLoading:!1})}catch{t({modelsLoading:!1})}}}}),D0=(t,r)=>({createThread:async(s,i)=>{try{await it(`/sessions/${s}/threads`,i),r().addLogEntry("INFO",`Thread created — "${i.message.slice(0,40)}"`)}catch(l){r().addToast("error",`Failed to create thread — ${l.message}`)}},followupThread:async(s,i,l)=>{try{await it(`/sessions/${s}/threads/${i}/followup`,{message:l}),r().addLogEntry("INFO",`Thread follow-up — "${l.slice(0,40)}"`)}catch(c){r().addToast("error",`Failed to send follow-up — ${c.message}`)}},cancelThreadTurn:async(s,i)=>{try{await it(`/sessions/${s}/cancel?threadId=${encodeURIComponent(i)}`),r().addLogEntry("INFO","Thread turn cancelled")}catch(l){r().addToast("error",`Failed to cancel thread turn — ${l.message}`)}},resolveThread:async(s,i)=>{try{await dr(`/sessions/${s}/threads/${i}`,{status:"resolved"})}catch(l){r().addToast("error",`Failed to resolve thread — ${l.message}`)}},reopenThread:async(s,i)=>{try{await dr(`/sessions/${s}/threads/${i}`,{status:"open"})}catch(l){r().addToast("error",`Failed to reopen thread — ${l.message}`)}},shareThread:async(s,i,l)=>{try{const c=await it(`/sessions/${s}/threads/${i}/summarize`,{directives:l}),d=`
43
+ [Shared from a resolved discussion thread — summary of its findings]
44
+
45
+ \`\`\`QUOTE
46
+ ${c.summary}
47
+ \`\`\`
48
+
49
+ `;return t({quotedText:d}),r().addLogEntry("INFO",`Thread shared to main session — "${c.summary.slice(0,40)}"`),r().addToast("success","Thread summary added to your input"),!0}catch(c){return r().addToast("error",`Failed to share thread — ${c.message}`),!1}},deleteThread:async(s,i)=>{try{await Ll(`/sessions/${s}/threads/${i}`)}catch(l){r().addToast("error",`Failed to delete thread — ${l.message}`)}},askSidecar:async(s,i)=>{try{return await it(`/sessions/${s}/sidecar`,{message:i}),r().addLogEntry("INFO",`Sidecar asked — "${i.slice(0,40)}"`),!0}catch(l){return r().addToast("error",`Failed to ask the sidecar — ${l.message}`),!1}},onThreadCreated:(s,i,l)=>{t(c=>{const d=c.sessionDetails[s];return d?{sessionDetails:{...c.sessionDetails,[s]:{...d,threads:[...d.threads??[],{...i,turns:[{...l,items:[]}]}]}}}:{}})},onThreadFollowup:(s,i,l)=>{t(c=>{const d=c.sessionDetails[s];return d?{sessionDetails:{...c.sessionDetails,[s]:{...d,threads:(d.threads??[]).map(p=>p.id===i?{...p,turns:[...p.turns??[],{...l,items:[]}]}:p)}}}:{}})},onThreadResolved:(s,i,l)=>{t(c=>{const d=c.sessionDetails[s];if(!d)return{};const p=(d.threads??[]).map(g=>g.id===i?{...g,status:l,resolved_at:l==="resolved"?new Date().toISOString():null}:g);return{sessionDetails:{...c.sessionDetails,[s]:{...d,threads:p}}}})},onThreadDeleted:(s,i)=>{t(l=>{const c=l.sessionDetails[s];return c?{sessionDetails:{...l.sessionDetails,[s]:{...c,threads:(c.threads??[]).filter(d=>d.id!==i)}}}:{}})}}),M0=(t,r)=>({folders:[],loadFolders:async()=>{const s=await Pg();t({folders:s})},createSidebarFolder:async(s,i)=>{try{const l=await Uw(s,i);return t(c=>({folders:[...c.folders,l]})),l}catch(l){return r().addToast("error",`Failed to create folder — ${l.message}`),null}},renameFolder:async(s,i)=>{try{const l=await Oh(s,{name:i});t(c=>({folders:c.folders.map(d=>d.id===s?l:d)}))}catch(l){r().addToast("error",`Failed to rename folder — ${l.message}`)}},deleteFolder:async s=>{const i=r().folders,l=r().sessions;t(c=>({folders:c.folders.filter(d=>d.id!==s),sessions:c.sessions.map(d=>d.folder_id===s?{...d,folder_id:null}:d)}));try{await Bw(s)}catch(c){t({folders:i,sessions:l}),r().addToast("error",`Failed to delete folder — ${c.message}`)}},applyMoves:async s=>{if(s.length===0)return;const i=r().sessions,l=new Map(s.map(c=>[c.id,c]));t(c=>({sessions:c.sessions.map(d=>{const p=l.get(d.id);return p?{...d,folder_id:p.folder_id,sort_order:p.sort_order}:d})}));try{await Ww(s)}catch(c){t({sessions:i}),r().addToast("error",`Failed to save session order — ${c.message}`)}},reorderFolders:async s=>{const i=r().folders,l=new Map(s.map((c,d)=>[c,d]));t(c=>({folders:c.folders.map(d=>l.has(d.id)?{...d,sort_order:l.get(d.id)}:d)}));try{await Promise.all(s.map((c,d)=>Oh(c,{sort_order:d})))}catch(c){t({folders:i}),r().addToast("error",`Failed to save folder order — ${c.message}`)}}});function Zh(){return Mt("/apps")}function L0(){return Mt("/apps/root")}function Jh(t){return Mt(`/apps/${t}/source`)}function em(t,r=""){return Mt(`/apps/${t}/state?workspace=${encodeURIComponent(r)}`)}function qg(t,r,s=""){return Tw(`/apps/${t}/state?workspace=${encodeURIComponent(s)}`,r)}function O0(t){return Ll(`/apps/${t}`)}function P0(t){return Mt(`/apps/${t}/sessions`)}async function $0(t,r){try{return await Mt(`/apps/${t}/sessions/${encodeURIComponent(r)}`)}catch(s){if(s instanceof Ml&&s.status===404)return null;throw s}}function z0(t,r){return it(`/apps/${t}/sessions/${encodeURIComponent(r)}/cancel`)}function F0(t,r,s){return dr(`/apps/${t}/sessions/${encodeURIComponent(r)}`,{lifecycle:s})}async function U0(t,r,s,i){const l=await it("/apps/mcp/call",{tool:`${t}__${s}`,args:i,workspace:r});if(!l.ok)throw new Error(l.error||`callTool: ${s} failed`);return l.result}function B0(){return Mt("/apps/examples")}function W0(t){return it(`/apps/examples/${t}/install`,{})}function H0(t){return it("/apps",t)}function V0(t,r){return it("/apps/import",{id:t,files:r})}function K0(t,r,s){return it(`/apps/mcp/calls/${t}/result`,{result:r,error:null})}function G0(t,r){return it(`/apps/${t}/edit-session`,r)}function q0(t,r){return it(`/apps/${t}/files`,r)}async function X0(t,r){const s=await fetch(`${mn()}/api/apps/${t}/files/${encodeURIComponent(r)}/meta`);if(s.status===404)return null;if(!s.ok)throw new Error(`GET /apps/${t}/files/${r}/meta failed: ${s.status} ${s.statusText}`);return await s.json()}async function Y0(t,r){const s=await fetch(`${mn()}/api/apps/${t}/files/${encodeURIComponent(r)}`);if(!s.ok)throw new Error(`GET /apps/${t}/files/${r} failed: ${s.status} ${s.statusText}`);return s.blob()}const il=new Set;async function Ou(t,r){il.add(r),await t().loadApps();const s=t().apps.find(i=>i.id===r);t().openAppTab(r),t().addToast("success",`Mini app added: ${(s==null?void 0:s.title)??r}`)}const td="agentpane:app-workspaces";function Q0(){try{const t=JSON.parse(localStorage.getItem(td)??"{}");return t&&typeof t=="object"?t:{}}catch{return{}}}const Z0=(t,r)=>({apps:[],appsRootPath:null,openAppTabs:[],activeAppTabId:null,appCatalogOpen:!1,appWorkspaces:Q0(),loadApps:async()=>{try{const[s,i]=await Promise.all([Zh(),L0().catch(()=>null)]);return s.forEach(l=>il.add(l.id)),t(i?{apps:s,appsRootPath:i.root}:{apps:s}),!0}catch{return!1}},refreshApps:async()=>{try{const s=await Zh();for(const i of s)il.has(i.id)||(il.add(i.id),r().addToast("success",`New mini app discovered: ${i.title}`));t({apps:s})}catch{}},openAppTab:s=>{t(i=>({activeAppTabId:s,openAppTabs:i.openAppTabs.includes(s)?i.openAppTabs:[...i.openAppTabs,s]}))},closeAppTab:s=>r().closeTabs([Ci(s)]),setActiveAppTab:s=>t({activeAppTabId:s}),openAppCatalog:()=>t({appCatalogOpen:!0}),closeAppCatalog:()=>t({appCatalogOpen:!1}),setAppWorkspace:(s,i)=>{t(l=>{const c={...l.appWorkspaces,[s]:i};try{localStorage.setItem(td,JSON.stringify(c))}catch{}return{appWorkspaces:c}})},installExampleApp:async s=>{try{return await W0(s),await Ou(r,s),!0}catch(i){return r().addToast("error",`Failed to install app — ${i.message}`),!1}},createSkeletonApp:async s=>{try{return await H0(s),await Ou(r,s.id),!0}catch(i){return r().addToast("error",`Failed to create app — ${i.message}`),!1}},importAppFolder:async(s,i)=>{try{return await V0(s,i),await Ou(r,s),!0}catch(l){return r().addToast("error",`Failed to import app — ${l.message}`),!1}},startAppEdit:async s=>{try{const i=r().lastModelConfig,l=await G0(s,{runtime_type:i==null?void 0:i.provider,model:(i==null?void 0:i.model)??null,model_reasoning_effort:(i==null?void 0:i.reasoning)??null});r().sessions.some(c=>c.id===l.id)||t(c=>({sessions:[l,...c.sessions]})),await r().selectSession(l.id),r().addLogEntry("INFO",`App edit session opened for ${s}`)}catch(i){r().addToast("error",`Failed to open app edit session — ${i.message}`)}},toggleAppPin:async s=>{const i=r().apps.find(l=>l.id===s);if(i)try{await qg(s,{pinned:!i.pinned}),await r().loadApps()}catch(l){r().addToast("error",`Failed to pin app — ${l.message}`)}},deleteApp:async s=>{try{await O0(s);const i=r().activeSessionId;t(c=>{const d={...c.appWorkspaces};delete d[s];try{localStorage.setItem(td,JSON.stringify(d))}catch{}return{apps:c.apps.filter(p=>p.id!==s),openAppTabs:c.openAppTabs.filter(p=>p!==s),...Td(c,new Set([Ci(s)])),appWorkspaces:d}});const l=r().activeSessionId;l&&l!==i&&r().selectSession(l,{keepAppView:!0}),r().addToast("success",`Mini app deleted: ${s}`)}catch(i){r().addToast("error",`Failed to delete app — ${i.message}`)}}}),J0=(t,r)=>({tabOrder:[],closedTabs:[],moveTab:(s,i)=>{const l=[...r().tabOrder],c=l.indexOf(s),d=l.indexOf(i);c===-1||d===-1||c===d||(l.splice(d,0,...l.splice(c,1)),t({tabOrder:l}))},closeTabs:s=>{const i=r(),l=new Set(s.filter(g=>i.tabOrder.includes(g)));if(l.size===0)return;const c=Td(i,l),d=i.tabOrder.map((g,m)=>({key:g,index:m})).filter(g=>l.has(g.key)).reverse();t({...c,openTabs:i.openTabs.filter(g=>!l.has($s(g))),openAppTabs:i.openAppTabs.filter(g=>!l.has(Ci(g))),tabOrder:i.tabOrder.filter(g=>!l.has(g)),closedTabs:[...i.closedTabs,...d].slice(-20)});const p=c.activeSessionId;p!==null&&p!==i.activeSessionId&&r().selectSession(p,{keepAppView:!0})},reopenClosedTab:()=>{const s=r(),i=[...s.closedTabs];let l=i.pop();for(;l&&!Fg(s,l.key);)l=i.pop();if(!l){t({closedTabs:[]});return}const c=[...s.tabOrder];c.splice(l.index,0,l.key);const{kind:d,id:p}=ps(l.key);d==="app"?(t({closedTabs:i,tabOrder:c,openAppTabs:[...s.openAppTabs,p]}),r().openAppTab(p)):(t({closedTabs:i,tabOrder:c,openTabs:[...s.openTabs,p]}),r().selectSession(p))}}),tm=3e3,Vn={lagMs:100,longtaskBufferMs:50,longtaskLogMs:100,eventBufferMs:50,eventLogMs:100,keypressMs:100,wsPerSecLog:15,storePerSecLog:15,renderPerSecLog:6,frameGapMs:150},Kn=[];let ml=0,_d=0,gl=0,Rd=0,vl=0,Ad=0,Id=0;const Ei=new Map,ji=new Map;let So=new Map,wo=0,bo=new Map,Pu=!1;function yl(t,r,s){if(Kn.push({t:Date.now(),cat:t,msg:r,ms:s}),Kn.length>tm){const i=Kn.length-tm;Kn.splice(0,i),Dn=Math.max(0,Dn-i)}}function ko(t,r,s){yl(t,r,s),console.log(`[perf:${t}] ${r}`)}function Xg(t){ko("note",t)}function Yg(t){return t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}function e1(t,r){let s=So.get(t);s||So.set(t,s={n:0,bytes:0}),s.n++,s.bytes+=r;let i=Ei.get(t);i||Ei.set(t,i={n:0,bytes:0}),i.n++,i.bytes+=r}function t1(){wo++,Id++}function n1(t){bo.set(t,(bo.get(t)??0)+1),ji.set(t,(ji.get(t)??0)+1)}let al=0;function r1(){al=performance.now()}function s1(){const t=performance.now(),r=al?t-al:null;al=0,requestAnimationFrame(()=>{if(r===null)return;const s=performance.now()-t+r;s>Vn.keypressMs&&ko("input",`keystroke→paint ${Math.round(s)}ms (keydown→change ${Math.round(r)}ms, change→paint ${Math.round(performance.now()-t)}ms)`)})}const o1=5e3,Qg=500,nm=2e3;let Dn=0,$u=!1;function i1(t){return it("/perf-log",{entries:t}).then(()=>{Dn+=t.length})}function a1(){if($u||Dn>=Kn.length)return;const t=Kn.slice(Dn,Dn+Qg);t.length!==0&&($u=!0,i1(t).catch(()=>{Kn.length-Dn>nm&&(Dn=Math.max(Dn,Kn.length-nm))}).finally(()=>{$u=!1}))}function rm(){if(typeof navigator>"u"||typeof navigator.sendBeacon!="function"||Dn>=Kn.length)return;const t=Kn.slice(Dn,Dn+Qg);if(t.length!==0)try{const r=new Blob([JSON.stringify({entries:t})],{type:"application/json"});navigator.sendBeacon(`${mn()}/api/perf-log`,r),Dn+=t.length}catch{}}function l1(){let t=0;for(const i of So.values())t+=i.n;const r=[];if(t>0){const i=[...So.entries()].sort((l,c)=>c[1].n-l[1].n).map(([l,c])=>`${l}×${c.n}(${Yg(c.bytes)})`).join(", ");r.push(`ws ${t}/s [${i}]`)}wo>0&&r.push(`store ${wo}/s`);const s=[...bo.entries()].sort((i,l)=>l[1]-i[1]).map(([i,l])=>`${i}×${l}`);if(s.length>0&&r.push(`renders ${s.join(" ")}`),r.length>0){const i=r.join(" · ");yl("stat",i);const l=[...bo.values()].some(c=>c>Vn.renderPerSecLog);(t>Vn.wsPerSecLog||wo>Vn.storePerSecLog||l)&&console.log(`[perf:stat] ${i}`)}So=new Map,wo=0,bo=new Map}function c1(t){if(t instanceof Element){const r=t.id?`#${t.id}`:"",s=typeof t.className=="string"&&t.className?`.${t.className.trim().split(/\s+/)[0]}`:"";return`${t.tagName.toLowerCase()}${r}${s}`}return t?"window":"unknown"}function u1(){if(Pu||typeof window>"u")return()=>{};Pu=!0,ml=Date.now();const t=[];let r=performance.now()+250;const s=window.setInterval(()=>{const c=performance.now(),d=c-r;r=c+250,d>Vn.lagMs&&(_d++,gl=Math.max(gl,d),ko("lag",`event loop blocked ${Math.round(d)}ms`))},250);if(t.push(()=>window.clearInterval(s)),typeof window.requestAnimationFrame=="function"){let c=performance.now(),d=0;const p=g=>{const m=g-c;c=g,m>Vn.frameGapMs&&ko("lag",`frame gap ${Math.round(m)}ms`),d=window.requestAnimationFrame(p)};d=window.requestAnimationFrame(p),t.push(()=>window.cancelAnimationFrame(d))}if(typeof PerformanceObserver<"u"){try{const c=new PerformanceObserver(d=>{var p;for(const g of d.getEntries()){const m=g.duration;if(m<Vn.longtaskBufferMs)continue;Rd++,vl=Math.max(vl,m);const v=(p=g.attribution)==null?void 0:p[0],k=(v==null?void 0:v.containerName)||(v==null?void 0:v.name)||"unknown",x=`long task ${Math.round(m)}ms (${k})`;m>=Vn.longtaskLogMs?ko("longtask",x,m):yl("longtask",x,m)}});c.observe({type:"longtask",buffered:!1}),t.push(()=>c.disconnect())}catch{}try{const c=new PerformanceObserver(d=>{for(const p of d.getEntries()){const g=p.duration,m=p.processingStart-p.startTime;Ad++;const v=`${p.name} ${Math.round(g)}ms (input delay ${Math.round(m)}ms) on ${c1(p.target)}`;g>=Vn.eventLogMs?ko("input",v,g):yl("input",v,g)}});c.observe({type:"event",durationThreshold:Vn.eventBufferMs}),t.push(()=>c.disconnect())}catch{}}const i=window.setInterval(l1,1e3);t.push(()=>window.clearInterval(i)),Xg("perf logger session started");const l=window.setInterval(a1,o1);return t.push(()=>window.clearInterval(l)),window.addEventListener("beforeunload",rm),t.push(()=>window.removeEventListener("beforeunload",rm)),window.__agentPanePerf={dump:Zg,reset:Jg},()=>{t.forEach(c=>c()),Pu=!1}}function Zg(){const t=[],r=ml?Math.round((Date.now()-ml)/1e3):0;if(t.push("=== agent-pane perf report ==="),t.push(`uptime ${r}s · ${Kn.length} buffered entries`),t.push(`event-loop lag: ${_d} blocks >${Vn.lagMs}ms (max ${Math.round(gl)}ms)`),t.push(`long tasks: ${Rd} ≥${Vn.longtaskBufferMs}ms (max ${Math.round(vl)}ms)`),t.push(`slow input events (≥${Vn.eventBufferMs}ms): ${Ad}`),t.push(`store updates: ${Id} total`),Ei.size>0){t.push("ws messages by type (top 15):");for(const[s,i]of[...Ei.entries()].sort((l,c)=>c[1].n-l[1].n).slice(0,15))t.push(` ${s}: ${i.n} msgs, ${Yg(i.bytes)}`)}if(ji.size>0){t.push("render counts by component:");for(const[s,i]of[...ji.entries()].sort((l,c)=>c[1]-l[1]))t.push(` ${s}: ${i}`)}t.push("--- last 200 entries ---");for(const s of Kn.slice(-200))t.push(`${new Date(s.t).toISOString().slice(11,23)} [${s.cat}] ${s.msg}`);return t.join(`
50
+ `)}function Jg(){Kn.length=0,Dn=0,ml=Date.now(),_d=0,gl=0,Rd=0,vl=0,Ad=0,Id=0,Ei.clear(),ji.clear(),So=new Map,wo=0,bo=new Map}const Dt={start:u1,note:Xg,trackWsEvent:e1,trackStoreUpdate:t1,trackRender:n1,markKeystroke:r1,markInputChange:s1,dump:Zg,reset:Jg},A=mw()((...t)=>({...y0(...t),...w0(...t),...l0(...t),...I0(...t),...D0(...t),...M0(...t),...Z0(...t),...J0(...t)}));typeof window<"u"&&(A.subscribe(()=>Dt.trackStoreUpdate()),Vw(A),Xw(A));const d1="modulepreload",f1=function(t){return"/"+t},sm={},p1=function(r,s,i){let l=Promise.resolve();if(s&&s.length>0){let d=function(m){return Promise.all(m.map(v=>Promise.resolve(v).then(k=>({status:"fulfilled",value:k}),k=>({status:"rejected",reason:k}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),g=(p==null?void 0:p.nonce)||(p==null?void 0:p.getAttribute("nonce"));l=d(s.map(m=>{if(m=f1(m),m in sm)return;sm[m]=!0;const v=m.endsWith(".css"),k=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${k}`))return;const x=document.createElement("link");if(x.rel=v?"stylesheet":d1,v||(x.as="script"),x.crossOrigin="",x.href=m,g&&x.setAttribute("nonce",g),document.head.appendChild(x),v)return new Promise((S,N)=>{x.addEventListener("load",S),x.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(d){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=d,window.dispatchEvent(p),!p.defaultPrevented)throw d}return l.then(d=>{for(const p of d||[])p.status==="rejected"&&c(p.reason);return r().catch(c)})};function nd(t){switch(t){case"claude":return{iconClass:"ic-claude",iconText:"CL"};case"codex":return{iconClass:"ic-codex",iconText:"CX"};case"repoburg":return{iconClass:"ic-repoburg",iconText:"RB"};case"cursor":return{iconClass:"ic-cursor",iconText:"CR"};default:return{iconClass:"ic-codex",iconText:"CX"}}}function h1(t,r,s=!1,i="working",l=0){if(i==="finished")return"";if(t==="interrupted")return"interrupted";if(r)return"running";if(l>0)return"background";if(s&&t!=="failed")return"queued";switch(t){case"failed":return"error";case"aborted":return"paused";default:return"paused"}}function m1(t,r,s=!1,i="working",l=0){if(i==="finished")return"Finished";if(t==="interrupted")return"Interrupted";if(r)return"Running";if(l>0)return"Background";if(s&&t!=="failed")return"Review Pending";switch(t){case"failed":return"Failed";case"aborted":return"Aborted";case"active":return"Idle";case"completed":return"Completed";case"running":return"Running";default:return t}}function zl(t,r=0){const s=t.is_running===1,i=t.lifecycle==="finished",l=nd(t.runtime_type),c=h1(t.status,s,t.has_unreviewed===1,t.lifecycle,r),d=m1(t.status,s,t.has_unreviewed===1,t.lifecycle,r);return{dot:c,label:d,dotTitle:c==="background"?`${r} background task${r===1?"":"s"} running`:d,iconClass:l.iconClass,iconText:l.iconText,isRunning:s,isFinished:i,backgroundTaskCount:r}}function Oi(t,r,s=!0){y.useEffect(()=>{if(!s)return;function i(l){t.current&&!t.current.contains(l.target)&&r()}return document.addEventListener("mousedown",i),document.addEventListener("touchstart",i),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("touchstart",i)}},[t,r,s])}function Eo(t,r=!0){y.useEffect(()=>{if(!r)return;function s(i){i.key==="Escape"&&t()}return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[t,r])}function Dd({status:t,size:r=6,title:s}){return a.jsx("span",{className:`status-dot ${t}`,style:r!==6?{width:r,height:r}:void 0,title:s})}function Md({iconClass:t,iconText:r,size:s=20}){return a.jsx("span",{className:`runtime-icon ${t}`,style:s!==20?{width:s,height:s,fontSize:s*.45}:void 0,children:r})}/**
51
+ * @license lucide-react v0.469.0 - ISC
52
+ *
53
+ * This source code is licensed under the ISC license.
54
+ * See the LICENSE file in the root directory of this source tree.
55
+ */const g1=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ev=(...t)=>t.filter((r,s,i)=>!!r&&r.trim()!==""&&i.indexOf(r)===s).join(" ").trim();/**
56
+ * @license lucide-react v0.469.0 - ISC
57
+ *
58
+ * This source code is licensed under the ISC license.
59
+ * See the LICENSE file in the root directory of this source tree.
60
+ */var v1={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
61
+ * @license lucide-react v0.469.0 - ISC
62
+ *
63
+ * This source code is licensed under the ISC license.
64
+ * See the LICENSE file in the root directory of this source tree.
65
+ */const tv=y.forwardRef(({color:t="currentColor",size:r=24,strokeWidth:s=2,absoluteStrokeWidth:i,className:l="",children:c,iconNode:d,...p},g)=>y.createElement("svg",{ref:g,...v1,width:r,height:r,stroke:t,strokeWidth:i?Number(s)*24/Number(r):s,className:ev("lucide",l),...p},[...d.map(([m,v])=>y.createElement(m,v)),...Array.isArray(c)?c:[c]]));/**
66
+ * @license lucide-react v0.469.0 - ISC
67
+ *
68
+ * This source code is licensed under the ISC license.
69
+ * See the LICENSE file in the root directory of this source tree.
70
+ */const ve=(t,r)=>{const s=y.forwardRef(({className:i,...l},c)=>y.createElement(tv,{ref:c,iconNode:r,className:ev(`lucide-${g1(t)}`,i),...l}));return s.displayName=`${t}`,s};/**
71
+ * @license lucide-react v0.469.0 - ISC
72
+ *
73
+ * This source code is licensed under the ISC license.
74
+ * See the LICENSE file in the root directory of this source tree.
75
+ */const y1=ve("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
76
+ * @license lucide-react v0.469.0 - ISC
77
+ *
78
+ * This source code is licensed under the ISC license.
79
+ * See the LICENSE file in the root directory of this source tree.
80
+ */const x1=ve("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
81
+ * @license lucide-react v0.469.0 - ISC
82
+ *
83
+ * This source code is licensed under the ISC license.
84
+ * See the LICENSE file in the root directory of this source tree.
85
+ */const nv=ve("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
86
+ * @license lucide-react v0.469.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ */const w1=ve("BotOff",[["path",{d:"M13.67 8H18a2 2 0 0 1 2 2v4.33",key:"7az073"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}],["path",{d:"M8 8H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 1.414-.586",key:"s09a7a"}],["path",{d:"M9 13v2",key:"rq6x2g"}],["path",{d:"M9.67 4H12v2.33",key:"110xot"}]]);/**
91
+ * @license lucide-react v0.469.0 - ISC
92
+ *
93
+ * This source code is licensed under the ISC license.
94
+ * See the LICENSE file in the root directory of this source tree.
95
+ */const ms=ve("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
96
+ * @license lucide-react v0.469.0 - ISC
97
+ *
98
+ * This source code is licensed under the ISC license.
99
+ * See the LICENSE file in the root directory of this source tree.
100
+ */const k1=ve("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
101
+ * @license lucide-react v0.469.0 - ISC
102
+ *
103
+ * This source code is licensed under the ISC license.
104
+ * See the LICENSE file in the root directory of this source tree.
105
+ */const Tr=ve("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
106
+ * @license lucide-react v0.469.0 - ISC
107
+ *
108
+ * This source code is licensed under the ISC license.
109
+ * See the LICENSE file in the root directory of this source tree.
110
+ */const No=ve("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
111
+ * @license lucide-react v0.469.0 - ISC
112
+ *
113
+ * This source code is licensed under the ISC license.
114
+ * See the LICENSE file in the root directory of this source tree.
115
+ */const _i=ve("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
116
+ * @license lucide-react v0.469.0 - ISC
117
+ *
118
+ * This source code is licensed under the ISC license.
119
+ * See the LICENSE file in the root directory of this source tree.
120
+ */const Fl=ve("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
121
+ * @license lucide-react v0.469.0 - ISC
122
+ *
123
+ * This source code is licensed under the ISC license.
124
+ * See the LICENSE file in the root directory of this source tree.
125
+ */const S1=ve("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
126
+ * @license lucide-react v0.469.0 - ISC
127
+ *
128
+ * This source code is licensed under the ISC license.
129
+ * See the LICENSE file in the root directory of this source tree.
130
+ */const xl=ve("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
131
+ * @license lucide-react v0.469.0 - ISC
132
+ *
133
+ * This source code is licensed under the ISC license.
134
+ * See the LICENSE file in the root directory of this source tree.
135
+ */const b1=ve("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
136
+ * @license lucide-react v0.469.0 - ISC
137
+ *
138
+ * This source code is licensed under the ISC license.
139
+ * See the LICENSE file in the root directory of this source tree.
140
+ */const N1=ve("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
141
+ * @license lucide-react v0.469.0 - ISC
142
+ *
143
+ * This source code is licensed under the ISC license.
144
+ * See the LICENSE file in the root directory of this source tree.
145
+ */const T1=ve("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
146
+ * @license lucide-react v0.469.0 - ISC
147
+ *
148
+ * This source code is licensed under the ISC license.
149
+ * See the LICENSE file in the root directory of this source tree.
150
+ */const rv=ve("Cog",[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]]);/**
151
+ * @license lucide-react v0.469.0 - ISC
152
+ *
153
+ * This source code is licensed under the ISC license.
154
+ * See the LICENSE file in the root directory of this source tree.
155
+ */const om=ve("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/**
156
+ * @license lucide-react v0.469.0 - ISC
157
+ *
158
+ * This source code is licensed under the ISC license.
159
+ * See the LICENSE file in the root directory of this source tree.
160
+ */const Ri=ve("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
161
+ * @license lucide-react v0.469.0 - ISC
162
+ *
163
+ * This source code is licensed under the ISC license.
164
+ * See the LICENSE file in the root directory of this source tree.
165
+ */const C1=ve("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
166
+ * @license lucide-react v0.469.0 - ISC
167
+ *
168
+ * This source code is licensed under the ISC license.
169
+ * See the LICENSE file in the root directory of this source tree.
170
+ */const E1=ve("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
171
+ * @license lucide-react v0.469.0 - ISC
172
+ *
173
+ * This source code is licensed under the ISC license.
174
+ * See the LICENSE file in the root directory of this source tree.
175
+ */const j1=ve("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/**
176
+ * @license lucide-react v0.469.0 - ISC
177
+ *
178
+ * This source code is licensed under the ISC license.
179
+ * See the LICENSE file in the root directory of this source tree.
180
+ */const sv=ve("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
181
+ * @license lucide-react v0.469.0 - ISC
182
+ *
183
+ * This source code is licensed under the ISC license.
184
+ * See the LICENSE file in the root directory of this source tree.
185
+ */const _1=ve("FolderGit2",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);/**
186
+ * @license lucide-react v0.469.0 - ISC
187
+ *
188
+ * This source code is licensed under the ISC license.
189
+ * See the LICENSE file in the root directory of this source tree.
190
+ */const R1=ve("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
191
+ * @license lucide-react v0.469.0 - ISC
192
+ *
193
+ * This source code is licensed under the ISC license.
194
+ * See the LICENSE file in the root directory of this source tree.
195
+ */const zu=ve("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
196
+ * @license lucide-react v0.469.0 - ISC
197
+ *
198
+ * This source code is licensed under the ISC license.
199
+ * See the LICENSE file in the root directory of this source tree.
200
+ */const wl=ve("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
201
+ * @license lucide-react v0.469.0 - ISC
202
+ *
203
+ * This source code is licensed under the ISC license.
204
+ * See the LICENSE file in the root directory of this source tree.
205
+ */const ov=ve("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
206
+ * @license lucide-react v0.469.0 - ISC
207
+ *
208
+ * This source code is licensed under the ISC license.
209
+ * See the LICENSE file in the root directory of this source tree.
210
+ */const iv=ve("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
211
+ * @license lucide-react v0.469.0 - ISC
212
+ *
213
+ * This source code is licensed under the ISC license.
214
+ * See the LICENSE file in the root directory of this source tree.
215
+ */const av=ve("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);/**
216
+ * @license lucide-react v0.469.0 - ISC
217
+ *
218
+ * This source code is licensed under the ISC license.
219
+ * See the LICENSE file in the root directory of this source tree.
220
+ */const A1=ve("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
221
+ * @license lucide-react v0.469.0 - ISC
222
+ *
223
+ * This source code is licensed under the ISC license.
224
+ * See the LICENSE file in the root directory of this source tree.
225
+ */const I1=ve("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
226
+ * @license lucide-react v0.469.0 - ISC
227
+ *
228
+ * This source code is licensed under the ISC license.
229
+ * See the LICENSE file in the root directory of this source tree.
230
+ */const D1=ve("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/**
231
+ * @license lucide-react v0.469.0 - ISC
232
+ *
233
+ * This source code is licensed under the ISC license.
234
+ * See the LICENSE file in the root directory of this source tree.
235
+ */const lv=ve("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
236
+ * @license lucide-react v0.469.0 - ISC
237
+ *
238
+ * This source code is licensed under the ISC license.
239
+ * See the LICENSE file in the root directory of this source tree.
240
+ */const M1=ve("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
241
+ * @license lucide-react v0.469.0 - ISC
242
+ *
243
+ * This source code is licensed under the ISC license.
244
+ * See the LICENSE file in the root directory of this source tree.
245
+ */const L1=ve("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
246
+ * @license lucide-react v0.469.0 - ISC
247
+ *
248
+ * This source code is licensed under the ISC license.
249
+ * See the LICENSE file in the root directory of this source tree.
250
+ */const O1=ve("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
251
+ * @license lucide-react v0.469.0 - ISC
252
+ *
253
+ * This source code is licensed under the ISC license.
254
+ * See the LICENSE file in the root directory of this source tree.
255
+ */const P1=ve("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
256
+ * @license lucide-react v0.469.0 - ISC
257
+ *
258
+ * This source code is licensed under the ISC license.
259
+ * See the LICENSE file in the root directory of this source tree.
260
+ */const hn=ve("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
261
+ * @license lucide-react v0.469.0 - ISC
262
+ *
263
+ * This source code is licensed under the ISC license.
264
+ * See the LICENSE file in the root directory of this source tree.
265
+ */const $1=ve("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
266
+ * @license lucide-react v0.469.0 - ISC
267
+ *
268
+ * This source code is licensed under the ISC license.
269
+ * See the LICENSE file in the root directory of this source tree.
270
+ */const z1=ve("MessageSquarePlus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/**
271
+ * @license lucide-react v0.469.0 - ISC
272
+ *
273
+ * This source code is licensed under the ISC license.
274
+ * See the LICENSE file in the root directory of this source tree.
275
+ */const cv=ve("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
276
+ * @license lucide-react v0.469.0 - ISC
277
+ *
278
+ * This source code is licensed under the ISC license.
279
+ * See the LICENSE file in the root directory of this source tree.
280
+ */const F1=ve("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
281
+ * @license lucide-react v0.469.0 - ISC
282
+ *
283
+ * This source code is licensed under the ISC license.
284
+ * See the LICENSE file in the root directory of this source tree.
285
+ */const im=ve("MonitorSmartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]);/**
286
+ * @license lucide-react v0.469.0 - ISC
287
+ *
288
+ * This source code is licensed under the ISC license.
289
+ * See the LICENSE file in the root directory of this source tree.
290
+ */const U1=ve("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/**
291
+ * @license lucide-react v0.469.0 - ISC
292
+ *
293
+ * This source code is licensed under the ISC license.
294
+ * See the LICENSE file in the root directory of this source tree.
295
+ */const B1=ve("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);/**
296
+ * @license lucide-react v0.469.0 - ISC
297
+ *
298
+ * This source code is licensed under the ISC license.
299
+ * See the LICENSE file in the root directory of this source tree.
300
+ */const W1=ve("PanelRightOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);/**
301
+ * @license lucide-react v0.469.0 - ISC
302
+ *
303
+ * This source code is licensed under the ISC license.
304
+ * See the LICENSE file in the root directory of this source tree.
305
+ */const H1=ve("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
306
+ * @license lucide-react v0.469.0 - ISC
307
+ *
308
+ * This source code is licensed under the ISC license.
309
+ * See the LICENSE file in the root directory of this source tree.
310
+ */const V1=ve("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/**
311
+ * @license lucide-react v0.469.0 - ISC
312
+ *
313
+ * This source code is licensed under the ISC license.
314
+ * See the LICENSE file in the root directory of this source tree.
315
+ */const ll=ve("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
316
+ * @license lucide-react v0.469.0 - ISC
317
+ *
318
+ * This source code is licensed under the ISC license.
319
+ * See the LICENSE file in the root directory of this source tree.
320
+ */const K1=ve("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
321
+ * @license lucide-react v0.469.0 - ISC
322
+ *
323
+ * This source code is licensed under the ISC license.
324
+ * See the LICENSE file in the root directory of this source tree.
325
+ */const G1=ve("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
326
+ * @license lucide-react v0.469.0 - ISC
327
+ *
328
+ * This source code is licensed under the ISC license.
329
+ * See the LICENSE file in the root directory of this source tree.
330
+ */const fs=ve("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
331
+ * @license lucide-react v0.469.0 - ISC
332
+ *
333
+ * This source code is licensed under the ISC license.
334
+ * See the LICENSE file in the root directory of this source tree.
335
+ */const uv=ve("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/**
336
+ * @license lucide-react v0.469.0 - ISC
337
+ *
338
+ * This source code is licensed under the ISC license.
339
+ * See the LICENSE file in the root directory of this source tree.
340
+ */const q1=ve("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
341
+ * @license lucide-react v0.469.0 - ISC
342
+ *
343
+ * This source code is licensed under the ISC license.
344
+ * See the LICENSE file in the root directory of this source tree.
345
+ */const X1=ve("Rewind",[["polygon",{points:"11 19 2 12 11 5 11 19",key:"14yba5"}],["polygon",{points:"22 19 13 12 22 5 22 19",key:"1pi1cj"}]]);/**
346
+ * @license lucide-react v0.469.0 - ISC
347
+ *
348
+ * This source code is licensed under the ISC license.
349
+ * See the LICENSE file in the root directory of this source tree.
350
+ */const Ai=ve("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
351
+ * @license lucide-react v0.469.0 - ISC
352
+ *
353
+ * This source code is licensed under the ISC license.
354
+ * See the LICENSE file in the root directory of this source tree.
355
+ */const dv=ve("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
356
+ * @license lucide-react v0.469.0 - ISC
357
+ *
358
+ * This source code is licensed under the ISC license.
359
+ * See the LICENSE file in the root directory of this source tree.
360
+ */const fv=ve("SatelliteDish",[["path",{d:"M4 10a7.31 7.31 0 0 0 10 10Z",key:"1fzpp3"}],["path",{d:"m9 15 3-3",key:"88sc13"}],["path",{d:"M17 13a6 6 0 0 0-6-6",key:"15cc6u"}],["path",{d:"M21 13A10 10 0 0 0 11 3",key:"11nf8s"}]]);/**
361
+ * @license lucide-react v0.469.0 - ISC
362
+ *
363
+ * This source code is licensed under the ISC license.
364
+ * See the LICENSE file in the root directory of this source tree.
365
+ */const Y1=ve("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
366
+ * @license lucide-react v0.469.0 - ISC
367
+ *
368
+ * This source code is licensed under the ISC license.
369
+ * See the LICENSE file in the root directory of this source tree.
370
+ */const Pi=ve("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
371
+ * @license lucide-react v0.469.0 - ISC
372
+ *
373
+ * This source code is licensed under the ISC license.
374
+ * See the LICENSE file in the root directory of this source tree.
375
+ */const Q1=ve("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"}]]);/**
376
+ * @license lucide-react v0.469.0 - ISC
377
+ *
378
+ * This source code is licensed under the ISC license.
379
+ * See the LICENSE file in the root directory of this source tree.
380
+ */const Z1=ve("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"}]]);/**
381
+ * @license lucide-react v0.469.0 - ISC
382
+ *
383
+ * This source code is licensed under the ISC license.
384
+ * See the LICENSE file in the root directory of this source tree.
385
+ */const pv=ve("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"}]]);/**
386
+ * @license lucide-react v0.469.0 - ISC
387
+ *
388
+ * This source code is licensed under the ISC license.
389
+ * See the LICENSE file in the root directory of this source tree.
390
+ */const Fs=ve("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
391
+ * @license lucide-react v0.469.0 - ISC
392
+ *
393
+ * This source code is licensed under the ISC license.
394
+ * See the LICENSE file in the root directory of this source tree.
395
+ */const kl=ve("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"}]]);/**
396
+ * @license lucide-react v0.469.0 - ISC
397
+ *
398
+ * This source code is licensed under the ISC license.
399
+ * See the LICENSE file in the root directory of this source tree.
400
+ */const hv=ve("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
401
+ * @license lucide-react v0.469.0 - ISC
402
+ *
403
+ * This source code is licensed under the ISC license.
404
+ * See the LICENSE file in the root directory of this source tree.
405
+ */const ur=ve("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"}]]);/**
406
+ * @license lucide-react v0.469.0 - ISC
407
+ *
408
+ * This source code is licensed under the ISC license.
409
+ * See the LICENSE file in the root directory of this source tree.
410
+ */const mv=ve("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
411
+ * @license lucide-react v0.469.0 - ISC
412
+ *
413
+ * This source code is licensed under the ISC license.
414
+ * See the LICENSE file in the root directory of this source tree.
415
+ */const J1=ve("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"}]]);/**
416
+ * @license lucide-react v0.469.0 - ISC
417
+ *
418
+ * This source code is licensed under the ISC license.
419
+ * See the LICENSE file in the root directory of this source tree.
420
+ */const ek=ve("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
421
+ * @license lucide-react v0.469.0 - ISC
422
+ *
423
+ * This source code is licensed under the ISC license.
424
+ * See the LICENSE file in the root directory of this source tree.
425
+ */const tk=ve("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
426
+ * @license lucide-react v0.469.0 - ISC
427
+ *
428
+ * This source code is licensed under the ISC license.
429
+ * See the LICENSE file in the root directory of this source tree.
430
+ */const gv=ve("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"}]]);/**
431
+ * @license lucide-react v0.469.0 - ISC
432
+ *
433
+ * This source code is licensed under the ISC license.
434
+ * See the LICENSE file in the root directory of this source tree.
435
+ */const nk=ve("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"}]]);/**
436
+ * @license lucide-react v0.469.0 - ISC
437
+ *
438
+ * This source code is licensed under the ISC license.
439
+ * See the LICENSE file in the root directory of this source tree.
440
+ */const Nn=ve("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
441
+ * @license lucide-react v0.469.0 - ISC
442
+ *
443
+ * This source code is licensed under the ISC license.
444
+ * See the LICENSE file in the root directory of this source tree.
445
+ */const rk=ve("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"}]]),sk=new Set(["path","circle","rect","line","ellipse","polyline","polygon"]),ok=new Set("d cx cy r rx ry x y width height x1 x2 y1 y2 points fill".split(" "));function ik(t){return t.filter(([r])=>sk.has(r)).map(([r,s],i)=>[r,{...Object.fromEntries(Object.entries(s).filter(([l])=>ok.has(l))),key:String(i)}])}function jo({iconNode:t,size:r=14,className:s}){const i=y.useMemo(()=>t?ik(t):[],[t]);return i.length===0?a.jsx(lv,{size:r,className:s,"aria-hidden":"true","data-testid":"app-icon-default"}):a.jsx(tv,{iconNode:i,size:r,className:s,"aria-hidden":"true","data-testid":"app-icon"})}var yi=Cg();function ak(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return y.useMemo(()=>i=>{r.forEach(l=>l(i))},r)}const Ul=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function _o(t){const r=Object.prototype.toString.call(t);return r==="[object Window]"||r==="[object global]"}function Ld(t){return"nodeType"in t}function Tn(t){var r,s;return t?_o(t)?t:Ld(t)&&(r=(s=t.ownerDocument)==null?void 0:s.defaultView)!=null?r:window:window}function Od(t){const{Document:r}=Tn(t);return t instanceof r}function $i(t){return _o(t)?!1:t instanceof Tn(t).HTMLElement}function vv(t){return t instanceof Tn(t).SVGElement}function Ro(t){return t?_o(t)?t.document:Ld(t)?Od(t)?t:$i(t)||vv(t)?t.ownerDocument:document:document:document}const fr=Ul?y.useLayoutEffect:y.useEffect;function Bl(t){const r=y.useRef(t);return fr(()=>{r.current=t}),y.useCallback(function(){for(var s=arguments.length,i=new Array(s),l=0;l<s;l++)i[l]=arguments[l];return r.current==null?void 0:r.current(...i)},[])}function lk(){const t=y.useRef(null),r=y.useCallback((i,l)=>{t.current=setInterval(i,l)},[]),s=y.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[r,s]}function Ii(t,r){r===void 0&&(r=[t]);const s=y.useRef(t);return fr(()=>{s.current!==t&&(s.current=t)},r),s}function zi(t,r){const s=y.useRef();return y.useMemo(()=>{const i=t(s.current);return s.current=i,i},[...r])}function Sl(t){const r=Bl(t),s=y.useRef(null),i=y.useCallback(l=>{l!==s.current&&(r==null||r(l,s.current)),s.current=l},[]);return[s,i]}function bl(t){const r=y.useRef();return y.useEffect(()=>{r.current=t},[t]),r.current}let Fu={};function Fi(t,r){return y.useMemo(()=>{if(r)return r;const s=Fu[t]==null?0:Fu[t]+1;return Fu[t]=s,t+"-"+s},[t,r])}function yv(t){return function(r){for(var s=arguments.length,i=new Array(s>1?s-1:0),l=1;l<s;l++)i[l-1]=arguments[l];return i.reduce((c,d)=>{const p=Object.entries(d);for(const[g,m]of p){const v=c[g];v!=null&&(c[g]=v+t*m)}return c},{...r})}}const To=yv(1),Nl=yv(-1);function ck(t){return"clientX"in t&&"clientY"in t}function Wl(t){if(!t)return!1;const{KeyboardEvent:r}=Tn(t.target);return r&&t instanceof r}function uk(t){if(!t)return!1;const{TouchEvent:r}=Tn(t.target);return r&&t instanceof r}function Tl(t){if(uk(t)){if(t.touches&&t.touches.length){const{clientX:r,clientY:s}=t.touches[0];return{x:r,y:s}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:r,clientY:s}=t.changedTouches[0];return{x:r,y:s}}}return ck(t)?{x:t.clientX,y:t.clientY}:null}const Cr=Object.freeze({Translate:{toString(t){if(!t)return;const{x:r,y:s}=t;return"translate3d("+(r?Math.round(r):0)+"px, "+(s?Math.round(s):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:r,scaleY:s}=t;return"scaleX("+r+") scaleY("+s+")"}},Transform:{toString(t){if(t)return[Cr.Translate.toString(t),Cr.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:r,duration:s,easing:i}=t;return r+" "+s+"ms "+i}}}),am="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function dk(t){return t.matches(am)?t:t.querySelector(am)}const fk={display:"none"};function pk(t){let{id:r,value:s}=t;return lt.createElement("div",{id:r,style:fk},s)}function hk(t){let{id:r,announcement:s,ariaLiveType:i="assertive"}=t;const l={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return lt.createElement("div",{id:r,style:l,role:"status","aria-live":i,"aria-atomic":!0},s)}function mk(){const[t,r]=y.useState("");return{announce:y.useCallback(i=>{i!=null&&r(i)},[]),announcement:t}}const xv=y.createContext(null);function gk(t){const r=y.useContext(xv);y.useEffect(()=>{if(!r)throw new Error("useDndMonitor must be used within a children of <DndContext>");return r(t)},[t,r])}function vk(){const[t]=y.useState(()=>new Set),r=y.useCallback(i=>(t.add(i),()=>t.delete(i)),[t]);return[y.useCallback(i=>{let{type:l,event:c}=i;t.forEach(d=>{var p;return(p=d[l])==null?void 0:p.call(d,c)})},[t]),r]}const yk={draggable:`
446
+ To pick up a draggable item, press the space bar.
447
+ While dragging, use the arrow keys to move the item.
448
+ Press space again to drop the item in its new position, or press escape to cancel.
449
+ `},xk={onDragStart(t){let{active:r}=t;return"Picked up draggable item "+r.id+"."},onDragOver(t){let{active:r,over:s}=t;return s?"Draggable item "+r.id+" was moved over droppable area "+s.id+".":"Draggable item "+r.id+" is no longer over a droppable area."},onDragEnd(t){let{active:r,over:s}=t;return s?"Draggable item "+r.id+" was dropped over droppable area "+s.id:"Draggable item "+r.id+" was dropped."},onDragCancel(t){let{active:r}=t;return"Dragging was cancelled. Draggable item "+r.id+" was dropped."}};function wk(t){let{announcements:r=xk,container:s,hiddenTextDescribedById:i,screenReaderInstructions:l=yk}=t;const{announce:c,announcement:d}=mk(),p=Fi("DndLiveRegion"),[g,m]=y.useState(!1);if(y.useEffect(()=>{m(!0)},[]),gk(y.useMemo(()=>({onDragStart(k){let{active:x}=k;c(r.onDragStart({active:x}))},onDragMove(k){let{active:x,over:S}=k;r.onDragMove&&c(r.onDragMove({active:x,over:S}))},onDragOver(k){let{active:x,over:S}=k;c(r.onDragOver({active:x,over:S}))},onDragEnd(k){let{active:x,over:S}=k;c(r.onDragEnd({active:x,over:S}))},onDragCancel(k){let{active:x,over:S}=k;c(r.onDragCancel({active:x,over:S}))}}),[c,r])),!g)return null;const v=lt.createElement(lt.Fragment,null,lt.createElement(pk,{id:i,value:l.draggable}),lt.createElement(hk,{id:p,announcement:d}));return s?yi.createPortal(v,s):v}var Wt;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Wt||(Wt={}));function Cl(){}function wv(t,r){return y.useMemo(()=>({sensor:t,options:r??{}}),[t,r])}function kv(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return y.useMemo(()=>[...r].filter(i=>i!=null),[...r])}const pr=Object.freeze({x:0,y:0});function kk(t,r){return Math.sqrt(Math.pow(t.x-r.x,2)+Math.pow(t.y-r.y,2))}function Sk(t,r){const s=Tl(t);if(!s)return"0 0";const i={x:(s.x-r.left)/r.width*100,y:(s.y-r.top)/r.height*100};return i.x+"% "+i.y+"%"}function bk(t,r){let{data:{value:s}}=t,{data:{value:i}}=r;return s-i}function Nk(t,r){let{data:{value:s}}=t,{data:{value:i}}=r;return i-s}function Tk(t,r){if(!t||t.length===0)return null;const[s]=t;return s[r]}function lm(t,r,s){return r===void 0&&(r=t.left),s===void 0&&(s=t.top),{x:r+t.width*.5,y:s+t.height*.5}}const Sv=t=>{let{collisionRect:r,droppableRects:s,droppableContainers:i}=t;const l=lm(r,r.left,r.top),c=[];for(const d of i){const{id:p}=d,g=s.get(p);if(g){const m=kk(lm(g),l);c.push({id:p,data:{droppableContainer:d,value:m}})}}return c.sort(bk)};function Ck(t,r){const s=Math.max(r.top,t.top),i=Math.max(r.left,t.left),l=Math.min(r.left+r.width,t.left+t.width),c=Math.min(r.top+r.height,t.top+t.height),d=l-i,p=c-s;if(i<l&&s<c){const g=r.width*r.height,m=t.width*t.height,v=d*p,k=v/(g+m-v);return Number(k.toFixed(4))}return 0}const Ek=t=>{let{collisionRect:r,droppableRects:s,droppableContainers:i}=t;const l=[];for(const c of i){const{id:d}=c,p=s.get(d);if(p){const g=Ck(p,r);g>0&&l.push({id:d,data:{droppableContainer:c,value:g}})}}return l.sort(Nk)};function jk(t,r,s){return{...t,scaleX:r&&s?r.width/s.width:1,scaleY:r&&s?r.height/s.height:1}}function bv(t,r){return t&&r?{x:t.left-r.left,y:t.top-r.top}:pr}function _k(t){return function(s){for(var i=arguments.length,l=new Array(i>1?i-1:0),c=1;c<i;c++)l[c-1]=arguments[c];return l.reduce((d,p)=>({...d,top:d.top+t*p.y,bottom:d.bottom+t*p.y,left:d.left+t*p.x,right:d.right+t*p.x}),{...s})}}const Rk=_k(1);function Nv(t){if(t.startsWith("matrix3d(")){const r=t.slice(9,-1).split(/, /);return{x:+r[12],y:+r[13],scaleX:+r[0],scaleY:+r[5]}}else if(t.startsWith("matrix(")){const r=t.slice(7,-1).split(/, /);return{x:+r[4],y:+r[5],scaleX:+r[0],scaleY:+r[3]}}return null}function Ak(t,r,s){const i=Nv(r);if(!i)return t;const{scaleX:l,scaleY:c,x:d,y:p}=i,g=t.left-d-(1-l)*parseFloat(s),m=t.top-p-(1-c)*parseFloat(s.slice(s.indexOf(" ")+1)),v=l?t.width/l:t.width,k=c?t.height/c:t.height;return{width:v,height:k,top:m,right:g+v,bottom:m+k,left:g}}const Ik={ignoreTransform:!1};function Ao(t,r){r===void 0&&(r=Ik);let s=t.getBoundingClientRect();if(r.ignoreTransform){const{transform:m,transformOrigin:v}=Tn(t).getComputedStyle(t);m&&(s=Ak(s,m,v))}const{top:i,left:l,width:c,height:d,bottom:p,right:g}=s;return{top:i,left:l,width:c,height:d,bottom:p,right:g}}function cm(t){return Ao(t,{ignoreTransform:!0})}function Dk(t){const r=t.innerWidth,s=t.innerHeight;return{top:0,left:0,right:r,bottom:s,width:r,height:s}}function Mk(t,r){return r===void 0&&(r=Tn(t).getComputedStyle(t)),r.position==="fixed"}function Lk(t,r){r===void 0&&(r=Tn(t).getComputedStyle(t));const s=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(l=>{const c=r[l];return typeof c=="string"?s.test(c):!1})}function Pd(t,r){const s=[];function i(l){if(r!=null&&s.length>=r||!l)return s;if(Od(l)&&l.scrollingElement!=null&&!s.includes(l.scrollingElement))return s.push(l.scrollingElement),s;if(!$i(l)||vv(l)||s.includes(l))return s;const c=Tn(t).getComputedStyle(l);return l!==t&&Lk(l,c)&&s.push(l),Mk(l,c)?s:i(l.parentNode)}return t?i(t):s}function Tv(t){const[r]=Pd(t,1);return r??null}function Uu(t){return!Ul||!t?null:_o(t)?t:Ld(t)?Od(t)||t===Ro(t).scrollingElement?window:$i(t)?t:null:null}function Cv(t){return _o(t)?t.scrollX:t.scrollLeft}function Ev(t){return _o(t)?t.scrollY:t.scrollTop}function rd(t){return{x:Cv(t),y:Ev(t)}}var Jt;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Jt||(Jt={}));function jv(t){return!Ul||!t?!1:t===document.scrollingElement}function _v(t){const r={x:0,y:0},s=jv(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},i={x:t.scrollWidth-s.width,y:t.scrollHeight-s.height},l=t.scrollTop<=r.y,c=t.scrollLeft<=r.x,d=t.scrollTop>=i.y,p=t.scrollLeft>=i.x;return{isTop:l,isLeft:c,isBottom:d,isRight:p,maxScroll:i,minScroll:r}}const Ok={x:.2,y:.2};function Pk(t,r,s,i,l){let{top:c,left:d,right:p,bottom:g}=s;i===void 0&&(i=10),l===void 0&&(l=Ok);const{isTop:m,isBottom:v,isLeft:k,isRight:x}=_v(t),S={x:0,y:0},N={x:0,y:0},C={height:r.height*l.y,width:r.width*l.x};return!m&&c<=r.top+C.height?(S.y=Jt.Backward,N.y=i*Math.abs((r.top+C.height-c)/C.height)):!v&&g>=r.bottom-C.height&&(S.y=Jt.Forward,N.y=i*Math.abs((r.bottom-C.height-g)/C.height)),!x&&p>=r.right-C.width?(S.x=Jt.Forward,N.x=i*Math.abs((r.right-C.width-p)/C.width)):!k&&d<=r.left+C.width&&(S.x=Jt.Backward,N.x=i*Math.abs((r.left+C.width-d)/C.width)),{direction:S,speed:N}}function $k(t){if(t===document.scrollingElement){const{innerWidth:c,innerHeight:d}=window;return{top:0,left:0,right:c,bottom:d,width:c,height:d}}const{top:r,left:s,right:i,bottom:l}=t.getBoundingClientRect();return{top:r,left:s,right:i,bottom:l,width:t.clientWidth,height:t.clientHeight}}function Rv(t){return t.reduce((r,s)=>To(r,rd(s)),pr)}function zk(t){return t.reduce((r,s)=>r+Cv(s),0)}function Fk(t){return t.reduce((r,s)=>r+Ev(s),0)}function Av(t,r){if(r===void 0&&(r=Ao),!t)return;const{top:s,left:i,bottom:l,right:c}=r(t);Tv(t)&&(l<=0||c<=0||s>=window.innerHeight||i>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const Uk=[["x",["left","right"],zk],["y",["top","bottom"],Fk]];class $d{constructor(r,s){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 i=Pd(s),l=Rv(i);this.rect={...r},this.width=r.width,this.height=r.height;for(const[c,d,p]of Uk)for(const g of d)Object.defineProperty(this,g,{get:()=>{const m=p(i),v=l[c]-m;return this.rect[g]+v},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ki{constructor(r){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(s=>{var i;return(i=this.target)==null?void 0:i.removeEventListener(...s)})},this.target=r}add(r,s,i){var l;(l=this.target)==null||l.addEventListener(r,s,i),this.listeners.push([r,s,i])}}function Bk(t){const{EventTarget:r}=Tn(t);return t instanceof r?t:Ro(t)}function Bu(t,r){const s=Math.abs(t.x),i=Math.abs(t.y);return typeof r=="number"?Math.sqrt(s**2+i**2)>r:"x"in r&&"y"in r?s>r.x&&i>r.y:"x"in r?s>r.x:"y"in r?i>r.y:!1}var er;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(er||(er={}));function um(t){t.preventDefault()}function Wk(t){t.stopPropagation()}var tt;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(tt||(tt={}));const Iv={start:[tt.Space,tt.Enter],cancel:[tt.Esc],end:[tt.Space,tt.Enter,tt.Tab]},Hk=(t,r)=>{let{currentCoordinates:s}=r;switch(t.code){case tt.Right:return{...s,x:s.x+25};case tt.Left:return{...s,x:s.x-25};case tt.Down:return{...s,y:s.y+25};case tt.Up:return{...s,y:s.y-25}}};class Dv{constructor(r){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=r;const{event:{target:s}}=r;this.props=r,this.listeners=new ki(Ro(s)),this.windowListeners=new ki(Tn(s)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(er.Resize,this.handleCancel),this.windowListeners.add(er.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(er.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:r,onStart:s}=this.props,i=r.node.current;i&&Av(i),s(pr)}handleKeyDown(r){if(Wl(r)){const{active:s,context:i,options:l}=this.props,{keyboardCodes:c=Iv,coordinateGetter:d=Hk,scrollBehavior:p="smooth"}=l,{code:g}=r;if(c.end.includes(g)){this.handleEnd(r);return}if(c.cancel.includes(g)){this.handleCancel(r);return}const{collisionRect:m}=i.current,v=m?{x:m.left,y:m.top}:pr;this.referenceCoordinates||(this.referenceCoordinates=v);const k=d(r,{active:s,context:i.current,currentCoordinates:v});if(k){const x=Nl(k,v),S={x:0,y:0},{scrollableAncestors:N}=i.current;for(const C of N){const T=r.code,{isTop:j,isRight:E,isLeft:H,isBottom:I,maxScroll:L,minScroll:q}=_v(C),K=$k(C),$={x:Math.min(T===tt.Right?K.right-K.width/2:K.right,Math.max(T===tt.Right?K.left:K.left+K.width/2,k.x)),y:Math.min(T===tt.Down?K.bottom-K.height/2:K.bottom,Math.max(T===tt.Down?K.top:K.top+K.height/2,k.y))},te=T===tt.Right&&!E||T===tt.Left&&!H,me=T===tt.Down&&!I||T===tt.Up&&!j;if(te&&$.x!==k.x){const ue=C.scrollLeft+x.x,ye=T===tt.Right&&ue<=L.x||T===tt.Left&&ue>=q.x;if(ye&&!x.y){C.scrollTo({left:ue,behavior:p});return}ye?S.x=C.scrollLeft-ue:S.x=T===tt.Right?C.scrollLeft-L.x:C.scrollLeft-q.x,S.x&&C.scrollBy({left:-S.x,behavior:p});break}else if(me&&$.y!==k.y){const ue=C.scrollTop+x.y,ye=T===tt.Down&&ue<=L.y||T===tt.Up&&ue>=q.y;if(ye&&!x.x){C.scrollTo({top:ue,behavior:p});return}ye?S.y=C.scrollTop-ue:S.y=T===tt.Down?C.scrollTop-L.y:C.scrollTop-q.y,S.y&&C.scrollBy({top:-S.y,behavior:p});break}}this.handleMove(r,To(Nl(k,this.referenceCoordinates),S))}}}handleMove(r,s){const{onMove:i}=this.props;r.preventDefault(),i(s)}handleEnd(r){const{onEnd:s}=this.props;r.preventDefault(),this.detach(),s()}handleCancel(r){const{onCancel:s}=this.props;r.preventDefault(),this.detach(),s()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Dv.activators=[{eventName:"onKeyDown",handler:(t,r,s)=>{let{keyboardCodes:i=Iv,onActivation:l}=r,{active:c}=s;const{code:d}=t.nativeEvent;if(i.start.includes(d)){const p=c.activatorNode.current;return p&&t.target!==p?!1:(t.preventDefault(),l==null||l({event:t.nativeEvent}),!0)}return!1}}];function dm(t){return!!(t&&"distance"in t)}function fm(t){return!!(t&&"delay"in t)}class zd{constructor(r,s,i){var l;i===void 0&&(i=Bk(r.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=r,this.events=s;const{event:c}=r,{target:d}=c;this.props=r,this.events=s,this.document=Ro(d),this.documentListeners=new ki(this.document),this.listeners=new ki(i),this.windowListeners=new ki(Tn(d)),this.initialCoordinates=(l=Tl(c))!=null?l:pr,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:r,props:{options:{activationConstraint:s,bypassActivationConstraint:i}}}=this;if(this.listeners.add(r.move.name,this.handleMove,{passive:!1}),this.listeners.add(r.end.name,this.handleEnd),r.cancel&&this.listeners.add(r.cancel.name,this.handleCancel),this.windowListeners.add(er.Resize,this.handleCancel),this.windowListeners.add(er.DragStart,um),this.windowListeners.add(er.VisibilityChange,this.handleCancel),this.windowListeners.add(er.ContextMenu,um),this.documentListeners.add(er.Keydown,this.handleKeydown),s){if(i!=null&&i({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(fm(s)){this.timeoutId=setTimeout(this.handleStart,s.delay),this.handlePending(s);return}if(dm(s)){this.handlePending(s);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(r,s){const{active:i,onPending:l}=this.props;l(i,r,this.initialCoordinates,s)}handleStart(){const{initialCoordinates:r}=this,{onStart:s}=this.props;r&&(this.activated=!0,this.documentListeners.add(er.Click,Wk,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(er.SelectionChange,this.removeTextSelection),s(r))}handleMove(r){var s;const{activated:i,initialCoordinates:l,props:c}=this,{onMove:d,options:{activationConstraint:p}}=c;if(!l)return;const g=(s=Tl(r))!=null?s:pr,m=Nl(l,g);if(!i&&p){if(dm(p)){if(p.tolerance!=null&&Bu(m,p.tolerance))return this.handleCancel();if(Bu(m,p.distance))return this.handleStart()}if(fm(p)&&Bu(m,p.tolerance))return this.handleCancel();this.handlePending(p,m);return}r.cancelable&&r.preventDefault(),d(g)}handleEnd(){const{onAbort:r,onEnd:s}=this.props;this.detach(),this.activated||r(this.props.active),s()}handleCancel(){const{onAbort:r,onCancel:s}=this.props;this.detach(),this.activated||r(this.props.active),s()}handleKeydown(r){r.code===tt.Esc&&this.handleCancel()}removeTextSelection(){var r;(r=this.document.getSelection())==null||r.removeAllRanges()}}const Vk={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Hl extends zd{constructor(r){const{event:s}=r,i=Ro(s.target);super(r,Vk,i)}}Hl.activators=[{eventName:"onPointerDown",handler:(t,r)=>{let{nativeEvent:s}=t,{onActivation:i}=r;return!s.isPrimary||s.button!==0?!1:(i==null||i({event:s}),!0)}}];const Kk={move:{name:"mousemove"},end:{name:"mouseup"}};var sd;(function(t){t[t.RightClick=2]="RightClick"})(sd||(sd={}));class Gk extends zd{constructor(r){super(r,Kk,Ro(r.event.target))}}Gk.activators=[{eventName:"onMouseDown",handler:(t,r)=>{let{nativeEvent:s}=t,{onActivation:i}=r;return s.button===sd.RightClick?!1:(i==null||i({event:s}),!0)}}];const Wu={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class qk extends zd{constructor(r){super(r,Wu)}static setup(){return window.addEventListener(Wu.move.name,r,{capture:!1,passive:!1}),function(){window.removeEventListener(Wu.move.name,r)};function r(){}}}qk.activators=[{eventName:"onTouchStart",handler:(t,r)=>{let{nativeEvent:s}=t,{onActivation:i}=r;const{touches:l}=s;return l.length>1?!1:(i==null||i({event:s}),!0)}}];var Si;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Si||(Si={}));var El;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(El||(El={}));function Xk(t){let{acceleration:r,activator:s=Si.Pointer,canScroll:i,draggingRect:l,enabled:c,interval:d=5,order:p=El.TreeOrder,pointerCoordinates:g,scrollableAncestors:m,scrollableAncestorRects:v,delta:k,threshold:x}=t;const S=Qk({delta:k,disabled:!c}),[N,C]=lk(),T=y.useRef({x:0,y:0}),j=y.useRef({x:0,y:0}),E=y.useMemo(()=>{switch(s){case Si.Pointer:return g?{top:g.y,bottom:g.y,left:g.x,right:g.x}:null;case Si.DraggableRect:return l}},[s,l,g]),H=y.useRef(null),I=y.useCallback(()=>{const q=H.current;if(!q)return;const K=T.current.x*j.current.x,$=T.current.y*j.current.y;q.scrollBy(K,$)},[]),L=y.useMemo(()=>p===El.TreeOrder?[...m].reverse():m,[p,m]);y.useEffect(()=>{if(!c||!m.length||!E){C();return}for(const q of L){if((i==null?void 0:i(q))===!1)continue;const K=m.indexOf(q),$=v[K];if(!$)continue;const{direction:te,speed:me}=Pk(q,$,E,r,x);for(const ue of["x","y"])S[ue][te[ue]]||(me[ue]=0,te[ue]=0);if(me.x>0||me.y>0){C(),H.current=q,N(I,d),T.current=me,j.current=te;return}}T.current={x:0,y:0},j.current={x:0,y:0},C()},[r,I,i,C,c,d,JSON.stringify(E),JSON.stringify(S),N,m,L,v,JSON.stringify(x)])}const Yk={x:{[Jt.Backward]:!1,[Jt.Forward]:!1},y:{[Jt.Backward]:!1,[Jt.Forward]:!1}};function Qk(t){let{delta:r,disabled:s}=t;const i=bl(r);return zi(l=>{if(s||!i||!l)return Yk;const c={x:Math.sign(r.x-i.x),y:Math.sign(r.y-i.y)};return{x:{[Jt.Backward]:l.x[Jt.Backward]||c.x===-1,[Jt.Forward]:l.x[Jt.Forward]||c.x===1},y:{[Jt.Backward]:l.y[Jt.Backward]||c.y===-1,[Jt.Forward]:l.y[Jt.Forward]||c.y===1}}},[s,r,i])}function Zk(t,r){const s=r!=null?t.get(r):void 0,i=s?s.node.current:null;return zi(l=>{var c;return r==null?null:(c=i??l)!=null?c:null},[i,r])}function Jk(t,r){return y.useMemo(()=>t.reduce((s,i)=>{const{sensor:l}=i,c=l.activators.map(d=>({eventName:d.eventName,handler:r(d.handler,i)}));return[...s,...c]},[]),[t,r])}var Di;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Di||(Di={}));var od;(function(t){t.Optimized="optimized"})(od||(od={}));const pm=new Map;function eS(t,r){let{dragging:s,dependencies:i,config:l}=r;const[c,d]=y.useState(null),{frequency:p,measure:g,strategy:m}=l,v=y.useRef(t),k=T(),x=Ii(k),S=y.useCallback(function(j){j===void 0&&(j=[]),!x.current&&d(E=>E===null?j:E.concat(j.filter(H=>!E.includes(H))))},[x]),N=y.useRef(null),C=zi(j=>{if(k&&!s)return pm;if(!j||j===pm||v.current!==t||c!=null){const E=new Map;for(let H of t){if(!H)continue;if(c&&c.length>0&&!c.includes(H.id)&&H.rect.current){E.set(H.id,H.rect.current);continue}const I=H.node.current,L=I?new $d(g(I),I):null;H.rect.current=L,L&&E.set(H.id,L)}return E}return j},[t,c,s,k,g]);return y.useEffect(()=>{v.current=t},[t]),y.useEffect(()=>{k||S()},[s,k]),y.useEffect(()=>{c&&c.length>0&&d(null)},[JSON.stringify(c)]),y.useEffect(()=>{k||typeof p!="number"||N.current!==null||(N.current=setTimeout(()=>{S(),N.current=null},p))},[p,k,S,...i]),{droppableRects:C,measureDroppableContainers:S,measuringScheduled:c!=null};function T(){switch(m){case Di.Always:return!1;case Di.BeforeDragging:return s;default:return!s}}}function Fd(t,r){return zi(s=>t?s||(typeof r=="function"?r(t):t):null,[r,t])}function tS(t,r){return Fd(t,r)}function nS(t){let{callback:r,disabled:s}=t;const i=Bl(r),l=y.useMemo(()=>{if(s||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(i)},[i,s]);return y.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function Vl(t){let{callback:r,disabled:s}=t;const i=Bl(r),l=y.useMemo(()=>{if(s||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(i)},[s]);return y.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function rS(t){return new $d(Ao(t),t)}function hm(t,r,s){r===void 0&&(r=rS);const[i,l]=y.useState(null);function c(){l(g=>{if(!t)return null;if(t.isConnected===!1){var m;return(m=g??s)!=null?m:null}const v=r(t);return JSON.stringify(g)===JSON.stringify(v)?g:v})}const d=nS({callback(g){if(t)for(const m of g){const{type:v,target:k}=m;if(v==="childList"&&k instanceof HTMLElement&&k.contains(t)){c();break}}}}),p=Vl({callback:c});return fr(()=>{c(),t?(p==null||p.observe(t),d==null||d.observe(document.body,{childList:!0,subtree:!0})):(p==null||p.disconnect(),d==null||d.disconnect())},[t]),i}function sS(t){const r=Fd(t);return bv(t,r)}const mm=[];function oS(t){const r=y.useRef(t),s=zi(i=>t?i&&i!==mm&&t&&r.current&&t.parentNode===r.current.parentNode?i:Pd(t):mm,[t]);return y.useEffect(()=>{r.current=t},[t]),s}function iS(t){const[r,s]=y.useState(null),i=y.useRef(t),l=y.useCallback(c=>{const d=Uu(c.target);d&&s(p=>p?(p.set(d,rd(d)),new Map(p)):null)},[]);return y.useEffect(()=>{const c=i.current;if(t!==c){d(c);const p=t.map(g=>{const m=Uu(g);return m?(m.addEventListener("scroll",l,{passive:!0}),[m,rd(m)]):null}).filter(g=>g!=null);s(p.length?new Map(p):null),i.current=t}return()=>{d(t),d(c)};function d(p){p.forEach(g=>{const m=Uu(g);m==null||m.removeEventListener("scroll",l)})}},[l,t]),y.useMemo(()=>t.length?r?Array.from(r.values()).reduce((c,d)=>To(c,d),pr):Rv(t):pr,[t,r])}function gm(t,r){r===void 0&&(r=[]);const s=y.useRef(null);return y.useEffect(()=>{s.current=null},r),y.useEffect(()=>{const i=t!==pr;i&&!s.current&&(s.current=t),!i&&s.current&&(s.current=null)},[t]),s.current?Nl(t,s.current):pr}function aS(t){y.useEffect(()=>{if(!Ul)return;const r=t.map(s=>{let{sensor:i}=s;return i.setup==null?void 0:i.setup()});return()=>{for(const s of r)s==null||s()}},t.map(r=>{let{sensor:s}=r;return s}))}function lS(t,r){return y.useMemo(()=>t.reduce((s,i)=>{let{eventName:l,handler:c}=i;return s[l]=d=>{c(d,r)},s},{}),[t,r])}function Mv(t){return y.useMemo(()=>t?Dk(t):null,[t])}const vm=[];function cS(t,r){r===void 0&&(r=Ao);const[s]=t,i=Mv(s?Tn(s):null),[l,c]=y.useState(vm);function d(){c(()=>t.length?t.map(g=>jv(g)?i:new $d(r(g),g)):vm)}const p=Vl({callback:d});return fr(()=>{p==null||p.disconnect(),d(),t.forEach(g=>p==null?void 0:p.observe(g))},[t]),l}function Lv(t){if(!t)return null;if(t.children.length>1)return t;const r=t.children[0];return $i(r)?r:t}function uS(t){let{measure:r}=t;const[s,i]=y.useState(null),l=y.useCallback(m=>{for(const{target:v}of m)if($i(v)){i(k=>{const x=r(v);return k?{...k,width:x.width,height:x.height}:x});break}},[r]),c=Vl({callback:l}),d=y.useCallback(m=>{const v=Lv(m);c==null||c.disconnect(),v&&(c==null||c.observe(v)),i(v?r(v):null)},[r,c]),[p,g]=Sl(d);return y.useMemo(()=>({nodeRef:p,rect:s,setRef:g}),[s,p,g])}const dS=[{sensor:Hl,options:{}},{sensor:Dv,options:{}}],fS={current:{}},cl={draggable:{measure:cm},droppable:{measure:cm,strategy:Di.WhileDragging,frequency:od.Optimized},dragOverlay:{measure:Ao}};class bi extends Map{get(r){var s;return r!=null&&(s=super.get(r))!=null?s:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(r=>{let{disabled:s}=r;return!s})}getNodeFor(r){var s,i;return(s=(i=this.get(r))==null?void 0:i.node.current)!=null?s:void 0}}const pS={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new bi,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Cl},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:cl,measureDroppableContainers:Cl,windowRect:null,measuringScheduled:!1},Ov={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Cl,draggableNodes:new Map,over:null,measureDroppableContainers:Cl},Ui=y.createContext(Ov),Pv=y.createContext(pS);function hS(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new bi}}}function mS(t,r){switch(r.type){case Wt.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:r.initialCoordinates,active:r.active}};case Wt.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:r.coordinates.x-t.draggable.initialCoordinates.x,y:r.coordinates.y-t.draggable.initialCoordinates.y}}};case Wt.DragEnd:case Wt.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Wt.RegisterDroppable:{const{element:s}=r,{id:i}=s,l=new bi(t.droppable.containers);return l.set(i,s),{...t,droppable:{...t.droppable,containers:l}}}case Wt.SetDroppableDisabled:{const{id:s,key:i,disabled:l}=r,c=t.droppable.containers.get(s);if(!c||i!==c.key)return t;const d=new bi(t.droppable.containers);return d.set(s,{...c,disabled:l}),{...t,droppable:{...t.droppable,containers:d}}}case Wt.UnregisterDroppable:{const{id:s,key:i}=r,l=t.droppable.containers.get(s);if(!l||i!==l.key)return t;const c=new bi(t.droppable.containers);return c.delete(s),{...t,droppable:{...t.droppable,containers:c}}}default:return t}}function gS(t){let{disabled:r}=t;const{active:s,activatorEvent:i,draggableNodes:l}=y.useContext(Ui),c=bl(i),d=bl(s==null?void 0:s.id);return y.useEffect(()=>{if(!r&&!i&&c&&d!=null){if(!Wl(c)||document.activeElement===c.target)return;const p=l.get(d);if(!p)return;const{activatorNode:g,node:m}=p;if(!g.current&&!m.current)return;requestAnimationFrame(()=>{for(const v of[g.current,m.current]){if(!v)continue;const k=dk(v);if(k){k.focus();break}}})}},[i,r,l,d,c]),null}function $v(t,r){let{transform:s,...i}=r;return t!=null&&t.length?t.reduce((l,c)=>c({transform:l,...i}),s):s}function vS(t){return y.useMemo(()=>({draggable:{...cl.draggable,...t==null?void 0:t.draggable},droppable:{...cl.droppable,...t==null?void 0:t.droppable},dragOverlay:{...cl.dragOverlay,...t==null?void 0:t.dragOverlay}}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function yS(t){let{activeNode:r,measure:s,initialRect:i,config:l=!0}=t;const c=y.useRef(!1),{x:d,y:p}=typeof l=="boolean"?{x:l,y:l}:l;fr(()=>{if(!d&&!p||!r){c.current=!1;return}if(c.current||!i)return;const m=r==null?void 0:r.node.current;if(!m||m.isConnected===!1)return;const v=s(m),k=bv(v,i);if(d||(k.x=0),p||(k.y=0),c.current=!0,Math.abs(k.x)>0||Math.abs(k.y)>0){const x=Tv(m);x&&x.scrollBy({top:k.y,left:k.x})}},[r,d,p,i,s])}const Kl=y.createContext({...pr,scaleX:1,scaleY:1});var us;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(us||(us={}));const zv=y.memo(function(r){var s,i,l,c;let{id:d,accessibility:p,autoScroll:g=!0,children:m,sensors:v=dS,collisionDetection:k=Ek,measuring:x,modifiers:S,...N}=r;const C=y.useReducer(mS,void 0,hS),[T,j]=C,[E,H]=vk(),[I,L]=y.useState(us.Uninitialized),q=I===us.Initialized,{draggable:{active:K,nodes:$,translate:te},droppable:{containers:me}}=T,ue=K!=null?$.get(K):null,ye=y.useRef({initial:null,translated:null}),be=y.useMemo(()=>{var Qe;return K!=null?{id:K,data:(Qe=ue==null?void 0:ue.data)!=null?Qe:fS,rect:ye}:null},[K,ue]),Me=y.useRef(null),[Z,oe]=y.useState(null),[ie,z]=y.useState(null),Q=Ii(N,Object.values(N)),G=Fi("DndDescribedBy",d),D=y.useMemo(()=>me.getEnabled(),[me]),P=vS(x),{droppableRects:ce,measureDroppableContainers:B,measuringScheduled:X}=eS(D,{dragging:q,dependencies:[te.x,te.y],config:P.droppable}),le=Zk($,K),Ne=y.useMemo(()=>ie?Tl(ie):null,[ie]),re=vn(),he=tS(le,P.draggable.measure);yS({activeNode:K!=null?$.get(K):null,config:re.layoutShiftCompensation,initialRect:he,measure:P.draggable.measure});const Se=hm(le,P.draggable.measure,he),He=hm(le?le.parentElement:null),_e=y.useRef({activatorEvent:null,active:null,activeNode:le,collisionRect:null,collisions:null,droppableRects:ce,draggableNodes:$,draggingNode:null,draggingNodeRect:null,droppableContainers:me,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ct=me.getNodeFor((s=_e.current.over)==null?void 0:s.id),$e=uS({measure:P.dragOverlay.measure}),en=(i=$e.nodeRef.current)!=null?i:le,Fe=q?(l=$e.rect)!=null?l:Se:null,Ht=!!($e.nodeRef.current&&$e.rect),tn=sS(Ht?null:Se),wt=Mv(en?Tn(en):null),Ct=oS(q?ct??le:null),zt=cS(Ct),Lt=$v(S,{transform:{x:te.x-tn.x,y:te.y-tn.y,scaleX:1,scaleY:1},activatorEvent:ie,active:be,activeNodeRect:Se,containerNodeRect:He,draggingNodeRect:Fe,over:_e.current.over,overlayNodeRect:$e.rect,scrollableAncestors:Ct,scrollableAncestorRects:zt,windowRect:wt}),Y=Ne?To(Ne,te):null,ge=iS(Ct),Ue=gm(ge),nt=gm(ge,[Se]),mt=To(Lt,Ue),gt=Fe?Rk(Fe,Lt):null,Et=be&&gt?k({active:be,collisionRect:gt,droppableRects:ce,droppableContainers:D,pointerCoordinates:Y}):null,an=Tk(Et,"id"),[dt,Mn]=y.useState(null),Ln=Ht?Lt:To(Lt,nt),hr=jk(Ln,(c=dt==null?void 0:dt.rect)!=null?c:null,Se),mr=y.useRef(null),tr=y.useCallback((Qe,jt)=>{let{sensor:ft,options:Kt}=jt;if(Me.current==null)return;const vt=$.get(Me.current);if(!vt)return;const yt=Qe.nativeEvent,at=new ft({active:Me.current,activeNode:vt,event:yt,options:Kt,context:_e,onAbort(st){if(!$.get(st))return;const{onDragAbort:R}=Q.current,pe={id:st};R==null||R(pe),E({type:"onDragAbort",event:pe})},onPending(st,Ot,R,pe){if(!$.get(st))return;const{onDragPending:we}=Q.current,Le={id:st,constraint:Ot,initialCoordinates:R,offset:pe};we==null||we(Le),E({type:"onDragPending",event:Le})},onStart(st){const Ot=Me.current;if(Ot==null)return;const R=$.get(Ot);if(!R)return;const{onDragStart:pe}=Q.current,ae={activatorEvent:yt,active:{id:Ot,data:R.data,rect:ye}};yi.unstable_batchedUpdates(()=>{pe==null||pe(ae),L(us.Initializing),j({type:Wt.DragStart,initialCoordinates:st,active:Ot}),E({type:"onDragStart",event:ae}),oe(mr.current),z(yt)})},onMove(st){j({type:Wt.DragMove,coordinates:st})},onEnd:Gt(Wt.DragEnd),onCancel:Gt(Wt.DragCancel)});mr.current=at;function Gt(st){return async function(){const{active:R,collisions:pe,over:ae,scrollAdjustedTranslate:we}=_e.current;let Le=null;if(R&&we){const{cancelDrop:Ge}=Q.current;Le={activatorEvent:yt,active:R,collisions:pe,delta:we,over:ae},st===Wt.DragEnd&&typeof Ge=="function"&&await Promise.resolve(Ge(Le))&&(st=Wt.DragCancel)}Me.current=null,yi.unstable_batchedUpdates(()=>{j({type:st}),L(us.Uninitialized),Mn(null),oe(null),z(null),mr.current=null;const Ge=st===Wt.DragEnd?"onDragEnd":"onDragCancel";if(Le){const Oe=Q.current[Ge];Oe==null||Oe(Le),E({type:Ge,event:Le})}})}}},[$]),On=y.useCallback((Qe,jt)=>(ft,Kt)=>{const vt=ft.nativeEvent,yt=$.get(Kt);if(Me.current!==null||!yt||vt.dndKit||vt.defaultPrevented)return;const at={active:yt};Qe(ft,jt.options,at)===!0&&(vt.dndKit={capturedBy:jt.sensor},Me.current=Kt,tr(ft,jt))},[$,tr]),gn=Jk(v,On);aS(v),fr(()=>{Se&&I===us.Initializing&&L(us.Initialized)},[Se,I]),y.useEffect(()=>{const{onDragMove:Qe}=Q.current,{active:jt,activatorEvent:ft,collisions:Kt,over:vt}=_e.current;if(!jt||!ft)return;const yt={active:jt,activatorEvent:ft,collisions:Kt,delta:{x:mt.x,y:mt.y},over:vt};yi.unstable_batchedUpdates(()=>{Qe==null||Qe(yt),E({type:"onDragMove",event:yt})})},[mt.x,mt.y]),y.useEffect(()=>{const{active:Qe,activatorEvent:jt,collisions:ft,droppableContainers:Kt,scrollAdjustedTranslate:vt}=_e.current;if(!Qe||Me.current==null||!jt||!vt)return;const{onDragOver:yt}=Q.current,at=Kt.get(an),Gt=at&&at.rect.current?{id:at.id,rect:at.rect.current,data:at.data,disabled:at.disabled}:null,st={active:Qe,activatorEvent:jt,collisions:ft,delta:{x:vt.x,y:vt.y},over:Gt};yi.unstable_batchedUpdates(()=>{Mn(Gt),yt==null||yt(st),E({type:"onDragOver",event:st})})},[an]),fr(()=>{_e.current={activatorEvent:ie,active:be,activeNode:le,collisionRect:gt,collisions:Et,droppableRects:ce,draggableNodes:$,draggingNode:en,draggingNodeRect:Fe,droppableContainers:me,over:dt,scrollableAncestors:Ct,scrollAdjustedTranslate:mt},ye.current={initial:Fe,translated:gt}},[be,le,Et,gt,$,en,Fe,ce,me,dt,Ct,mt]),Xk({...re,delta:te,draggingRect:gt,pointerCoordinates:Y,scrollableAncestors:Ct,scrollableAncestorRects:zt});const ln=y.useMemo(()=>({active:be,activeNode:le,activeNodeRect:Se,activatorEvent:ie,collisions:Et,containerNodeRect:He,dragOverlay:$e,draggableNodes:$,droppableContainers:me,droppableRects:ce,over:dt,measureDroppableContainers:B,scrollableAncestors:Ct,scrollableAncestorRects:zt,measuringConfiguration:P,measuringScheduled:X,windowRect:wt}),[be,le,Se,ie,Et,He,$e,$,me,ce,dt,B,Ct,zt,P,X,wt]),Vt=y.useMemo(()=>({activatorEvent:ie,activators:gn,active:be,activeNodeRect:Se,ariaDescribedById:{draggable:G},dispatch:j,draggableNodes:$,over:dt,measureDroppableContainers:B}),[ie,gn,be,Se,j,G,$,dt,B]);return lt.createElement(xv.Provider,{value:H},lt.createElement(Ui.Provider,{value:Vt},lt.createElement(Pv.Provider,{value:ln},lt.createElement(Kl.Provider,{value:hr},m)),lt.createElement(gS,{disabled:(p==null?void 0:p.restoreFocus)===!1})),lt.createElement(wk,{...p,hiddenTextDescribedById:G}));function vn(){const Qe=(Z==null?void 0:Z.autoScrollEnabled)===!1,jt=typeof g=="object"?g.enabled===!1:g===!1,ft=q&&!Qe&&!jt;return typeof g=="object"?{...g,enabled:ft}:{enabled:ft}}}),xS=y.createContext(null),ym="button",wS="Draggable";function kS(t){let{id:r,data:s,disabled:i=!1,attributes:l}=t;const c=Fi(wS),{activators:d,activatorEvent:p,active:g,activeNodeRect:m,ariaDescribedById:v,draggableNodes:k,over:x}=y.useContext(Ui),{role:S=ym,roleDescription:N="draggable",tabIndex:C=0}=l??{},T=(g==null?void 0:g.id)===r,j=y.useContext(T?Kl:xS),[E,H]=Sl(),[I,L]=Sl(),q=lS(d,r),K=Ii(s);fr(()=>(k.set(r,{id:r,key:c,node:E,activatorNode:I,data:K}),()=>{const te=k.get(r);te&&te.key===c&&k.delete(r)}),[k,r]);const $=y.useMemo(()=>({role:S,tabIndex:C,"aria-disabled":i,"aria-pressed":T&&S===ym?!0:void 0,"aria-roledescription":N,"aria-describedby":v.draggable}),[i,S,C,T,N,v.draggable]);return{active:g,activatorEvent:p,activeNodeRect:m,attributes:$,isDragging:T,listeners:i?void 0:q,node:E,over:x,setNodeRef:H,setActivatorNodeRef:L,transform:j}}function Fv(){return y.useContext(Pv)}const SS="Droppable",bS={timeout:25};function Uv(t){let{data:r,disabled:s=!1,id:i,resizeObserverConfig:l}=t;const c=Fi(SS),{active:d,dispatch:p,over:g,measureDroppableContainers:m}=y.useContext(Ui),v=y.useRef({disabled:s}),k=y.useRef(!1),x=y.useRef(null),S=y.useRef(null),{disabled:N,updateMeasurementsFor:C,timeout:T}={...bS,...l},j=Ii(C??i),E=y.useCallback(()=>{if(!k.current){k.current=!0;return}S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{m(Array.isArray(j.current)?j.current:[j.current]),S.current=null},T)},[T]),H=Vl({callback:E,disabled:N||!d}),I=y.useCallback(($,te)=>{H&&(te&&(H.unobserve(te),k.current=!1),$&&H.observe($))},[H]),[L,q]=Sl(I),K=Ii(r);return y.useEffect(()=>{!H||!L.current||(H.disconnect(),k.current=!1,H.observe(L.current))},[L,H]),y.useEffect(()=>(p({type:Wt.RegisterDroppable,element:{id:i,key:c,disabled:s,node:L,rect:x,data:K}}),()=>p({type:Wt.UnregisterDroppable,key:c,id:i})),[i]),y.useEffect(()=>{s!==v.current.disabled&&(p({type:Wt.SetDroppableDisabled,id:i,key:c,disabled:s}),v.current.disabled=s)},[i,c,s,p]),{active:d,rect:x,isOver:(g==null?void 0:g.id)===i,node:L,over:g,setNodeRef:q}}function NS(t){let{animation:r,children:s}=t;const[i,l]=y.useState(null),[c,d]=y.useState(null),p=bl(s);return!s&&!i&&p&&l(p),fr(()=>{if(!c)return;const g=i==null?void 0:i.key,m=i==null?void 0:i.props.id;if(g==null||m==null){l(null);return}Promise.resolve(r(m,c)).then(()=>{l(null)})},[r,i,c]),lt.createElement(lt.Fragment,null,s,i?y.cloneElement(i,{ref:d}):null)}const TS={x:0,y:0,scaleX:1,scaleY:1};function CS(t){let{children:r}=t;return lt.createElement(Ui.Provider,{value:Ov},lt.createElement(Kl.Provider,{value:TS},r))}const ES={position:"fixed",touchAction:"none"},jS=t=>Wl(t)?"transform 250ms ease":void 0,_S=y.forwardRef((t,r)=>{let{as:s,activatorEvent:i,adjustScale:l,children:c,className:d,rect:p,style:g,transform:m,transition:v=jS}=t;if(!p)return null;const k=l?m:{...m,scaleX:1,scaleY:1},x={...ES,width:p.width,height:p.height,top:p.top,left:p.left,transform:Cr.Transform.toString(k),transformOrigin:l&&i?Sk(i,p):void 0,transition:typeof v=="function"?v(i):v,...g};return lt.createElement(s,{className:d,style:x,ref:r},c)}),RS=t=>r=>{let{active:s,dragOverlay:i}=r;const l={},{styles:c,className:d}=t;if(c!=null&&c.active)for(const[p,g]of Object.entries(c.active))g!==void 0&&(l[p]=s.node.style.getPropertyValue(p),s.node.style.setProperty(p,g));if(c!=null&&c.dragOverlay)for(const[p,g]of Object.entries(c.dragOverlay))g!==void 0&&i.node.style.setProperty(p,g);return d!=null&&d.active&&s.node.classList.add(d.active),d!=null&&d.dragOverlay&&i.node.classList.add(d.dragOverlay),function(){for(const[g,m]of Object.entries(l))s.node.style.setProperty(g,m);d!=null&&d.active&&s.node.classList.remove(d.active)}},AS=t=>{let{transform:{initial:r,final:s}}=t;return[{transform:Cr.Transform.toString(r)},{transform:Cr.Transform.toString(s)}]},IS={duration:250,easing:"ease",keyframes:AS,sideEffects:RS({styles:{active:{opacity:"0"}}})};function DS(t){let{config:r,draggableNodes:s,droppableContainers:i,measuringConfiguration:l}=t;return Bl((c,d)=>{if(r===null)return;const p=s.get(c);if(!p)return;const g=p.node.current;if(!g)return;const m=Lv(d);if(!m)return;const{transform:v}=Tn(d).getComputedStyle(d),k=Nv(v);if(!k)return;const x=typeof r=="function"?r:MS(r);return Av(g,l.draggable.measure),x({active:{id:c,data:p.data,node:g,rect:l.draggable.measure(g)},draggableNodes:s,dragOverlay:{node:d,rect:l.dragOverlay.measure(m)},droppableContainers:i,measuringConfiguration:l,transform:k})})}function MS(t){const{duration:r,easing:s,sideEffects:i,keyframes:l}={...IS,...t};return c=>{let{active:d,dragOverlay:p,transform:g,...m}=c;if(!r)return;const v={x:p.rect.left-d.rect.left,y:p.rect.top-d.rect.top},k={scaleX:g.scaleX!==1?d.rect.width*g.scaleX/p.rect.width:1,scaleY:g.scaleY!==1?d.rect.height*g.scaleY/p.rect.height:1},x={x:g.x-v.x,y:g.y-v.y,...k},S=l({...m,active:d,dragOverlay:p,transform:{initial:g,final:x}}),[N]=S,C=S[S.length-1];if(JSON.stringify(N)===JSON.stringify(C))return;const T=i==null?void 0:i({active:d,dragOverlay:p,...m}),j=p.node.animate(S,{duration:r,easing:s,fill:"forwards"});return new Promise(E=>{j.onfinish=()=>{T==null||T(),E()}})}}let xm=0;function LS(t){return y.useMemo(()=>{if(t!=null)return xm++,xm},[t])}const OS=lt.memo(t=>{let{adjustScale:r=!1,children:s,dropAnimation:i,style:l,transition:c,modifiers:d,wrapperElement:p="div",className:g,zIndex:m=999}=t;const{activatorEvent:v,active:k,activeNodeRect:x,containerNodeRect:S,draggableNodes:N,droppableContainers:C,dragOverlay:T,over:j,measuringConfiguration:E,scrollableAncestors:H,scrollableAncestorRects:I,windowRect:L}=Fv(),q=y.useContext(Kl),K=LS(k==null?void 0:k.id),$=$v(d,{activatorEvent:v,active:k,activeNodeRect:x,containerNodeRect:S,draggingNodeRect:T.rect,over:j,overlayNodeRect:T.rect,scrollableAncestors:H,scrollableAncestorRects:I,transform:q,windowRect:L}),te=Fd(x),me=DS({config:i,draggableNodes:N,droppableContainers:C,measuringConfiguration:E}),ue=te?T.setRef:void 0;return lt.createElement(CS,null,lt.createElement(NS,{animation:me},k&&K?lt.createElement(_S,{key:K,id:k.id,ref:ue,as:p,activatorEvent:v,adjustScale:r,className:g,transition:c,rect:te,style:{zIndex:m,...l},transform:$},s):null))});function Bv(t,r,s){const i=t.slice();return i.splice(s<0?i.length+s:s,0,i.splice(r,1)[0]),i}function PS(t,r){return t.reduce((s,i,l)=>{const c=r.get(i);return c&&(s[l]=c),s},Array(t.length))}function qa(t){return t!==null&&t>=0}function $S(t,r){if(t===r)return!0;if(t.length!==r.length)return!1;for(let s=0;s<t.length;s++)if(t[s]!==r[s])return!1;return!0}function zS(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const Xa={scaleX:1,scaleY:1},FS=t=>{var r;let{rects:s,activeNodeRect:i,activeIndex:l,overIndex:c,index:d}=t;const p=(r=s[l])!=null?r:i;if(!p)return null;const g=US(s,d,l);if(d===l){const m=s[c];return m?{x:l<c?m.left+m.width-(p.left+p.width):m.left-p.left,y:0,...Xa}:null}return d>l&&d<=c?{x:-p.width-g,y:0,...Xa}:d<l&&d>=c?{x:p.width+g,y:0,...Xa}:{x:0,y:0,...Xa}};function US(t,r,s){const i=t[r],l=t[r-1],c=t[r+1];return!i||!l&&!c?0:s<r?l?i.left-(l.left+l.width):c.left-(i.left+i.width):c?c.left-(i.left+i.width):i.left-(l.left+l.width)}const Wv=t=>{let{rects:r,activeIndex:s,overIndex:i,index:l}=t;const c=Bv(r,i,s),d=r[l],p=c[l];return!p||!d?null:{x:p.left-d.left,y:p.top-d.top,scaleX:p.width/d.width,scaleY:p.height/d.height}},Ya={scaleX:1,scaleY:1},wm=t=>{var r;let{activeIndex:s,activeNodeRect:i,index:l,rects:c,overIndex:d}=t;const p=(r=c[s])!=null?r:i;if(!p)return null;if(l===s){const m=c[d];return m?{x:0,y:s<d?m.top+m.height-(p.top+p.height):m.top-p.top,...Ya}:null}const g=BS(c,l,s);return l>s&&l<=d?{x:0,y:-p.height-g,...Ya}:l<s&&l>=d?{x:0,y:p.height+g,...Ya}:{x:0,y:0,...Ya}};function BS(t,r,s){const i=t[r],l=t[r-1],c=t[r+1];return i?s<r?l?i.top-(l.top+l.height):c?c.top-(i.top+i.height):0:c?c.top-(i.top+i.height):l?i.top-(l.top+l.height):0:0}const Hv="Sortable",Vv=lt.createContext({activeIndex:-1,containerId:Hv,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Wv,disabled:{draggable:!1,droppable:!1}});function id(t){let{children:r,id:s,items:i,strategy:l=Wv,disabled:c=!1}=t;const{active:d,dragOverlay:p,droppableRects:g,over:m,measureDroppableContainers:v}=Fv(),k=Fi(Hv,s),x=p.rect!==null,S=y.useMemo(()=>i.map(q=>typeof q=="object"&&"id"in q?q.id:q),[i]),N=d!=null,C=d?S.indexOf(d.id):-1,T=m?S.indexOf(m.id):-1,j=y.useRef(S),E=!$S(S,j.current),H=T!==-1&&C===-1||E,I=zS(c);fr(()=>{E&&N&&v(S)},[E,S,N,v]),y.useEffect(()=>{j.current=S},[S]);const L=y.useMemo(()=>({activeIndex:C,containerId:k,disabled:I,disableTransforms:H,items:S,overIndex:T,useDragOverlay:x,sortedRects:PS(S,g),strategy:l}),[C,k,I.draggable,I.droppable,H,S,T,g,x,l]);return lt.createElement(Vv.Provider,{value:L},r)}const WS=t=>{let{id:r,items:s,activeIndex:i,overIndex:l}=t;return Bv(s,i,l).indexOf(r)},HS=t=>{let{containerId:r,isSorting:s,wasDragging:i,index:l,items:c,newIndex:d,previousItems:p,previousContainerId:g,transition:m}=t;return!m||!i||p!==c&&l===d?!1:s?!0:d!==l&&r===g},VS={duration:200,easing:"ease"},Kv="transform",KS=Cr.Transition.toString({property:Kv,duration:0,easing:"linear"}),GS={roleDescription:"sortable"};function qS(t){let{disabled:r,index:s,node:i,rect:l}=t;const[c,d]=y.useState(null),p=y.useRef(s);return fr(()=>{if(!r&&s!==p.current&&i.current){const g=l.current;if(g){const m=Ao(i.current,{ignoreTransform:!0}),v={x:g.left-m.left,y:g.top-m.top,scaleX:g.width/m.width,scaleY:g.height/m.height};(v.x||v.y)&&d(v)}}s!==p.current&&(p.current=s)},[r,s,i,l]),y.useEffect(()=>{c&&d(null)},[c]),c}function Ud(t){let{animateLayoutChanges:r=HS,attributes:s,disabled:i,data:l,getNewIndex:c=WS,id:d,strategy:p,resizeObserverConfig:g,transition:m=VS}=t;const{items:v,containerId:k,activeIndex:x,disabled:S,disableTransforms:N,sortedRects:C,overIndex:T,useDragOverlay:j,strategy:E}=y.useContext(Vv),H=XS(i,S),I=v.indexOf(d),L=y.useMemo(()=>({sortable:{containerId:k,index:I,items:v},...l}),[k,l,I,v]),q=y.useMemo(()=>v.slice(v.indexOf(d)),[v,d]),{rect:K,node:$,isOver:te,setNodeRef:me}=Uv({id:d,data:L,disabled:H.droppable,resizeObserverConfig:{updateMeasurementsFor:q,...g}}),{active:ue,activatorEvent:ye,activeNodeRect:be,attributes:Me,setNodeRef:Z,listeners:oe,isDragging:ie,over:z,setActivatorNodeRef:Q,transform:G}=kS({id:d,data:L,attributes:{...GS,...s},disabled:H.draggable}),D=ak(me,Z),P=!!ue,ce=P&&!N&&qa(x)&&qa(T),B=!j&&ie,X=B&&ce?G:null,Ne=ce?X??(p??E)({rects:C,activeNodeRect:be,activeIndex:x,overIndex:T,index:I}):null,re=qa(x)&&qa(T)?c({id:d,items:v,activeIndex:x,overIndex:T}):I,he=ue==null?void 0:ue.id,Se=y.useRef({activeId:he,items:v,newIndex:re,containerId:k}),He=v!==Se.current.items,_e=r({active:ue,containerId:k,isDragging:ie,isSorting:P,id:d,index:I,items:v,newIndex:Se.current.newIndex,previousItems:Se.current.items,previousContainerId:Se.current.containerId,transition:m,wasDragging:Se.current.activeId!=null}),ct=qS({disabled:!_e,index:I,node:$,rect:K});return y.useEffect(()=>{P&&Se.current.newIndex!==re&&(Se.current.newIndex=re),k!==Se.current.containerId&&(Se.current.containerId=k),v!==Se.current.items&&(Se.current.items=v)},[P,re,k,v]),y.useEffect(()=>{if(he===Se.current.activeId)return;if(he!=null&&Se.current.activeId==null){Se.current.activeId=he;return}const en=setTimeout(()=>{Se.current.activeId=he},50);return()=>clearTimeout(en)},[he]),{active:ue,activeIndex:x,attributes:Me,data:L,rect:K,index:I,newIndex:re,items:v,isOver:te,isSorting:P,isDragging:ie,listeners:oe,node:$,overIndex:T,over:z,setNodeRef:D,setActivatorNodeRef:Q,setDroppableNodeRef:me,setDraggableNodeRef:Z,transform:ct??Ne,transition:$e()};function $e(){if(ct||He&&Se.current.newIndex===I)return KS;if(!(B&&!Wl(ye)||!m)&&(P||_e))return Cr.Transition.toString({...m,property:Kv})}}function XS(t,r){var s,i;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(s=t==null?void 0:t.draggable)!=null?s:r.draggable,droppable:(i=t==null?void 0:t.droppable)!=null?i:r.droppable}}tt.Down,tt.Right,tt.Up,tt.Left;function Qa(t){const[r,s]=y.useState(()=>{try{const l=localStorage.getItem(t);if(l==null)return new Set;const c=JSON.parse(l);return Array.isArray(c)?new Set(c.filter(d=>typeof d=="string")):new Set}catch{return new Set}}),i=y.useCallback(l=>{s(c=>{const d=l(new Set(c));try{localStorage.setItem(t,JSON.stringify([...d]))}catch{}return d})},[t]);return[r,i]}function YS(t,r=!1){const[s,i]=y.useState(()=>{try{const c=localStorage.getItem(t);return c==="1"?!0:c==="0"?!1:r}catch{return r}}),l=y.useCallback(c=>{i(c);try{localStorage.setItem(t,c?"1":"0")}catch{}},[t]);return[s,l]}async function Mi(t){try{return await navigator.clipboard.writeText(t),!0}catch{try{const r=document.createElement("textarea");r.value=t,r.style.position="fixed",r.style.opacity="0",document.body.appendChild(r),r.select();const s=document.execCommand("copy");return document.body.removeChild(r),s}catch{return!1}}}function QS(t){return t.origin_app_id!=null&&!t.user_touched&&!t.starred}const ad="(no directory)";function hs(t){return t.replaceAll("\\","/").replace(/\/+$/,"")}function ld(t,r){if(!r||!t.cwd)return!1;const s=hs(t.cwd),i=hs(r);return s.startsWith(`${i}/`)}function ZS(t,r){const s=new Map;for(const d of r){const p=d.cwd||ad,g=s.get(p)??[];g.push(d),s.set(p,g)}const i=new Set,l=new Set(t.filter(d=>d.deleted===1).map(d=>d.path)),c=[];for(const d of t){if(d.deleted===1){i.add(d.path);continue}i.add(d.path),c.push({path:d.path,label:d.label||d.path.split("/").pop()||d.path,sessions:s.get(d.path)??[],workspace:d})}for(const[d,p]of s)i.has(d)||l.has(d)||c.push({path:d,label:d===ad?"Other":d.split("/").pop()||d,sessions:p,workspace:null});return c}function JS(t,r,s){if(r.length===0)return!1;const i=new Set(t.filter(l=>l.deleted===1).map(l=>l.path));return r.some(l=>!ld(l,s)&&!i.has(l.cwd||ad))}function jl(t){return[...t].sort((r,s)=>s.sort_order-r.sort_order||(r.created_at<s.created_at?1:-1))}function km(t,r,s,i){const l=r.map(c=>({folder:c,sessions:t.sessions.filter(d=>d.folder_id===c.id),finishedKey:`folder:${c.id}:finished`,hidden:i.has(c.id)}));return l.push({folder:null,sessions:t.sessions.filter(c=>!(c.folder_id&&s.has(c.folder_id))),finishedKey:`${t.path}:finished`,hidden:!1}),l}function Sm(t,r){return{working:jl(t.sessions.filter(s=>s.lifecycle!=="finished")),finished:jl(t.sessions.filter(s=>s.lifecycle==="finished")),finishedCollapsed:r.has(t.finishedKey)}}function Za(t,r){return t.folder_id&&r.has(t.folder_id)?t.folder_id:null}function eb(t){const r=new Set(t.map(i=>i.name));if(!r.has("New Folder"))return"New Folder";let s=2;for(;r.has(`New Folder ${s}`);)s++;return`New Folder ${s}`}function bm({id:t,children:r,className:s}){const{setNodeRef:i,isOver:l}=Uv({id:t});return a.jsx("div",{ref:i,className:`${s??""}${l?" drop-over":""}`,children:r})}function Bd({inputRef:t,value:r,onChange:s,onConfirm:i,onCancel:l}){return a.jsx("input",{ref:t,className:"tree-rename-input",value:r,onChange:c=>s(c.target.value),onClick:c=>c.stopPropagation(),onPointerDown:c=>c.stopPropagation(),onKeyDown:c=>{c.key==="Enter"&&i(),c.key==="Escape"&&l()},onBlur:i})}function tb({s:t,backgroundTaskCount:r,isActive:s,isSelected:i,originApp:l,renaming:c,renameValue:d,renameRef:p,onRenameValue:g,onRenameConfirm:m,onRenameCancel:v,onSelect:k,onCtxMenu:x,onToggleStar:S}){const{attributes:N,listeners:C,setNodeRef:T,transform:j,transition:E,isDragging:H}=Ud({id:`s:${t.id}`}),I=zl(t,r);return a.jsxs("div",{ref:T,style:{transform:Cr.Transform.toString(j),transition:E},className:`tree-item ${s?"active":""}${i?" selected":""} ${I.isFinished?"tree-item-finished":""}${H?" dragging":""}${t.starred?" tree-item-starred":""}`,...N,...C,onClick:k,onContextMenu:x,children:[a.jsx(Md,{iconClass:I.iconClass,iconText:I.iconText,size:16}),l&&a.jsx("span",{className:"tree-app-badge",title:"Created by a mini app",children:a.jsx(jo,{iconNode:l.iconNode,size:10})}),c?a.jsx(Bd,{inputRef:p,value:d,onChange:g,onConfirm:m,onCancel:v}):a.jsx("span",{className:"tree-label",children:t.title||t.id.slice(0,8)}),!c&&a.jsx("button",{className:`star-btn${t.starred?" starred":""}`,title:t.starred?"Unstar session":"Star session",onClick:L=>{L.stopPropagation(),S()},onPointerDown:L=>L.stopPropagation(),children:a.jsx(kl,{size:10,fill:t.starred?"currentColor":"none"})}),I.dot&&a.jsx(Dd,{status:I.dot,title:I.dotTitle})]})}function nb({folder:t,count:r,collapsed:s,renaming:i,renameValue:l,renameRef:c,onRenameValue:d,onRenameConfirm:p,onRenameCancel:g,onToggle:m,onCtxMenu:v,children:k}){const{attributes:x,listeners:S,setNodeRef:N,transform:C,transition:T,isDragging:j,over:E}=Ud({id:`f:${t.id}`}),H=E!=null&&String(E.id).startsWith("s:");return a.jsxs("div",{ref:N,style:{transform:Cr.Transform.toString(C),transition:T},className:`tree-folder ${s?"collapsed":""}${j?" dragging":""}`,children:[a.jsx("div",{className:`tree-folder-header${H?" drop-over":""}`,...x,...S,onClick:()=>{i||m()},onContextMenu:v,children:i?a.jsx(Bd,{inputRef:c,value:l,onChange:d,onConfirm:p,onCancel:g}):a.jsxs(a.Fragment,{children:[a.jsx(No,{size:8,className:"tree-chevron"}),a.jsx(wl,{size:12}),a.jsx("span",{className:"tree-folder-label",children:t.name}),a.jsx("span",{className:"tree-count",children:r})]})}),!s&&a.jsx("div",{className:"tree-folder-children",children:k})]})}function rb(){const t=A(R=>R.sessions),r=A(R=>R.backgroundTasks),s=A(R=>R.workspaces),i=A(R=>R.folders),l=A(R=>R.activeSessionId),c=A(R=>R.selectSession),d=A(R=>R.deleteSession),p=A(R=>R.removeWorkspace),g=A(R=>R.createSessionInWorkspace),m=A(R=>R.pickAndAddWorkspace),v=A(R=>R.setImportSessionsWorkspace),k=A(R=>R.renameSession),x=A(R=>R.markFinished),S=A(R=>R.markFinishedMany),N=A(R=>R.toggleStar),C=A(R=>R.reopenSession),T=A(R=>R.reopenSessionMany),j=A(R=>R.deleteSessionMany),E=A(R=>R.createSidebarFolder),H=A(R=>R.renameFolder),I=A(R=>R.deleteFolder),L=A(R=>R.applyMoves),q=A(R=>R.reorderFolders),K=A(R=>R.apps),$=A(R=>R.appsRootPath),te=A(R=>R.activeAppTabId),me=A(R=>R.openAppTab),ue=A(R=>R.startAppEdit),ye=A(R=>R.toggleAppPin),be=A(R=>R.deleteApp),Me=A(R=>R.openAppCatalog),[Z,oe]=Qa("agentpane:sidebar-ws-collapsed"),[ie,z]=Qa("agentpane:sidebar-sub-collapsed"),[Q,G]=Qa("agentpane:sidebar-folders-collapsed"),[D,P]=Qa("agentpane:sidebar-app-edits-collapsed"),[ce,B]=YS("agentpane:sidebar-hide-auto-sessions"),[X,le]=y.useState(null),[Ne,re]=y.useState(null),[he,Se]=y.useState(""),[He,_e]=y.useState(null),[ct,$e]=y.useState(new Set),[en,Fe]=y.useState(null),Ht=y.useRef(null),tn=y.useRef(null),wt=y.useRef(null),Ct=y.useRef(!1),zt=kv(wv(Hl,{activationConstraint:{distance:5}}));function Lt(){$e(new Set),Fe(null)}Oi(Ht,()=>le(null),!!X),Eo(()=>{le(null),Lt()},!!X||ct.size>0),y.useLayoutEffect(()=>{const R=Ht.current;if(!X||!R)return;const pe=8,{offsetWidth:ae,offsetHeight:we}=R,Le=X.x+ae>window.innerWidth-pe?Math.max(pe,X.x-ae):X.x,Ge=X.y+we>window.innerHeight-pe?Math.max(pe,X.y-we):X.y;R.style.left=`${Le}px`,R.style.top=`${Ge}px`},[X]);const Y=y.useMemo(()=>new Map(t.map(R=>[R.id,R])),[t]),ge=y.useMemo(()=>new Map(i.map(R=>[R.id,R])),[i]),Ue=y.useMemo(()=>{const R=new Map;for(const pe of[...i].sort((ae,we)=>ae.sort_order-we.sort_order)){const ae=R.get(pe.workspace_path)??[];ae.push(pe),R.set(pe.workspace_path,ae)}return R},[i]);function nt(R){oe(pe=>{const ae=new Set(pe);return ae.has(R)?ae.delete(R):ae.add(R),ae})}function mt(R){z(pe=>{const ae=new Set(pe);return ae.has(R)?ae.delete(R):ae.add(R),ae})}function gt(R){G(pe=>{const ae=new Set(pe);return ae.has(R)?ae.delete(R):ae.add(R),ae})}function Et(){B(!ce),Lt()}function an(R){P(pe=>{const ae=new Set(pe);return ae.has(R)?ae.delete(R):ae.add(R),ae})}y.useEffect(()=>{Ne&&tn.current&&(tn.current.focus(),tn.current.select())},[Ne]),y.useEffect(()=>{var R,pe,ae;Ct.current||!l||(Ct.current=!0,(ae=(pe=(R=wt.current)==null?void 0:R.querySelector(".tree-item.active, .sidebar-app-edit-row.active"))==null?void 0:pe.scrollIntoView)==null||ae.call(pe,{block:"nearest"}))},[l]);function dt(R,pe,ae,we=""){re({kind:R,id:pe}),Se(ae||we)}function Mn(){if(Ne){const R=he.trim();R&&(Ne.kind==="session"?k(Ne.id,R):H(Ne.id,R))}re(null)}function Ln(){re(null),Se("")}async function hr(R){const pe=eb(Ue.get(R)??[]),ae=await E(R,pe);ae&&dt("folder",ae.id,ae.name)}function mr(R){const pe=String(R.active.id);if(pe.startsWith("s:")){const ae=Y.get(pe.slice(2));ae&&_e({kind:"session",label:ae.title||ae.id.slice(0,8)})}else if(pe.startsWith("f:")){const ae=ge.get(pe.slice(2));ae&&_e({kind:"folder",label:ae.name})}}function tr(R){_e(null);const{active:pe,over:ae}=R;if(!ae)return;const we=String(pe.id),Le=String(ae.id);if(we.startsWith("s:")){const Ge=Y.get(we.slice(2));if(!Ge)return;const Oe=Ge.cwd||"(no directory)",Ft=Za(Ge,ge);let Pn,Be;if(Le.startsWith("f:")){const Ze=ge.get(Le.slice(2));if(!Ze)return;Pn=Ze.workspace_path,Be=Ze.id}else if(Le.startsWith("s:")){const Ze=Y.get(Le.slice(2));if(!Ze)return;Pn=Ze.cwd||"(no directory)",Be=Za(Ze,ge)}else if(Le.startsWith("c:")){const Ze=Le.slice(2),_t=Ze.lastIndexOf("|");Pn=Ze.slice(0,_t);const vr=Ze.slice(_t+1);Be=vr==="root"?null:vr}else return;if(Pn!==Oe)return;const yn=jl(t.filter(Ze=>(Ze.cwd||"(no directory)")===Pn&&Za(Ze,ge)===Be)),Er=yn.filter(Ze=>Ze.id!==Ge.id);let Ur=Er.length;if(Le.startsWith("s:")){const Ze=Er.findIndex(_t=>_t.id===Le.slice(2));Ze>=0&&(Ur=Ze)}const $n=[...Er.slice(0,Ur),Ge,...Er.slice(Ur)],gr=[];if(Be===Ft){if($n.length===yn.length&&$n.every((Ze,_t)=>Ze.id===yn[_t].id))return;$n.forEach((Ze,_t)=>gr.push({id:Ze.id,folder_id:Be,sort_order:$n.length-1-_t}))}else{const Ze=jl(t.filter(_t=>(_t.cwd||"(no directory)")===Oe&&Za(_t,ge)===Ft)).filter(_t=>_t.id!==Ge.id);Ze.forEach((_t,vr)=>gr.push({id:_t.id,folder_id:Ft,sort_order:Ze.length-1-vr})),$n.forEach((_t,vr)=>gr.push({id:_t.id,folder_id:Be,sort_order:$n.length-1-vr}))}L(gr);return}if(we.startsWith("f:")){if(!Le.startsWith("f:"))return;const Ge=ge.get(we.slice(2)),Oe=ge.get(Le.slice(2));if(!Ge||!Oe||Ge.id===Oe.id||Ge.workspace_path!==Oe.workspace_path)return;const Ft=(Ue.get(Ge.workspace_path)??[]).map(yn=>yn.id),Pn=Ft.indexOf(Ge.id),Be=Ft.indexOf(Oe.id);Ft.splice(Be,0,...Ft.splice(Pn,1)),q(Ft)}}const On=$?t.filter(R=>!ld(R,$)):t,gn=new Set(ce?On.filter(R=>QS(R)&&R.id!==l).map(R=>R.id):[]),ln=ZS(s,gn.size>0?On.filter(R=>!gn.has(R.id)):On),Vt=y.useMemo(()=>{const R=new Map;if(!$)return R;const pe=hs($);for(const ae of t){if(!ld(ae,$))continue;const we=hs(ae.cwd).slice(pe.length+1).split("/")[0],Le=R.get(we)??[];Le.push(ae),R.set(we,Le)}return R},[t,$]);function vn(R){return{folder:null,sessions:Vt.get(R)??[],finishedKey:`app:${R}:finished`,hidden:D.has(R)}}const Qe=[],jt=R=>{if(R.hidden)return;const{working:pe,finished:ae,finishedCollapsed:we}=Sm(R,ie);Qe.push(...pe.map(Le=>Le.id)),we||Qe.push(...ae.map(Le=>Le.id))};for(const R of ln){if(Z.has(R.path))continue;const pe=Ue.get(R.path)??[],ae=new Set(pe.map(we=>we.id));km(R,pe,ae,Q).forEach(jt)}K.forEach(R=>jt(vn(R.id)));const ft=t.filter(R=>ct.has(R.id)),Kt=ft.filter(R=>R.lifecycle!=="finished").map(R=>R.id),vt=ft.filter(R=>R.lifecycle==="finished").map(R=>R.id);function yt(R,pe){if(pe.metaKey||pe.ctrlKey){pe.preventDefault(),Fe(R.id),$e(ae=>{const we=new Set(ae);return we.has(R.id)?we.delete(R.id):we.add(R.id),we});return}if(pe.shiftKey){pe.preventDefault();const ae=en??R.id;Fe(ae);const we=Qe.indexOf(ae),Le=Qe.indexOf(R.id);if(we>=0&&Le>=0){const[Ge,Oe]=we<Le?[we,Le]:[Le,we];$e(new Set(Qe.slice(Ge,Oe+1)))}return}Lt(),Fe(R.id),c(R.id)}function at(R,pe){pe.preventDefault();const ae=ct.has(R.id)&&ct.size>1;ct.has(R.id)||($e(new Set),Fe(R.id)),le({x:pe.clientX,y:pe.clientY,type:"session",sessionId:R.id,sessionTitle:R.title,sessionLifecycle:R.lifecycle,sessionExternalId:R.external_thread_id,multi:ae})}function Gt(R){var ae;const pe=R.origin_app_id?K.find(we=>we.id===R.origin_app_id):null;return a.jsx(tb,{s:R,backgroundTaskCount:((ae=r[R.id])==null?void 0:ae.length)??0,isActive:l===R.id,isSelected:ct.has(R.id),originApp:pe??null,renaming:(Ne==null?void 0:Ne.kind)==="session"&&Ne.id===R.id,renameValue:he,renameRef:tn,onRenameValue:Se,onRenameConfirm:Mn,onRenameCancel:Ln,onSelect:we=>yt(R,we),onToggleStar:()=>N(R.id),onCtxMenu:we=>at(R,we)},R.id)}function st(R){var ae;const pe=zl(R,((ae=r[R.id])==null?void 0:ae.length)??0);return a.jsxs("div",{className:`sidebar-app-edit-row${l===R.id?" active":""}${ct.has(R.id)?" selected":""}${pe.isFinished?" tree-item-finished":""}`,title:"App edit session — click to open",onClick:we=>yt(R,we),onContextMenu:we=>at(R,we),children:[a.jsx(Md,{iconClass:pe.iconClass,iconText:pe.iconText,size:14}),(Ne==null?void 0:Ne.kind)==="session"&&Ne.id===R.id?a.jsx(Bd,{inputRef:tn,value:he,onChange:Se,onConfirm:Mn,onCancel:Ln}):a.jsx("span",{className:"tree-label",children:R.title||R.id.slice(0,8)}),pe.dot&&a.jsx(Dd,{status:pe.dot,title:pe.dotTitle})]},R.id)}function Ot(R,pe="workspace"){const{working:ae,finished:we,finishedCollapsed:Le}=Sm(R,ie),Ge=pe==="workspace"?Gt:st,Oe=a.jsxs(a.Fragment,{children:[ae.length===0&&we.length===0?a.jsx("div",{className:"tree-empty",children:"No sessions"}):ae.map(Ge),we.length>0&&a.jsxs("div",{className:`tree-subgroup ${Le?"collapsed":""}`,children:[a.jsxs("div",{className:"tree-subgroup-header",onClick:()=>mt(R.finishedKey),children:[a.jsx(No,{size:8,className:"tree-chevron"}),a.jsx("span",{className:"tree-subgroup-label",children:"Finished"}),a.jsx("span",{className:"tree-subgroup-count",children:we.length})]}),!Le&&a.jsx("div",{className:"tree-subgroup-items",children:we.map(Ge)})]})]});if(pe==="app")return Oe;const Ft=[...ae,...we].map(Pn=>`s:${Pn.id}`);return a.jsx(id,{items:Ft,strategy:wm,children:Oe})}return a.jsxs("div",{className:"ide-sidebar",ref:wt,children:[a.jsxs("div",{className:"sidebar-header",children:[a.jsx("span",{className:"sidebar-header-title",children:"Workspaces"}),a.jsxs("div",{className:"sidebar-header-actions",children:[a.jsx("button",{className:`sidebar-add sidebar-filter${ce?" active":""}`,title:ce?`Show automatic sessions (${gn.size} hidden)`:"Hide automatic sessions — the ones mini apps run on their own. Sessions you message, stop, rewind, rename or star stay visible.","aria-label":ce?"Show automatic sessions":"Hide automatic sessions","aria-pressed":ce,onClick:Et,children:ce?a.jsx(w1,{size:14}):a.jsx(ms,{size:14})}),a.jsx("button",{className:"sidebar-add",title:"Add workspace",onClick:()=>m(),children:a.jsx(fs,{size:14})})]})]}),a.jsxs(zv,{sensors:zt,collisionDetection:Sv,onDragStart:mr,onDragEnd:tr,children:[ln.length===0?a.jsx("div",{className:"empty-state",style:{padding:"16px"},children:"No workspaces yet. Click + to add one."}):ln.map(R=>{const pe=Z.has(R.path),ae=Ue.get(R.path)??[],we=new Set(ae.map(Oe=>Oe.id)),Le=km(R,ae,we,Q),Ge=Le[Le.length-1];return a.jsxs("div",{className:`tree-section ${pe?"collapsed":""}`,children:[a.jsxs("div",{className:"tree-section-header",onClick:()=>nt(R.path),onContextMenu:Oe=>{Oe.preventDefault(),le({x:Oe.clientX,y:Oe.clientY,type:"workspace",path:R.path})},children:[a.jsx(No,{size:9,className:"tree-chevron"}),a.jsx(wl,{size:14}),a.jsx("span",{className:"tree-section-label",children:R.label}),a.jsx("button",{className:"tree-section-add",title:"New session in this workspace",onClick:Oe=>{Oe.stopPropagation(),g(R.path)},children:a.jsx(fs,{size:11})}),a.jsx("button",{className:"tree-section-add",title:"New folder in this workspace",onClick:Oe=>{Oe.stopPropagation(),hr(R.path)},children:a.jsx(zu,{size:11})}),a.jsx("span",{className:"tree-count",children:R.sessions.length})]}),!pe&&a.jsxs("div",{className:"tree-children",children:[a.jsx(id,{items:ae.map(Oe=>`f:${Oe.id}`),strategy:wm,children:Le.filter(Oe=>Oe.folder).map(Oe=>a.jsx(nb,{folder:Oe.folder,count:Oe.sessions.length,collapsed:Oe.hidden,renaming:(Ne==null?void 0:Ne.kind)==="folder"&&Ne.id===Oe.folder.id,renameValue:he,renameRef:tn,onRenameValue:Se,onRenameConfirm:Mn,onRenameCancel:Ln,onToggle:()=>gt(Oe.folder.id),onCtxMenu:Ft=>{Ft.preventDefault(),le({x:Ft.clientX,y:Ft.clientY,type:"folder",folderId:Oe.folder.id,folderName:Oe.folder.name})},children:a.jsx(bm,{id:`c:${R.path}|${Oe.folder.id}`,children:Ot(Oe)})},Oe.folder.id))}),a.jsx(bm,{id:`c:${R.path}|root`,children:Ot(Ge)})]})]},R.path)}),a.jsx(OS,{children:He&&a.jsxs("div",{className:"drag-overlay",children:[He.kind==="folder"&&a.jsx(wl,{size:12}),a.jsx("span",{children:He.label})]})})]}),a.jsxs("div",{className:"sidebar-apps",children:[a.jsxs("div",{className:"sidebar-header sidebar-apps-header",children:[a.jsx("span",{className:"sidebar-header-title",children:"Apps"}),a.jsx("button",{className:"sidebar-add",title:"Add mini app",onClick:()=>Me(),children:a.jsx(fs,{size:14})})]}),K.length===0&&a.jsx("div",{className:"tree-empty",children:"No apps yet"}),K.map(R=>{const pe=vn(R.id),ae=pe.sessions.length>0&&!pe.hidden;return a.jsxs("div",{className:"sidebar-app-block",children:[a.jsxs("div",{className:`sidebar-app-row${te===R.id?" active":""}`,title:R.description??void 0,onClick:()=>me(R.id),onContextMenu:we=>{we.preventDefault(),le({x:we.clientX,y:we.clientY,type:"app",appId:R.id,appPinned:R.pinned})},children:[pe.sessions.length>0&&a.jsx("button",{className:`sidebar-app-chevron${ae?"":" closed"}`,title:"Edit sessions of this app",onClick:we=>{we.stopPropagation(),an(R.id)},children:a.jsx(No,{size:10,className:"tree-chevron"})}),a.jsx(jo,{iconNode:R.iconNode,size:14,className:"sidebar-app-icon"}),a.jsx("span",{className:"tree-label",children:R.title}),pe.sessions.length>0&&a.jsx("span",{className:"sidebar-app-count",children:pe.sessions.length}),R.pinned&&a.jsx(kl,{size:10,className:"sidebar-app-pin",fill:"currentColor"})]}),ae&&a.jsx("div",{className:"sidebar-app-edits",children:Ot(pe,"app")})]},R.id)})]}),a.jsxs("div",{className:"sidebar-footer",onClick:()=>m(),children:[a.jsx(zu,{size:14}),a.jsx("span",{children:"Add workspace"})]}),X&&a.jsxs("div",{ref:Ht,className:"ctx-menu",style:{position:"fixed",left:X.x,top:X.y,zIndex:500},children:[X.type==="workspace"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{g(X.path),le(null)},children:[a.jsx(fs,{size:12})," New Session"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{hr(X.path),le(null)},children:[a.jsx(zu,{size:12})," New Folder"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{v(X.path),le(null)},children:[a.jsx(av,{size:12})," Import Claude Code Sessions…"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{p(X.path),le(null)},children:[a.jsx(ur,{size:12})," Hide Workspace"]})]}),X.type==="folder"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{dt("folder",X.folderId,X.folderName??""),le(null)},children:[a.jsx(ll,{size:12})," Rename Folder"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{I(X.folderId),le(null)},children:[a.jsx(ur,{size:12})," Delete Folder"]})]}),X.type==="session"&&!X.multi&&a.jsx(a.Fragment,{children:X.sessionLifecycle!=="finished"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{dt("session",X.sessionId,X.sessionTitle??""),le(null)},children:[a.jsx(ll,{size:12})," Rename"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{x(X.sessionId),le(null)},children:[a.jsx(xl,{size:12})," Mark as Finished"]}),a.jsxs("div",{className:`ctx-menu-item${X.sessionExternalId?"":" ctx-disabled"}`,title:X.sessionExternalId?void 0:"Session not started",onClick:()=>{X.sessionExternalId&&(Mi(X.sessionExternalId),le(null))},children:[a.jsx(Ri,{size:12})," Copy Session ID"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{d(X.sessionId),le(null)},children:[a.jsx(ur,{size:12})," Delete Session"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{C(X.sessionId),le(null)},children:[a.jsx(Ai,{size:12})," Reopen"]}),a.jsxs("div",{className:`ctx-menu-item${X.sessionExternalId?"":" ctx-disabled"}`,title:X.sessionExternalId?void 0:"Session not started",onClick:()=>{X.sessionExternalId&&(Mi(X.sessionExternalId),le(null))},children:[a.jsx(Ri,{size:12})," Copy Session ID"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{d(X.sessionId),le(null)},children:[a.jsx(ur,{size:12})," Delete Session"]})]})}),X.type==="session"&&X.multi&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-header",children:[ft.length," sessions selected"]}),Kt.length>0&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{S(Kt),le(null),Lt()},children:[a.jsx(xl,{size:12})," Mark ",Kt.length," as Finished"]}),vt.length>0&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{T(vt),le(null),Lt()},children:[a.jsx(Ai,{size:12})," Reopen ",vt.length]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{j([...ct]),le(null),Lt()},children:[a.jsx(ur,{size:12})," Delete ",ft.length," Sessions"]})]}),X.type==="app"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{ue(X.appId),le(null)},children:[a.jsx(ll,{size:12})," Edit App"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{ye(X.appId),le(null)},children:[a.jsx(kl,{size:12})," ",X.appPinned?"Unpin":"Pin"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{be(X.appId),le(null)},children:[a.jsx(ur,{size:12})," Delete App"]})]})]})]})}const Ja=4,sb=({transform:t})=>({...t,y:0});function Nm({tabKey:t,title:r,active:s,icon:i,badge:l,onSelect:c,onClose:d,onMenu:p}){const{attributes:g,listeners:m,setNodeRef:v,transform:k,transition:x,isDragging:S}=Ud({id:t});return a.jsxs("div",{ref:v,style:{transform:Cr.Translate.toString(k),transition:x},className:`ide-tab ${s?"active":""} ${S?"dragging":""}`,title:r,...g,...m,onClick:c,onMouseDown:N=>{N.button===1&&N.preventDefault()},onAuxClick:N=>{N.button===1&&d()},onContextMenu:N=>{N.preventDefault(),N.stopPropagation(),p(N.clientX,N.clientY)},children:[i,r,l,a.jsx("span",{className:"ide-tab-close",onClick:N=>{N.stopPropagation(),d()},children:a.jsx(Nn,{size:12})})]})}function ob({menu:t,tabs:r,onDone:s}){const i=A(k=>k.closeTabs),l=A(k=>k.reopenClosedTab),c=A(k=>k.closedTabs.some(x=>Fg(k,x.key))),d=y.useRef(null),[p,g]=y.useState({left:t.x,top:t.y});Oi(d,s,!0),Eo(s,!0),y.useLayoutEffect(()=>{if(!d.current)return;const{width:k,height:x}=d.current.getBoundingClientRect();g({left:Math.max(Ja,Math.min(t.x,window.innerWidth-k-Ja)),top:Math.max(Ja,Math.min(t.y,window.innerHeight-x-Ja))})},[t.x,t.y]);const m=t.key!==null&&r.includes(t.key)?t.key:null,v=(k,x,S=!1)=>a.jsx("div",{role:"menuitem","aria-disabled":S,className:`ctx-menu-item ${S?"ctx-disabled":""}`,onClick:()=>{S||(x(),s())},children:k});return a.jsxs("div",{ref:d,role:"menu",className:"ctx-menu",style:{position:"fixed",...p,zIndex:500},children:[m!==null&&a.jsxs(a.Fragment,{children:[v("Close",()=>i([m])),v("Close Others",()=>i(r.filter(k=>k!==m)),r.length<2),v("Close to the Right",()=>i(r.slice(r.indexOf(m)+1)),r.at(-1)===m),v("Close All",()=>i(r))]}),v("Reopen Closed Tab",l,!c)]})}function ib(){const t=A(L=>L.tabOrder),r=A(L=>L.activeSessionId),s=A(L=>L.sessions),i=A(L=>L.backgroundTasks),l=A(L=>L.selectSession),c=A(L=>L.closeTab),d=A(L=>L.setShowNewSessionDialog),p=A(L=>L.apps),g=A(L=>L.activeAppTabId),m=A(L=>L.openAppTab),v=A(L=>L.closeAppTab),k=A(L=>L.moveTab),[x,S]=y.useState(null),N=y.useRef(null),C=kv(wv(Hl,{activationConstraint:{distance:5}})),T=Nd({activeSessionId:r,activeAppTabId:g});y.useEffect(()=>{var L,q,K;(K=(q=(L=N.current)==null?void 0:L.querySelector(".ide-tab.active"))==null?void 0:q.scrollIntoView)==null||K.call(q,{block:"nearest",inline:"nearest"})},[T]);const j=t.filter(L=>{const{kind:q,id:K}=ps(L);return q==="app"||s.some($=>$.id===K)}),E=({active:L,over:q})=>{q&&k(String(L.id),String(q.id))},H=L=>{L.preventDefault(),S({x:L.clientX,y:L.clientY,key:null})},I=L=>{var ue;const{kind:q,id:K}=ps(L),$=(ye,be)=>S({x:ye,y:be,key:L});if(q==="app"){const ye=p.find(be=>be.id===K);return a.jsx(Nm,{tabKey:L,title:(ye==null?void 0:ye.title)??K,active:g===K,icon:a.jsx(jo,{iconNode:ye==null?void 0:ye.iconNode,size:12,className:"miniapp-tab-icon"}),onSelect:()=>m(K),onClose:()=>v(K),onMenu:$},L)}const te=s.find(ye=>ye.id===K);if(!te)return null;const me=zl(te,((ue=i[K])==null?void 0:ue.length)??0);return a.jsx(Nm,{tabKey:L,title:te.title||K.slice(0,8),active:r===K&&g==null,icon:a.jsx(Md,{iconClass:me.iconClass,iconText:me.iconText,size:14}),badge:me.dot&&a.jsx(Dd,{status:me.dot,title:me.dotTitle}),onSelect:()=>void l(K),onClose:()=>c(K),onMenu:$},L)};return a.jsxs(zv,{sensors:C,collisionDetection:Sv,modifiers:[sb],onDragEnd:E,children:[a.jsx(id,{items:j,strategy:FS,children:a.jsxs("div",{ref:N,className:"ide-tabs",onContextMenu:H,onWheel:L=>{L.deltaX===0&&(L.currentTarget.scrollLeft+=L.deltaY)},children:[j.map(I),a.jsx("div",{className:"ide-tab-add",title:"New Session",onClick:()=>d(!0),children:a.jsx(fs,{size:14})})]})}),x&&a.jsx(ob,{menu:x,tabs:j,onDone:()=>S(null)})]})}function Wd(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Us=Wd();function Gv(t){Us=t}var Ni={exec:()=>null};function rt(t,r=""){let s=typeof t=="string"?t:t.source;const i={replace:(l,c)=>{let d=typeof c=="string"?c:c.source;return d=d.replace(bn.caret,"$1"),s=s.replace(l,d),i},getRegex:()=>new RegExp(s,r)};return i}var bn={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},ab=/^(?:[ \t]*(?:\n|$))+/,lb=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,cb=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Bi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ub=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Hd=/(?:[*+-]|\d{1,9}[.)])/,qv=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Xv=rt(qv).replace(/bull/g,Hd).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(),db=rt(qv).replace(/bull/g,Hd).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(),Vd=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,fb=/^[^\n]+/,Kd=/(?!\s*\])(?:\\.|[^\[\]\\])+/,pb=rt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Kd).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),hb=rt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Hd).getRegex(),Gl="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",Gd=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,mb=rt("^ {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",Gd).replace("tag",Gl).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Yv=rt(Vd).replace("hr",Bi).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",Gl).getRegex(),gb=rt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Yv).getRegex(),qd={blockquote:gb,code:lb,def:pb,fences:cb,heading:ub,hr:Bi,html:mb,lheading:Xv,list:hb,newline:ab,paragraph:Yv,table:Ni,text:fb},Tm=rt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Bi).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",Gl).getRegex(),vb={...qd,lheading:db,table:Tm,paragraph:rt(Vd).replace("hr",Bi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Tm).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",Gl).getRegex()},yb={...qd,html:rt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Gd).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:Ni,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:rt(Vd).replace("hr",Bi).replace("heading",` *#{1,6} *[^
450
+ ]`).replace("lheading",Xv).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},xb=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,wb=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Qv=/^( {2,}|\\)\n(?!\s*$)/,kb=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ql=/[\p{P}\p{S}]/u,Xd=/[\s\p{P}\p{S}]/u,Zv=/[^\s\p{P}\p{S}]/u,Sb=rt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Xd).getRegex(),Jv=/(?!~)[\p{P}\p{S}]/u,bb=/(?!~)[\s\p{P}\p{S}]/u,Nb=/(?:[^\s\p{P}\p{S}]|~)/u,Tb=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,ey=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Cb=rt(ey,"u").replace(/punct/g,ql).getRegex(),Eb=rt(ey,"u").replace(/punct/g,Jv).getRegex(),ty="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",jb=rt(ty,"gu").replace(/notPunctSpace/g,Zv).replace(/punctSpace/g,Xd).replace(/punct/g,ql).getRegex(),_b=rt(ty,"gu").replace(/notPunctSpace/g,Nb).replace(/punctSpace/g,bb).replace(/punct/g,Jv).getRegex(),Rb=rt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Zv).replace(/punctSpace/g,Xd).replace(/punct/g,ql).getRegex(),Ab=rt(/\\(punct)/,"gu").replace(/punct/g,ql).getRegex(),Ib=rt(/^<(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(),Db=rt(Gd).replace("(?:-->|$)","-->").getRegex(),Mb=rt("^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",Db).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),_l=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Lb=rt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",_l).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ny=rt(/^!?\[(label)\]\[(ref)\]/).replace("label",_l).replace("ref",Kd).getRegex(),ry=rt(/^!?\[(ref)\](?:\[\])?/).replace("ref",Kd).getRegex(),Ob=rt("reflink|nolink(?!\\()","g").replace("reflink",ny).replace("nolink",ry).getRegex(),Yd={_backpedal:Ni,anyPunctuation:Ab,autolink:Ib,blockSkip:Tb,br:Qv,code:wb,del:Ni,emStrongLDelim:Cb,emStrongRDelimAst:jb,emStrongRDelimUnd:Rb,escape:xb,link:Lb,nolink:ry,punctuation:Sb,reflink:ny,reflinkSearch:Ob,tag:Mb,text:kb,url:Ni},Pb={...Yd,link:rt(/^!?\[(label)\]\((.*?)\)/).replace("label",_l).getRegex(),reflink:rt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",_l).getRegex()},cd={...Yd,emStrongRDelimAst:_b,emStrongLDelim:Eb,url:rt(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},$b={...cd,br:rt(Qv).replace("{2,}","*").getRegex(),text:rt(cd.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},el={normal:qd,gfm:vb,pedantic:yb},fi={normal:Yd,gfm:cd,breaks:$b,pedantic:Pb},zb={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Cm=t=>zb[t];function Nr(t,r){if(r){if(bn.escapeTest.test(t))return t.replace(bn.escapeReplace,Cm)}else if(bn.escapeTestNoEncode.test(t))return t.replace(bn.escapeReplaceNoEncode,Cm);return t}function Em(t){try{t=encodeURI(t).replace(bn.percentDecode,"%")}catch{return null}return t}function jm(t,r){var c;const s=t.replace(bn.findPipe,(d,p,g)=>{let m=!1,v=p;for(;--v>=0&&g[v]==="\\";)m=!m;return m?"|":" |"}),i=s.split(bn.splitPipe);let l=0;if(i[0].trim()||i.shift(),i.length>0&&!((c=i.at(-1))!=null&&c.trim())&&i.pop(),r)if(i.length>r)i.splice(r);else for(;i.length<r;)i.push("");for(;l<i.length;l++)i[l]=i[l].trim().replace(bn.slashPipe,"|");return i}function pi(t,r,s){const i=t.length;if(i===0)return"";let l=0;for(;l<i&&t.charAt(i-l-1)===r;)l++;return t.slice(0,i-l)}function Fb(t,r){if(t.indexOf(r[1])===-1)return-1;let s=0;for(let i=0;i<t.length;i++)if(t[i]==="\\")i++;else if(t[i]===r[0])s++;else if(t[i]===r[1]&&(s--,s<0))return i;return s>0?-2:-1}function _m(t,r,s,i,l){const c=r.href,d=r.title||null,p=t[1].replace(l.other.outputLinkReplace,"$1");i.state.inLink=!0;const g={type:t[0].charAt(0)==="!"?"image":"link",raw:s,href:c,title:d,text:p,tokens:i.inlineTokens(p)};return i.state.inLink=!1,g}function Ub(t,r,s){const i=t.match(s.other.indentCodeCompensation);if(i===null)return r;const l=i[1];return r.split(`
451
+ `).map(c=>{const d=c.match(s.other.beginningSpace);if(d===null)return c;const[p]=d;return p.length>=l.length?c.slice(l.length):c}).join(`
452
+ `)}var Rl=class{constructor(t){ot(this,"options");ot(this,"rules");ot(this,"lexer");this.options=t||Us}space(t){const r=this.rules.block.newline.exec(t);if(r&&r[0].length>0)return{type:"space",raw:r[0]}}code(t){const r=this.rules.block.code.exec(t);if(r){const s=r[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:r[0],codeBlockStyle:"indented",text:this.options.pedantic?s:pi(s,`
453
+ `)}}}fences(t){const r=this.rules.block.fences.exec(t);if(r){const s=r[0],i=Ub(s,r[3]||"",this.rules);return{type:"code",raw:s,lang:r[2]?r[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):r[2],text:i}}}heading(t){const r=this.rules.block.heading.exec(t);if(r){let s=r[2].trim();if(this.rules.other.endingHash.test(s)){const i=pi(s,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(s=i.trim())}return{type:"heading",raw:r[0],depth:r[1].length,text:s,tokens:this.lexer.inline(s)}}}hr(t){const r=this.rules.block.hr.exec(t);if(r)return{type:"hr",raw:pi(r[0],`
454
+ `)}}blockquote(t){const r=this.rules.block.blockquote.exec(t);if(r){let s=pi(r[0],`
455
+ `).split(`
456
+ `),i="",l="";const c=[];for(;s.length>0;){let d=!1;const p=[];let g;for(g=0;g<s.length;g++)if(this.rules.other.blockquoteStart.test(s[g]))p.push(s[g]),d=!0;else if(!d)p.push(s[g]);else break;s=s.slice(g);const m=p.join(`
457
+ `),v=m.replace(this.rules.other.blockquoteSetextReplace,`
458
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
459
+ ${m}`:m,l=l?`${l}
460
+ ${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,s.length===0)break;const x=c.at(-1);if((x==null?void 0:x.type)==="code")break;if((x==null?void 0:x.type)==="blockquote"){const S=x,N=S.raw+`
461
+ `+s.join(`
462
+ `),C=this.blockquote(N);c[c.length-1]=C,i=i.substring(0,i.length-S.raw.length)+C.raw,l=l.substring(0,l.length-S.text.length)+C.text;break}else if((x==null?void 0:x.type)==="list"){const S=x,N=S.raw+`
463
+ `+s.join(`
464
+ `),C=this.list(N);c[c.length-1]=C,i=i.substring(0,i.length-x.raw.length)+C.raw,l=l.substring(0,l.length-S.raw.length)+C.raw,s=N.substring(c.at(-1).raw.length).split(`
465
+ `);continue}}return{type:"blockquote",raw:i,tokens:c,text:l}}}list(t){let r=this.rules.block.list.exec(t);if(r){let s=r[1].trim();const i=s.length>1,l={type:"list",raw:"",ordered:i,start:i?+s.slice(0,-1):"",loose:!1,items:[]};s=i?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=i?s:"[*+-]");const c=this.rules.other.listItemRegex(s);let d=!1;for(;t;){let g=!1,m="",v="";if(!(r=c.exec(t))||this.rules.block.hr.test(t))break;m=r[0],t=t.substring(m.length);let k=r[2].split(`
466
+ `,1)[0].replace(this.rules.other.listReplaceTabs,j=>" ".repeat(3*j.length)),x=t.split(`
467
+ `,1)[0],S=!k.trim(),N=0;if(this.options.pedantic?(N=2,v=k.trimStart()):S?N=r[1].length+1:(N=r[2].search(this.rules.other.nonSpaceChar),N=N>4?1:N,v=k.slice(N),N+=r[1].length),S&&this.rules.other.blankLine.test(x)&&(m+=x+`
468
+ `,t=t.substring(x.length+1),g=!0),!g){const j=this.rules.other.nextBulletRegex(N),E=this.rules.other.hrRegex(N),H=this.rules.other.fencesBeginRegex(N),I=this.rules.other.headingBeginRegex(N),L=this.rules.other.htmlBeginRegex(N);for(;t;){const q=t.split(`
469
+ `,1)[0];let K;if(x=q,this.options.pedantic?(x=x.replace(this.rules.other.listReplaceNesting," "),K=x):K=x.replace(this.rules.other.tabCharGlobal," "),H.test(x)||I.test(x)||L.test(x)||j.test(x)||E.test(x))break;if(K.search(this.rules.other.nonSpaceChar)>=N||!x.trim())v+=`
470
+ `+K.slice(N);else{if(S||k.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||H.test(k)||I.test(k)||E.test(k))break;v+=`
471
+ `+x}!S&&!x.trim()&&(S=!0),m+=q+`
472
+ `,t=t.substring(q.length+1),k=K.slice(N)}}l.loose||(d?l.loose=!0:this.rules.other.doubleBlankLine.test(m)&&(d=!0));let C=null,T;this.options.gfm&&(C=this.rules.other.listIsTask.exec(v),C&&(T=C[0]!=="[ ] ",v=v.replace(this.rules.other.listReplaceTask,""))),l.items.push({type:"list_item",raw:m,task:!!C,checked:T,loose:!1,text:v,tokens:[]}),l.raw+=m}const p=l.items.at(-1);if(p)p.raw=p.raw.trimEnd(),p.text=p.text.trimEnd();else return;l.raw=l.raw.trimEnd();for(let g=0;g<l.items.length;g++)if(this.lexer.state.top=!1,l.items[g].tokens=this.lexer.blockTokens(l.items[g].text,[]),!l.loose){const m=l.items[g].tokens.filter(k=>k.type==="space"),v=m.length>0&&m.some(k=>this.rules.other.anyLine.test(k.raw));l.loose=v}if(l.loose)for(let g=0;g<l.items.length;g++)l.items[g].loose=!0;return l}}html(t){const r=this.rules.block.html.exec(t);if(r)return{type:"html",block:!0,raw:r[0],pre:r[1]==="pre"||r[1]==="script"||r[1]==="style",text:r[0]}}def(t){const r=this.rules.block.def.exec(t);if(r){const s=r[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=r[2]?r[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",l=r[3]?r[3].substring(1,r[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):r[3];return{type:"def",tag:s,raw:r[0],href:i,title:l}}}table(t){var d;const r=this.rules.block.table.exec(t);if(!r||!this.rules.other.tableDelimiter.test(r[2]))return;const s=jm(r[1]),i=r[2].replace(this.rules.other.tableAlignChars,"").split("|"),l=(d=r[3])!=null&&d.trim()?r[3].replace(this.rules.other.tableRowBlankLine,"").split(`
473
+ `):[],c={type:"table",raw:r[0],header:[],align:[],rows:[]};if(s.length===i.length){for(const p of i)this.rules.other.tableAlignRight.test(p)?c.align.push("right"):this.rules.other.tableAlignCenter.test(p)?c.align.push("center"):this.rules.other.tableAlignLeft.test(p)?c.align.push("left"):c.align.push(null);for(let p=0;p<s.length;p++)c.header.push({text:s[p],tokens:this.lexer.inline(s[p]),header:!0,align:c.align[p]});for(const p of l)c.rows.push(jm(p,c.header.length).map((g,m)=>({text:g,tokens:this.lexer.inline(g),header:!1,align:c.align[m]})));return c}}lheading(t){const r=this.rules.block.lheading.exec(t);if(r)return{type:"heading",raw:r[0],depth:r[2].charAt(0)==="="?1:2,text:r[1],tokens:this.lexer.inline(r[1])}}paragraph(t){const r=this.rules.block.paragraph.exec(t);if(r){const s=r[1].charAt(r[1].length-1)===`
474
+ `?r[1].slice(0,-1):r[1];return{type:"paragraph",raw:r[0],text:s,tokens:this.lexer.inline(s)}}}text(t){const r=this.rules.block.text.exec(t);if(r)return{type:"text",raw:r[0],text:r[0],tokens:this.lexer.inline(r[0])}}escape(t){const r=this.rules.inline.escape.exec(t);if(r)return{type:"escape",raw:r[0],text:r[1]}}tag(t){const r=this.rules.inline.tag.exec(t);if(r)return!this.lexer.state.inLink&&this.rules.other.startATag.test(r[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(r[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(r[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(r[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:r[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:r[0]}}link(t){const r=this.rules.inline.link.exec(t);if(r){const s=r[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(s)){if(!this.rules.other.endAngleBracket.test(s))return;const c=pi(s.slice(0,-1),"\\");if((s.length-c.length)%2===0)return}else{const c=Fb(r[2],"()");if(c===-2)return;if(c>-1){const p=(r[0].indexOf("!")===0?5:4)+r[1].length+c;r[2]=r[2].substring(0,c),r[0]=r[0].substring(0,p).trim(),r[3]=""}}let i=r[2],l="";if(this.options.pedantic){const c=this.rules.other.pedanticHrefTitle.exec(i);c&&(i=c[1],l=c[3])}else l=r[3]?r[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(s)?i=i.slice(1):i=i.slice(1,-1)),_m(r,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:l&&l.replace(this.rules.inline.anyPunctuation,"$1")},r[0],this.lexer,this.rules)}}reflink(t,r){let s;if((s=this.rules.inline.reflink.exec(t))||(s=this.rules.inline.nolink.exec(t))){const i=(s[2]||s[1]).replace(this.rules.other.multipleSpaceGlobal," "),l=r[i.toLowerCase()];if(!l){const c=s[0].charAt(0);return{type:"text",raw:c,text:c}}return _m(s,l,s[0],this.lexer,this.rules)}}emStrong(t,r,s=""){let i=this.rules.inline.emStrongLDelim.exec(t);if(!i||i[3]&&s.match(this.rules.other.unicodeAlphaNumeric))return;if(!(i[1]||i[2]||"")||!s||this.rules.inline.punctuation.exec(s)){const c=[...i[0]].length-1;let d,p,g=c,m=0;const v=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(v.lastIndex=0,r=r.slice(-1*t.length+c);(i=v.exec(r))!=null;){if(d=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!d)continue;if(p=[...d].length,i[3]||i[4]){g+=p;continue}else if((i[5]||i[6])&&c%3&&!((c+p)%3)){m+=p;continue}if(g-=p,g>0)continue;p=Math.min(p,p+g+m);const k=[...i[0]][0].length,x=t.slice(0,c+i.index+k+p);if(Math.min(c,p)%2){const N=x.slice(1,-1);return{type:"em",raw:x,text:N,tokens:this.lexer.inlineTokens(N)}}const S=x.slice(2,-2);return{type:"strong",raw:x,text:S,tokens:this.lexer.inlineTokens(S)}}}}codespan(t){const r=this.rules.inline.code.exec(t);if(r){let s=r[2].replace(this.rules.other.newLineCharGlobal," ");const i=this.rules.other.nonSpaceChar.test(s),l=this.rules.other.startingSpaceChar.test(s)&&this.rules.other.endingSpaceChar.test(s);return i&&l&&(s=s.substring(1,s.length-1)),{type:"codespan",raw:r[0],text:s}}}br(t){const r=this.rules.inline.br.exec(t);if(r)return{type:"br",raw:r[0]}}del(t){const r=this.rules.inline.del.exec(t);if(r)return{type:"del",raw:r[0],text:r[2],tokens:this.lexer.inlineTokens(r[2])}}autolink(t){const r=this.rules.inline.autolink.exec(t);if(r){let s,i;return r[2]==="@"?(s=r[1],i="mailto:"+s):(s=r[1],i=s),{type:"link",raw:r[0],text:s,href:i,tokens:[{type:"text",raw:s,text:s}]}}}url(t){var s;let r;if(r=this.rules.inline.url.exec(t)){let i,l;if(r[2]==="@")i=r[0],l="mailto:"+i;else{let c;do c=r[0],r[0]=((s=this.rules.inline._backpedal.exec(r[0]))==null?void 0:s[0])??"";while(c!==r[0]);i=r[0],r[1]==="www."?l="http://"+r[0]:l=r[0]}return{type:"link",raw:r[0],text:i,href:l,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(t){const r=this.rules.inline.text.exec(t);if(r){const s=this.lexer.state.inRawBlock;return{type:"text",raw:r[0],text:r[0],escaped:s}}}},Pr=class ud{constructor(r){ot(this,"tokens");ot(this,"options");ot(this,"state");ot(this,"tokenizer");ot(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=r||Us,this.options.tokenizer=this.options.tokenizer||new Rl,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 s={other:bn,block:el.normal,inline:fi.normal};this.options.pedantic?(s.block=el.pedantic,s.inline=fi.pedantic):this.options.gfm&&(s.block=el.gfm,this.options.breaks?s.inline=fi.breaks:s.inline=fi.gfm),this.tokenizer.rules=s}static get rules(){return{block:el,inline:fi}}static lex(r,s){return new ud(s).lex(r)}static lexInline(r,s){return new ud(s).inlineTokens(r)}lex(r){r=r.replace(bn.carriageReturn,`
475
+ `),this.blockTokens(r,this.tokens);for(let s=0;s<this.inlineQueue.length;s++){const i=this.inlineQueue[s];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(r,s=[],i=!1){var l,c,d;for(this.options.pedantic&&(r=r.replace(bn.tabCharGlobal," ").replace(bn.spaceLine,""));r;){let p;if((c=(l=this.options.extensions)==null?void 0:l.block)!=null&&c.some(m=>(p=m.call({lexer:this},r,s))?(r=r.substring(p.raw.length),s.push(p),!0):!1))continue;if(p=this.tokenizer.space(r)){r=r.substring(p.raw.length);const m=s.at(-1);p.raw.length===1&&m!==void 0?m.raw+=`
476
+ `:s.push(p);continue}if(p=this.tokenizer.code(r)){r=r.substring(p.raw.length);const m=s.at(-1);(m==null?void 0:m.type)==="paragraph"||(m==null?void 0:m.type)==="text"?(m.raw+=`
477
+ `+p.raw,m.text+=`
478
+ `+p.text,this.inlineQueue.at(-1).src=m.text):s.push(p);continue}if(p=this.tokenizer.fences(r)){r=r.substring(p.raw.length),s.push(p);continue}if(p=this.tokenizer.heading(r)){r=r.substring(p.raw.length),s.push(p);continue}if(p=this.tokenizer.hr(r)){r=r.substring(p.raw.length),s.push(p);continue}if(p=this.tokenizer.blockquote(r)){r=r.substring(p.raw.length),s.push(p);continue}if(p=this.tokenizer.list(r)){r=r.substring(p.raw.length),s.push(p);continue}if(p=this.tokenizer.html(r)){r=r.substring(p.raw.length),s.push(p);continue}if(p=this.tokenizer.def(r)){r=r.substring(p.raw.length);const m=s.at(-1);(m==null?void 0:m.type)==="paragraph"||(m==null?void 0:m.type)==="text"?(m.raw+=`
479
+ `+p.raw,m.text+=`
480
+ `+p.raw,this.inlineQueue.at(-1).src=m.text):this.tokens.links[p.tag]||(this.tokens.links[p.tag]={href:p.href,title:p.title});continue}if(p=this.tokenizer.table(r)){r=r.substring(p.raw.length),s.push(p);continue}if(p=this.tokenizer.lheading(r)){r=r.substring(p.raw.length),s.push(p);continue}let g=r;if((d=this.options.extensions)!=null&&d.startBlock){let m=1/0;const v=r.slice(1);let k;this.options.extensions.startBlock.forEach(x=>{k=x.call({lexer:this},v),typeof k=="number"&&k>=0&&(m=Math.min(m,k))}),m<1/0&&m>=0&&(g=r.substring(0,m+1))}if(this.state.top&&(p=this.tokenizer.paragraph(g))){const m=s.at(-1);i&&(m==null?void 0:m.type)==="paragraph"?(m.raw+=`
481
+ `+p.raw,m.text+=`
482
+ `+p.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):s.push(p),i=g.length!==r.length,r=r.substring(p.raw.length);continue}if(p=this.tokenizer.text(r)){r=r.substring(p.raw.length);const m=s.at(-1);(m==null?void 0:m.type)==="text"?(m.raw+=`
483
+ `+p.raw,m.text+=`
484
+ `+p.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):s.push(p);continue}if(r){const m="Infinite loop on byte: "+r.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return this.state.top=!0,s}inline(r,s=[]){return this.inlineQueue.push({src:r,tokens:s}),s}inlineTokens(r,s=[]){var p,g,m;let i=r,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(i))!=null;)v.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(l=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,l.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(l=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)i=i.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let c=!1,d="";for(;r;){c||(d=""),c=!1;let v;if((g=(p=this.options.extensions)==null?void 0:p.inline)!=null&&g.some(x=>(v=x.call({lexer:this},r,s))?(r=r.substring(v.raw.length),s.push(v),!0):!1))continue;if(v=this.tokenizer.escape(r)){r=r.substring(v.raw.length),s.push(v);continue}if(v=this.tokenizer.tag(r)){r=r.substring(v.raw.length),s.push(v);continue}if(v=this.tokenizer.link(r)){r=r.substring(v.raw.length),s.push(v);continue}if(v=this.tokenizer.reflink(r,this.tokens.links)){r=r.substring(v.raw.length);const x=s.at(-1);v.type==="text"&&(x==null?void 0:x.type)==="text"?(x.raw+=v.raw,x.text+=v.text):s.push(v);continue}if(v=this.tokenizer.emStrong(r,i,d)){r=r.substring(v.raw.length),s.push(v);continue}if(v=this.tokenizer.codespan(r)){r=r.substring(v.raw.length),s.push(v);continue}if(v=this.tokenizer.br(r)){r=r.substring(v.raw.length),s.push(v);continue}if(v=this.tokenizer.del(r)){r=r.substring(v.raw.length),s.push(v);continue}if(v=this.tokenizer.autolink(r)){r=r.substring(v.raw.length),s.push(v);continue}if(!this.state.inLink&&(v=this.tokenizer.url(r))){r=r.substring(v.raw.length),s.push(v);continue}let k=r;if((m=this.options.extensions)!=null&&m.startInline){let x=1/0;const S=r.slice(1);let N;this.options.extensions.startInline.forEach(C=>{N=C.call({lexer:this},S),typeof N=="number"&&N>=0&&(x=Math.min(x,N))}),x<1/0&&x>=0&&(k=r.substring(0,x+1))}if(v=this.tokenizer.inlineText(k)){r=r.substring(v.raw.length),v.raw.slice(-1)!=="_"&&(d=v.raw.slice(-1)),c=!0;const x=s.at(-1);(x==null?void 0:x.type)==="text"?(x.raw+=v.raw,x.text+=v.text):s.push(v);continue}if(r){const x="Infinite loop on byte: "+r.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return s}},Al=class{constructor(t){ot(this,"options");ot(this,"parser");this.options=t||Us}space(t){return""}code({text:t,lang:r,escaped:s}){var c;const i=(c=(r||"").match(bn.notSpaceStart))==null?void 0:c[0],l=t.replace(bn.endingNewline,"")+`
485
+ `;return i?'<pre><code class="language-'+Nr(i)+'">'+(s?l:Nr(l,!0))+`</code></pre>
486
+ `:"<pre><code>"+(s?l:Nr(l,!0))+`</code></pre>
487
+ `}blockquote({tokens:t}){return`<blockquote>
488
+ ${this.parser.parse(t)}</blockquote>
489
+ `}html({text:t}){return t}heading({tokens:t,depth:r}){return`<h${r}>${this.parser.parseInline(t)}</h${r}>
490
+ `}hr(t){return`<hr>
491
+ `}list(t){const r=t.ordered,s=t.start;let i="";for(let d=0;d<t.items.length;d++){const p=t.items[d];i+=this.listitem(p)}const l=r?"ol":"ul",c=r&&s!==1?' start="'+s+'"':"";return"<"+l+c+`>
492
+ `+i+"</"+l+`>
493
+ `}listitem(t){var s;let r="";if(t.task){const i=this.checkbox({checked:!!t.checked});t.loose?((s=t.tokens[0])==null?void 0:s.type)==="paragraph"?(t.tokens[0].text=i+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=i+" "+Nr(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:i+" ",text:i+" ",escaped:!0}):r+=i+" "}return r+=this.parser.parse(t.tokens,!!t.loose),`<li>${r}</li>
494
+ `}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
495
+ `}table(t){let r="",s="";for(let l=0;l<t.header.length;l++)s+=this.tablecell(t.header[l]);r+=this.tablerow({text:s});let i="";for(let l=0;l<t.rows.length;l++){const c=t.rows[l];s="";for(let d=0;d<c.length;d++)s+=this.tablecell(c[d]);i+=this.tablerow({text:s})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
496
+ <thead>
497
+ `+r+`</thead>
498
+ `+i+`</table>
499
+ `}tablerow({text:t}){return`<tr>
500
+ ${t}</tr>
501
+ `}tablecell(t){const r=this.parser.parseInline(t.tokens),s=t.header?"th":"td";return(t.align?`<${s} align="${t.align}">`:`<${s}>`)+r+`</${s}>
502
+ `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Nr(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:r,tokens:s}){const i=this.parser.parseInline(s),l=Em(t);if(l===null)return i;t=l;let c='<a href="'+t+'"';return r&&(c+=' title="'+Nr(r)+'"'),c+=">"+i+"</a>",c}image({href:t,title:r,text:s,tokens:i}){i&&(s=this.parser.parseInline(i,this.parser.textRenderer));const l=Em(t);if(l===null)return Nr(s);t=l;let c=`<img src="${t}" alt="${s}"`;return r&&(c+=` title="${Nr(r)}"`),c+=">",c}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Nr(t.text)}},Qd=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},$r=class dd{constructor(r){ot(this,"options");ot(this,"renderer");ot(this,"textRenderer");this.options=r||Us,this.options.renderer=this.options.renderer||new Al,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Qd}static parse(r,s){return new dd(s).parse(r)}static parseInline(r,s){return new dd(s).parseInline(r)}parse(r,s=!0){var l,c;let i="";for(let d=0;d<r.length;d++){const p=r[d];if((c=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&c[p.type]){const m=p,v=this.options.extensions.renderers[m.type].call({parser:this},m);if(v!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(m.type)){i+=v||"";continue}}const g=p;switch(g.type){case"space":{i+=this.renderer.space(g);continue}case"hr":{i+=this.renderer.hr(g);continue}case"heading":{i+=this.renderer.heading(g);continue}case"code":{i+=this.renderer.code(g);continue}case"table":{i+=this.renderer.table(g);continue}case"blockquote":{i+=this.renderer.blockquote(g);continue}case"list":{i+=this.renderer.list(g);continue}case"html":{i+=this.renderer.html(g);continue}case"paragraph":{i+=this.renderer.paragraph(g);continue}case"text":{let m=g,v=this.renderer.text(m);for(;d+1<r.length&&r[d+1].type==="text";)m=r[++d],v+=`
503
+ `+this.renderer.text(m);s?i+=this.renderer.paragraph({type:"paragraph",raw:v,text:v,tokens:[{type:"text",raw:v,text:v,escaped:!0}]}):i+=v;continue}default:{const m='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return i}parseInline(r,s=this.renderer){var l,c;let i="";for(let d=0;d<r.length;d++){const p=r[d];if((c=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&c[p.type]){const m=this.options.extensions.renderers[p.type].call({parser:this},p);if(m!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(p.type)){i+=m||"";continue}}const g=p;switch(g.type){case"escape":{i+=s.text(g);break}case"html":{i+=s.html(g);break}case"link":{i+=s.link(g);break}case"image":{i+=s.image(g);break}case"strong":{i+=s.strong(g);break}case"em":{i+=s.em(g);break}case"codespan":{i+=s.codespan(g);break}case"br":{i+=s.br(g);break}case"del":{i+=s.del(g);break}case"text":{i+=s.text(g);break}default:{const m='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return i}},Qu,ul=(Qu=class{constructor(t){ot(this,"options");ot(this,"block");this.options=t||Us}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?Pr.lex:Pr.lexInline}provideParser(){return this.block?$r.parse:$r.parseInline}},ot(Qu,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),Qu),Bb=class{constructor(...t){ot(this,"defaults",Wd());ot(this,"options",this.setOptions);ot(this,"parse",this.parseMarkdown(!0));ot(this,"parseInline",this.parseMarkdown(!1));ot(this,"Parser",$r);ot(this,"Renderer",Al);ot(this,"TextRenderer",Qd);ot(this,"Lexer",Pr);ot(this,"Tokenizer",Rl);ot(this,"Hooks",ul);this.use(...t)}walkTokens(t,r){var i,l;let s=[];for(const c of t)switch(s=s.concat(r.call(this,c)),c.type){case"table":{const d=c;for(const p of d.header)s=s.concat(this.walkTokens(p.tokens,r));for(const p of d.rows)for(const g of p)s=s.concat(this.walkTokens(g.tokens,r));break}case"list":{const d=c;s=s.concat(this.walkTokens(d.items,r));break}default:{const d=c;(l=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&l[d.type]?this.defaults.extensions.childTokens[d.type].forEach(p=>{const g=d[p].flat(1/0);s=s.concat(this.walkTokens(g,r))}):d.tokens&&(s=s.concat(this.walkTokens(d.tokens,r)))}}return s}use(...t){const r=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(s=>{const i={...s};if(i.async=this.defaults.async||i.async||!1,s.extensions&&(s.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){const c=r.renderers[l.name];c?r.renderers[l.name]=function(...d){let p=l.renderer.apply(this,d);return p===!1&&(p=c.apply(this,d)),p}:r.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=r[l.level];c?c.unshift(l.tokenizer):r[l.level]=[l.tokenizer],l.start&&(l.level==="block"?r.startBlock?r.startBlock.push(l.start):r.startBlock=[l.start]:l.level==="inline"&&(r.startInline?r.startInline.push(l.start):r.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(r.childTokens[l.name]=l.childTokens)}),i.extensions=r),s.renderer){const l=this.defaults.renderer||new Al(this.defaults);for(const c in s.renderer){if(!(c in l))throw new Error(`renderer '${c}' does not exist`);if(["options","parser"].includes(c))continue;const d=c,p=s.renderer[d],g=l[d];l[d]=(...m)=>{let v=p.apply(l,m);return v===!1&&(v=g.apply(l,m)),v||""}}i.renderer=l}if(s.tokenizer){const l=this.defaults.tokenizer||new Rl(this.defaults);for(const c in s.tokenizer){if(!(c in l))throw new Error(`tokenizer '${c}' does not exist`);if(["options","rules","lexer"].includes(c))continue;const d=c,p=s.tokenizer[d],g=l[d];l[d]=(...m)=>{let v=p.apply(l,m);return v===!1&&(v=g.apply(l,m)),v}}i.tokenizer=l}if(s.hooks){const l=this.defaults.hooks||new ul;for(const c in s.hooks){if(!(c in l))throw new Error(`hook '${c}' does not exist`);if(["options","block"].includes(c))continue;const d=c,p=s.hooks[d],g=l[d];ul.passThroughHooks.has(c)?l[d]=m=>{if(this.defaults.async)return Promise.resolve(p.call(l,m)).then(k=>g.call(l,k));const v=p.call(l,m);return g.call(l,v)}:l[d]=(...m)=>{let v=p.apply(l,m);return v===!1&&(v=g.apply(l,m)),v}}i.hooks=l}if(s.walkTokens){const l=this.defaults.walkTokens,c=s.walkTokens;i.walkTokens=function(d){let p=[];return p.push(c.call(this,d)),l&&(p=p.concat(l.call(this,d))),p}}this.defaults={...this.defaults,...i}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,r){return Pr.lex(t,r??this.defaults)}parser(t,r){return $r.parse(t,r??this.defaults)}parseMarkdown(t){return(s,i)=>{const l={...i},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 s>"u"||s===null)return d(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return d(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));c.hooks&&(c.hooks.options=c,c.hooks.block=t);const p=c.hooks?c.hooks.provideLexer():t?Pr.lex:Pr.lexInline,g=c.hooks?c.hooks.provideParser():t?$r.parse:$r.parseInline;if(c.async)return Promise.resolve(c.hooks?c.hooks.preprocess(s):s).then(m=>p(m,c)).then(m=>c.hooks?c.hooks.processAllTokens(m):m).then(m=>c.walkTokens?Promise.all(this.walkTokens(m,c.walkTokens)).then(()=>m):m).then(m=>g(m,c)).then(m=>c.hooks?c.hooks.postprocess(m):m).catch(d);try{c.hooks&&(s=c.hooks.preprocess(s));let m=p(s,c);c.hooks&&(m=c.hooks.processAllTokens(m)),c.walkTokens&&this.walkTokens(m,c.walkTokens);let v=g(m,c);return c.hooks&&(v=c.hooks.postprocess(v)),v}catch(m){return d(m)}}}onError(t,r){return s=>{if(s.message+=`
504
+ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An error occurred:</p><pre>"+Nr(s.message+"",!0)+"</pre>";return r?Promise.resolve(i):i}if(r)return Promise.reject(s);throw s}}},zs=new Bb;function Ke(t,r){return zs.parse(t,r)}Ke.options=Ke.setOptions=function(t){return zs.setOptions(t),Ke.defaults=zs.defaults,Gv(Ke.defaults),Ke};Ke.getDefaults=Wd;Ke.defaults=Us;Ke.use=function(...t){return zs.use(...t),Ke.defaults=zs.defaults,Gv(Ke.defaults),Ke};Ke.walkTokens=function(t,r){return zs.walkTokens(t,r)};Ke.parseInline=zs.parseInline;Ke.Parser=$r;Ke.parser=$r.parse;Ke.Renderer=Al;Ke.TextRenderer=Qd;Ke.Lexer=Pr;Ke.lexer=Pr.lex;Ke.Tokenizer=Rl;Ke.Hooks=ul;Ke.parse=Ke;Ke.options;Ke.setOptions;Ke.use;Ke.walkTokens;Ke.parseInline;$r.parse;Pr.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 Rm(t,r){(r==null||r>t.length)&&(r=t.length);for(var s=0,i=Array(r);s<r;s++)i[s]=t[s];return i}function Wb(t){if(Array.isArray(t))return t}function Hb(t,r){var s=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(s!=null){var i,l,c,d,p=[],g=!0,m=!1;try{if(c=(s=s.call(t)).next,r!==0)for(;!(g=(i=c.call(s)).done)&&(p.push(i.value),p.length!==r);g=!0);}catch(v){m=!0,l=v}finally{try{if(!g&&s.return!=null&&(d=s.return(),Object(d)!==d))return}finally{if(m)throw l}}return p}}function Vb(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
505
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Kb(t,r){return Wb(t)||Hb(t,r)||Gb(t,r)||Vb()}function Gb(t,r){if(t){if(typeof t=="string")return Rm(t,r);var s={}.toString.call(t).slice(8,-1);return s==="Object"&&t.constructor&&(s=t.constructor.name),s==="Map"||s==="Set"?Array.from(t):s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?Rm(t,r):void 0}}const sy=Object.entries,Am=Object.setPrototypeOf,qb=Object.isFrozen,Xb=Object.getPrototypeOf,Yb=Object.getOwnPropertyDescriptor;let sn=Object.freeze,on=Object.seal,yo=Object.create,oy=typeof Reflect<"u"&&Reflect,fd=oy.apply,pd=oy.construct;sn||(sn=function(r){return r});on||(on=function(r){return r});fd||(fd=function(r,s){for(var i=arguments.length,l=new Array(i>2?i-2:0),c=2;c<i;c++)l[c-2]=arguments[c];return r.apply(s,l)});pd||(pd=function(r){for(var s=arguments.length,i=new Array(s>1?s-1:0),l=1;l<s;l++)i[l-1]=arguments[l];return new r(...i)});const mo=$t(Array.prototype.forEach),Qb=$t(Array.prototype.lastIndexOf),Im=$t(Array.prototype.pop),go=$t(Array.prototype.push),Zb=$t(Array.prototype.splice),ds=Array.isArray,xi=$t(String.prototype.toLowerCase),Hu=$t(String.prototype.toString),Dm=$t(String.prototype.match),hi=$t(String.prototype.replace),Mm=$t(String.prototype.indexOf),Jb=$t(String.prototype.trim),eN=$t(Number.prototype.toString),tN=$t(Boolean.prototype.toString),Lm=typeof BigInt>"u"?null:$t(BigInt.prototype.toString),Om=typeof Symbol>"u"?null:$t(Symbol.prototype.toString),Zt=$t(Object.prototype.hasOwnProperty),mi=$t(Object.prototype.toString),Qt=$t(RegExp.prototype.test),Ms=nN(TypeError);function $t(t){return function(r){r instanceof RegExp&&(r.lastIndex=0);for(var s=arguments.length,i=new Array(s>1?s-1:0),l=1;l<s;l++)i[l-1]=arguments[l];return fd(t,r,i)}}function nN(t){return function(){for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return pd(t,s)}}function Ve(t,r){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:xi;if(Am&&Am(t,null),!ds(r))return t;let i=r.length;for(;i--;){let l=r[i];if(typeof l=="string"){const c=s(l);c!==l&&(qb(r)||(r[i]=c),l=c)}t[l]=!0}return t}function rN(t){for(let r=0;r<t.length;r++)Zt(t,r)||(t[r]=null);return t}function pn(t){const r=yo(null);for(const i of sy(t)){var s=Kb(i,2);const l=s[0],c=s[1];Zt(t,l)&&(ds(c)?r[l]=rN(c):c&&typeof c=="object"&&c.constructor===Object?r[l]=pn(c):r[l]=c)}return r}function sN(t){switch(typeof t){case"string":return t;case"number":return eN(t);case"boolean":return tN(t);case"bigint":return Lm?Lm(t):"0";case"symbol":return Om?Om(t):"Symbol()";case"undefined":return mi(t);case"function":case"object":{if(t===null)return mi(t);const r=t,s=lr(r,"toString");if(typeof s=="function"){const i=s(r);return typeof i=="string"?i:mi(i)}return mi(t)}default:return mi(t)}}function lr(t,r){for(;t!==null;){const i=Yb(t,r);if(i){if(i.get)return $t(i.get);if(typeof i.value=="function")return $t(i.value)}t=Xb(t)}function s(){return null}return s}function oN(t){try{return Qt(t,""),!0}catch{return!1}}const Pm=sn(["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"]),Vu=sn(["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"]),Ku=sn(["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"]),iN=sn(["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"]),Gu=sn(["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"]),aN=sn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),$m=sn(["#text"]),zm=sn(["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"]),qu=sn(["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"]),Fm=sn(["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"]),tl=sn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),lN=on(/{{[\w\W]*|^[\w\W]*}}/g),cN=on(/<%[\w\W]*|^[\w\W]*%>/g),uN=on(/\${[\w\W]*/g),dN=on(/^data-[\-\w.\u00B7-\uFFFF]+$/),fN=on(/^aria-[\-\w]+$/),Um=on(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),pN=on(/^(?:\w+script|data):/i),hN=on(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),mN=on(/^html$/i),gN=on(/^[a-z][.\w]*(-[.\w]+)+$/i),Bm=on(/<[/\w!]/g),Wm=on(/<[/\w]/g),vN=on(/<\/no(script|embed|frames)/i),yN=on(/\/>/i),Hn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},xN=function(){return typeof window>"u"?null:window},wN=function(r,s){if(typeof r!="object"||typeof r.createPolicy!="function")return null;let i=null;const l="data-tt-policy-suffix";s&&s.hasAttribute(l)&&(i=s.getAttribute(l));const c="dompurify"+(i?"#"+i:"");try{return r.createPolicy(c,{createHTML(d){return d},createScriptURL(d){return d}})}catch{return console.warn("TrustedTypes policy "+c+" could not be created."),null}},Hm=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},cs=function(r,s,i,l){return Zt(r,s)&&ds(r[s])?Ve(l.base?pn(l.base):{},r[s],l.transform):i};function iy(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:xN();const r=de=>iy(de);if(r.version="3.4.13",r.removed=[],!t||!t.document||t.document.nodeType!==Hn.document||!t.Element)return r.isSupported=!1,r;let s=t.document;const i=s,l=i.currentScript;t.DocumentFragment;const c=t.HTMLTemplateElement,d=t.Node,p=t.Element,g=t.NodeFilter,m=t.NamedNodeMap;m===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const v=t.DOMParser,k=t.trustedTypes,x=p.prototype,S=lr(x,"cloneNode"),N=lr(x,"remove"),C=lr(x,"nextSibling"),T=lr(x,"childNodes"),j=lr(x,"parentNode"),E=lr(x,"shadowRoot"),H=lr(x,"attributes"),I=d&&d.prototype?lr(d.prototype,"nodeType"):null,L=d&&d.prototype?lr(d.prototype,"nodeName"):null,q=d&&d.prototype?lr(d.prototype,"ownerDocument"):null;if(typeof c=="function"){const de=s.createElement("template");de.content&&de.content.ownerDocument&&(s=de.content.ownerDocument)}let K,$="",te,me=!1,ue=0;const ye=function(){if(ue>0)throw Ms('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.')},be=function(b){ye(),ue++;try{return K.createHTML(b)}finally{ue--}},Me=function(b){ye(),ue++;try{return K.createScriptURL(b)}finally{ue--}},Z=function(){return me||(te=wN(k,l),me=!0),te},oe=s,ie=oe.implementation,z=oe.createNodeIterator,Q=oe.createDocumentFragment,G=oe.getElementsByTagName,D=i.importNode;let P=Hm();r.isSupported=typeof sy=="function"&&typeof j=="function"&&ie&&ie.createHTMLDocument!==void 0;const ce=lN,B=cN,X=uN,le=dN,Ne=fN,re=pN,he=hN,Se=gN;let He=Um,_e=null;const ct=Ve({},[...Pm,...Vu,...Ku,...Gu,...$m]);let $e=null;const en=Ve({},[...zm,...qu,...Fm,...tl]);let Fe=Object.seal(yo(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ht=null,tn=null;const wt=Object.seal(yo(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ct=!0,zt=!0,Lt=!1,Y=!0,ge=!1,Ue=!0,nt=!1,mt=!1,gt=null,Et=null,an=!1,dt=!1,Mn=!1,Ln=!1,hr=!0,mr=!1;const tr="user-content-";let On=!0,gn=!1,ln={},Vt=null;const vn=Ve({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Qe=null;const jt=Ve({},["audio","video","img","source","image","track"]);let ft=null;const Kt=Ve({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),vt="http://www.w3.org/1998/Math/MathML",yt="http://www.w3.org/2000/svg",at="http://www.w3.org/1999/xhtml";let Gt=at,st=!1,Ot=null;const R=Ve({},[vt,yt,at],Hu),pe=sn(["mi","mo","mn","ms","mtext"]);let ae=Ve({},pe);const we=sn(["annotation-xml"]);let Le=Ve({},we);const Ge=Ve({},["title","style","font","a","script"]);let Oe=null;const Ft=["application/xhtml+xml","text/html"],Pn="text/html";let Be=null,yn=null;const Er=s.createElement("form"),Ur=function(b){return b instanceof RegExp||b instanceof Function},$n=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(yn&&yn===b)return;(!b||typeof b!="object")&&(b={}),b=pn(b),Oe=Ft.indexOf(b.PARSER_MEDIA_TYPE)===-1?Pn:b.PARSER_MEDIA_TYPE,Be=Oe==="application/xhtml+xml"?Hu:xi,_e=cs(b,"ALLOWED_TAGS",ct,{transform:Be}),$e=cs(b,"ALLOWED_ATTR",en,{transform:Be}),Ot=cs(b,"ALLOWED_NAMESPACES",R,{transform:Hu}),ft=cs(b,"ADD_URI_SAFE_ATTR",Kt,{transform:Be,base:Kt}),Qe=cs(b,"ADD_DATA_URI_TAGS",jt,{transform:Be,base:jt}),Vt=cs(b,"FORBID_CONTENTS",vn,{transform:Be}),Ht=cs(b,"FORBID_TAGS",pn({}),{transform:Be}),tn=cs(b,"FORBID_ATTR",pn({}),{transform:Be}),ln=Zt(b,"USE_PROFILES")?b.USE_PROFILES&&typeof b.USE_PROFILES=="object"?pn(b.USE_PROFILES):b.USE_PROFILES:!1,Ct=b.ALLOW_ARIA_ATTR!==!1,zt=b.ALLOW_DATA_ATTR!==!1,Lt=b.ALLOW_UNKNOWN_PROTOCOLS||!1,Y=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ge=b.SAFE_FOR_TEMPLATES||!1,Ue=b.SAFE_FOR_XML!==!1,nt=b.WHOLE_DOCUMENT||!1,dt=b.RETURN_DOM||!1,Mn=b.RETURN_DOM_FRAGMENT||!1,Ln=b.RETURN_TRUSTED_TYPE||!1,an=b.FORCE_BODY||!1,hr=b.SANITIZE_DOM!==!1,mr=b.SANITIZE_NAMED_PROPS||!1,On=b.KEEP_CONTENT!==!1,gn=b.IN_PLACE||!1,He=oN(b.ALLOWED_URI_REGEXP)?b.ALLOWED_URI_REGEXP:Um,Gt=typeof b.NAMESPACE=="string"?b.NAMESPACE:at,ae=Zt(b,"MATHML_TEXT_INTEGRATION_POINTS")&&b.MATHML_TEXT_INTEGRATION_POINTS&&typeof b.MATHML_TEXT_INTEGRATION_POINTS=="object"?pn(b.MATHML_TEXT_INTEGRATION_POINTS):Ve({},pe),Le=Zt(b,"HTML_INTEGRATION_POINTS")&&b.HTML_INTEGRATION_POINTS&&typeof b.HTML_INTEGRATION_POINTS=="object"?pn(b.HTML_INTEGRATION_POINTS):Ve({},we);const F=Zt(b,"CUSTOM_ELEMENT_HANDLING")&&b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING=="object"?pn(b.CUSTOM_ELEMENT_HANDLING):yo(null);if(Fe=yo(null),Zt(F,"tagNameCheck")&&Ur(F.tagNameCheck)&&(Fe.tagNameCheck=F.tagNameCheck),Zt(F,"attributeNameCheck")&&Ur(F.attributeNameCheck)&&(Fe.attributeNameCheck=F.attributeNameCheck),Zt(F,"allowCustomizedBuiltInElements")&&typeof F.allowCustomizedBuiltInElements=="boolean"&&(Fe.allowCustomizedBuiltInElements=F.allowCustomizedBuiltInElements),on(Fe),ge&&(zt=!1),Mn&&(dt=!0),ln&&(_e=Ve({},$m),$e=yo(null),ln.html===!0&&(Ve(_e,Pm),Ve($e,zm)),ln.svg===!0&&(Ve(_e,Vu),Ve($e,qu),Ve($e,tl)),ln.svgFilters===!0&&(Ve(_e,Ku),Ve($e,qu),Ve($e,tl)),ln.mathMl===!0&&(Ve(_e,Gu),Ve($e,Fm),Ve($e,tl))),wt.tagCheck=null,wt.attributeCheck=null,Zt(b,"ADD_TAGS")&&(typeof b.ADD_TAGS=="function"?wt.tagCheck=b.ADD_TAGS:ds(b.ADD_TAGS)&&(_e===ct&&(_e=pn(_e)),Ve(_e,b.ADD_TAGS,Be))),Zt(b,"ADD_ATTR")&&(typeof b.ADD_ATTR=="function"?wt.attributeCheck=b.ADD_ATTR:ds(b.ADD_ATTR)&&($e===en&&($e=pn($e)),Ve($e,b.ADD_ATTR,Be))),Zt(b,"ADD_URI_SAFE_ATTR")&&ds(b.ADD_URI_SAFE_ATTR)&&Ve(ft,b.ADD_URI_SAFE_ATTR,Be),Zt(b,"FORBID_CONTENTS")&&ds(b.FORBID_CONTENTS)&&(Vt===vn&&(Vt=pn(Vt)),Ve(Vt,b.FORBID_CONTENTS,Be)),Zt(b,"ADD_FORBID_CONTENTS")&&ds(b.ADD_FORBID_CONTENTS)&&(Vt===vn&&(Vt=pn(Vt)),Ve(Vt,b.ADD_FORBID_CONTENTS,Be)),On&&(_e["#text"]=!0),nt&&Ve(_e,["html","head","body"]),_e.table&&(Ve(_e,["tbody"]),delete Ht.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ms('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ms('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const J=K;K=b.TRUSTED_TYPES_POLICY;try{$=be("")}catch(Ce){throw K=J,Ce}}else b.TRUSTED_TYPES_POLICY===null?(K=void 0,$=""):(K===void 0&&(K=Z()),K&&typeof $=="string"&&($=be("")));sn&&sn(b),yn=b},gr=Ve({},[...Vu,...Ku,...iN]),Ze=Ve({},[...Gu,...aN]),_t=function(b,F,J){return F.namespaceURI===at?b==="svg":F.namespaceURI===vt?b==="svg"&&(J==="annotation-xml"||ae[J]):!!gr[b]},vr=function(b,F,J){return F.namespaceURI===at?b==="math":F.namespaceURI===yt?b==="math"&&Le[J]:!!Ze[b]},Xl=function(b,F,J){return F.namespaceURI===yt&&!Le[J]||F.namespaceURI===vt&&!ae[J]?!1:!Ze[b]&&(Ge[b]||!gr[b])},kt=function(b){let F=j(b);(!F||!F.tagName)&&(F={namespaceURI:Gt,tagName:"template"});const J=xi(b.tagName),Ce=xi(F.tagName);return Ot[b.namespaceURI]?b.namespaceURI===yt?_t(J,F,Ce):b.namespaceURI===vt?vr(J,F,Ce):b.namespaceURI===at?Xl(J,F,Ce):!!(Oe==="application/xhtml+xml"&&Ot[b.namespaceURI]):!1},yr=function(b){go(r.removed,{element:b});try{j(b).removeChild(b)}catch{if(N(b),!j(b))throw Ms("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Br=function(b){gs(b);const F=T(b);if(F){const Ce=[];mo(F,Re=>{go(Ce,Re)}),mo(Ce,Re=>{try{N(Re)}catch{}})}const J=H(b);if(J)for(let Ce=J.length-1;Ce>=0;--Ce){const Re=J[Ce],ze=Re&&Re.name;if(typeof ze=="string")try{b.removeAttribute(ze)}catch{}}},xr=function(b,F){try{go(r.removed,{attribute:F.getAttributeNode(b),from:F})}catch{go(r.removed,{attribute:null,from:F})}if(F.removeAttribute(b),b==="is")if(dt||Mn)try{yr(F)}catch{}else try{F.setAttribute(b,"")}catch{}},Bs=function(b){const F=H(b);if(F)for(let J=F.length-1;J>=0;--J){const Ce=F[J],Re=Ce&&Ce.name;if(!(typeof Re!="string"||$e[Be(Re)]))try{b.removeAttribute(Re)}catch{}}},gs=function(b){const F=[b];for(;F.length>0;){const J=F.pop();(I?I(J):J.nodeType)===Hn.element&&Bs(J);const Re=T(J);if(Re)for(let ze=Re.length-1;ze>=0;--ze)F.push(Re[ze])}},Wi=function(b){if(!Ue)return;const F=[b];for(;F.length>0;){const J=F.pop(),Ce=I?I(J):J.nodeType;if(Ce===Hn.processingInstruction||Ce===Hn.comment&&Qt(Wm,J.data)){try{N(J)}catch{}continue}if(Ce===Hn.element){const ze=J,Xe=Be(L?L(J):J.nodeName);try{ze.hasAttribute&&ze.hasAttribute("patchsrc")&&ze.removeAttribute("patchsrc"),ze.hasAttribute&&ze.hasAttribute("for")&&Xe!=="label"&&Xe!=="output"&&ze.removeAttribute("for")}catch{}}const Re=T(J);if(Re)for(let ze=Re.length-1;ze>=0;--ze)F.push(Re[ze])}},vs=function(b){let F=null,J=null;if(an)b="<remove></remove>"+b;else{const ze=Dm(b,/^[\r\n\t ]+/);J=ze&&ze[0]}Oe==="application/xhtml+xml"&&Gt===at&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const Ce=K?be(b):b;if(Gt===at)try{F=new v().parseFromString(Ce,Oe)}catch{}if(!F||!F.documentElement){F=ie.createDocument(Gt,"template",null);try{F.documentElement.innerHTML=st?$:Ce}catch{}}const Re=F.body||F.documentElement;return b&&J&&Re.insertBefore(s.createTextNode(J),Re.childNodes[0]||null),Gt===at?G.call(F,nt?"html":"body")[0]:nt?F.documentElement:Re},zn=function(b){const F=q?q(b):b.ownerDocument;return z.call(F||b,b,g.SHOW_ELEMENT|g.SHOW_COMMENT|g.SHOW_TEXT|g.SHOW_PROCESSING_INSTRUCTION|g.SHOW_CDATA_SECTION,null)},Ws=function(b){return b=hi(b,ce," "),b=hi(b,B," "),b=hi(b,X," "),b},xn=function(b){var F;b.normalize();const J=q?q(b):b.ownerDocument,Ce=z.call(J||b,b,g.SHOW_TEXT|g.SHOW_COMMENT|g.SHOW_CDATA_SECTION|g.SHOW_PROCESSING_INSTRUCTION,null);let Re=Ce.nextNode();for(;Re;)Re.data=Ws(Re.data),Re=Ce.nextNode();const ze=(F=b.querySelectorAll)===null||F===void 0?void 0:F.call(b,"template");ze&&mo(ze,Xe=>{Wr(Xe.content)&&xn(Xe.content)})},Hs=function(b){const F=L?L(b):null;return typeof F!="string"||Be(F)!=="form"?!1:typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||b.attributes!==H(b)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function"||b.nodeType!==I(b)||b.childNodes!==T(b)},Wr=function(b){if(!I||typeof b!="object"||b===null)return!1;try{return I(b)===Hn.documentFragment}catch{return!1}},ys=function(b){if(!I||typeof b!="object"||b===null)return!1;try{return typeof I(b)=="number"}catch{return!1}};function wn(de,b,F){de.length!==0&&mo(de,J=>{J.call(r,b,F,yn)})}const Vs=function(b,F){return!!(Ue&&b.hasChildNodes()&&!ys(b.firstElementChild)&&Qt(Bm,b.textContent)&&Qt(Bm,b.innerHTML)||Ue&&b.namespaceURI===at&&F==="style"&&ys(b.firstElementChild)||b.nodeType===Hn.processingInstruction||Ue&&b.nodeType===Hn.comment&&Qt(Wm,b.data))},xs=function(b,F,J){if(!Ht[F]&&Do(F)&&(Fe.tagNameCheck instanceof RegExp&&Qt(Fe.tagNameCheck,F)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(F)))return!1;if(On&&!Vt[F]){const Ce=j(b),Re=T(b);if(Re&&Ce){const ze=Re.length;for(let Xe=ze-1;Xe>=0;--Xe){const Je=b===J?S(Re[Xe],!0):Re[Xe];Ce.insertBefore(Je,C(b))}}}return yr(b),!0},ws=function(b,F,J,Ce){return b.length===0?F:F===J||F===Ce?pn(F):F},Hi=function(b,F){if(wn(P.beforeSanitizeElements,b,null),b!==F&&j(b)===null)return gn&&gs(b),!0;if(Hs(b))return yr(b),!0;const J=Be(L?L(b):b.nodeName);if(_e=ws(P.uponSanitizeElement,_e,ct,gt),wn(P.uponSanitizeElement,b,{tagName:J,allowedTags:_e}),b!==F&&j(b)===null)return gn&&gs(b),!0;if(Vs(b,J))return yr(b),!0;if(Ht[J]||!(wt.tagCheck instanceof Function&&wt.tagCheck(J))&&!_e[J]){const Re=xs(b,J,F);return Re===!1&&wn(P.afterSanitizeElements,b,null),Re}if((I?I(b):b.nodeType)===Hn.element&&!kt(b)||(J==="noscript"||J==="noembed"||J==="noframes")&&Qt(vN,b.innerHTML))return yr(b),!0;if(ge&&b.nodeType===Hn.text){const Re=Ws(b.textContent);b.textContent!==Re&&(go(r.removed,{element:b.cloneNode()}),b.textContent=Re)}return wn(P.afterSanitizeElements,b,null),!1},Vi=function(b,F,J){if(tn[F]||Ue&&F==="patchsrc"||Ue&&F==="for"&&b!=="label"&&b!=="output"||hr&&(F==="id"||F==="name")&&(J in s||J in Er))return!1;const Ce=$e[F]||wt.attributeCheck instanceof Function&&wt.attributeCheck(F,b);if(!(zt&&Qt(le,F))){if(!(Ct&&Qt(Ne,F))){if(Ce){if(!ft[F]){if(!Qt(He,hi(J,he,""))){if(!((F==="src"||F==="xlink:href"||F==="href")&&b!=="script"&&Mm(J,"data:")===0&&Qe[b])){if(!(Lt&&!Qt(re,hi(J,he,"")))){if(J)return!1}}}}}else if(!(Do(b)&&(Fe.tagNameCheck instanceof RegExp&&Qt(Fe.tagNameCheck,b)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(b))&&(Fe.attributeNameCheck instanceof RegExp&&Qt(Fe.attributeNameCheck,F)||Fe.attributeNameCheck instanceof Function&&Fe.attributeNameCheck(F,b))||F==="is"&&Fe.allowCustomizedBuiltInElements&&(Fe.tagNameCheck instanceof RegExp&&Qt(Fe.tagNameCheck,J)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(J))))return!1}}return!0},Io=Ve({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Do=function(b){return!Io[xi(b)]&&Qt(Se,b)},Mo=function(b,F,J,Ce){if(K&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!J)switch(k.getAttributeType(b,F)){case"TrustedHTML":return be(Ce);case"TrustedScriptURL":return Me(Ce)}return Ce},ks=function(b,F,J,Ce){try{J?b.setAttributeNS(J,F,Ce):b.setAttribute(F,Ce),Hs(b)?yr(b):Im(r.removed)}catch{xr(F,b)}},Ki=function(b){wn(P.beforeSanitizeAttributes,b,null);const F=b.attributes;if(!F||Hs(b))return;$e=ws(P.uponSanitizeAttribute,$e,en,Et);const J={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:$e,forceKeepAttr:void 0};let Ce=F.length;const Re=Be(b.nodeName);for(;Ce--;){const ze=F[Ce],Xe=ze.name,Je=ze.namespaceURI,St=ze.value,bt=Be(Xe),jr=St;let At=Xe==="value"?jr:Jb(jr);if(J.attrName=bt,J.attrValue=At,J.keepAttr=!0,J.forceKeepAttr=void 0,wn(P.uponSanitizeAttribute,b,J),At=J.attrValue,mr&&(bt==="id"||bt==="name")&&Mm(At,tr)!==0&&(xr(Xe,b),At=tr+At),Ue&&Qt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,At)){xr(Xe,b);continue}if(bt==="attributename"&&Dm(At,"href")){xr(Xe,b);continue}if(!J.forceKeepAttr){if(!J.keepAttr){xr(Xe,b);continue}if(!Y&&Qt(yN,At)){xr(Xe,b);continue}if(ge&&(At=Ws(At)),!Vi(Re,bt,At)){xr(Xe,b);continue}At=Mo(Re,bt,Je,At),At!==jr&&ks(b,Xe,Je,At)}}wn(P.afterSanitizeAttributes,b,null)},Hr=function(b){let F=null;const J=zn(b);for(wn(P.beforeSanitizeShadowDOM,b,null);F=J.nextNode();)if(wn(P.uponSanitizeShadowNode,F,null),Hi(F,b),Ki(F),Wr(F.content)&&Hr(F.content),(I?I(F):F.nodeType)===Hn.element){const Re=E(F);Wr(Re)&&(qe(Re),Hr(Re))}wn(P.afterSanitizeShadowDOM,b,null)},qe=function(b){const F=[{node:b,shadow:null}];for(;F.length>0;){const J=F.pop();if(J.shadow){Hr(J.shadow);continue}const Ce=J.node,ze=(I?I(Ce):Ce.nodeType)===Hn.element,Xe=T(Ce);if(Xe)for(let Je=Xe.length-1;Je>=0;--Je)F.push({node:Xe[Je],shadow:null});if(ze){const Je=L?L(Ce):null;if(typeof Je=="string"&&Be(Je)==="template"){const St=Ce.content;Wr(St)&&F.push({node:St,shadow:null})}}if(ze){const Je=E(Ce);Wr(Je)&&F.push({node:null,shadow:Je},{node:Je,shadow:null})}}};return r.sanitize=function(de){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},F=null,J=null,Ce=null,Re=null;if(st=!de,st&&(de="<!-->"),typeof de!="string"&&!ys(de)&&(de=sN(de),typeof de!="string"))throw Ms("dirty is not a string, aborting");if(!r.isSupported)return de;mt?(_e=gt,$e=Et):$n(b),(P.uponSanitizeElement.length>0||P.uponSanitizeAttribute.length>0)&&(_e=pn(_e)),P.uponSanitizeAttribute.length>0&&($e=pn($e)),r.removed=[];const ze=gn&&typeof de!="string"&&ys(de);if(ze){Wi(de);const St=L?L(de):de.nodeName;if(typeof St=="string"){const bt=Be(St);if(!_e[bt]||Ht[bt])throw Br(de),Ms("root node is forbidden and cannot be sanitized in-place")}if(Hs(de))throw Br(de),Ms("root node is clobbered and cannot be sanitized in-place");try{qe(de)}catch(bt){throw Br(de),bt}}else if(ys(de))F=vs("<!---->"),J=F.ownerDocument.importNode(de,!0),J.nodeType===Hn.element&&J.nodeName==="BODY"||J.nodeName==="HTML"?F=J:F.appendChild(J),qe(J);else{if(!dt&&!ge&&!nt&&de.indexOf("<")===-1)return K&&Ln?be(de):de;if(F=vs(de),!F)return dt?null:Ln?$:""}F&&an&&yr(F.firstChild);const Xe=ze?de:F;try{const St=zn(Xe);for(;Ce=St.nextNode();)Hi(Ce,Xe),Ki(Ce),Wr(Ce.content)&&Hr(Ce.content)}catch(St){throw ze&&(Br(de),mo(r.removed,bt=>{bt.element&&gs(bt.element)})),St}if(ze)return mo(r.removed,St=>{St.element&&gs(St.element)}),ge&&xn(de),de;if(dt){if(ge&&xn(F),Mn)for(Re=Q.call(F.ownerDocument);F.firstChild;)Re.appendChild(F.firstChild);else Re=F;return($e.shadowroot||$e.shadowrootmode)&&(Re=D.call(i,Re,!0)),Re}let Je=nt?F.outerHTML:F.innerHTML;return nt&&_e["!doctype"]&&F.ownerDocument&&F.ownerDocument.doctype&&F.ownerDocument.doctype.name&&Qt(mN,F.ownerDocument.doctype.name)&&(Je="<!DOCTYPE "+F.ownerDocument.doctype.name+`>
506
+ `+Je),ge&&(Je=Ws(Je)),K&&Ln?be(Je):Je},r.setConfig=function(){let de=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};$n(de),mt=!0,gt=_e,Et=$e},r.clearConfig=function(){yn=null,mt=!1,gt=null,Et=null,K=te,$=""},r.isValidAttribute=function(de,b,F){yn||$n({});const J=Be(de),Ce=Be(b);return Vi(J,Ce,F)},r.addHook=function(de,b){typeof b=="function"&&Zt(P,de)&&go(P[de],b)},r.removeHook=function(de,b){if(Zt(P,de)){if(b!==void 0){const F=Qb(P[de],b);return F===-1?void 0:Zb(P[de],F,1)[0]}return Im(P[de])}},r.removeHooks=function(de){Zt(P,de)&&(P[de]=[])},r.removeAllHooks=function(){P=Hm()},r}var Zd=iy();const kN=new Set(["command_execution","file_change","mcp_tool_call","web_search"]),SN=100;function Vm(t){return kN.has(t.type)}function bN({items:t,runtimeType:r,turn:s,threads:i=[]}){const[l,c]=y.useState(!1),[d,p]=y.useState(!1);if(t.length===0)return null;const g=t.length,m=d?0:Math.max(0,g-SN),v=m>0?t.slice(m):t;return a.jsxs("div",{className:"tool-calls",children:[a.jsxs("div",{className:"tool-calls-header",onClick:()=>c(k=>!k),children:[a.jsx("span",{className:"tool-calls-icon",children:a.jsx(nk,{size:12})}),a.jsxs("span",{className:"tool-calls-summary",children:[g," tool call",g>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:()=>p(!0),children:["Show ",m," earlier tool call",m>1?"s":""]})}),v.map(k=>a.jsx(Ls,{item:k,runtimeType:r,turn:s,threads:i},k.id))]})]})}Ke.setOptions({breaks:!0,gfm:!0});function NN(t){const r=Ke.parse(t);return Zd.sanitize(r)}function Km(t,r){var l;const s=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);let i=0;for(;s.nextNode();){const c=s.currentNode,d=((l=c.textContent)==null?void 0:l.length)??0;if(i+d>r)return{node:c,offset:r-i};i+=d}return null}function TN(t,r,s){const i=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),l=[];for(;i.nextNode();){const c=i.currentNode;if(!c.textContent||c.textContent.trim()==="")continue;const d=document.createRange();d.selectNodeContents(c),!(d.compareBoundaryPoints(Range.START_TO_END,r)<=0)&&(d.compareBoundaryPoints(Range.END_TO_START,r)>=0||l.push(c))}for(const c of l){const d=c.length;let p=0,g=d;if(c===r.startContainer&&(p=Math.min(r.startOffset,d)),c===r.endContainer&&(g=Math.min(r.endOffset,d)),p>=g)continue;g<d&&c.splitText(g);const m=p>0?c.splitText(p):c,v=s(),k=m.parentNode;k&&(k.insertBefore(v,m),v.appendChild(m))}}function CN(t,r){t.querySelectorAll("mark[data-thread-id]").forEach(s=>{const i=s.parentNode;if(!i)return;const l=document.createTextNode(s.textContent||"");i.replaceChild(l,s),i.normalize()});for(const s of r){if(s.start_offset===null||s.end_offset===null)continue;const i=Km(t,s.start_offset),l=Km(t,s.end_offset);if(!i||!l)continue;const c=document.createRange();c.setStart(i.node,i.offset),c.setEnd(l.node,l.offset),TN(t,c,()=>{const d=document.createElement("mark");return d.setAttribute("data-thread-id",s.id),s.status==="resolved"&&d.classList.add("thread-mark-resolved"),d})}}function EN(t){const r=window.getSelection();if(!r||r.rangeCount===0)return null;const s=r.getRangeAt(0);if(s.collapsed||!t.contains(s.commonAncestorContainer))return null;const i=document.createRange();i.setStart(t,0),i.setEnd(s.startContainer,s.startOffset);const l=i.toString().length,c=s.toString();return{start:l,end:l+c.length,text:c}}function jN({itemId:t,turnId:r,sessionId:s,content:i,threads:l}){const c=y.useRef(null),d=y.useRef(null),p=y.useRef(null),g=y.useRef(""),m=y.useRef(0),[v,k]=y.useState(!1),[x,S]=y.useState({x:0,y:0}),[N,C]=y.useState(!1),[T,j]=y.useState({x:0,y:0}),[E,H]=y.useState(""),[I,L]=y.useState(null),[q,K]=y.useState(!1),$=A(G=>G.createThread),te=A(G=>G.switchRightTab),me=A(G=>Ol(G.sessionDetails[s])),ue=y.useCallback(async()=>{await Mi(i||""),K(!0),setTimeout(()=>K(!1),1500)},[i]),ye=y.useCallback(()=>{var D;if(!I)return;const G=`
507
+ \`\`\`QUOTE
508
+ ${I.text}
509
+ \`\`\`
510
+
511
+ `;A.setState({quotedText:G}),k(!1),L(null),(D=window.getSelection())==null||D.removeAllRanges()},[I]),be=y.useMemo(()=>NN(i||"…"),[i]),Me=y.useMemo(()=>l.filter(G=>G.item_id===t),[l,t]);y.useEffect(()=>{c.current&&CN(c.current,Me)},[be,Me]),y.useEffect(()=>{g.current=E},[E]),y.useEffect(()=>{function G(D){d.current&&!d.current.contains(D.target)&&(k(!1),g.current.trim()||C(!1))}return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[]);const Z=y.useCallback(()=>{k(!1),g.current.trim()||C(!1)},[]),oe=y.useCallback(()=>{const G=c.current;if(!G)return;const D=EN(G);if(D&&D.text.trim().length>0){const P=window.getSelection();if(P&&P.rangeCount>0&&P.anchorNode&&P.focusNode){const B=P.getRangeAt(0).getBoundingClientRect(),X=28,le=6,Ne=170;let re=!1;try{const He=document.createRange();He.setStart(P.focusNode,P.focusOffset),He.setEnd(P.focusNode,P.focusOffset);const _e=document.createRange();_e.setStart(P.anchorNode,P.anchorOffset),_e.setEnd(P.anchorNode,P.anchorOffset),re=_e.compareBoundaryPoints(Range.START_TO_START,He)>0}catch{re=!1}let he=B.top-X-le;he<8&&(he=B.bottom+le);let Se=re?B.left-Ne:B.right;Se=Math.max(8,Math.min(Se,window.innerWidth-Ne-8)),S({x:Se,y:he}),k(!0),L(D)}}else k(!1)},[]);y.useEffect(()=>{function G(D){const P=D.target;P&&(P.closest(".selection-actions")||P.closest(".thread-create-popover"))||oe()}return document.addEventListener("mouseup",G),()=>document.removeEventListener("mouseup",G)},[oe]);const ie=y.useCallback(()=>{k(!1),C(!0),j({x:x.x,y:x.y})},[x]);y.useLayoutEffect(()=>{if(!N)return;const G=p.current;if(!G)return;const D=G.offsetWidth,P=G.offsetHeight,ce=8;let B=x.x,X=x.y;B-D<ce&&(B=D+ce),B>window.innerWidth-ce&&(B=window.innerWidth-ce),X<ce&&(X=ce),X+P>window.innerHeight-ce&&(X=window.innerHeight-P-ce),j({x:B,y:X})},[N,x]);const z=y.useCallback(async()=>{var G;me||!I||!E.trim()||(await $(s,{itemId:t,turnId:r,startOffset:I.start,endOffset:I.end,selectedText:I.text,message:E.trim()}),H(""),C(!1),L(null),(G=window.getSelection())==null||G.removeAllRanges(),te("threads"))},[I,E,$,s,t,r,te,me]),Q=y.useCallback(G=>{const D=G.target;if(D.tagName==="MARK"&&D.hasAttribute("data-thread-id")){G.preventDefault(),te("threads");const P=D.getAttribute("data-thread-id");setTimeout(()=>{const ce=document.getElementById(`thread-${P}`);ce&&(ce.scrollIntoView({behavior:"smooth",block:"center"}),ce.classList.add("thread-card-highlighted"),setTimeout(()=>ce.classList.remove("thread-card-highlighted"),1500))},100)}},[te]);return a.jsxs("div",{className:"copy-text-wrapper",style:{position:"relative"},ref:d,children:[a.jsx("div",{ref:c,dangerouslySetInnerHTML:{__html:be},onMouseDown:Z,onClick:Q}),a.jsx("button",{className:`copy-text-btn${q?" copied":""}`,onClick:ue,title:q?"Copied":"Copy message","aria-label":"Copy message text",children:q?a.jsx(Tr,{size:14}):a.jsx(Ri,{size:14})}),v&&!N&&a.jsxs("div",{className:"selection-actions",style:{left:x.x,top:x.y},children:[!me&&a.jsxs("button",{className:"discuss-button",onClick:ie,title:"Start a discussion about this text",children:[a.jsx(z1,{size:14}),a.jsx("span",{children:"Discuss"})]}),a.jsxs("button",{className:"discuss-button",onClick:ye,title:"Quote this text in your message",children:[a.jsx(uv,{size:14}),a.jsx("span",{children:"Quote"})]})]}),N&&a.jsxs("div",{ref:p,className:"thread-create-popover",style:{left:T.x,top:T.y},children:[a.jsxs("div",{className:"thread-create-header",children:[a.jsxs("span",{className:"thread-create-quote",children:['"',I==null?void 0:I.text.slice(0,80),I&&I.text.length>80?"…":"",'"']}),a.jsx("button",{className:"thread-create-close",onClick:()=>{C(!1),L(null)},children:a.jsx(Nn,{size:14})})]}),a.jsx("textarea",{className:"thread-create-input",placeholder:"Ask about this text…",value:E,onChange:G=>H(G.target.value),autoFocus:!0,rows:2,onKeyDown:G=>{if(G.key==="Enter"&&(G.metaKey||G.ctrlKey)&&(G.preventDefault(),z()),G.key==="Escape")if(g.current.trim()){const D=Date.now();m.current&&D-m.current<400?(m.current=0,C(!1),L(null)):m.current=D}else C(!1),L(null)}}),a.jsxs("div",{className:"thread-create-footer",children:[a.jsx("span",{className:"thread-create-hint",children:"⌘↵ to send · Esc to cancel"}),a.jsxs("button",{className:"thread-create-send",onClick:z,disabled:!E.trim()||me,title:me?"Wait for the running turn to finish first":void 0,children:[a.jsx(Pi,{size:13}),a.jsx("span",{children:"Send"})]})]})]})]})}const Gm=y.memo(jN),Il=new Map,ay=new Set,hd=new Set,qm=new Map;function ly(){hd.forEach(t=>t())}function cy(t,r){return`${t}:${r}`}function _N(t,r,s,i,l){var g;const c=cy(r,s),d=Il.get(t)??new Map,p=new Map(d);((g=p.get(c))==null?void 0:g.answer)===l?p.delete(c):p.set(c,{itemIndex:r,groupIndex:s,question:i,answer:l}),Il.set(t,p),ly()}function RN(t){Il.delete(t),ly()}function AN(t){ay.add(t),RN(t)}function IN(t){const r=y.useCallback(s=>(hd.add(s),()=>{hd.delete(s)}),[]);return y.useSyncExternalStore(r,()=>Il.get(t)??qm,()=>qm)}function DN(t){return[...t].sort((r,s)=>r.itemIndex-s.itemIndex||r.groupIndex-s.groupIndex).map(r=>`> ${r.question}
512
+ ${r.answer}`).join(`
513
+
514
+ `)}function Xm({item:t,turn:r}){var S;const s=t.data??{},i=y.useMemo(()=>Array.isArray(s.groups)?s.groups.filter(N=>!!N&&Array.isArray(N.selections)&&N.selections.length>0):[],[s.groups]),l=IN(r.id),c=A(N=>r.session_id?N.sessionDetails[r.session_id]:null),d=A(N=>N.activeSessionId),p=r.items.filter(N=>N.type==="ask_user"||N.type==="final_result").findIndex(N=>N.id===t.id),g=c?((S=c.turns[c.turns.length-1])==null?void 0:S.id)===r.id:!0,m=ay.has(r.id),v=m||$g(c)||!g||r.session_id!==d,k=(N,C,T)=>{v||_N(r.id,p,N,C,T)},x=()=>{const N=[...l.values()];if(N.length===0)return;const C=DN(N);AN(r.id),A.getState().submitPrompt(C)};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(b1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Question"}),m&&a.jsx("span",{className:"turn-header-meta",children:"answered"})]}),i.length>0?a.jsxs("div",{className:"ask-user-groups",children:[i.map((N,C)=>a.jsxs("div",{className:"ask-user-group",children:[N.question&&a.jsx("div",{className:"ask-user-question",children:N.question}),a.jsx("div",{className:"ask-user-options",children:N.selections.map(T=>{var E;const j=((E=l.get(cy(p,C)))==null?void 0:E.answer)===T;return a.jsx("button",{type:"button",className:`ask-user-option ${j?"selected":""}`,disabled:v,onClick:()=>k(C,N.question,T),children:T},T)})})]},C)),v?m&&a.jsx("div",{className:"ask-user-submitted",children:"Answer sent"}):a.jsxs("button",{type:"button",className:"ask-user-send",disabled:l.size===0,onClick:x,children:[a.jsx(Pi,{size:12}),"Send"]})]}):s.question?a.jsx("p",{className:"user-message",children:s.question}):a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:"Waiting for user response"})]})}const MN={host_shutdown:"host shutdown",host_restart:"host restart",process_exit:"agent process stopped",network:"network error",auth:"signed out",usage_limit:"usage limit"};function dl(t){return t&&MN[t]||"interrupted"}function Dl(t){if(!t)return"";const r=new Date(t);return Number.isNaN(r.getTime())?"":r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function LN(t){switch(t.interrupt_reason){case"network":return"Interrupted — network error. Will resume when the connection is back.";case"auth":return"Interrupted — Claude is signed out. Sign in again from a terminal, then resume.";case"usage_limit":{const r=Dl(t.resume_at);return r?`Usage limit reached — resumes at ${r}.`:"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 ON(t){return t.items.filter(r=>r.type==="interruption").map(r=>r.data)}function PN({item:t}){const r=t.data,s=Dl(r.interrupted_at);let i="";switch(r.outcome){case"waiting":i="waiting to resume";break;case"resuming":i="resuming…";break;case"resumed":i=r.resumed_at?`resumed ${Dl(r.resumed_at)}`:"resumed";break;case"cancelled":i="stopped";break;case"unsupported":i="cannot be resumed";break;default:i="not resumed"}return a.jsx("div",{className:"interruption-marker",title:r.detail??void 0,children:a.jsxs("span",{children:["Interrupted",s?` ${s}`:""," (",dl(r.reason),") · ",i]})})}function $N({turn:t,label:r}){const[s,i]=y.useState(!1),l=A(d=>d.addToast),c=()=>{i(!0),_w(t.session_id,t.id).catch(d=>l("error",`Could not resume the turn — ${d.message}`)).finally(()=>i(!1))};return a.jsxs("button",{type:"button",className:"banner-action",onClick:c,disabled:s,children:[a.jsx(dv,{size:12}),r]})}function zN({turn:t}){const r=t.resume_state;if(!r||r==="cancelled"||r==="resumed")return null;const s=t.interrupt_reason,i=ON(t),l=i[i.length-1],c=Dl(t.interrupted_at??(l==null?void 0:l.interrupted_at));let d,p=null,g=null;switch(r){case"waiting":{const m=s==="usage_limit"&&!t.resume_at;d=LN(t),p=m?(l==null?void 0:l.detail)??null:null,g=s==="auth"||m?"Resume":"Resume now";break}case"resuming":d=`Interrupted (${dl(s)}) — resuming from where it left off…`;break;case"gave_up":{const m=Math.max(i.length,1);d=`Interrupted ${m===1?"once":`${m} times`} — automatic resume stopped.`,p=t.error&&!t.error.startsWith("Automatic resume stopped")?t.error:null,g="Resume";break}case"skipped":d=`Interrupted${c?` ${c}`:""} (${dl(s)}) — too long ago to resume automatically.`,g="Resume";break;default:d=`Interrupted (${dl(s)}) — this turn cannot be resumed.`,p=t.error}return a.jsxs("div",{className:"interruption-banner","data-state":r,children:[a.jsx("span",{className:"banner-icon",children:s==="network"?a.jsx(gv,{size:12}):a.jsx(Fl,{size:12})}),a.jsxs("span",{className:"banner-text",children:[d,p&&a.jsx("span",{className:"banner-detail",children:p})]}),g&&a.jsx($N,{turn:t,label:g})]})}function FN({turnId:t}){const r=A(i=>i.retryStates[t]);if(!r)return null;const s=r.errorStatus?`API error ${r.errorStatus}`:"Connection problem";return a.jsxs("div",{className:"retry-banner",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(gv,{size:12})}),a.jsxs("span",{className:"banner-text",children:[s," — retrying (attempt ",r.attempt," of ",r.maxRetries,")…"]})]})}const UN='(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});',BN=["https://cdnjs.cloudflare.com","https://cdn.jsdelivr.net","https://unpkg.com","https://esm.sh"],uy="agentpane-widget",dy="agentpane-pane",gi=BN.join(" "),WN=["default-src 'none'",`script-src 'unsafe-inline' 'unsafe-eval' ${gi}`,`style-src 'unsafe-inline' ${gi}`,`img-src data: blob: ${gi}`,`font-src data: ${gi}`,`connect-src ${gi}`,"media-src data: blob:","frame-src 'none'","form-action 'none'","base-uri 'none'"].join("; ");function HN(){const t=typeof document<"u"?getComputedStyle(document.documentElement):null,r=(s,i)=>(t==null?void 0:t.getPropertyValue(s).trim())||i;return{"--color-text-primary":r("--text","#1c1b18"),"--color-text-secondary":r("--text-2","#54504a"),"--color-text-muted":r("--text-3","#78736c"),"--color-background-primary":r("--canvas","#fdfdfc"),"--color-background-secondary":r("--surface-0","#f8f7f5"),"--color-border":r("--border","#e2e0db"),"--color-accent":r("--accent","#d97706"),"--font-sans":r("--font-sans","'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"),"--font-mono":r("--font-mono","'JetBrains Mono', 'SF Mono', 'Fira Code', monospace"),"--radius":r("--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 VN=`(function () {
515
+ var SELF = '${uy}';
516
+ var PANE = '${dy}';
517
+ var SCRIPT_TIMEOUT_MS = 15000;
518
+ var root = document.getElementById('root');
519
+ var finished = false;
520
+ var lastHtml = null;
521
+
522
+ function post(msg) {
523
+ msg.source = SELF;
524
+ parent.postMessage(msg, '*');
525
+ }
526
+
527
+ function parse(html, keepScripts) {
528
+ var tmp = document.createElement('div');
529
+ tmp.innerHTML = html;
530
+ if (!keepScripts) {
531
+ var scripts = tmp.querySelectorAll('script');
532
+ for (var i = 0; i < scripts.length; i++) scripts[i].remove();
533
+ }
534
+ return tmp;
535
+ }
536
+
537
+ function morph(html, isFinal) {
538
+ var added = new Set();
539
+ morphdom(root, parse(html, isFinal), {
540
+ childrenOnly: true,
541
+ onBeforeElUpdated: function (from, to) { return !from.isEqualNode(to); },
542
+ onNodeAdded: function (node) {
543
+ added.add(node);
544
+ if (!isFinal && node.nodeType === 1 && node.animate && !added.has(node.parentNode)) {
545
+ node.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 220, easing: 'ease-out' });
546
+ }
547
+ return node;
548
+ },
549
+ });
550
+ }
551
+
552
+ // Scripts parsed by innerHTML never run; replace each with a fresh copy.
553
+ function runScripts(done) {
554
+ var scripts = Array.prototype.slice.call(root.querySelectorAll('script'));
555
+ var i = 0;
556
+ function next() {
557
+ if (i >= scripts.length) return done();
558
+ var old = scripts[i++];
559
+ var s = document.createElement('script');
560
+ for (var a = 0; a < old.attributes.length; a++) s.setAttribute(old.attributes[a].name, old.attributes[a].value);
561
+ s.text = old.textContent || '';
562
+ if (!old.src) {
563
+ old.replaceWith(s);
564
+ return next();
565
+ }
566
+ s.async = false;
567
+ var settled = false;
568
+ var timer = setTimeout(go, SCRIPT_TIMEOUT_MS);
569
+ function go() {
570
+ if (settled) return;
571
+ settled = true;
572
+ clearTimeout(timer);
573
+ next();
574
+ }
575
+ s.onload = go;
576
+ s.onerror = function () {
577
+ post({ type: 'error', message: 'Could not load ' + old.src });
578
+ go();
579
+ };
580
+ old.replaceWith(s);
581
+ }
582
+ next();
583
+ }
584
+
585
+ function finish() {
586
+ document.dispatchEvent(new Event('DOMContentLoaded', { bubbles: true }));
587
+ window.dispatchEvent(new Event('load'));
588
+ }
589
+
590
+ window.addEventListener('message', function (e) {
591
+ if (e.source !== parent) return;
592
+ var msg = e.data;
593
+ if (!msg || msg.source !== PANE || msg.type !== 'content' || finished) return;
594
+ var html = typeof msg.html === 'string' ? msg.html : '';
595
+ var isFinal = msg.final === true;
596
+ if (!isFinal && html === lastHtml) return;
597
+ lastHtml = html;
598
+ morph(html, isFinal);
599
+ if (isFinal) {
600
+ finished = true;
601
+ runScripts(finish);
602
+ }
603
+ });
604
+
605
+ window.addEventListener('error', function (e) {
606
+ var message = String(e.message || 'Script error');
607
+ // Benign: a layout change inside a ResizeObserver callback.
608
+ if (/ResizeObserver loop/.test(message)) return;
609
+ post({ type: 'error', message: message });
610
+ });
611
+
612
+ // External links open in a new browser tab: in the frame they would
613
+ // replace the widget, and most sites refuse to be framed. Bubble phase, so
614
+ // the widget's own handlers can still claim the click. Relative links would
615
+ // resolve against the pane, so they go nowhere.
616
+ window.addEventListener('click', function (e) {
617
+ if (e.defaultPrevented || e.button !== 0) return;
618
+ var a = e.target && e.target.closest ? e.target.closest('a[href]') : null;
619
+ if (!a) return;
620
+ var href = (a.getAttribute('href') || '').trim();
621
+ if (href.charAt(0) === '#' || /^javascript:/i.test(href)) return;
622
+ e.preventDefault();
623
+ if (!/^https?:\\/\\//i.test(href)) return;
624
+ try {
625
+ window.open(new URL(href).href, '_blank', 'noopener,noreferrer');
626
+ } catch (err) {}
627
+ });
628
+
629
+ // The frame is as tall as the document's content: the bottom of the
630
+ // lowest in-flow child of <body> (#root, or what a script appended), plus
631
+ // the body's own padding, border and margin below it. Not the viewport or
632
+ // a box styled height: 100% — those follow the frame itself.
633
+ function px(style, prop) {
634
+ return parseFloat(style.getPropertyValue(prop)) || 0;
635
+ }
636
+ function contentHeight() {
637
+ var bottom = 0;
638
+ var children = document.body.children;
639
+ for (var i = 0; i < children.length; i++) {
640
+ var child = children[i];
641
+ if (child.tagName === 'SCRIPT') continue;
642
+ var style = getComputedStyle(child);
643
+ if (style.position === 'absolute' || style.position === 'fixed' || style.display === 'none') continue;
644
+ bottom = Math.max(bottom, child.getBoundingClientRect().bottom + px(style, 'margin-bottom'));
645
+ }
646
+ var body = getComputedStyle(document.body);
647
+ return bottom + window.scrollY + px(body, 'padding-bottom') + px(body, 'border-bottom-width') + px(body, 'margin-bottom');
648
+ }
649
+ var lastHeight = -1;
650
+ function reportHeight() {
651
+ var h = Math.ceil(contentHeight());
652
+ if (h === lastHeight) return;
653
+ lastHeight = h;
654
+ post({ type: 'height', height: h });
655
+ }
656
+ var sizes = new ResizeObserver(reportHeight);
657
+ sizes.observe(root);
658
+ sizes.observe(document.body);
659
+ // Elements a script adds next to #root count too.
660
+ new MutationObserver(function (records) {
661
+ for (var r = 0; r < records.length; r++) {
662
+ for (var n = 0; n < records[r].addedNodes.length; n++) {
663
+ if (records[r].addedNodes[n].nodeType === 1) sizes.observe(records[r].addedNodes[n]);
664
+ }
665
+ }
666
+ reportHeight();
667
+ }).observe(document.body, { childList: true });
668
+ reportHeight();
669
+ post({ type: 'ready' });
670
+ })();`;function Ym(t){return`<script>${t.replace(/<\/script/gi,"<\\/script")}<\/script>`}function KN(){const t=Object.entries(HN()).map(([r,s])=>`${r}: ${s};`).join(" ");return["<!DOCTYPE html>","<html><head>",'<meta charset="utf-8">',`<meta http-equiv="Content-Security-Policy" content="${WN}">`,"<style>",`:root { ${t} 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>",Ym(UN),'</head><body><div id="root"></div>',Ym(VN),"</body></html>"].join(`
671
+ `)}let Qm=null;function GN(){return Qm??(Qm=KN()),Qm}const qN=4e3,XN=3,xo=new Map,YN=500;function QN(t,r){if(xo.delete(t),xo.set(t,r),xo.size>YN){const s=xo.keys().next().value;s!==void 0&&xo.delete(s)}}function ZN({widgetId:t,title:r,html:s,final:i,onError:l}){const c=y.useRef(null),[d,p]=y.useState(()=>xo.get(t)??0),g=y.useRef({html:s,final:i});g.current={html:s,final:i};const m=y.useRef(l);m.current=l;const v=y.useRef(0),k=y.useRef(null),x=y.useCallback(()=>{var T;const S=(T=c.current)==null?void 0:T.contentWindow;if(!S||v.current===0||v.current>XN)return;const N=g.current,C=k.current;C&&(C.final||C.html===N.html&&C.final===N.final)||(k.current=N,S.postMessage({source:dy,type:"content",html:N.html,final:N.final},"*"))},[]);return y.useEffect(()=>{function S(N){var j;const C=c.current;if(!C||N.source!==C.contentWindow)return;const T=N.data;if(!(!T||typeof T!="object"||T.source!==uy))if(T.type==="ready")v.current+=1,k.current=null,x();else if(T.type==="height"&&typeof T.height=="number"&&Number.isFinite(T.height)){const E=Math.min(qN,Math.max(0,Math.ceil(T.height)));p(E),QN(t,E)}else T.type==="error"&&typeof T.message=="string"&&((j=m.current)==null||j.call(m,T.message.slice(0,500)))}return window.addEventListener("message",S),()=>window.removeEventListener("message",S)},[t,x]),y.useEffect(()=>{x()},[s,i,x]),a.jsx("iframe",{ref:c,className:"widget-frame",sandbox:"allow-scripts allow-popups allow-popups-to-escape-sandbox",srcDoc:GN(),title:r||"Widget",style:{height:`${d}px`}})}function JN({item:t}){const[r,s]=y.useState(null),i=t.data??{},l=typeof i.title=="string"?i.title.trim():"",c=typeof i.html=="string"?i.html:"",d=i.partial===!0,p=typeof i.error=="string"&&i.error?i.error:null;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(Q1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:l||"Visual"}),d&&a.jsx("span",{className:"turn-header-meta",children:"drawing…"}),p&&a.jsx("span",{className:"turn-header-meta",style:{color:"var(--red)"},children:"failed"})]}),c.trim()?a.jsx(ZN,{widgetId:t.external_item_id??t.id,title:l,html:c,final:!d,onError:s}):!p&&a.jsx("div",{className:"widget-placeholder",children:d?"Drawing…":"Nothing to show"}),p&&a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:p})}),r&&!p&&a.jsxs("div",{className:"widget-script-error",title:r,children:["Script error: ",r]})]})}Ke.setOptions({breaks:!0,gfm:!0});const eT=10,tT=100;function nT({attachments:t}){const[r,s]=y.useState(null);return y.useEffect(()=>{if(!r)return;function i(l){l.key==="Escape"&&s(null)}return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[r]),!Array.isArray(t)||t.length===0?null:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"attachment-pills",children:t.map((i,l)=>{const c=i.media_type.startsWith("image/"),d=`data:${i.media_type};base64,${i.data}`;return a.jsxs("span",{className:"attachment-pill",title:i.name,onClick:c?()=>s(d):void 0,style:c?{cursor:"pointer"}:void 0,children:[c?a.jsx("img",{src:d,alt:i.name,className:"attachment-pill-thumb"}):a.jsx(sv,{size:12,className:"attachment-pill-icon"}),a.jsx("span",{className:"attachment-pill-name",children:i.name})]},l)})}),r&&a.jsx("div",{className:"image-preview-modal",onClick:()=>s(null),children:a.jsxs("div",{className:"image-preview-content",onClick:i=>i.stopPropagation(),children:[a.jsx("img",{src:r,alt:"preview"}),a.jsx("button",{className:"image-preview-close",onClick:()=>s(null),children:a.jsx(Nn,{size:20})})]})})]})}function rT(t){const r=Ke.parse(t);return Zd.sanitize(r)}function Zm(t){var r;return(r=t.data)!=null&&r.text?t.data.text:""}function sT(t){const r=t.match(/^\/bin\/\w+\s+-\w+\s+"(.*)"$/s);return r?r[1]:t}const Jm='<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 oT(t){return/<\/body>/i.test(t)?t.replace(/<\/body>/i,`${Jm}</body>`):t+Jm}function iT({html:t}){const[r,s]=y.useState(480),i=y.useRef(null);return y.useEffect(()=>{function l(c){var d;c.source===((d=i.current)==null?void 0:d.contentWindow)&&typeof c.data=="number"&&c.data>0&&s(c.data)}return window.addEventListener("message",l),()=>window.removeEventListener("message",l)},[]),a.jsx("iframe",{ref:i,sandbox:"allow-scripts",srcDoc:oT(t),title:"HTML content",style:{width:"100%",height:`${r}px`,border:"1px solid var(--border)",borderRadius:"var(--r-md)",background:"#fff",marginTop:"8px"}})}const eg=1e4;function aT({item:t,runtimeType:r,turn:s,threads:i}){var p,g,m,v,k,x,S,N;const l=t.status==="in_progress",[c,d]=y.useState(!1);switch(t.type){case"agent_message":{const{iconClass:C,iconText:T}=nd(r??"codex");return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:`turn-header-icon ${C}`,children:T}),a.jsx("span",{className:"turn-header-title",children:"Agent"}),l&&a.jsx("span",{className:"turn-header-meta",children:"writing…"})]}),a.jsx(Gm,{itemId:t.id,turnId:s.id,sessionId:s.session_id,content:Zm(t)||"…",threads:i,runtimeType:r})]})}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(k1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Reasoning"})]}),a.jsx("div",{dangerouslySetInnerHTML:{__html:rT(Zm(t))}})]});case"command_execution":{const C=t.data||{},T=sT(C.command||""),j=C.aggregated_output||"",E=C.exit_code,H=l?"running…":E!==null?`exit ${E}`:"",I=j.length>eg,L=I&&!c?j.slice(0,eg)+`
672
+ … (truncated, click to expand)`:j;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(hv,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Command"}),H&&a.jsx("span",{className:"turn-header-meta",children:H})]}),a.jsx("pre",{className:"cmd-block",children:a.jsx("code",{children:T})}),j&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"cmd-output",children:a.jsx("code",{children:L})}),I&&a.jsx("button",{className:"cmd-output-toggle",onClick:()=>d(q=>!q),children:c?"Show less":`Show full output (${(j.length/1024).toFixed(0)}KB)`})]})]})}case"file_change":{const C=(p=t.data)==null?void 0:p.changes,T=Array.isArray(C)?C:[],j=`${T.length} file${T.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(j1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"File Changes"}),a.jsx("span",{className:"turn-header-meta",children:j})]}),a.jsx("div",{className:"file-change-list",children:T.map((E,H)=>{const I=E.kind==="add"?"A":E.kind==="delete"?"D":"M",L=E.kind==="add"?"fc-add":E.kind==="delete"?"fc-del":"fc-mod";return a.jsxs("div",{className:"file-change",children:[a.jsx("span",{className:`fc-status ${L}`,children:I}),a.jsx("span",{className:"fc-name",children:E.path})]},H)})})]})}case"mcp_tool_call":{const C=t.data||{},T=C.tool||"mcp";if(T==="Agent"){const $=C.arguments,te=($==null?void 0:$.description)||($==null?void 0:$.prompt)||"Subagent",me=t.status==="failed",ue=l?"running…":me?"failed":"done";return a.jsxs("div",{className:"agent-call-card",children:[a.jsx("span",{className:"agent-call-icon",children:a.jsx(ms,{size:14})}),a.jsx("span",{className:"agent-call-desc",children:te}),a.jsx("span",{className:`agent-call-status ${l?"running":me?"failed":"done"}`,children:ue})]})}const j=C.server||"",E=C.arguments,H=C.result,I=C.error,L=t.status==="failed"||!!I,q=l?"running…":L?"failed":"done",K=((g=H==null?void 0:H.content)==null?void 0:g.filter($=>$.type==="text").map($=>$.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(G1,{size:14})}),a.jsxs("span",{className:"turn-header-title",children:["MCP: ",T]}),j&&a.jsx("span",{className:"turn-header-meta",children:j}),a.jsx("span",{className:"turn-header-meta",style:L?{color:"var(--red)"}:void 0,children:q})]}),E&&Object.keys(E).length>0&&a.jsx("div",{className:"mcp-args",children:Object.entries(E).map(([$,te])=>a.jsxs("div",{className:"mcp-arg",children:[a.jsx("span",{className:"mcp-arg-key",children:$}),$==="code"?a.jsx("pre",{className:"cmd-block",children:a.jsx("code",{children:String(te)})}):a.jsx("span",{className:"mcp-arg-value",children:typeof te=="string"?te:JSON.stringify(te,null,2)})]},$))}),K.length>0&&K.map(($,te)=>a.jsx("pre",{className:"cmd-output",children:a.jsx("code",{children:$})},te)),I&&a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:I})})]})}case"web_search":{const C=((m=t.data)==null?void 0:m.query)||"";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(Y1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Web Search"})]}),a.jsx("p",{className:"user-message",children:C})]})}case"todo_list":{const C=((v=t.data)==null?void 0:v.items)||[];return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(O1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Todo List"})]}),a.jsx("ul",{className:"todo-list",children:C.map((T,j)=>a.jsxs("li",{className:T.completed?"todo-done":"todo-pending",children:[T.completed?a.jsx(Tr,{size:14}):a.jsx(Fs,{size:14})," ",T.text]},j))})]})}case"ask_user":return a.jsx(Xm,{item:t,turn:s});case"final_result":{const C=t.data??{},T=C.text||"",j=C.html||null,E=Array.isArray(C.groups)?C.groups.filter(L=>!!L&&Array.isArray(L.selections)&&L.selections.length>0):[],{iconClass:H,iconText:I}=nd(r??"codex");return a.jsxs(a.Fragment,{children:[(T||j)&&a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:`turn-header-icon ${H}`,children:I}),a.jsx("span",{className:"turn-header-title",children:"Agent"})]}),T&&a.jsx(Gm,{itemId:t.id,turnId:s.id,sessionId:s.session_id,content:T,threads:i,runtimeType:r}),j&&a.jsx(iT,{html:j})]}),E.length>0&&a.jsx(Xm,{item:t,turn:s})]})}case"background_task":{const C=t.data||{},T=C.task_type||"unknown",j=C.subagent_type||null,E=C.description||"",H=C.status||"running",I=C.last_tool_name||null,L=C.token_count||null,q=T==="local_agent",K=T==="local_bash",$=q?ms:K?fv:rv,te=q?`Subagent${j?`: ${j}`:""}`:K?"Monitor":"Background Task",me=H==="running"?"running…":H==="completed"?"done":H==="failed"?"failed":H==="stopped"?"stopped":H,ue=t.status==="failed"||H==="failed";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx($,{size:14})}),a.jsx("span",{className:"turn-header-title",children:te}),a.jsx("span",{className:"turn-header-meta",style:ue?{color:"var(--red)"}:void 0,children:me})]}),E&&a.jsx("p",{className:"user-message",style:{fontSize:"13px"},children:E}),I&&l&&a.jsxs("div",{className:"cmd-output",style:{color:"var(--text-3)",fontSize:"12px"},children:["last tool: ",I,L!=null&&` · ${L.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 C=((k=t.data)==null?void 0:k.trigger)??"auto",T=((x=t.data)==null?void 0:x.pre_tokens)??0,j=((S=t.data)==null?void 0:S.post_tokens)??0,E=T>0?Math.round((1-j/T)*100):0,H=C==="manual"?"Context compacted (/compact)":"Context auto-compacted";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(F1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:H})]}),a.jsxs("div",{className:"cmd-output",style:{color:"var(--text-3)"},children:[T.toLocaleString()," → ",j.toLocaleString()," tokens (",E,"% reduction)"]})]})}case"interruption":return a.jsx(PN,{item:t});case"widget":return a.jsx(JN,{item:t});case"error":{const C=((N=t.data)==null?void 0:N.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(Fl,{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:C})})]})}default:return null}}const Ls=y.memo(aT,(t,r)=>t.item===r.item&&t.runtimeType===r.runtimeType&&t.threads===r.threads&&t.turn.id===r.turn.id);function lT(t){return t.type==="widget"?`widget-${t.external_item_id??t.id}`:t.id}function cT({turn:t,runtimeType:r,threads:s=[]}){Dt.trackRender("TurnContent");const[i,l]=y.useState(!1),[c,d]=y.useState(!1),[p,g]=y.useState(!1),[m,v]=y.useState(!1),k=A(B=>B.loadDeferredItems),x=t.items.some(B=>B.type==="background_task"&&B.status==="in_progress");y.useEffect(()=>{t.status==="running"||t.status==="pending"?l(!0):t.status==="completed"&&!x&&l(!1)},[t.status,x]);const S=t.deferred_item_count??0,N=zr(t),C=y.useRef(N);y.useEffect(()=>{const B=C.current&&!N&&t.status==="completed"&&!x;if(C.current=N,B||!i||S===0||m||N&&!c)return;let X=!1;return k(t.session_id,t.id).then(le=>{!le&&!X&&v(!0)}),()=>{X=!0}},[i,S,m,N,c,t.status,x,k,t.session_id,t.id]);let T=-1;for(let B=t.items.length-1;B>=0;B--)if(t.items[B].type==="agent_message"){T=B;break}const j=T>=0,E=j?t.items.slice(0,T):t.items,H=t.items.some(B=>B.type==="final_result"||B.type==="ask_user"),I=!j&&t.status==="completed"&&t.agent_response&&!H?{id:`response-${t.id}`,turn_id:t.id,external_item_id:`response-${t.id}`,type:"agent_message",data:{text:t.agent_response},status:"completed",created_at:t.created_at,updated_at:t.updated_at}:null,L=E.filter(B=>{var X;return!(B.type==="reasoning"&&(!((X=B.data)!=null&&X.text)||B.data.text===""))}),q=t.items.some(B=>{var X;return B.type==="interruption"&&((X=B.data)==null?void 0:X.reason)==="auth"}),K=t.items.some(B=>{var X;return B.type==="interruption"&&((X=B.data)==null?void 0:X.reason)==="usage_limit"}),$=L.filter(B=>{var X,le;return!(B.type==="background_task"||B.type==="ask_user"||B.type==="final_result"||B.type==="widget"||q&&B.type==="error"&&((X=B.data)==null?void 0:X.error)==="authentication_failed"||K&&B.type==="error"&&((le=B.data)==null?void 0:le.error)==="rate_limit")}),te=c?0:Math.max(0,$.length-tT),me=te>0?$.slice(te):$,ue=[];let ye=null;for(const B of me)B.type==="agent_message"?(ye&&ue.push(ye),ye={agentMessage:B,toolItems:[],otherItems:[]}):B.type==="interruption"||B.type==="error"?(ye&&ue.push(ye),ue.push({agentMessage:null,toolItems:[],otherItems:[B]}),ye=null):(ye||(ye={agentMessage:null,toolItems:[],otherItems:[]}),Vm(B)?ye.toolItems.push(B):ye.otherItems.push(B));ye&&ue.push(ye);const be=t.status==="running"||t.status==="pending",Me=B=>{var X;return B.type==="widget"&&(be||((X=B.data)==null?void 0:X.partial)!==!0)},Z=j?t.items[T]:I,oe=[...E.filter(Me),...Z?[Z]:[],...j?t.items.slice(T+1).filter(B=>B.type!=="ask_user"&&B.type!=="background_task"&&B.type!=="final_result"&&(B.type!=="widget"||Me(B))):[]],ie=t.items.filter(B=>B.type==="background_task"),z=p?0:Math.max(0,ie.length-eT),Q=z>0?ie.slice(z):ie,G=$.filter(B=>Vm(B)).length+(t.deferred_tool_calls??0),D=G>0||N&&($.length>0||S>0),P=t.status==="pending"&&t.resume_state==="waiting",ce=t.resume_state==="gave_up"||t.resume_state==="skipped"||t.resume_state==="unsupported";return a.jsxs("div",{className:"turn-group",children:[a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--amber)",color:"#fff"},children:"U"}),a.jsx("span",{className:"turn-header-title",children:"You"})]}),a.jsx("p",{className:"user-message",children:t.user_prompt}),Array.isArray(t.attachments)&&t.attachments.length>0&&a.jsx(nT,{attachments:t.attachments})]}),D&&a.jsxs("div",{className:"tool-calls",children:[a.jsxs("div",{className:"tool-calls-header",onClick:()=>l(B=>!B),children:[a.jsx("span",{className:"tool-calls-icon",children:a.jsx(D1,{size:12})}),a.jsx("span",{className:"tool-calls-summary",children:G>0?`${G} tool call${G>1?"s":""}`:P?"interrupted":"thinking…"}),a.jsx(_i,{size:14,className:"tool-calls-chevron",style:{transform:i?"rotate(90deg)":"none"}})]}),i&&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"}):N&&!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||N)&&a.jsxs(a.Fragment,{children:[S===0&&te>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>d(!0),children:["Show ",te," earlier step",te>1?"s":""]})}),ue.map((B,X)=>a.jsxs("div",{className:"intermediate-segment",children:[B.agentMessage&&a.jsx(Ls,{item:B.agentMessage,runtimeType:r,turn:t,threads:s}),B.otherItems.map(le=>a.jsx(Ls,{item:le,runtimeType:r,turn:t,threads:s},le.id)),B.toolItems.length>0&&a.jsx(bN,{items:B.toolItems,runtimeType:r,turn:t,threads:s})]},X))]})]})]}),z>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>g(!0),children:["Show ",z," earlier background task",z>1?"s":""]})}),Q.map(B=>a.jsx(Ls,{item:B,runtimeType:r,turn:t,threads:s},`task-${B.id}`)),oe.map(B=>a.jsx(Ls,{item:B,runtimeType:r,turn:t,threads:s},lT(B))),t.items.filter(B=>B.type==="final_result").map(B=>a.jsx(Ls,{item:B,runtimeType:r,turn:t,threads:s},`final-${B.id}`)),t.items.filter(B=>B.type==="ask_user").map(B=>a.jsx(Ls,{item:B,runtimeType:r,turn:t,threads:s},`ask-${B.id}`)),t.items.length===0&&!t.error&&(t.status==="pending"||t.status==="running")&&a.jsx("div",{className:"render-content",children:a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:t.status==="running"?"Agent is thinking…":"Waiting to start…"})}),t.error&&!ce&&a.jsx("div",{className:"render-content",children:a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:t.error})})}),t.status==="running"&&a.jsx(FN,{turnId:t.id}),a.jsx(zN,{turn:t}),t.status==="aborted"&&a.jsxs("div",{className:"aborted-banner",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(Fs,{size:12})}),a.jsx("span",{className:"banner-text",children:"Turn stopped — work generated so far is kept."})]})]})}const uT=y.memo(cT),dT=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.userAgent)?"⌘K":"Ctrl+K";function fT(){const t=A(T=>T.workspaces),r=A(T=>T.loadPickerSupport),s=A(T=>T.pickAndAddWorkspace),i=A(T=>T.createSessionInWorkspace),l=A(T=>T.setImportSessionsWorkspace);y.useEffect(()=>{r()},[r]);const c=t.filter(T=>T.deleted===0),[d,p]=y.useState(null),g=c.find(T=>T.path===d)??c[c.length-1]??null,m=(g==null?void 0:g.path)??null,[v,k]=y.useState(null);y.useEffect(()=>{if(!m)return;let T=!1;return Vg(m).then(j=>{T||k({path:m,count:j.length})}).catch(()=>{}),()=>{T=!0}},[m]);const x=v&&v.path===m?v.count:0,[S,N]=y.useState(!1);async function C(T){N(!0);try{await i(T)}finally{N(!1)}}return a.jsx("div",{className:"render-scroll welcome-scroll",children:a.jsxs("main",{className:"welcome","aria-labelledby":"welcome-title",children:[a.jsx("h1",{className:"welcome-title",id:"welcome-title",children:"Welcome to Repoburg"}),a.jsx("p",{className:"welcome-lead",children:"Run Claude Code and Codex agents on your projects, side by side. Each session works in a workspace: one of your project folders."}),a.jsxs("ol",{className:"welcome-steps",children:[a.jsxs("li",{className:`welcome-step${g?" done":" current"}`,children:[a.jsx("span",{className:"welcome-step-mark","aria-hidden":"true",children:g?a.jsx(Tr,{size:13}):"1"}),a.jsxs("div",{className:"welcome-step-body",children:[a.jsx("h2",{className:"welcome-step-title",children:"Add a workspace"}),g?a.jsx("p",{className:"welcome-step-text",children:a.jsx("code",{title:g.path,children:g.path})}):a.jsxs("button",{className:"dialog-btn-create welcome-primary",onClick:()=>void s(),children:[a.jsx(R1,{size:14})," Open folder…"]})]})]}),a.jsxs("li",{className:`welcome-step${g?" current":" upcoming"}`,children:[a.jsx("span",{className:"welcome-step-mark","aria-hidden":"true",children:"2"}),a.jsxs("div",{className:"welcome-step-body",children:[a.jsx("h2",{className:"welcome-step-title",children:"Start your first session"}),g&&m?a.jsxs(a.Fragment,{children:[c.length>1&&a.jsxs("label",{className:"welcome-step-text welcome-target",children:["In",a.jsx("select",{className:"dialog-input dialog-select",value:m,onChange:T=>p(T.target.value),children:c.map(T=>a.jsx("option",{value:T.path,children:T.label||T.path},T.id))})]}),a.jsxs("div",{className:"welcome-actions",children:[a.jsxs("button",{className:"dialog-btn-create welcome-primary",disabled:S,onClick:()=>void C(m),children:[a.jsx(fs,{size:14})," New session"]}),x>0&&a.jsxs("button",{className:"dialog-btn-cancel",onClick:()=>l(m),children:[a.jsx(av,{size:14})," Import ",x," Claude Code"," ",x===1?"session":"sessions"]})]}),x>0&&a.jsxs("p",{className:"welcome-step-text",children:["Sessions you started with ",a.jsx("code",{children:"claude"})," in this folder continue right where they left off."]})]}):a.jsx("p",{className:"welcome-step-text",children:"Then start an agent session in it."})]})]})]}),a.jsxs("p",{className:"welcome-tip",children:["Later: right-click a workspace to import its Claude Code sessions, and press ",a.jsx("kbd",{children:dT})," for the command palette."]})]})})}const pT=[],nl=50;function hT(){Dt.trackRender("RenderArea");const t=A(S=>S.activeSessionId),r=A(S=>S.activeSessionId?S.sessionDetails[S.activeSessionId]:null),s=A(S=>S.submittingPrompt),i=A(S=>S.loading),l=A(S=>!S.activeSessionId&&!JS(S.workspaces,S.sessions,S.appsRootPath)),c=(r==null?void 0:r.turns)??[],d=(r==null?void 0:r.threads)??pT,p=y.useRef(null),[g,m]=y.useState(nl);y.useEffect(()=>{m(nl)},[t]);const v=c.filter(S=>!S.thread_id),k=Math.max(0,v.length-g),x=v.slice(k);return y.useEffect(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},[t,c.length]),i&&!r?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"})]})}):r?a.jsxs("div",{className:"render-scroll",ref:p,children:[s&&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:s})]}),a.jsx("div",{className:"render-content",children:a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:"Sending…"})})]})}),c.length===0&&!s&&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+nl),children:["Show ",Math.min(nl,k)," earlier turns (",k," hidden)"]})}),x.map((S,N)=>a.jsx("div",{id:`turn-${k+N}`,className:"turn-block",children:a.jsx(uT,{turn:S,runtimeType:r.runtime_type,threads:d})},S.id))]}):l?a.jsx(fT,{}):a.jsx("div",{className:"render-scroll",children:a.jsx("div",{className:"empty-state",children:"No session selected"})})}const mT=y.memo(hT),gT=[{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 vT(t){return t.map(r=>({id:r.name,label:`/${r.name}`,hint:r.description,capability:null,insertAsText:!0}))}function yT(t,r,s=[]){const i=[...gT,...vT(s)],l=new Set;return i.filter(c=>!(l.has(c.label)||(l.add(c.label),c.capability&&!r[c.capability])||t&&!c.label.toLowerCase().includes(t.toLowerCase())))}function xT({commands:t,selectedIndex:r,onSelect:s,onHover:i}){return a.jsxs("div",{className:"slash-popup",children:[a.jsx("div",{className:"slash-popup-header",children:"Commands"}),t.length===0&&a.jsx("div",{className:"slash-popup-empty",children:"No matching commands"}),t.map((l,c)=>a.jsxs("div",{className:`slash-popup-item ${c===r?"selected":""}`,onMouseEnter:()=>i(c),onClick:()=>s(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 Xu({title:t,options:r,currentValue:s,onSelect:i,onClose:l}){return a.jsxs("div",{className:"slash-popup",children:[a.jsxs("div",{className:"slash-popup-header",children:[a.jsx("button",{className:"slash-popup-back",onClick:l,children:"← Back"}),a.jsx("span",{children:t})]}),r.map(c=>a.jsxs("div",{className:`slash-popup-item ${c.value===s?"selected":""}`,onClick:()=>i(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===s&&a.jsx("span",{className:"slash-popup-check",children:"✓"})]},c.value))]})}function wT(t){return Mt("/skills")}function kT({filter:t,onSelect:r,onClose:s}){const[i,l]=y.useState([]),[c,d]=y.useState(!0),[p,g]=y.useState(0),m=y.useRef(null);y.useEffect(()=>{wT().then(l).catch(()=>l([])).finally(()=>d(!1))},[]);const v=i.filter(k=>k.name.toLowerCase().includes(t.toLowerCase())||k.description.toLowerCase().includes(t.toLowerCase()));return y.useEffect(()=>{g(0)},[t]),y.useEffect(()=>{function k(x){x.key==="ArrowDown"?(x.preventDefault(),g(S=>Math.min(S+1,v.length-1))):x.key==="ArrowUp"?(x.preventDefault(),g(S=>Math.max(S-1,0))):x.key==="Enter"?(x.preventDefault(),v[p]&&r(v[p])):x.key==="Escape"&&(x.preventDefault(),s())}return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[v,p,r,s]),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:s,children:"← Back"}),a.jsx("span",{children:"Skills"})]}),c&&a.jsx("div",{className:"slash-popup-empty",children:"Loading skills…"}),!c&&v.length===0&&a.jsx("div",{className:"slash-popup-empty",children:"No matching skills"}),v.map((k,x)=>a.jsxs("div",{className:`slash-popup-item ${x===p?"selected":""}`,onMouseEnter:()=>g(x),onClick:()=>r(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 fy(){return Mt("/providers")}function ST(t,r){const s=r?`?cwd=${encodeURIComponent(r)}`:"";return Mt(`/providers/${t}/commands${s}`)}const bT={dynamicModels:!1,skills:!1,plugins:!1,mcpServers:!1,imageAttachments:!1,sandbox:!1,webSearch:!1,networkAccess:!1,fileReferences:!1};function NT(t){const[r,s]=y.useState([]),[i,l]=y.useState(!0);y.useEffect(()=>{fy().then(s).catch(()=>s([])).finally(()=>l(!1))},[]);const c=r.find(d=>d.id===t)??null;return{provider:c,capabilities:(c==null?void 0:c.capabilities)??bT,loading:i}}const vo=32,Yu=200;function tg(t){if(!t)return{};try{return JSON.parse(t)}catch{return{}}}function ng(t){return t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}let rg=0;function TT(){return rg+=1,`att-${Date.now()}-${rg}`}function CT(){Dt.trackRender("CommandInputBar");const[t,r]=y.useState(""),s=y.useRef(null),i=y.useRef(vo),l=y.useRef(null),{submitPrompt:c,cancelTurn:d,updateRuntimeConfig:p,setShowModelSelector:g}=A(),m=A(Y=>Y.activeSessionId),v=A(Y=>Y.activeSessionId?Y.sessionDetails[Y.activeSessionId]:null),k=A(Y=>Y.quotedText),x=$g(v),S=!!(v!=null&&v.turns.some(Y=>Y.status==="pending"&&Y.resume_state==="waiting")),N=!m,{capabilities:C}=NT(v==null?void 0:v.runtime_type),T=(v==null?void 0:v.runtime_type)??null,j=C.imageAttachments,[E,H]=y.useState([]),[I,L]=y.useState(!1),[q,K]=y.useState(null),[$,te]=y.useState([]);y.useEffect(()=>{if(!T){te([]);return}let Y=!1;return ST(T,(v==null?void 0:v.cwd)??void 0).then(ge=>{Y||te(ge)}).catch(()=>{Y||te([])}),()=>{Y=!0}},[T,v==null?void 0:v.cwd]);const[me,ue]=y.useState(!1),[ye,be]=y.useState(""),[Me,Z]=y.useState(0),[oe,ie]=y.useState(void 0),[z,Q]=y.useState(!1),[G,D]=y.useState(""),[P,ce]=y.useState([]),B=me?yT(ye,C,$):[];y.useEffect(()=>{k!==null&&(r(Y=>Y+k),setTimeout(()=>{if(s.current){_e(),s.current.focus();const Y=s.current.value.length;s.current.setSelectionRange(Y,Y)}},0),A.setState({quotedText:null}))},[k]),y.useEffect(()=>{if(!x)return;function Y(ge){ge.key==="Escape"&&(ge.preventDefault(),d())}return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[x,d]),y.useEffect(()=>{ue(!1),ie(void 0),Q(!1),ce([]),H(Y=>{for(const ge of Y)ge.previewUrl&&URL.revokeObjectURL(ge.previewUrl);return[]})},[m]),y.useEffect(()=>{if(!q)return;function Y(ge){ge.key==="Escape"&&(ge.preventDefault(),K(null))}return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[q]);const X=y.useCallback(Y=>{if(!Y)return;const ge=Array.from(Y);for(const Ue of ge){const nt=new FileReader;nt.onload=()=>{const gt=nt.result.split(",")[1]??"",Et=Ue.type.startsWith("image/")?URL.createObjectURL(Ue):void 0;H(an=>[...an,{id:TT(),name:Ue.name,media_type:Ue.type||"application/octet-stream",data:gt,previewUrl:Et,size:Ue.size}])},nt.readAsDataURL(Ue)}},[]),le=y.useCallback(Y=>{H(ge=>{const Ue=ge.find(nt=>nt.id===Y);return Ue!=null&&Ue.previewUrl&&URL.revokeObjectURL(Ue.previewUrl),ge.filter(nt=>nt.id!==Y)})},[]),Ne=y.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),!(!j||x)&&L(!0)},[j,x]),re=y.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),L(!1)},[]),he=y.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),L(!1),!(!j||x)&&X(Y.dataTransfer.files)},[j,x,X]),Se=y.useCallback(Y=>{var nt;if(!j)return;const ge=(nt=Y.clipboardData)==null?void 0:nt.items;if(!ge)return;const Ue=[];for(let mt=0;mt<ge.length;mt++){const gt=ge[mt];if(gt.type.startsWith("image/")){const Et=gt.getAsFile();Et&&Ue.push(Et)}}Ue.length>0&&(Y.preventDefault(),X(Ue))},[j,X]);function He(Y){const ge=s.current;ge&&(ge.style.height=`${Y}px`,i.current=Y)}function _e(){const Y=s.current;if(Y){if(Y.scrollHeight>Y.clientHeight){const ge=Math.min(Y.scrollHeight,Yu);ge!==i.current&&He(ge);return}i.current>vo&&(Y.style.height="auto",He(Math.min(Y.scrollHeight,Yu)))}}function ct(){const Y=t.trim();if(!Y||x)return;let ge=Y;P.length>0&&(ge=`${P.map(mt=>`$${mt.name}`).join(" ")}
673
+
674
+ ${Y}`);const Ue=E.map(({id:nt,previewUrl:mt,size:gt,...Et})=>Et);r(""),ce([]),He(vo),ue(!1),ie(void 0),Q(!1);for(const nt of E)nt.previewUrl&&URL.revokeObjectURL(nt.previewUrl);H([]),c(ge,Ue.length>0?Ue:void 0)}function $e(Y){if(Y.insertAsText){const ge=`/${Y.id} `;r(ge),ue(!1),ie(void 0),requestAnimationFrame(()=>{if(s.current){s.current.focus();const Ue=ge.length;s.current.setSelectionRange(Ue,Ue),_e()}});return}Y.subPopup?ie(Y.subPopup):Y.id==="skills"?(Q(!0),D(""),ue(!1),r("")):Y.id==="model"?(g(!0),ue(!1),r("")):(ue(!1),r(""))}function en(Y){ce(ge=>[...ge,Y]),Q(!1),r(""),He(vo)}function Fe(Y){const ge=tg(v==null?void 0:v.runtime_config);oe==="sandbox"?ge.sandboxMode=Y:oe==="websearch"?ge.webSearchMode=Y:oe==="network"&&(ge.networkAccessEnabled=Y==="true"),p(ge),ie(void 0),ue(!1),r(""),He(vo)}function Ht(Y){if(Dt.markKeystroke(),me&&!oe){if(Y.key==="ArrowDown"){Y.preventDefault(),Z(ge=>Math.min(ge+1,B.length-1));return}if(Y.key==="ArrowUp"){Y.preventDefault(),Z(ge=>Math.max(ge-1,0));return}if(Y.key==="Enter"){Y.preventDefault(),B[Me]&&$e(B[Me]);return}if(Y.key==="Escape"){Y.preventDefault(),ue(!1),r("");return}}if(oe&&Y.key==="Escape"){Y.preventDefault(),ie(void 0);return}if(Y.key==="Enter"&&(Y.metaKey||Y.ctrlKey)&&!x){Y.preventDefault(),ct();return}Y.key==="Escape"&&x&&(Y.preventDefault(),d())}function tn(Y){Dt.markInputChange();const ge=Y.target.value;r(ge),_e(),ge.startsWith("/")&&!ge.includes(" ")&&!x?(ue(!0),be(ge.slice(1)),Z(0)):(ue(!1),ie(void 0)),ge.startsWith("$")&&!x?(Q(!0),D(ge.slice(1))):ge.startsWith("$")||Q(!1)}const wt=tg(v==null?void 0:v.runtime_config),Ct=[{value:"read-only",label:"Read Only",description:"Agent can only read files"},{value:"workspace-write",label:"Workspace Write",description:"Agent can read and write in workspace"},{value:"danger-full-access",label:"Danger Full Access",description:"Agent has unrestricted access"}],zt=[{value:"disabled",label:"Disabled",description:"No web search"},{value:"cached",label:"Cached",description:"Use cached search results"},{value:"live",label:"Live",description:"Perform live web searches"}],Lt=[{value:"false",label:"Disabled",description:"No network access"},{value:"true",label:"Enabled",description:"Allow network access in sandbox"}];return a.jsxs("div",{className:`cmd-bar${I?" drag-over":""}`,onDragOver:Ne,onDragLeave:re,onDrop:he,children:[me&&!oe&&a.jsx(xT,{commands:B,selectedIndex:Me,onSelect:$e,onHover:Z}),me&&oe==="sandbox"&&a.jsx(Xu,{title:"Sandbox Mode",options:Ct,currentValue:wt.sandboxMode,onSelect:Fe,onClose:()=>ie(void 0)}),me&&oe==="websearch"&&a.jsx(Xu,{title:"Web Search",options:zt,currentValue:wt.webSearchMode,onSelect:Fe,onClose:()=>ie(void 0)}),me&&oe==="network"&&a.jsx(Xu,{title:"Network Access",options:Lt,currentValue:wt.networkAccessEnabled===!0?"true":"false",onSelect:Fe,onClose:()=>ie(void 0)}),z&&a.jsx(kT,{filter:G,onSelect:en,onClose:()=>{Q(!1),r("")}}),P.length>0&&a.jsx("div",{className:"skill-badges",children:P.map(Y=>a.jsxs("span",{className:"skill-badge",children:["$",Y.name,a.jsx("button",{className:"skill-badge-remove",onClick:()=>ce(ge=>ge.filter(Ue=>Ue.id!==Y.id)),children:"×"})]},Y.id))}),E.length>0&&a.jsx("div",{className:"attachment-preview-area",children:E.map(Y=>a.jsxs("div",{className:"attachment-chip",title:Y.name,children:[Y.previewUrl?a.jsx("img",{src:Y.previewUrl,alt:Y.name,className:"attachment-thumb",onClick:()=>K(Y),style:{cursor:"pointer"}}):a.jsx(sv,{size:20,className:"attachment-file-icon"}),a.jsxs("div",{className:"attachment-info",children:[a.jsx("span",{className:"attachment-name",children:Y.name}),a.jsx("span",{className:"attachment-size",children:ng(Y.size)})]}),a.jsx("button",{className:"attachment-remove",onClick:()=>le(Y.id),title:"Remove attachment",children:a.jsx(Nn,{size:14})})]},Y.id))}),j&&!x&&!N&&a.jsx("input",{ref:l,type:"file",multiple:!0,accept:"image/*,application/pdf,text/*,.ts,.js,.tsx,.jsx,.py,.go,.rs,.java,.c,.cpp,.h,.css,.html,.xml,.yml,.yaml,.toml,.ini,.sh,.sql",style:{display:"none"},onChange:Y=>{X(Y.target.files),Y.target.value=""}}),a.jsxs("div",{className:"cmd-input-row",children:[j&&!x&&!N&&a.jsx("button",{className:"attachment-clip-btn",onClick:()=>{var Y;return(Y=l.current)==null?void 0:Y.click()},title:"Attach files",disabled:x,children:a.jsx(V1,{size:16})}),a.jsx("textarea",{ref:s,className:"cmd-textarea",placeholder:N?"Select or create a session…":S?"Interrupted — waiting to resume…":x?"Agent is running…":"Type a message… Use / for commands",autoComplete:"off",value:t,disabled:x||N,rows:1,style:{minHeight:vo,maxHeight:Yu},onChange:tn,onKeyDown:Ht,onPaste:Se}),x?a.jsx("button",{className:"cmd-stop-btn",onClick:()=>d(),title:"Stop (Esc)",children:a.jsx(Fs,{size:15})}):a.jsx("button",{className:"cmd-send-btn",onClick:ct,disabled:!t.trim()||N,title:"Send (⌘↵)",children:a.jsx(nv,{size:16})})]}),q&&a.jsx("div",{className:"image-preview-modal",onClick:()=>K(null),children:a.jsxs("div",{className:"image-preview-content",onClick:Y=>Y.stopPropagation(),children:[a.jsx("img",{src:q.previewUrl,alt:q.name}),a.jsxs("div",{className:"image-preview-info",children:[a.jsx("span",{children:q.name}),a.jsx("span",{children:ng(q.size)})]}),a.jsx("button",{className:"image-preview-close",onClick:()=>K(null),children:a.jsx(Nn,{size:20})})]})})]})}function ET(){const t=A(T=>T.activeSessionId),r=A(T=>T.activeSessionId?T.sessionDetails[T.activeSessionId]:null),s=A(T=>T.activeTurnIndex),i=A(T=>T.setActiveTurnIndex),l=A(T=>T.rewindToTurn),c=A(T=>T.restoreSession),d=A(T=>T.branchFromTurn),p=(r==null?void 0:r.turns)??[],g=Ol(r),m=!!(r!=null&&r.rewound_at_turn_id),v=(r==null?void 0:r.runtime_type)==="repoburg",k=v?"Rewind to this turn? Runtime history after this point is PERMANENTLY deleted and cannot be restored.":"Rewind to this turn? Hidden turns can be restored later.",[x,S]=y.useState(null),N=y.useRef(null);if(Oi(N,()=>S(null),!!x),Eo(()=>S(null),!!x),p.length===0)return a.jsx("div",{className:"empty-state",children:"No turns yet"});function C(T){i(T),requestAnimationFrame(()=>{var j;(j=document.getElementById(`turn-${T}`))==null||j.scrollIntoView({behavior:"smooth",block:"start"})})}return a.jsxs("div",{className:"right-section",children:[a.jsx("div",{className:"right-section-title",children:"Conversation"}),p.map((T,j)=>{const E=j===s,H=T.user_prompt.length>50?T.user_prompt.slice(0,50)+"…":T.user_prompt,I=T.status==="running"||T.status==="pending";return a.jsx("div",{children:a.jsxs("div",{className:`turn-item ${E?"active":""}`,onClick:()=>C(j),onContextMenu:L=>{L.preventDefault(),S({x:L.clientX,y:L.clientY,turnId:T.id,turnIndex:j,isLast:j===p.length-1,isSlashCommand:T.user_prompt.trimStart().startsWith("/")})},children:[a.jsx("span",{className:"turn-item-icon",style:{background:"var(--amber)",color:"#fff"},children:a.jsx(tk,{size:12})}),a.jsx("span",{className:"turn-item-label",children:H}),I&&a.jsx("span",{className:"turn-item-status",children:T.status==="pending"&&T.resume_state==="waiting"?"interrupted":"running…"})]})},T.id)}),x&&a.jsxs("div",{ref:N,className:"ctx-menu",style:{position:"fixed",left:x.x,top:x.y,zIndex:500},children:[a.jsxs("div",{className:`ctx-menu-item ${x.isLast||g||x.isSlashCommand?"ctx-disabled":""}`,onClick:()=>{x.isLast||g||x.isSlashCommand||(window.confirm(k)&&l(t,x.turnId),S(null))},children:[a.jsx(X1,{size:12})," Rewind to Here",x.isSlashCommand?" (slash command)":""]}),m&&!v&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{c(t),S(null)},children:[a.jsx(Ai,{size:12})," Restore Rewind"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{d(t,x.turnId),S(null)},children:[a.jsx(iv,{size:12})," Branch from Here"]})]})]})}function Jd(t){return(t??[]).filter(r=>r.task_type!=="local_agent").length}const sg=2e4;function jT(t){const r=[];return t.forEach((s,i)=>{var l;for(const c of s.items)if(c.type==="background_task"){if((((l=c.data)==null?void 0:l.task_type)||"unknown")==="local_agent")continue;r.push({item:c,turnIndex:i,turnPrompt:s.user_prompt})}}),r}function _T({entry:t}){const{item:r,turnIndex:s,turnPrompt:i}=t,l=r.data||{},c=l.task_type||"unknown",d=l.subagent_type||null,p=l.description||"",g=l.summary||null,m=l.last_tool_name||null,v=l.token_count||null,k=l.output||"",x=r.status==="in_progress",S=l.status||"running",N=!x&&S==="running"?"stopped":S,C=c==="local_agent",T=c==="local_bash",j=C?ms:T?fv:rv,E=C?`Subagent${d?`: ${d}`:""}`:T?"Monitor":"Background Task",H=N==="running"?"running…":N==="completed"?"done":N==="failed"?"failed":N==="stopped"?"stopped":N,I=N==="failed"||r.status==="failed"&&N!=="stopped",[L,q]=y.useState(x),[K,$]=y.useState(!1),te=y.useRef(null);y.useEffect(()=>{x&&q(!0)},[x]),y.useEffect(()=>{L&&x&&te.current&&(te.current.scrollTop=te.current.scrollHeight)},[L,x,k]);const me=k.length>sg,ue=me&&!K?k.slice(0,sg)+`
675
+ … (truncated, click to expand)`:k,ye=x?null:N==="completed"?a.jsx(Tr,{size:12}):I?a.jsx(Fl,{size:12}):a.jsx(Fs,{size:12});return a.jsxs("div",{className:`task-card ${x?"task-running":""} ${I?"task-failed":""}`,children:[a.jsxs("div",{className:"task-card-header",onClick:()=>q(be=>!be),style:{cursor:"pointer"},children:[a.jsx("span",{className:"task-card-icon",children:a.jsx(j,{size:14})}),a.jsx("span",{className:"task-card-type",children:E}),a.jsxs("span",{className:`task-card-status ${I?"task-status-failed":x?"task-status-running":"task-status-done"}`,children:[ye," ",H]}),a.jsx(_i,{size:14,className:"task-card-chevron",style:{transform:L?"rotate(90deg)":"none",marginLeft:"auto"}})]}),p&&a.jsx("div",{className:"task-card-desc",children:p}),x&&m&&a.jsxs("div",{className:"task-card-meta",children:["last tool: ",m,v!=null&&` · ${v.toLocaleString()} tokens`]}),L&&a.jsxs("div",{className:"task-card-body",children:[k?a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"cmd-output task-output",ref:te,children:a.jsx("code",{children:ue})}),me&&a.jsx("button",{className:"cmd-output-toggle",onClick:()=>$(be=>!be),children:K?"Show less":`Show full output (${(k.length/1024).toFixed(0)}KB)`})]}):g?a.jsx("pre",{className:"cmd-output task-output",children:a.jsx("code",{children:g})}):x?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:i,children:["from turn ",s+1,": ",i.length>60?i.slice(0,60)+"…":i]})]})]})}const RT=y.memo(_T);function AT(){const t=A(d=>d.activeSessionId?d.sessionDetails[d.activeSessionId]:null),r=A(d=>d.activeSessionId?d.backgroundTasks[d.activeSessionId]:void 0),s=(t==null?void 0:t.turns)??[],i=jT(s),l=[...i].sort((d,p)=>{const g=d.item.status==="in_progress",m=p.item.status==="in_progress";return g&&!m?-1:!g&&m?1:p.turnIndex-d.turnIndex}),c=Jd(r);return i.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 (",i.length,")",c>0&&a.jsxs("span",{className:"task-count-badge",style:{color:"var(--amber)"},children:[" ",c," running"]})]}),l.map(d=>a.jsx(RT,{entry:d},d.item.id))]})}const IT=y.memo(AT),DT="Your job is to answer questions about this session:",og="Understand the user's question below, read the session file given above, and answer.",MT=new Set(["claude"]);function LT(t){return MT.has(t)}function ef(t){return t.kind==="sidecar"}function OT(t){const r=(t??[]).filter(ef);return r.length?r[r.length-1]:null}function PT(t){if(!t.startsWith(DT))return t;const r=t.indexOf(og);return r<0?t:t.slice(r+og.length).replace(/^\n+/,"")}function $T({thread:t,onClose:r}){const{activeSessionId:s,resolveThread:i,shareThread:l}=A(),[c,d]=y.useState(""),[p,g]=y.useState(!1),[m,v]=y.useState(!1);async function k(){if(!s||p)return;g(!0),await l(s,t.id,c)?r():g(!1)}async function x(){!s||m||(v(!0),await i(s,t.id),r())}const S=p||m;return a.jsx("div",{className:"dialog-overlay",onClick:S?void 0:r,children:a.jsxs("div",{className:"dialog",onClick:N=>N.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:r,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:N=>d(N.target.value),rows:3,disabled:S,autoFocus:!0})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:r,disabled:S,children:"Cancel"}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:x,disabled:S,title:"Resolve without sharing",children:[m?a.jsx(hn,{size:13,className:"spin"}):a.jsx(xl,{size:13}),"Resolve only"]}),a.jsxs("button",{className:"dialog-btn-create",onClick:k,disabled:S,children:[p?a.jsx(hn,{size:13,className:"spin"}):a.jsx(Z1,{size:13}),p?"Summarizing…":"Share & Resolve"]})]})]})})}const ig=[];Ke.setOptions({breaks:!0,gfm:!0});function zT(t){const r=Ke.parse(t);return Zd.sanitize(r)}function FT(t){var r,s,i;if(t.type==="agent_message"||t.type==="final_result"){const l=(r=t.data)==null?void 0:r.text;return typeof l=="string"&&l?l:null}if(t.type==="ask_user"){const l=Array.isArray((s=t.data)==null?void 0:s.groups)?t.data.groups:[],c=[(i=t.data)==null?void 0:i.question,...l.map(d=>d.question)].filter(d=>typeof d=="string"&&!!d);return c.length?c.join(`
676
+
677
+ `):null}return null}function UT(t){const r=t.match(/^\[Quoting from your previous response\]:\n> .*\n\n([\s\S]*)$/);return r?r[1]:t}function py({turn:t,formatPrompt:r=UT}){const s=r(t.user_prompt),i=t.items.map(FT).filter(l=>l!==null);return i.length===0&&t.status==="completed"&&t.agent_response&&i.push(t.agent_response),a.jsxs("div",{className:"thread-card-turn",children:[a.jsx("div",{className:"thread-card-user-message",children:s}),i.map((l,c)=>a.jsx("div",{className:"thread-card-ai-response",dangerouslySetInnerHTML:{__html:zT(l)}},c)),i.length===0&&(t.status==="pending"||t.status==="running")&&a.jsx("div",{className:"thread-card-pending",children:t.status==="running"?"AI is responding…":"Waiting…"}),t.status==="failed"&&a.jsx("div",{className:"thread-card-pending",children:t.error||"Turn failed"})]})}function BT({thread:t,threadTurns:r,onStop:s,onResolve:i,onReopen:l,onDelete:c,onFollowup:d,onLocate:p}){var be,Me,Z;const[g,m]=y.useState(""),[v,k]=y.useState(!0),x=y.useRef(null),S=y.useRef(null),[N,C]=y.useState(!1),[T,j]=y.useState({x:0,y:0}),[E,H]=y.useState(""),I=r.some(zr),L=28,q=120,K=y.useRef(L);y.useEffect(()=>{const oe=S.current;oe&&(oe.scrollTop=oe.scrollHeight)},[r.length,v]);function $(oe){const ie=x.current;ie&&(ie.style.height=`${oe}px`,K.current=oe)}function te(){const oe=x.current;if(oe){if(oe.scrollHeight>oe.clientHeight){const ie=Math.min(oe.scrollHeight,q);ie!==K.current&&$(ie);return}K.current>L&&(oe.style.height="auto",$(Math.min(oe.scrollHeight,q)))}}const me=y.useCallback(()=>{C(!1)},[]),ue=y.useCallback(()=>{const oe=S.current;if(!oe)return;const ie=window.getSelection();if(!ie||ie.rangeCount===0||ie.isCollapsed){C(!1);return}const z=ie.getRangeAt(0);if(!oe.contains(z.commonAncestorContainer)){C(!1);return}const Q=z.commonAncestorContainer.nodeType===Node.TEXT_NODE?z.commonAncestorContainer.parentElement:z.commonAncestorContainer;if(!(Q!=null&&Q.closest(".thread-card-ai-response"))){C(!1);return}const G=ie.toString();if(!G.trim()){C(!1);return}const D=z.getBoundingClientRect(),P=28,ce=6,B=170;let X=!1;if(ie.anchorNode&&ie.focusNode)try{const re=document.createRange();re.setStart(ie.focusNode,ie.focusOffset),re.setEnd(ie.focusNode,ie.focusOffset);const he=document.createRange();he.setStart(ie.anchorNode,ie.anchorOffset),he.setEnd(ie.anchorNode,ie.anchorOffset),X=he.compareBoundaryPoints(Range.START_TO_START,re)>0}catch{X=!1}let le=D.top-P-ce;le<8&&(le=D.bottom+ce);let Ne=X?D.left-B:D.right;Ne=Math.max(8,Math.min(Ne,window.innerWidth-B-8)),j({x:Ne,y:le}),H(G),C(!0)},[]);y.useEffect(()=>{function oe(ie){const z=ie.target;z&&z.closest(".selection-actions")||ue()}return document.addEventListener("mouseup",oe),()=>document.removeEventListener("mouseup",oe)},[ue]);const ye=y.useCallback(()=>{var ie;const oe=`
678
+ \`\`\`QUOTE
679
+ ${E}
680
+ \`\`\`
681
+
682
+ `;m(z=>z+oe),C(!1),H(""),(ie=window.getSelection())==null||ie.removeAllRanges(),setTimeout(()=>{if(x.current){te(),x.current.focus();const z=x.current.value.length;x.current.setSelectionRange(z,z)}},0)},[E]);return a.jsxs("div",{className:`thread-card ${t.status==="resolved"?"thread-resolved":""}`,id:`thread-${t.id}`,children:[a.jsxs("div",{className:"thread-card-header",onClick:()=>k(oe=>!oe),children:[a.jsx("div",{className:"thread-card-quote",children:t.selected_text===null?((Z=(Me=(be=t.turns)==null?void 0:be[0])==null?void 0:Me.user_prompt)==null?void 0:Z.slice(0,100))||"Quick question":`“${t.selected_text.slice(0,100)}${t.selected_text.length>100?"…":""}”`}),a.jsxs("div",{className:"thread-card-header-right",children:[t.selected_text!==null&&a.jsx("button",{className:"thread-locate-btn",onClick:oe=>{oe.stopPropagation(),p()},title:"Scroll to text",children:a.jsx(U1,{size:12})}),a.jsx("span",{className:`thread-status-badge ${t.status==="open"?"thread-status-open":"thread-status-resolved"}`,children:t.status==="open"?"Open":"Resolved"})]})]}),v&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"thread-card-conversation",ref:S,onMouseDown:me,children:[r.map(oe=>a.jsx(py,{turn:oe},oe.id)),r.length===0&&a.jsx("div",{className:"thread-card-placeholder",children:"No messages yet."})]}),N&&a.jsx("div",{className:"selection-actions",style:{left:T.x,top:T.y},children:a.jsxs("button",{className:"discuss-button",onClick:ye,title:"Quote this text in your follow-up",children:[a.jsx(uv,{size:14}),a.jsx("span",{children:"Quote"})]})}),t.status==="open"&&a.jsxs("div",{className:"thread-card-followup",children:[a.jsx("textarea",{ref:x,className:"thread-card-followup-input",placeholder:I?"Agent is running…":"Type a follow-up…",value:g,onChange:oe=>{Dt.markInputChange(),m(oe.target.value),te()},disabled:I,rows:1,style:{minHeight:L,maxHeight:q},onKeyDown:oe=>{Dt.markKeystroke(),oe.key==="Enter"&&(oe.metaKey||oe.ctrlKey)&&!I&&g.trim()&&(oe.preventDefault(),d(g.trim()),m(""),$(L))}}),a.jsx("button",{className:"thread-card-followup-send",disabled:I||!g.trim(),onClick:()=>{d(g.trim()),m("")},children:a.jsx(Pi,{size:13})}),I&&a.jsx("button",{className:"thread-card-followup-stop",onClick:s,title:"Stop this thread's turn (Esc)",children:a.jsx(Fs,{size:13})})]}),a.jsxs("div",{className:"thread-card-actions",children:[t.status==="open"?a.jsxs("button",{className:"thread-action-btn",onClick:i,title:"Resolve thread",children:[a.jsx(xl,{size:13})," Resolve"]}):a.jsxs("button",{className:"thread-action-btn",onClick:l,title:"Reopen thread",children:[a.jsx(Ai,{size:13})," Reopen"]}),a.jsxs("button",{className:"thread-action-btn thread-action-danger",onClick:c,title:"Delete thread",children:[a.jsx(ur,{size:13})," Delete"]})]})]})]})}function WT(){Dt.trackRender("ThreadsPanel");const t=A(j=>j.activeSessionId),r=A(j=>{var E;return j.activeSessionId?((E=j.sessionDetails[j.activeSessionId])==null?void 0:E.threads)??ig:ig}),s=y.useMemo(()=>r.filter(j=>!ef(j)),[r]),i=A(j=>j.followupThread),l=A(j=>j.cancelThreadTurn),c=A(j=>j.reopenThread),d=A(j=>j.deleteThread),p=A(j=>j.deepLinkThreadId),g=A(j=>j.setDeepLinkThreadId),[m,v]=y.useState("open"),[k,x]=y.useState(null);y.useEffect(()=>{if(!p)return;const j=p;g(null),v(H=>s.some(I=>I.id===j&&I.status==="open")?H:"all");const E=setTimeout(()=>{const H=document.getElementById(`thread-${j}`);H&&(H.scrollIntoView({behavior:"smooth",block:"center"}),H.classList.add("thread-card-highlighted"),setTimeout(()=>H.classList.remove("thread-card-highlighted"),1500))},100);return()=>clearTimeout(E)},[p,g,s]);const S=s.filter(j=>m==="open"?j.status==="open":m==="resolved"?j.status==="resolved":!0),N=s.filter(j=>j.status==="open").length,C=s.filter(j=>j.status==="resolved").length;function T(j){setTimeout(()=>{const E=document.querySelector(`mark[data-thread-id="${j}"]`);E&&(E.scrollIntoView({behavior:"smooth",block:"center"}),E.classList.add("thread-mark-flash"),setTimeout(()=>E.classList.remove("thread-mark-flash"),1500))},50)}return t?s.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx(cv,{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 (",N,")"]}),a.jsxs("button",{className:`thread-filter-tab ${m==="resolved"?"active":""}`,onClick:()=>v("resolved"),children:["Resolved (",C,")"]}),a.jsxs("button",{className:`thread-filter-tab ${m==="all"?"active":""}`,onClick:()=>v("all"),children:["All (",s.length,")"]})]}),S.length===0?a.jsxs("div",{className:"empty-state",style:{padding:"20px 0"},children:["No ",m," threads."]}):S.map(j=>a.jsx(BT,{thread:j,threadTurns:j.turns??[],onStop:()=>l(t,j.id),onResolve:()=>x(j),onReopen:()=>c(t,j.id),onDelete:()=>d(t,j.id),onFollowup:E=>i(t,j.id,E),onLocate:()=>T(j.id)},j.id)),k&&a.jsx($T,{thread:k,onClose:()=>x(null)})]}):a.jsx("div",{className:"empty-state",children:"No session selected"})}function HT(){const t=A(d=>d.apps),r=A(d=>d.activeAppTabId),s=A(d=>d.openAppTab),i=A(d=>d.startAppEdit),l=A(d=>d.toggleAppPin),c=A(d=>d.deleteApp);return t.length===0?a.jsx("div",{className:"empty-state",style:{padding:"16px"},children:"No mini apps yet. Add one with the + button in the sidebar Apps section."}):a.jsx("div",{className:"apps-panel",children:t.map(d=>a.jsxs("div",{className:`apps-panel-row${r===d.id?" active":""}`,onClick:()=>s(d.id),title:d.description??void 0,children:[a.jsx(jo,{iconNode:d.iconNode,size:14,className:"sidebar-app-icon"}),a.jsxs("div",{className:"apps-panel-info",children:[a.jsx("span",{className:"apps-panel-title",children:d.title}),d.description&&a.jsx("span",{className:"apps-panel-desc",children:d.description})]}),a.jsx("button",{className:"apps-panel-action",title:"Edit app with the agent",onClick:p=>{p.stopPropagation(),i(d.id)},children:a.jsx(ll,{size:12})}),a.jsx("button",{className:`apps-panel-action${d.pinned?" pinned":""}`,title:d.pinned?"Unpin app":"Pin app (sorts first)",onClick:p=>{p.stopPropagation(),l(d.id)},children:a.jsx(kl,{size:12,fill:d.pinned?"currentColor":"none"})}),a.jsx("button",{className:"apps-panel-action apps-panel-danger",title:"Delete app",onClick:p=>{p.stopPropagation(),c(d.id)},children:a.jsx(ur,{size:12})})]},d.id))})}const VT=24;function KT(){Dt.trackRender("SidecarPanel");const t=A(j=>j.activeSessionId),r=A(j=>{var E;return j.activeSessionId?(E=j.sessionDetails[j.activeSessionId])==null?void 0:E.runtime_type:void 0}),s=A(j=>{var E;return j.activeSessionId?OT((E=j.sessionDetails[j.activeSessionId])==null?void 0:E.threads):null}),i=A(j=>j.askSidecar),l=A(j=>j.cancelThreadTurn),c=A(j=>j.deleteThread),[d,p]=y.useState(""),[g,m]=y.useState(!1),v=y.useRef(null),k=y.useRef(!0),x=(s==null?void 0:s.turns)??[],S=x[x.length-1],N=x.some(zr);if(y.useEffect(()=>{k.current=!0},[t,x.length]),y.useEffect(()=>{const j=v.current;j&&k.current&&(j.scrollTop=j.scrollHeight)},[t,x.length,S==null?void 0:S.items.length,S==null?void 0:S.status]),!t||!r)return a.jsx("div",{className:"empty-state",children:"No session selected"});if(!LT(r))return a.jsxs("div",{className:"empty-state",children:[a.jsx(ms,{size:24,style:{opacity:.3,marginBottom:8}}),a.jsxs("div",{children:["The sidecar is not available for ",r," sessions yet."]})]});const C=!N&&!g&&d.trim().length>0;async function T(){if(!t||!C)return;m(!0);const j=await i(t,d.trim());m(!1),j&&p("")}return a.jsxs("div",{className:"sidecar-panel",children:[a.jsx("div",{ref:v,className:"sidecar-conversation",onScroll:j=>{const E=j.currentTarget;k.current=E.scrollHeight-E.scrollTop-E.clientHeight<=VT},children:x.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx(ms,{size:24,style:{opacity:.3,marginBottom:8}}),a.jsx("div",{children:"Ask about this session."}),a.jsx("div",{className:"sidecar-hint",children:"Where does it stand? Is it stuck? When will it finish? What is done and what is left?"})]}):x.map(j=>a.jsx(py,{turn:j,formatPrompt:PT},j.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:N?"Sidecar is answering…":"Ask about this session… (⌘/Ctrl+Enter)",value:d,rows:2,disabled:N,onChange:j=>{Dt.markInputChange(),p(j.target.value)},onKeyDown:j=>{Dt.markKeystroke(),j.key==="Enter"&&(j.metaKey||j.ctrlKey)&&(j.preventDefault(),T())}}),N&&s?a.jsx("button",{className:"thread-card-followup-stop",title:"Stop the answer","aria-label":"Stop the answer",onClick:()=>l(t,s.id),children:a.jsx(Fs,{size:13})}):a.jsx("button",{className:"thread-card-followup-send",title:"Ask","aria-label":"Ask",disabled:!C,onClick:()=>void T(),children:a.jsx(Pi,{size:13})})]}),s&&a.jsx("div",{className:"thread-card-actions",children:a.jsxs("button",{className:"thread-action-btn thread-action-danger",title:"Clear the sidecar conversation",disabled:N,onClick:()=>c(t,s.id),children:[a.jsx(ur,{size:13})," Clear"]})})]})]})}function GT(){var g;Dt.trackRender("RightPanel");const t=A(m=>m.activeRightTab),r=A(m=>m.switchRightTab),s=A(m=>m.rightPanelCollapsed),i=A(m=>m.toggleRightPanel),l=A(m=>m.activeSessionId?m.sessionDetails[m.activeSessionId]:null),c=A(m=>m.activeSessionId?Jd(m.backgroundTasks[m.activeSessionId]):0),d=((g=l==null?void 0:l.threads)==null?void 0:g.filter(m=>m.status==="open"&&!ef(m)).length)??0,p=[{id:"turns",label:"Turns",icon:L1},{id:"sidecar",label:"Sidecar",icon:ms},{id:"tasks",label:"Tasks",icon:M1,badge:c||void 0},{id:"threads",label:"Threads",icon:cv,badge:d||void 0},{id:"apps",label:"Apps",icon:lv}];return s?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:i,children:a.jsx(W1,{size:15})}),a.jsx("div",{className:"right-rail-divider"}),p.map(m=>{const v=m.icon,k=m.badge?`${m.label} (${m.badge})`:m.label;return a.jsxs("button",{type:"button",className:`right-icon-btn right-rail-tab ${t===m.id?"active":""}`,title:k,"aria-label":k,onClick:()=>r(m.id),children:[a.jsx(v,{size:15}),m.badge?a.jsx("span",{className:"right-tab-badge",children:m.badge}):null]},m.id)})]}):a.jsxs("div",{className:"ide-right",children:[a.jsxs("div",{className:"right-header",children:[a.jsx("div",{className:"right-tabs",children:p.map(m=>a.jsxs("div",{className:`right-tab ${t===m.id?"active":""}`,onClick:()=>r(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:i,children:a.jsx(B1,{size:14})})]}),a.jsxs("div",{className:"right-content",children:[t==="turns"&&a.jsx(ET,{}),t==="sidecar"&&a.jsx(KT,{}),t==="tasks"&&a.jsx(IT,{}),t==="threads"&&a.jsx(WT,{}),t==="apps"&&a.jsx(HT,{})]})]})}const Ae={low:{effort:"low",label:"Low"},medium:{effort:"medium",label:"Medium"},high:{effort:"high",label:"High"},xhigh:{effort:"xhigh",label:"Extra High"},max:{effort:"max",label:"Max"},ultra:{effort:"ultra",label:"Ultra"}},md=[{id:"codex",label:"Codex",available:!0,models:[{slug:"gpt-5.6-sol",displayName:"GPT-5.6-Sol",description:"Flagship — complex, open-ended work",defaultReasoning:"low",reasoningLevels:[Ae.low,Ae.medium,Ae.high,Ae.xhigh,Ae.max,Ae.ultra]},{slug:"gpt-5.6-terra",displayName:"GPT-5.6-Terra",description:"Balanced all-rounder for everyday work",defaultReasoning:"medium",reasoningLevels:[Ae.low,Ae.medium,Ae.high,Ae.xhigh,Ae.max,Ae.ultra]},{slug:"gpt-5.6-luna",displayName:"GPT-5.6-Luna",description:"Fast, affordable — clear, repeatable tasks",defaultReasoning:"medium",reasoningLevels:[Ae.low,Ae.medium,Ae.high,Ae.xhigh,Ae.max]},{slug:"gpt-5.5",displayName:"GPT-5.5",description:"Previous-gen frontier model",defaultReasoning:"medium",reasoningLevels:[Ae.low,Ae.medium,Ae.high,Ae.xhigh]}]},{id:"claude",label:"Claude",available:!0,models:[{slug:"claude-sonnet-5-5",displayName:"Claude Sonnet 5.5",description:"Best combination of speed and intelligence",defaultReasoning:"medium",reasoningLevels:[Ae.low,Ae.medium,Ae.high,Ae.xhigh,Ae.max]},{slug:"claude-sonnet-5",displayName:"Claude Sonnet 5",description:"Previous-gen balanced all-rounder",defaultReasoning:"medium",reasoningLevels:[Ae.low,Ae.medium,Ae.high,Ae.xhigh,Ae.max]},{slug:"claude-opus-5",displayName:"Claude Opus 5",description:"Deep reasoning for complex tasks",defaultReasoning:"medium",reasoningLevels:[Ae.low,Ae.medium,Ae.high,Ae.xhigh,Ae.max]},{slug:"claude-fable-5",displayName:"Claude Fable 5",description:"Fast and efficient for simple tasks",defaultReasoning:"medium",reasoningLevels:[Ae.low,Ae.medium,Ae.high,Ae.xhigh,Ae.max]}]},{id:"repoburg",label:"Repoburg",available:!0,models:[{slug:"ollama/glm-5.3:cloud",displayName:"GLM-5.3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[Ae.low,Ae.medium,Ae.high]},{slug:"ollama/glm-5.3-flash:cloud",displayName:"GLM-5.3 Flash",description:"Ollama Cloud — fast",defaultReasoning:"medium",reasoningLevels:[Ae.low,Ae.medium,Ae.high]},{slug:"ollama/minimax-m3:cloud",displayName:"MiniMax M3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[Ae.low,Ae.medium,Ae.high]},{slug:"ollama/deepseek-v4-pro:cloud",displayName:"DeepSeek V4 Pro",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[Ae.low,Ae.medium,Ae.high]}]}];function qT(t){return md.find(r=>r.id===t)}function tf(t){const r=qT(t);return(r==null?void 0:r.models)??[]}function hy(t,r){return tf(t).find(s=>s.slug===r)}function gd(t,r){var s;return((s=hy(t,r))==null?void 0:s.reasoningLevels)??[]}function vd(t,r){var s;return(s=hy(t,r))==null?void 0:s.defaultReasoning}function XT(){const{activeSessionId:t,sessions:r,updateModelConfig:s}=A(),i=A(Z=>Z.showModelSelector),l=A(Z=>Z.setShowModelSelector),c=r.find(Z=>Z.id===t),d=A(Z=>Z.models),p=A(Z=>Z.modelsLoading),g=A(Z=>Z.loadModels),[m,v]=y.useState(!1),k=y.useRef(null);if(Oi(k,()=>v(!1),m),Eo(()=>v(!1),m),y.useEffect(()=>{i&&(v(!0),l(!1))},[i,l]),y.useEffect(()=>{c!=null&&c.runtime_type&&g(c.runtime_type,c.cwd??void 0)},[c==null?void 0:c.runtime_type,c==null?void 0:c.cwd,g]),!c)return null;const x=c.runtime_type,S=c.model??"",N=c.model_reasoning_effort??"",C=d.length>0?d:[],T=tf(x),E=[...C.length>0?C:T];if(S&&!E.some(Z=>Z.slug===S)){const Z=T[0];E.unshift({slug:S,displayName:S,description:"Custom model",defaultReasoning:(Z==null?void 0:Z.defaultReasoning)??"medium",reasoningLevels:(Z==null?void 0:Z.reasoningLevels)??[]})}function H(Z){return E.find(oe=>oe.slug===Z)}function I(Z){var oe;return C.length>0?((oe=H(Z))==null?void 0:oe.reasoningLevels)??[]:gd(x,Z)}function L(Z){var oe;return C.length>0?(oe=H(Z))==null?void 0:oe.defaultReasoning:vd(x,Z)}const q=md.find(Z=>Z.id===x),K=H(S),$=S?I(S):[],te=(q==null?void 0:q.label)??x,me=(K==null?void 0:K.displayName)??(S||"Default"),ue=$.find(Z=>Z.effort===N),ye=(ue==null?void 0:ue.label)??(N||"Default");function be(Z){var Q;const oe=I(Z),z=oe.some(G=>G.effort===N)?N:L(Z)??((Q=oe[0])==null?void 0:Q.effort)??"";s(Z,z),v(!1)}function Me(Z){s(S,Z),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:te}),a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-model",children:me}),ye!=="Default"&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-reasoning",children:ye})]}),a.jsx(No,{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"}),md.map(Z=>a.jsxs("div",{className:`model-selector-item ${Z.id===x?"selected":""} ${Z.available?"":"disabled"}`,onClick:()=>{if(Z.available){if(Z.id===x){v(!1);return}s("","",Z.id)}},children:[a.jsx("span",{children:Z.label}),!Z.available&&a.jsxs("span",{className:"model-selector-coming-soon",children:[a.jsx($1,{size:10})," Soon"]}),Z.id===x&&a.jsx(Tr,{size:12})]},Z.id))]}),a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Model"}),p&&a.jsx("div",{className:"model-selector-empty",children:"Loading models…"}),!p&&E.length===0&&a.jsx("div",{className:"model-selector-empty",children:"No models available"}),E.map(Z=>a.jsxs("div",{className:`model-selector-item ${Z.slug===S?"selected":""}`,onClick:()=>be(Z.slug),children:[a.jsxs("div",{className:"model-selector-item-main",children:[a.jsx("span",{className:"model-selector-item-name",children:Z.displayName}),a.jsx("span",{className:"model-selector-item-desc",children:Z.description})]}),Z.slug===S&&a.jsx(Tr,{size:12})]},Z.slug))]}),a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Thinking"}),$.length===0&&a.jsx("div",{className:"model-selector-empty",children:"Select a model first"}),$.map(Z=>a.jsxs("div",{className:`model-selector-item ${Z.effort===N?"selected":""}`,onClick:()=>Me(Z.effort),children:[a.jsx("span",{children:Z.label}),Z.effort===N&&a.jsx(Tr,{size:12})]},Z.effort))]})]})]})}function vi(t){return t>=1e6?`${(t/1e6).toFixed(t%1e6===0?0:1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}function ag(){const t=A(s=>s.canGoBack),r=A(s=>s.canGoForward);return a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"sb-item sb-btn",title:"Back","aria-label":"Back",disabled:!t,onClick:()=>window.history.back(),children:a.jsx(y1,{size:14})}),a.jsx("button",{className:"sb-item sb-btn",title:"Forward","aria-label":"Forward",disabled:!r,onClick:()=>window.history.forward(),children:a.jsx(x1,{size:14})})]})}function lg(){const t=A(r=>r.setShowRemoteModal);return a.jsxs("div",{className:"sb-item",style:{cursor:"pointer"},title:"Remote access — make this machine remote",onClick:()=>t(!0),children:[a.jsx(rk,{size:14})," Repoburg"]})}function cg(){const t=A(s=>s.usageViewOpen),r=A(s=>s.toggleUsageView);return a.jsxs("button",{className:`sb-item sb-btn${t?" sb-item-active":""}`,title:t?"Back to the agent view":"Usage Center",onClick:r,children:[a.jsx(ov,{size:14})," Usage"]})}function ug(){const t=A(s=>s.vscodeViewOpen),r=A(s=>s.toggleVscodeView);return a.jsxs("button",{className:`sb-item sb-btn${t?" sb-item-active":""}`,title:t?"Back to the agent view":"Open VS Code",onClick:r,children:[a.jsx(T1,{size:14})," Code"]})}function dg(){const t=A(s=>s.terminalViewOpen),r=A(s=>s.toggleTerminalView);return a.jsxs("button",{className:`sb-item sb-btn${t?" sb-item-active":""}`,title:t?"Back to the agent view":"Open a terminal",onClick:r,children:[a.jsx(pv,{size:14})," Terminal"]})}function YT(){Dt.trackRender("StatusBar");const t=A(v=>v.activeSessionId),r=A(v=>t?v.sessions.find(k=>k.id===t)??null:null),s=A(v=>t?v.sessionDetails[t]??null:null),i=A(v=>t?v.backgroundTasks[t]:void 0),l=A(v=>v.wsConnected),c=A(v=>v.switchRightTab),d=(s==null?void 0:s.contextUsage)??null;if(!r)return a.jsxs("div",{className:"ide-statusbar",children:[a.jsx(ag,{}),a.jsx(lg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(ug,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(dg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(cg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx("div",{className:"sb-item",title:l?"WebSocket connected":"WebSocket disconnected",children:l?"Live":"Offline"}),a.jsx("div",{className:"sb-spacer"}),a.jsxs("div",{className:"sb-item",children:[a.jsx(om,{size:14})," K"]})]});const p=i??[],g=zl(r,p.length),m=Jd(p);return a.jsxs("div",{className:"ide-statusbar",children:[a.jsx(ag,{}),a.jsx(lg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(ug,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(dg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(cg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(XT,{}),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(hv,{size:14})," ",m]})]}),a.jsx("div",{className:"sb-spacer"}),a.jsx("div",{className:"sb-item",title:l?"WebSocket connected":"WebSocket disconnected",children:l?"Live":"Offline"}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx("div",{className:"sb-item",style:g.dot==="background"?{color:"var(--purple)"}:r.status==="failed"?{color:"var(--red)"}:void 0,title:g.dot==="background"?g.dotTitle:void 0,children:g.label}),d&&a.jsx(QT,{usage:d}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsxs("div",{className:"sb-item",children:[a.jsx(om,{size:14})," K"]})]})}function QT({usage:t}){const r=t.percentage>=85?"var(--red)":t.percentage>=60?"var(--amber)":"var(--green)",s=`${vi(t.totalTokens)} / ${vi(t.contextWindow)} tokens`+(t.autoCompactThreshold?` · auto-compacts at ${vi(t.autoCompactThreshold)}`:"");return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx("div",{className:"sb-context",title:s,children:a.jsxs("span",{className:"sb-context-text",style:{color:r},children:[Math.round(t.percentage),"% / ",vi(t.totalTokens)," / ",vi(t.contextWindow)]})})]})}function fg(t){return Mt(`/vscode-web/status?folder=${encodeURIComponent(t??"")}`)}function ZT(t){return it("/vscode-web/start",{folder:t})}function JT(t){return it("/vscode-web/heartbeat",{id:t})}const eC=1e3,tC=5*6e4;function pg({children:t}){const r=A(s=>s.toggleVscodeView);return a.jsxs("div",{className:"vscode-view vscode-view--loading",children:[t,a.jsx("button",{className:"dialog-close vscode-view-close",title:"Close VS Code view","aria-label":"Close VS Code view",onClick:r,children:a.jsx(Nn,{size:16})})]})}function nC(){const t=A(N=>N.vscodeState),r=A(N=>N.vscodeId),s=A(N=>N.vscodeToken),i=A(N=>N.setVscodeView),l=A(N=>{var T;const C=N.activeSessionId?N.sessions.find(j=>j.id===N.activeSessionId):null;return C!=null&&C.cwd?C.cwd:((T=N.workspaces.find(j=>j.deleted===0))==null?void 0:T.path)??null}),[c,d]=y.useState(!1),[p,g]=y.useState(0),m=y.useRef(null),v=mn(),k=v===""||v===window.location.origin,x=`${v}/vscode/${r??""}/?tkn=${s??""}${l?`&folder=${encodeURIComponent(l)}`:""}`;y.useEffect(()=>{let N=!1;function C(){m.current&&(clearInterval(m.current),m.current=null)}async function T(){try{let E=await fg(l);if((E.state==="stopped"||E.state==="error")&&(E=await ZT(l)),N||(i(E.state,E.id,E.token),E.state==="running"||E.state==="error"))return;m.current=setInterval(async()=>{const H=await fg(l);N||(i(H.state,H.id,H.token),(H.state==="running"||H.state==="error"||H.state==="stopped")&&C())},eC)}catch{N||i("error",null,null)}}T();const j=setInterval(()=>{const E=A.getState().vscodeId;E&&JT(E).catch(()=>{})},tC);return()=>{N=!0,C(),clearInterval(j)}},[p,l,i]);function S(){d(!1),i("starting",null,null),g(N=>N+1)}return t!=="running"||!s||!r?a.jsx(pg,{children:t==="error"?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"VS Code could not start."}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:S,children:[a.jsx(Ai,{size:14})," Retry"]})]}):a.jsxs("span",{className:"vscode-view-hint",children:[a.jsx(hn,{size:16,className:"spin"})," Starting VS Code — first start downloads the server component (~20 s)."]})}):k?a.jsxs("div",{className:"vscode-view",children:[!c&&a.jsxs("div",{className:"vscode-view-overlay",children:[a.jsx(hn,{size:16,className:"spin"})," Loading VS Code…"]}),a.jsx("iframe",{src:x,title:"VS Code",className:"vscode-view-frame",onLoad:()=>d(!0)},r)]}):a.jsxs(pg,{children:[a.jsx("span",{children:"VS Code cannot be embedded on this host — serve-web allows same-origin frames only."}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:()=>window.open(x,"_blank","noopener"),children:[a.jsx(E1,{size:14})," Open VS Code in a new tab"]})]})}function hg(t,r){const s=new URLSearchParams;t&&s.set("since",t),r&&s.set("until",r);const i=s.toString();return Mt(`/usage/summary${i?`?${i}`:""}`)}const my="agentpane:usage-budget";function cr(t){return t>=1e6?`${(t/1e6).toFixed(t%1e6===0?0:1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}function Os(t){return`$${t>=100?t.toFixed(0):t>=1?t.toFixed(2):t.toFixed(4).replace(/0+$/,"").replace(/\.$/,"")}`}function rC(t,r=new Date){if(t==="all")return{since:null,until:null};const s=new Date(r);return t==="today"?s.setHours(0,0,0,0):s.setDate(s.getDate()-(t==="7d"?7:30)),{since:s.toISOString(),until:null}}function sC(t=new Date){return new Date(t.getFullYear(),t.getMonth(),1).toISOString()}function oC(){try{const t=Number(localStorage.getItem(my));return Number.isFinite(t)&&t>0?t:0}catch{return 0}}function iC(t){try{localStorage.setItem(my,String(t))}catch{}}const aC={claude:"Claude",codex:"Codex",repoburg:"Repoburg"};function rl({label:t,value:r,sub:s,tone:i}){return a.jsxs("div",{className:"usage-kpi",children:[a.jsx("div",{className:"usage-kpi-label",children:t}),a.jsx("div",{className:"usage-kpi-value",style:i?{color:i}:void 0,children:r}),s&&a.jsx("div",{className:"usage-kpi-sub",children:s})]})}function lC({day:t,max:r}){const s=i=>r>0?i/r*100:0;return a.jsxs("div",{className:"usage-day",title:`${t.date} · ${cr(t.input_tokens)} input · ${cr(t.cached_input_tokens)} cached · ${cr(t.output_tokens)} output · ${Os(t.cost_usd)}`,children:[a.jsxs("div",{className:"usage-day-bar",children:[a.jsx("div",{className:"usage-seg usage-seg-output",style:{height:`${s(t.output_tokens)}%`}}),a.jsx("div",{className:"usage-seg usage-seg-cached",style:{height:`${s(t.cached_input_tokens+t.cache_write_input_tokens)}%`}}),a.jsx("div",{className:"usage-seg usage-seg-input",style:{height:`${s(t.input_tokens)}%`}})]}),a.jsx("div",{className:"usage-day-label",children:t.date.slice(5)})]})}function cC(){const t=A(E=>E.toggleUsageView),[r,s]=y.useState("30d"),[i,l]=y.useState(null),[c,d]=y.useState(null),[p,g]=y.useState(oC),[m,v]=y.useState(null),[k,x]=y.useState(!1),S=y.useCallback(async()=>{x(!0),v(null);try{const{since:E,until:H}=rC(r),[I,L]=await Promise.all([hg(E,H),hg(sC(),null)]);l(I),d(L.totals.cost_usd)}catch(E){v(E.message)}finally{x(!1)}},[r]);y.useEffect(()=>{S()},[S]);const N=i==null?void 0:i.totals,C=p>0&&c!==null?p-c:null,T=y.useMemo(()=>Math.max(0,...((i==null?void 0:i.daily)??[]).map(E=>E.input_tokens+E.cached_input_tokens+E.output_tokens)),[i]),j=E=>{const H=Number(E.replace(",",".")),I=Number.isFinite(H)&&H>0?H:0;g(I),iC(I)};return a.jsxs("div",{className:"usage-view",children:[a.jsxs("div",{className:"usage-header",children:[a.jsxs("div",{className:"usage-title",children:[a.jsx(ov,{size:18})," Usage Center"]}),a.jsxs("div",{className:"usage-controls",children:[["today","7d","30d","all"].map(E=>a.jsx("button",{className:`usage-range-btn${r===E?" usage-range-btn-active":""}`,onClick:()=>s(E),children:E==="today"?"Today":E==="7d"?"7 days":E==="30d"?"30 days":"All"},E)),a.jsx("button",{className:"usage-range-btn",onClick:()=>void S(),title:"Refresh",children:a.jsx(q1,{size:13,className:k?"spin":void 0})}),a.jsx("button",{className:"dialog-close",title:"Close usage view","aria-label":"Close usage view",onClick:t,children:a.jsx(Nn,{size:16})})]})]}),m&&a.jsxs("div",{className:"usage-error",children:["Could not load usage data: ",m]}),!i&&!m&&a.jsx("div",{className:"usage-empty",children:"Loading…"}),i&&N&&a.jsxs("div",{className:"usage-body",children:[a.jsxs("div",{className:"usage-kpis",children:[a.jsx(rl,{label:"Spend",value:Os(N.cost_usd),sub:N.unpriced_models.length>0?"excluding unpriced models":void 0}),a.jsx(rl,{label:"Remaining (monthly)",value:C===null?"—":C>=0?Os(C):Os(0),sub:p>0&&c!==null?`this month ${Os(c)} / budget ${Os(p)}`:"no budget set",tone:C!==null&&C<0?"var(--red)":void 0}),a.jsx(rl,{label:"Tokens",value:cr(N.input_tokens+N.cached_input_tokens+N.cache_write_input_tokens+N.output_tokens),sub:`input ${cr(N.input_tokens)} · cached ${cr(N.cached_input_tokens)} · write ${cr(N.cache_write_input_tokens)} · output ${cr(N.output_tokens)}`}),a.jsx(rl,{label:"Calls",value:String(N.calls),sub:N.errors>0?`${N.errors} failed`:void 0,tone:N.errors>0?"var(--amber)":void 0})]}),a.jsxs("div",{className:"usage-budget",children:[a.jsx("label",{htmlFor:"usage-budget-input",children:"Monthly budget (USD)"}),a.jsx("input",{id:"usage-budget-input",type:"number",min:"0",step:"1",defaultValue:p>0?p:"",placeholder:"e.g. 50",onBlur:E=>j(E.target.value)}),p>0&&c!==null&&a.jsx("div",{className:"usage-budget-bar",children:a.jsx("div",{className:"usage-budget-fill",style:{width:`${Math.min(100,c/p*100)}%`,background:c>=p?"var(--red)":void 0}})})]}),N.unpriced_models.length>0&&a.jsxs("div",{className:"usage-note",children:["Unpriced models: ",N.unpriced_models.join(", ")]}),a.jsxs("div",{className:"usage-chart",children:[a.jsx("div",{className:"usage-section-title",children:"Daily usage"}),i.daily.length===0?a.jsx("div",{className:"usage-empty",children:"No usage in this range."}):a.jsx("div",{className:"usage-days",children:i.daily.map(E=>a.jsx(lC,{day:E,max:T},E.date))}),a.jsxs("div",{className:"usage-legend",children:[a.jsxs("span",{children:[a.jsx("span",{className:"usage-dot usage-seg-input"})," input"]}),a.jsxs("span",{children:[a.jsx("span",{className:"usage-dot usage-seg-cached"})," cached"]}),a.jsxs("span",{children:[a.jsx("span",{className:"usage-dot usage-seg-output"})," output"]})]})]}),a.jsxs("div",{className:"usage-table-wrap",children:[a.jsx("div",{className:"usage-section-title",children:"By model"}),a.jsxs("table",{className:"usage-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Runtime"}),a.jsx("th",{children:"Provider"}),a.jsx("th",{children:"Model"}),a.jsx("th",{children:"Effort"}),a.jsx("th",{children:"Calls"}),a.jsx("th",{children:"Input"}),a.jsx("th",{children:"Cached"}),a.jsx("th",{children:"Output"}),a.jsx("th",{children:"Cost"})]})}),a.jsxs("tbody",{children:[i.by_model.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:9,className:"usage-empty",children:"No usage records yet."})}),i.by_model.map(E=>a.jsxs("tr",{children:[a.jsx("td",{children:aC[E.runtime_type]??E.runtime_type}),a.jsx("td",{children:E.provider??"—"}),a.jsx("td",{title:E.model,children:E.model}),a.jsx("td",{children:E.reasoning_effort??"default"}),a.jsxs("td",{children:[E.calls,E.errors>0&&a.jsxs("span",{className:"usage-err",children:[" (",E.errors," failed)"]})]}),a.jsx("td",{children:cr(E.input_tokens)}),a.jsx("td",{children:cr(E.cached_input_tokens+E.cache_write_input_tokens)}),a.jsx("td",{children:cr(E.output_tokens)}),a.jsx("td",{children:E.cost_usd===null?a.jsx("span",{className:"usage-unpriced",children:"unknown"}):Os(E.cost_usd)})]},`${E.runtime_type}|${E.provider??""}|${E.model}|${E.reasoning_effort??""}`))]})]})]})]})]})}const mg="claude auth login";function uC(){const t=A(p=>Object.keys(p.signedOutTurns).length),r=A(p=>p.terminalViewOpen),s=A(p=>p.toggleTerminalView),i=A(p=>p.addToast),[l,c]=y.useState(!1);if(t===0)return null;const d=()=>{c(!0),Rw().catch(p=>i("error",`Could not resume the turns — ${Ps(p)}`)).finally(()=>c(!1))};return a.jsxs("div",{className:"signed-out-band",role:"status",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(I1,{size:12})}),a.jsxs("span",{className:"banner-text",children:["Claude is signed out — ",t===1?"1 turn is":`${t} turns are`," waiting. Run"," ",a.jsx("code",{children:mg})," in a terminal, then resume."]}),a.jsxs("button",{type:"button",className:"banner-action",onClick:()=>void Mi(mg),children:[a.jsx(Ri,{size:12}),"Copy"]}),!r&&a.jsxs("button",{type:"button",className:"banner-action",onClick:s,children:[a.jsx(pv,{size:12}),"Open terminal"]}),a.jsxs("button",{type:"button",className:"banner-action",onClick:d,disabled:l,children:[a.jsx(dv,{size:12}),t===1?"Resume turn":"Resume turns"]})]})}const gg=/^[a-f0-9]{64}\.(?:png|jpg|gif|webp)$/,dC=/^(?:https?:\/\/[^/?#]+)?\/api\/apps\/([^/?#]+)\/files\/([^/?#]+)$/i,fC={png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp"};function gy(){return mn()||window.location.origin}function vy(t,r){let s=r;if(s&&typeof s=="object"){const d=s;s=typeof d.id=="string"?d.id:d.url}if(typeof s!="string")return null;const i=s.trim();if(gg.test(i))return i;const l=dC.exec(i);if(!l)return null;let c;try{c=decodeURIComponent(l[1])}catch{return null}return c===t&&gg.test(l[2])?l[2]:null}function vg(t){return/^https?:\/\//i.test(t.url)?t:{...t,url:`${gy()}${t.url}`}}function pC(t){return fC[t.slice(t.lastIndexOf(".")+1)]??"application/octet-stream"}function yy(t){return new Promise((r,s)=>{const i=new FileReader;i.onload=()=>{const l=String(i.result??"");r(l.slice(l.indexOf(",")+1))},i.onerror=()=>s(i.error??new Error("Could not read the file")),i.readAsDataURL(t)})}function hC(t,r){const s=/^data:([^;,]*)(?:;[^;,]*)*;base64,/i.exec(t);return s?{type:r||s[1]||void 0,data:t.slice(s[0].length)}:{type:r,data:t}}async function xy(t){if(t instanceof Blob){const r=t.name;return{name:typeof r=="string"&&r?r:void 0,type:t.type||void 0,data:await yy(t)}}if(t&&typeof t=="object"&&typeof t.data=="string"){const r=t;return{name:typeof r.name=="string"&&r.name?r.name:void 0,type:typeof r.type=="string"&&r.type?r.type:void 0,data:r.data}}return null}async function mC(t){const r=await xy(t);if(!r)throw new Error("uploadFile: expected a Blob/File or { name, type, data }");return r}async function gC(t,r,s){if(r==null)return[];if(!Array.isArray(r))throw new Error("submitTurn: attachments must be an array");const i=[];for(let l=0;l<r.length;l++){const c=r[l],d=await xy(c);if(d){const{type:m,data:v}=hC(d.data,d.type);if(!m)throw new Error(`submitTurn: attachment ${l+1} has no type`);i.push({name:d.name??`attachment-${l+1}`,media_type:m,data:v});continue}const p=vy(t,c);if(!p)throw new Error(`submitTurn: attachment ${l+1} is not a file of this app`);const g=await s(p);i.push({name:p,media_type:pC(p),data:await yy(g)})}return i}const vC=`function (config) {
683
+ var nextId = 1;
684
+ var pending = new Map();
685
+ var listeners = [];
686
+ // Absolute http(s) URL, or null. Relative and #fragment hrefs are not
687
+ // external and keep their in-frame behavior.
688
+ function externalUrl(raw) {
689
+ if (typeof raw !== 'string' || !/^\\s*https?:\\/\\//i.test(raw)) return null;
690
+ try { return new URL(raw.trim()).href; } catch (err) { return null; }
691
+ }
692
+ // New browser tab. The sandbox lets popups escape it, so the page loads
693
+ // like any other tab; noopener leaves it no handle back to this frame.
694
+ function openTab(url) {
695
+ window.open(url, '_blank', 'noopener,noreferrer');
696
+ }
697
+ // A plain external link would navigate THIS frame: the app disappears and
698
+ // most sites refuse to be framed anyway. Open it in a new tab instead.
699
+ // Bubble phase on window, so the app's own handlers run first and can
700
+ // still claim the click with preventDefault(). Modifier clicks and
701
+ // target="_blank" links already open a tab natively.
702
+ window.addEventListener('click', function (e) {
703
+ if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
704
+ var a = e.target && e.target.closest ? e.target.closest('a[href]') : null;
705
+ if (!a) return;
706
+ var target = (a.getAttribute('target') || '').toLowerCase();
707
+ if (target && target !== '_self' && target !== '_parent' && target !== '_top') return;
708
+ var url = externalUrl(a.getAttribute('href'));
709
+ if (!url) return;
710
+ e.preventDefault();
711
+ openTab(url);
712
+ });
713
+ // Stored files: <apiOrigin>/api/apps/<app-id>/files/<id>. Same reference
714
+ // rules as the pane (utils/appFiles.ts): an id, a file URL of this app on
715
+ // any origin, or an object carrying id/url.
716
+ var FILE_ID_RE = /^[a-f0-9]{64}\\.(?:png|jpg|gif|webp)$/;
717
+ var FILE_URL_RE = /^(?:https?:\\/\\/[^\\/?#]+)?\\/api\\/apps\\/([^\\/?#]+)\\/files\\/([^\\/?#]+)$/i;
718
+ function fileRefId(ref) {
719
+ if (ref && typeof ref === 'object') ref = typeof ref.id === 'string' ? ref.id : ref.url;
720
+ if (typeof ref !== 'string') return null;
721
+ var s = ref.trim();
722
+ if (FILE_ID_RE.test(s)) return s;
723
+ var m = FILE_URL_RE.exec(s);
724
+ if (!m) return null;
725
+ var owner;
726
+ try { owner = decodeURIComponent(m[1]); } catch (err) { return null; }
727
+ return owner === config.appId && FILE_ID_RE.test(m[2]) ? m[2] : null;
728
+ }
729
+ function fileUrl(ref) {
730
+ var id = fileRefId(ref);
731
+ if (!id) return typeof ref === 'string' ? ref : '';
732
+ return config.apiOrigin + '/api/apps/' + encodeURIComponent(config.appId) + '/files/' + id;
733
+ }
734
+ window.addEventListener('message', function (e) {
735
+ var msg = e.data;
736
+ if (!msg || msg.source !== 'agentpane-host') return;
737
+ if (msg.id != null && pending.has(msg.id)) {
738
+ var p = pending.get(msg.id);
739
+ pending.delete(msg.id);
740
+ if (msg.ok) {
741
+ p.resolve(msg.result);
742
+ } else {
743
+ var err = new Error(msg.error || 'bridge error');
744
+ // code 'conflict': setState's ifVersion is stale; state = the stored copy.
745
+ if (msg.code) err.code = msg.code;
746
+ if (msg.state) err.state = msg.state;
747
+ p.reject(err);
748
+ }
749
+ } else if (msg.event) {
750
+ for (var i = 0; i < listeners.length; i++) {
751
+ try { listeners[i](msg.event, msg.payload); } catch (err) { /* app error */ }
752
+ }
753
+ }
754
+ });
755
+ function call(method, params) {
756
+ return new Promise(function (resolve, reject) {
757
+ var id = nextId++;
758
+ pending.set(id, { resolve: resolve, reject: reject });
759
+ try {
760
+ parent.postMessage({ source: 'agentpane-app', id: id, method: method, params: params || null }, '*');
761
+ } catch (err) {
762
+ // Params that cannot be cloned (functions, DOM nodes, ...).
763
+ pending.delete(id);
764
+ reject(err);
765
+ }
766
+ });
767
+ }
768
+ window.AgentPane = {
769
+ getApp: function () { return call('getApp'); },
770
+ getState: function () { return call('getState'); },
771
+ setState: function (data, opts) {
772
+ var params = { data: data };
773
+ if (opts && typeof opts.ifVersion === 'number') params.ifVersion = opts.ifVersion;
774
+ return call('setState', params);
775
+ },
776
+ createSession: function (opts) { return call('createSession', opts); },
777
+ submitTurn: function (sessionId, prompt, opts) {
778
+ var params = { sessionId: sessionId, prompt: prompt };
779
+ if (opts && opts.attachments != null) params.attachments = opts.attachments;
780
+ return call('submitTurn', params);
781
+ },
782
+ getSession: function (sessionId) { return call('getSession', { sessionId: sessionId }); },
783
+ cancelTurn: function (sessionId) { return call('cancelTurn', { sessionId: sessionId }); },
784
+ setSessionLifecycle: function (sessionId, lifecycle) { return call('setSessionLifecycle', { sessionId: sessionId, lifecycle: lifecycle }); },
785
+ callTool: function (tool, args) { return call('callTool', { tool: tool, args: args }); },
786
+ listProviders: function () { return call('listProviders'); },
787
+ listModels: function (runtime, cwd) { return call('listModels', { runtime: runtime, cwd: cwd }); },
788
+ pickDirectory: function () { return call('pickDirectory'); },
789
+ onTurnCompleted: function (cb) { listeners.push(function (event, payload) { if (event === 'turn:completed' || event === 'turn:failed') cb(event, payload); }); },
790
+ onTurnDelta: function (cb) { listeners.push(function (event, payload) { if (event === 'turn:delta' && payload) cb(payload); }); },
791
+ onToolCall: function (cb) { listeners.push(function (event, payload) { if (event === 'tool_call' && payload) cb(payload); }); },
792
+ onStateChanged: function (cb) { listeners.push(function (event, payload) { if (event === 'state_changed') cb(payload || {}); }); },
793
+ onBackgroundTasks: function (cb) { listeners.push(function (event, payload) { if (event === 'background_tasks' && payload) cb(payload); }); },
794
+ resolveToolCall: function (callId, result) { return call('resolveToolCall', { callId: callId, result: result }); },
795
+ openSession: function (sessionId) { return call('openSession', { sessionId: sessionId }); },
796
+ openUrl: function (url) {
797
+ var href = externalUrl(url);
798
+ if (!href) return Promise.reject(new Error('openUrl: expected an absolute http(s) URL, got ' + JSON.stringify(url)));
799
+ try { openTab(href); } catch (err) { return Promise.reject(err); }
800
+ return Promise.resolve({ ok: true });
801
+ },
802
+ uploadFile: function (file) { return call('uploadFile', { file: file }); },
803
+ getFile: function (ref) { return call('getFile', { ref: ref }); },
804
+ fileUrl: fileUrl
805
+ };
806
+ // Runtime error reporting — surface compile checks' blind side to the pane.
807
+ window.addEventListener('error', function (e) {
808
+ parent.postMessage({
809
+ source: 'agentpane-app', report: 'error',
810
+ message: e.message || 'Unknown error',
811
+ stack: (e.error && e.error.stack) || '',
812
+ line: e.lineno || 0, col: e.colno || 0
813
+ }, '*');
814
+ });
815
+ window.addEventListener('unhandledrejection', function (e) {
816
+ var r = e.reason;
817
+ var msg = r && (r.message || String(r)) || 'unknown';
818
+ parent.postMessage({
819
+ source: 'agentpane-app', report: 'error',
820
+ message: 'Unhandled promise rejection: ' + msg,
821
+ stack: (r && r.stack) || '', line: 0, col: 0
822
+ }, '*');
823
+ });
824
+ }`;function yC(t){return`(${vC})(${JSON.stringify(t)});`}function yg(t){return t.replace(/<\/script/gi,"<\\/script")}function xC(t,r){const s=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(s,"gi");let l=-1,c;for(;(c=i.exec(t))!==null;)l=c.index;return l}function xg(t,r,s){const i=xC(t,r);return i===-1?t+s:t.slice(0,i)+s+t.slice(i)}function wC(t,r,s){let i=t;const l=`<script>${yg(r)}<\/script>`;if(/<\/head>/i.test(i)?i=xg(i,"</head>",l):/<html[^>]*>/i.test(i)?i=i.replace(/(<html[^>]*>)/i,`$1<head>${l}</head>`):i=`${l}${i}`,s){const c=`<script>${yg(s)}<\/script>`;i=xg(i,"</body>",c)}return i}function kC(){const t=globalThis.crypto;return t&&typeof t.randomUUID=="function"?`tab-${t.randomUUID()}`:`tab-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function SC(t){var s;if(!(t instanceof Ml)||t.status!==409)return null;const r=(s=t.body)==null?void 0:s.state;return r&&typeof r=="object"?r:null}function bC({appId:t,workspace:r=""}){const s=y.useRef(null),i=y.useRef({pinned:!1,data:null}),[l,c]=y.useState(null),[d,p]=y.useState(null),[g,m]=y.useState([]);y.useEffect(()=>{let S=!0;const N=kC(),C=j=>{const E=i.current.version;typeof j.version=="number"&&typeof E=="number"&&j.version<E||(i.current=j)};Qw(t,j=>{var E,H;return(H=(E=s.current)==null?void 0:E.contentWindow)==null?void 0:H.postMessage(j,"*")},r);const T=async j=>{var K,$,te,me,ue,ye,be,Me,Z,oe,ie,z,Q,G,D,P,ce,B,X,le,Ne;if(j.source!==((K=s.current)==null?void 0:K.contentWindow))return;const E=j.data;if(!E||E.source!=="agentpane-app")return;if(E.report==="error"){const re={message:String(E.message??"Unknown error"),stack:String(E.stack??"")};m(he=>{const Se=he[he.length-1];return Se&&Se.message===re.message?he:[...he,re].slice(-20)});return}if(typeof E.method!="string")return;let H=!0,I,L,q=null;try{switch(E.method){case"getApp":I={id:t,workspace:r};break;case"getState":try{const re=await em(t,r);C(re),I=re}catch{I=i.current}break;case"setState":{const re=(($=E.params)==null?void 0:$.data)??null,he=(te=E.params)==null?void 0:te.ifVersion,Se={data:re,writer:N};typeof he=="number"&&(Se.ifVersion=he);try{const He=await qg(t,Se,r);C(He),I=He}catch(He){if(q=SC(He),!q)throw He;C(q);const _e=He.body;throw new Error(typeof(_e==null?void 0:_e.error)=="string"?_e.error:"App state changed since that version")}break}case"createSession":{const re=E.params??{},he=await bd({title:typeof re.title=="string"?re.title:void 0,runtime_type:typeof re.runtime_type=="string"?re.runtime_type:void 0,model:typeof re.model=="string"?re.model:void 0,model_reasoning_effort:typeof re.model_reasoning_effort=="string"?re.model_reasoning_effort:void 0,cwd:typeof re.cwd=="string"?re.cwd:void 0,origin_app_id:t,origin_app_workspace:r});ol(he.id,t),A.getState().addSession(he),I=he;break}case"submitTurn":{const re=String(((me=E.params)==null?void 0:me.sessionId)??""),he=String(((ue=E.params)==null?void 0:ue.prompt)??""),Se=await gC(t,(ye=E.params)==null?void 0:ye.attachments,_e=>Y0(t,_e)),He=await Mg(re,he,Se.length?Se:void 0,{originAppId:t});ol(re,t),I=He;break}case"getSession":{I=await $0(t,String(((be=E.params)==null?void 0:be.sessionId)??""));break}case"cancelTurn":{I=await z0(t,String(((Me=E.params)==null?void 0:Me.sessionId)??""));break}case"setSessionLifecycle":{I=await F0(t,String(((Z=E.params)==null?void 0:Z.sessionId)??""),String(((oe=E.params)==null?void 0:oe.lifecycle)??""));break}case"callTool":{const re=(ie=E.params)==null?void 0:ie.args;I=await U0(t,r,String(((z=E.params)==null?void 0:z.tool)??""),re&&typeof re=="object"?re:{});break}case"listProviders":{I=await fy();break}case"listModels":{const re=typeof((Q=E.params)==null?void 0:Q.runtime)=="string"?E.params.runtime.trim():"";if(!re)throw new Error("listModels: runtime is required");const he=(G=E.params)==null?void 0:G.cwd;I=await Kg(re,typeof he=="string"&&he?he:void 0);break}case"pickDirectory":{if(A.getState().activeAppTabId!==t)throw new Error("pickDirectory: the app is not on screen — call it from a click in the app");I=await Og();break}case"resolveToolCall":{const re=String(((D=E.params)==null?void 0:D.callId)??""),he=(P=E.params)==null?void 0:P.result;await K0(re,he),I={ok:!0};break}case"openSession":{if(A.getState().activeAppTabId!==t)throw new Error("openSession: the app is not on screen — call it from a click in the app");const re=typeof((ce=E.params)==null?void 0:ce.sessionId)=="string"?E.params.sessionId.trim():"";if(!re)throw new Error("openSession: sessionId is required");try{await A.getState().revealSession(re)}catch(he){throw new Error(`openSession: ${he instanceof Error?he.message:String(he)}`)}I={ok:!0};break}case"uploadFile":{const re=await mC((B=E.params)==null?void 0:B.file);try{I=vg(await q0(t,re))}catch(he){throw new Error(`uploadFile: ${he instanceof Error?he.message:String(he)}`)}break}case"getFile":{const re=vy(t,(X=E.params)==null?void 0:X.ref),he=re?await X0(t,re):null;I=he?vg(he):null;break}default:throw new Error(`Unknown bridge method: ${E.method}`)}}catch(re){H=!1,L=re instanceof Error?re.message:String(re)}(Ne=(le=s.current)==null?void 0:le.contentWindow)==null||Ne.postMessage(q?{source:"agentpane-host",id:E.id,ok:H,error:L,code:"conflict",state:q}:{source:"agentpane-host",id:E.id,ok:H,result:I,error:L},"*")};return window.addEventListener("message",T),s0(t,j=>{var E,H;typeof j.workspace=="string"&&j.workspace!==r||j.writer!==N&&((H=(E=s.current)==null?void 0:E.contentWindow)==null||H.postMessage({source:"agentpane-host",event:"state_changed",payload:typeof j.version=="number"?{version:j.version}:{}},"*"))}),n0(t,()=>{Jh(t).then(j=>{S&&(c(j),m([]))}).catch(()=>{})}),(async()=>{try{const[j,E,H]=await Promise.all([Jh(t),em(t,r),P0(t).catch(()=>[])]);if(!S)return;i.current=E,H.forEach(I=>ol(I.id,t)),c(j)}catch(j){S&&p(j instanceof Error?j.message:String(j))}})(),()=>{S=!1,Zw(t),r0(t),o0(t),window.removeEventListener("message",T)}},[t,r]),y.useEffect(()=>{l&&Jw(t,l.manifest.headlessSessions===!0)},[t,l]);const v=y.useMemo(()=>l?wC(l.html,yC({appId:t,apiOrigin:gy()}),l.js):"",[l,t]);if(d)return a.jsxs("div",{className:"empty-state",style:{padding:"24px"},children:["Mini app failed to load: ",d]});if(!v)return a.jsx("div",{className:"empty-state",style:{padding:"24px"},children:"Loading mini app…"});const k=(l==null?void 0:l.diagnostics)??[],x=k.some(S=>S.severity==="error");return a.jsxs("div",{className:"miniapp-runtime",children:[k.length>0&&a.jsxs("div",{className:`miniapp-diagnostics${x?"":" miniapp-diagnostics-warn"}`,"data-testid":"miniapp-diagnostics",children:[a.jsx("div",{className:"miniapp-diagnostics-title",children:x?`Compile errors in ${(l==null?void 0:l.sourceFile)??"the app logic"} — the pane serves the last code that parsed:`:"Warnings — the app runs, but fix these:"}),k.map((S,N)=>a.jsxs("div",{className:"miniapp-diag",children:[S.file,":",S.line,":",S.column," — ",S.message]},N))]}),a.jsx("iframe",{ref:s,className:"miniapp-frame",sandbox:"allow-scripts allow-popups allow-popups-to-escape-sandbox",allow:"loopback-network; local-network; local-network-access",title:`Mini app: ${t}`,srcDoc:v}),g.length>0&&a.jsx("div",{className:"miniapp-rt-errors","data-testid":"miniapp-rt-errors",children:g.map((S,N)=>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})]},N))})]})}function NC({appId:t,active:r}){const s=A(x=>x.apps),i=A(x=>x.workspaces),l=A(x=>x.appWorkspaces),c=A(x=>x.setAppWorkspace),d=A(x=>x.setActiveAppTab),p=A(x=>x.startAppEdit),g=s.find(x=>x.id===t),m=l[t]??"",v=i.filter(x=>x.deleted!==1),k=m!==""&&!v.some(x=>x.path===m)?m:null;return a.jsxs("div",{className:`miniapp-view ${r?"":"miniapp-view-hidden"}`,children:[a.jsxs("div",{className:"miniapp-header",children:[a.jsx(jo,{iconNode:g==null?void 0:g.iconNode,size:14,className:"miniapp-header-icon"}),a.jsx("span",{className:"miniapp-header-title",children:(g==null?void 0:g.title)??t}),a.jsxs("select",{className:"miniapp-workspace-select",title:"Workspace this app instance is bound to (state and pinning are scoped per workspace)",value:m,onChange:x=>c(t,x.target.value),children:[a.jsx("option",{value:"",children:"All workspaces (global)"}),v.map(x=>a.jsx("option",{value:x.path,children:x.label||x.path.split("/").pop()||x.path},x.path)),k&&a.jsx("option",{value:k,children:`${k} (unknown workspace)`})]}),a.jsxs("button",{className:"miniapp-header-btn",title:"Edit this app with the agent (opens an edit session on the app folder)",onClick:()=>void p(t),children:[a.jsx(K1,{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(bC,{appId:t,workspace:m},`${t}:${m}`)})]})}function TC({side:t,minWidth:r,maxWidth:s,getWidth:i,setWidth:l}){const[c,d]=y.useState(!1),p=y.useRef(0),g=y.useRef(0),m=y.useCallback(x=>{const S=x.clientX-p.current,N=t==="left"?g.current+S:g.current-S,C=Math.min(s,Math.max(r,N));l(C)},[t,r,s,l]),v=y.useCallback(()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",v),document.body.classList.remove("is-resizing"),d(!1)},[m]);return{onPointerDown:y.useCallback(x=>{var S,N;x.preventDefault(),x.stopPropagation();try{(N=(S=x.currentTarget)==null?void 0:S.setPointerCapture)==null||N.call(S,x.pointerId)}catch{}p.current=x.clientX,g.current=i(),d(!0),document.body.classList.add("is-resizing"),window.addEventListener("pointermove",m),window.addEventListener("pointerup",v)},[i,m,v]),dragging:c}}function wg({side:t,minWidth:r,maxWidth:s,getWidth:i,setWidth:l}){const{onPointerDown:c,dragging:d}=TC({side:t,minWidth:r,maxWidth:s,getWidth:i,setWidth:l});return a.jsx("div",{className:`resize-handle ${t}${d?" dragging":""}`,onPointerDown:c,role:"separator","aria-orientation":"vertical","aria-label":`Resize ${t} panel`,"data-resizing":d?"":void 0})}const CC=y.lazy(()=>p1(()=>import("./TerminalView-BLFbzxTg.js"),__vite__mapDeps([0,1])));function EC(){Dt.trackRender("IdeWorkspace");const t=A(S=>S.sidebarWidth),r=A(S=>S.rightPanelWidth),s=A(S=>S.setSidebarWidth),i=A(S=>S.setRightPanelWidth),l=A(S=>S.rightPanelCollapsed),c=A(S=>S.vscodeViewOpen),d=A(S=>S.usageViewOpen),p=A(S=>S.terminalViewOpen),[g,m]=y.useState(!1);p&&!g&&m(!0);const v=A(S=>S.activeAppTabId),k=A(S=>S.openAppTabs);y.useEffect(()=>{const S=()=>{const N=hl(),{rightPanelWidth:C,setRightPanelWidth:T}=A.getState();C>N&&T(N)};return window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const x=l?`${t}px 6px 1fr ${R0}px`:`${t}px 6px 1fr 6px ${r}px`;return a.jsxs("div",{className:"ide-root",children:[a.jsx(uC,{}),a.jsxs("div",{className:`ide-layout ${c||d||p?"ide-hidden":""}`,style:{gridTemplateColumns:x},children:[a.jsx(rb,{}),a.jsx(wg,{side:"left",minWidth:Ju,maxWidth:ed,getWidth:()=>A.getState().sidebarWidth,setWidth:s}),a.jsxs("div",{className:"ide-center",children:[a.jsx(ib,{}),a.jsxs("div",{className:"ide-render",children:[k.map(S=>a.jsx(NC,{appId:S,active:v===S},S)),v==null&&a.jsx(mT,{})]}),a.jsx(CT,{})]}),!l&&a.jsx(wg,{side:"right",minWidth:pl,maxWidth:hl(),getWidth:()=>A.getState().rightPanelWidth,setWidth:i}),a.jsx(GT,{})]}),c&&a.jsx(nC,{}),d&&a.jsx(cC,{}),g&&a.jsx(y.Suspense,{fallback:null,children:a.jsx(CC,{visible:p})}),a.jsx(YT,{})]})}function jC(){const{showNewSessionDialog:t,setShowNewSessionDialog:r,createSession:s,lastModelConfig:i}=A(),l=(i==null?void 0:i.provider)??"codex",c=(i==null?void 0:i.model)??"",d=(i==null?void 0:i.reasoning)??"",[p,g]=y.useState(""),[m,v]=y.useState(c),[k,x]=y.useState(d),[S,N]=y.useState("");if(!t)return null;const C=tf(l),T=m?gd(l,m):[];function j(){s({title:p.trim()||void 0,model:m||void 0,model_reasoning_effort:k||void 0,cwd:S.trim()||void 0,runtime_type:l}),g(""),N("")}function E(I){I.key==="Escape"&&r(!1)}function H(I){var K;v(I);const L=gd(l,I);L.some($=>$.effort===k)||x(vd(l,I)??((K=L[0])==null?void 0:K.effort)??"")}return a.jsx("div",{className:"dialog-overlay",onClick:()=>r(!1),children:a.jsxs("div",{className:"dialog",onClick:I=>I.stopPropagation(),onKeyDown:E,children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"New Session"}),a.jsx("button",{className:"dialog-close",onClick:()=>r(!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:p,onChange:I=>g(I.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:I=>H(I.target.value),children:[a.jsx("option",{value:"",children:"Default (Codex picks)"}),C.map(I=>a.jsxs("option",{value:I.slug,children:[I.displayName," — ",I.description]},I.slug))]})]}),T.length>0&&a.jsxs("label",{className:"dialog-label",children:["Thinking Level",a.jsxs("select",{className:"dialog-input dialog-select",value:k,onChange:I=>x(I.target.value),children:[a.jsxs("option",{value:"",children:["Default (",vd(l,m),")"]}),T.map(I=>a.jsx("option",{value:I.effort,children:I.label},I.effort))]})]}),a.jsxs("label",{className:"dialog-label",children:["Working Directory (optional)",a.jsx("input",{className:"dialog-input",type:"text",value:S,onChange:I=>N(I.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:()=>r(!1),children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:j,children:"Create"})]})]})})}function _C(t,r){const s=r!==""&&(t===r||t.startsWith(`${r}/`)),i=[s?{label:"~",path:r}:{label:"/",path:"/"}],l=t.slice(s?r.length:0);let c=i[0].path;for(const d of l.split("/").filter(Boolean))c=c==="/"?`/${d}`:`${c}/${d}`,i.push({label:d,path:c});return i}function RC(t){const r=t.filter(l=>l.deleted===0).at(-1);if(!r)return;const s=hs(r.path),i=s.lastIndexOf("/");return i>0?s.slice(0,i):void 0}function AC(){return A(r=>r.showAddWorkspaceDialog)?a.jsx(IC,{}):null}function IC(){var K;const t=A($=>$.setShowAddWorkspaceDialog),r=A($=>$.workspaces),s=A($=>$.createWorkspaceAt),i=A($=>$.addToast),[l,c]=y.useState(null),[d,p]=y.useState(!0),[g,m]=y.useState(null),[v,k]=y.useState(!1),x=y.useRef(0),[S]=y.useState(()=>RC(A.getState().workspaces)),N=y.useRef(null),C=y.useCallback(()=>{v||t(!1)},[v,t]);Eo(C);const T=y.useCallback(async($,te=!1)=>{const me=++x.current;p(!0);let ue=null,ye=null;try{ue=await Lh($)}catch(be){if(ye=Ps(be),te&&$)try{ue=await Lh(),ye=null}catch(Me){ye=Ps(Me)}}me===x.current&&(ue&&c(ue),m(ye),p(!1))},[]);y.useEffect(()=>{T(S,!0)},[T,S]);const j=l==null?void 0:l.path;y.useEffect(()=>{N.current&&(N.current.scrollTop=0)},[j]);const E=new Set(r.filter($=>$.deleted===0).map($=>hs($.path)));async function H($){if(!v){k(!0),m(null);try{const te=await s($);t(!1),i("success",`Workspace added — ${te.path}`)}catch(te){m(Ps(te)),k(!1)}}}const I=l?_C(l.path,l.home):[],L=((K=I.at(-1))==null?void 0:K.label)??"",q=l!==null&&E.has(hs(l.path));return a.jsx("div",{className:"dialog-overlay",onClick:C,children:a.jsxs("div",{className:"dialog folder-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"folder-dialog-title",onClick:$=>$.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:C,"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 T(l.parent),disabled:!(l!=null&&l.parent),"aria-label":"Parent folder",title:"Parent folder",children:a.jsx(nv,{size:14})}),a.jsx("nav",{className:"folder-crumbs","aria-label":"Folder path",children:I.map(($,te)=>a.jsxs(y.Fragment,{children:[te>0&&a.jsx(_i,{size:12,className:"folder-crumb-sep","aria-hidden":"true"}),te===I.length-1?a.jsx("span",{className:"folder-crumb current","aria-current":"location",title:$.path,children:$.label}):a.jsx("button",{className:"folder-crumb",onClick:()=>void T($.path),title:$.path,children:$.label})]},$.path))}),d&&l&&a.jsx(hn,{size:14,className:"spin folder-spinner","aria-label":"Loading"})]}),a.jsx("ul",{ref:N,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($=>a.jsxs("li",{className:"folder-item",children:[a.jsxs("button",{className:"folder-row",onClick:()=>void T($.path),title:$.path,"aria-label":$.git?`${$.name} (git repository)`:$.name,children:[$.git?a.jsx(_1,{size:15,className:"folder-icon git","aria-hidden":"true"}):a.jsx(wl,{size:15,className:"folder-icon","aria-hidden":"true"}),a.jsx("span",{className:"folder-name",children:$.name}),a.jsx(_i,{size:13,className:"folder-chevron","aria-hidden":"true"})]}),E.has(hs($.path))?a.jsx("span",{className:"folder-tag",children:"Added"}):a.jsx("button",{className:"folder-add",onClick:()=>void H($.path),disabled:v,"aria-label":`Add ${$.name}`,children:"Add"})]},$.path)):d&&a.jsxs("li",{className:"folder-empty",role:"status",children:[a.jsx(hn,{size:14,className:"spin"})," Loading folders…"]})}),(l==null?void 0:l.truncated)&&a.jsxs("p",{className:"folder-note",children:["Showing the first ",l.folders.length," folders."]}),g&&a.jsx("p",{className:"folder-error",role:"alert",children:g})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:C,disabled:v,children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:()=>l&&void H(l.path),disabled:!l||d||v||q,children:v?"Adding…":q?"Already added":`Add “${L}”`})]})]})})}const yd=6e4,xd=60*yd,sl=24*xd;function DC(t,r=Date.now()){const s=Date.parse(t);if(Number.isNaN(s))return"";const i=Math.max(0,r-s);return i<yd?"just now":i<xd?`${Math.floor(i/yd)} min ago`:i<sl?`${Math.floor(i/xd)} h ago`:i<2*sl?"yesterday":i<7*sl?`${Math.floor(i/sl)} days ago`:new Date(s).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function MC(){const t=A(r=>r.importSessionsWorkspace);return t?a.jsx(LC,{workspace:t},t):null}function LC({workspace:t}){const r=A(I=>I.setImportSessionsWorkspace),s=A(I=>I.importClaudeSessions),[i,l]=y.useState(null),[c,d]=y.useState(null),[p,g]=y.useState(new Set),[m,v]=y.useState(!1),[k,x]=y.useState(new Map),S=y.useCallback(()=>{m||r(null)},[m,r]);Eo(S),y.useEffect(()=>{let I=!1;return Vg(t).then(L=>{I||l(L)}).catch(L=>{I||d(Ps(L))}),()=>{I=!0}},[t]);function N(I){g(L=>{const q=new Set(L);return q.has(I)?q.delete(I):q.add(I),q})}const C=i??[],T=C.length>0&&C.every(I=>p.has(I.session_id));async function j(){const I=C.filter($=>p.has($.session_id)).map($=>$.session_id);if(I.length===0)return;v(!0);const{imported:L,failed:q}=await s(t,I);if(v(!1),q.length===0){r(null);return}const K=new Set(L.map($=>$.import_source_id));l($=>($??[]).filter(te=>!K.has(te.session_id))),g(new Set(q.map($=>$.id))),x(new Map(q.map($=>[$.id,$.error])))}const E=t.split("/").pop()||t,H=p.size;return a.jsx("div",{className:"dialog-overlay",onClick:S,children:a.jsxs("div",{className:"dialog import-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"import-dialog-title",onClick:I=>I.stopPropagation(),children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",id:"import-dialog-title",children:"Import Claude Code sessions"}),a.jsx("button",{className:"dialog-close",onClick:S,"aria-label":"Close",disabled:m,children:a.jsx(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"})," in ",a.jsx("strong",{title:t,children:E}),", in a terminal or an IDE. An imported session keeps its history and continues the same Claude conversation."]}),c?a.jsxs("p",{className:"import-error",role:"alert",children:["Could not list the sessions — ",c]}):i===null?a.jsxs("div",{className:"import-loading",role:"status",children:[a.jsx(hn,{size:14,className:"spin"})," Looking for sessions…"]}):i.length===0?a.jsxs("div",{className:"import-empty",children:["No Claude Code sessions to import here. Sessions you start with ",a.jsx("code",{children:"claude"})," in this folder will show up here."]}):a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"import-select-all",children:[a.jsx("input",{type:"checkbox",checked:T,disabled:m,onChange:()=>g(T?new Set:new Set(C.map(I=>I.session_id)))}),"Select all (",i.length,")"]}),a.jsx("ul",{className:"import-list",children:i.map(I=>{const L=k.get(I.session_id);return a.jsx("li",{children:a.jsxs("label",{className:`import-row${p.has(I.session_id)?" selected":""}`,children:[a.jsx("input",{type:"checkbox",checked:p.has(I.session_id),disabled:m,onChange:()=>N(I.session_id)}),a.jsxs("span",{className:"import-row-main",children:[a.jsx("span",{className:"import-row-title",title:I.title,children:I.title}),a.jsxs("span",{className:"import-row-meta",children:[a.jsx("span",{title:new Date(I.last_modified).toLocaleString(),children:DC(I.last_modified)}),I.git_branch&&a.jsxs("span",{className:"import-row-branch",title:"Git branch",children:[a.jsx(iv,{size:10})," ",I.git_branch]})]}),I.recently_active&&a.jsxs("span",{className:"import-row-warn",children:[a.jsx(mv,{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."]}),L&&a.jsx("span",{className:"import-row-error",role:"alert",children:L})]})]})},I.session_id)})})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:S,disabled:m,children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:()=>void j(),disabled:H===0||m,children:m?a.jsxs(a.Fragment,{children:[a.jsx(hn,{size:12,className:"spin"})," Importing…"]}):H>1?`Import ${H} sessions`:"Import"})]})]})})}const OC=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,PC=512*1024;function $C(t){const r=t.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"");return/^[a-z0-9]/.test(r)?r:""}function zC(){const{appCatalogOpen:t,closeAppCatalog:r,apps:s,installExampleApp:i,createSkeletonApp:l,importAppFolder:c}=A(),[d,p]=y.useState("examples"),[g,m]=y.useState(null),[v,k]=y.useState(null),[x,S]=y.useState(!1),[N,C]=y.useState(""),[T,j]=y.useState(""),[E,H]=y.useState(""),[I,L]=y.useState(""),[q,K]=y.useState(null),[$,te]=y.useState(""),me=y.useRef(null);if(y.useEffect(()=>{t&&(m(null),B0().then(m).catch(()=>m([])))},[t]),y.useEffect(()=>{me.current&&(me.current.webkitdirectory=!0)},[d]),!t)return null;const ue=new Set(s.map(z=>z.id));async function ye(z){k(z);try{await i(z)&&r()}finally{k(null)}}async function be(){if(x)return;const z=N.trim(),Q=T.trim();if(!(!z||!Q)){S(!0);try{await l({id:z,title:Q,description:E.trim()||void 0,icon:I.trim()||void 0})&&(C(""),j(""),H(""),L(""),r())}finally{S(!1)}}}async function Me(z){const Q=Array.from(z.target.files??[]),G={};let D="";for(const P of Q){const B=(P.webkitRelativePath??"").split("/");!D&&B.length>1&&(D=B[0]);const X=B[B.length-1];if(!(!X||!OC.test(X))&&!(P.size>PC))try{G[X]=await P.text()}catch{}}K(Object.keys(G).length>0?G:null),te($C(D))}async function Z(){if(!(x||!q||!$.trim())){S(!0);try{await c($.trim(),q)&&(K(null),te(""),r())}finally{S(!1)}}}function oe(z){z.key==="Escape"&&r()}const ie=[{key:"examples",label:"Examples"},{key:"new",label:"New App"},{key:"upload",label:"Upload"}];return a.jsx("div",{className:"dialog-overlay",onClick:r,children:a.jsxs("div",{className:"dialog app-catalog",onClick:z=>z.stopPropagation(),onKeyDown:oe,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:r,children:"✕"})]}),a.jsx("div",{className:"catalog-tabs",children:ie.map(z=>a.jsx("button",{className:`catalog-tab${d===z.key?" active":""}`,onClick:()=>p(z.key),children:z.label},z.key))}),a.jsxs("div",{className:"dialog-body catalog-body",children:[d==="examples"&&a.jsx("div",{className:"catalog-examples",children:g===null?a.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"Loading examples…"}):g.length===0?a.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"No example apps available."}):g.map(z=>{const Q=ue.has(z.id);return a.jsxs("div",{className:"example-row",children:[a.jsx(jo,{iconNode:z.iconNode,size:14,className:"sidebar-app-icon"}),a.jsxs("div",{className:"example-info",children:[a.jsx("span",{className:"example-title",children:z.title}),z.description&&a.jsx("span",{className:"example-desc",children:z.description})]}),a.jsx("button",{className:"example-install",disabled:Q||v===z.id,onClick:()=>ye(z.id),title:Q?"Already installed":"Install this example",children:Q?"Installed":v===z.id?"Installing…":"Install"})]},z.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:N,onChange:z=>C(z.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:T,onChange:z=>j(z.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:E,onChange:z=>H(z.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:I,onChange:z=>L(z.target.value),placeholder:"e.g. notebook-pen",spellCheck:!1,autoCapitalize:"off"})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:x||!N.trim()||!T.trim(),onClick:be,children:[a.jsx(fs,{size:13})," Create App"]})]}),d==="upload"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"catalog-upload-hint",children:"Select an app folder from disk. Text files only (manifest.json, index.html, app.ts (or legacy app.js), …). A missing manifest.json is generated from the folder name."}),a.jsx("input",{ref:me,type:"file",multiple:!0,onChange:Me}),q&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["App id",a.jsx("input",{className:"dialog-input",type:"text",value:$,onChange:z=>te(z.target.value)})]}),a.jsxs("div",{className:"catalog-upload-summary",children:[Object.keys(q).length," file(s):"," ",Object.keys(q).slice(0,6).join(", "),Object.keys(q).length>6?", …":""]})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:x||!q||!$.trim(),onClick:Z,children:[a.jsx(ek,{size:13})," Import App"]})]})]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:r,children:"Close"})})]})})}function FC(){const t=A(k=>k.showCommandPalette),r=A(k=>k.setShowCommandPalette),s=A(),[i,l]=y.useState(""),[c,d]=y.useState(0),p=y.useRef(null),g=y.useMemo(()=>{const k=s.activeSessionId?s.sessionDetails[s.activeSessionId]:null,x=Ol(k);return[{id:"new-session",label:"New Session",hint:"Create a new Codex session",icon:fs,action:()=>s.setShowNewSessionDialog(!0),available:!0},{id:"delete-session",label:"Delete Session",hint:"Delete the active session",icon:ur,action:()=>{s.activeSessionId&&s.deleteSession(s.activeSessionId)},available:!!s.activeSessionId},{id:"send-message",label:"Send Message",hint:"Focus the message input",icon:Pi,action:()=>{const S=document.querySelector(".cmd-input");S==null||S.focus()},available:!!s.activeSessionId&&!x},{id:"cancel-turn",label:"Cancel Turn",hint:"Cancel the running turn",icon:Fs,action:()=>s.cancelTurn(),available:x},{id:"tab-turns",label:"Switch to Turns Tab",hint:"View conversation timeline",icon:P1,action:()=>s.switchRightTab("turns"),available:!!s.activeSessionId},{id:"tab-sidecar",label:"Ask Sidecar",hint:"Ask about this session — status, blockers, what is left",icon:ms,action:()=>s.switchRightTab("sidecar"),available:!!s.activeSessionId},{id:"toggle-right-panel",label:"Toggle Right Panel",hint:s.rightPanelCollapsed?"Expand the right panel":"Collapse the right panel to its icon rail",icon:H1,action:()=>s.toggleRightPanel(),available:!0},{id:"close-tab",label:"Close Tab",hint:"Close the active session tab",icon:Nn,action:()=>{s.activeSessionId&&s.closeTab(s.activeSessionId)},available:!!s.activeSessionId}]},[s]),m=y.useMemo(()=>{const k=i.toLowerCase().trim(),x=g.filter(S=>S.available);return k?x.filter(S=>S.label.toLowerCase().includes(k)||S.hint.toLowerCase().includes(k)):x},[g,i]);y.useEffect(()=>{t&&(l(""),d(0),setTimeout(()=>{var k;return(k=p.current)==null?void 0:k.focus()},50))},[t]);function v(k){if(k.key==="ArrowDown")k.preventDefault(),d(x=>Math.min(x+1,m.length-1));else if(k.key==="ArrowUp")k.preventDefault(),d(x=>Math.max(x-1,0));else if(k.key==="Enter"){k.preventDefault();const x=m[c];x&&(x.action(),r(!1))}else k.key==="Escape"&&r(!1)}return t?a.jsx("div",{className:"palette-overlay",onClick:()=>r(!1),children:a.jsxs("div",{className:"palette",onClick:k=>k.stopPropagation(),children:[a.jsxs("div",{className:"palette-search",children:[a.jsx("input",{ref:p,type:"text",placeholder:"Type a command…",value:i,onChange:k=>{l(k.target.value),d(0)},onKeyDown:v}),a.jsx("span",{className:"palette-esc",children:"ESC"})]}),m.length===0?a.jsx("div",{className:"palette-empty",children:"No matching commands"}):a.jsx("div",{className:"palette-list",children:m.map((k,x)=>{const S=k.icon;return a.jsxs("div",{className:`palette-item ${x===c?"selected":""}`,onClick:()=>{k.action(),r(!1)},onMouseEnter:()=>d(x),children:[a.jsx("span",{className:"palette-item-icon",children:a.jsx(S,{size:16})}),a.jsx("span",{className:"palette-item-label",children:k.label}),a.jsx("span",{className:"palette-item-hint",children:k.hint}),x===c&&a.jsx(C1,{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 kg=/^[a-z][a-z0-9-]{1,30}$/,UC=2e3;function BC(){const{showRemoteModal:t,setShowRemoteModal:r,selectSession:s}=A(),[i,l]=y.useState(null),[c,d]=y.useState(null),[p,g]=y.useState(!1),[m,v]=y.useState(!1),[k,x]=y.useState(!1),[S,N]=y.useState(!1),[C,T]=y.useState("main"),[j,E]=y.useState(""),[H,I]=y.useState(!1),[L,q]=y.useState(null),K=y.useRef(null);Oi(K,()=>N(!1),S);const $=m||k,te=y.useCallback(async()=>{g(!0),d(null);try{const z=await fetch(`${mn()}/remote/status`,{headers:{Accept:"application/json"}});if(!z.ok)throw new Error(`status ${z.status}`);l(await z.json())}catch{l(null),d("Machine management is only available from this machine's local pane.")}finally{g(!1)}},[]);y.useEffect(()=>{t&&(T("main"),q(null),te())},[t,te]);const me=L!==null&&L.state==="running";if(y.useEffect(()=>{if(!me)return;const z=setInterval(async()=>{try{const Q=await fetch(`${mn()}/remote/enable`,{headers:{Accept:"application/json"}});Q.ok&&q(await Q.json())}catch{}},UC);return()=>clearInterval(z)},[me]),!t)return null;const ue=!!(i!=null&&i.tunnel.provisioned)&&!!(i!=null&&i.service.running)&&!!(i!=null&&i.connection.ok);function ye(z){z.key==="Escape"&&r(!1)}async function be(z){if(kg.test(z)){I(!0);try{const Q=await fetch(`${mn()}/remote/enable`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mahlas:z})});if(!Q.ok)throw new Error(`enable ${Q.status}`);q(await Q.json()),T("setup")}catch{d("Could not start the setup — check the daemon logs.")}finally{I(!1)}}}function Me(){L!=null&&L.troubleshootingSessionId&&(s(L.troubleshootingSessionId),r(!1))}async function Z(){v(!0);try{await fetch(`${mn()}/remote/disable`,{method:"POST"}),await te()}catch{d("Could not stop the tunnel service — check the service logs.")}finally{v(!1)}}async function oe(){if(N(!1),!!window.confirm(`Remove the tunnel completely?
825
+
826
+ This deletes the Cloudflare tunnel, its DNS record and Access app, and this machine's remote state. The mahlas is released.
827
+
828
+ This cannot be undone.`)){x(!0);try{const Q=await fetch(`${mn()}/remote/uninstall`,{method:"DELETE"});if(!Q.ok)throw new Error(`uninstall ${Q.status}`);await te()}catch{d("Could not remove the tunnel — check the daemon logs.")}finally{x(!1)}}}function ie(){if(!L)return a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["Machine name (mahlas)",a.jsx("input",{className:"dialog-input",value:j,onChange:D=>E(D.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:()=>T("main"),children:"Back"}),a.jsxs("button",{className:"dialog-btn-create",disabled:!kg.test(j)||H,onClick:()=>void be(j),children:[H?a.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Start setup"]})]})]});const z=["detect","provision","install","verify","ready"],Q=z.indexOf(L.step),G=L.state==="ready";return a.jsxs(a.Fragment,{children:[L.state==="running"&&a.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(hn,{size:14,className:"spin"})," Setting up the remote tunnel…"]}),L.state==="ready"&&a.jsxs("div",{className:"dialog-label",style:{color:"var(--green)",display:"flex",alignItems:"center",gap:6},children:[a.jsx(Tr,{size:14})," Setup complete — you can close this window."]}),L.state==="ready"&&L.hostname&&a.jsxs("div",{className:"dialog-label",children:["This machine is accessible at"," ",a.jsx("a",{href:`https://${L.hostname}`,target:"_blank",rel:"noreferrer",children:L.hostname})]}),a.jsx("ol",{className:"dialog-label",style:{margin:"4px 0",paddingLeft:0,listStyle:"none"},children:z.map((D,P)=>{const ce=G||Q>-1&&P<Q,B=!G&&P===Q&&L.state==="running";return a.jsxs("li",{style:{display:"flex",alignItems:"center",gap:6,opacity:ce||B?1:.4,color:ce?"var(--green)":void 0},children:[ce?a.jsx(Tr,{size:13}):B?a.jsx(hn,{size:13,className:"spin"}):a.jsx(N1,{size:9,style:{marginLeft:2,marginRight:2}}),D]},D)})}),L.logs.length>0&&a.jsx("div",{className:"dialog-label",style:{opacity:.7,fontSize:12,whiteSpace:"pre-wrap"},children:L.logs.slice(-3).map(D=>D.message).join(`
829
+ `)}),L.state==="troubleshooting"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"dialog-label",style:{color:"var(--red)"},children:"Setup failed — a troubleshooting session is open and the agent is working on the fix in the background."}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-create",onClick:Me,children:"Open troubleshooting session"})})]}),L.state==="failed"&&a.jsxs("div",{className:"dialog-label",style:{color:"var(--red)"},children:["Setup failed: ",L.error]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:()=>void te(),children:"Refresh status"})})]})}return a.jsx("div",{className:"dialog-overlay",onClick:()=>r(!1),children:a.jsxs("div",{className:"dialog",onClick:z=>z.stopPropagation(),onKeyDown:ye,children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"Remote Access"}),a.jsx("button",{className:"dialog-close",onClick:()=>r(!1),children:a.jsx(Nn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[p&&a.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(hn,{size:14,className:"spin"})," Loading machine status…"]}),c&&a.jsx("div",{className:"dialog-label",style:{color:"var(--red)"},children:c}),C==="setup"?ie():a.jsxs(a.Fragment,{children:[ue&&(i==null?void 0:i.tunnel.hostname)&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"dialog-label",children:["This machine is reachable at"," ",a.jsx("a",{href:`https://${i.tunnel.hostname}`,target:"_blank",rel:"noreferrer",children:i.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 Z(),disabled:$,children:[m?a.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Stop tunnel connection"]}),a.jsx("button",{className:"dialog-btn-cancel",style:{width:30,borderLeft:"none",borderTopLeftRadius:0,borderBottomLeftRadius:0,display:"inline-flex",alignItems:"center",justifyContent:"center"},onClick:()=>N(z=>!z),disabled:$,"aria-label":"More tunnel actions","aria-haspopup":"menu","aria-expanded":S,children:k?a.jsx(hn,{size:14,className:"spin"}):a.jsx(No,{size:14})}),S&&a.jsx("div",{ref:K,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 oe(),children:[a.jsx(ur,{size:12})," Remove tunnel"]})})]})]}),!ue&&a.jsx(a.Fragment,{children:i!=null&&i.tunnel.provisioned&&i.tunnel.mahlas&&i.tunnel.hostname?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"dialog-label",children:["Tunnel exists as"," ",a.jsx("a",{href:`https://${i.tunnel.hostname}`,target:"_blank",rel:"noreferrer",children:i.tunnel.hostname})," ","but the connection is stopped."]}),a.jsxs("button",{className:"dialog-btn-create",style:{width:"100%"},onClick:()=>void be(i.tunnel.mahlas),disabled:H,children:[H?a.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):a.jsx(im,{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:()=>T("setup"),children:[a.jsx(im,{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 WC={success:S1,error:Fl,info:A1,warn:mv},HC=4e3;function VC({toast:t}){const r=A(d=>d.removeToast),s=WC[t.type],i=y.useRef(null);y.useEffect(()=>{function d(){i.current=setTimeout(()=>r(t.id),HC)}return d(),()=>{i.current&&clearTimeout(i.current)}},[t.id,r]);function l(){i.current&&(clearTimeout(i.current),i.current=null)}function c(){i.current=setTimeout(()=>r(t.id),2e3)}return a.jsxs("div",{className:`toast toast-${t.type}`,onMouseEnter:l,onMouseLeave:c,children:[a.jsx(s,{size:16}),a.jsx("span",{className:"toast-message",children:t.message}),t.undoAction&&a.jsxs("button",{className:"toast-undo",onClick:()=>{var d;(d=t.undoAction)==null||d.call(t),r(t.id)},children:[a.jsx(J1,{size:12})," ",t.undoLabel||"Undo"]}),a.jsx("button",{className:"toast-close",onClick:()=>r(t.id),children:a.jsx(Nn,{size:14})})]})}function KC(){const t=A(r=>r.toasts);return t.length===0?null:a.jsx("div",{className:"toast-container",children:t.map(r=>a.jsx(VC,{toast:r},r.id))})}function GC(){const[t]=y.useState(N0),[r,s]=y.useState(!1),[i,l]=y.useState(!1),c=y.useRef(void 0);y.useEffect(()=>()=>clearTimeout(c.current),[]);async function d(){await Mi(Kh)&&(s(!0),l(!0),clearTimeout(c.current),c.current=setTimeout(()=>s(!1),1500))}return a.jsxs("main",{className:"daemon-download",children:[a.jsx("h1",{className:"daemon-download-title",children:"Repoburg"}),t&&a.jsx("p",{className:"daemon-download-text",children:"Open the Repoburg app to continue."}),a.jsxs("div",{className:"daemon-download-install",children:[t&&a.jsx("p",{className:"daemon-download-label",children:"Not installed? Run this in Terminal:"}),a.jsxs("div",{className:"daemon-download-cmd",onCopy:()=>l(!0),children:[a.jsx("span",{className:"daemon-download-prompt","aria-hidden":"true",children:"$"}),a.jsx("code",{children:Kh}),a.jsx("button",{type:"button",className:`daemon-download-copy${r?" copied":""}`,onClick:()=>void d(),"aria-label":"Copy the install command",title:r?"Copied":"Copy",children:r?a.jsx(Tr,{size:15}):a.jsx(Ri,{size:15})})]}),!t&&a.jsx("p",{className:"daemon-download-meta",children:"Apple Silicon · macOS 13+"})]}),i&&a.jsx("p",{className:"daemon-download-hint",children:"Paste it into Terminal and press Return. Repoburg installs and opens in your menu bar."}),(t||i)&&a.jsxs("p",{className:"daemon-download-waiting",role:"status",children:[a.jsx(hn,{size:13,className:"spin"}),"Waiting for Repoburg to start…"]})]})}let Jn=null,Co=null,Ti=1e3;const qC=1e4;function wd(){Jn&&(Jn.readyState===WebSocket.OPEN||Jn.readyState===WebSocket.CONNECTING)||(Jn=new WebSocket(bw("/ws")),Jn.onopen=()=>{const t=Ti>1e3;if(Ti=1e3,A.getState().setWsConnected(!0),A.getState().addLogEntry("INFO","WebSocket connected"),t){i0();const r=A.getState();r.activeSessionId&&(r.refreshActiveSession(),r.addToast("info","WebSocket reconnected — session state reconciled"))}},Jn.onclose=()=>{A.getState().setWsConnected(!1),A.getState().addLogEntry("WARN","WebSocket disconnected"),A.getState().addToast("warn","WebSocket disconnected — reconnecting…"),YC()},Jn.onerror=()=>{},Jn.onmessage=t=>{try{const r=JSON.parse(t.data);Dt.trackWsEvent(typeof r.event=="string"?r.event:"unknown",typeof t.data=="string"?t.data.length:0);const s=QC[r.event];s&&s(r.data)}catch{}})}function XC(){Co&&(clearTimeout(Co),Co=null),Jn&&(Jn.onclose=null,Jn.close(),Jn=null),A.getState().setWsConnected(!1)}function YC(){Co||(Co=window.setTimeout(()=>{Co=null,wd()},Ti),Ti=Math.min(Ti*2,qC))}const QC={"turn:created":t=>{const r=t;A.getState().onTurnCreated(r.sessionId,r.turn)},"turn:started":t=>{const r=t;Dt.note(`turn:started — ${r.turnId.slice(0,8)}`),A.getState().onTurnStarted(r.sessionId,r.turnId)},"item:started":t=>{const r=t;A.getState().onItemStarted(r.sessionId,r.turnId,r.item)},"item:updated":t=>{const r=t;A.getState().onItemUpdated(r.sessionId,r.turnId,r.item)},"item:completed":t=>{const r=t;A.getState().onItemCompleted(r.sessionId,r.turnId,r.item)},"item:delta":t=>{const r=t;A.getState().onItemDelta(r.sessionId,r.turnId,r.itemId,r.delta)},"widget:delta":t=>{const r=t;typeof r.itemId!="string"||typeof r.html!="string"||A.getState().onWidgetDelta(r.sessionId,r.turnId,r.itemId,typeof r.title=="string"?r.title:"",r.html)},"turn:completed":t=>{const r=t;Dt.note(`turn:completed — ${r.turnId.slice(0,8)}`),A.getState().onTurnCompleted(r.sessionId,r.turnId,r.usage,r.hasUnreviewed,r.response??void 0)},"turn:tokenUsage":t=>{const r=t;A.getState().onTokenUsageUpdated(r.sessionId,r.turnId,r.usage)},"turn:contextUsage":t=>{const r=t,s={totalTokens:r.totalTokens,contextWindow:r.contextWindow,percentage:r.percentage,...r.autoCompactThreshold?{autoCompactThreshold:r.autoCompactThreshold}:{}};A.getState().onContextUsageUpdated(r.sessionId,s)},"turn:failed":t=>{const r=t;A.getState().onTurnFailed(r.sessionId,r.turnId,r.error,r.resumeState)},"turn:interrupted":t=>{const r=t;Dt.note(`turn:interrupted — ${r.turnId.slice(0,8)} (${r.reason})`),A.getState().onTurnInterrupted(r.sessionId,r.turnId,{reason:r.reason,interruptedAt:r.interruptedAt,attempts:r.attempts,detail:r.detail??null,resumeAt:r.resumeAt??null})},"turn:resuming":t=>{const r=t;A.getState().onTurnResuming(r.sessionId,r.turnId,r.attempt)},"turn:resumed":t=>{const r=t;A.getState().onTurnResumed(r.sessionId,r.turnId)},"turn:retrying":t=>{const r=t;A.getState().onTurnRetrying(r.sessionId,r.turnId,{attempt:r.attempt,maxRetries:r.maxRetries,retryDelayMs:r.retryDelayMs,errorStatus:r.errorStatus??null,error:r.error??null})},"turn:cancelled":t=>{const r=t;A.getState().onTurnCancelled(r.sessionId,r.turnId)},"session:title":t=>{const r=t;A.getState().onSessionTitle(r.sessionId,r.title)},"session:touched":t=>{const r=t;A.getState().onSessionTouched(r.sessionId)},"session:created":t=>{const{session:r}=t;r.origin_app_id&&ol(r.id,r.origin_app_id),A.getState().addSession(r)},"session:updated":t=>{const r=t;A.getState().onSessionUpdated(r.session)},background_tasks:t=>{const r=t;Dt.note(`background_tasks — ${r.tasks.length} live (${r.tasks.map(s=>s.task_type).join(", ")||"none"})`),A.getState().onBackgroundTasksChanged(r.sessionId,r.tasks)},"background_tasks:snapshot":t=>{const r=t;A.getState().onBackgroundTasksSnapshot(r.sessions??{})},"signed_out_turns:snapshot":t=>{const r=t;A.getState().onSignedOutTurnsSnapshot(r.turns??[])},"thread:created":t=>{const r=t;A.getState().onThreadCreated(r.sessionId,r.thread,r.turn)},"thread:followup":t=>{const r=t;A.getState().onThreadFollowup(r.sessionId,r.threadId,r.turn)},"thread:resolved":t=>{const r=t;A.getState().onThreadResolved(r.sessionId,r.threadId,r.status)},"thread:deleted":t=>{const r=t;A.getState().onThreadDeleted(r.sessionId,r.threadId)},"app:tool_call":t=>{const r=t;e0(r.appId,r.callId,r.tool,r.args??{},r.workspace,r.caller)},"app:source:updated":t=>{a0(t.appId),A.getState().refreshApps()},"app:state_changed":t=>{const{appId:r,...s}=t;Hg(r,s)}};function ZC(){const t=A(r=>r.init);return y.useEffect(()=>{kw();function r(){t(),wd()}const{daemonStatus:s,setDaemonStatus:i}=A.getState();let l=null;s==="ready"?r():l=C0({onMissing:()=>i("missing"),onReady:()=>{i("ready"),r()}});function c(){if(document.visibilityState!=="visible")return;const d=A.getState(),p=d.activeSessionId;if(!p)return;const g=d.sessionDetails[p];d.wsConnected||wd(),g&&g.is_running===1&&(d.refreshActiveSession(),d.addLogEntry("INFO","Tab returned — reconciling session state"))}return document.addEventListener("visibilitychange",c),()=>{l==null||l(),XC(),document.removeEventListener("visibilitychange",c)}},[t]),null}const wy="agentpaneView";function kd(t){return{tab:Nd(t),vscode:t.vscodeViewOpen,usage:t.usageViewOpen,terminal:t.terminalViewOpen}}function ky(t,r){return t.tab===r.tab&&t.vscode===r.vscode&&t.usage===r.usage&&t.terminal===r.terminal}function Sg(t){return t.tab===null&&!t.vscode&&!t.usage&&!t.terminal}function bg(t,r){return r.tab!==null&&!t.tabOrder.includes(r.tab)?!1:!ky(r,kd(t))}function Ng(t){const r=t==null?void 0:t[wy];return typeof(r==null?void 0:r.index)!="number"?null:{...r,view:{...r.view,terminal:!!r.view.terminal}}}function JC(t,r){t.getState().vscodeViewOpen!==r.vscode&&t.getState().toggleVscodeView(),t.getState().usageViewOpen!==r.usage&&t.getState().toggleUsageView(),t.getState().terminalViewOpen!==r.terminal&&t.getState().toggleTerminalView();const s=t.getState();if(r.tab===null)return;const{kind:i,id:l}=ps(r.tab);i==="app"?s.openAppTab(l):s.activeSessionId===l?s.setActiveAppTab(null):s.selectSession(l)}function eE(t){let r=Ng(window.history.state)??{index:0,newest:0,view:kd(t.getState())},s=r.newest,i=!1;const l=new Map([[r.index,r.view]]),c=x=>{const S=t.getState();for(let N=r.index+x;N>=0&&N<=s;N+=x){const C=l.get(N);if(!C||bg(S,C))return!0}return!1},d=()=>{const x=c(-1),S=c(1),N=t.getState();(N.canGoBack!==x||N.canGoForward!==S)&&t.setState({canGoBack:x,canGoForward:S})},p=()=>({[wy]:{...r,newest:s}}),g=()=>{window.history.replaceState({...window.history.state,...p()},"")},m=x=>{if(l.set(r.index,r.view),Sg(r.view))r={...r,view:x},g();else{r={index:r.index+1,newest:r.index+1,view:x},s=r.index;for(const S of l.keys())S>s&&l.delete(S);window.history.pushState(p(),"")}l.set(r.index,x)},v=x=>{const S=Ng(x.state);if(!S)return;l.set(S.index,S.view),s=Math.max(s,S.index);const N=t.getState(),C=Math.sign(S.index-r.index);if(C!==0&&!bg(N,S.view)){const T=S.index+C;window.history.go(T<0||T>s?r.index-S.index:C);return}r=S,g(),i=!0;try{JC(t,S.view)}finally{i=!1}d()};g(),d(),window.addEventListener("popstate",v);const k=t.subscribe((x,S)=>{const N=x.activeSessionId!==S.activeSessionId||x.activeAppTabId!==S.activeAppTabId||x.vscodeViewOpen!==S.vscodeViewOpen||x.usageViewOpen!==S.usageViewOpen||x.terminalViewOpen!==S.terminalViewOpen;if(!(!N&&x.tabOrder===S.tabOrder)){if(N&&!i){const C=kd(x);!Sg(C)&&!ky(C,r.view)&&m(C)}d()}});return()=>{k(),window.removeEventListener("popstate",v)}}function tE(){const t=A(c=>c.loading),r=A(c=>c.error),s=A(c=>c.sessions),i=A(c=>c.daemonStatus),l=A(c=>c.setShowCommandPalette);return y.useEffect(()=>Dt.start(),[]),y.useEffect(()=>eE(A),[]),y.useEffect(()=>{function c(d){(d.metaKey||d.ctrlKey)&&d.key==="k"&&(d.preventDefault(),l(!0))}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[l]),a.jsxs(a.Fragment,{children:[a.jsx(ZC,{}),i==="missing"?a.jsx(GC,{}):i==="checking"||t&&s.length===0?a.jsx("div",{className:"empty-state",children:"Loading sessions…"}):r&&s.length===0?a.jsxs("div",{className:"empty-state",children:["Error: ",r]}):a.jsxs(a.Fragment,{children:[a.jsx(EC,{}),a.jsx(jC,{}),a.jsx(AC,{}),a.jsx(MC,{}),a.jsx(zC,{}),a.jsx(BC,{}),a.jsx(FC,{}),a.jsx(KC,{})]})]})}uw.createRoot(document.getElementById("root")).render(a.jsx(lt.StrictMode,{children:a.jsx(tE,{})}));export{Ai as R,Nn as X,bw as b,ve as c,a as j,y as r,A as u};