repoburg 1.3.303 → 1.3.305
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent-pane/backend/dist/index.js +3936 -717
- package/agent-pane/backend/dist/server.js +4031 -717
- package/agent-pane/backend/scripts/session-host.mjs +860 -0
- package/agent-pane/frontend/dist/assets/{TerminalView-C6AkFuDP.js → TerminalView-CWb7lwEQ.js} +1 -1
- package/agent-pane/frontend/dist/assets/index-B5j2jGP4.css +1 -0
- package/agent-pane/frontend/dist/assets/index-BhyGOapD.js +836 -0
- package/agent-pane/frontend/dist/index.html +2 -2
- package/backend/dist/src/agent-runtime/agent-runtime-event-emitter.d.ts +30 -2
- package/backend/dist/src/agent-runtime/agent-runtime-event-emitter.js +108 -6
- package/backend/dist/src/agent-runtime/agent-runtime-event-emitter.js.map +1 -1
- package/backend/dist/src/agent-runtime/agent-runtime.controller.d.ts +4 -2
- package/backend/dist/src/agent-runtime/agent-runtime.controller.js +49 -9
- package/backend/dist/src/agent-runtime/agent-runtime.controller.js.map +1 -1
- package/backend/dist/src/agent-runtime/agent-runtime.types.d.ts +20 -1
- package/backend/dist/src/interactive-chat/chat.service.js +9 -2
- package/backend/dist/src/interactive-chat/chat.service.js.map +1 -1
- package/backend/dist/src/session-inputs/session-inputs.module.js +2 -0
- package/backend/dist/src/session-inputs/session-inputs.module.js.map +1 -1
- package/backend/dist/src/session-inputs/session-inputs.service.d.ts +4 -1
- package/backend/dist/src/session-inputs/session-inputs.service.js +15 -2
- package/backend/dist/src/session-inputs/session-inputs.service.js.map +1 -1
- package/backend/dist/tsconfig.build.tsbuildinfo +1 -1
- package/daemon/dist/agentPane.js +6 -2
- package/daemon/dist/agents.js +74 -0
- package/daemon/dist/agents.spec.js +90 -0
- package/daemon/dist/api/agents.js +38 -0
- package/daemon/dist/api/services.js +25 -0
- package/daemon/dist/index.js +7 -3
- package/daemon/dist/serviceManager.js +28 -2
- package/daemon/dist/serviceRoller.js +133 -0
- package/daemon/dist/serviceRoller.spec.js +132 -0
- package/package.json +2 -1
- package/tabtape/extension/dist/build-info.json +3 -3
- package/tabtape/extension/dist/manifest.json +1 -1
- package/tabtape/ui/dist/build-info.json +3 -3
- package/agent-pane/frontend/dist/assets/index-CuJZVIUh.css +0 -1
- package/agent-pane/frontend/dist/assets/index-DoReiVY-.js +0 -834
|
@@ -0,0 +1,836 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalView-CWb7lwEQ.js","assets/TerminalView-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Ow=Object.defineProperty;var $w=(e,n,r)=>n in e?Ow(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var at=(e,n,r)=>$w(e,typeof n!="symbol"?n+"":n,r);(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))o(a);new MutationObserver(a=>{for(const c of a)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&o(d)}).observe(document,{childList:!0,subtree:!0});function r(a){const c={};return a.integrity&&(c.integrity=a.integrity),a.referrerPolicy&&(c.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?c.credentials="include":a.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function o(a){if(a.ep)return;a.ep=!0;const c=r(a);fetch(a.href,c)}})();function ev(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $u={exports:{}},mi={},Pu={exports:{}},He={};/**
|
|
3
|
+
* @license React
|
|
4
|
+
* react.production.min.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/var Vh;function Pw(){if(Vh)return He;Vh=1;var e=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),k=Symbol.iterator;function x(I){return I===null||typeof I!="object"?null:(I=k&&I[k]||I["@@iterator"],typeof I=="function"?I:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,b={};function T(I,$,le){this.props=I,this.context=$,this.refs=b,this.updater=le||S}T.prototype.isReactComponent={},T.prototype.setState=function(I,$){if(typeof I!="object"&&typeof I!="function"&&I!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,I,$,"setState")},T.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function N(){}N.prototype=T.prototype;function _(I,$,le){this.props=I,this.context=$,this.refs=b,this.updater=le||S}var z=_.prototype=new N;z.constructor=_,E(z,T.prototype),z.isPureReactComponent=!0;var M=Array.isArray,O=Object.prototype.hasOwnProperty,X={current:null},U={key:!0,ref:!0,__self:!0,__source:!0};function P(I,$,le){var H,q={},ae=null,Se=null;if($!=null)for(H in $.ref!==void 0&&(Se=$.ref),$.key!==void 0&&(ae=""+$.key),$)O.call($,H)&&!U.hasOwnProperty(H)&&(q[H]=$[H]);var _e=arguments.length-2;if(_e===1)q.children=le;else if(1<_e){for(var Ae=Array(_e),je=0;je<_e;je++)Ae[je]=arguments[je+2];q.children=Ae}if(I&&I.defaultProps)for(H in _e=I.defaultProps,_e)q[H]===void 0&&(q[H]=_e[H]);return{$$typeof:e,type:I,key:ae,ref:Se,props:q,_owner:X.current}}function Q(I,$){return{$$typeof:e,type:I.type,key:$,ref:I.ref,props:I.props,_owner:I._owner}}function ce(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function ue(I){var $={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(le){return $[le]})}var me=/\/+/g;function Ne(I,$){return typeof I=="object"&&I!==null&&I.key!=null?ue(""+I.key):$.toString(36)}function Me(I,$,le,H,q){var ae=typeof I;(ae==="undefined"||ae==="boolean")&&(I=null);var Se=!1;if(I===null)Se=!0;else switch(ae){case"string":case"number":Se=!0;break;case"object":switch(I.$$typeof){case e:case n:Se=!0}}if(Se)return Se=I,q=q(Se),I=H===""?"."+Ne(Se,0):H,M(q)?(le="",I!=null&&(le=I.replace(me,"$&/")+"/"),Me(q,$,le,"",function(je){return je})):q!=null&&(ce(q)&&(q=Q(q,le+(!q.key||Se&&Se.key===q.key?"":(""+q.key).replace(me,"$&/")+"/")+I)),$.push(q)),1;if(Se=0,H=H===""?".":H+":",M(I))for(var _e=0;_e<I.length;_e++){ae=I[_e];var Ae=H+Ne(ae,_e);Se+=Me(ae,$,le,Ae,q)}else if(Ae=x(I),typeof Ae=="function")for(I=Ae.call(I),_e=0;!(ae=I.next()).done;)ae=ae.value,Ae=H+Ne(ae,_e++),Se+=Me(ae,$,le,Ae,q);else if(ae==="object")throw $=String(I),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.");return Se}function J(I,$,le){if(I==null)return I;var H=[],q=0;return Me(I,H,"","",function(ae){return $.call(le,ae,q++)}),H}function re(I){if(I._status===-1){var $=I._result;$=$(),$.then(function(le){(I._status===0||I._status===-1)&&(I._status=1,I._result=le)},function(le){(I._status===0||I._status===-1)&&(I._status=2,I._result=le)}),I._status===-1&&(I._status=0,I._result=$)}if(I._status===1)return I._result.default;throw I._result}var ee={current:null},F={transition:null},Z={ReactCurrentDispatcher:ee,ReactCurrentBatchConfig:F,ReactCurrentOwner:X};function G(){throw Error("act(...) is not supported in production builds of React.")}return He.Children={map:J,forEach:function(I,$,le){J(I,function(){$.apply(this,arguments)},le)},count:function(I){var $=0;return J(I,function(){$++}),$},toArray:function(I){return J(I,function($){return $})||[]},only:function(I){if(!ce(I))throw Error("React.Children.only expected to receive a single React element child.");return I}},He.Component=T,He.Fragment=r,He.Profiler=a,He.PureComponent=_,He.StrictMode=o,He.Suspense=h,He.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Z,He.act=G,He.cloneElement=function(I,$,le){if(I==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+I+".");var H=E({},I.props),q=I.key,ae=I.ref,Se=I._owner;if($!=null){if($.ref!==void 0&&(ae=$.ref,Se=X.current),$.key!==void 0&&(q=""+$.key),I.type&&I.type.defaultProps)var _e=I.type.defaultProps;for(Ae in $)O.call($,Ae)&&!U.hasOwnProperty(Ae)&&(H[Ae]=$[Ae]===void 0&&_e!==void 0?_e[Ae]:$[Ae])}var Ae=arguments.length-2;if(Ae===1)H.children=le;else if(1<Ae){_e=Array(Ae);for(var je=0;je<Ae;je++)_e[je]=arguments[je+2];H.children=_e}return{$$typeof:e,type:I.type,key:q,ref:ae,props:H,_owner:Se}},He.createContext=function(I){return I={$$typeof:d,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},I.Provider={$$typeof:c,_context:I},I.Consumer=I},He.createElement=P,He.createFactory=function(I){var $=P.bind(null,I);return $.type=I,$},He.createRef=function(){return{current:null}},He.forwardRef=function(I){return{$$typeof:f,render:I}},He.isValidElement=ce,He.lazy=function(I){return{$$typeof:v,_payload:{_status:-1,_result:I},_init:re}},He.memo=function(I,$){return{$$typeof:g,type:I,compare:$===void 0?null:$}},He.startTransition=function(I){var $=F.transition;F.transition={};try{I()}finally{F.transition=$}},He.unstable_act=G,He.useCallback=function(I,$){return ee.current.useCallback(I,$)},He.useContext=function(I){return ee.current.useContext(I)},He.useDebugValue=function(){},He.useDeferredValue=function(I){return ee.current.useDeferredValue(I)},He.useEffect=function(I,$){return ee.current.useEffect(I,$)},He.useId=function(){return ee.current.useId()},He.useImperativeHandle=function(I,$,le){return ee.current.useImperativeHandle(I,$,le)},He.useInsertionEffect=function(I,$){return ee.current.useInsertionEffect(I,$)},He.useLayoutEffect=function(I,$){return ee.current.useLayoutEffect(I,$)},He.useMemo=function(I,$){return ee.current.useMemo(I,$)},He.useReducer=function(I,$,le){return ee.current.useReducer(I,$,le)},He.useRef=function(I){return ee.current.useRef(I)},He.useState=function(I){return ee.current.useState(I)},He.useSyncExternalStore=function(I,$,le){return ee.current.useSyncExternalStore(I,$,le)},He.useTransition=function(){return ee.current.useTransition()},He.version="18.3.1",He}var Kh;function Wd(){return Kh||(Kh=1,Pu.exports=Pw()),Pu.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 Gh;function zw(){if(Gh)return mi;Gh=1;var e=Wd(),n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function d(f,h,g){var v,k={},x=null,S=null;g!==void 0&&(x=""+g),h.key!==void 0&&(x=""+h.key),h.ref!==void 0&&(S=h.ref);for(v in h)o.call(h,v)&&!c.hasOwnProperty(v)&&(k[v]=h[v]);if(f&&f.defaultProps)for(v in h=f.defaultProps,h)k[v]===void 0&&(k[v]=h[v]);return{$$typeof:n,type:f,key:x,ref:S,props:k,_owner:a.current}}return mi.Fragment=r,mi.jsx=d,mi.jsxs=d,mi}var qh;function Fw(){return qh||(qh=1,$u.exports=zw()),$u.exports}var l=Fw(),y=Wd();const ct=ev(y);var Ja={},zu={exports:{}},In={},Fu={exports:{}},Uu={};/**
|
|
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 Xh;function Uw(){return Xh||(Xh=1,(function(e){function n(F,Z){var G=F.length;F.push(Z);e:for(;0<G;){var I=G-1>>>1,$=F[I];if(0<a($,Z))F[I]=Z,F[G]=$,G=I;else break e}}function r(F){return F.length===0?null:F[0]}function o(F){if(F.length===0)return null;var Z=F[0],G=F.pop();if(G!==Z){F[0]=G;e:for(var I=0,$=F.length,le=$>>>1;I<le;){var H=2*(I+1)-1,q=F[H],ae=H+1,Se=F[ae];if(0>a(q,G))ae<$&&0>a(Se,q)?(F[I]=Se,F[ae]=G,I=ae):(F[I]=q,F[H]=G,I=H);else if(ae<$&&0>a(Se,G))F[I]=Se,F[ae]=G,I=ae;else break e}}return Z}function a(F,Z){var G=F.sortIndex-Z.sortIndex;return G!==0?G:F.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var h=[],g=[],v=1,k=null,x=3,S=!1,E=!1,b=!1,T=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function z(F){for(var Z=r(g);Z!==null;){if(Z.callback===null)o(g);else if(Z.startTime<=F)o(g),Z.sortIndex=Z.expirationTime,n(h,Z);else break;Z=r(g)}}function M(F){if(b=!1,z(F),!E)if(r(h)!==null)E=!0,re(O);else{var Z=r(g);Z!==null&&ee(M,Z.startTime-F)}}function O(F,Z){E=!1,b&&(b=!1,N(P),P=-1),S=!0;var G=x;try{for(z(Z),k=r(h);k!==null&&(!(k.expirationTime>Z)||F&&!ue());){var I=k.callback;if(typeof I=="function"){k.callback=null,x=k.priorityLevel;var $=I(k.expirationTime<=Z);Z=e.unstable_now(),typeof $=="function"?k.callback=$:k===r(h)&&o(h),z(Z)}else o(h);k=r(h)}if(k!==null)var le=!0;else{var H=r(g);H!==null&&ee(M,H.startTime-Z),le=!1}return le}finally{k=null,x=G,S=!1}}var X=!1,U=null,P=-1,Q=5,ce=-1;function ue(){return!(e.unstable_now()-ce<Q)}function me(){if(U!==null){var F=e.unstable_now();ce=F;var Z=!0;try{Z=U(!0,F)}finally{Z?Ne():(X=!1,U=null)}}else X=!1}var Ne;if(typeof _=="function")Ne=function(){_(me)};else if(typeof MessageChannel<"u"){var Me=new MessageChannel,J=Me.port2;Me.port1.onmessage=me,Ne=function(){J.postMessage(null)}}else Ne=function(){T(me,0)};function re(F){U=F,X||(X=!0,Ne())}function ee(F,Z){P=T(function(){F(e.unstable_now())},Z)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(F){F.callback=null},e.unstable_continueExecution=function(){E||S||(E=!0,re(O))},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_getFirstCallbackNode=function(){return r(h)},e.unstable_next=function(F){switch(x){case 1:case 2:case 3:var Z=3;break;default:Z=x}var G=x;x=Z;try{return F()}finally{x=G}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(F,Z){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var G=x;x=F;try{return Z()}finally{x=G}},e.unstable_scheduleCallback=function(F,Z,G){var I=e.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?I+G:I):G=I,F){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=G+$,F={id:v++,callback:Z,priorityLevel:F,startTime:G,expirationTime:$,sortIndex:-1},G>I?(F.sortIndex=G,n(g,F),r(h)===null&&F===r(g)&&(b?(N(P),P=-1):b=!0,ee(M,G-I))):(F.sortIndex=$,n(h,F),E||S||(E=!0,re(O))),F},e.unstable_shouldYield=ue,e.unstable_wrapCallback=function(F){var Z=x;return function(){var G=x;x=Z;try{return F.apply(this,arguments)}finally{x=G}}}})(Uu)),Uu}var Yh;function Bw(){return Yh||(Yh=1,Fu.exports=Uw()),Fu.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 Qh;function Ww(){if(Qh)return In;Qh=1;var e=Wd(),n=Bw();function r(t){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+t,i=1;i<arguments.length;i++)s+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+t+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var o=new Set,a={};function c(t,s){d(t,s),d(t+"Capture",s)}function d(t,s){for(a[t]=s,t=0;t<s.length;t++)o.add(s[t])}var f=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,g=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,v={},k={};function x(t){return h.call(k,t)?!0:h.call(v,t)?!1:g.test(t)?k[t]=!0:(v[t]=!0,!1)}function S(t,s,i,u){if(i!==null&&i.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return u?!1:i!==null?!i.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function E(t,s,i,u){if(s===null||typeof s>"u"||S(t,s,i,u))return!0;if(u)return!1;if(i!==null)switch(i.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function b(t,s,i,u,p,m,w){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=u,this.attributeNamespace=p,this.mustUseProperty=i,this.propertyName=t,this.type=s,this.sanitizeURL=m,this.removeEmptyString=w}var T={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){T[t]=new b(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var s=t[0];T[s]=new b(s,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){T[t]=new b(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){T[t]=new b(t,2,!1,t,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){T[t]=new b(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){T[t]=new b(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){T[t]=new b(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){T[t]=new b(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){T[t]=new b(t,5,!1,t.toLowerCase(),null,!1,!1)});var N=/[\-:]([a-z])/g;function _(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var s=t.replace(N,_);T[s]=new b(s,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var s=t.replace(N,_);T[s]=new b(s,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var s=t.replace(N,_);T[s]=new b(s,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){T[t]=new b(t,1,!1,t.toLowerCase(),null,!1,!1)}),T.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){T[t]=new b(t,1,!1,t.toLowerCase(),null,!0,!0)});function z(t,s,i,u){var p=T.hasOwnProperty(s)?T[s]:null;(p!==null?p.type!==0:u||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(E(s,i,p,u)&&(i=null),u||p===null?x(s)&&(i===null?t.removeAttribute(s):t.setAttribute(s,""+i)):p.mustUseProperty?t[p.propertyName]=i===null?p.type===3?!1:"":i:(s=p.attributeName,u=p.attributeNamespace,i===null?t.removeAttribute(s):(p=p.type,i=p===3||p===4&&i===!0?"":""+i,u?t.setAttributeNS(u,s,i):t.setAttribute(s,i))))}var M=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,O=Symbol.for("react.element"),X=Symbol.for("react.portal"),U=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),Q=Symbol.for("react.profiler"),ce=Symbol.for("react.provider"),ue=Symbol.for("react.context"),me=Symbol.for("react.forward_ref"),Ne=Symbol.for("react.suspense"),Me=Symbol.for("react.suspense_list"),J=Symbol.for("react.memo"),re=Symbol.for("react.lazy"),ee=Symbol.for("react.offscreen"),F=Symbol.iterator;function Z(t){return t===null||typeof t!="object"?null:(t=F&&t[F]||t["@@iterator"],typeof t=="function"?t:null)}var G=Object.assign,I;function $(t){if(I===void 0)try{throw Error()}catch(i){var s=i.stack.trim().match(/\n( *(at )?)/);I=s&&s[1]||""}return`
|
|
35
|
+
`+I+t}var le=!1;function H(t,s){if(!t||le)return"";le=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(K){var u=K}Reflect.construct(t,[],s)}else{try{s.call()}catch(K){u=K}t.call(s.prototype)}else{try{throw Error()}catch(K){u=K}t()}}catch(K){if(K&&u&&typeof K.stack=="string"){for(var p=K.stack.split(`
|
|
36
|
+
`),m=u.stack.split(`
|
|
37
|
+
`),w=p.length-1,j=m.length-1;1<=w&&0<=j&&p[w]!==m[j];)j--;for(;1<=w&&0<=j;w--,j--)if(p[w]!==m[j]){if(w!==1||j!==1)do if(w--,j--,0>j||p[w]!==m[j]){var D=`
|
|
38
|
+
`+p[w].replace(" at new "," at ");return t.displayName&&D.includes("<anonymous>")&&(D=D.replace("<anonymous>",t.displayName)),D}while(1<=w&&0<=j);break}}}finally{le=!1,Error.prepareStackTrace=i}return(t=t?t.displayName||t.name:"")?$(t):""}function q(t){switch(t.tag){case 5:return $(t.type);case 16:return $("Lazy");case 13:return $("Suspense");case 19:return $("SuspenseList");case 0:case 2:case 15:return t=H(t.type,!1),t;case 11:return t=H(t.type.render,!1),t;case 1:return t=H(t.type,!0),t;default:return""}}function ae(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case U:return"Fragment";case X:return"Portal";case Q:return"Profiler";case P:return"StrictMode";case Ne:return"Suspense";case Me:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case ue:return(t.displayName||"Context")+".Consumer";case ce:return(t._context.displayName||"Context")+".Provider";case me:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case J:return s=t.displayName||null,s!==null?s:ae(t.type)||"Memo";case re:s=t._payload,t=t._init;try{return ae(t(s))}catch{}}return null}function Se(t){var s=t.type;switch(t.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=s.render,t=t.displayName||t.name||"",s.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ae(s);case 8:return s===P?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function _e(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Ae(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function je(t){var s=Ae(t)?"checked":"value",i=Object.getOwnPropertyDescriptor(t.constructor.prototype,s),u=""+t[s];if(!t.hasOwnProperty(s)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var p=i.get,m=i.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return p.call(this)},set:function(w){u=""+w,m.call(this,w)}}),Object.defineProperty(t,s,{enumerable:i.enumerable}),{getValue:function(){return u},setValue:function(w){u=""+w},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function ge(t){t._valueTracker||(t._valueTracker=je(t))}function he(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var i=s.getValue(),u="";return t&&(u=Ae(t)?t.checked?"true":"false":t.value),t=u,t!==i?(s.setValue(t),!0):!1}function Ve(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Ie(t,s){var i=s.checked;return G({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??t._wrapperState.initialChecked})}function mt(t,s){var i=s.defaultValue==null?"":s.defaultValue,u=s.checked!=null?s.checked:s.defaultChecked;i=_e(s.value!=null?s.value:i),t._wrapperState={initialChecked:u,initialValue:i,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function Ue(t,s){s=s.checked,s!=null&&z(t,"checked",s,!1)}function Vt(t,s){Ue(t,s);var i=_e(s.value),u=s.type;if(i!=null)u==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+i):t.value!==""+i&&(t.value=""+i);else if(u==="submit"||u==="reset"){t.removeAttribute("value");return}s.hasOwnProperty("value")?St(t,s.type,i):s.hasOwnProperty("defaultValue")&&St(t,s.type,_e(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(t.defaultChecked=!!s.defaultChecked)}function tn(t,s,i){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var u=s.type;if(!(u!=="submit"&&u!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+t._wrapperState.initialValue,i||s===t.value||(t.value=s),t.defaultValue=s}i=t.name,i!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,i!==""&&(t.name=i)}function St(t,s,i){(s!=="number"||Ve(t.ownerDocument)!==t)&&(i==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+i&&(t.defaultValue=""+i))}var jt=Array.isArray;function Ft(t,s,i,u){if(t=t.options,s){s={};for(var p=0;p<i.length;p++)s["$"+i[p]]=!0;for(i=0;i<t.length;i++)p=s.hasOwnProperty("$"+t[i].value),t[i].selected!==p&&(t[i].selected=p),p&&u&&(t[i].defaultSelected=!0)}else{for(i=""+_e(i),s=null,p=0;p<t.length;p++){if(t[p].value===i){t[p].selected=!0,u&&(t[p].defaultSelected=!0);return}s!==null||t[p].disabled||(s=t[p])}s!==null&&(s.selected=!0)}}function Ot(t,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return G({},s,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Y(t,s){var i=s.value;if(i==null){if(i=s.children,s=s.defaultValue,i!=null){if(s!=null)throw Error(r(92));if(jt(i)){if(1<i.length)throw Error(r(93));i=i[0]}s=i}s==null&&(s=""),i=s}t._wrapperState={initialValue:_e(i)}}function ve(t,s){var i=_e(s.value),u=_e(s.defaultValue);i!=null&&(i=""+i,i!==t.value&&(t.value=i),s.defaultValue==null&&t.defaultValue!==i&&(t.defaultValue=i)),u!=null&&(t.defaultValue=""+u)}function Be(t){var s=t.textContent;s===t._wrapperState.initialValue&&s!==""&&s!==null&&(t.value=s)}function rt(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function gt(t,s){return t==null||t==="http://www.w3.org/1999/xhtml"?rt(s):t==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var vt,_t=(function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,i,u,p){MSApp.execUnsafeLocalFunction(function(){return t(s,i,u,p)})}:t})(function(t,s){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=s;else{for(vt=vt||document.createElement("div"),vt.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=vt.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;s.firstChild;)t.appendChild(s.firstChild)}});function an(t,s){if(s){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=s;return}}t.textContent=s}var dt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Mn=["Webkit","ms","Moz","O"];Object.keys(dt).forEach(function(t){Mn.forEach(function(s){s=s+t.charAt(0).toUpperCase()+t.substring(1),dt[s]=dt[t]})});function Ln(t,s,i){return s==null||typeof s=="boolean"||s===""?"":i||typeof s!="number"||s===0||dt.hasOwnProperty(t)&&dt[t]?(""+s).trim():s+"px"}function hs(t,s){t=t.style;for(var i in s)if(s.hasOwnProperty(i)){var u=i.indexOf("--")===0,p=Ln(i,s[i],u);i==="float"&&(i="cssFloat"),u?t.setProperty(i,p):t[i]=p}}var ms=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 ns(t,s){if(s){if(ms[t]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(r(137,t));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(r(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(r(61))}if(s.style!=null&&typeof s.style!="object")throw Error(r(62))}}function On(t,s){if(t.indexOf("-")===-1)return typeof s.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var gn=null;function ln(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Kt=null,vn=null,Ze=null;function Rt(t){if(t=ei(t)){if(typeof Kt!="function")throw Error(r(280));var s=t.stateNode;s&&(s=ha(s),Kt(t.stateNode,t.type,s))}}function ft(t){vn?Ze?Ze.push(t):Ze=[t]:vn=t}function Gt(){if(vn){var t=vn,s=Ze;if(Ze=vn=null,Rt(t),s)for(t=0;t<s.length;t++)Rt(s[t])}}function yt(t,s){return t(s)}function xt(){}var lt=!1;function qt(t,s,i){if(lt)return t(s,i);lt=!0;try{return yt(t,s,i)}finally{lt=!1,(vn!==null||Ze!==null)&&(xt(),Gt())}}function it(t,s){var i=t.stateNode;if(i===null)return null;var u=ha(i);if(u===null)return null;i=u[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(i&&typeof i!="function")throw Error(r(231,s,typeof i));return i}var $t=!1;if(f)try{var R={};Object.defineProperty(R,"passive",{get:function(){$t=!0}}),window.addEventListener("test",R,R),window.removeEventListener("test",R,R)}catch{$t=!1}function pe(t,s,i,u,p,m,w,j,D){var K=Array.prototype.slice.call(arguments,3);try{s.apply(i,K)}catch(se){this.onError(se)}}var ie=!1,we=null,$e=!1,qe=null,Pe={onError:function(t){ie=!0,we=t}};function Ut(t,s,i,u,p,m,w,j,D){ie=!1,we=null,pe.apply(Pe,arguments)}function $n(t,s,i,u,p,m,w,j,D){if(Ut.apply(this,arguments),ie){if(ie){var K=we;ie=!1,we=null}else throw Error(r(198));$e||($e=!0,qe=K)}}function We(t){var s=t,i=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(i=s.return),t=s.return;while(t)}return s.tag===3?i:null}function yn(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function js(t){if(We(t)!==t)throw Error(r(188))}function Bs(t){var s=t.alternate;if(!s){if(s=We(t),s===null)throw Error(r(188));return s!==t?null:t}for(var i=t,u=s;;){var p=i.return;if(p===null)break;var m=p.alternate;if(m===null){if(u=p.return,u!==null){i=u;continue}break}if(p.child===m.child){for(m=p.child;m;){if(m===i)return js(p),t;if(m===u)return js(p),s;m=m.sibling}throw Error(r(188))}if(i.return!==u.return)i=p,u=m;else{for(var w=!1,j=p.child;j;){if(j===i){w=!0,i=p,u=m;break}if(j===u){w=!0,u=p,i=m;break}j=j.sibling}if(!w){for(j=m.child;j;){if(j===i){w=!0,i=m,u=p;break}if(j===u){w=!0,u=m,i=p;break}j=j.sibling}if(!w)throw Error(r(189))}}if(i.alternate!==u)throw Error(r(190))}if(i.tag!==3)throw Error(r(188));return i.stateNode.current===i?t:s}function Pn(t){return t=Bs(t),t!==null?gs(t):null}function gs(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var s=gs(t);if(s!==null)return s;t=t.sibling}return null}var Je=n.unstable_scheduleCallback,At=n.unstable_cancelCallback,vs=n.unstable_shouldYield,lc=n.unstable_requestPaint,bt=n.unstable_now,ys=n.unstable_getCurrentPriorityLevel,Ws=n.unstable_ImmediatePriority,xs=n.unstable_UserBlockingPriority,Wr=n.unstable_NormalPriority,xr=n.unstable_LowPriority,Yi=n.unstable_IdlePriority,wr=null,zn=null;function Hr(t){if(zn&&typeof zn.onCommitFiberRoot=="function")try{zn.onCommitFiberRoot(wr,t,void 0,(t.current.flags&128)===128)}catch{}}var xn=Math.clz32?Math.clz32:kr,Vr=Math.log,Hs=Math.LN2;function kr(t){return t>>>=0,t===0?32:31-(Vr(t)/Hs|0)|0}var wn=64,Kr=4194304;function Sr(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function br(t,s){var i=t.pendingLanes;if(i===0)return 0;var u=0,p=t.suspendedLanes,m=t.pingedLanes,w=i&268435455;if(w!==0){var j=w&~p;j!==0?u=Sr(j):(m&=w,m!==0&&(u=Sr(m)))}else w=i&~p,w!==0?u=Sr(w):m!==0&&(u=Sr(m));if(u===0)return 0;if(s!==0&&s!==u&&(s&p)===0&&(p=u&-u,m=s&-s,p>=m||p===16&&(m&4194240)!==0))return s;if((u&4)!==0&&(u|=i&16),s=t.entangledLanes,s!==0)for(t=t.entanglements,s&=u;0<s;)i=31-xn(s),p=1<<i,u|=t[i],s&=~p;return u}function Qi(t,s){switch(t){case 1:case 2:case 4:return s+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Zi(t,s){for(var i=t.suspendedLanes,u=t.pingedLanes,p=t.expirationTimes,m=t.pendingLanes;0<m;){var w=31-xn(m),j=1<<w,D=p[w];D===-1?((j&i)===0||(j&u)!==0)&&(p[w]=Qi(j,s)):D<=s&&(t.expiredLanes|=j),m&=~j}}function $o(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Po(){var t=wn;return wn<<=1,(wn&4194240)===0&&(wn=64),t}function zo(t){for(var s=[],i=0;31>i;i++)s.push(t);return s}function Nr(t,s,i){t.pendingLanes|=s,s!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,s=31-xn(s),t[s]=i}function Ji(t,s){var i=t.pendingLanes&~s;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=s,t.mutableReadLanes&=s,t.entangledLanes&=s,s=t.entanglements;var u=t.eventTimes;for(t=t.expirationTimes;0<i;){var p=31-xn(i),m=1<<p;s[p]=0,u[p]=-1,t[p]=-1,i&=~m}}function Vs(t,s){var i=t.entangledLanes|=s;for(t=t.entanglements;i;){var u=31-xn(i),p=1<<u;p&s|t[u]&s&&(t[u]|=s),i&=~p}}var Xe=0;function de(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var C,B,te,Te,Re,Fe=!1,Ye=[],et=null,Nt=null,Tt=null,_s=new Map,Dt=new Map,Ks=[],rx="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 jf(t,s){switch(t){case"focusin":case"focusout":et=null;break;case"dragenter":case"dragleave":Nt=null;break;case"mouseover":case"mouseout":Tt=null;break;case"pointerover":case"pointerout":_s.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Dt.delete(s.pointerId)}}function Fo(t,s,i,u,p,m){return t===null||t.nativeEvent!==m?(t={blockedOn:s,domEventName:i,eventSystemFlags:u,nativeEvent:m,targetContainers:[p]},s!==null&&(s=ei(s),s!==null&&B(s)),t):(t.eventSystemFlags|=u,s=t.targetContainers,p!==null&&s.indexOf(p)===-1&&s.push(p),t)}function ox(t,s,i,u,p){switch(s){case"focusin":return et=Fo(et,t,s,i,u,p),!0;case"dragenter":return Nt=Fo(Nt,t,s,i,u,p),!0;case"mouseover":return Tt=Fo(Tt,t,s,i,u,p),!0;case"pointerover":var m=p.pointerId;return _s.set(m,Fo(_s.get(m)||null,t,s,i,u,p)),!0;case"gotpointercapture":return m=p.pointerId,Dt.set(m,Fo(Dt.get(m)||null,t,s,i,u,p)),!0}return!1}function _f(t){var s=Tr(t.target);if(s!==null){var i=We(s);if(i!==null){if(s=i.tag,s===13){if(s=yn(i),s!==null){t.blockedOn=s,Re(t.priority,function(){te(i)});return}}else if(s===3&&i.stateNode.current.memoizedState.isDehydrated){t.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}t.blockedOn=null}function ea(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var i=uc(t.domEventName,t.eventSystemFlags,s[0],t.nativeEvent);if(i===null){i=t.nativeEvent;var u=new i.constructor(i.type,i);gn=u,i.target.dispatchEvent(u),gn=null}else return s=ei(i),s!==null&&B(s),t.blockedOn=i,!1;s.shift()}return!0}function Rf(t,s,i){ea(t)&&i.delete(s)}function ix(){Fe=!1,et!==null&&ea(et)&&(et=null),Nt!==null&&ea(Nt)&&(Nt=null),Tt!==null&&ea(Tt)&&(Tt=null),_s.forEach(Rf),Dt.forEach(Rf)}function Uo(t,s){t.blockedOn===s&&(t.blockedOn=null,Fe||(Fe=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,ix)))}function Bo(t){function s(p){return Uo(p,t)}if(0<Ye.length){Uo(Ye[0],t);for(var i=1;i<Ye.length;i++){var u=Ye[i];u.blockedOn===t&&(u.blockedOn=null)}}for(et!==null&&Uo(et,t),Nt!==null&&Uo(Nt,t),Tt!==null&&Uo(Tt,t),_s.forEach(s),Dt.forEach(s),i=0;i<Ks.length;i++)u=Ks[i],u.blockedOn===t&&(u.blockedOn=null);for(;0<Ks.length&&(i=Ks[0],i.blockedOn===null);)_f(i),i.blockedOn===null&&Ks.shift()}var Gr=M.ReactCurrentBatchConfig,ta=!0;function ax(t,s,i,u){var p=Xe,m=Gr.transition;Gr.transition=null;try{Xe=1,cc(t,s,i,u)}finally{Xe=p,Gr.transition=m}}function lx(t,s,i,u){var p=Xe,m=Gr.transition;Gr.transition=null;try{Xe=4,cc(t,s,i,u)}finally{Xe=p,Gr.transition=m}}function cc(t,s,i,u){if(ta){var p=uc(t,s,i,u);if(p===null)Ec(t,s,u,na,i),jf(t,u);else if(ox(p,t,s,i,u))u.stopPropagation();else if(jf(t,u),s&4&&-1<rx.indexOf(t)){for(;p!==null;){var m=ei(p);if(m!==null&&C(m),m=uc(t,s,i,u),m===null&&Ec(t,s,u,na,i),m===p)break;p=m}p!==null&&u.stopPropagation()}else Ec(t,s,u,null,i)}}var na=null;function uc(t,s,i,u){if(na=null,t=ln(u),t=Tr(t),t!==null)if(s=We(t),s===null)t=null;else if(i=s.tag,i===13){if(t=yn(s),t!==null)return t;t=null}else if(i===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null);return na=t,null}function Af(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(ys()){case Ws:return 1;case xs:return 4;case Wr:case xr:return 16;case Yi:return 536870912;default:return 16}default:return 16}}var Gs=null,dc=null,sa=null;function If(){if(sa)return sa;var t,s=dc,i=s.length,u,p="value"in Gs?Gs.value:Gs.textContent,m=p.length;for(t=0;t<i&&s[t]===p[t];t++);var w=i-t;for(u=1;u<=w&&s[i-u]===p[m-u];u++);return sa=p.slice(t,1<u?1-u:void 0)}function ra(t){var s=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function oa(){return!0}function Df(){return!1}function Fn(t){function s(i,u,p,m,w){this._reactName=i,this._targetInst=p,this.type=u,this.nativeEvent=m,this.target=w,this.currentTarget=null;for(var j in t)t.hasOwnProperty(j)&&(i=t[j],this[j]=i?i(m):m[j]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?oa:Df,this.isPropagationStopped=Df,this}return G(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=oa)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=oa)},persist:function(){},isPersistent:oa}),s}var qr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fc=Fn(qr),Wo=G({},qr,{view:0,detail:0}),cx=Fn(Wo),pc,hc,Ho,ia=G({},Wo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Ho&&(Ho&&t.type==="mousemove"?(pc=t.screenX-Ho.screenX,hc=t.screenY-Ho.screenY):hc=pc=0,Ho=t),pc)},movementY:function(t){return"movementY"in t?t.movementY:hc}}),Mf=Fn(ia),ux=G({},ia,{dataTransfer:0}),dx=Fn(ux),fx=G({},Wo,{relatedTarget:0}),mc=Fn(fx),px=G({},qr,{animationName:0,elapsedTime:0,pseudoElement:0}),hx=Fn(px),mx=G({},qr,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),gx=Fn(mx),vx=G({},qr,{data:0}),Lf=Fn(vx),yx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},xx={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"},wx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function kx(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=wx[t])?!!s[t]:!1}function gc(){return kx}var Sx=G({},Wo,{key:function(t){if(t.key){var s=yx[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=ra(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?xx[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gc,charCode:function(t){return t.type==="keypress"?ra(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?ra(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),bx=Fn(Sx),Nx=G({},ia,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Of=Fn(Nx),Tx=G({},Wo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gc}),Cx=Fn(Tx),Ex=G({},qr,{propertyName:0,elapsedTime:0,pseudoElement:0}),jx=Fn(Ex),_x=G({},ia,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Rx=Fn(_x),Ax=[9,13,27,32],vc=f&&"CompositionEvent"in window,Vo=null;f&&"documentMode"in document&&(Vo=document.documentMode);var Ix=f&&"TextEvent"in window&&!Vo,$f=f&&(!vc||Vo&&8<Vo&&11>=Vo),Pf=" ",zf=!1;function Ff(t,s){switch(t){case"keyup":return Ax.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Uf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Xr=!1;function Dx(t,s){switch(t){case"compositionend":return Uf(s);case"keypress":return s.which!==32?null:(zf=!0,Pf);case"textInput":return t=s.data,t===Pf&&zf?null:t;default:return null}}function Mx(t,s){if(Xr)return t==="compositionend"||!vc&&Ff(t,s)?(t=If(),sa=dc=Gs=null,Xr=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return $f&&s.locale!=="ko"?null:s.data;default:return null}}var Lx={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 Bf(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!Lx[t.type]:s==="textarea"}function Wf(t,s,i,u){ft(u),s=da(s,"onChange"),0<s.length&&(i=new fc("onChange","change",null,i,u),t.push({event:i,listeners:s}))}var Ko=null,Go=null;function Ox(t){ap(t,0)}function aa(t){var s=eo(t);if(he(s))return t}function $x(t,s){if(t==="change")return s}var Hf=!1;if(f){var yc;if(f){var xc="oninput"in document;if(!xc){var Vf=document.createElement("div");Vf.setAttribute("oninput","return;"),xc=typeof Vf.oninput=="function"}yc=xc}else yc=!1;Hf=yc&&(!document.documentMode||9<document.documentMode)}function Kf(){Ko&&(Ko.detachEvent("onpropertychange",Gf),Go=Ko=null)}function Gf(t){if(t.propertyName==="value"&&aa(Go)){var s=[];Wf(s,Go,t,ln(t)),qt(Ox,s)}}function Px(t,s,i){t==="focusin"?(Kf(),Ko=s,Go=i,Ko.attachEvent("onpropertychange",Gf)):t==="focusout"&&Kf()}function zx(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return aa(Go)}function Fx(t,s){if(t==="click")return aa(s)}function Ux(t,s){if(t==="input"||t==="change")return aa(s)}function Bx(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var ss=typeof Object.is=="function"?Object.is:Bx;function qo(t,s){if(ss(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var i=Object.keys(t),u=Object.keys(s);if(i.length!==u.length)return!1;for(u=0;u<i.length;u++){var p=i[u];if(!h.call(s,p)||!ss(t[p],s[p]))return!1}return!0}function qf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Xf(t,s){var i=qf(t);t=0;for(var u;i;){if(i.nodeType===3){if(u=t+i.textContent.length,t<=s&&u>=s)return{node:i,offset:s-t};t=u}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=qf(i)}}function Yf(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?Yf(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function Qf(){for(var t=window,s=Ve();s instanceof t.HTMLIFrameElement;){try{var i=typeof s.contentWindow.location.href=="string"}catch{i=!1}if(i)t=s.contentWindow;else break;s=Ve(t.document)}return s}function wc(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}function Wx(t){var s=Qf(),i=t.focusedElem,u=t.selectionRange;if(s!==i&&i&&i.ownerDocument&&Yf(i.ownerDocument.documentElement,i)){if(u!==null&&wc(i)){if(s=u.start,t=u.end,t===void 0&&(t=s),"selectionStart"in i)i.selectionStart=s,i.selectionEnd=Math.min(t,i.value.length);else if(t=(s=i.ownerDocument||document)&&s.defaultView||window,t.getSelection){t=t.getSelection();var p=i.textContent.length,m=Math.min(u.start,p);u=u.end===void 0?m:Math.min(u.end,p),!t.extend&&m>u&&(p=u,u=m,m=p),p=Xf(i,m);var w=Xf(i,u);p&&w&&(t.rangeCount!==1||t.anchorNode!==p.node||t.anchorOffset!==p.offset||t.focusNode!==w.node||t.focusOffset!==w.offset)&&(s=s.createRange(),s.setStart(p.node,p.offset),t.removeAllRanges(),m>u?(t.addRange(s),t.extend(w.node,w.offset)):(s.setEnd(w.node,w.offset),t.addRange(s)))}}for(s=[],t=i;t=t.parentNode;)t.nodeType===1&&s.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<s.length;i++)t=s[i],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var Hx=f&&"documentMode"in document&&11>=document.documentMode,Yr=null,kc=null,Xo=null,Sc=!1;function Zf(t,s,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Sc||Yr==null||Yr!==Ve(u)||(u=Yr,"selectionStart"in u&&wc(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Xo&&qo(Xo,u)||(Xo=u,u=da(kc,"onSelect"),0<u.length&&(s=new fc("onSelect","select",null,s,i),t.push({event:s,listeners:u}),s.target=Yr)))}function la(t,s){var i={};return i[t.toLowerCase()]=s.toLowerCase(),i["Webkit"+t]="webkit"+s,i["Moz"+t]="moz"+s,i}var Qr={animationend:la("Animation","AnimationEnd"),animationiteration:la("Animation","AnimationIteration"),animationstart:la("Animation","AnimationStart"),transitionend:la("Transition","TransitionEnd")},bc={},Jf={};f&&(Jf=document.createElement("div").style,"AnimationEvent"in window||(delete Qr.animationend.animation,delete Qr.animationiteration.animation,delete Qr.animationstart.animation),"TransitionEvent"in window||delete Qr.transitionend.transition);function ca(t){if(bc[t])return bc[t];if(!Qr[t])return t;var s=Qr[t],i;for(i in s)if(s.hasOwnProperty(i)&&i in Jf)return bc[t]=s[i];return t}var ep=ca("animationend"),tp=ca("animationiteration"),np=ca("animationstart"),sp=ca("transitionend"),rp=new Map,op="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function qs(t,s){rp.set(t,s),c(s,[t])}for(var Nc=0;Nc<op.length;Nc++){var Tc=op[Nc],Vx=Tc.toLowerCase(),Kx=Tc[0].toUpperCase()+Tc.slice(1);qs(Vx,"on"+Kx)}qs(ep,"onAnimationEnd"),qs(tp,"onAnimationIteration"),qs(np,"onAnimationStart"),qs("dblclick","onDoubleClick"),qs("focusin","onFocus"),qs("focusout","onBlur"),qs(sp,"onTransitionEnd"),d("onMouseEnter",["mouseout","mouseover"]),d("onMouseLeave",["mouseout","mouseover"]),d("onPointerEnter",["pointerout","pointerover"]),d("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Yo="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Gx=new Set("cancel close invalid load scroll toggle".split(" ").concat(Yo));function ip(t,s,i){var u=t.type||"unknown-event";t.currentTarget=i,$n(u,s,void 0,t),t.currentTarget=null}function ap(t,s){s=(s&4)!==0;for(var i=0;i<t.length;i++){var u=t[i],p=u.event;u=u.listeners;e:{var m=void 0;if(s)for(var w=u.length-1;0<=w;w--){var j=u[w],D=j.instance,K=j.currentTarget;if(j=j.listener,D!==m&&p.isPropagationStopped())break e;ip(p,j,K),m=D}else for(w=0;w<u.length;w++){if(j=u[w],D=j.instance,K=j.currentTarget,j=j.listener,D!==m&&p.isPropagationStopped())break e;ip(p,j,K),m=D}}}if($e)throw t=qe,$e=!1,qe=null,t}function pt(t,s){var i=s[Dc];i===void 0&&(i=s[Dc]=new Set);var u=t+"__bubble";i.has(u)||(lp(s,t,2,!1),i.add(u))}function Cc(t,s,i){var u=0;s&&(u|=4),lp(i,t,u,s)}var ua="_reactListening"+Math.random().toString(36).slice(2);function Qo(t){if(!t[ua]){t[ua]=!0,o.forEach(function(i){i!=="selectionchange"&&(Gx.has(i)||Cc(i,!1,t),Cc(i,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[ua]||(s[ua]=!0,Cc("selectionchange",!1,s))}}function lp(t,s,i,u){switch(Af(s)){case 1:var p=ax;break;case 4:p=lx;break;default:p=cc}i=p.bind(null,s,i,t),p=void 0,!$t||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(p=!0),u?p!==void 0?t.addEventListener(s,i,{capture:!0,passive:p}):t.addEventListener(s,i,!0):p!==void 0?t.addEventListener(s,i,{passive:p}):t.addEventListener(s,i,!1)}function Ec(t,s,i,u,p){var m=u;if((s&1)===0&&(s&2)===0&&u!==null)e:for(;;){if(u===null)return;var w=u.tag;if(w===3||w===4){var j=u.stateNode.containerInfo;if(j===p||j.nodeType===8&&j.parentNode===p)break;if(w===4)for(w=u.return;w!==null;){var D=w.tag;if((D===3||D===4)&&(D=w.stateNode.containerInfo,D===p||D.nodeType===8&&D.parentNode===p))return;w=w.return}for(;j!==null;){if(w=Tr(j),w===null)return;if(D=w.tag,D===5||D===6){u=m=w;continue e}j=j.parentNode}}u=u.return}qt(function(){var K=m,se=ln(i),oe=[];e:{var ne=rp.get(t);if(ne!==void 0){var xe=fc,be=t;switch(t){case"keypress":if(ra(i)===0)break e;case"keydown":case"keyup":xe=bx;break;case"focusin":be="focus",xe=mc;break;case"focusout":be="blur",xe=mc;break;case"beforeblur":case"afterblur":xe=mc;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":xe=Mf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":xe=dx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":xe=Cx;break;case ep:case tp:case np:xe=hx;break;case sp:xe=jx;break;case"scroll":xe=cx;break;case"wheel":xe=Rx;break;case"copy":case"cut":case"paste":xe=gx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":xe=Of}var Ce=(s&4)!==0,Mt=!Ce&&t==="scroll",W=Ce?ne!==null?ne+"Capture":null:ne;Ce=[];for(var L=K,V;L!==null;){V=L;var fe=V.stateNode;if(V.tag===5&&fe!==null&&(V=fe,W!==null&&(fe=it(L,W),fe!=null&&Ce.push(Zo(L,fe,V)))),Mt)break;L=L.return}0<Ce.length&&(ne=new xe(ne,be,null,i,se),oe.push({event:ne,listeners:Ce}))}}if((s&7)===0){e:{if(ne=t==="mouseover"||t==="pointerover",xe=t==="mouseout"||t==="pointerout",ne&&i!==gn&&(be=i.relatedTarget||i.fromElement)&&(Tr(be)||be[Rs]))break e;if((xe||ne)&&(ne=se.window===se?se:(ne=se.ownerDocument)?ne.defaultView||ne.parentWindow:window,xe?(be=i.relatedTarget||i.toElement,xe=K,be=be?Tr(be):null,be!==null&&(Mt=We(be),be!==Mt||be.tag!==5&&be.tag!==6)&&(be=null)):(xe=null,be=K),xe!==be)){if(Ce=Mf,fe="onMouseLeave",W="onMouseEnter",L="mouse",(t==="pointerout"||t==="pointerover")&&(Ce=Of,fe="onPointerLeave",W="onPointerEnter",L="pointer"),Mt=xe==null?ne:eo(xe),V=be==null?ne:eo(be),ne=new Ce(fe,L+"leave",xe,i,se),ne.target=Mt,ne.relatedTarget=V,fe=null,Tr(se)===K&&(Ce=new Ce(W,L+"enter",be,i,se),Ce.target=V,Ce.relatedTarget=Mt,fe=Ce),Mt=fe,xe&&be)t:{for(Ce=xe,W=be,L=0,V=Ce;V;V=Zr(V))L++;for(V=0,fe=W;fe;fe=Zr(fe))V++;for(;0<L-V;)Ce=Zr(Ce),L--;for(;0<V-L;)W=Zr(W),V--;for(;L--;){if(Ce===W||W!==null&&Ce===W.alternate)break t;Ce=Zr(Ce),W=Zr(W)}Ce=null}else Ce=null;xe!==null&&cp(oe,ne,xe,Ce,!1),be!==null&&Mt!==null&&cp(oe,Mt,be,Ce,!0)}}e:{if(ne=K?eo(K):window,xe=ne.nodeName&&ne.nodeName.toLowerCase(),xe==="select"||xe==="input"&&ne.type==="file")var Ee=$x;else if(Bf(ne))if(Hf)Ee=Ux;else{Ee=zx;var Le=Px}else(xe=ne.nodeName)&&xe.toLowerCase()==="input"&&(ne.type==="checkbox"||ne.type==="radio")&&(Ee=Fx);if(Ee&&(Ee=Ee(t,K))){Wf(oe,Ee,i,se);break e}Le&&Le(t,ne,K),t==="focusout"&&(Le=ne._wrapperState)&&Le.controlled&&ne.type==="number"&&St(ne,"number",ne.value)}switch(Le=K?eo(K):window,t){case"focusin":(Bf(Le)||Le.contentEditable==="true")&&(Yr=Le,kc=K,Xo=null);break;case"focusout":Xo=kc=Yr=null;break;case"mousedown":Sc=!0;break;case"contextmenu":case"mouseup":case"dragend":Sc=!1,Zf(oe,i,se);break;case"selectionchange":if(Hx)break;case"keydown":case"keyup":Zf(oe,i,se)}var Oe;if(vc)e:{switch(t){case"compositionstart":var ze="onCompositionStart";break e;case"compositionend":ze="onCompositionEnd";break e;case"compositionupdate":ze="onCompositionUpdate";break e}ze=void 0}else Xr?Ff(t,i)&&(ze="onCompositionEnd"):t==="keydown"&&i.keyCode===229&&(ze="onCompositionStart");ze&&($f&&i.locale!=="ko"&&(Xr||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&Xr&&(Oe=If()):(Gs=se,dc="value"in Gs?Gs.value:Gs.textContent,Xr=!0)),Le=da(K,ze),0<Le.length&&(ze=new Lf(ze,t,null,i,se),oe.push({event:ze,listeners:Le}),Oe?ze.data=Oe:(Oe=Uf(i),Oe!==null&&(ze.data=Oe)))),(Oe=Ix?Dx(t,i):Mx(t,i))&&(K=da(K,"onBeforeInput"),0<K.length&&(se=new Lf("onBeforeInput","beforeinput",null,i,se),oe.push({event:se,listeners:K}),se.data=Oe))}ap(oe,s)})}function Zo(t,s,i){return{instance:t,listener:s,currentTarget:i}}function da(t,s){for(var i=s+"Capture",u=[];t!==null;){var p=t,m=p.stateNode;p.tag===5&&m!==null&&(p=m,m=it(t,i),m!=null&&u.unshift(Zo(t,m,p)),m=it(t,s),m!=null&&u.push(Zo(t,m,p))),t=t.return}return u}function Zr(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function cp(t,s,i,u,p){for(var m=s._reactName,w=[];i!==null&&i!==u;){var j=i,D=j.alternate,K=j.stateNode;if(D!==null&&D===u)break;j.tag===5&&K!==null&&(j=K,p?(D=it(i,m),D!=null&&w.unshift(Zo(i,D,j))):p||(D=it(i,m),D!=null&&w.push(Zo(i,D,j)))),i=i.return}w.length!==0&&t.push({event:s,listeners:w})}var qx=/\r\n?/g,Xx=/\u0000|\uFFFD/g;function up(t){return(typeof t=="string"?t:""+t).replace(qx,`
|
|
39
|
+
`).replace(Xx,"")}function fa(t,s,i){if(s=up(s),up(t)!==s&&i)throw Error(r(425))}function pa(){}var jc=null,_c=null;function Rc(t,s){return t==="textarea"||t==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Ac=typeof setTimeout=="function"?setTimeout:void 0,Yx=typeof clearTimeout=="function"?clearTimeout:void 0,dp=typeof Promise=="function"?Promise:void 0,Qx=typeof queueMicrotask=="function"?queueMicrotask:typeof dp<"u"?function(t){return dp.resolve(null).then(t).catch(Zx)}:Ac;function Zx(t){setTimeout(function(){throw t})}function Ic(t,s){var i=s,u=0;do{var p=i.nextSibling;if(t.removeChild(i),p&&p.nodeType===8)if(i=p.data,i==="/$"){if(u===0){t.removeChild(p),Bo(s);return}u--}else i!=="$"&&i!=="$?"&&i!=="$!"||u++;i=p}while(i);Bo(s)}function Xs(t){for(;t!=null;t=t.nextSibling){var s=t.nodeType;if(s===1||s===3)break;if(s===8){if(s=t.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return t}function fp(t){t=t.previousSibling;for(var s=0;t;){if(t.nodeType===8){var i=t.data;if(i==="$"||i==="$!"||i==="$?"){if(s===0)return t;s--}else i==="/$"&&s++}t=t.previousSibling}return null}var Jr=Math.random().toString(36).slice(2),ws="__reactFiber$"+Jr,Jo="__reactProps$"+Jr,Rs="__reactContainer$"+Jr,Dc="__reactEvents$"+Jr,Jx="__reactListeners$"+Jr,ew="__reactHandles$"+Jr;function Tr(t){var s=t[ws];if(s)return s;for(var i=t.parentNode;i;){if(s=i[Rs]||i[ws]){if(i=s.alternate,s.child!==null||i!==null&&i.child!==null)for(t=fp(t);t!==null;){if(i=t[ws])return i;t=fp(t)}return s}t=i,i=t.parentNode}return null}function ei(t){return t=t[ws]||t[Rs],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function eo(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(r(33))}function ha(t){return t[Jo]||null}var Mc=[],to=-1;function Ys(t){return{current:t}}function ht(t){0>to||(t.current=Mc[to],Mc[to]=null,to--)}function ut(t,s){to++,Mc[to]=t.current,t.current=s}var Qs={},cn=Ys(Qs),En=Ys(!1),Cr=Qs;function no(t,s){var i=t.type.contextTypes;if(!i)return Qs;var u=t.stateNode;if(u&&u.__reactInternalMemoizedUnmaskedChildContext===s)return u.__reactInternalMemoizedMaskedChildContext;var p={},m;for(m in i)p[m]=s[m];return u&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=p),p}function jn(t){return t=t.childContextTypes,t!=null}function ma(){ht(En),ht(cn)}function pp(t,s,i){if(cn.current!==Qs)throw Error(r(168));ut(cn,s),ut(En,i)}function hp(t,s,i){var u=t.stateNode;if(s=s.childContextTypes,typeof u.getChildContext!="function")return i;u=u.getChildContext();for(var p in u)if(!(p in s))throw Error(r(108,Se(t)||"Unknown",p));return G({},i,u)}function ga(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Qs,Cr=cn.current,ut(cn,t),ut(En,En.current),!0}function mp(t,s,i){var u=t.stateNode;if(!u)throw Error(r(169));i?(t=hp(t,s,Cr),u.__reactInternalMemoizedMergedChildContext=t,ht(En),ht(cn),ut(cn,t)):ht(En),ut(En,i)}var As=null,va=!1,Lc=!1;function gp(t){As===null?As=[t]:As.push(t)}function tw(t){va=!0,gp(t)}function Zs(){if(!Lc&&As!==null){Lc=!0;var t=0,s=Xe;try{var i=As;for(Xe=1;t<i.length;t++){var u=i[t];do u=u(!0);while(u!==null)}As=null,va=!1}catch(p){throw As!==null&&(As=As.slice(t+1)),Je(Ws,Zs),p}finally{Xe=s,Lc=!1}}return null}var so=[],ro=0,ya=null,xa=0,Gn=[],qn=0,Er=null,Is=1,Ds="";function jr(t,s){so[ro++]=xa,so[ro++]=ya,ya=t,xa=s}function vp(t,s,i){Gn[qn++]=Is,Gn[qn++]=Ds,Gn[qn++]=Er,Er=t;var u=Is;t=Ds;var p=32-xn(u)-1;u&=~(1<<p),i+=1;var m=32-xn(s)+p;if(30<m){var w=p-p%5;m=(u&(1<<w)-1).toString(32),u>>=w,p-=w,Is=1<<32-xn(s)+p|i<<p|u,Ds=m+t}else Is=1<<m|i<<p|u,Ds=t}function Oc(t){t.return!==null&&(jr(t,1),vp(t,1,0))}function $c(t){for(;t===ya;)ya=so[--ro],so[ro]=null,xa=so[--ro],so[ro]=null;for(;t===Er;)Er=Gn[--qn],Gn[qn]=null,Ds=Gn[--qn],Gn[qn]=null,Is=Gn[--qn],Gn[qn]=null}var Un=null,Bn=null,wt=!1,rs=null;function yp(t,s){var i=Zn(5,null,null,0);i.elementType="DELETED",i.stateNode=s,i.return=t,s=t.deletions,s===null?(t.deletions=[i],t.flags|=16):s.push(i)}function xp(t,s){switch(t.tag){case 5:var i=t.type;return s=s.nodeType!==1||i.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(t.stateNode=s,Un=t,Bn=Xs(s.firstChild),!0):!1;case 6:return s=t.pendingProps===""||s.nodeType!==3?null:s,s!==null?(t.stateNode=s,Un=t,Bn=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(i=Er!==null?{id:Is,overflow:Ds}:null,t.memoizedState={dehydrated:s,treeContext:i,retryLane:1073741824},i=Zn(18,null,null,0),i.stateNode=s,i.return=t,t.child=i,Un=t,Bn=null,!0):!1;default:return!1}}function Pc(t){return(t.mode&1)!==0&&(t.flags&128)===0}function zc(t){if(wt){var s=Bn;if(s){var i=s;if(!xp(t,s)){if(Pc(t))throw Error(r(418));s=Xs(i.nextSibling);var u=Un;s&&xp(t,s)?yp(u,i):(t.flags=t.flags&-4097|2,wt=!1,Un=t)}}else{if(Pc(t))throw Error(r(418));t.flags=t.flags&-4097|2,wt=!1,Un=t}}}function wp(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Un=t}function wa(t){if(t!==Un)return!1;if(!wt)return wp(t),wt=!0,!1;var s;if((s=t.tag!==3)&&!(s=t.tag!==5)&&(s=t.type,s=s!=="head"&&s!=="body"&&!Rc(t.type,t.memoizedProps)),s&&(s=Bn)){if(Pc(t))throw kp(),Error(r(418));for(;s;)yp(t,s),s=Xs(s.nextSibling)}if(wp(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));e:{for(t=t.nextSibling,s=0;t;){if(t.nodeType===8){var i=t.data;if(i==="/$"){if(s===0){Bn=Xs(t.nextSibling);break e}s--}else i!=="$"&&i!=="$!"&&i!=="$?"||s++}t=t.nextSibling}Bn=null}}else Bn=Un?Xs(t.stateNode.nextSibling):null;return!0}function kp(){for(var t=Bn;t;)t=Xs(t.nextSibling)}function oo(){Bn=Un=null,wt=!1}function Fc(t){rs===null?rs=[t]:rs.push(t)}var nw=M.ReactCurrentBatchConfig;function ti(t,s,i){if(t=i.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(r(309));var u=i.stateNode}if(!u)throw Error(r(147,t));var p=u,m=""+t;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===m?s.ref:(s=function(w){var j=p.refs;w===null?delete j[m]:j[m]=w},s._stringRef=m,s)}if(typeof t!="string")throw Error(r(284));if(!i._owner)throw Error(r(290,t))}return t}function ka(t,s){throw t=Object.prototype.toString.call(s),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t))}function Sp(t){var s=t._init;return s(t._payload)}function bp(t){function s(W,L){if(t){var V=W.deletions;V===null?(W.deletions=[L],W.flags|=16):V.push(L)}}function i(W,L){if(!t)return null;for(;L!==null;)s(W,L),L=L.sibling;return null}function u(W,L){for(W=new Map;L!==null;)L.key!==null?W.set(L.key,L):W.set(L.index,L),L=L.sibling;return W}function p(W,L){return W=ir(W,L),W.index=0,W.sibling=null,W}function m(W,L,V){return W.index=V,t?(V=W.alternate,V!==null?(V=V.index,V<L?(W.flags|=2,L):V):(W.flags|=2,L)):(W.flags|=1048576,L)}function w(W){return t&&W.alternate===null&&(W.flags|=2),W}function j(W,L,V,fe){return L===null||L.tag!==6?(L=Au(V,W.mode,fe),L.return=W,L):(L=p(L,V),L.return=W,L)}function D(W,L,V,fe){var Ee=V.type;return Ee===U?se(W,L,V.props.children,fe,V.key):L!==null&&(L.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===re&&Sp(Ee)===L.type)?(fe=p(L,V.props),fe.ref=ti(W,L,V),fe.return=W,fe):(fe=Va(V.type,V.key,V.props,null,W.mode,fe),fe.ref=ti(W,L,V),fe.return=W,fe)}function K(W,L,V,fe){return L===null||L.tag!==4||L.stateNode.containerInfo!==V.containerInfo||L.stateNode.implementation!==V.implementation?(L=Iu(V,W.mode,fe),L.return=W,L):(L=p(L,V.children||[]),L.return=W,L)}function se(W,L,V,fe,Ee){return L===null||L.tag!==7?(L=Or(V,W.mode,fe,Ee),L.return=W,L):(L=p(L,V),L.return=W,L)}function oe(W,L,V){if(typeof L=="string"&&L!==""||typeof L=="number")return L=Au(""+L,W.mode,V),L.return=W,L;if(typeof L=="object"&&L!==null){switch(L.$$typeof){case O:return V=Va(L.type,L.key,L.props,null,W.mode,V),V.ref=ti(W,null,L),V.return=W,V;case X:return L=Iu(L,W.mode,V),L.return=W,L;case re:var fe=L._init;return oe(W,fe(L._payload),V)}if(jt(L)||Z(L))return L=Or(L,W.mode,V,null),L.return=W,L;ka(W,L)}return null}function ne(W,L,V,fe){var Ee=L!==null?L.key:null;if(typeof V=="string"&&V!==""||typeof V=="number")return Ee!==null?null:j(W,L,""+V,fe);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case O:return V.key===Ee?D(W,L,V,fe):null;case X:return V.key===Ee?K(W,L,V,fe):null;case re:return Ee=V._init,ne(W,L,Ee(V._payload),fe)}if(jt(V)||Z(V))return Ee!==null?null:se(W,L,V,fe,null);ka(W,V)}return null}function xe(W,L,V,fe,Ee){if(typeof fe=="string"&&fe!==""||typeof fe=="number")return W=W.get(V)||null,j(L,W,""+fe,Ee);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case O:return W=W.get(fe.key===null?V:fe.key)||null,D(L,W,fe,Ee);case X:return W=W.get(fe.key===null?V:fe.key)||null,K(L,W,fe,Ee);case re:var Le=fe._init;return xe(W,L,V,Le(fe._payload),Ee)}if(jt(fe)||Z(fe))return W=W.get(V)||null,se(L,W,fe,Ee,null);ka(L,fe)}return null}function be(W,L,V,fe){for(var Ee=null,Le=null,Oe=L,ze=L=0,Qt=null;Oe!==null&&ze<V.length;ze++){Oe.index>ze?(Qt=Oe,Oe=null):Qt=Oe.sibling;var tt=ne(W,Oe,V[ze],fe);if(tt===null){Oe===null&&(Oe=Qt);break}t&&Oe&&tt.alternate===null&&s(W,Oe),L=m(tt,L,ze),Le===null?Ee=tt:Le.sibling=tt,Le=tt,Oe=Qt}if(ze===V.length)return i(W,Oe),wt&&jr(W,ze),Ee;if(Oe===null){for(;ze<V.length;ze++)Oe=oe(W,V[ze],fe),Oe!==null&&(L=m(Oe,L,ze),Le===null?Ee=Oe:Le.sibling=Oe,Le=Oe);return wt&&jr(W,ze),Ee}for(Oe=u(W,Oe);ze<V.length;ze++)Qt=xe(Oe,W,ze,V[ze],fe),Qt!==null&&(t&&Qt.alternate!==null&&Oe.delete(Qt.key===null?ze:Qt.key),L=m(Qt,L,ze),Le===null?Ee=Qt:Le.sibling=Qt,Le=Qt);return t&&Oe.forEach(function(ar){return s(W,ar)}),wt&&jr(W,ze),Ee}function Ce(W,L,V,fe){var Ee=Z(V);if(typeof Ee!="function")throw Error(r(150));if(V=Ee.call(V),V==null)throw Error(r(151));for(var Le=Ee=null,Oe=L,ze=L=0,Qt=null,tt=V.next();Oe!==null&&!tt.done;ze++,tt=V.next()){Oe.index>ze?(Qt=Oe,Oe=null):Qt=Oe.sibling;var ar=ne(W,Oe,tt.value,fe);if(ar===null){Oe===null&&(Oe=Qt);break}t&&Oe&&ar.alternate===null&&s(W,Oe),L=m(ar,L,ze),Le===null?Ee=ar:Le.sibling=ar,Le=ar,Oe=Qt}if(tt.done)return i(W,Oe),wt&&jr(W,ze),Ee;if(Oe===null){for(;!tt.done;ze++,tt=V.next())tt=oe(W,tt.value,fe),tt!==null&&(L=m(tt,L,ze),Le===null?Ee=tt:Le.sibling=tt,Le=tt);return wt&&jr(W,ze),Ee}for(Oe=u(W,Oe);!tt.done;ze++,tt=V.next())tt=xe(Oe,W,ze,tt.value,fe),tt!==null&&(t&&tt.alternate!==null&&Oe.delete(tt.key===null?ze:tt.key),L=m(tt,L,ze),Le===null?Ee=tt:Le.sibling=tt,Le=tt);return t&&Oe.forEach(function(Lw){return s(W,Lw)}),wt&&jr(W,ze),Ee}function Mt(W,L,V,fe){if(typeof V=="object"&&V!==null&&V.type===U&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case O:e:{for(var Ee=V.key,Le=L;Le!==null;){if(Le.key===Ee){if(Ee=V.type,Ee===U){if(Le.tag===7){i(W,Le.sibling),L=p(Le,V.props.children),L.return=W,W=L;break e}}else if(Le.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===re&&Sp(Ee)===Le.type){i(W,Le.sibling),L=p(Le,V.props),L.ref=ti(W,Le,V),L.return=W,W=L;break e}i(W,Le);break}else s(W,Le);Le=Le.sibling}V.type===U?(L=Or(V.props.children,W.mode,fe,V.key),L.return=W,W=L):(fe=Va(V.type,V.key,V.props,null,W.mode,fe),fe.ref=ti(W,L,V),fe.return=W,W=fe)}return w(W);case X:e:{for(Le=V.key;L!==null;){if(L.key===Le)if(L.tag===4&&L.stateNode.containerInfo===V.containerInfo&&L.stateNode.implementation===V.implementation){i(W,L.sibling),L=p(L,V.children||[]),L.return=W,W=L;break e}else{i(W,L);break}else s(W,L);L=L.sibling}L=Iu(V,W.mode,fe),L.return=W,W=L}return w(W);case re:return Le=V._init,Mt(W,L,Le(V._payload),fe)}if(jt(V))return be(W,L,V,fe);if(Z(V))return Ce(W,L,V,fe);ka(W,V)}return typeof V=="string"&&V!==""||typeof V=="number"?(V=""+V,L!==null&&L.tag===6?(i(W,L.sibling),L=p(L,V),L.return=W,W=L):(i(W,L),L=Au(V,W.mode,fe),L.return=W,W=L),w(W)):i(W,L)}return Mt}var io=bp(!0),Np=bp(!1),Sa=Ys(null),ba=null,ao=null,Uc=null;function Bc(){Uc=ao=ba=null}function Wc(t){var s=Sa.current;ht(Sa),t._currentValue=s}function Hc(t,s,i){for(;t!==null;){var u=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,u!==null&&(u.childLanes|=s)):u!==null&&(u.childLanes&s)!==s&&(u.childLanes|=s),t===i)break;t=t.return}}function lo(t,s){ba=t,Uc=ao=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&s)!==0&&(_n=!0),t.firstContext=null)}function Xn(t){var s=t._currentValue;if(Uc!==t)if(t={context:t,memoizedValue:s,next:null},ao===null){if(ba===null)throw Error(r(308));ao=t,ba.dependencies={lanes:0,firstContext:t}}else ao=ao.next=t;return s}var _r=null;function Vc(t){_r===null?_r=[t]:_r.push(t)}function Tp(t,s,i,u){var p=s.interleaved;return p===null?(i.next=i,Vc(s)):(i.next=p.next,p.next=i),s.interleaved=i,Ms(t,u)}function Ms(t,s){t.lanes|=s;var i=t.alternate;for(i!==null&&(i.lanes|=s),i=t,t=t.return;t!==null;)t.childLanes|=s,i=t.alternate,i!==null&&(i.childLanes|=s),i=t,t=t.return;return i.tag===3?i.stateNode:null}var Js=!1;function Kc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Cp(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Ls(t,s){return{eventTime:t,lane:s,tag:0,payload:null,callback:null,next:null}}function er(t,s,i){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(Qe&2)!==0){var p=u.pending;return p===null?s.next=s:(s.next=p.next,p.next=s),u.pending=s,Ms(t,i)}return p=u.interleaved,p===null?(s.next=s,Vc(u)):(s.next=p.next,p.next=s),u.interleaved=s,Ms(t,i)}function Na(t,s,i){if(s=s.updateQueue,s!==null&&(s=s.shared,(i&4194240)!==0)){var u=s.lanes;u&=t.pendingLanes,i|=u,s.lanes=i,Vs(t,i)}}function Ep(t,s){var i=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var p=null,m=null;if(i=i.firstBaseUpdate,i!==null){do{var w={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};m===null?p=m=w:m=m.next=w,i=i.next}while(i!==null);m===null?p=m=s:m=m.next=s}else p=m=s;i={baseState:u.baseState,firstBaseUpdate:p,lastBaseUpdate:m,shared:u.shared,effects:u.effects},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=s:t.next=s,i.lastBaseUpdate=s}function Ta(t,s,i,u){var p=t.updateQueue;Js=!1;var m=p.firstBaseUpdate,w=p.lastBaseUpdate,j=p.shared.pending;if(j!==null){p.shared.pending=null;var D=j,K=D.next;D.next=null,w===null?m=K:w.next=K,w=D;var se=t.alternate;se!==null&&(se=se.updateQueue,j=se.lastBaseUpdate,j!==w&&(j===null?se.firstBaseUpdate=K:j.next=K,se.lastBaseUpdate=D))}if(m!==null){var oe=p.baseState;w=0,se=K=D=null,j=m;do{var ne=j.lane,xe=j.eventTime;if((u&ne)===ne){se!==null&&(se=se.next={eventTime:xe,lane:0,tag:j.tag,payload:j.payload,callback:j.callback,next:null});e:{var be=t,Ce=j;switch(ne=s,xe=i,Ce.tag){case 1:if(be=Ce.payload,typeof be=="function"){oe=be.call(xe,oe,ne);break e}oe=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Ce.payload,ne=typeof be=="function"?be.call(xe,oe,ne):be,ne==null)break e;oe=G({},oe,ne);break e;case 2:Js=!0}}j.callback!==null&&j.lane!==0&&(t.flags|=64,ne=p.effects,ne===null?p.effects=[j]:ne.push(j))}else xe={eventTime:xe,lane:ne,tag:j.tag,payload:j.payload,callback:j.callback,next:null},se===null?(K=se=xe,D=oe):se=se.next=xe,w|=ne;if(j=j.next,j===null){if(j=p.shared.pending,j===null)break;ne=j,j=ne.next,ne.next=null,p.lastBaseUpdate=ne,p.shared.pending=null}}while(!0);if(se===null&&(D=oe),p.baseState=D,p.firstBaseUpdate=K,p.lastBaseUpdate=se,s=p.shared.interleaved,s!==null){p=s;do w|=p.lane,p=p.next;while(p!==s)}else m===null&&(p.shared.lanes=0);Ir|=w,t.lanes=w,t.memoizedState=oe}}function jp(t,s,i){if(t=s.effects,s.effects=null,t!==null)for(s=0;s<t.length;s++){var u=t[s],p=u.callback;if(p!==null){if(u.callback=null,u=i,typeof p!="function")throw Error(r(191,p));p.call(u)}}}var ni={},ks=Ys(ni),si=Ys(ni),ri=Ys(ni);function Rr(t){if(t===ni)throw Error(r(174));return t}function Gc(t,s){switch(ut(ri,s),ut(si,t),ut(ks,ni),t=s.nodeType,t){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:gt(null,"");break;default:t=t===8?s.parentNode:s,s=t.namespaceURI||null,t=t.tagName,s=gt(s,t)}ht(ks),ut(ks,s)}function co(){ht(ks),ht(si),ht(ri)}function _p(t){Rr(ri.current);var s=Rr(ks.current),i=gt(s,t.type);s!==i&&(ut(si,t),ut(ks,i))}function qc(t){si.current===t&&(ht(ks),ht(si))}var Ct=Ys(0);function Ca(t){for(var s=t;s!==null;){if(s.tag===13){var i=s.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Xc=[];function Yc(){for(var t=0;t<Xc.length;t++)Xc[t]._workInProgressVersionPrimary=null;Xc.length=0}var Ea=M.ReactCurrentDispatcher,Qc=M.ReactCurrentBatchConfig,Ar=0,Et=null,Bt=null,Xt=null,ja=!1,oi=!1,ii=0,sw=0;function un(){throw Error(r(321))}function Zc(t,s){if(s===null)return!1;for(var i=0;i<s.length&&i<t.length;i++)if(!ss(t[i],s[i]))return!1;return!0}function Jc(t,s,i,u,p,m){if(Ar=m,Et=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,Ea.current=t===null||t.memoizedState===null?aw:lw,t=i(u,p),oi){m=0;do{if(oi=!1,ii=0,25<=m)throw Error(r(301));m+=1,Xt=Bt=null,s.updateQueue=null,Ea.current=cw,t=i(u,p)}while(oi)}if(Ea.current=Aa,s=Bt!==null&&Bt.next!==null,Ar=0,Xt=Bt=Et=null,ja=!1,s)throw Error(r(300));return t}function eu(){var t=ii!==0;return ii=0,t}function Ss(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Xt===null?Et.memoizedState=Xt=t:Xt=Xt.next=t,Xt}function Yn(){if(Bt===null){var t=Et.alternate;t=t!==null?t.memoizedState:null}else t=Bt.next;var s=Xt===null?Et.memoizedState:Xt.next;if(s!==null)Xt=s,Bt=t;else{if(t===null)throw Error(r(310));Bt=t,t={memoizedState:Bt.memoizedState,baseState:Bt.baseState,baseQueue:Bt.baseQueue,queue:Bt.queue,next:null},Xt===null?Et.memoizedState=Xt=t:Xt=Xt.next=t}return Xt}function ai(t,s){return typeof s=="function"?s(t):s}function tu(t){var s=Yn(),i=s.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=t;var u=Bt,p=u.baseQueue,m=i.pending;if(m!==null){if(p!==null){var w=p.next;p.next=m.next,m.next=w}u.baseQueue=p=m,i.pending=null}if(p!==null){m=p.next,u=u.baseState;var j=w=null,D=null,K=m;do{var se=K.lane;if((Ar&se)===se)D!==null&&(D=D.next={lane:0,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),u=K.hasEagerState?K.eagerState:t(u,K.action);else{var oe={lane:se,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null};D===null?(j=D=oe,w=u):D=D.next=oe,Et.lanes|=se,Ir|=se}K=K.next}while(K!==null&&K!==m);D===null?w=u:D.next=j,ss(u,s.memoizedState)||(_n=!0),s.memoizedState=u,s.baseState=w,s.baseQueue=D,i.lastRenderedState=u}if(t=i.interleaved,t!==null){p=t;do m=p.lane,Et.lanes|=m,Ir|=m,p=p.next;while(p!==t)}else p===null&&(i.lanes=0);return[s.memoizedState,i.dispatch]}function nu(t){var s=Yn(),i=s.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=t;var u=i.dispatch,p=i.pending,m=s.memoizedState;if(p!==null){i.pending=null;var w=p=p.next;do m=t(m,w.action),w=w.next;while(w!==p);ss(m,s.memoizedState)||(_n=!0),s.memoizedState=m,s.baseQueue===null&&(s.baseState=m),i.lastRenderedState=m}return[m,u]}function Rp(){}function Ap(t,s){var i=Et,u=Yn(),p=s(),m=!ss(u.memoizedState,p);if(m&&(u.memoizedState=p,_n=!0),u=u.queue,su(Mp.bind(null,i,u,t),[t]),u.getSnapshot!==s||m||Xt!==null&&Xt.memoizedState.tag&1){if(i.flags|=2048,li(9,Dp.bind(null,i,u,p,s),void 0,null),Yt===null)throw Error(r(349));(Ar&30)!==0||Ip(i,s,p)}return p}function Ip(t,s,i){t.flags|=16384,t={getSnapshot:s,value:i},s=Et.updateQueue,s===null?(s={lastEffect:null,stores:null},Et.updateQueue=s,s.stores=[t]):(i=s.stores,i===null?s.stores=[t]:i.push(t))}function Dp(t,s,i,u){s.value=i,s.getSnapshot=u,Lp(s)&&Op(t)}function Mp(t,s,i){return i(function(){Lp(s)&&Op(t)})}function Lp(t){var s=t.getSnapshot;t=t.value;try{var i=s();return!ss(t,i)}catch{return!0}}function Op(t){var s=Ms(t,1);s!==null&&ls(s,t,1,-1)}function $p(t){var s=Ss();return typeof t=="function"&&(t=t()),s.memoizedState=s.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ai,lastRenderedState:t},s.queue=t,t=t.dispatch=iw.bind(null,Et,t),[s.memoizedState,t]}function li(t,s,i,u){return t={tag:t,create:s,destroy:i,deps:u,next:null},s=Et.updateQueue,s===null?(s={lastEffect:null,stores:null},Et.updateQueue=s,s.lastEffect=t.next=t):(i=s.lastEffect,i===null?s.lastEffect=t.next=t:(u=i.next,i.next=t,t.next=u,s.lastEffect=t)),t}function Pp(){return Yn().memoizedState}function _a(t,s,i,u){var p=Ss();Et.flags|=t,p.memoizedState=li(1|s,i,void 0,u===void 0?null:u)}function Ra(t,s,i,u){var p=Yn();u=u===void 0?null:u;var m=void 0;if(Bt!==null){var w=Bt.memoizedState;if(m=w.destroy,u!==null&&Zc(u,w.deps)){p.memoizedState=li(s,i,m,u);return}}Et.flags|=t,p.memoizedState=li(1|s,i,m,u)}function zp(t,s){return _a(8390656,8,t,s)}function su(t,s){return Ra(2048,8,t,s)}function Fp(t,s){return Ra(4,2,t,s)}function Up(t,s){return Ra(4,4,t,s)}function Bp(t,s){if(typeof s=="function")return t=t(),s(t),function(){s(null)};if(s!=null)return t=t(),s.current=t,function(){s.current=null}}function Wp(t,s,i){return i=i!=null?i.concat([t]):null,Ra(4,4,Bp.bind(null,s,t),i)}function ru(){}function Hp(t,s){var i=Yn();s=s===void 0?null:s;var u=i.memoizedState;return u!==null&&s!==null&&Zc(s,u[1])?u[0]:(i.memoizedState=[t,s],t)}function Vp(t,s){var i=Yn();s=s===void 0?null:s;var u=i.memoizedState;return u!==null&&s!==null&&Zc(s,u[1])?u[0]:(t=t(),i.memoizedState=[t,s],t)}function Kp(t,s,i){return(Ar&21)===0?(t.baseState&&(t.baseState=!1,_n=!0),t.memoizedState=i):(ss(i,s)||(i=Po(),Et.lanes|=i,Ir|=i,t.baseState=!0),s)}function rw(t,s){var i=Xe;Xe=i!==0&&4>i?i:4,t(!0);var u=Qc.transition;Qc.transition={};try{t(!1),s()}finally{Xe=i,Qc.transition=u}}function Gp(){return Yn().memoizedState}function ow(t,s,i){var u=rr(t);if(i={lane:u,action:i,hasEagerState:!1,eagerState:null,next:null},qp(t))Xp(s,i);else if(i=Tp(t,s,i,u),i!==null){var p=Sn();ls(i,t,u,p),Yp(i,s,u)}}function iw(t,s,i){var u=rr(t),p={lane:u,action:i,hasEagerState:!1,eagerState:null,next:null};if(qp(t))Xp(s,p);else{var m=t.alternate;if(t.lanes===0&&(m===null||m.lanes===0)&&(m=s.lastRenderedReducer,m!==null))try{var w=s.lastRenderedState,j=m(w,i);if(p.hasEagerState=!0,p.eagerState=j,ss(j,w)){var D=s.interleaved;D===null?(p.next=p,Vc(s)):(p.next=D.next,D.next=p),s.interleaved=p;return}}catch{}finally{}i=Tp(t,s,p,u),i!==null&&(p=Sn(),ls(i,t,u,p),Yp(i,s,u))}}function qp(t){var s=t.alternate;return t===Et||s!==null&&s===Et}function Xp(t,s){oi=ja=!0;var i=t.pending;i===null?s.next=s:(s.next=i.next,i.next=s),t.pending=s}function Yp(t,s,i){if((i&4194240)!==0){var u=s.lanes;u&=t.pendingLanes,i|=u,s.lanes=i,Vs(t,i)}}var Aa={readContext:Xn,useCallback:un,useContext:un,useEffect:un,useImperativeHandle:un,useInsertionEffect:un,useLayoutEffect:un,useMemo:un,useReducer:un,useRef:un,useState:un,useDebugValue:un,useDeferredValue:un,useTransition:un,useMutableSource:un,useSyncExternalStore:un,useId:un,unstable_isNewReconciler:!1},aw={readContext:Xn,useCallback:function(t,s){return Ss().memoizedState=[t,s===void 0?null:s],t},useContext:Xn,useEffect:zp,useImperativeHandle:function(t,s,i){return i=i!=null?i.concat([t]):null,_a(4194308,4,Bp.bind(null,s,t),i)},useLayoutEffect:function(t,s){return _a(4194308,4,t,s)},useInsertionEffect:function(t,s){return _a(4,2,t,s)},useMemo:function(t,s){var i=Ss();return s=s===void 0?null:s,t=t(),i.memoizedState=[t,s],t},useReducer:function(t,s,i){var u=Ss();return s=i!==void 0?i(s):s,u.memoizedState=u.baseState=s,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:s},u.queue=t,t=t.dispatch=ow.bind(null,Et,t),[u.memoizedState,t]},useRef:function(t){var s=Ss();return t={current:t},s.memoizedState=t},useState:$p,useDebugValue:ru,useDeferredValue:function(t){return Ss().memoizedState=t},useTransition:function(){var t=$p(!1),s=t[0];return t=rw.bind(null,t[1]),Ss().memoizedState=t,[s,t]},useMutableSource:function(){},useSyncExternalStore:function(t,s,i){var u=Et,p=Ss();if(wt){if(i===void 0)throw Error(r(407));i=i()}else{if(i=s(),Yt===null)throw Error(r(349));(Ar&30)!==0||Ip(u,s,i)}p.memoizedState=i;var m={value:i,getSnapshot:s};return p.queue=m,zp(Mp.bind(null,u,m,t),[t]),u.flags|=2048,li(9,Dp.bind(null,u,m,i,s),void 0,null),i},useId:function(){var t=Ss(),s=Yt.identifierPrefix;if(wt){var i=Ds,u=Is;i=(u&~(1<<32-xn(u)-1)).toString(32)+i,s=":"+s+"R"+i,i=ii++,0<i&&(s+="H"+i.toString(32)),s+=":"}else i=sw++,s=":"+s+"r"+i.toString(32)+":";return t.memoizedState=s},unstable_isNewReconciler:!1},lw={readContext:Xn,useCallback:Hp,useContext:Xn,useEffect:su,useImperativeHandle:Wp,useInsertionEffect:Fp,useLayoutEffect:Up,useMemo:Vp,useReducer:tu,useRef:Pp,useState:function(){return tu(ai)},useDebugValue:ru,useDeferredValue:function(t){var s=Yn();return Kp(s,Bt.memoizedState,t)},useTransition:function(){var t=tu(ai)[0],s=Yn().memoizedState;return[t,s]},useMutableSource:Rp,useSyncExternalStore:Ap,useId:Gp,unstable_isNewReconciler:!1},cw={readContext:Xn,useCallback:Hp,useContext:Xn,useEffect:su,useImperativeHandle:Wp,useInsertionEffect:Fp,useLayoutEffect:Up,useMemo:Vp,useReducer:nu,useRef:Pp,useState:function(){return nu(ai)},useDebugValue:ru,useDeferredValue:function(t){var s=Yn();return Bt===null?s.memoizedState=t:Kp(s,Bt.memoizedState,t)},useTransition:function(){var t=nu(ai)[0],s=Yn().memoizedState;return[t,s]},useMutableSource:Rp,useSyncExternalStore:Ap,useId:Gp,unstable_isNewReconciler:!1};function os(t,s){if(t&&t.defaultProps){s=G({},s),t=t.defaultProps;for(var i in t)s[i]===void 0&&(s[i]=t[i]);return s}return s}function ou(t,s,i,u){s=t.memoizedState,i=i(u,s),i=i==null?s:G({},s,i),t.memoizedState=i,t.lanes===0&&(t.updateQueue.baseState=i)}var Ia={isMounted:function(t){return(t=t._reactInternals)?We(t)===t:!1},enqueueSetState:function(t,s,i){t=t._reactInternals;var u=Sn(),p=rr(t),m=Ls(u,p);m.payload=s,i!=null&&(m.callback=i),s=er(t,m,p),s!==null&&(ls(s,t,p,u),Na(s,t,p))},enqueueReplaceState:function(t,s,i){t=t._reactInternals;var u=Sn(),p=rr(t),m=Ls(u,p);m.tag=1,m.payload=s,i!=null&&(m.callback=i),s=er(t,m,p),s!==null&&(ls(s,t,p,u),Na(s,t,p))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var i=Sn(),u=rr(t),p=Ls(i,u);p.tag=2,s!=null&&(p.callback=s),s=er(t,p,u),s!==null&&(ls(s,t,u,i),Na(s,t,u))}};function Qp(t,s,i,u,p,m,w){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,m,w):s.prototype&&s.prototype.isPureReactComponent?!qo(i,u)||!qo(p,m):!0}function Zp(t,s,i){var u=!1,p=Qs,m=s.contextType;return typeof m=="object"&&m!==null?m=Xn(m):(p=jn(s)?Cr:cn.current,u=s.contextTypes,m=(u=u!=null)?no(t,p):Qs),s=new s(i,m),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Ia,t.stateNode=s,s._reactInternals=t,u&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=p,t.__reactInternalMemoizedMaskedChildContext=m),s}function Jp(t,s,i,u){t=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(i,u),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(i,u),s.state!==t&&Ia.enqueueReplaceState(s,s.state,null)}function iu(t,s,i,u){var p=t.stateNode;p.props=i,p.state=t.memoizedState,p.refs={},Kc(t);var m=s.contextType;typeof m=="object"&&m!==null?p.context=Xn(m):(m=jn(s)?Cr:cn.current,p.context=no(t,m)),p.state=t.memoizedState,m=s.getDerivedStateFromProps,typeof m=="function"&&(ou(t,s,m,i),p.state=t.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(s=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),s!==p.state&&Ia.enqueueReplaceState(p,p.state,null),Ta(t,i,p,u),p.state=t.memoizedState),typeof p.componentDidMount=="function"&&(t.flags|=4194308)}function uo(t,s){try{var i="",u=s;do i+=q(u),u=u.return;while(u);var p=i}catch(m){p=`
|
|
40
|
+
Error generating stack: `+m.message+`
|
|
41
|
+
`+m.stack}return{value:t,source:s,stack:p,digest:null}}function au(t,s,i){return{value:t,source:null,stack:i??null,digest:s??null}}function lu(t,s){try{console.error(s.value)}catch(i){setTimeout(function(){throw i})}}var uw=typeof WeakMap=="function"?WeakMap:Map;function eh(t,s,i){i=Ls(-1,i),i.tag=3,i.payload={element:null};var u=s.value;return i.callback=function(){za||(za=!0,bu=u),lu(t,s)},i}function th(t,s,i){i=Ls(-1,i),i.tag=3;var u=t.type.getDerivedStateFromError;if(typeof u=="function"){var p=s.value;i.payload=function(){return u(p)},i.callback=function(){lu(t,s)}}var m=t.stateNode;return m!==null&&typeof m.componentDidCatch=="function"&&(i.callback=function(){lu(t,s),typeof u!="function"&&(nr===null?nr=new Set([this]):nr.add(this));var w=s.stack;this.componentDidCatch(s.value,{componentStack:w!==null?w:""})}),i}function nh(t,s,i){var u=t.pingCache;if(u===null){u=t.pingCache=new uw;var p=new Set;u.set(s,p)}else p=u.get(s),p===void 0&&(p=new Set,u.set(s,p));p.has(i)||(p.add(i),t=Nw.bind(null,t,s,i),s.then(t,t))}function sh(t){do{var s;if((s=t.tag===13)&&(s=t.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return t;t=t.return}while(t!==null);return null}function rh(t,s,i,u,p){return(t.mode&1)===0?(t===s?t.flags|=65536:(t.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(s=Ls(-1,1),s.tag=2,er(i,s,1))),i.lanes|=1),t):(t.flags|=65536,t.lanes=p,t)}var dw=M.ReactCurrentOwner,_n=!1;function kn(t,s,i,u){s.child=t===null?Np(s,null,i,u):io(s,t.child,i,u)}function oh(t,s,i,u,p){i=i.render;var m=s.ref;return lo(s,p),u=Jc(t,s,i,u,m,p),i=eu(),t!==null&&!_n?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~p,Os(t,s,p)):(wt&&i&&Oc(s),s.flags|=1,kn(t,s,u,p),s.child)}function ih(t,s,i,u,p){if(t===null){var m=i.type;return typeof m=="function"&&!Ru(m)&&m.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(s.tag=15,s.type=m,ah(t,s,m,u,p)):(t=Va(i.type,null,u,s,s.mode,p),t.ref=s.ref,t.return=s,s.child=t)}if(m=t.child,(t.lanes&p)===0){var w=m.memoizedProps;if(i=i.compare,i=i!==null?i:qo,i(w,u)&&t.ref===s.ref)return Os(t,s,p)}return s.flags|=1,t=ir(m,u),t.ref=s.ref,t.return=s,s.child=t}function ah(t,s,i,u,p){if(t!==null){var m=t.memoizedProps;if(qo(m,u)&&t.ref===s.ref)if(_n=!1,s.pendingProps=u=m,(t.lanes&p)!==0)(t.flags&131072)!==0&&(_n=!0);else return s.lanes=t.lanes,Os(t,s,p)}return cu(t,s,i,u,p)}function lh(t,s,i){var u=s.pendingProps,p=u.children,m=t!==null?t.memoizedState:null;if(u.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},ut(po,Wn),Wn|=i;else{if((i&1073741824)===0)return t=m!==null?m.baseLanes|i:i,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:t,cachePool:null,transitions:null},s.updateQueue=null,ut(po,Wn),Wn|=t,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},u=m!==null?m.baseLanes:i,ut(po,Wn),Wn|=u}else m!==null?(u=m.baseLanes|i,s.memoizedState=null):u=i,ut(po,Wn),Wn|=u;return kn(t,s,p,i),s.child}function ch(t,s){var i=s.ref;(t===null&&i!==null||t!==null&&t.ref!==i)&&(s.flags|=512,s.flags|=2097152)}function cu(t,s,i,u,p){var m=jn(i)?Cr:cn.current;return m=no(s,m),lo(s,p),i=Jc(t,s,i,u,m,p),u=eu(),t!==null&&!_n?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~p,Os(t,s,p)):(wt&&u&&Oc(s),s.flags|=1,kn(t,s,i,p),s.child)}function uh(t,s,i,u,p){if(jn(i)){var m=!0;ga(s)}else m=!1;if(lo(s,p),s.stateNode===null)Ma(t,s),Zp(s,i,u),iu(s,i,u,p),u=!0;else if(t===null){var w=s.stateNode,j=s.memoizedProps;w.props=j;var D=w.context,K=i.contextType;typeof K=="object"&&K!==null?K=Xn(K):(K=jn(i)?Cr:cn.current,K=no(s,K));var se=i.getDerivedStateFromProps,oe=typeof se=="function"||typeof w.getSnapshotBeforeUpdate=="function";oe||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(j!==u||D!==K)&&Jp(s,w,u,K),Js=!1;var ne=s.memoizedState;w.state=ne,Ta(s,u,w,p),D=s.memoizedState,j!==u||ne!==D||En.current||Js?(typeof se=="function"&&(ou(s,i,se,u),D=s.memoizedState),(j=Js||Qp(s,i,j,u,ne,D,K))?(oe||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(s.flags|=4194308)):(typeof w.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=u,s.memoizedState=D),w.props=u,w.state=D,w.context=K,u=j):(typeof w.componentDidMount=="function"&&(s.flags|=4194308),u=!1)}else{w=s.stateNode,Cp(t,s),j=s.memoizedProps,K=s.type===s.elementType?j:os(s.type,j),w.props=K,oe=s.pendingProps,ne=w.context,D=i.contextType,typeof D=="object"&&D!==null?D=Xn(D):(D=jn(i)?Cr:cn.current,D=no(s,D));var xe=i.getDerivedStateFromProps;(se=typeof xe=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(j!==oe||ne!==D)&&Jp(s,w,u,D),Js=!1,ne=s.memoizedState,w.state=ne,Ta(s,u,w,p);var be=s.memoizedState;j!==oe||ne!==be||En.current||Js?(typeof xe=="function"&&(ou(s,i,xe,u),be=s.memoizedState),(K=Js||Qp(s,i,K,u,ne,be,D)||!1)?(se||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(u,be,D),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(u,be,D)),typeof w.componentDidUpdate=="function"&&(s.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof w.componentDidUpdate!="function"||j===t.memoizedProps&&ne===t.memoizedState||(s.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||j===t.memoizedProps&&ne===t.memoizedState||(s.flags|=1024),s.memoizedProps=u,s.memoizedState=be),w.props=u,w.state=be,w.context=D,u=K):(typeof w.componentDidUpdate!="function"||j===t.memoizedProps&&ne===t.memoizedState||(s.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||j===t.memoizedProps&&ne===t.memoizedState||(s.flags|=1024),u=!1)}return uu(t,s,i,u,m,p)}function uu(t,s,i,u,p,m){ch(t,s);var w=(s.flags&128)!==0;if(!u&&!w)return p&&mp(s,i,!1),Os(t,s,m);u=s.stateNode,dw.current=s;var j=w&&typeof i.getDerivedStateFromError!="function"?null:u.render();return s.flags|=1,t!==null&&w?(s.child=io(s,t.child,null,m),s.child=io(s,null,j,m)):kn(t,s,j,m),s.memoizedState=u.state,p&&mp(s,i,!0),s.child}function dh(t){var s=t.stateNode;s.pendingContext?pp(t,s.pendingContext,s.pendingContext!==s.context):s.context&&pp(t,s.context,!1),Gc(t,s.containerInfo)}function fh(t,s,i,u,p){return oo(),Fc(p),s.flags|=256,kn(t,s,i,u),s.child}var du={dehydrated:null,treeContext:null,retryLane:0};function fu(t){return{baseLanes:t,cachePool:null,transitions:null}}function ph(t,s,i){var u=s.pendingProps,p=Ct.current,m=!1,w=(s.flags&128)!==0,j;if((j=w)||(j=t!==null&&t.memoizedState===null?!1:(p&2)!==0),j?(m=!0,s.flags&=-129):(t===null||t.memoizedState!==null)&&(p|=1),ut(Ct,p&1),t===null)return zc(s),t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?((s.mode&1)===0?s.lanes=1:t.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(w=u.children,t=u.fallback,m?(u=s.mode,m=s.child,w={mode:"hidden",children:w},(u&1)===0&&m!==null?(m.childLanes=0,m.pendingProps=w):m=Ka(w,u,0,null),t=Or(t,u,i,null),m.return=s,t.return=s,m.sibling=t,s.child=m,s.child.memoizedState=fu(i),s.memoizedState=du,t):pu(s,w));if(p=t.memoizedState,p!==null&&(j=p.dehydrated,j!==null))return fw(t,s,w,u,j,p,i);if(m){m=u.fallback,w=s.mode,p=t.child,j=p.sibling;var D={mode:"hidden",children:u.children};return(w&1)===0&&s.child!==p?(u=s.child,u.childLanes=0,u.pendingProps=D,s.deletions=null):(u=ir(p,D),u.subtreeFlags=p.subtreeFlags&14680064),j!==null?m=ir(j,m):(m=Or(m,w,i,null),m.flags|=2),m.return=s,u.return=s,u.sibling=m,s.child=u,u=m,m=s.child,w=t.child.memoizedState,w=w===null?fu(i):{baseLanes:w.baseLanes|i,cachePool:null,transitions:w.transitions},m.memoizedState=w,m.childLanes=t.childLanes&~i,s.memoizedState=du,u}return m=t.child,t=m.sibling,u=ir(m,{mode:"visible",children:u.children}),(s.mode&1)===0&&(u.lanes=i),u.return=s,u.sibling=null,t!==null&&(i=s.deletions,i===null?(s.deletions=[t],s.flags|=16):i.push(t)),s.child=u,s.memoizedState=null,u}function pu(t,s){return s=Ka({mode:"visible",children:s},t.mode,0,null),s.return=t,t.child=s}function Da(t,s,i,u){return u!==null&&Fc(u),io(s,t.child,null,i),t=pu(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function fw(t,s,i,u,p,m,w){if(i)return s.flags&256?(s.flags&=-257,u=au(Error(r(422))),Da(t,s,w,u)):s.memoizedState!==null?(s.child=t.child,s.flags|=128,null):(m=u.fallback,p=s.mode,u=Ka({mode:"visible",children:u.children},p,0,null),m=Or(m,p,w,null),m.flags|=2,u.return=s,m.return=s,u.sibling=m,s.child=u,(s.mode&1)!==0&&io(s,t.child,null,w),s.child.memoizedState=fu(w),s.memoizedState=du,m);if((s.mode&1)===0)return Da(t,s,w,null);if(p.data==="$!"){if(u=p.nextSibling&&p.nextSibling.dataset,u)var j=u.dgst;return u=j,m=Error(r(419)),u=au(m,u,void 0),Da(t,s,w,u)}if(j=(w&t.childLanes)!==0,_n||j){if(u=Yt,u!==null){switch(w&-w){case 4:p=2;break;case 16:p=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:p=32;break;case 536870912:p=268435456;break;default:p=0}p=(p&(u.suspendedLanes|w))!==0?0:p,p!==0&&p!==m.retryLane&&(m.retryLane=p,Ms(t,p),ls(u,t,p,-1))}return _u(),u=au(Error(r(421))),Da(t,s,w,u)}return p.data==="$?"?(s.flags|=128,s.child=t.child,s=Tw.bind(null,t),p._reactRetry=s,null):(t=m.treeContext,Bn=Xs(p.nextSibling),Un=s,wt=!0,rs=null,t!==null&&(Gn[qn++]=Is,Gn[qn++]=Ds,Gn[qn++]=Er,Is=t.id,Ds=t.overflow,Er=s),s=pu(s,u.children),s.flags|=4096,s)}function hh(t,s,i){t.lanes|=s;var u=t.alternate;u!==null&&(u.lanes|=s),Hc(t.return,s,i)}function hu(t,s,i,u,p){var m=t.memoizedState;m===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:u,tail:i,tailMode:p}:(m.isBackwards=s,m.rendering=null,m.renderingStartTime=0,m.last=u,m.tail=i,m.tailMode=p)}function mh(t,s,i){var u=s.pendingProps,p=u.revealOrder,m=u.tail;if(kn(t,s,u.children,i),u=Ct.current,(u&2)!==0)u=u&1|2,s.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&hh(t,i,s);else if(t.tag===19)hh(t,i,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break e;for(;t.sibling===null;){if(t.return===null||t.return===s)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}u&=1}if(ut(Ct,u),(s.mode&1)===0)s.memoizedState=null;else switch(p){case"forwards":for(i=s.child,p=null;i!==null;)t=i.alternate,t!==null&&Ca(t)===null&&(p=i),i=i.sibling;i=p,i===null?(p=s.child,s.child=null):(p=i.sibling,i.sibling=null),hu(s,!1,p,i,m);break;case"backwards":for(i=null,p=s.child,s.child=null;p!==null;){if(t=p.alternate,t!==null&&Ca(t)===null){s.child=p;break}t=p.sibling,p.sibling=i,i=p,p=t}hu(s,!0,i,null,m);break;case"together":hu(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Ma(t,s){(s.mode&1)===0&&t!==null&&(t.alternate=null,s.alternate=null,s.flags|=2)}function Os(t,s,i){if(t!==null&&(s.dependencies=t.dependencies),Ir|=s.lanes,(i&s.childLanes)===0)return null;if(t!==null&&s.child!==t.child)throw Error(r(153));if(s.child!==null){for(t=s.child,i=ir(t,t.pendingProps),s.child=i,i.return=s;t.sibling!==null;)t=t.sibling,i=i.sibling=ir(t,t.pendingProps),i.return=s;i.sibling=null}return s.child}function pw(t,s,i){switch(s.tag){case 3:dh(s),oo();break;case 5:_p(s);break;case 1:jn(s.type)&&ga(s);break;case 4:Gc(s,s.stateNode.containerInfo);break;case 10:var u=s.type._context,p=s.memoizedProps.value;ut(Sa,u._currentValue),u._currentValue=p;break;case 13:if(u=s.memoizedState,u!==null)return u.dehydrated!==null?(ut(Ct,Ct.current&1),s.flags|=128,null):(i&s.child.childLanes)!==0?ph(t,s,i):(ut(Ct,Ct.current&1),t=Os(t,s,i),t!==null?t.sibling:null);ut(Ct,Ct.current&1);break;case 19:if(u=(i&s.childLanes)!==0,(t.flags&128)!==0){if(u)return mh(t,s,i);s.flags|=128}if(p=s.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),ut(Ct,Ct.current),u)break;return null;case 22:case 23:return s.lanes=0,lh(t,s,i)}return Os(t,s,i)}var gh,mu,vh,yh;gh=function(t,s){for(var i=s.child;i!==null;){if(i.tag===5||i.tag===6)t.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},mu=function(){},vh=function(t,s,i,u){var p=t.memoizedProps;if(p!==u){t=s.stateNode,Rr(ks.current);var m=null;switch(i){case"input":p=Ie(t,p),u=Ie(t,u),m=[];break;case"select":p=G({},p,{value:void 0}),u=G({},u,{value:void 0}),m=[];break;case"textarea":p=Ot(t,p),u=Ot(t,u),m=[];break;default:typeof p.onClick!="function"&&typeof u.onClick=="function"&&(t.onclick=pa)}ns(i,u);var w;i=null;for(K in p)if(!u.hasOwnProperty(K)&&p.hasOwnProperty(K)&&p[K]!=null)if(K==="style"){var j=p[K];for(w in j)j.hasOwnProperty(w)&&(i||(i={}),i[w]="")}else K!=="dangerouslySetInnerHTML"&&K!=="children"&&K!=="suppressContentEditableWarning"&&K!=="suppressHydrationWarning"&&K!=="autoFocus"&&(a.hasOwnProperty(K)?m||(m=[]):(m=m||[]).push(K,null));for(K in u){var D=u[K];if(j=p!=null?p[K]:void 0,u.hasOwnProperty(K)&&D!==j&&(D!=null||j!=null))if(K==="style")if(j){for(w in j)!j.hasOwnProperty(w)||D&&D.hasOwnProperty(w)||(i||(i={}),i[w]="");for(w in D)D.hasOwnProperty(w)&&j[w]!==D[w]&&(i||(i={}),i[w]=D[w])}else i||(m||(m=[]),m.push(K,i)),i=D;else K==="dangerouslySetInnerHTML"?(D=D?D.__html:void 0,j=j?j.__html:void 0,D!=null&&j!==D&&(m=m||[]).push(K,D)):K==="children"?typeof D!="string"&&typeof D!="number"||(m=m||[]).push(K,""+D):K!=="suppressContentEditableWarning"&&K!=="suppressHydrationWarning"&&(a.hasOwnProperty(K)?(D!=null&&K==="onScroll"&&pt("scroll",t),m||j===D||(m=[])):(m=m||[]).push(K,D))}i&&(m=m||[]).push("style",i);var K=m;(s.updateQueue=K)&&(s.flags|=4)}},yh=function(t,s,i,u){i!==u&&(s.flags|=4)};function ci(t,s){if(!wt)switch(t.tailMode){case"hidden":s=t.tail;for(var i=null;s!==null;)s.alternate!==null&&(i=s),s=s.sibling;i===null?t.tail=null:i.sibling=null;break;case"collapsed":i=t.tail;for(var u=null;i!==null;)i.alternate!==null&&(u=i),i=i.sibling;u===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function dn(t){var s=t.alternate!==null&&t.alternate.child===t.child,i=0,u=0;if(s)for(var p=t.child;p!==null;)i|=p.lanes|p.childLanes,u|=p.subtreeFlags&14680064,u|=p.flags&14680064,p.return=t,p=p.sibling;else for(p=t.child;p!==null;)i|=p.lanes|p.childLanes,u|=p.subtreeFlags,u|=p.flags,p.return=t,p=p.sibling;return t.subtreeFlags|=u,t.childLanes=i,s}function hw(t,s,i){var u=s.pendingProps;switch($c(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dn(s),null;case 1:return jn(s.type)&&ma(),dn(s),null;case 3:return u=s.stateNode,co(),ht(En),ht(cn),Yc(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(t===null||t.child===null)&&(wa(s)?s.flags|=4:t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,rs!==null&&(Cu(rs),rs=null))),mu(t,s),dn(s),null;case 5:qc(s);var p=Rr(ri.current);if(i=s.type,t!==null&&s.stateNode!=null)vh(t,s,i,u,p),t.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!u){if(s.stateNode===null)throw Error(r(166));return dn(s),null}if(t=Rr(ks.current),wa(s)){u=s.stateNode,i=s.type;var m=s.memoizedProps;switch(u[ws]=s,u[Jo]=m,t=(s.mode&1)!==0,i){case"dialog":pt("cancel",u),pt("close",u);break;case"iframe":case"object":case"embed":pt("load",u);break;case"video":case"audio":for(p=0;p<Yo.length;p++)pt(Yo[p],u);break;case"source":pt("error",u);break;case"img":case"image":case"link":pt("error",u),pt("load",u);break;case"details":pt("toggle",u);break;case"input":mt(u,m),pt("invalid",u);break;case"select":u._wrapperState={wasMultiple:!!m.multiple},pt("invalid",u);break;case"textarea":Y(u,m),pt("invalid",u)}ns(i,m),p=null;for(var w in m)if(m.hasOwnProperty(w)){var j=m[w];w==="children"?typeof j=="string"?u.textContent!==j&&(m.suppressHydrationWarning!==!0&&fa(u.textContent,j,t),p=["children",j]):typeof j=="number"&&u.textContent!==""+j&&(m.suppressHydrationWarning!==!0&&fa(u.textContent,j,t),p=["children",""+j]):a.hasOwnProperty(w)&&j!=null&&w==="onScroll"&&pt("scroll",u)}switch(i){case"input":ge(u),tn(u,m,!0);break;case"textarea":ge(u),Be(u);break;case"select":case"option":break;default:typeof m.onClick=="function"&&(u.onclick=pa)}u=p,s.updateQueue=u,u!==null&&(s.flags|=4)}else{w=p.nodeType===9?p:p.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=rt(i)),t==="http://www.w3.org/1999/xhtml"?i==="script"?(t=w.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof u.is=="string"?t=w.createElement(i,{is:u.is}):(t=w.createElement(i),i==="select"&&(w=t,u.multiple?w.multiple=!0:u.size&&(w.size=u.size))):t=w.createElementNS(t,i),t[ws]=s,t[Jo]=u,gh(t,s,!1,!1),s.stateNode=t;e:{switch(w=On(i,u),i){case"dialog":pt("cancel",t),pt("close",t),p=u;break;case"iframe":case"object":case"embed":pt("load",t),p=u;break;case"video":case"audio":for(p=0;p<Yo.length;p++)pt(Yo[p],t);p=u;break;case"source":pt("error",t),p=u;break;case"img":case"image":case"link":pt("error",t),pt("load",t),p=u;break;case"details":pt("toggle",t),p=u;break;case"input":mt(t,u),p=Ie(t,u),pt("invalid",t);break;case"option":p=u;break;case"select":t._wrapperState={wasMultiple:!!u.multiple},p=G({},u,{value:void 0}),pt("invalid",t);break;case"textarea":Y(t,u),p=Ot(t,u),pt("invalid",t);break;default:p=u}ns(i,p),j=p;for(m in j)if(j.hasOwnProperty(m)){var D=j[m];m==="style"?hs(t,D):m==="dangerouslySetInnerHTML"?(D=D?D.__html:void 0,D!=null&&_t(t,D)):m==="children"?typeof D=="string"?(i!=="textarea"||D!=="")&&an(t,D):typeof D=="number"&&an(t,""+D):m!=="suppressContentEditableWarning"&&m!=="suppressHydrationWarning"&&m!=="autoFocus"&&(a.hasOwnProperty(m)?D!=null&&m==="onScroll"&&pt("scroll",t):D!=null&&z(t,m,D,w))}switch(i){case"input":ge(t),tn(t,u,!1);break;case"textarea":ge(t),Be(t);break;case"option":u.value!=null&&t.setAttribute("value",""+_e(u.value));break;case"select":t.multiple=!!u.multiple,m=u.value,m!=null?Ft(t,!!u.multiple,m,!1):u.defaultValue!=null&&Ft(t,!!u.multiple,u.defaultValue,!0);break;default:typeof p.onClick=="function"&&(t.onclick=pa)}switch(i){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}}u&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return dn(s),null;case 6:if(t&&s.stateNode!=null)yh(t,s,t.memoizedProps,u);else{if(typeof u!="string"&&s.stateNode===null)throw Error(r(166));if(i=Rr(ri.current),Rr(ks.current),wa(s)){if(u=s.stateNode,i=s.memoizedProps,u[ws]=s,(m=u.nodeValue!==i)&&(t=Un,t!==null))switch(t.tag){case 3:fa(u.nodeValue,i,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&fa(u.nodeValue,i,(t.mode&1)!==0)}m&&(s.flags|=4)}else u=(i.nodeType===9?i:i.ownerDocument).createTextNode(u),u[ws]=s,s.stateNode=u}return dn(s),null;case 13:if(ht(Ct),u=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(wt&&Bn!==null&&(s.mode&1)!==0&&(s.flags&128)===0)kp(),oo(),s.flags|=98560,m=!1;else if(m=wa(s),u!==null&&u.dehydrated!==null){if(t===null){if(!m)throw Error(r(318));if(m=s.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(r(317));m[ws]=s}else oo(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;dn(s),m=!1}else rs!==null&&(Cu(rs),rs=null),m=!0;if(!m)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=i,s):(u=u!==null,u!==(t!==null&&t.memoizedState!==null)&&u&&(s.child.flags|=8192,(s.mode&1)!==0&&(t===null||(Ct.current&1)!==0?Wt===0&&(Wt=3):_u())),s.updateQueue!==null&&(s.flags|=4),dn(s),null);case 4:return co(),mu(t,s),t===null&&Qo(s.stateNode.containerInfo),dn(s),null;case 10:return Wc(s.type._context),dn(s),null;case 17:return jn(s.type)&&ma(),dn(s),null;case 19:if(ht(Ct),m=s.memoizedState,m===null)return dn(s),null;if(u=(s.flags&128)!==0,w=m.rendering,w===null)if(u)ci(m,!1);else{if(Wt!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(w=Ca(t),w!==null){for(s.flags|=128,ci(m,!1),u=w.updateQueue,u!==null&&(s.updateQueue=u,s.flags|=4),s.subtreeFlags=0,u=i,i=s.child;i!==null;)m=i,t=u,m.flags&=14680066,w=m.alternate,w===null?(m.childLanes=0,m.lanes=t,m.child=null,m.subtreeFlags=0,m.memoizedProps=null,m.memoizedState=null,m.updateQueue=null,m.dependencies=null,m.stateNode=null):(m.childLanes=w.childLanes,m.lanes=w.lanes,m.child=w.child,m.subtreeFlags=0,m.deletions=null,m.memoizedProps=w.memoizedProps,m.memoizedState=w.memoizedState,m.updateQueue=w.updateQueue,m.type=w.type,t=w.dependencies,m.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),i=i.sibling;return ut(Ct,Ct.current&1|2),s.child}t=t.sibling}m.tail!==null&&bt()>ho&&(s.flags|=128,u=!0,ci(m,!1),s.lanes=4194304)}else{if(!u)if(t=Ca(w),t!==null){if(s.flags|=128,u=!0,i=t.updateQueue,i!==null&&(s.updateQueue=i,s.flags|=4),ci(m,!0),m.tail===null&&m.tailMode==="hidden"&&!w.alternate&&!wt)return dn(s),null}else 2*bt()-m.renderingStartTime>ho&&i!==1073741824&&(s.flags|=128,u=!0,ci(m,!1),s.lanes=4194304);m.isBackwards?(w.sibling=s.child,s.child=w):(i=m.last,i!==null?i.sibling=w:s.child=w,m.last=w)}return m.tail!==null?(s=m.tail,m.rendering=s,m.tail=s.sibling,m.renderingStartTime=bt(),s.sibling=null,i=Ct.current,ut(Ct,u?i&1|2:i&1),s):(dn(s),null);case 22:case 23:return ju(),u=s.memoizedState!==null,t!==null&&t.memoizedState!==null!==u&&(s.flags|=8192),u&&(s.mode&1)!==0?(Wn&1073741824)!==0&&(dn(s),s.subtreeFlags&6&&(s.flags|=8192)):dn(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function mw(t,s){switch($c(s),s.tag){case 1:return jn(s.type)&&ma(),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return co(),ht(En),ht(cn),Yc(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 5:return qc(s),null;case 13:if(ht(Ct),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(r(340));oo()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return ht(Ct),null;case 4:return co(),null;case 10:return Wc(s.type._context),null;case 22:case 23:return ju(),null;case 24:return null;default:return null}}var La=!1,fn=!1,gw=typeof WeakSet=="function"?WeakSet:Set,ke=null;function fo(t,s){var i=t.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(u){It(t,s,u)}else i.current=null}function gu(t,s,i){try{i()}catch(u){It(t,s,u)}}var xh=!1;function vw(t,s){if(jc=ta,t=Qf(),wc(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var u=i.getSelection&&i.getSelection();if(u&&u.rangeCount!==0){i=u.anchorNode;var p=u.anchorOffset,m=u.focusNode;u=u.focusOffset;try{i.nodeType,m.nodeType}catch{i=null;break e}var w=0,j=-1,D=-1,K=0,se=0,oe=t,ne=null;t:for(;;){for(var xe;oe!==i||p!==0&&oe.nodeType!==3||(j=w+p),oe!==m||u!==0&&oe.nodeType!==3||(D=w+u),oe.nodeType===3&&(w+=oe.nodeValue.length),(xe=oe.firstChild)!==null;)ne=oe,oe=xe;for(;;){if(oe===t)break t;if(ne===i&&++K===p&&(j=w),ne===m&&++se===u&&(D=w),(xe=oe.nextSibling)!==null)break;oe=ne,ne=oe.parentNode}oe=xe}i=j===-1||D===-1?null:{start:j,end:D}}else i=null}i=i||{start:0,end:0}}else i=null;for(_c={focusedElem:t,selectionRange:i},ta=!1,ke=s;ke!==null;)if(s=ke,t=s.child,(s.subtreeFlags&1028)!==0&&t!==null)t.return=s,ke=t;else for(;ke!==null;){s=ke;try{var be=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(be!==null){var Ce=be.memoizedProps,Mt=be.memoizedState,W=s.stateNode,L=W.getSnapshotBeforeUpdate(s.elementType===s.type?Ce:os(s.type,Ce),Mt);W.__reactInternalSnapshotBeforeUpdate=L}break;case 3:var V=s.stateNode.containerInfo;V.nodeType===1?V.textContent="":V.nodeType===9&&V.documentElement&&V.removeChild(V.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(fe){It(s,s.return,fe)}if(t=s.sibling,t!==null){t.return=s.return,ke=t;break}ke=s.return}return be=xh,xh=!1,be}function ui(t,s,i){var u=s.updateQueue;if(u=u!==null?u.lastEffect:null,u!==null){var p=u=u.next;do{if((p.tag&t)===t){var m=p.destroy;p.destroy=void 0,m!==void 0&&gu(s,i,m)}p=p.next}while(p!==u)}}function Oa(t,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var i=s=s.next;do{if((i.tag&t)===t){var u=i.create;i.destroy=u()}i=i.next}while(i!==s)}}function vu(t){var s=t.ref;if(s!==null){var i=t.stateNode;switch(t.tag){case 5:t=i;break;default:t=i}typeof s=="function"?s(t):s.current=t}}function wh(t){var s=t.alternate;s!==null&&(t.alternate=null,wh(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&(delete s[ws],delete s[Jo],delete s[Dc],delete s[Jx],delete s[ew])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function kh(t){return t.tag===5||t.tag===3||t.tag===4}function Sh(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||kh(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function yu(t,s,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,s?i.nodeType===8?i.parentNode.insertBefore(t,s):i.insertBefore(t,s):(i.nodeType===8?(s=i.parentNode,s.insertBefore(t,i)):(s=i,s.appendChild(t)),i=i._reactRootContainer,i!=null||s.onclick!==null||(s.onclick=pa));else if(u!==4&&(t=t.child,t!==null))for(yu(t,s,i),t=t.sibling;t!==null;)yu(t,s,i),t=t.sibling}function xu(t,s,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,s?i.insertBefore(t,s):i.appendChild(t);else if(u!==4&&(t=t.child,t!==null))for(xu(t,s,i),t=t.sibling;t!==null;)xu(t,s,i),t=t.sibling}var nn=null,is=!1;function tr(t,s,i){for(i=i.child;i!==null;)bh(t,s,i),i=i.sibling}function bh(t,s,i){if(zn&&typeof zn.onCommitFiberUnmount=="function")try{zn.onCommitFiberUnmount(wr,i)}catch{}switch(i.tag){case 5:fn||fo(i,s);case 6:var u=nn,p=is;nn=null,tr(t,s,i),nn=u,is=p,nn!==null&&(is?(t=nn,i=i.stateNode,t.nodeType===8?t.parentNode.removeChild(i):t.removeChild(i)):nn.removeChild(i.stateNode));break;case 18:nn!==null&&(is?(t=nn,i=i.stateNode,t.nodeType===8?Ic(t.parentNode,i):t.nodeType===1&&Ic(t,i),Bo(t)):Ic(nn,i.stateNode));break;case 4:u=nn,p=is,nn=i.stateNode.containerInfo,is=!0,tr(t,s,i),nn=u,is=p;break;case 0:case 11:case 14:case 15:if(!fn&&(u=i.updateQueue,u!==null&&(u=u.lastEffect,u!==null))){p=u=u.next;do{var m=p,w=m.destroy;m=m.tag,w!==void 0&&((m&2)!==0||(m&4)!==0)&&gu(i,s,w),p=p.next}while(p!==u)}tr(t,s,i);break;case 1:if(!fn&&(fo(i,s),u=i.stateNode,typeof u.componentWillUnmount=="function"))try{u.props=i.memoizedProps,u.state=i.memoizedState,u.componentWillUnmount()}catch(j){It(i,s,j)}tr(t,s,i);break;case 21:tr(t,s,i);break;case 22:i.mode&1?(fn=(u=fn)||i.memoizedState!==null,tr(t,s,i),fn=u):tr(t,s,i);break;default:tr(t,s,i)}}function Nh(t){var s=t.updateQueue;if(s!==null){t.updateQueue=null;var i=t.stateNode;i===null&&(i=t.stateNode=new gw),s.forEach(function(u){var p=Cw.bind(null,t,u);i.has(u)||(i.add(u),u.then(p,p))})}}function as(t,s){var i=s.deletions;if(i!==null)for(var u=0;u<i.length;u++){var p=i[u];try{var m=t,w=s,j=w;e:for(;j!==null;){switch(j.tag){case 5:nn=j.stateNode,is=!1;break e;case 3:nn=j.stateNode.containerInfo,is=!0;break e;case 4:nn=j.stateNode.containerInfo,is=!0;break e}j=j.return}if(nn===null)throw Error(r(160));bh(m,w,p),nn=null,is=!1;var D=p.alternate;D!==null&&(D.return=null),p.return=null}catch(K){It(p,s,K)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Th(s,t),s=s.sibling}function Th(t,s){var i=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(as(s,t),bs(t),u&4){try{ui(3,t,t.return),Oa(3,t)}catch(Ce){It(t,t.return,Ce)}try{ui(5,t,t.return)}catch(Ce){It(t,t.return,Ce)}}break;case 1:as(s,t),bs(t),u&512&&i!==null&&fo(i,i.return);break;case 5:if(as(s,t),bs(t),u&512&&i!==null&&fo(i,i.return),t.flags&32){var p=t.stateNode;try{an(p,"")}catch(Ce){It(t,t.return,Ce)}}if(u&4&&(p=t.stateNode,p!=null)){var m=t.memoizedProps,w=i!==null?i.memoizedProps:m,j=t.type,D=t.updateQueue;if(t.updateQueue=null,D!==null)try{j==="input"&&m.type==="radio"&&m.name!=null&&Ue(p,m),On(j,w);var K=On(j,m);for(w=0;w<D.length;w+=2){var se=D[w],oe=D[w+1];se==="style"?hs(p,oe):se==="dangerouslySetInnerHTML"?_t(p,oe):se==="children"?an(p,oe):z(p,se,oe,K)}switch(j){case"input":Vt(p,m);break;case"textarea":ve(p,m);break;case"select":var ne=p._wrapperState.wasMultiple;p._wrapperState.wasMultiple=!!m.multiple;var xe=m.value;xe!=null?Ft(p,!!m.multiple,xe,!1):ne!==!!m.multiple&&(m.defaultValue!=null?Ft(p,!!m.multiple,m.defaultValue,!0):Ft(p,!!m.multiple,m.multiple?[]:"",!1))}p[Jo]=m}catch(Ce){It(t,t.return,Ce)}}break;case 6:if(as(s,t),bs(t),u&4){if(t.stateNode===null)throw Error(r(162));p=t.stateNode,m=t.memoizedProps;try{p.nodeValue=m}catch(Ce){It(t,t.return,Ce)}}break;case 3:if(as(s,t),bs(t),u&4&&i!==null&&i.memoizedState.isDehydrated)try{Bo(s.containerInfo)}catch(Ce){It(t,t.return,Ce)}break;case 4:as(s,t),bs(t);break;case 13:as(s,t),bs(t),p=t.child,p.flags&8192&&(m=p.memoizedState!==null,p.stateNode.isHidden=m,!m||p.alternate!==null&&p.alternate.memoizedState!==null||(Su=bt())),u&4&&Nh(t);break;case 22:if(se=i!==null&&i.memoizedState!==null,t.mode&1?(fn=(K=fn)||se,as(s,t),fn=K):as(s,t),bs(t),u&8192){if(K=t.memoizedState!==null,(t.stateNode.isHidden=K)&&!se&&(t.mode&1)!==0)for(ke=t,se=t.child;se!==null;){for(oe=ke=se;ke!==null;){switch(ne=ke,xe=ne.child,ne.tag){case 0:case 11:case 14:case 15:ui(4,ne,ne.return);break;case 1:fo(ne,ne.return);var be=ne.stateNode;if(typeof be.componentWillUnmount=="function"){u=ne,i=ne.return;try{s=u,be.props=s.memoizedProps,be.state=s.memoizedState,be.componentWillUnmount()}catch(Ce){It(u,i,Ce)}}break;case 5:fo(ne,ne.return);break;case 22:if(ne.memoizedState!==null){jh(oe);continue}}xe!==null?(xe.return=ne,ke=xe):jh(oe)}se=se.sibling}e:for(se=null,oe=t;;){if(oe.tag===5){if(se===null){se=oe;try{p=oe.stateNode,K?(m=p.style,typeof m.setProperty=="function"?m.setProperty("display","none","important"):m.display="none"):(j=oe.stateNode,D=oe.memoizedProps.style,w=D!=null&&D.hasOwnProperty("display")?D.display:null,j.style.display=Ln("display",w))}catch(Ce){It(t,t.return,Ce)}}}else if(oe.tag===6){if(se===null)try{oe.stateNode.nodeValue=K?"":oe.memoizedProps}catch(Ce){It(t,t.return,Ce)}}else if((oe.tag!==22&&oe.tag!==23||oe.memoizedState===null||oe===t)&&oe.child!==null){oe.child.return=oe,oe=oe.child;continue}if(oe===t)break e;for(;oe.sibling===null;){if(oe.return===null||oe.return===t)break e;se===oe&&(se=null),oe=oe.return}se===oe&&(se=null),oe.sibling.return=oe.return,oe=oe.sibling}}break;case 19:as(s,t),bs(t),u&4&&Nh(t);break;case 21:break;default:as(s,t),bs(t)}}function bs(t){var s=t.flags;if(s&2){try{e:{for(var i=t.return;i!==null;){if(kh(i)){var u=i;break e}i=i.return}throw Error(r(160))}switch(u.tag){case 5:var p=u.stateNode;u.flags&32&&(an(p,""),u.flags&=-33);var m=Sh(t);xu(t,m,p);break;case 3:case 4:var w=u.stateNode.containerInfo,j=Sh(t);yu(t,j,w);break;default:throw Error(r(161))}}catch(D){It(t,t.return,D)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function yw(t,s,i){ke=t,Ch(t)}function Ch(t,s,i){for(var u=(t.mode&1)!==0;ke!==null;){var p=ke,m=p.child;if(p.tag===22&&u){var w=p.memoizedState!==null||La;if(!w){var j=p.alternate,D=j!==null&&j.memoizedState!==null||fn;j=La;var K=fn;if(La=w,(fn=D)&&!K)for(ke=p;ke!==null;)w=ke,D=w.child,w.tag===22&&w.memoizedState!==null?_h(p):D!==null?(D.return=w,ke=D):_h(p);for(;m!==null;)ke=m,Ch(m),m=m.sibling;ke=p,La=j,fn=K}Eh(t)}else(p.subtreeFlags&8772)!==0&&m!==null?(m.return=p,ke=m):Eh(t)}}function Eh(t){for(;ke!==null;){var s=ke;if((s.flags&8772)!==0){var i=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:fn||Oa(5,s);break;case 1:var u=s.stateNode;if(s.flags&4&&!fn)if(i===null)u.componentDidMount();else{var p=s.elementType===s.type?i.memoizedProps:os(s.type,i.memoizedProps);u.componentDidUpdate(p,i.memoizedState,u.__reactInternalSnapshotBeforeUpdate)}var m=s.updateQueue;m!==null&&jp(s,m,u);break;case 3:var w=s.updateQueue;if(w!==null){if(i=null,s.child!==null)switch(s.child.tag){case 5:i=s.child.stateNode;break;case 1:i=s.child.stateNode}jp(s,w,i)}break;case 5:var j=s.stateNode;if(i===null&&s.flags&4){i=j;var D=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":D.autoFocus&&i.focus();break;case"img":D.src&&(i.src=D.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var K=s.alternate;if(K!==null){var se=K.memoizedState;if(se!==null){var oe=se.dehydrated;oe!==null&&Bo(oe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}fn||s.flags&512&&vu(s)}catch(ne){It(s,s.return,ne)}}if(s===t){ke=null;break}if(i=s.sibling,i!==null){i.return=s.return,ke=i;break}ke=s.return}}function jh(t){for(;ke!==null;){var s=ke;if(s===t){ke=null;break}var i=s.sibling;if(i!==null){i.return=s.return,ke=i;break}ke=s.return}}function _h(t){for(;ke!==null;){var s=ke;try{switch(s.tag){case 0:case 11:case 15:var i=s.return;try{Oa(4,s)}catch(D){It(s,i,D)}break;case 1:var u=s.stateNode;if(typeof u.componentDidMount=="function"){var p=s.return;try{u.componentDidMount()}catch(D){It(s,p,D)}}var m=s.return;try{vu(s)}catch(D){It(s,m,D)}break;case 5:var w=s.return;try{vu(s)}catch(D){It(s,w,D)}}}catch(D){It(s,s.return,D)}if(s===t){ke=null;break}var j=s.sibling;if(j!==null){j.return=s.return,ke=j;break}ke=s.return}}var xw=Math.ceil,$a=M.ReactCurrentDispatcher,wu=M.ReactCurrentOwner,Qn=M.ReactCurrentBatchConfig,Qe=0,Yt=null,Pt=null,sn=0,Wn=0,po=Ys(0),Wt=0,di=null,Ir=0,Pa=0,ku=0,fi=null,Rn=null,Su=0,ho=1/0,$s=null,za=!1,bu=null,nr=null,Fa=!1,sr=null,Ua=0,pi=0,Nu=null,Ba=-1,Wa=0;function Sn(){return(Qe&6)!==0?bt():Ba!==-1?Ba:Ba=bt()}function rr(t){return(t.mode&1)===0?1:(Qe&2)!==0&&sn!==0?sn&-sn:nw.transition!==null?(Wa===0&&(Wa=Po()),Wa):(t=Xe,t!==0||(t=window.event,t=t===void 0?16:Af(t.type)),t)}function ls(t,s,i,u){if(50<pi)throw pi=0,Nu=null,Error(r(185));Nr(t,i,u),((Qe&2)===0||t!==Yt)&&(t===Yt&&((Qe&2)===0&&(Pa|=i),Wt===4&&or(t,sn)),An(t,u),i===1&&Qe===0&&(s.mode&1)===0&&(ho=bt()+500,va&&Zs()))}function An(t,s){var i=t.callbackNode;Zi(t,s);var u=br(t,t===Yt?sn:0);if(u===0)i!==null&&At(i),t.callbackNode=null,t.callbackPriority=0;else if(s=u&-u,t.callbackPriority!==s){if(i!=null&&At(i),s===1)t.tag===0?tw(Ah.bind(null,t)):gp(Ah.bind(null,t)),Qx(function(){(Qe&6)===0&&Zs()}),i=null;else{switch(de(u)){case 1:i=Ws;break;case 4:i=xs;break;case 16:i=Wr;break;case 536870912:i=Yi;break;default:i=Wr}i=zh(i,Rh.bind(null,t))}t.callbackPriority=s,t.callbackNode=i}}function Rh(t,s){if(Ba=-1,Wa=0,(Qe&6)!==0)throw Error(r(327));var i=t.callbackNode;if(mo()&&t.callbackNode!==i)return null;var u=br(t,t===Yt?sn:0);if(u===0)return null;if((u&30)!==0||(u&t.expiredLanes)!==0||s)s=Ha(t,u);else{s=u;var p=Qe;Qe|=2;var m=Dh();(Yt!==t||sn!==s)&&($s=null,ho=bt()+500,Mr(t,s));do try{Sw();break}catch(j){Ih(t,j)}while(!0);Bc(),$a.current=m,Qe=p,Pt!==null?s=0:(Yt=null,sn=0,s=Wt)}if(s!==0){if(s===2&&(p=$o(t),p!==0&&(u=p,s=Tu(t,p))),s===1)throw i=di,Mr(t,0),or(t,u),An(t,bt()),i;if(s===6)or(t,u);else{if(p=t.current.alternate,(u&30)===0&&!ww(p)&&(s=Ha(t,u),s===2&&(m=$o(t),m!==0&&(u=m,s=Tu(t,m))),s===1))throw i=di,Mr(t,0),or(t,u),An(t,bt()),i;switch(t.finishedWork=p,t.finishedLanes=u,s){case 0:case 1:throw Error(r(345));case 2:Lr(t,Rn,$s);break;case 3:if(or(t,u),(u&130023424)===u&&(s=Su+500-bt(),10<s)){if(br(t,0)!==0)break;if(p=t.suspendedLanes,(p&u)!==u){Sn(),t.pingedLanes|=t.suspendedLanes&p;break}t.timeoutHandle=Ac(Lr.bind(null,t,Rn,$s),s);break}Lr(t,Rn,$s);break;case 4:if(or(t,u),(u&4194240)===u)break;for(s=t.eventTimes,p=-1;0<u;){var w=31-xn(u);m=1<<w,w=s[w],w>p&&(p=w),u&=~m}if(u=p,u=bt()-u,u=(120>u?120:480>u?480:1080>u?1080:1920>u?1920:3e3>u?3e3:4320>u?4320:1960*xw(u/1960))-u,10<u){t.timeoutHandle=Ac(Lr.bind(null,t,Rn,$s),u);break}Lr(t,Rn,$s);break;case 5:Lr(t,Rn,$s);break;default:throw Error(r(329))}}}return An(t,bt()),t.callbackNode===i?Rh.bind(null,t):null}function Tu(t,s){var i=fi;return t.current.memoizedState.isDehydrated&&(Mr(t,s).flags|=256),t=Ha(t,s),t!==2&&(s=Rn,Rn=i,s!==null&&Cu(s)),t}function Cu(t){Rn===null?Rn=t:Rn.push.apply(Rn,t)}function ww(t){for(var s=t;;){if(s.flags&16384){var i=s.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var u=0;u<i.length;u++){var p=i[u],m=p.getSnapshot;p=p.value;try{if(!ss(m(),p))return!1}catch{return!1}}}if(i=s.child,s.subtreeFlags&16384&&i!==null)i.return=s,s=i;else{if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function or(t,s){for(s&=~ku,s&=~Pa,t.suspendedLanes|=s,t.pingedLanes&=~s,t=t.expirationTimes;0<s;){var i=31-xn(s),u=1<<i;t[i]=-1,s&=~u}}function Ah(t){if((Qe&6)!==0)throw Error(r(327));mo();var s=br(t,0);if((s&1)===0)return An(t,bt()),null;var i=Ha(t,s);if(t.tag!==0&&i===2){var u=$o(t);u!==0&&(s=u,i=Tu(t,u))}if(i===1)throw i=di,Mr(t,0),or(t,s),An(t,bt()),i;if(i===6)throw Error(r(345));return t.finishedWork=t.current.alternate,t.finishedLanes=s,Lr(t,Rn,$s),An(t,bt()),null}function Eu(t,s){var i=Qe;Qe|=1;try{return t(s)}finally{Qe=i,Qe===0&&(ho=bt()+500,va&&Zs())}}function Dr(t){sr!==null&&sr.tag===0&&(Qe&6)===0&&mo();var s=Qe;Qe|=1;var i=Qn.transition,u=Xe;try{if(Qn.transition=null,Xe=1,t)return t()}finally{Xe=u,Qn.transition=i,Qe=s,(Qe&6)===0&&Zs()}}function ju(){Wn=po.current,ht(po)}function Mr(t,s){t.finishedWork=null,t.finishedLanes=0;var i=t.timeoutHandle;if(i!==-1&&(t.timeoutHandle=-1,Yx(i)),Pt!==null)for(i=Pt.return;i!==null;){var u=i;switch($c(u),u.tag){case 1:u=u.type.childContextTypes,u!=null&&ma();break;case 3:co(),ht(En),ht(cn),Yc();break;case 5:qc(u);break;case 4:co();break;case 13:ht(Ct);break;case 19:ht(Ct);break;case 10:Wc(u.type._context);break;case 22:case 23:ju()}i=i.return}if(Yt=t,Pt=t=ir(t.current,null),sn=Wn=s,Wt=0,di=null,ku=Pa=Ir=0,Rn=fi=null,_r!==null){for(s=0;s<_r.length;s++)if(i=_r[s],u=i.interleaved,u!==null){i.interleaved=null;var p=u.next,m=i.pending;if(m!==null){var w=m.next;m.next=p,u.next=w}i.pending=u}_r=null}return t}function Ih(t,s){do{var i=Pt;try{if(Bc(),Ea.current=Aa,ja){for(var u=Et.memoizedState;u!==null;){var p=u.queue;p!==null&&(p.pending=null),u=u.next}ja=!1}if(Ar=0,Xt=Bt=Et=null,oi=!1,ii=0,wu.current=null,i===null||i.return===null){Wt=1,di=s,Pt=null;break}e:{var m=t,w=i.return,j=i,D=s;if(s=sn,j.flags|=32768,D!==null&&typeof D=="object"&&typeof D.then=="function"){var K=D,se=j,oe=se.tag;if((se.mode&1)===0&&(oe===0||oe===11||oe===15)){var ne=se.alternate;ne?(se.updateQueue=ne.updateQueue,se.memoizedState=ne.memoizedState,se.lanes=ne.lanes):(se.updateQueue=null,se.memoizedState=null)}var xe=sh(w);if(xe!==null){xe.flags&=-257,rh(xe,w,j,m,s),xe.mode&1&&nh(m,K,s),s=xe,D=K;var be=s.updateQueue;if(be===null){var Ce=new Set;Ce.add(D),s.updateQueue=Ce}else be.add(D);break e}else{if((s&1)===0){nh(m,K,s),_u();break e}D=Error(r(426))}}else if(wt&&j.mode&1){var Mt=sh(w);if(Mt!==null){(Mt.flags&65536)===0&&(Mt.flags|=256),rh(Mt,w,j,m,s),Fc(uo(D,j));break e}}m=D=uo(D,j),Wt!==4&&(Wt=2),fi===null?fi=[m]:fi.push(m),m=w;do{switch(m.tag){case 3:m.flags|=65536,s&=-s,m.lanes|=s;var W=eh(m,D,s);Ep(m,W);break e;case 1:j=D;var L=m.type,V=m.stateNode;if((m.flags&128)===0&&(typeof L.getDerivedStateFromError=="function"||V!==null&&typeof V.componentDidCatch=="function"&&(nr===null||!nr.has(V)))){m.flags|=65536,s&=-s,m.lanes|=s;var fe=th(m,j,s);Ep(m,fe);break e}}m=m.return}while(m!==null)}Lh(i)}catch(Ee){s=Ee,Pt===i&&i!==null&&(Pt=i=i.return);continue}break}while(!0)}function Dh(){var t=$a.current;return $a.current=Aa,t===null?Aa:t}function _u(){(Wt===0||Wt===3||Wt===2)&&(Wt=4),Yt===null||(Ir&268435455)===0&&(Pa&268435455)===0||or(Yt,sn)}function Ha(t,s){var i=Qe;Qe|=2;var u=Dh();(Yt!==t||sn!==s)&&($s=null,Mr(t,s));do try{kw();break}catch(p){Ih(t,p)}while(!0);if(Bc(),Qe=i,$a.current=u,Pt!==null)throw Error(r(261));return Yt=null,sn=0,Wt}function kw(){for(;Pt!==null;)Mh(Pt)}function Sw(){for(;Pt!==null&&!vs();)Mh(Pt)}function Mh(t){var s=Ph(t.alternate,t,Wn);t.memoizedProps=t.pendingProps,s===null?Lh(t):Pt=s,wu.current=null}function Lh(t){var s=t;do{var i=s.alternate;if(t=s.return,(s.flags&32768)===0){if(i=hw(i,s,Wn),i!==null){Pt=i;return}}else{if(i=mw(i,s),i!==null){i.flags&=32767,Pt=i;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Wt=6,Pt=null;return}}if(s=s.sibling,s!==null){Pt=s;return}Pt=s=t}while(s!==null);Wt===0&&(Wt=5)}function Lr(t,s,i){var u=Xe,p=Qn.transition;try{Qn.transition=null,Xe=1,bw(t,s,i,u)}finally{Qn.transition=p,Xe=u}return null}function bw(t,s,i,u){do mo();while(sr!==null);if((Qe&6)!==0)throw Error(r(327));i=t.finishedWork;var p=t.finishedLanes;if(i===null)return null;if(t.finishedWork=null,t.finishedLanes=0,i===t.current)throw Error(r(177));t.callbackNode=null,t.callbackPriority=0;var m=i.lanes|i.childLanes;if(Ji(t,m),t===Yt&&(Pt=Yt=null,sn=0),(i.subtreeFlags&2064)===0&&(i.flags&2064)===0||Fa||(Fa=!0,zh(Wr,function(){return mo(),null})),m=(i.flags&15990)!==0,(i.subtreeFlags&15990)!==0||m){m=Qn.transition,Qn.transition=null;var w=Xe;Xe=1;var j=Qe;Qe|=4,wu.current=null,vw(t,i),Th(i,t),Wx(_c),ta=!!jc,_c=jc=null,t.current=i,yw(i),lc(),Qe=j,Xe=w,Qn.transition=m}else t.current=i;if(Fa&&(Fa=!1,sr=t,Ua=p),m=t.pendingLanes,m===0&&(nr=null),Hr(i.stateNode),An(t,bt()),s!==null)for(u=t.onRecoverableError,i=0;i<s.length;i++)p=s[i],u(p.value,{componentStack:p.stack,digest:p.digest});if(za)throw za=!1,t=bu,bu=null,t;return(Ua&1)!==0&&t.tag!==0&&mo(),m=t.pendingLanes,(m&1)!==0?t===Nu?pi++:(pi=0,Nu=t):pi=0,Zs(),null}function mo(){if(sr!==null){var t=de(Ua),s=Qn.transition,i=Xe;try{if(Qn.transition=null,Xe=16>t?16:t,sr===null)var u=!1;else{if(t=sr,sr=null,Ua=0,(Qe&6)!==0)throw Error(r(331));var p=Qe;for(Qe|=4,ke=t.current;ke!==null;){var m=ke,w=m.child;if((ke.flags&16)!==0){var j=m.deletions;if(j!==null){for(var D=0;D<j.length;D++){var K=j[D];for(ke=K;ke!==null;){var se=ke;switch(se.tag){case 0:case 11:case 15:ui(8,se,m)}var oe=se.child;if(oe!==null)oe.return=se,ke=oe;else for(;ke!==null;){se=ke;var ne=se.sibling,xe=se.return;if(wh(se),se===K){ke=null;break}if(ne!==null){ne.return=xe,ke=ne;break}ke=xe}}}var be=m.alternate;if(be!==null){var Ce=be.child;if(Ce!==null){be.child=null;do{var Mt=Ce.sibling;Ce.sibling=null,Ce=Mt}while(Ce!==null)}}ke=m}}if((m.subtreeFlags&2064)!==0&&w!==null)w.return=m,ke=w;else e:for(;ke!==null;){if(m=ke,(m.flags&2048)!==0)switch(m.tag){case 0:case 11:case 15:ui(9,m,m.return)}var W=m.sibling;if(W!==null){W.return=m.return,ke=W;break e}ke=m.return}}var L=t.current;for(ke=L;ke!==null;){w=ke;var V=w.child;if((w.subtreeFlags&2064)!==0&&V!==null)V.return=w,ke=V;else e:for(w=L;ke!==null;){if(j=ke,(j.flags&2048)!==0)try{switch(j.tag){case 0:case 11:case 15:Oa(9,j)}}catch(Ee){It(j,j.return,Ee)}if(j===w){ke=null;break e}var fe=j.sibling;if(fe!==null){fe.return=j.return,ke=fe;break e}ke=j.return}}if(Qe=p,Zs(),zn&&typeof zn.onPostCommitFiberRoot=="function")try{zn.onPostCommitFiberRoot(wr,t)}catch{}u=!0}return u}finally{Xe=i,Qn.transition=s}}return!1}function Oh(t,s,i){s=uo(i,s),s=eh(t,s,1),t=er(t,s,1),s=Sn(),t!==null&&(Nr(t,1,s),An(t,s))}function It(t,s,i){if(t.tag===3)Oh(t,t,i);else for(;s!==null;){if(s.tag===3){Oh(s,t,i);break}else if(s.tag===1){var u=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(nr===null||!nr.has(u))){t=uo(i,t),t=th(s,t,1),s=er(s,t,1),t=Sn(),s!==null&&(Nr(s,1,t),An(s,t));break}}s=s.return}}function Nw(t,s,i){var u=t.pingCache;u!==null&&u.delete(s),s=Sn(),t.pingedLanes|=t.suspendedLanes&i,Yt===t&&(sn&i)===i&&(Wt===4||Wt===3&&(sn&130023424)===sn&&500>bt()-Su?Mr(t,0):ku|=i),An(t,s)}function $h(t,s){s===0&&((t.mode&1)===0?s=1:(s=Kr,Kr<<=1,(Kr&130023424)===0&&(Kr=4194304)));var i=Sn();t=Ms(t,s),t!==null&&(Nr(t,s,i),An(t,i))}function Tw(t){var s=t.memoizedState,i=0;s!==null&&(i=s.retryLane),$h(t,i)}function Cw(t,s){var i=0;switch(t.tag){case 13:var u=t.stateNode,p=t.memoizedState;p!==null&&(i=p.retryLane);break;case 19:u=t.stateNode;break;default:throw Error(r(314))}u!==null&&u.delete(s),$h(t,i)}var Ph;Ph=function(t,s,i){if(t!==null)if(t.memoizedProps!==s.pendingProps||En.current)_n=!0;else{if((t.lanes&i)===0&&(s.flags&128)===0)return _n=!1,pw(t,s,i);_n=(t.flags&131072)!==0}else _n=!1,wt&&(s.flags&1048576)!==0&&vp(s,xa,s.index);switch(s.lanes=0,s.tag){case 2:var u=s.type;Ma(t,s),t=s.pendingProps;var p=no(s,cn.current);lo(s,i),p=Jc(null,s,u,t,p,i);var m=eu();return s.flags|=1,typeof p=="object"&&p!==null&&typeof p.render=="function"&&p.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,jn(u)?(m=!0,ga(s)):m=!1,s.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,Kc(s),p.updater=Ia,s.stateNode=p,p._reactInternals=s,iu(s,u,t,i),s=uu(null,s,u,!0,m,i)):(s.tag=0,wt&&m&&Oc(s),kn(null,s,p,i),s=s.child),s;case 16:u=s.elementType;e:{switch(Ma(t,s),t=s.pendingProps,p=u._init,u=p(u._payload),s.type=u,p=s.tag=jw(u),t=os(u,t),p){case 0:s=cu(null,s,u,t,i);break e;case 1:s=uh(null,s,u,t,i);break e;case 11:s=oh(null,s,u,t,i);break e;case 14:s=ih(null,s,u,os(u.type,t),i);break e}throw Error(r(306,u,""))}return s;case 0:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:os(u,p),cu(t,s,u,p,i);case 1:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:os(u,p),uh(t,s,u,p,i);case 3:e:{if(dh(s),t===null)throw Error(r(387));u=s.pendingProps,m=s.memoizedState,p=m.element,Cp(t,s),Ta(s,u,null,i);var w=s.memoizedState;if(u=w.element,m.isDehydrated)if(m={element:u,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},s.updateQueue.baseState=m,s.memoizedState=m,s.flags&256){p=uo(Error(r(423)),s),s=fh(t,s,u,i,p);break e}else if(u!==p){p=uo(Error(r(424)),s),s=fh(t,s,u,i,p);break e}else for(Bn=Xs(s.stateNode.containerInfo.firstChild),Un=s,wt=!0,rs=null,i=Np(s,null,u,i),s.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(oo(),u===p){s=Os(t,s,i);break e}kn(t,s,u,i)}s=s.child}return s;case 5:return _p(s),t===null&&zc(s),u=s.type,p=s.pendingProps,m=t!==null?t.memoizedProps:null,w=p.children,Rc(u,p)?w=null:m!==null&&Rc(u,m)&&(s.flags|=32),ch(t,s),kn(t,s,w,i),s.child;case 6:return t===null&&zc(s),null;case 13:return ph(t,s,i);case 4:return Gc(s,s.stateNode.containerInfo),u=s.pendingProps,t===null?s.child=io(s,null,u,i):kn(t,s,u,i),s.child;case 11:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:os(u,p),oh(t,s,u,p,i);case 7:return kn(t,s,s.pendingProps,i),s.child;case 8:return kn(t,s,s.pendingProps.children,i),s.child;case 12:return kn(t,s,s.pendingProps.children,i),s.child;case 10:e:{if(u=s.type._context,p=s.pendingProps,m=s.memoizedProps,w=p.value,ut(Sa,u._currentValue),u._currentValue=w,m!==null)if(ss(m.value,w)){if(m.children===p.children&&!En.current){s=Os(t,s,i);break e}}else for(m=s.child,m!==null&&(m.return=s);m!==null;){var j=m.dependencies;if(j!==null){w=m.child;for(var D=j.firstContext;D!==null;){if(D.context===u){if(m.tag===1){D=Ls(-1,i&-i),D.tag=2;var K=m.updateQueue;if(K!==null){K=K.shared;var se=K.pending;se===null?D.next=D:(D.next=se.next,se.next=D),K.pending=D}}m.lanes|=i,D=m.alternate,D!==null&&(D.lanes|=i),Hc(m.return,i,s),j.lanes|=i;break}D=D.next}}else if(m.tag===10)w=m.type===s.type?null:m.child;else if(m.tag===18){if(w=m.return,w===null)throw Error(r(341));w.lanes|=i,j=w.alternate,j!==null&&(j.lanes|=i),Hc(w,i,s),w=m.sibling}else w=m.child;if(w!==null)w.return=m;else for(w=m;w!==null;){if(w===s){w=null;break}if(m=w.sibling,m!==null){m.return=w.return,w=m;break}w=w.return}m=w}kn(t,s,p.children,i),s=s.child}return s;case 9:return p=s.type,u=s.pendingProps.children,lo(s,i),p=Xn(p),u=u(p),s.flags|=1,kn(t,s,u,i),s.child;case 14:return u=s.type,p=os(u,s.pendingProps),p=os(u.type,p),ih(t,s,u,p,i);case 15:return ah(t,s,s.type,s.pendingProps,i);case 17:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:os(u,p),Ma(t,s),s.tag=1,jn(u)?(t=!0,ga(s)):t=!1,lo(s,i),Zp(s,u,p),iu(s,u,p,i),uu(null,s,u,!0,t,i);case 19:return mh(t,s,i);case 22:return lh(t,s,i)}throw Error(r(156,s.tag))};function zh(t,s){return Je(t,s)}function Ew(t,s,i,u){this.tag=t,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zn(t,s,i,u){return new Ew(t,s,i,u)}function Ru(t){return t=t.prototype,!(!t||!t.isReactComponent)}function jw(t){if(typeof t=="function")return Ru(t)?1:0;if(t!=null){if(t=t.$$typeof,t===me)return 11;if(t===J)return 14}return 2}function ir(t,s){var i=t.alternate;return i===null?(i=Zn(t.tag,s,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=s,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&14680064,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,s=t.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i}function Va(t,s,i,u,p,m){var w=2;if(u=t,typeof t=="function")Ru(t)&&(w=1);else if(typeof t=="string")w=5;else e:switch(t){case U:return Or(i.children,p,m,s);case P:w=8,p|=8;break;case Q:return t=Zn(12,i,s,p|2),t.elementType=Q,t.lanes=m,t;case Ne:return t=Zn(13,i,s,p),t.elementType=Ne,t.lanes=m,t;case Me:return t=Zn(19,i,s,p),t.elementType=Me,t.lanes=m,t;case ee:return Ka(i,p,m,s);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case ce:w=10;break e;case ue:w=9;break e;case me:w=11;break e;case J:w=14;break e;case re:w=16,u=null;break e}throw Error(r(130,t==null?t:typeof t,""))}return s=Zn(w,i,s,p),s.elementType=t,s.type=u,s.lanes=m,s}function Or(t,s,i,u){return t=Zn(7,t,u,s),t.lanes=i,t}function Ka(t,s,i,u){return t=Zn(22,t,u,s),t.elementType=ee,t.lanes=i,t.stateNode={isHidden:!1},t}function Au(t,s,i){return t=Zn(6,t,null,s),t.lanes=i,t}function Iu(t,s,i){return s=Zn(4,t.children!==null?t.children:[],t.key,s),s.lanes=i,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}function _w(t,s,i,u,p){this.tag=s,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zo(0),this.expirationTimes=zo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zo(0),this.identifierPrefix=u,this.onRecoverableError=p,this.mutableSourceEagerHydrationData=null}function Du(t,s,i,u,p,m,w,j,D){return t=new _w(t,s,i,j,D),s===1?(s=1,m===!0&&(s|=8)):s=0,m=Zn(3,null,null,s),t.current=m,m.stateNode=t,m.memoizedState={element:u,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Kc(m),t}function Rw(t,s,i){var u=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:X,key:u==null?null:""+u,children:t,containerInfo:s,implementation:i}}function Fh(t){if(!t)return Qs;t=t._reactInternals;e:{if(We(t)!==t||t.tag!==1)throw Error(r(170));var s=t;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(jn(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(r(171))}if(t.tag===1){var i=t.type;if(jn(i))return hp(t,i,s)}return s}function Uh(t,s,i,u,p,m,w,j,D){return t=Du(i,u,!0,t,p,m,w,j,D),t.context=Fh(null),i=t.current,u=Sn(),p=rr(i),m=Ls(u,p),m.callback=s??null,er(i,m,p),t.current.lanes=p,Nr(t,p,u),An(t,u),t}function Ga(t,s,i,u){var p=s.current,m=Sn(),w=rr(p);return i=Fh(i),s.context===null?s.context=i:s.pendingContext=i,s=Ls(m,w),s.payload={element:t},u=u===void 0?null:u,u!==null&&(s.callback=u),t=er(p,s,w),t!==null&&(ls(t,p,w,m),Na(t,p,w)),w}function qa(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Bh(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i<s?i:s}}function Mu(t,s){Bh(t,s),(t=t.alternate)&&Bh(t,s)}function Aw(){return null}var Wh=typeof reportError=="function"?reportError:function(t){console.error(t)};function Lu(t){this._internalRoot=t}Xa.prototype.render=Lu.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(r(409));Ga(t,s,null,null)},Xa.prototype.unmount=Lu.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;Dr(function(){Ga(null,t,null,null)}),s[Rs]=null}};function Xa(t){this._internalRoot=t}Xa.prototype.unstable_scheduleHydration=function(t){if(t){var s=Te();t={blockedOn:null,target:t,priority:s};for(var i=0;i<Ks.length&&s!==0&&s<Ks[i].priority;i++);Ks.splice(i,0,t),i===0&&_f(t)}};function Ou(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Ya(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Hh(){}function Iw(t,s,i,u,p){if(p){if(typeof u=="function"){var m=u;u=function(){var K=qa(w);m.call(K)}}var w=Uh(s,u,t,0,null,!1,!1,"",Hh);return t._reactRootContainer=w,t[Rs]=w.current,Qo(t.nodeType===8?t.parentNode:t),Dr(),w}for(;p=t.lastChild;)t.removeChild(p);if(typeof u=="function"){var j=u;u=function(){var K=qa(D);j.call(K)}}var D=Du(t,0,!1,null,null,!1,!1,"",Hh);return t._reactRootContainer=D,t[Rs]=D.current,Qo(t.nodeType===8?t.parentNode:t),Dr(function(){Ga(s,D,i,u)}),D}function Qa(t,s,i,u,p){var m=i._reactRootContainer;if(m){var w=m;if(typeof p=="function"){var j=p;p=function(){var D=qa(w);j.call(D)}}Ga(s,w,t,p)}else w=Iw(i,s,t,p,u);return qa(w)}C=function(t){switch(t.tag){case 3:var s=t.stateNode;if(s.current.memoizedState.isDehydrated){var i=Sr(s.pendingLanes);i!==0&&(Vs(s,i|1),An(s,bt()),(Qe&6)===0&&(ho=bt()+500,Zs()))}break;case 13:Dr(function(){var u=Ms(t,1);if(u!==null){var p=Sn();ls(u,t,1,p)}}),Mu(t,1)}},B=function(t){if(t.tag===13){var s=Ms(t,134217728);if(s!==null){var i=Sn();ls(s,t,134217728,i)}Mu(t,134217728)}},te=function(t){if(t.tag===13){var s=rr(t),i=Ms(t,s);if(i!==null){var u=Sn();ls(i,t,s,u)}Mu(t,s)}},Te=function(){return Xe},Re=function(t,s){var i=Xe;try{return Xe=t,s()}finally{Xe=i}},Kt=function(t,s,i){switch(s){case"input":if(Vt(t,i),s=i.name,i.type==="radio"&&s!=null){for(i=t;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<i.length;s++){var u=i[s];if(u!==t&&u.form===t.form){var p=ha(u);if(!p)throw Error(r(90));he(u),Vt(u,p)}}}break;case"textarea":ve(t,i);break;case"select":s=i.value,s!=null&&Ft(t,!!i.multiple,s,!1)}},yt=Eu,xt=Dr;var Dw={usingClientEntryPoint:!1,Events:[ei,eo,ha,ft,Gt,Eu]},hi={findFiberByHostInstance:Tr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Mw={bundleType:hi.bundleType,version:hi.version,rendererPackageName:hi.rendererPackageName,rendererConfig:hi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:M.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Pn(t),t===null?null:t.stateNode},findFiberByHostInstance:hi.findFiberByHostInstance||Aw,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Za=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Za.isDisabled&&Za.supportsFiber)try{wr=Za.inject(Mw),zn=Za}catch{}}return In.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Dw,In.createPortal=function(t,s){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ou(s))throw Error(r(200));return Rw(t,s,null,i)},In.createRoot=function(t,s){if(!Ou(t))throw Error(r(299));var i=!1,u="",p=Wh;return s!=null&&(s.unstable_strictMode===!0&&(i=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onRecoverableError!==void 0&&(p=s.onRecoverableError)),s=Du(t,1,!1,null,null,i,!1,u,p),t[Rs]=s.current,Qo(t.nodeType===8?t.parentNode:t),new Lu(s)},In.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=Pn(s),t=t===null?null:t.stateNode,t},In.flushSync=function(t){return Dr(t)},In.hydrate=function(t,s,i){if(!Ya(s))throw Error(r(200));return Qa(null,t,s,!0,i)},In.hydrateRoot=function(t,s,i){if(!Ou(t))throw Error(r(405));var u=i!=null&&i.hydratedSources||null,p=!1,m="",w=Wh;if(i!=null&&(i.unstable_strictMode===!0&&(p=!0),i.identifierPrefix!==void 0&&(m=i.identifierPrefix),i.onRecoverableError!==void 0&&(w=i.onRecoverableError)),s=Uh(s,null,t,1,i??null,p,!1,m,w),t[Rs]=s.current,Qo(t),u)for(t=0;t<u.length;t++)i=u[t],p=i._getVersion,p=p(i._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[i,p]:s.mutableSourceEagerHydrationData.push(i,p);return new Xa(s)},In.render=function(t,s,i){if(!Ya(s))throw Error(r(200));return Qa(null,t,s,!1,i)},In.unmountComponentAtNode=function(t){if(!Ya(t))throw Error(r(40));return t._reactRootContainer?(Dr(function(){Qa(null,null,t,!1,function(){t._reactRootContainer=null,t[Rs]=null})}),!0):!1},In.unstable_batchedUpdates=Eu,In.unstable_renderSubtreeIntoContainer=function(t,s,i,u){if(!Ya(i))throw Error(r(200));if(t==null||t._reactInternals===void 0)throw Error(r(38));return Qa(t,s,i,!1,u)},In.version="18.3.1-next-f1338f8080-20240426",In}var Zh;function tv(){if(Zh)return zu.exports;Zh=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),zu.exports=Ww(),zu.exports}var Jh;function Hw(){if(Jh)return Ja;Jh=1;var e=tv();return Ja.createRoot=e.createRoot,Ja.hydrateRoot=e.hydrateRoot,Ja}var Vw=Hw();const Kw=ev(Vw),em=e=>{let n;const r=new Set,o=(g,v)=>{const k=typeof g=="function"?g(n):g;if(!Object.is(k,n)){const x=n;n=v??(typeof k!="object"||k===null)?k:Object.assign({},n,k),r.forEach(S=>S(n,x))}},a=()=>n,f={setState:o,getState:a,getInitialState:()=>h,subscribe:g=>(r.add(g),()=>r.delete(g))},h=n=e(o,a,f);return f},Gw=(e=>e?em(e):em),qw=e=>e;function Xw(e,n=qw){const r=ct.useSyncExternalStore(e.subscribe,ct.useCallback(()=>n(e.getState()),[e,n]),ct.useCallback(()=>n(e.getInitialState()),[e,n]));return ct.useDebugValue(r),r}const Yw=e=>{const n=Gw(e),r=o=>Xw(n,o);return Object.assign(r,n),r},Qw=(e=>Yw),nv="agentpane:machines",sv="agentpane:active-machine";function Zw(e){return/^[a-z][a-z0-9-]{1,30}$/.test(e)}function rv(e){return`${e}.repoburg.com`}function ov(e){const n=/^([a-z][a-z0-9-]{1,30})\.repoburg\.com$/.exec(e);return n?n[1]:null}function iv(e,n){try{const r=localStorage.getItem(e);return r==null?n:JSON.parse(r)}catch{return n}}function av(e,n){try{localStorage.setItem(e,JSON.stringify(n))}catch{}}function Jw(e){const{mahlas:n,hostname:r}=e??{};return typeof n=="string"&&Zw(n)&&r===rv(n)}function lv(){const e=iv(nv,[]);return Array.isArray(e)?e.filter(Jw):[]}function e0(e){const n={mahlas:e,hostname:rv(e),lastConnectedAt:new Date().toISOString()},r=lv(),o=[n,...r.filter(a=>a.mahlas!==e)];return av(nv,o),n}function t0(){const e=iv(sv,null);return e?lv().find(n=>n.mahlas===e)??null:null}function n0(e){av(sv,e)}function s0(){if(typeof window>"u")return;const e=new URLSearchParams(window.location.search).get("host");if(!e)return;const n=ov(e);n&&(e0(n),n0(n))}const tm="http://localhost:9998",r0=["agent.repoburg.com"];function mn(){if(typeof window>"u")return"";const e=new URLSearchParams(window.location.search),n=e.get("bport");if(n)return`http://localhost:${n}`;const r=e.get("host");if(r)return`https://${r}`;const o=window.location.hostname;if(r0.includes(o))return tm;if(ov(o))return"";const a=t0();return a?`https://${a.hostname}`:o==="localhost"||o==="127.0.0.1"||o==="0.0.0.0"?"":tm}function o0(e){const n=mn();return n?`${n.replace(/^http/,"ws")}${e}`:`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${e}`}const i0="/api";class Ui extends Error{constructor(r,o,a){super(r);at(this,"status");at(this,"body");this.name="ApiError",this.status=o,this.body=a}}function hr(e){var n;if(e instanceof Ui){const r=(n=e.body)==null?void 0:n.error;if(typeof r=="string"&&r)return r}return e instanceof Error?e.message:String(e)}async function Bi(e,n,r){const o=await fetch(`${mn()}${i0}${n}`,{method:e,headers:r?{"Content-Type":"application/json"}:void 0,body:r?JSON.stringify(r):void 0});if(!o.ok){let a=`${o.status} ${o.statusText}`,c=null;try{c=await o.json();const d=c==null?void 0:c.error;typeof d=="string"&&d&&(a=`${a} — ${d}`)}catch{}throw new Ui(`${e} ${n} failed: ${a}`,o.status,c)}return o.json()}function kt(e){return Bi("GET",e)}function st(e,n){return Bi("POST",e,n)}function Hl(e){return Bi("DELETE",e)}function ds(e,n){return Bi("PATCH",e,n)}function a0(e,n){return Bi("PUT",e,n)}const Ts=new Map;function Hd(e,n,r){return`${e}
|
|
42
|
+
${n}
|
|
43
|
+
${r}`}function l0(e,n,r,o){const a=Hd(e,n,r),c=Ts.get(a);return c?(c.text+=o,c.text):(Ts.set(a,{sessionId:e,turnId:n,itemId:r,text:o}),o)}function c0(e,n){for(const[o,a]of Ts)(e===null||a.sessionId===e)&&Ts.delete(o);const r=n.filter(o=>o&&typeof o.sessionId=="string"&&typeof o.turnId=="string"&&typeof o.itemId=="string"&&typeof o.text=="string");for(const o of r)Ts.set(Hd(o.sessionId,o.turnId,o.itemId),{...o});return r}function Bu(e,n,r){var c;const o=r==null?void 0:r.external_item_id;if(!r||!o)return;const a=Hd(e,n,o);if(r.status==="in_progress"){const d=(c=r.data)==null?void 0:c.text;typeof d=="string"&&Ts.set(a,{sessionId:e,turnId:n,itemId:o,text:d});return}Ts.delete(a)}function gi(e,n){for(const[r,o]of Ts)o.sessionId===e&&o.turnId===n&&Ts.delete(r)}function cv(e,n,r){var f;const o=e.items??[];let a=-1;for(let h=o.length-1;h>=0;h--)if(o[h].external_item_id===n){a=h;break}if(a>=0){const h=o[a];if(h.status!=="in_progress"||((f=h.data)==null?void 0:f.text)===r)return e;const g=[...o];return g[a]={...h,data:{...h.data,text:r}},{...e,items:g,...h.type==="agent_message"?{agent_response:r}:{}}}const c=new Date().toISOString(),d={id:`delta-${n}`,turn_id:e.id,external_item_id:n,type:"agent_message",data:{text:r},status:"in_progress",created_at:c,updated_at:c};return{...e,items:[...o,d],agent_response:r}}function u0(e){var d;const n=[...Ts.values()].filter(f=>f.sessionId===e.id);if(n.length===0)return e;const r=f=>{if(f.status!=="running")return f;let h=f;for(const g of n)g.turnId===f.id&&(h=cv(h,g.itemId,g.text));return h},o=(e.turns??[]).map(r),a=(d=e.threads)==null?void 0:d.map(f=>{const h=(f.turns??[]).map(r);return h.some((g,v)=>{var k;return g!==((k=f.turns)==null?void 0:k[v])})?{...f,turns:h}:f});return o.some((f,h)=>f!==e.turns[h])||(a==null?void 0:a.some((f,h)=>{var g;return f!==((g=e.threads)==null?void 0:g[h])}))?{...e,turns:o,...a?{threads:a}:{}}:e}function d0(){return kt("/sessions")}function vi(e){return kt(`/sessions/${e}?items=summary`).then(u0)}function f0(e,n){return kt(`/sessions/${e}/turns/${n}`)}function Vd(e){return st("/sessions",e)}function nm(e){return Hl(`/sessions/${e}`)}function uv(e,n,r,o){return st(`/sessions/${e}/turns`,{user_prompt:n,...r!=null&&r.length?{attachments:r}:{},...o!=null&&o.originAppId?{origin_app_id:o.originAppId}:{}})}function p0(e){return st(`/sessions/${e}/cancel`)}function h0(e,n){return st(`/sessions/${encodeURIComponent(e)}/tasks/${encodeURIComponent(n)}/stop`)}function m0(e,n){return st(`/sessions/${e}/turns/${n}/resume`)}function g0(){return st("/turns/resume-signed-out")}function v0(e,n){return ds(`/sessions/${e}`,{title:n})}function sm(e){return ds(`/sessions/${e}`,{lifecycle:"finished"})}function rm(e){return ds(`/sessions/${e}`,{lifecycle:"working"})}function y0(e,n){return ds(`/sessions/${e}`,{starred:n})}function om(e){return ds(`/sessions/${e}`,{has_unreviewed:0})}function x0(e,n,r,o){const a={model:n,model_reasoning_effort:r};return o!==void 0&&(a.runtime_type=o),ds(`/sessions/${e}`,a)}function w0(e,n){return ds(`/sessions/${e}`,{runtime_config:n})}function k0(e,n){return st(`/sessions/${e}/rewind`,{turn_id:n})}function S0(e){return st(`/sessions/${e}/restore`,{})}function b0(e,n,r){return st(`/sessions/${e}/branch`,{turn_id:n,title:r})}function dv(){return kt("/workspaces")}function N0(e,n){return st("/workspaces",{path:e,label:n})}function T0(e){return st("/workspaces/hide",{path:e})}function C0(){return kt("/workspaces/picker")}function im(e){return kt(e?`/workspaces/browse?path=${encodeURIComponent(e)}`:"/workspaces/browse")}async function fv(){const e=await fetch(`${mn()}/api/pick-directory`);if(e.status===204)return{cancelled:!0};if(!e.ok)throw new Error(`GET /api/pick-directory failed: ${e.status} ${e.statusText}`);return e.json()}function pv(){return kt("/folders")}function E0(e,n){return st("/folders",{workspace_path:e,name:n})}function am(e,n){return ds(`/folders/${e}`,n)}function j0(e){return Hl(`/folders/${e}`)}function _0(e){return st("/sessions/reorder",{moves:e})}function Fs(e){return e.status==="pending"||e.status==="running"}function hv(e){return!!(e!=null&&e.turns.some(Fs))}function Vl(e){return e?e.turns.some(Fs)||(e.threads??[]).some(n=>(n.turns??[]).some(Fs)):!1}const R0="s:",md="a:",Fr=e=>`${R0}${e}`,Ii=e=>`${md}${e}`;function mr(e){return{kind:e.startsWith(md)?"app":"session",id:e.slice(md.length)}}function Kd(e){return e.activeAppTabId!==null?Ii(e.activeAppTabId):e.activeSessionId===null?null:Fr(e.activeSessionId)}function mv(e,n,r){const o=[...n.map(Fr),...r.map(Ii)],a=new Set(o),c=e.filter(h=>a.has(h)),d=new Set(c),f=o.filter(h=>!d.has(h));return f.length===0&&c.length===e.length?e:[...c,...f]}function A0(e){return e.subscribe((n,r)=>{if(n.openTabs===r.openTabs&&n.openAppTabs===r.openAppTabs)return;const o=mv(n.tabOrder,n.openTabs,n.openAppTabs);o!==n.tabOrder&&e.setState({tabOrder:o})})}function lm(e,n,r){const o=e.indexOf(n);return e.slice(o+1).find(r)??e.slice(0,Math.max(o,0)).reverse().find(r)??null}function Gd(e,n){const r=d=>!n.has(d),o=Kd(e);let{activeSessionId:a,activeAppTabId:c}=e;if(o!==null&&n.has(o)){const d=lm(e.tabOrder,o,r),f=d===null?null:mr(d);c=(f==null?void 0:f.kind)==="app"?f.id:null,(f==null?void 0:f.kind)==="session"&&(a=f.id)}if(a!==null&&n.has(Fr(a))){const d=h=>r(h)&&mr(h).kind==="session",f=lm(e.tabOrder,Fr(a),d);a=f===null?null:mr(f).id}return{activeSessionId:a,activeAppTabId:c}}function gv(e,n){if(e.tabOrder.includes(n))return!1;const{kind:r,id:o}=mr(n);return(r==="app"?e.apps:e.sessions).some(c=>c.id===o)}const vv=1;function yv(){let e="";try{e=mn()}catch{}return`agentpane:tabs:${e||window.location.origin}`}function Wu(e){return Array.isArray(e)&&e.every(n=>typeof n=="string")}function cm(e){return e===null||typeof e=="string"}function I0(e){if(e==null)return null;let n;try{n=JSON.parse(e)}catch{return null}if(typeof n!="object"||n===null)return null;const r=n;return r.v!==vv||!Wu(r.openTabs)||!cm(r.activeSessionId)||!Wu(r.openAppTabs)||!cm(r.activeAppTabId)?null:{openTabs:r.openTabs,activeSessionId:r.activeSessionId,openAppTabs:r.openAppTabs,activeAppTabId:r.activeAppTabId,tabOrder:Wu(r.tabOrder)?r.tabOrder:[]}}const xv=[()=>window.sessionStorage,()=>window.localStorage];function D0(){const e=yv();for(const n of xv)try{const r=I0(n().getItem(e));if(r)return r}catch{}return null}function M0(e){const n=yv(),r=JSON.stringify({v:vv,openTabs:e.openTabs,activeSessionId:e.activeSessionId,openAppTabs:e.openAppTabs,activeAppTabId:e.activeAppTabId,tabOrder:e.tabOrder});for(const o of xv)try{o().setItem(n,r)}catch{}}function L0(e){return e.subscribe((n,r)=>{(n.openTabs!==r.openTabs||n.activeSessionId!==r.activeSessionId||n.openAppTabs!==r.openAppTabs||n.activeAppTabId!==r.activeAppTabId||n.tabOrder!==r.tabOrder)&&M0(n)})}function Ci(e){return[...new Set(e)]}function O0(e,n,r,o){const a=v=>r===null||r.has(v),c=Ci(((e==null?void 0:e.openTabs)??[]).filter(v=>n.has(v))),d=Ci(((e==null?void 0:e.openAppTabs)??[]).filter(a));let f=(e==null?void 0:e.activeSessionId)??null;f!==null&&!n.has(f)&&(f=null),f!==null&&!c.includes(f)&&c.push(f),f??(f=c.at(-1)??null);let h=(e==null?void 0:e.activeAppTabId)??null;h!==null&&!a(h)&&(h=null),h!==null&&!d.includes(h)&&d.push(h),o!==null&&n.has(o)&&(c.includes(o)||c.push(o),f=o,h=null);const g=mv(Ci((e==null?void 0:e.tabOrder)??[]),c,d);return{openTabs:c,activeSessionId:f,openAppTabs:d,activeAppTabId:h,tabOrder:g}}const Us=new Map,qd=new Map,Kl=new Map,kl=new Set,Xd=new Map,Gl=new Map;function $0(e,n,r=""){Us.set(e,n),qd.set(e,r)}function P0(e){Us.delete(e),qd.delete(e)}function dl(e,n){Kl.set(e,n)}function z0(e,n){n?kl.add(e):kl.delete(e)}function um(e,n,r){const o=Kl.get(e);if(!o||kl.has(o))return;const a=Us.get(o);a&&a({source:"agentpane-host",event:n,payload:r})}function dm(e,n){const r=Kl.get(e);if(!r||kl.has(r))return;const o=Us.get(r);o&&o({source:"agentpane-host",event:"background_tasks",payload:{sessionId:e,tasks:n}})}function F0(e,n,r,o,a,c=null){if(typeof a=="string"&&a!==qd.get(e))return;const d=Us.get(e);d&&d({source:"agentpane-host",event:"tool_call",payload:{callId:n,tool:r,name:r,args:o,caller:c}})}function U0(e,n,r,o){const a=Kl.get(e);if(!a)return;const c=Us.get(a);c&&c({source:"agentpane-host",event:"turn:delta",payload:{sessionId:e,turnId:n,itemId:r,delta:o}})}function B0(e,n){Xd.set(e,n)}function W0(e){Xd.delete(e)}function H0(e,n){Gl.set(e,n)}function V0(e){Gl.delete(e)}function wv(e,n={}){const r=Gl.get(e);if(r){r(n);return}const o=Us.get(e);o&&o({source:"agentpane-host",event:"state_changed",payload:{}})}function K0(){for(const e of new Set([...Us.keys(),...Gl.keys()]))wv(e)}function G0(e){var r;const n=Us.get(e);n&&n({source:"agentpane-host",event:"source:updated",payload:{}}),(r=Xd.get(e))==null||r()}const q0=(e,n)=>({wsConnected:!1,backgroundTasks:{},retryStates:{},signedOutTurns:{},setWsConnected:r=>e({wsConnected:r}),onTurnCreated:(r,o)=>{e(a=>{const c=a.sessionDetails[r];return!c||o.thread_id?{}:c.turns.some(d=>d.id===o.id)?{}:{sessionDetails:{...a.sessionDetails,[r]:{...c,turns:[...c.turns,{...o,items:[]}]}}}})},onTurnStarted:(r,o)=>{n().addLogEntry("DEBUG",`turn:started — ${o.slice(0,8)}`),e(a=>{const c=cr(a.sessions,r,()=>({is_running:1,status:"running"})),d=a.sessionDetails[r];if(!d)return{sessions:c};const f=d.turns.findIndex(h=>h.id===o);return{sessionDetails:{...a.sessionDetails,[r]:{...bn(d,o,h=>({...h,status:"running"})),is_running:1,status:"running"}},sessions:c,activeTurnIndex:a.activeSessionId===r&&f>=0?f:a.activeTurnIndex}})},onItemStarted:(r,o,a)=>{n().addLogEntry("DEBUG",`item:started — ${a.type}`),e(c=>{const d=fm(a)?lr(c.retryStates,o):c.retryStates,f=c.sessionDetails[r];return f?{sessionDetails:{...c.sessionDetails,[r]:bn(f,o,h=>Vu(h,a))},retryStates:d}:{retryStates:d}})},onItemUpdated:(r,o,a)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:bn(d,o,f=>Vu(f,a))}}:{}})},onItemCompleted:(r,o,a)=>{if(n().addLogEntry("DEBUG",`item:completed — ${a.type}`),a.type==="background_task"&&(a.status==="completed"||a.status==="failed")){const c=a.data||{},d=c.task_type||"unknown",f=c.description||"background task",g=d==="local_agent"?"Subagent":d==="local_bash"?"Monitor":"Task";a.status==="completed"?n().addToast("success",`${g} completed: ${f}`):c.status!=="stopped"&&n().addToast("error",`${g} failed: ${f}`)}e(c=>{const d=fm(a)?lr(c.retryStates,o):c.retryStates,f=c.sessionDetails[r];return f?{retryStates:d,sessionDetails:{...c.sessionDetails,[r]:bn(f,o,h=>{var v,k;let g=Vu(h,a);if(a.type==="agent_message"&&((v=a.data)!=null&&v.text)&&(g={...g,agent_response:a.data.text}),a.type==="reasoning"&&((k=a.data)!=null&&k.text)){const x=g.thoughts?g.thoughts+`
|
|
44
|
+
`+a.data.text:a.data.text;g={...g,thoughts:x}}return g})}}:{retryStates:d}})},onItemDelta:(r,o,a,c,d)=>{U0(r,o,a,c),e(f=>{const h=lr(f.retryStates,o),g=f.sessionDetails[r];return g?{sessionDetails:{...f.sessionDetails,[r]:bn(g,o,v=>Z0(v,a,c,d))},retryStates:h}:{retryStates:h}})},onItemText:(r,o,a,c)=>{e(d=>{const f=d.sessionDetails[r];if(!f)return{};const h=bn(f,o,g=>g.status==="running"?cv(g,a,c):g);return{sessionDetails:{...d.sessionDetails,[r]:h}}})},onWidgetDelta:(r,o,a,c,d)=>{e(f=>{const h=lr(f.retryStates,o),g=f.sessionDetails[r];return g?{sessionDetails:{...f.sessionDetails,[r]:bn(g,o,v=>Q0(v,a,c,d))},retryStates:h}:{retryStates:h}})},onTurnCompleted:(r,o,a,c,d)=>{n().dropSignedOutTurn(o);const f=(a==null?void 0:a.input_tokens)??0,h=(a==null?void 0:a.output_tokens)??0;n().addLogEntry("INFO",`turn:completed — ${f} in / ${h} out`),um(r,"turn:completed",{sessionId:r,turnId:o,response:d??null}),n().refreshApps(),e(g=>{const v=g.sessionDetails[r],k=v?bn(v,o,T=>({...T,status:"completed",token_usage:a??T.token_usage??null,...d&&!T.agent_response?{agent_response:d}:{}})):null,x=Hu(k),S=x&&k?el(k):"active",E=cr(g.sessions,r,T=>({is_running:x,status:S,has_unreviewed:c?1:T.has_unreviewed})),b=lr(g.retryStates,o);return k?{sessionDetails:{...g.sessionDetails,[r]:{...k,is_running:x,status:S,has_unreviewed:c?1:k.has_unreviewed}},sessions:E,retryStates:b}:{sessions:E,retryStates:b}})},onTokenUsageUpdated:(r,o,a)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:bn(d,o,f=>({...f,token_usage:a}))}}:{}})},onContextUsageUpdated:(r,o)=>{e(a=>{const c=a.sessionDetails[r];return c?{sessionDetails:{...a.sessionDetails,[r]:{...c,contextUsage:o}}}:{}})},onTurnFailed:(r,o,a,c)=>{n().dropSignedOutTurn(o),n().addLogEntry("ERROR",`turn:failed — ${a}`),n().addToast("error",`Turn failed — ${a}`),um(r,"turn:failed",{sessionId:r,turnId:o,error:a}),e(d=>{const f=d.sessionDetails[r],h=a.includes("cancelled")||a.includes("aborted"),g=h?"aborted":"failed",v=f?bn(f,o,b=>({...b,status:g,error:a,...c?{resume_state:c}:{},items:b.items.map(T=>T.status==="in_progress"?{...T,status:"failed"}:T)})):null,k=Hu(v),x=k&&v?el(v):h?"active":"failed",S=cr(d.sessions,r,()=>({is_running:k,status:x})),E=lr(d.retryStates,o);return v?{sessionDetails:{...d.sessionDetails,[r]:{...v,is_running:k,status:x}},sessions:S,retryStates:E}:{sessions:S,retryStates:E}})},onTurnCancelled:(r,o)=>{n().dropSignedOutTurn(o),e(a=>{const c=a.sessionDetails[r],d=c?bn(c,o,k=>({...k,status:"aborted",...k.resume_state==="waiting"||k.resume_state==="resuming"?{resume_state:"cancelled"}:{},items:k.items.map(x=>x.status==="in_progress"?{...x,status:"completed"}:x)})):null,f=Hu(d),h=f&&d?el(d):"active",g=cr(a.sessions,r,()=>({is_running:f,status:h})),v=lr(a.retryStates,o);return d?{sessionDetails:{...a.sessionDetails,[r]:{...d,is_running:f,status:h}},sessions:g,retryStates:v}:{sessions:g,retryStates:v}})},onTurnInterrupted:(r,o,a)=>{n().addLogEntry("WARN",`turn:interrupted — ${a.reason}${a.detail?` (${a.detail})`:""}`),n().addToast("warn",X0(a.reason)),a.reason==="auth"?e(c=>({signedOutTurns:{...c.signedOutTurns,[o]:r}})):n().dropSignedOutTurn(o),e(c=>{const d=c.sessionDetails[r],f=d?bn(d,o,k=>({...k,status:"pending",error:null,resume_state:"waiting",interrupt_reason:a.reason,interrupted_at:a.interruptedAt,resume_attempts:a.attempts,resume_at:a.resumeAt??null})):null,h=f?el(f):"interrupted",g=cr(c.sessions,r,()=>({is_running:1,status:h})),v=lr(c.retryStates,o);return f?{sessionDetails:{...c.sessionDetails,[r]:{...f,is_running:1,status:h}},sessions:g,retryStates:v}:{sessions:g,retryStates:v}})},onTurnResuming:(r,o,a)=>{n().dropSignedOutTurn(o),n().addLogEntry("INFO",`turn:resuming — ${o.slice(0,8)} (attempt ${a})`),e(c=>{const d=cr(c.sessions,r,()=>({is_running:1,status:"running"})),f=c.sessionDetails[r];return f?{sessionDetails:{...c.sessionDetails,[r]:{...bn(f,o,h=>({...h,status:"running",error:null,resume_state:"resuming",resume_attempts:a})),is_running:1,status:"running"}},sessions:d}:{sessions:d}})},onTurnResumed:(r,o)=>{n().addLogEntry("INFO",`turn:resumed — ${o.slice(0,8)}`),n().addToast("success","Interrupted turn resumed"),e(a=>{const c=a.sessionDetails[r];return c?{sessionDetails:{...a.sessionDetails,[r]:bn(c,o,d=>({...d,resume_state:"resumed"}))}}:{}})},onTurnRetrying:(r,o,a)=>{n().addLogEntry("WARN",`turn:retrying — ${r.slice(0,8)}/${o.slice(0,8)} attempt ${a.attempt}/${a.maxRetries} (${a.errorStatus??"no response"}${a.error?`, ${a.error}`:""})`),e(c=>({retryStates:{...c.retryStates,[o]:a}}))},onSessionTitle:(r,o)=>{e(a=>({sessions:a.sessions.map(c=>c.id===r?{...c,title:o}:c),sessionDetails:a.sessionDetails[r]?{...a.sessionDetails,[r]:{...a.sessionDetails[r],title:o}}:a.sessionDetails}))},onSessionTouched:r=>{e(o=>{const a=o.sessionDetails[r];return{sessions:cr(o.sessions,r,()=>({user_touched:1})),sessionDetails:a?{...o.sessionDetails,[r]:{...a,user_touched:1}}:o.sessionDetails}})},onSessionUpdated:r=>{const o={...r};delete o.is_running,delete o.status,e(a=>{const c=a.sessionDetails[r.id];return{sessions:cr(a.sessions,r.id,()=>o),sessionDetails:c?{...a.sessionDetails,[r.id]:{...c,...o}}:a.sessionDetails}})},onBackgroundTasksChanged:(r,o)=>{dm(r,o),e(a=>{if(o.length===0&&!a.backgroundTasks[r])return{};const c={...a.backgroundTasks};return o.length>0?c[r]=o:delete c[r],{backgroundTasks:c}})},onSignedOutTurnsSnapshot:r=>e({signedOutTurns:Object.fromEntries(r.map(o=>[o.turnId,o.sessionId]))}),dropSignedOutTurn:r=>{if(!(r in n().signedOutTurns))return;const o={...n().signedOutTurns};delete o[r],e({signedOutTurns:o})},onBackgroundTasksSnapshot:r=>{for(const[a,c]of Object.entries(r))dm(a,c);const o={};for(const[a,c]of Object.entries(r))c.length>0&&(o[a]=c);e({backgroundTasks:o})}});function X0(e){switch(e){case"network":return"Network error — the turn will resume when the connection is back";case"process_exit":return"The agent process stopped — resuming the turn";case"auth":return"Claude is signed out — the turn waits until you sign in again";case"usage_limit":return"Usage limit reached — the turn waits until it is over";default:return"The agent host restarted — resuming the turn"}}function el(e){const n=[...e.turns,...(e.threads??[]).flatMap(r=>r.turns??[])].filter(Fs);return n.length>0&&n.every(r=>r.status==="pending"&&r.resume_state==="waiting")?"interrupted":"running"}function fm(e){return e.type!=="background_task"&&e.type!=="error"&&e.type!=="interruption"}function lr(e,n){if(!(n in e))return e;const r={...e};return delete r[n],r}function Hu(e){return e&&(e.turns.some(Fs)||(e.threads??[]).some(r=>(r.turns??[]).some(Fs)))?1:0}function cr(e,n,r){return e.some(o=>o.id===n)?e.map(o=>o.id===n?{...o,...r(o)}:o):e}function bn(e,n,r){const o=(e.threads??[]).map(a=>(a.turns??[]).some(c=>c.id===n)?{...a,turns:(a.turns??[]).map(c=>c.id===n?r(c):c)}:a);return{...e,turns:e.turns.map(a=>a.id===n?r(a):a),threads:o}}function Yd(e,n){for(let r=e.length-1;r>=0;r--)if(e[r].external_item_id===n)return r;return-1}function Vu(e,n){const r=Yd(e.items,n.external_item_id);if(r>=0){const c=[...e.items];return c[r]=n,{...e,items:c}}if(n.type==="agent_message"){const c=e.items.filter(d=>!(d.type==="agent_message"&&d.id.startsWith("delta-")));return{...e,items:[...c,n]}}const o=e.items;let a=o.length;if(e.deferred_item_count)for(;a>0&&o[a-1].created_at>n.created_at;)a--;return{...e,items:[...o.slice(0,a),n,...o.slice(a)]}}function Y0(e,n){const r=c=>c.external_item_id??c.id,o=new Map(e.items.map(c=>[r(c),c])),a=n.map(c=>{var f;const d=o.get(r(c));return o.delete(r(c)),d&&((f=d.data)==null?void 0:f.partial)!==!0&&d.updated_at>c.updated_at?d:c});return{...e,items:[...a,...o.values()],deferred_item_count:0,deferred_tool_calls:0}}function Q0(e,n,r,o){var f;const a=new Date().toISOString(),c=Yd(e.items,n);if(c>=0){const h=e.items[c];if(((f=h.data)==null?void 0:f.partial)!==!0||h.data.title===r&&h.data.html===o)return e;const g=[...e.items];return g[c]={...h,data:{...h.data,title:r,html:o},updated_at:a},{...e,items:g}}const d={id:`delta-${n}`,turn_id:e.id,external_item_id:n,type:"widget",data:{title:r,html:o,error:null,partial:!0},status:"in_progress",created_at:a,updated_at:a};return{...e,items:[...e.items,d]}}function Z0(e,n,r,o){var d;const a=Yd(e.items,n);if(a>=0){const f=e.items[a],h=((d=f.data)==null?void 0:d.text)??"",g=o??h+r,v=[...e.items];return v[a]={...f,data:{...f.data,text:g}},{...e,items:v,agent_response:g}}const c={id:`delta-${n}`,turn_id:e.id,external_item_id:n,type:"agent_message",data:{text:o??r},status:"in_progress",created_at:new Date().toISOString(),updated_at:new Date().toISOString()};return{...e,items:[...e.items,c],agent_response:o??r}}function J0(){const e=new URLSearchParams(window.location.search);return{session:e.get("session"),thread:e.get("thread")}}function ek(){const e=new URL(window.location.href);!e.searchParams.has("session")&&!e.searchParams.has("thread")||(e.searchParams.delete("session"),e.searchParams.delete("thread"),window.history.replaceState(window.history.state,"",e))}let Ku=0;function pm(e){return e==="sidecar"?"sidecar":"turns"}async function tk(e,n){const r=await Promise.allSettled(e.map(c=>n(c))),o=new Map;let a=null;return r.forEach((c,d)=>{var f;c.status==="fulfilled"?o.set(e[d],c.value):a===null&&(a=((f=c.reason)==null?void 0:f.message)??"Request failed")}),{updated:o,firstError:a}}function nk(e,n){const r={...e.sessionDetails};n.forEach(h=>delete r[h]);const o={...e.backgroundTasks};n.forEach(h=>delete o[h]);const a=Object.fromEntries(Object.entries(e.signedOutTurns).filter(([,h])=>!n.has(h))),c=e.openTabs.filter(h=>!n.has(h)),d=Gd(e,new Set([...n].map(Fr)));let f=e.activeTurnIndex;if(d.activeSessionId!==e.activeSessionId){const h=d.activeSessionId?r[d.activeSessionId]:null;f=h&&h.turns.length>0?h.turns.length-1:0}return{sessions:e.sessions.filter(h=>!n.has(h.id)),sessionDetails:r,backgroundTasks:o,signedOutTurns:a,openTabs:c,...d,activeTurnIndex:f}}function sk(e){const n={...e};return delete n.turns,delete n.threads,delete n.contextUsage,n}function hm(e,n,r){const o=n().activeSessionId;e(c=>nk(c,r));const a=n().activeSessionId;a&&a!==o&&n().selectSession(a,{keepAppView:!0})}async function mm(e,n,r,o,a){if(r.length===0)return;e({error:null});const{updated:c,firstError:d}=await tk(r,o);c.size>0&&e(h=>({sessions:h.sessions.map(g=>c.get(g.id)??g)}));const f=r.length-c.size;if(f===0)n().addToast("info",`${r.length} session${r.length===1?"":"s"} ${a}`);else{e({error:d});const h=a[0].toUpperCase()+a.slice(1);n().addToast(f===r.length?"error":"warn",`${h} ${c.size} of ${r.length} — ${f} failed`)}}const Gu=new Map,rk=(e,n)=>({sessions:[],sessionDetails:{},activeSessionId:null,openTabs:[],activeTurnIndex:0,submittingPrompt:null,quotedText:null,init:async()=>{const r=J0(),o=D0();try{const a=localStorage.getItem("agentpane:last-model-config");a&&e({lastModelConfig:JSON.parse(a)})}catch{}e({loading:!0,error:null});try{const a=n().loadApps(),[c,d,f]=await Promise.all([d0(),dv(),pv()]);e({sessions:c,workspaces:d,folders:f,loading:!1}),ek();const h=await a,g=O0(o,new Set(c.map(v=>v.id)),h?new Set(n().apps.map(v=>v.id)):null,r.session);e(v=>{const k=v.activeSessionId!==null||v.activeAppTabId!==null;return{openTabs:Ci([...g.openTabs,...v.openTabs]),openAppTabs:Ci([...g.openAppTabs,...v.openAppTabs]),tabOrder:g.tabOrder,activeAppTabId:k?v.activeAppTabId:g.activeAppTabId}}),g.activeSessionId&&!n().activeSessionId&&await n().selectSession(g.activeSessionId,{keepAppView:!0}),r.thread&&(e({deepLinkThreadId:r.thread}),n().switchRightTab("threads"))}catch(a){e({loading:!1,error:a.message})}},selectSession:async(r,o)=>{const a=++Ku,c=o!=null&&o.keepAppView?{}:{activeAppTabId:null},d=f=>f.includes(r)?f:[...f,r];if(n().sessionDetails[r]){const f=n().sessionDetails[r];e({activeSessionId:r,activeTurnIndex:f.turns.length>0?f.turns.length-1:0,activeRightTab:pm(n().activeRightTab),...c,openTabs:d(n().openTabs)}),f.has_unreviewed===1&&(om(r).catch(()=>{}),e(h=>({sessions:h.sessions.map(g=>g.id===r?{...g,has_unreviewed:0}:g),sessionDetails:{...h.sessionDetails,[r]:{...f,has_unreviewed:0}}})));return}e({loading:!0,error:null});try{const f=await vi(r);if(a!==Ku){e(h=>({sessionDetails:{...h.sessionDetails,[r]:f},openTabs:d(h.openTabs),loading:!1}));return}e(h=>({sessionDetails:{...h.sessionDetails,[r]:f},activeSessionId:r,activeTurnIndex:f.turns.length>0?f.turns.length-1:0,activeRightTab:pm(h.activeRightTab),...c,openTabs:d(h.openTabs),loading:!1})),f.has_unreviewed===1&&(om(r).catch(()=>{}),e(h=>({sessions:h.sessions.map(g=>g.id===r?{...g,has_unreviewed:0}:g),sessionDetails:{...h.sessionDetails,[r]:{...f,has_unreviewed:0}}})))}catch(f){e(a===Ku?{loading:!1,error:f.message}:{loading:!1})}},closeTab:r=>n().closeTabs([Fr(r)]),updateModelConfig:async(r,o,a)=>{const c=n().activeSessionId;if(c){e({error:null});try{const d=await x0(c,r,o,a),f={provider:d.runtime_type,model:d.model??"",reasoning:d.model_reasoning_effort??""};e({lastModelConfig:f}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(f)),e(h=>({sessions:h.sessions.map(g=>g.id===c?d:g),sessionDetails:h.sessionDetails[c]?{...h.sessionDetails,[c]:{...h.sessionDetails[c],model:d.model,model_reasoning_effort:d.model_reasoning_effort,external_thread_id:d.external_thread_id}}:h.sessionDetails})),await n().refreshActiveSession()}catch(d){e({error:d.message}),n().addToast("error",`Failed to update model — ${d.message}`)}}},createSession:async r=>{e({error:null});try{const o=await Vd(r);e(c=>({sessions:[o,...c.sessions],showNewSessionDialog:!1}));const a={provider:o.runtime_type,model:o.model??"",reasoning:o.model_reasoning_effort??""};e({lastModelConfig:a}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(a)),await n().selectSession(o.id),n().addLogEntry("INFO",`Session created — ${o.id.slice(0,8)}`),n().addToast("success",`Session created — ${o.title||o.id.slice(0,8)}`)}catch(o){e({error:o.message}),n().addToast("error",`Failed to create session — ${o.message}`)}},addSession:r=>{e(o=>({sessions:o.sessions.some(a=>a.id===r.id)?o.sessions:[r,...o.sessions]}))},revealSession:async r=>{let o=n().sessionDetails[r];if(!o){const a=await vi(r);e(c=>({sessionDetails:{...c.sessionDetails,[r]:a}})),o=a}n().sessions.some(a=>a.id===r)||n().addSession(sk(o)),await n().selectSession(r)},deleteSession:async r=>{var a;e({error:null});const o=(a=n().sessions.find(c=>c.id===r))==null?void 0:a.title;try{await nm(r),hm(e,n,new Set([r])),n().addLogEntry("INFO",`Session deleted — ${r.slice(0,8)}`),n().addToast("info",`Session "${o||r.slice(0,8)}" deleted`)}catch(c){e({error:c.message}),n().addToast("error",`Failed to delete session — ${c.message}`)}},renameSession:async(r,o)=>{e({error:null});try{const a=await v0(r,o.trim());e(c=>({sessions:c.sessions.map(d=>d.id===r?a:d),sessionDetails:c.sessionDetails[r]?{...c.sessionDetails,[r]:{...c.sessionDetails[r],title:a.title}}:c.sessionDetails}))}catch(a){e({error:a.message}),n().addToast("error",`Failed to rename session — ${a.message}`)}},markFinished:async r=>{e({error:null});try{const o=await sm(r);e(a=>({sessions:a.sessions.map(c=>c.id===r?o:c)})),n().addToast("info","Session marked as finished")}catch(o){e({error:o.message}),n().addToast("error",`Failed to mark as finished — ${o.message}`)}},markFinishedMany:async r=>{await mm(e,n,r,sm,"marked as finished")},toggleStar:async r=>{const o=n().sessions.find(a=>a.id===r);if(o){e({error:null});try{const a=await y0(r,o.starred?0:1);e(c=>({sessions:c.sessions.map(d=>d.id===r?a:d),sessionDetails:c.sessionDetails[r]?{...c.sessionDetails,[r]:{...c.sessionDetails[r],starred:a.starred}}:c.sessionDetails}))}catch(a){e({error:a.message}),n().addToast("error",`Failed to star session — ${a.message}`)}}},reopenSession:async r=>{e({error:null});try{const o=await rm(r);e(a=>({sessions:a.sessions.map(c=>c.id===r?o:c)})),n().addToast("info","Session reopened")}catch(o){e({error:o.message}),n().addToast("error",`Failed to reopen session — ${o.message}`)}},reopenSessionMany:async r=>{await mm(e,n,r,rm,"reopened")},deleteSessionMany:async r=>{if(r.length===0)return;e({error:null});const o=await Promise.allSettled(r.map(d=>nm(d))),a=new Set;if(o.forEach((d,f)=>{d.status==="fulfilled"&&a.add(r[f])}),a.size===0){e({error:"Failed to delete sessions"}),n().addToast("error","Failed to delete sessions");return}hm(e,n,a),n().addLogEntry("INFO",`${a.size} session${a.size===1?"":"s"} deleted`);const c=r.length-a.size;c===0?n().addToast("info",`${a.size} session${a.size===1?"":"s"} deleted`):(e({error:"One or more sessions failed to delete"}),n().addToast("warn",`Deleted ${a.size} of ${r.length} — ${c} failed`))},submitPrompt:async(r,o)=>{const a=n().activeSessionId;if(a){e({error:null,submittingPrompt:r}),e(c=>{const d=c.sessionDetails[a];return d?{sessionDetails:{...c.sessionDetails,[a]:{...d,is_running:1,status:"running"}},sessions:c.sessions.map(f=>f.id===a?{...f,is_running:1,status:"running"}:f)}:{}});try{const c=await uv(a,r,o);n().addLogEntry("INFO",`Turn submitted — "${r.slice(0,40)}"`),e(d=>{const f=d.sessionDetails[a];if(!f)return{submittingPrompt:null};const h=f.turns.findIndex(v=>v.id===c.id);if(h>=0)return{submittingPrompt:null,activeTurnIndex:h};const g={...c,items:[]};return{submittingPrompt:null,sessionDetails:{...d.sessionDetails,[a]:{...f,turns:[...f.turns,g]}},activeTurnIndex:f.turns.length}})}catch(c){e({submittingPrompt:null,error:c.message}),n().addLogEntry("ERROR",`Turn failed — ${c.message}`),n().addToast("error",`Failed to send prompt — ${c.message}`),e(d=>{const f=d.sessionDetails[a];if(!f)return{};const h=Vl(f)?1:0;return{sessionDetails:{...d.sessionDetails,[a]:{...f,is_running:h,status:h?"running":"active"}},sessions:d.sessions.map(g=>g.id===a?{...g,is_running:h,status:h?"running":"active"}:g)}})}}},cancelTurn:async()=>{const r=n().activeSessionId;if(r)try{await p0(r)}catch(o){e({error:o.message})}},rewindToTurn:async(r,o)=>{e({error:null});try{const a=await k0(r,o),c=await vi(r);e(d=>({sessionDetails:{...d.sessionDetails,[r]:c},sessions:d.sessions.map(f=>f.id===r?{...f,external_thread_id:a.external_thread_id,is_running:0,status:"active"}:f),activeTurnIndex:c.turns.length>0?c.turns.length-1:0})),n().addToast("info","Rewound to selected turn")}catch(a){e({error:a.message}),n().addToast("error",`Failed to rewind — ${a.message}`)}},restoreSession:async r=>{e({error:null});try{const o=await S0(r),a=await vi(r);e(c=>({sessionDetails:{...c.sessionDetails,[r]:a},sessions:c.sessions.map(d=>d.id===r?{...d,external_thread_id:o.external_thread_id,is_running:0,status:"active"}:d),activeTurnIndex:a.turns.length>0?a.turns.length-1:0})),n().addToast("info","Restored rewound session")}catch(o){e({error:o.message}),n().addToast("error",`Failed to restore — ${o.message}`)}},branchFromTurn:async(r,o,a)=>{e({error:null});try{const c=await b0(r,o,a);e(d=>({sessions:[c,...d.sessions]})),await n().selectSession(c.id),n().addToast("success","Branched from selected turn")}catch(c){e({error:c.message}),n().addToast("error",`Failed to branch — ${c.message}`)}},updateRuntimeConfig:async r=>{const o=n().activeSessionId;if(o){e({error:null});try{const a=await w0(o,JSON.stringify(r));e(c=>({sessions:c.sessions.map(d=>d.id===o?a:d),sessionDetails:c.sessionDetails[o]?{...c.sessionDetails,[o]:{...c.sessionDetails[o],runtime_config:a.runtime_config}}:c.sessionDetails}))}catch(a){e({error:a.message}),n().addToast("error",`Failed to update config — ${a.message}`)}}},refreshActiveSession:async()=>{const r=n().activeSessionId;if(r)try{const o=await vi(r);e(a=>({sessionDetails:{...a.sessionDetails,[r]:o},activeTurnIndex:o.turns.length>0?Math.min(a.activeTurnIndex,o.turns.length-1):0,sessions:a.sessions.map(c=>c.id===r?{...c,is_running:o.is_running,status:o.status}:c)}))}catch(o){e({error:o.message})}},loadDeferredItems:(r,o)=>{const a=Gu.get(o);if(a)return a;const c=f0(r,o).then(({items:d})=>(e(f=>{const h=f.sessionDetails[r];return h?{sessionDetails:{...f.sessionDetails,[r]:bn(h,o,g=>Y0(g,d))}}:{}}),!0)).catch(d=>(n().addToast("error",`Failed to load tool calls — ${d.message}`),!1)).finally(()=>Gu.delete(o));return Gu.set(o,c),c}});async function ok(e){const{sessions:n}=await kt(`/claude-sessions?workspace=${encodeURIComponent(e)}`);return n}function ik(e,n){return st(`/claude-sessions/${encodeURIComponent(e)}/import`,{workspace:n})}async function ak(e){const{sessions:n}=await kt(`/codex-sessions?workspace=${encodeURIComponent(e)}`);return n}function lk(e,n){return st(`/codex-sessions/${encodeURIComponent(e)}/import`,{workspace:n})}const gd=["claude","codex"],ql={claude:"Claude Code",codex:"Codex"};function qu(e){return`${e.runtime}:${e.id}`}function kv(e){const n=e.length===1?"session":"sessions";return new Set(e).size===1?`${e.length} ${ql[e[0]]} ${n}`:`${e.length} ${n}`}const ck={claude:e=>ok(e),codex:e=>ak(e)},uk={claude:(e,n)=>ik(e,n),codex:(e,n)=>lk(e,n)};async function Sv(e){const n=await Promise.allSettled(gd.map(a=>ck[a](e))),r=[],o={};return n.forEach((a,c)=>{const d=gd[c];a.status==="fulfilled"?r.push(...a.value.map(f=>({...f,runtime:d}))):o[d]=hr(a.reason)}),r.sort((a,c)=>a.last_modified<c.last_modified?1:a.last_modified>c.last_modified?-1:0),{sessions:r,errors:o}}function dk(e,n){return uk[e.runtime](e.id,n)}const gm={available:!0,reason:null};let Xu=null;const fk=(e,n)=>({workspaces:[],pickerSupport:null,loadPickerSupport:()=>{const r=n().pickerSupport;return r?Promise.resolve(r):(Xu??(Xu=C0().then(o=>typeof(o==null?void 0:o.available)!="boolean"?gm:(e({pickerSupport:o}),o)).catch(()=>gm).finally(()=>{Xu=null})),Xu)},createWorkspaceAt:async r=>{const o=await N0(r.trim());return e(a=>({workspaces:[...a.workspaces.filter(c=>c.id!==o.id),o]})),o},addWorkspace:async r=>{e({error:null});try{const o=await n().createWorkspaceAt(r);return n().addToast("success",`Workspace added — ${o.path}`),o}catch(o){return n().addToast("error",`Failed to add workspace — ${hr(o)}`),null}},removeWorkspace:async r=>{e({error:null});try{await T0(r);const o=await dv();e({workspaces:o}),n().addToast("info","Workspace hidden")}catch(o){n().addToast("error",`Failed to hide workspace — ${o.message}`)}},createSessionInWorkspace:async r=>{e({error:null});try{const o=n().lastModelConfig,a=await Vd({cwd:r,runtime_type:(o==null?void 0:o.provider)??"codex",model:o==null?void 0:o.model,model_reasoning_effort:o==null?void 0:o.reasoning});e(c=>({sessions:[a,...c.sessions]})),await n().selectSession(a.id),n().addLogEntry("INFO",`Session created in ${r} — ${a.id.slice(0,8)}`),n().addToast("success",`Session created in ${r.split("/").pop()||r}`)}catch(o){e({error:o.message}),n().addToast("error",`Failed to create session — ${o.message}`)}},pickAndAddWorkspace:async()=>{if(!(await n().loadPickerSupport()).available){n().setShowAddWorkspaceDialog(!0);return}try{const o=await fv();if(o.cancelled||!o.path)return;await n().addWorkspace(o.path)}catch(o){n().addToast("error",`Failed to pick directory — ${o.message}`)}},importSessions:async(r,o)=>{const a=[],c=[],d=[];for(const f of[...o].reverse())try{a.unshift(await dk(f,r)),c.unshift(f.runtime)}catch(h){d.unshift({...f,error:hr(h)})}if(a.length>0){e(h=>({sessions:[...a,...h.sessions]})),await n().selectSession(a[0].id);const f=kv(c);n().addLogEntry("INFO",`Imported ${f} into ${r}`),n().addToast("success",a.length===1?`Imported — ${a[0].title||`${ql[c[0]]} session`}`:`Imported ${f}`)}return{imported:a,failed:d}}});function bv(e,n){const r=n?`?cwd=${encodeURIComponent(n)}`:"";return kt(`/providers/${encodeURIComponent(e)}/models${r}`)}const vm="curl -fsSL https://repoburg.com/install.sh | bash",pk=2e3,Nv="agentpane:daemon-seen";function hk(e=mn()){if(!e)return!1;try{const n=new URL(e);return n.protocol==="http:"&&(n.hostname==="localhost"||n.hostname==="127.0.0.1")}catch{return!1}}async function mk(e=mn()){try{return await fetch(`${e}/health`,{mode:"no-cors",cache:"no-store"}),!0}catch{return!1}}function gk(){try{return localStorage.getItem(Nv)==="true"}catch{return!1}}function vk(){try{localStorage.setItem(Nv,"true")}catch{}}function yk(e){let n=!1,r=!1,o=!1,a=null;function c(){a!==null&&(clearTimeout(a),a=null)}async function d(){if(n||r)return;c(),r=!0;const g=await mk();if(r=!1,!n){if(g){vk(),h(),e.onReady();return}o||(o=!0,e.onMissing()),a=setTimeout(()=>void d(),pk)}}function f(){document.visibilityState==="visible"&&d()}function h(){n=!0,c(),window.removeEventListener("focus",f),document.removeEventListener("visibilitychange",f)}return window.addEventListener("focus",f),document.addEventListener("visibilitychange",f),d(),h}const vd=160,yd=480,xk=240,Sl=220,wk=300,kk=600,Sk=36;function bl(){return typeof window>"u"?kk:Math.max(Sl,Math.round(window.innerWidth*.7))}const ym="agentpane:sidebar-width",xm="agentpane:right-panel-width",Yu="agentpane:right-panel-collapsed";function wm(e,n,r,o){try{const a=localStorage.getItem(e);if(a==null)return o;const c=Number(a);return Number.isFinite(c)?Math.min(r,Math.max(n,c)):o}catch{return o}}function bk(e){try{return localStorage.getItem(e)==="true"}catch{return!1}}function km(e,n){try{localStorage.setItem(e,String(n))}catch{}}const Sm=200,Nk=(e,n)=>({activeRightTab:"turns",eventLog:[],loading:!1,error:null,showNewSessionDialog:!1,showAddWorkspaceDialog:!1,importSessionsWorkspace:null,showRemoteModal:!1,toasts:[],showCommandPalette:!1,lastModelConfig:null,models:[],modelsLoading:!1,showModelSelector:!1,sidebarWidth:wm(ym,vd,yd,xk),rightPanelWidth:wm(xm,Sl,bl(),wk),rightPanelCollapsed:bk(Yu),deepLinkThreadId:null,vscodeViewOpen:!1,vscodeState:"stopped",vscodeId:null,vscodeToken:null,usageViewOpen:!1,terminalViewOpen:!1,canGoBack:!1,canGoForward:!1,daemonStatus:hk()?"checking":"ready",setActiveTurnIndex:r=>e({activeTurnIndex:r}),switchRightTab:r=>{n().rightPanelCollapsed&&km(Yu,!1),e({activeRightTab:r,rightPanelCollapsed:!1})},setShowNewSessionDialog:r=>e({showNewSessionDialog:r}),setShowAddWorkspaceDialog:r=>e({showAddWorkspaceDialog:r}),setImportSessionsWorkspace:r=>e({importSessionsWorkspace:r}),setShowRemoteModal:r=>e({showRemoteModal:r}),setShowCommandPalette:r=>e({showCommandPalette:r}),setShowModelSelector:r=>e({showModelSelector:r}),setDeepLinkThreadId:r=>e({deepLinkThreadId:r}),setSidebarWidth:r=>{const o=Math.min(yd,Math.max(vd,Math.round(r)));e({sidebarWidth:o});try{localStorage.setItem(ym,String(o))}catch{}},setRightPanelWidth:r=>{const o=Math.min(bl(),Math.max(Sl,Math.round(r)));e({rightPanelWidth:o});try{localStorage.setItem(xm,String(o))}catch{}},setRightPanelCollapsed:r=>{e({rightPanelCollapsed:r}),km(Yu,r)},toggleRightPanel:()=>n().setRightPanelCollapsed(!n().rightPanelCollapsed),toggleVscodeView:()=>{if(n().vscodeViewOpen){e({vscodeViewOpen:!1});return}e({vscodeViewOpen:!0,terminalViewOpen:!1,vscodeState:"starting",vscodeId:null,vscodeToken:null})},setVscodeView:(r,o,a)=>e({vscodeState:r,vscodeId:o,vscodeToken:a}),toggleUsageView:()=>e({usageViewOpen:!n().usageViewOpen,terminalViewOpen:!1}),toggleTerminalView:()=>e(n().terminalViewOpen?{terminalViewOpen:!1}:{terminalViewOpen:!0,vscodeViewOpen:!1,usageViewOpen:!1}),setDaemonStatus:r=>e({daemonStatus:r}),addToast:(r,o,a,c)=>{const d=Math.random().toString(36).slice(2,9);e(f=>({toasts:[...f.toasts,{id:d,type:r,message:o,undoAction:a,undoLabel:c}]}))},removeToast:r=>{e(o=>({toasts:o.toasts.filter(a=>a.id!==r)}))},addLogEntry:(r,o)=>{const a=new Date().toLocaleTimeString("en-GB",{hour12:!1});e(c=>{const d=[...c.eventLog,{time:a,level:r,message:o}];return d.length>Sm&&d.splice(0,d.length-Sm),{eventLog:d}})},loadModels:async(r,o)=>{if(!n().modelsLoading){e({modelsLoading:!0,models:[]});try{const a=await bv(r,o);e({models:a,modelsLoading:!1})}catch{e({modelsLoading:!1})}}}}),Tk=(e,n)=>({createThread:async(r,o)=>{try{await st(`/sessions/${r}/threads`,o),n().addLogEntry("INFO",`Thread created — "${o.message.slice(0,40)}"`)}catch(a){n().addToast("error",`Failed to create thread — ${a.message}`)}},followupThread:async(r,o,a)=>{try{await st(`/sessions/${r}/threads/${o}/followup`,{message:a}),n().addLogEntry("INFO",`Thread follow-up — "${a.slice(0,40)}"`)}catch(c){n().addToast("error",`Failed to send follow-up — ${c.message}`)}},cancelThreadTurn:async(r,o)=>{try{await st(`/sessions/${r}/cancel?threadId=${encodeURIComponent(o)}`),n().addLogEntry("INFO","Thread turn cancelled")}catch(a){n().addToast("error",`Failed to cancel thread turn — ${a.message}`)}},resolveThread:async(r,o)=>{try{await ds(`/sessions/${r}/threads/${o}`,{status:"resolved"})}catch(a){n().addToast("error",`Failed to resolve thread — ${a.message}`)}},reopenThread:async(r,o)=>{try{await ds(`/sessions/${r}/threads/${o}`,{status:"open"})}catch(a){n().addToast("error",`Failed to reopen thread — ${a.message}`)}},shareThread:async(r,o,a)=>{try{const c=await st(`/sessions/${r}/threads/${o}/summarize`,{directives:a}),d=`
|
|
45
|
+
[Shared from a resolved discussion thread — summary of its findings]
|
|
46
|
+
|
|
47
|
+
\`\`\`QUOTE
|
|
48
|
+
${c.summary}
|
|
49
|
+
\`\`\`
|
|
50
|
+
|
|
51
|
+
`;return e({quotedText:d}),n().addLogEntry("INFO",`Thread shared to main session — "${c.summary.slice(0,40)}"`),n().addToast("success","Thread summary added to your input"),!0}catch(c){return n().addToast("error",`Failed to share thread — ${c.message}`),!1}},deleteThread:async(r,o)=>{try{await Hl(`/sessions/${r}/threads/${o}`)}catch(a){n().addToast("error",`Failed to delete thread — ${a.message}`)}},askSidecar:async(r,o)=>{try{return await st(`/sessions/${r}/sidecar`,{message:o}),n().addLogEntry("INFO",`Sidecar asked — "${o.slice(0,40)}"`),!0}catch(a){return n().addToast("error",`Failed to ask the sidecar — ${a.message}`),!1}},onThreadCreated:(r,o,a)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:[...d.threads??[],{...o,turns:[{...a,items:[]}]}]}}}:{}})},onThreadFollowup:(r,o,a)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:(d.threads??[]).map(f=>f.id===o?{...f,turns:[...f.turns??[],{...a,items:[]}]}:f)}}}:{}})},onThreadResolved:(r,o,a)=>{e(c=>{const d=c.sessionDetails[r];if(!d)return{};const f=(d.threads??[]).map(h=>h.id===o?{...h,status:a,resolved_at:a==="resolved"?new Date().toISOString():null}:h);return{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:f}}}})},onThreadDeleted:(r,o)=>{e(a=>{const c=a.sessionDetails[r];return c?{sessionDetails:{...a.sessionDetails,[r]:{...c,threads:(c.threads??[]).filter(d=>d.id!==o)}}}:{}})}}),Ck=(e,n)=>({folders:[],loadFolders:async()=>{const r=await pv();e({folders:r})},createSidebarFolder:async(r,o)=>{try{const a=await E0(r,o);return e(c=>({folders:[...c.folders,a]})),a}catch(a){return n().addToast("error",`Failed to create folder — ${a.message}`),null}},renameFolder:async(r,o)=>{try{const a=await am(r,{name:o});e(c=>({folders:c.folders.map(d=>d.id===r?a:d)}))}catch(a){n().addToast("error",`Failed to rename folder — ${a.message}`)}},deleteFolder:async r=>{const o=n().folders,a=n().sessions;e(c=>({folders:c.folders.filter(d=>d.id!==r),sessions:c.sessions.map(d=>d.folder_id===r?{...d,folder_id:null}:d)}));try{await j0(r)}catch(c){e({folders:o,sessions:a}),n().addToast("error",`Failed to delete folder — ${c.message}`)}},applyMoves:async r=>{if(r.length===0)return;const o=n().sessions,a=new Map(r.map(c=>[c.id,c]));e(c=>({sessions:c.sessions.map(d=>{const f=a.get(d.id);return f?{...d,folder_id:f.folder_id,sort_order:f.sort_order}:d})}));try{await _0(r)}catch(c){e({sessions:o}),n().addToast("error",`Failed to save session order — ${c.message}`)}},reorderFolders:async r=>{const o=n().folders,a=new Map(r.map((c,d)=>[c,d]));e(c=>({folders:c.folders.map(d=>a.has(d.id)?{...d,sort_order:a.get(d.id)}:d)}));try{await Promise.all(r.map((c,d)=>am(c,{sort_order:d})))}catch(c){e({folders:o}),n().addToast("error",`Failed to save folder order — ${c.message}`)}}});function bm(){return kt("/apps")}function Ek(){return kt("/apps/root")}function Nm(e){return kt(`/apps/${e}/source`)}function Tm(e,n=""){return kt(`/apps/${e}/state?workspace=${encodeURIComponent(n)}`)}function Tv(e,n,r=""){return a0(`/apps/${e}/state?workspace=${encodeURIComponent(r)}`,n)}function jk(e){return Hl(`/apps/${e}`)}function _k(e){return kt(`/apps/${e}/sessions`)}async function Cm(e,n){try{return await kt(`/apps/${e}/sessions/${encodeURIComponent(n)}`)}catch(r){if(r instanceof Ui&&r.status===404)return null;throw r}}function Rk(e,n,r={}){const o=new URLSearchParams({workspace:n});return r.lifecycle&&o.set("lifecycle",r.lifecycle),typeof r.running=="boolean"&&o.set("running",String(r.running)),kt(`/apps/${e}/workspace-sessions?${o}`)}async function Ak(e,n,r){try{return await kt(`/apps/${e}/workspace-sessions/${encodeURIComponent(r)}?workspace=${encodeURIComponent(n)}`)}catch(o){if(o instanceof Ui&&o.status===404)return null;throw o}}function Ik(e,n){return st(`/apps/${e}/sessions/${encodeURIComponent(n)}/cancel`)}function Dk(e,n,r){return ds(`/apps/${e}/sessions/${encodeURIComponent(n)}`,{lifecycle:r})}async function Mk(e,n,r,o){const a=await st("/apps/mcp/call",{tool:`${e}__${r}`,args:o,workspace:n});if(!a.ok)throw new Error(a.error||`callTool: ${r} failed`);return a.result}function Lk(){return kt("/apps/examples")}function Ok(e){return st(`/apps/examples/${e}/install`,{})}function $k(e){return st("/apps",e)}function Pk(e,n){return st("/apps/import",{id:e,files:n})}function zk(e,n,r){return st(`/apps/mcp/calls/${e}/result`,{result:n,error:null})}function Fk(e,n){return st(`/apps/${e}/edit-session`,n)}function Uk(e,n){return st(`/apps/${e}/files`,n)}async function Bk(e,n){const r=await fetch(`${mn()}/api/apps/${e}/files/${encodeURIComponent(n)}/meta`);if(r.status===404)return null;if(!r.ok)throw new Error(`GET /apps/${e}/files/${n}/meta failed: ${r.status} ${r.statusText}`);return await r.json()}async function Wk(e,n){const r=await fetch(`${mn()}/api/apps/${e}/files/${encodeURIComponent(n)}`);if(!r.ok)throw new Error(`GET /apps/${e}/files/${n} failed: ${r.status} ${r.statusText}`);return r.blob()}const fl=new Set;async function Qu(e,n){fl.add(n),await e().loadApps();const r=e().apps.find(o=>o.id===n);e().openAppTab(n),e().addToast("success",`Mini app added: ${(r==null?void 0:r.title)??n}`)}const xd="agentpane:app-workspaces";function Hk(){try{const e=JSON.parse(localStorage.getItem(xd)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}const Vk=(e,n)=>({apps:[],appsRootPath:null,openAppTabs:[],activeAppTabId:null,appCatalogOpen:!1,appWorkspaces:Hk(),loadApps:async()=>{try{const[r,o]=await Promise.all([bm(),Ek().catch(()=>null)]);return r.forEach(a=>fl.add(a.id)),e(o?{apps:r,appsRootPath:o.root}:{apps:r}),!0}catch{return!1}},refreshApps:async()=>{try{const r=await bm();for(const o of r)fl.has(o.id)||(fl.add(o.id),n().addToast("success",`New mini app discovered: ${o.title}`));e({apps:r})}catch{}},openAppTab:r=>{e(o=>({activeAppTabId:r,openAppTabs:o.openAppTabs.includes(r)?o.openAppTabs:[...o.openAppTabs,r]}))},closeAppTab:r=>n().closeTabs([Ii(r)]),setActiveAppTab:r=>e({activeAppTabId:r}),openAppCatalog:()=>e({appCatalogOpen:!0}),closeAppCatalog:()=>e({appCatalogOpen:!1}),setAppWorkspace:(r,o)=>{e(a=>{const c={...a.appWorkspaces,[r]:o};try{localStorage.setItem(xd,JSON.stringify(c))}catch{}return{appWorkspaces:c}})},installExampleApp:async r=>{try{return await Ok(r),await Qu(n,r),!0}catch(o){return n().addToast("error",`Failed to install app — ${o.message}`),!1}},createSkeletonApp:async r=>{try{return await $k(r),await Qu(n,r.id),!0}catch(o){return n().addToast("error",`Failed to create app — ${o.message}`),!1}},importAppFolder:async(r,o)=>{try{return await Pk(r,o),await Qu(n,r),!0}catch(a){return n().addToast("error",`Failed to import app — ${a.message}`),!1}},startAppEdit:async r=>{try{const o=n().lastModelConfig,a=await Fk(r,{runtime_type:o==null?void 0:o.provider,model:(o==null?void 0:o.model)??null,model_reasoning_effort:(o==null?void 0:o.reasoning)??null});n().sessions.some(c=>c.id===a.id)||e(c=>({sessions:[a,...c.sessions]})),await n().selectSession(a.id),n().addLogEntry("INFO",`App edit session opened for ${r}`)}catch(o){n().addToast("error",`Failed to open app edit session — ${o.message}`)}},toggleAppPin:async r=>{const o=n().apps.find(a=>a.id===r);if(o)try{await Tv(r,{pinned:!o.pinned}),await n().loadApps()}catch(a){n().addToast("error",`Failed to pin app — ${a.message}`)}},deleteApp:async r=>{try{await jk(r);const o=n().activeSessionId;e(c=>{const d={...c.appWorkspaces};delete d[r];try{localStorage.setItem(xd,JSON.stringify(d))}catch{}return{apps:c.apps.filter(f=>f.id!==r),openAppTabs:c.openAppTabs.filter(f=>f!==r),...Gd(c,new Set([Ii(r)])),appWorkspaces:d}});const a=n().activeSessionId;a&&a!==o&&n().selectSession(a,{keepAppView:!0}),n().addToast("success",`Mini app deleted: ${r}`)}catch(o){n().addToast("error",`Failed to delete app — ${o.message}`)}}}),Kk=(e,n)=>({tabOrder:[],closedTabs:[],moveTab:(r,o)=>{const a=[...n().tabOrder],c=a.indexOf(r),d=a.indexOf(o);c===-1||d===-1||c===d||(a.splice(d,0,...a.splice(c,1)),e({tabOrder:a}))},closeTabs:r=>{const o=n(),a=new Set(r.filter(h=>o.tabOrder.includes(h)));if(a.size===0)return;const c=Gd(o,a),d=o.tabOrder.map((h,g)=>({key:h,index:g})).filter(h=>a.has(h.key)).reverse();e({...c,openTabs:o.openTabs.filter(h=>!a.has(Fr(h))),openAppTabs:o.openAppTabs.filter(h=>!a.has(Ii(h))),tabOrder:o.tabOrder.filter(h=>!a.has(h)),closedTabs:[...o.closedTabs,...d].slice(-20)});const f=c.activeSessionId;f!==null&&f!==o.activeSessionId&&n().selectSession(f,{keepAppView:!0})},reopenClosedTab:()=>{const r=n(),o=[...r.closedTabs];let a=o.pop();for(;a&&!gv(r,a.key);)a=o.pop();if(!a){e({closedTabs:[]});return}const c=[...r.tabOrder];c.splice(a.index,0,a.key);const{kind:d,id:f}=mr(a.key);d==="app"?(e({closedTabs:o,tabOrder:c,openAppTabs:[...r.openAppTabs,f]}),n().openAppTab(f)):(e({closedTabs:o,tabOrder:c,openTabs:[...r.openTabs,f]}),n().selectSession(f))}}),Em=3e3,Vn={lagMs:100,longtaskBufferMs:50,longtaskLogMs:100,eventBufferMs:50,eventLogMs:100,keypressMs:100,wsPerSecLog:15,storePerSecLog:15,renderPerSecLog:6,frameGapMs:150},Kn=[];let Nl=0,Qd=0,Tl=0,Zd=0,Cl=0,Jd=0,ef=0;const Di=new Map,Mi=new Map;let Eo=new Map,To=0,jo=new Map,Zu=!1;function El(e,n,r){if(Kn.push({t:Date.now(),cat:e,msg:n,ms:r}),Kn.length>Em){const o=Kn.length-Em;Kn.splice(0,o),Dn=Math.max(0,Dn-o)}}function Co(e,n,r){El(e,n,r),console.log(`[perf:${e}] ${n}`)}function Cv(e){Co("note",e)}function Ev(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function Gk(e,n){let r=Eo.get(e);r||Eo.set(e,r={n:0,bytes:0}),r.n++,r.bytes+=n;let o=Di.get(e);o||Di.set(e,o={n:0,bytes:0}),o.n++,o.bytes+=n}function qk(){To++,ef++}function Xk(e){jo.set(e,(jo.get(e)??0)+1),Mi.set(e,(Mi.get(e)??0)+1)}let pl=0;function Yk(){pl=performance.now()}function Qk(){const e=performance.now(),n=pl?e-pl:null;pl=0,requestAnimationFrame(()=>{if(n===null)return;const r=performance.now()-e+n;r>Vn.keypressMs&&Co("input",`keystroke→paint ${Math.round(r)}ms (keydown→change ${Math.round(n)}ms, change→paint ${Math.round(performance.now()-e)}ms)`)})}const Zk=5e3,jv=500,jm=2e3;let Dn=0,Ju=!1;function Jk(e){return st("/perf-log",{entries:e}).then(()=>{Dn+=e.length})}function e1(){if(Ju||Dn>=Kn.length)return;const e=Kn.slice(Dn,Dn+jv);e.length!==0&&(Ju=!0,Jk(e).catch(()=>{Kn.length-Dn>jm&&(Dn=Math.max(Dn,Kn.length-jm))}).finally(()=>{Ju=!1}))}function _m(){if(typeof navigator>"u"||typeof navigator.sendBeacon!="function"||Dn>=Kn.length)return;const e=Kn.slice(Dn,Dn+jv);if(e.length!==0)try{const n=new Blob([JSON.stringify({entries:e})],{type:"application/json"});navigator.sendBeacon(`${mn()}/api/perf-log`,n),Dn+=e.length}catch{}}function t1(){let e=0;for(const o of Eo.values())e+=o.n;const n=[];if(e>0){const o=[...Eo.entries()].sort((a,c)=>c[1].n-a[1].n).map(([a,c])=>`${a}×${c.n}(${Ev(c.bytes)})`).join(", ");n.push(`ws ${e}/s [${o}]`)}To>0&&n.push(`store ${To}/s`);const r=[...jo.entries()].sort((o,a)=>a[1]-o[1]).map(([o,a])=>`${o}×${a}`);if(r.length>0&&n.push(`renders ${r.join(" ")}`),n.length>0){const o=n.join(" · ");El("stat",o);const a=[...jo.values()].some(c=>c>Vn.renderPerSecLog);(e>Vn.wsPerSecLog||To>Vn.storePerSecLog||a)&&console.log(`[perf:stat] ${o}`)}Eo=new Map,To=0,jo=new Map}function n1(e){if(e instanceof Element){const n=e.id?`#${e.id}`:"",r=typeof e.className=="string"&&e.className?`.${e.className.trim().split(/\s+/)[0]}`:"";return`${e.tagName.toLowerCase()}${n}${r}`}return e?"window":"unknown"}function s1(){if(Zu||typeof window>"u")return()=>{};Zu=!0,Nl=Date.now();const e=[];let n=performance.now()+250;const r=window.setInterval(()=>{const c=performance.now(),d=c-n;n=c+250,d>Vn.lagMs&&(Qd++,Tl=Math.max(Tl,d),Co("lag",`event loop blocked ${Math.round(d)}ms`))},250);if(e.push(()=>window.clearInterval(r)),typeof window.requestAnimationFrame=="function"){let c=performance.now(),d=0;const f=h=>{const g=h-c;c=h,g>Vn.frameGapMs&&Co("lag",`frame gap ${Math.round(g)}ms`),d=window.requestAnimationFrame(f)};d=window.requestAnimationFrame(f),e.push(()=>window.cancelAnimationFrame(d))}if(typeof PerformanceObserver<"u"){try{const c=new PerformanceObserver(d=>{var f;for(const h of d.getEntries()){const g=h.duration;if(g<Vn.longtaskBufferMs)continue;Zd++,Cl=Math.max(Cl,g);const v=(f=h.attribution)==null?void 0:f[0],k=(v==null?void 0:v.containerName)||(v==null?void 0:v.name)||"unknown",x=`long task ${Math.round(g)}ms (${k})`;g>=Vn.longtaskLogMs?Co("longtask",x,g):El("longtask",x,g)}});c.observe({type:"longtask",buffered:!1}),e.push(()=>c.disconnect())}catch{}try{const c=new PerformanceObserver(d=>{for(const f of d.getEntries()){const h=f.duration,g=f.processingStart-f.startTime;Jd++;const v=`${f.name} ${Math.round(h)}ms (input delay ${Math.round(g)}ms) on ${n1(f.target)}`;h>=Vn.eventLogMs?Co("input",v,h):El("input",v,h)}});c.observe({type:"event",durationThreshold:Vn.eventBufferMs}),e.push(()=>c.disconnect())}catch{}}const o=window.setInterval(t1,1e3);e.push(()=>window.clearInterval(o)),Cv("perf logger session started");const a=window.setInterval(e1,Zk);return e.push(()=>window.clearInterval(a)),window.addEventListener("beforeunload",_m),e.push(()=>window.removeEventListener("beforeunload",_m)),window.__agentPanePerf={dump:_v,reset:Rv},()=>{e.forEach(c=>c()),Zu=!1}}function _v(){const e=[],n=Nl?Math.round((Date.now()-Nl)/1e3):0;if(e.push("=== agent-pane perf report ==="),e.push(`uptime ${n}s · ${Kn.length} buffered entries`),e.push(`event-loop lag: ${Qd} blocks >${Vn.lagMs}ms (max ${Math.round(Tl)}ms)`),e.push(`long tasks: ${Zd} ≥${Vn.longtaskBufferMs}ms (max ${Math.round(Cl)}ms)`),e.push(`slow input events (≥${Vn.eventBufferMs}ms): ${Jd}`),e.push(`store updates: ${ef} total`),Di.size>0){e.push("ws messages by type (top 15):");for(const[r,o]of[...Di.entries()].sort((a,c)=>c[1].n-a[1].n).slice(0,15))e.push(` ${r}: ${o.n} msgs, ${Ev(o.bytes)}`)}if(Mi.size>0){e.push("render counts by component:");for(const[r,o]of[...Mi.entries()].sort((a,c)=>c[1]-a[1]))e.push(` ${r}: ${o}`)}e.push("--- last 200 entries ---");for(const r of Kn.slice(-200))e.push(`${new Date(r.t).toISOString().slice(11,23)} [${r.cat}] ${r.msg}`);return e.join(`
|
|
52
|
+
`)}function Rv(){Kn.length=0,Dn=0,Nl=Date.now(),Qd=0,Tl=0,Zd=0,Cl=0,Jd=0,ef=0,Di.clear(),Mi.clear(),Eo=new Map,To=0,jo=new Map}const Lt={start:s1,note:Cv,trackWsEvent:Gk,trackStoreUpdate:qk,trackRender:Xk,markKeystroke:Yk,markInputChange:Qk,dump:_v,reset:Rv},A=Qw()((...e)=>({...rk(...e),...fk(...e),...q0(...e),...Nk(...e),...Tk(...e),...Ck(...e),...Vk(...e),...Kk(...e)}));typeof window<"u"&&(A.subscribe(()=>Lt.trackStoreUpdate()),A0(A),L0(A));const r1="modulepreload",o1=function(e){return"/"+e},Rm={},i1=function(n,r,o){let a=Promise.resolve();if(r&&r.length>0){let d=function(g){return Promise.all(g.map(v=>Promise.resolve(v).then(k=>({status:"fulfilled",value:k}),k=>({status:"rejected",reason:k}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),h=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));a=d(r.map(g=>{if(g=o1(g),g in Rm)return;Rm[g]=!0;const v=g.endsWith(".css"),k=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${k}`))return;const x=document.createElement("link");if(x.rel=v?"stylesheet":r1,v||(x.as="script"),x.crossOrigin="",x.href=g,h&&x.setAttribute("nonce",h),document.head.appendChild(x),v)return new Promise((S,E)=>{x.addEventListener("load",S),x.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${g}`)))})}))}function c(d){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=d,window.dispatchEvent(f),!f.defaultPrevented)throw d}return a.then(d=>{for(const f of d||[])f.status==="rejected"&&c(f.reason);return n().catch(c)})};function wd(e){switch(e){case"claude":return{iconClass:"ic-claude",iconText:"CL"};case"codex":return{iconClass:"ic-codex",iconText:"CX"};case"repoburg":return{iconClass:"ic-repoburg",iconText:"RB"};case"cursor":return{iconClass:"ic-cursor",iconText:"CR"};default:return{iconClass:"ic-codex",iconText:"CX"}}}function a1(e,n,r=!1,o="working",a=0){if(o==="finished")return"";if(e==="interrupted")return"interrupted";if(n)return"running";if(a>0)return"background";if(r&&e!=="failed")return"queued";switch(e){case"failed":return"error";case"aborted":return"paused";default:return"paused"}}function l1(e,n,r=!1,o="working",a=0){if(o==="finished")return"Finished";if(e==="interrupted")return"Interrupted";if(n)return"Running";if(a>0)return"Background";if(r&&e!=="failed")return"Review Pending";switch(e){case"failed":return"Failed";case"aborted":return"Aborted";case"active":return"Idle";case"completed":return"Completed";case"running":return"Running";default:return e}}function Xl(e,n=0){const r=e.is_running===1,o=e.lifecycle==="finished",a=wd(e.runtime_type),c=a1(e.status,r,e.has_unreviewed===1,e.lifecycle,n),d=l1(e.status,r,e.has_unreviewed===1,e.lifecycle,n);return{dot:c,label:d,dotTitle:c==="background"?`${n} background task${n===1?"":"s"} running`:d,iconClass:a.iconClass,iconText:a.iconText,isRunning:r,isFinished:o,backgroundTaskCount:n}}function Wi(e,n,r=!0){y.useEffect(()=>{if(!r)return;function o(a){e.current&&!e.current.contains(a.target)&&n()}return document.addEventListener("mousedown",o),document.addEventListener("touchstart",o),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("touchstart",o)}},[e,n,r])}function Io(e,n=!0){y.useEffect(()=>{if(!n)return;function r(o){o.key==="Escape"&&e()}return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,n])}function tf({status:e,size:n=6,title:r}){return l.jsx("span",{className:`status-dot ${e}`,style:n!==6?{width:n,height:n}:void 0,title:r})}function nf({iconClass:e,iconText:n,size:r=20}){return l.jsx("span",{className:`runtime-icon ${e}`,style:r!==20?{width:r,height:r,fontSize:r*.45}:void 0,children:n})}/**
|
|
53
|
+
* @license lucide-react v0.469.0 - ISC
|
|
54
|
+
*
|
|
55
|
+
* This source code is licensed under the ISC license.
|
|
56
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
57
|
+
*/const c1=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Av=(...e)=>e.filter((n,r,o)=>!!n&&n.trim()!==""&&o.indexOf(n)===r).join(" ").trim();/**
|
|
58
|
+
* @license lucide-react v0.469.0 - ISC
|
|
59
|
+
*
|
|
60
|
+
* This source code is licensed under the ISC license.
|
|
61
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
62
|
+
*/var u1={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
63
|
+
* @license lucide-react v0.469.0 - ISC
|
|
64
|
+
*
|
|
65
|
+
* This source code is licensed under the ISC license.
|
|
66
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
67
|
+
*/const Iv=y.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:a="",children:c,iconNode:d,...f},h)=>y.createElement("svg",{ref:h,...u1,width:n,height:n,stroke:e,strokeWidth:o?Number(r)*24/Number(n):r,className:Av("lucide",a),...f},[...d.map(([g,v])=>y.createElement(g,v)),...Array.isArray(c)?c:[c]]));/**
|
|
68
|
+
* @license lucide-react v0.469.0 - ISC
|
|
69
|
+
*
|
|
70
|
+
* This source code is licensed under the ISC license.
|
|
71
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
72
|
+
*/const ye=(e,n)=>{const r=y.forwardRef(({className:o,...a},c)=>y.createElement(Iv,{ref:c,iconNode:n,className:Av(`lucide-${c1(e)}`,o),...a}));return r.displayName=`${e}`,r};/**
|
|
73
|
+
* @license lucide-react v0.469.0 - ISC
|
|
74
|
+
*
|
|
75
|
+
* This source code is licensed under the ISC license.
|
|
76
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
77
|
+
*/const d1=ye("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
|
|
78
|
+
* @license lucide-react v0.469.0 - ISC
|
|
79
|
+
*
|
|
80
|
+
* This source code is licensed under the ISC license.
|
|
81
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
82
|
+
*/const f1=ye("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
|
|
83
|
+
* @license lucide-react v0.469.0 - ISC
|
|
84
|
+
*
|
|
85
|
+
* This source code is licensed under the ISC license.
|
|
86
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
87
|
+
*/const Dv=ye("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
|
|
88
|
+
* @license lucide-react v0.469.0 - ISC
|
|
89
|
+
*
|
|
90
|
+
* This source code is licensed under the ISC license.
|
|
91
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
92
|
+
*/const p1=ye("BotOff",[["path",{d:"M13.67 8H18a2 2 0 0 1 2 2v4.33",key:"7az073"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}],["path",{d:"M8 8H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 1.414-.586",key:"s09a7a"}],["path",{d:"M9 13v2",key:"rq6x2g"}],["path",{d:"M9.67 4H12v2.33",key:"110xot"}]]);/**
|
|
93
|
+
* @license lucide-react v0.469.0 - ISC
|
|
94
|
+
*
|
|
95
|
+
* This source code is licensed under the ISC license.
|
|
96
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
97
|
+
*/const vr=ye("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
|
|
98
|
+
* @license lucide-react v0.469.0 - ISC
|
|
99
|
+
*
|
|
100
|
+
* This source code is licensed under the ISC license.
|
|
101
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
102
|
+
*/const h1=ye("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
|
|
103
|
+
* @license lucide-react v0.469.0 - ISC
|
|
104
|
+
*
|
|
105
|
+
* This source code is licensed under the ISC license.
|
|
106
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
107
|
+
*/const Cs=ye("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
108
|
+
* @license lucide-react v0.469.0 - ISC
|
|
109
|
+
*
|
|
110
|
+
* This source code is licensed under the ISC license.
|
|
111
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
112
|
+
*/const _o=ye("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
113
|
+
* @license lucide-react v0.469.0 - ISC
|
|
114
|
+
*
|
|
115
|
+
* This source code is licensed under the ISC license.
|
|
116
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
117
|
+
*/const Li=ye("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
118
|
+
* @license lucide-react v0.469.0 - ISC
|
|
119
|
+
*
|
|
120
|
+
* This source code is licensed under the ISC license.
|
|
121
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
122
|
+
*/const Yl=ye("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
123
|
+
* @license lucide-react v0.469.0 - ISC
|
|
124
|
+
*
|
|
125
|
+
* This source code is licensed under the ISC license.
|
|
126
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
127
|
+
*/const m1=ye("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
|
|
128
|
+
* @license lucide-react v0.469.0 - ISC
|
|
129
|
+
*
|
|
130
|
+
* This source code is licensed under the ISC license.
|
|
131
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
132
|
+
*/const jl=ye("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
133
|
+
* @license lucide-react v0.469.0 - ISC
|
|
134
|
+
*
|
|
135
|
+
* This source code is licensed under the ISC license.
|
|
136
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
137
|
+
*/const g1=ye("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
138
|
+
* @license lucide-react v0.469.0 - ISC
|
|
139
|
+
*
|
|
140
|
+
* This source code is licensed under the ISC license.
|
|
141
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
142
|
+
*/const v1=ye("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
143
|
+
* @license lucide-react v0.469.0 - ISC
|
|
144
|
+
*
|
|
145
|
+
* This source code is licensed under the ISC license.
|
|
146
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
147
|
+
*/const y1=ye("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
|
|
148
|
+
* @license lucide-react v0.469.0 - ISC
|
|
149
|
+
*
|
|
150
|
+
* This source code is licensed under the ISC license.
|
|
151
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
152
|
+
*/const Mv=ye("Cog",[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]]);/**
|
|
153
|
+
* @license lucide-react v0.469.0 - ISC
|
|
154
|
+
*
|
|
155
|
+
* This source code is licensed under the ISC license.
|
|
156
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
157
|
+
*/const Am=ye("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/**
|
|
158
|
+
* @license lucide-react v0.469.0 - ISC
|
|
159
|
+
*
|
|
160
|
+
* This source code is licensed under the ISC license.
|
|
161
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
162
|
+
*/const Oi=ye("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
163
|
+
* @license lucide-react v0.469.0 - ISC
|
|
164
|
+
*
|
|
165
|
+
* This source code is licensed under the ISC license.
|
|
166
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
167
|
+
*/const x1=ye("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
|
|
168
|
+
* @license lucide-react v0.469.0 - ISC
|
|
169
|
+
*
|
|
170
|
+
* This source code is licensed under the ISC license.
|
|
171
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
172
|
+
*/const Lv=ye("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
|
|
173
|
+
* @license lucide-react v0.469.0 - ISC
|
|
174
|
+
*
|
|
175
|
+
* This source code is licensed under the ISC license.
|
|
176
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
177
|
+
*/const w1=ye("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/**
|
|
178
|
+
* @license lucide-react v0.469.0 - ISC
|
|
179
|
+
*
|
|
180
|
+
* This source code is licensed under the ISC license.
|
|
181
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
182
|
+
*/const Ov=ye("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
183
|
+
* @license lucide-react v0.469.0 - ISC
|
|
184
|
+
*
|
|
185
|
+
* This source code is licensed under the ISC license.
|
|
186
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
187
|
+
*/const k1=ye("FolderGit2",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);/**
|
|
188
|
+
* @license lucide-react v0.469.0 - ISC
|
|
189
|
+
*
|
|
190
|
+
* This source code is licensed under the ISC license.
|
|
191
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
192
|
+
*/const S1=ye("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
|
|
193
|
+
* @license lucide-react v0.469.0 - ISC
|
|
194
|
+
*
|
|
195
|
+
* This source code is licensed under the ISC license.
|
|
196
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
197
|
+
*/const ed=ye("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
|
|
198
|
+
* @license lucide-react v0.469.0 - ISC
|
|
199
|
+
*
|
|
200
|
+
* This source code is licensed under the ISC license.
|
|
201
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
202
|
+
*/const _l=ye("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
|
|
203
|
+
* @license lucide-react v0.469.0 - ISC
|
|
204
|
+
*
|
|
205
|
+
* This source code is licensed under the ISC license.
|
|
206
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
207
|
+
*/const $v=ye("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
|
|
208
|
+
* @license lucide-react v0.469.0 - ISC
|
|
209
|
+
*
|
|
210
|
+
* This source code is licensed under the ISC license.
|
|
211
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
212
|
+
*/const Pv=ye("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
|
|
213
|
+
* @license lucide-react v0.469.0 - ISC
|
|
214
|
+
*
|
|
215
|
+
* This source code is licensed under the ISC license.
|
|
216
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
217
|
+
*/const zv=ye("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);/**
|
|
218
|
+
* @license lucide-react v0.469.0 - ISC
|
|
219
|
+
*
|
|
220
|
+
* This source code is licensed under the ISC license.
|
|
221
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
222
|
+
*/const b1=ye("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
223
|
+
* @license lucide-react v0.469.0 - ISC
|
|
224
|
+
*
|
|
225
|
+
* This source code is licensed under the ISC license.
|
|
226
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
227
|
+
*/const N1=ye("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
|
|
228
|
+
* @license lucide-react v0.469.0 - ISC
|
|
229
|
+
*
|
|
230
|
+
* This source code is licensed under the ISC license.
|
|
231
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
232
|
+
*/const T1=ye("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/**
|
|
233
|
+
* @license lucide-react v0.469.0 - ISC
|
|
234
|
+
*
|
|
235
|
+
* This source code is licensed under the ISC license.
|
|
236
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
237
|
+
*/const Fv=ye("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
|
|
238
|
+
* @license lucide-react v0.469.0 - ISC
|
|
239
|
+
*
|
|
240
|
+
* This source code is licensed under the ISC license.
|
|
241
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
242
|
+
*/const C1=ye("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
|
|
243
|
+
* @license lucide-react v0.469.0 - ISC
|
|
244
|
+
*
|
|
245
|
+
* This source code is licensed under the ISC license.
|
|
246
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
247
|
+
*/const E1=ye("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
|
|
248
|
+
* @license lucide-react v0.469.0 - ISC
|
|
249
|
+
*
|
|
250
|
+
* This source code is licensed under the ISC license.
|
|
251
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
252
|
+
*/const j1=ye("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
|
|
253
|
+
* @license lucide-react v0.469.0 - ISC
|
|
254
|
+
*
|
|
255
|
+
* This source code is licensed under the ISC license.
|
|
256
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
257
|
+
*/const _1=ye("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
|
|
258
|
+
* @license lucide-react v0.469.0 - ISC
|
|
259
|
+
*
|
|
260
|
+
* This source code is licensed under the ISC license.
|
|
261
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
262
|
+
*/const hn=ye("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
263
|
+
* @license lucide-react v0.469.0 - ISC
|
|
264
|
+
*
|
|
265
|
+
* This source code is licensed under the ISC license.
|
|
266
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
267
|
+
*/const R1=ye("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
|
|
268
|
+
* @license lucide-react v0.469.0 - ISC
|
|
269
|
+
*
|
|
270
|
+
* This source code is licensed under the ISC license.
|
|
271
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
272
|
+
*/const A1=ye("MessageSquarePlus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/**
|
|
273
|
+
* @license lucide-react v0.469.0 - ISC
|
|
274
|
+
*
|
|
275
|
+
* This source code is licensed under the ISC license.
|
|
276
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
277
|
+
*/const Uv=ye("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
|
|
278
|
+
* @license lucide-react v0.469.0 - ISC
|
|
279
|
+
*
|
|
280
|
+
* This source code is licensed under the ISC license.
|
|
281
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
282
|
+
*/const I1=ye("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
|
|
283
|
+
* @license lucide-react v0.469.0 - ISC
|
|
284
|
+
*
|
|
285
|
+
* This source code is licensed under the ISC license.
|
|
286
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
287
|
+
*/const Im=ye("MonitorSmartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]);/**
|
|
288
|
+
* @license lucide-react v0.469.0 - ISC
|
|
289
|
+
*
|
|
290
|
+
* This source code is licensed under the ISC license.
|
|
291
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
292
|
+
*/const D1=ye("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/**
|
|
293
|
+
* @license lucide-react v0.469.0 - ISC
|
|
294
|
+
*
|
|
295
|
+
* This source code is licensed under the ISC license.
|
|
296
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
297
|
+
*/const M1=ye("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);/**
|
|
298
|
+
* @license lucide-react v0.469.0 - ISC
|
|
299
|
+
*
|
|
300
|
+
* This source code is licensed under the ISC license.
|
|
301
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
302
|
+
*/const L1=ye("PanelRightOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);/**
|
|
303
|
+
* @license lucide-react v0.469.0 - ISC
|
|
304
|
+
*
|
|
305
|
+
* This source code is licensed under the ISC license.
|
|
306
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
307
|
+
*/const O1=ye("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
|
|
308
|
+
* @license lucide-react v0.469.0 - ISC
|
|
309
|
+
*
|
|
310
|
+
* This source code is licensed under the ISC license.
|
|
311
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
312
|
+
*/const $1=ye("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/**
|
|
313
|
+
* @license lucide-react v0.469.0 - ISC
|
|
314
|
+
*
|
|
315
|
+
* This source code is licensed under the ISC license.
|
|
316
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
317
|
+
*/const hl=ye("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
|
|
318
|
+
* @license lucide-react v0.469.0 - ISC
|
|
319
|
+
*
|
|
320
|
+
* This source code is licensed under the ISC license.
|
|
321
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
322
|
+
*/const P1=ye("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
|
|
323
|
+
* @license lucide-react v0.469.0 - ISC
|
|
324
|
+
*
|
|
325
|
+
* This source code is licensed under the ISC license.
|
|
326
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
327
|
+
*/const z1=ye("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
|
|
328
|
+
* @license lucide-react v0.469.0 - ISC
|
|
329
|
+
*
|
|
330
|
+
* This source code is licensed under the ISC license.
|
|
331
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
332
|
+
*/const pr=ye("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
333
|
+
* @license lucide-react v0.469.0 - ISC
|
|
334
|
+
*
|
|
335
|
+
* This source code is licensed under the ISC license.
|
|
336
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
337
|
+
*/const Bv=ye("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/**
|
|
338
|
+
* @license lucide-react v0.469.0 - ISC
|
|
339
|
+
*
|
|
340
|
+
* This source code is licensed under the ISC license.
|
|
341
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
342
|
+
*/const Dm=ye("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
|
|
343
|
+
* @license lucide-react v0.469.0 - ISC
|
|
344
|
+
*
|
|
345
|
+
* This source code is licensed under the ISC license.
|
|
346
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
347
|
+
*/const F1=ye("Rewind",[["polygon",{points:"11 19 2 12 11 5 11 19",key:"14yba5"}],["polygon",{points:"22 19 13 12 22 5 22 19",key:"1pi1cj"}]]);/**
|
|
348
|
+
* @license lucide-react v0.469.0 - ISC
|
|
349
|
+
*
|
|
350
|
+
* This source code is licensed under the ISC license.
|
|
351
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
352
|
+
*/const $i=ye("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
|
|
353
|
+
* @license lucide-react v0.469.0 - ISC
|
|
354
|
+
*
|
|
355
|
+
* This source code is licensed under the ISC license.
|
|
356
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
357
|
+
*/const Wv=ye("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
|
|
358
|
+
* @license lucide-react v0.469.0 - ISC
|
|
359
|
+
*
|
|
360
|
+
* This source code is licensed under the ISC license.
|
|
361
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
362
|
+
*/const Hv=ye("SatelliteDish",[["path",{d:"M4 10a7.31 7.31 0 0 0 10 10Z",key:"1fzpp3"}],["path",{d:"m9 15 3-3",key:"88sc13"}],["path",{d:"M17 13a6 6 0 0 0-6-6",key:"15cc6u"}],["path",{d:"M21 13A10 10 0 0 0 11 3",key:"11nf8s"}]]);/**
|
|
363
|
+
* @license lucide-react v0.469.0 - ISC
|
|
364
|
+
*
|
|
365
|
+
* This source code is licensed under the ISC license.
|
|
366
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
367
|
+
*/const U1=ye("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
368
|
+
* @license lucide-react v0.469.0 - ISC
|
|
369
|
+
*
|
|
370
|
+
* This source code is licensed under the ISC license.
|
|
371
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
372
|
+
*/const Hi=ye("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
|
|
373
|
+
* @license lucide-react v0.469.0 - ISC
|
|
374
|
+
*
|
|
375
|
+
* This source code is licensed under the ISC license.
|
|
376
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
377
|
+
*/const B1=ye("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/**
|
|
378
|
+
* @license lucide-react v0.469.0 - ISC
|
|
379
|
+
*
|
|
380
|
+
* This source code is licensed under the ISC license.
|
|
381
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
382
|
+
*/const W1=ye("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
|
|
383
|
+
* @license lucide-react v0.469.0 - ISC
|
|
384
|
+
*
|
|
385
|
+
* This source code is licensed under the ISC license.
|
|
386
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
387
|
+
*/const Vv=ye("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/**
|
|
388
|
+
* @license lucide-react v0.469.0 - ISC
|
|
389
|
+
*
|
|
390
|
+
* This source code is licensed under the ISC license.
|
|
391
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
392
|
+
*/const yr=ye("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
393
|
+
* @license lucide-react v0.469.0 - ISC
|
|
394
|
+
*
|
|
395
|
+
* This source code is licensed under the ISC license.
|
|
396
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
397
|
+
*/const Rl=ye("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
|
|
398
|
+
* @license lucide-react v0.469.0 - ISC
|
|
399
|
+
*
|
|
400
|
+
* This source code is licensed under the ISC license.
|
|
401
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
402
|
+
*/const Ql=ye("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
403
|
+
* @license lucide-react v0.469.0 - ISC
|
|
404
|
+
*
|
|
405
|
+
* This source code is licensed under the ISC license.
|
|
406
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
407
|
+
*/const us=ye("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
|
408
|
+
* @license lucide-react v0.469.0 - ISC
|
|
409
|
+
*
|
|
410
|
+
* This source code is licensed under the ISC license.
|
|
411
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
412
|
+
*/const Zl=ye("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
413
|
+
* @license lucide-react v0.469.0 - ISC
|
|
414
|
+
*
|
|
415
|
+
* This source code is licensed under the ISC license.
|
|
416
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
417
|
+
*/const H1=ye("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/**
|
|
418
|
+
* @license lucide-react v0.469.0 - ISC
|
|
419
|
+
*
|
|
420
|
+
* This source code is licensed under the ISC license.
|
|
421
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
422
|
+
*/const V1=ye("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
|
|
423
|
+
* @license lucide-react v0.469.0 - ISC
|
|
424
|
+
*
|
|
425
|
+
* This source code is licensed under the ISC license.
|
|
426
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
427
|
+
*/const K1=ye("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
|
|
428
|
+
* @license lucide-react v0.469.0 - ISC
|
|
429
|
+
*
|
|
430
|
+
* This source code is licensed under the ISC license.
|
|
431
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
432
|
+
*/const Kv=ye("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
|
433
|
+
* @license lucide-react v0.469.0 - ISC
|
|
434
|
+
*
|
|
435
|
+
* This source code is licensed under the ISC license.
|
|
436
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
437
|
+
*/const G1=ye("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
|
|
438
|
+
* @license lucide-react v0.469.0 - ISC
|
|
439
|
+
*
|
|
440
|
+
* This source code is licensed under the ISC license.
|
|
441
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
442
|
+
*/const Tn=ye("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
|
|
443
|
+
* @license lucide-react v0.469.0 - ISC
|
|
444
|
+
*
|
|
445
|
+
* This source code is licensed under the ISC license.
|
|
446
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
447
|
+
*/const q1=ye("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),X1=new Set(["path","circle","rect","line","ellipse","polyline","polygon"]),Y1=new Set("d cx cy r rx ry x y width height x1 x2 y1 y2 points fill".split(" "));function Q1(e){return e.filter(([n])=>X1.has(n)).map(([n,r],o)=>[n,{...Object.fromEntries(Object.entries(r).filter(([a])=>Y1.has(a))),key:String(o)}])}function Do({iconNode:e,size:n=14,className:r}){const o=y.useMemo(()=>e?Q1(e):[],[e]);return o.length===0?l.jsx(Fv,{size:n,className:r,"aria-hidden":"true","data-testid":"app-icon-default"}):l.jsx(Iv,{iconNode:o,size:n,className:r,"aria-hidden":"true","data-testid":"app-icon"})}var Ni=tv();function Z1(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return y.useMemo(()=>o=>{n.forEach(a=>a(o))},n)}const Jl=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Mo(e){const n=Object.prototype.toString.call(e);return n==="[object Window]"||n==="[object global]"}function sf(e){return"nodeType"in e}function Cn(e){var n,r;return e?Mo(e)?e:sf(e)&&(n=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?n:window:window}function rf(e){const{Document:n}=Cn(e);return e instanceof n}function Vi(e){return Mo(e)?!1:e instanceof Cn(e).HTMLElement}function Gv(e){return e instanceof Cn(e).SVGElement}function Lo(e){return e?Mo(e)?e.document:sf(e)?rf(e)?e:Vi(e)||Gv(e)?e.ownerDocument:document:document:document}const fs=Jl?y.useLayoutEffect:y.useEffect;function ec(e){const n=y.useRef(e);return fs(()=>{n.current=e}),y.useCallback(function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return n.current==null?void 0:n.current(...o)},[])}function J1(){const e=y.useRef(null),n=y.useCallback((o,a)=>{e.current=setInterval(o,a)},[]),r=y.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[n,r]}function Pi(e,n){n===void 0&&(n=[e]);const r=y.useRef(e);return fs(()=>{r.current!==e&&(r.current=e)},n),r}function Ki(e,n){const r=y.useRef();return y.useMemo(()=>{const o=e(r.current);return r.current=o,o},[...n])}function Al(e){const n=ec(e),r=y.useRef(null),o=y.useCallback(a=>{a!==r.current&&(n==null||n(a,r.current)),r.current=a},[]);return[r,o]}function Il(e){const n=y.useRef();return y.useEffect(()=>{n.current=e},[e]),n.current}let td={};function Gi(e,n){return y.useMemo(()=>{if(n)return n;const r=td[e]==null?0:td[e]+1;return td[e]=r,e+"-"+r},[e,n])}function qv(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];return o.reduce((c,d)=>{const f=Object.entries(d);for(const[h,g]of f){const v=c[h];v!=null&&(c[h]=v+e*g)}return c},{...n})}}const Ro=qv(1),Dl=qv(-1);function eS(e){return"clientX"in e&&"clientY"in e}function tc(e){if(!e)return!1;const{KeyboardEvent:n}=Cn(e.target);return n&&e instanceof n}function tS(e){if(!e)return!1;const{TouchEvent:n}=Cn(e.target);return n&&e instanceof n}function Ml(e){if(tS(e)){if(e.touches&&e.touches.length){const{clientX:n,clientY:r}=e.touches[0];return{x:n,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:n,clientY:r}=e.changedTouches[0];return{x:n,y:r}}}return eS(e)?{x:e.clientX,y:e.clientY}:null}const Es=Object.freeze({Translate:{toString(e){if(!e)return;const{x:n,y:r}=e;return"translate3d("+(n?Math.round(n):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:n,scaleY:r}=e;return"scaleX("+n+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Es.Translate.toString(e),Es.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:n,duration:r,easing:o}=e;return n+" "+r+"ms "+o}}}),Mm="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function nS(e){return e.matches(Mm)?e:e.querySelector(Mm)}const sS={display:"none"};function rS(e){let{id:n,value:r}=e;return ct.createElement("div",{id:n,style:sS},r)}function oS(e){let{id:n,announcement:r,ariaLiveType:o="assertive"}=e;const a={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ct.createElement("div",{id:n,style:a,role:"status","aria-live":o,"aria-atomic":!0},r)}function iS(){const[e,n]=y.useState("");return{announce:y.useCallback(o=>{o!=null&&n(o)},[]),announcement:e}}const Xv=y.createContext(null);function aS(e){const n=y.useContext(Xv);y.useEffect(()=>{if(!n)throw new Error("useDndMonitor must be used within a children of <DndContext>");return n(e)},[e,n])}function lS(){const[e]=y.useState(()=>new Set),n=y.useCallback(o=>(e.add(o),()=>e.delete(o)),[e]);return[y.useCallback(o=>{let{type:a,event:c}=o;e.forEach(d=>{var f;return(f=d[a])==null?void 0:f.call(d,c)})},[e]),n]}const cS={draggable:`
|
|
448
|
+
To pick up a draggable item, press the space bar.
|
|
449
|
+
While dragging, use the arrow keys to move the item.
|
|
450
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
451
|
+
`},uS={onDragStart(e){let{active:n}=e;return"Picked up draggable item "+n.id+"."},onDragOver(e){let{active:n,over:r}=e;return r?"Draggable item "+n.id+" was moved over droppable area "+r.id+".":"Draggable item "+n.id+" is no longer over a droppable area."},onDragEnd(e){let{active:n,over:r}=e;return r?"Draggable item "+n.id+" was dropped over droppable area "+r.id:"Draggable item "+n.id+" was dropped."},onDragCancel(e){let{active:n}=e;return"Dragging was cancelled. Draggable item "+n.id+" was dropped."}};function dS(e){let{announcements:n=uS,container:r,hiddenTextDescribedById:o,screenReaderInstructions:a=cS}=e;const{announce:c,announcement:d}=iS(),f=Gi("DndLiveRegion"),[h,g]=y.useState(!1);if(y.useEffect(()=>{g(!0)},[]),aS(y.useMemo(()=>({onDragStart(k){let{active:x}=k;c(n.onDragStart({active:x}))},onDragMove(k){let{active:x,over:S}=k;n.onDragMove&&c(n.onDragMove({active:x,over:S}))},onDragOver(k){let{active:x,over:S}=k;c(n.onDragOver({active:x,over:S}))},onDragEnd(k){let{active:x,over:S}=k;c(n.onDragEnd({active:x,over:S}))},onDragCancel(k){let{active:x,over:S}=k;c(n.onDragCancel({active:x,over:S}))}}),[c,n])),!h)return null;const v=ct.createElement(ct.Fragment,null,ct.createElement(rS,{id:o,value:a.draggable}),ct.createElement(oS,{id:f,announcement:d}));return r?Ni.createPortal(v,r):v}var Ht;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Ht||(Ht={}));function Ll(){}function Yv(e,n){return y.useMemo(()=>({sensor:e,options:n??{}}),[e,n])}function Qv(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return y.useMemo(()=>[...n].filter(o=>o!=null),[...n])}const ps=Object.freeze({x:0,y:0});function fS(e,n){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function pS(e,n){const r=Ml(e);if(!r)return"0 0";const o={x:(r.x-n.left)/n.width*100,y:(r.y-n.top)/n.height*100};return o.x+"% "+o.y+"%"}function hS(e,n){let{data:{value:r}}=e,{data:{value:o}}=n;return r-o}function mS(e,n){let{data:{value:r}}=e,{data:{value:o}}=n;return o-r}function gS(e,n){if(!e||e.length===0)return null;const[r]=e;return r[n]}function Lm(e,n,r){return n===void 0&&(n=e.left),r===void 0&&(r=e.top),{x:n+e.width*.5,y:r+e.height*.5}}const Zv=e=>{let{collisionRect:n,droppableRects:r,droppableContainers:o}=e;const a=Lm(n,n.left,n.top),c=[];for(const d of o){const{id:f}=d,h=r.get(f);if(h){const g=fS(Lm(h),a);c.push({id:f,data:{droppableContainer:d,value:g}})}}return c.sort(hS)};function vS(e,n){const r=Math.max(n.top,e.top),o=Math.max(n.left,e.left),a=Math.min(n.left+n.width,e.left+e.width),c=Math.min(n.top+n.height,e.top+e.height),d=a-o,f=c-r;if(o<a&&r<c){const h=n.width*n.height,g=e.width*e.height,v=d*f,k=v/(h+g-v);return Number(k.toFixed(4))}return 0}const yS=e=>{let{collisionRect:n,droppableRects:r,droppableContainers:o}=e;const a=[];for(const c of o){const{id:d}=c,f=r.get(d);if(f){const h=vS(f,n);h>0&&a.push({id:d,data:{droppableContainer:c,value:h}})}}return a.sort(mS)};function xS(e,n,r){return{...e,scaleX:n&&r?n.width/r.width:1,scaleY:n&&r?n.height/r.height:1}}function Jv(e,n){return e&&n?{x:e.left-n.left,y:e.top-n.top}:ps}function wS(e){return function(r){for(var o=arguments.length,a=new Array(o>1?o-1:0),c=1;c<o;c++)a[c-1]=arguments[c];return a.reduce((d,f)=>({...d,top:d.top+e*f.y,bottom:d.bottom+e*f.y,left:d.left+e*f.x,right:d.right+e*f.x}),{...r})}}const kS=wS(1);function ey(e){if(e.startsWith("matrix3d(")){const n=e.slice(9,-1).split(/, /);return{x:+n[12],y:+n[13],scaleX:+n[0],scaleY:+n[5]}}else if(e.startsWith("matrix(")){const n=e.slice(7,-1).split(/, /);return{x:+n[4],y:+n[5],scaleX:+n[0],scaleY:+n[3]}}return null}function SS(e,n,r){const o=ey(n);if(!o)return e;const{scaleX:a,scaleY:c,x:d,y:f}=o,h=e.left-d-(1-a)*parseFloat(r),g=e.top-f-(1-c)*parseFloat(r.slice(r.indexOf(" ")+1)),v=a?e.width/a:e.width,k=c?e.height/c:e.height;return{width:v,height:k,top:g,right:h+v,bottom:g+k,left:h}}const bS={ignoreTransform:!1};function Oo(e,n){n===void 0&&(n=bS);let r=e.getBoundingClientRect();if(n.ignoreTransform){const{transform:g,transformOrigin:v}=Cn(e).getComputedStyle(e);g&&(r=SS(r,g,v))}const{top:o,left:a,width:c,height:d,bottom:f,right:h}=r;return{top:o,left:a,width:c,height:d,bottom:f,right:h}}function Om(e){return Oo(e,{ignoreTransform:!0})}function NS(e){const n=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:n,bottom:r,width:n,height:r}}function TS(e,n){return n===void 0&&(n=Cn(e).getComputedStyle(e)),n.position==="fixed"}function CS(e,n){n===void 0&&(n=Cn(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const c=n[a];return typeof c=="string"?r.test(c):!1})}function of(e,n){const r=[];function o(a){if(n!=null&&r.length>=n||!a)return r;if(rf(a)&&a.scrollingElement!=null&&!r.includes(a.scrollingElement))return r.push(a.scrollingElement),r;if(!Vi(a)||Gv(a)||r.includes(a))return r;const c=Cn(e).getComputedStyle(a);return a!==e&&CS(a,c)&&r.push(a),TS(a,c)?r:o(a.parentNode)}return e?o(e):r}function ty(e){const[n]=of(e,1);return n??null}function nd(e){return!Jl||!e?null:Mo(e)?e:sf(e)?rf(e)||e===Lo(e).scrollingElement?window:Vi(e)?e:null:null}function ny(e){return Mo(e)?e.scrollX:e.scrollLeft}function sy(e){return Mo(e)?e.scrollY:e.scrollTop}function kd(e){return{x:ny(e),y:sy(e)}}var en;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(en||(en={}));function ry(e){return!Jl||!e?!1:e===document.scrollingElement}function oy(e){const n={x:0,y:0},r=ry(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},o={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},a=e.scrollTop<=n.y,c=e.scrollLeft<=n.x,d=e.scrollTop>=o.y,f=e.scrollLeft>=o.x;return{isTop:a,isLeft:c,isBottom:d,isRight:f,maxScroll:o,minScroll:n}}const ES={x:.2,y:.2};function jS(e,n,r,o,a){let{top:c,left:d,right:f,bottom:h}=r;o===void 0&&(o=10),a===void 0&&(a=ES);const{isTop:g,isBottom:v,isLeft:k,isRight:x}=oy(e),S={x:0,y:0},E={x:0,y:0},b={height:n.height*a.y,width:n.width*a.x};return!g&&c<=n.top+b.height?(S.y=en.Backward,E.y=o*Math.abs((n.top+b.height-c)/b.height)):!v&&h>=n.bottom-b.height&&(S.y=en.Forward,E.y=o*Math.abs((n.bottom-b.height-h)/b.height)),!x&&f>=n.right-b.width?(S.x=en.Forward,E.x=o*Math.abs((n.right-b.width-f)/b.width)):!k&&d<=n.left+b.width&&(S.x=en.Backward,E.x=o*Math.abs((n.left+b.width-d)/b.width)),{direction:S,speed:E}}function _S(e){if(e===document.scrollingElement){const{innerWidth:c,innerHeight:d}=window;return{top:0,left:0,right:c,bottom:d,width:c,height:d}}const{top:n,left:r,right:o,bottom:a}=e.getBoundingClientRect();return{top:n,left:r,right:o,bottom:a,width:e.clientWidth,height:e.clientHeight}}function iy(e){return e.reduce((n,r)=>Ro(n,kd(r)),ps)}function RS(e){return e.reduce((n,r)=>n+ny(r),0)}function AS(e){return e.reduce((n,r)=>n+sy(r),0)}function ay(e,n){if(n===void 0&&(n=Oo),!e)return;const{top:r,left:o,bottom:a,right:c}=n(e);ty(e)&&(a<=0||c<=0||r>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const IS=[["x",["left","right"],RS],["y",["top","bottom"],AS]];class af{constructor(n,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const o=of(r),a=iy(o);this.rect={...n},this.width=n.width,this.height=n.height;for(const[c,d,f]of IS)for(const h of d)Object.defineProperty(this,h,{get:()=>{const g=f(o),v=a[c]-g;return this.rect[h]+v},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ei{constructor(n){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...r)})},this.target=n}add(n,r,o){var a;(a=this.target)==null||a.addEventListener(n,r,o),this.listeners.push([n,r,o])}}function DS(e){const{EventTarget:n}=Cn(e);return e instanceof n?e:Lo(e)}function sd(e,n){const r=Math.abs(e.x),o=Math.abs(e.y);return typeof n=="number"?Math.sqrt(r**2+o**2)>n:"x"in n&&"y"in n?r>n.x&&o>n.y:"x"in n?r>n.x:"y"in n?o>n.y:!1}var es;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(es||(es={}));function $m(e){e.preventDefault()}function MS(e){e.stopPropagation()}var nt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(nt||(nt={}));const ly={start:[nt.Space,nt.Enter],cancel:[nt.Esc],end:[nt.Space,nt.Enter,nt.Tab]},LS=(e,n)=>{let{currentCoordinates:r}=n;switch(e.code){case nt.Right:return{...r,x:r.x+25};case nt.Left:return{...r,x:r.x-25};case nt.Down:return{...r,y:r.y+25};case nt.Up:return{...r,y:r.y-25}}};class cy{constructor(n){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=n;const{event:{target:r}}=n;this.props=n,this.listeners=new Ei(Lo(r)),this.windowListeners=new Ei(Cn(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(es.Resize,this.handleCancel),this.windowListeners.add(es.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(es.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:n,onStart:r}=this.props,o=n.node.current;o&&ay(o),r(ps)}handleKeyDown(n){if(tc(n)){const{active:r,context:o,options:a}=this.props,{keyboardCodes:c=ly,coordinateGetter:d=LS,scrollBehavior:f="smooth"}=a,{code:h}=n;if(c.end.includes(h)){this.handleEnd(n);return}if(c.cancel.includes(h)){this.handleCancel(n);return}const{collisionRect:g}=o.current,v=g?{x:g.left,y:g.top}:ps;this.referenceCoordinates||(this.referenceCoordinates=v);const k=d(n,{active:r,context:o.current,currentCoordinates:v});if(k){const x=Dl(k,v),S={x:0,y:0},{scrollableAncestors:E}=o.current;for(const b of E){const T=n.code,{isTop:N,isRight:_,isLeft:z,isBottom:M,maxScroll:O,minScroll:X}=oy(b),U=_S(b),P={x:Math.min(T===nt.Right?U.right-U.width/2:U.right,Math.max(T===nt.Right?U.left:U.left+U.width/2,k.x)),y:Math.min(T===nt.Down?U.bottom-U.height/2:U.bottom,Math.max(T===nt.Down?U.top:U.top+U.height/2,k.y))},Q=T===nt.Right&&!_||T===nt.Left&&!z,ce=T===nt.Down&&!M||T===nt.Up&&!N;if(Q&&P.x!==k.x){const ue=b.scrollLeft+x.x,me=T===nt.Right&&ue<=O.x||T===nt.Left&&ue>=X.x;if(me&&!x.y){b.scrollTo({left:ue,behavior:f});return}me?S.x=b.scrollLeft-ue:S.x=T===nt.Right?b.scrollLeft-O.x:b.scrollLeft-X.x,S.x&&b.scrollBy({left:-S.x,behavior:f});break}else if(ce&&P.y!==k.y){const ue=b.scrollTop+x.y,me=T===nt.Down&&ue<=O.y||T===nt.Up&&ue>=X.y;if(me&&!x.x){b.scrollTo({top:ue,behavior:f});return}me?S.y=b.scrollTop-ue:S.y=T===nt.Down?b.scrollTop-O.y:b.scrollTop-X.y,S.y&&b.scrollBy({top:-S.y,behavior:f});break}}this.handleMove(n,Ro(Dl(k,this.referenceCoordinates),S))}}}handleMove(n,r){const{onMove:o}=this.props;n.preventDefault(),o(r)}handleEnd(n){const{onEnd:r}=this.props;n.preventDefault(),this.detach(),r()}handleCancel(n){const{onCancel:r}=this.props;n.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}cy.activators=[{eventName:"onKeyDown",handler:(e,n,r)=>{let{keyboardCodes:o=ly,onActivation:a}=n,{active:c}=r;const{code:d}=e.nativeEvent;if(o.start.includes(d)){const f=c.activatorNode.current;return f&&e.target!==f?!1:(e.preventDefault(),a==null||a({event:e.nativeEvent}),!0)}return!1}}];function Pm(e){return!!(e&&"distance"in e)}function zm(e){return!!(e&&"delay"in e)}class lf{constructor(n,r,o){var a;o===void 0&&(o=DS(n.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=n,this.events=r;const{event:c}=n,{target:d}=c;this.props=n,this.events=r,this.document=Lo(d),this.documentListeners=new Ei(this.document),this.listeners=new Ei(o),this.windowListeners=new Ei(Cn(d)),this.initialCoordinates=(a=Ml(c))!=null?a:ps,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:n,props:{options:{activationConstraint:r,bypassActivationConstraint:o}}}=this;if(this.listeners.add(n.move.name,this.handleMove,{passive:!1}),this.listeners.add(n.end.name,this.handleEnd),n.cancel&&this.listeners.add(n.cancel.name,this.handleCancel),this.windowListeners.add(es.Resize,this.handleCancel),this.windowListeners.add(es.DragStart,$m),this.windowListeners.add(es.VisibilityChange,this.handleCancel),this.windowListeners.add(es.ContextMenu,$m),this.documentListeners.add(es.Keydown,this.handleKeydown),r){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(zm(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Pm(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(n,r){const{active:o,onPending:a}=this.props;a(o,n,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:n}=this,{onStart:r}=this.props;n&&(this.activated=!0,this.documentListeners.add(es.Click,MS,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(es.SelectionChange,this.removeTextSelection),r(n))}handleMove(n){var r;const{activated:o,initialCoordinates:a,props:c}=this,{onMove:d,options:{activationConstraint:f}}=c;if(!a)return;const h=(r=Ml(n))!=null?r:ps,g=Dl(a,h);if(!o&&f){if(Pm(f)){if(f.tolerance!=null&&sd(g,f.tolerance))return this.handleCancel();if(sd(g,f.distance))return this.handleStart()}if(zm(f)&&sd(g,f.tolerance))return this.handleCancel();this.handlePending(f,g);return}n.cancelable&&n.preventDefault(),d(h)}handleEnd(){const{onAbort:n,onEnd:r}=this.props;this.detach(),this.activated||n(this.props.active),r()}handleCancel(){const{onAbort:n,onCancel:r}=this.props;this.detach(),this.activated||n(this.props.active),r()}handleKeydown(n){n.code===nt.Esc&&this.handleCancel()}removeTextSelection(){var n;(n=this.document.getSelection())==null||n.removeAllRanges()}}const OS={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class nc extends lf{constructor(n){const{event:r}=n,o=Lo(r.target);super(n,OS,o)}}nc.activators=[{eventName:"onPointerDown",handler:(e,n)=>{let{nativeEvent:r}=e,{onActivation:o}=n;return!r.isPrimary||r.button!==0?!1:(o==null||o({event:r}),!0)}}];const $S={move:{name:"mousemove"},end:{name:"mouseup"}};var Sd;(function(e){e[e.RightClick=2]="RightClick"})(Sd||(Sd={}));class PS extends lf{constructor(n){super(n,$S,Lo(n.event.target))}}PS.activators=[{eventName:"onMouseDown",handler:(e,n)=>{let{nativeEvent:r}=e,{onActivation:o}=n;return r.button===Sd.RightClick?!1:(o==null||o({event:r}),!0)}}];const rd={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class zS extends lf{constructor(n){super(n,rd)}static setup(){return window.addEventListener(rd.move.name,n,{capture:!1,passive:!1}),function(){window.removeEventListener(rd.move.name,n)};function n(){}}}zS.activators=[{eventName:"onTouchStart",handler:(e,n)=>{let{nativeEvent:r}=e,{onActivation:o}=n;const{touches:a}=r;return a.length>1?!1:(o==null||o({event:r}),!0)}}];var ji;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ji||(ji={}));var Ol;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ol||(Ol={}));function FS(e){let{acceleration:n,activator:r=ji.Pointer,canScroll:o,draggingRect:a,enabled:c,interval:d=5,order:f=Ol.TreeOrder,pointerCoordinates:h,scrollableAncestors:g,scrollableAncestorRects:v,delta:k,threshold:x}=e;const S=BS({delta:k,disabled:!c}),[E,b]=J1(),T=y.useRef({x:0,y:0}),N=y.useRef({x:0,y:0}),_=y.useMemo(()=>{switch(r){case ji.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case ji.DraggableRect:return a}},[r,a,h]),z=y.useRef(null),M=y.useCallback(()=>{const X=z.current;if(!X)return;const U=T.current.x*N.current.x,P=T.current.y*N.current.y;X.scrollBy(U,P)},[]),O=y.useMemo(()=>f===Ol.TreeOrder?[...g].reverse():g,[f,g]);y.useEffect(()=>{if(!c||!g.length||!_){b();return}for(const X of O){if((o==null?void 0:o(X))===!1)continue;const U=g.indexOf(X),P=v[U];if(!P)continue;const{direction:Q,speed:ce}=jS(X,P,_,n,x);for(const ue of["x","y"])S[ue][Q[ue]]||(ce[ue]=0,Q[ue]=0);if(ce.x>0||ce.y>0){b(),z.current=X,E(M,d),T.current=ce,N.current=Q;return}}T.current={x:0,y:0},N.current={x:0,y:0},b()},[n,M,o,b,c,d,JSON.stringify(_),JSON.stringify(S),E,g,O,v,JSON.stringify(x)])}const US={x:{[en.Backward]:!1,[en.Forward]:!1},y:{[en.Backward]:!1,[en.Forward]:!1}};function BS(e){let{delta:n,disabled:r}=e;const o=Il(n);return Ki(a=>{if(r||!o||!a)return US;const c={x:Math.sign(n.x-o.x),y:Math.sign(n.y-o.y)};return{x:{[en.Backward]:a.x[en.Backward]||c.x===-1,[en.Forward]:a.x[en.Forward]||c.x===1},y:{[en.Backward]:a.y[en.Backward]||c.y===-1,[en.Forward]:a.y[en.Forward]||c.y===1}}},[r,n,o])}function WS(e,n){const r=n!=null?e.get(n):void 0,o=r?r.node.current:null;return Ki(a=>{var c;return n==null?null:(c=o??a)!=null?c:null},[o,n])}function HS(e,n){return y.useMemo(()=>e.reduce((r,o)=>{const{sensor:a}=o,c=a.activators.map(d=>({eventName:d.eventName,handler:n(d.handler,o)}));return[...r,...c]},[]),[e,n])}var zi;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(zi||(zi={}));var bd;(function(e){e.Optimized="optimized"})(bd||(bd={}));const Fm=new Map;function VS(e,n){let{dragging:r,dependencies:o,config:a}=n;const[c,d]=y.useState(null),{frequency:f,measure:h,strategy:g}=a,v=y.useRef(e),k=T(),x=Pi(k),S=y.useCallback(function(N){N===void 0&&(N=[]),!x.current&&d(_=>_===null?N:_.concat(N.filter(z=>!_.includes(z))))},[x]),E=y.useRef(null),b=Ki(N=>{if(k&&!r)return Fm;if(!N||N===Fm||v.current!==e||c!=null){const _=new Map;for(let z of e){if(!z)continue;if(c&&c.length>0&&!c.includes(z.id)&&z.rect.current){_.set(z.id,z.rect.current);continue}const M=z.node.current,O=M?new af(h(M),M):null;z.rect.current=O,O&&_.set(z.id,O)}return _}return N},[e,c,r,k,h]);return y.useEffect(()=>{v.current=e},[e]),y.useEffect(()=>{k||S()},[r,k]),y.useEffect(()=>{c&&c.length>0&&d(null)},[JSON.stringify(c)]),y.useEffect(()=>{k||typeof f!="number"||E.current!==null||(E.current=setTimeout(()=>{S(),E.current=null},f))},[f,k,S,...o]),{droppableRects:b,measureDroppableContainers:S,measuringScheduled:c!=null};function T(){switch(g){case zi.Always:return!1;case zi.BeforeDragging:return r;default:return!r}}}function cf(e,n){return Ki(r=>e?r||(typeof n=="function"?n(e):e):null,[n,e])}function KS(e,n){return cf(e,n)}function GS(e){let{callback:n,disabled:r}=e;const o=ec(n),a=y.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(o)},[o,r]);return y.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function sc(e){let{callback:n,disabled:r}=e;const o=ec(n),a=y.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(o)},[r]);return y.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function qS(e){return new af(Oo(e),e)}function Um(e,n,r){n===void 0&&(n=qS);const[o,a]=y.useState(null);function c(){a(h=>{if(!e)return null;if(e.isConnected===!1){var g;return(g=h??r)!=null?g:null}const v=n(e);return JSON.stringify(h)===JSON.stringify(v)?h:v})}const d=GS({callback(h){if(e)for(const g of h){const{type:v,target:k}=g;if(v==="childList"&&k instanceof HTMLElement&&k.contains(e)){c();break}}}}),f=sc({callback:c});return fs(()=>{c(),e?(f==null||f.observe(e),d==null||d.observe(document.body,{childList:!0,subtree:!0})):(f==null||f.disconnect(),d==null||d.disconnect())},[e]),o}function XS(e){const n=cf(e);return Jv(e,n)}const Bm=[];function YS(e){const n=y.useRef(e),r=Ki(o=>e?o&&o!==Bm&&e&&n.current&&e.parentNode===n.current.parentNode?o:of(e):Bm,[e]);return y.useEffect(()=>{n.current=e},[e]),r}function QS(e){const[n,r]=y.useState(null),o=y.useRef(e),a=y.useCallback(c=>{const d=nd(c.target);d&&r(f=>f?(f.set(d,kd(d)),new Map(f)):null)},[]);return y.useEffect(()=>{const c=o.current;if(e!==c){d(c);const f=e.map(h=>{const g=nd(h);return g?(g.addEventListener("scroll",a,{passive:!0}),[g,kd(g)]):null}).filter(h=>h!=null);r(f.length?new Map(f):null),o.current=e}return()=>{d(e),d(c)};function d(f){f.forEach(h=>{const g=nd(h);g==null||g.removeEventListener("scroll",a)})}},[a,e]),y.useMemo(()=>e.length?n?Array.from(n.values()).reduce((c,d)=>Ro(c,d),ps):iy(e):ps,[e,n])}function Wm(e,n){n===void 0&&(n=[]);const r=y.useRef(null);return y.useEffect(()=>{r.current=null},n),y.useEffect(()=>{const o=e!==ps;o&&!r.current&&(r.current=e),!o&&r.current&&(r.current=null)},[e]),r.current?Dl(e,r.current):ps}function ZS(e){y.useEffect(()=>{if(!Jl)return;const n=e.map(r=>{let{sensor:o}=r;return o.setup==null?void 0:o.setup()});return()=>{for(const r of n)r==null||r()}},e.map(n=>{let{sensor:r}=n;return r}))}function JS(e,n){return y.useMemo(()=>e.reduce((r,o)=>{let{eventName:a,handler:c}=o;return r[a]=d=>{c(d,n)},r},{}),[e,n])}function uy(e){return y.useMemo(()=>e?NS(e):null,[e])}const Hm=[];function eb(e,n){n===void 0&&(n=Oo);const[r]=e,o=uy(r?Cn(r):null),[a,c]=y.useState(Hm);function d(){c(()=>e.length?e.map(h=>ry(h)?o:new af(n(h),h)):Hm)}const f=sc({callback:d});return fs(()=>{f==null||f.disconnect(),d(),e.forEach(h=>f==null?void 0:f.observe(h))},[e]),a}function dy(e){if(!e)return null;if(e.children.length>1)return e;const n=e.children[0];return Vi(n)?n:e}function tb(e){let{measure:n}=e;const[r,o]=y.useState(null),a=y.useCallback(g=>{for(const{target:v}of g)if(Vi(v)){o(k=>{const x=n(v);return k?{...k,width:x.width,height:x.height}:x});break}},[n]),c=sc({callback:a}),d=y.useCallback(g=>{const v=dy(g);c==null||c.disconnect(),v&&(c==null||c.observe(v)),o(v?n(v):null)},[n,c]),[f,h]=Al(d);return y.useMemo(()=>({nodeRef:f,rect:r,setRef:h}),[r,f,h])}const nb=[{sensor:nc,options:{}},{sensor:cy,options:{}}],sb={current:{}},ml={draggable:{measure:Om},droppable:{measure:Om,strategy:zi.WhileDragging,frequency:bd.Optimized},dragOverlay:{measure:Oo}};class _i extends Map{get(n){var r;return n!=null&&(r=super.get(n))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(n=>{let{disabled:r}=n;return!r})}getNodeFor(n){var r,o;return(r=(o=this.get(n))==null?void 0:o.node.current)!=null?r:void 0}}const rb={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new _i,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ll},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ml,measureDroppableContainers:Ll,windowRect:null,measuringScheduled:!1},fy={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Ll,draggableNodes:new Map,over:null,measureDroppableContainers:Ll},qi=y.createContext(fy),py=y.createContext(rb);function ob(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new _i}}}function ib(e,n){switch(n.type){case Ht.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:n.initialCoordinates,active:n.active}};case Ht.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:n.coordinates.x-e.draggable.initialCoordinates.x,y:n.coordinates.y-e.draggable.initialCoordinates.y}}};case Ht.DragEnd:case Ht.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ht.RegisterDroppable:{const{element:r}=n,{id:o}=r,a=new _i(e.droppable.containers);return a.set(o,r),{...e,droppable:{...e.droppable,containers:a}}}case Ht.SetDroppableDisabled:{const{id:r,key:o,disabled:a}=n,c=e.droppable.containers.get(r);if(!c||o!==c.key)return e;const d=new _i(e.droppable.containers);return d.set(r,{...c,disabled:a}),{...e,droppable:{...e.droppable,containers:d}}}case Ht.UnregisterDroppable:{const{id:r,key:o}=n,a=e.droppable.containers.get(r);if(!a||o!==a.key)return e;const c=new _i(e.droppable.containers);return c.delete(r),{...e,droppable:{...e.droppable,containers:c}}}default:return e}}function ab(e){let{disabled:n}=e;const{active:r,activatorEvent:o,draggableNodes:a}=y.useContext(qi),c=Il(o),d=Il(r==null?void 0:r.id);return y.useEffect(()=>{if(!n&&!o&&c&&d!=null){if(!tc(c)||document.activeElement===c.target)return;const f=a.get(d);if(!f)return;const{activatorNode:h,node:g}=f;if(!h.current&&!g.current)return;requestAnimationFrame(()=>{for(const v of[h.current,g.current]){if(!v)continue;const k=nS(v);if(k){k.focus();break}}})}},[o,n,a,d,c]),null}function hy(e,n){let{transform:r,...o}=n;return e!=null&&e.length?e.reduce((a,c)=>c({transform:a,...o}),r):r}function lb(e){return y.useMemo(()=>({draggable:{...ml.draggable,...e==null?void 0:e.draggable},droppable:{...ml.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ml.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function cb(e){let{activeNode:n,measure:r,initialRect:o,config:a=!0}=e;const c=y.useRef(!1),{x:d,y:f}=typeof a=="boolean"?{x:a,y:a}:a;fs(()=>{if(!d&&!f||!n){c.current=!1;return}if(c.current||!o)return;const g=n==null?void 0:n.node.current;if(!g||g.isConnected===!1)return;const v=r(g),k=Jv(v,o);if(d||(k.x=0),f||(k.y=0),c.current=!0,Math.abs(k.x)>0||Math.abs(k.y)>0){const x=ty(g);x&&x.scrollBy({top:k.y,left:k.x})}},[n,d,f,o,r])}const rc=y.createContext({...ps,scaleX:1,scaleY:1});var dr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(dr||(dr={}));const my=y.memo(function(n){var r,o,a,c;let{id:d,accessibility:f,autoScroll:h=!0,children:g,sensors:v=nb,collisionDetection:k=yS,measuring:x,modifiers:S,...E}=n;const b=y.useReducer(ib,void 0,ob),[T,N]=b,[_,z]=lS(),[M,O]=y.useState(dr.Uninitialized),X=M===dr.Initialized,{draggable:{active:U,nodes:P,translate:Q},droppable:{containers:ce}}=T,ue=U!=null?P.get(U):null,me=y.useRef({initial:null,translated:null}),Ne=y.useMemo(()=>{var Ze;return U!=null?{id:U,data:(Ze=ue==null?void 0:ue.data)!=null?Ze:sb,rect:me}:null},[U,ue]),Me=y.useRef(null),[J,re]=y.useState(null),[ee,F]=y.useState(null),Z=Pi(E,Object.values(E)),G=Gi("DndDescribedBy",d),I=y.useMemo(()=>ce.getEnabled(),[ce]),$=lb(x),{droppableRects:le,measureDroppableContainers:H,measuringScheduled:q}=VS(I,{dragging:X,dependencies:[Q.x,Q.y],config:$.droppable}),ae=WS(P,U),Se=y.useMemo(()=>ee?Ml(ee):null,[ee]),_e=vn(),Ae=KS(ae,$.draggable.measure);cb({activeNode:U!=null?P.get(U):null,config:_e.layoutShiftCompensation,initialRect:Ae,measure:$.draggable.measure});const je=Um(ae,$.draggable.measure,Ae),ge=Um(ae?ae.parentElement:null),he=y.useRef({activatorEvent:null,active:null,activeNode:ae,collisionRect:null,collisions:null,droppableRects:le,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:ce,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ve=ce.getNodeFor((r=he.current.over)==null?void 0:r.id),Ie=tb({measure:$.dragOverlay.measure}),mt=(o=Ie.nodeRef.current)!=null?o:ae,Ue=X?(a=Ie.rect)!=null?a:je:null,Vt=!!(Ie.nodeRef.current&&Ie.rect),tn=XS(Vt?null:je),St=uy(mt?Cn(mt):null),jt=YS(X?Ve??ae:null),Ft=eb(jt),Ot=hy(S,{transform:{x:Q.x-tn.x,y:Q.y-tn.y,scaleX:1,scaleY:1},activatorEvent:ee,active:Ne,activeNodeRect:je,containerNodeRect:ge,draggingNodeRect:Ue,over:he.current.over,overlayNodeRect:Ie.rect,scrollableAncestors:jt,scrollableAncestorRects:Ft,windowRect:St}),Y=Se?Ro(Se,Q):null,ve=QS(jt),Be=Wm(ve),rt=Wm(ve,[je]),gt=Ro(Ot,Be),vt=Ue?kS(Ue,Ot):null,_t=Ne&&vt?k({active:Ne,collisionRect:vt,droppableRects:le,droppableContainers:I,pointerCoordinates:Y}):null,an=gS(_t,"id"),[dt,Mn]=y.useState(null),Ln=Vt?Ot:Ro(Ot,rt),hs=xS(Ln,(c=dt==null?void 0:dt.rect)!=null?c:null,je),ms=y.useRef(null),ns=y.useCallback((Ze,Rt)=>{let{sensor:ft,options:Gt}=Rt;if(Me.current==null)return;const yt=P.get(Me.current);if(!yt)return;const xt=Ze.nativeEvent,lt=new ft({active:Me.current,activeNode:yt,event:xt,options:Gt,context:he,onAbort(it){if(!P.get(it))return;const{onDragAbort:R}=Z.current,pe={id:it};R==null||R(pe),_({type:"onDragAbort",event:pe})},onPending(it,$t,R,pe){if(!P.get(it))return;const{onDragPending:we}=Z.current,$e={id:it,constraint:$t,initialCoordinates:R,offset:pe};we==null||we($e),_({type:"onDragPending",event:$e})},onStart(it){const $t=Me.current;if($t==null)return;const R=P.get($t);if(!R)return;const{onDragStart:pe}=Z.current,ie={activatorEvent:xt,active:{id:$t,data:R.data,rect:me}};Ni.unstable_batchedUpdates(()=>{pe==null||pe(ie),O(dr.Initializing),N({type:Ht.DragStart,initialCoordinates:it,active:$t}),_({type:"onDragStart",event:ie}),re(ms.current),F(xt)})},onMove(it){N({type:Ht.DragMove,coordinates:it})},onEnd:qt(Ht.DragEnd),onCancel:qt(Ht.DragCancel)});ms.current=lt;function qt(it){return async function(){const{active:R,collisions:pe,over:ie,scrollAdjustedTranslate:we}=he.current;let $e=null;if(R&&we){const{cancelDrop:qe}=Z.current;$e={activatorEvent:xt,active:R,collisions:pe,delta:we,over:ie},it===Ht.DragEnd&&typeof qe=="function"&&await Promise.resolve(qe($e))&&(it=Ht.DragCancel)}Me.current=null,Ni.unstable_batchedUpdates(()=>{N({type:it}),O(dr.Uninitialized),Mn(null),re(null),F(null),ms.current=null;const qe=it===Ht.DragEnd?"onDragEnd":"onDragCancel";if($e){const Pe=Z.current[qe];Pe==null||Pe($e),_({type:qe,event:$e})}})}}},[P]),On=y.useCallback((Ze,Rt)=>(ft,Gt)=>{const yt=ft.nativeEvent,xt=P.get(Gt);if(Me.current!==null||!xt||yt.dndKit||yt.defaultPrevented)return;const lt={active:xt};Ze(ft,Rt.options,lt)===!0&&(yt.dndKit={capturedBy:Rt.sensor},Me.current=Gt,ns(ft,Rt))},[P,ns]),gn=HS(v,On);ZS(v),fs(()=>{je&&M===dr.Initializing&&O(dr.Initialized)},[je,M]),y.useEffect(()=>{const{onDragMove:Ze}=Z.current,{active:Rt,activatorEvent:ft,collisions:Gt,over:yt}=he.current;if(!Rt||!ft)return;const xt={active:Rt,activatorEvent:ft,collisions:Gt,delta:{x:gt.x,y:gt.y},over:yt};Ni.unstable_batchedUpdates(()=>{Ze==null||Ze(xt),_({type:"onDragMove",event:xt})})},[gt.x,gt.y]),y.useEffect(()=>{const{active:Ze,activatorEvent:Rt,collisions:ft,droppableContainers:Gt,scrollAdjustedTranslate:yt}=he.current;if(!Ze||Me.current==null||!Rt||!yt)return;const{onDragOver:xt}=Z.current,lt=Gt.get(an),qt=lt&<.rect.current?{id:lt.id,rect:lt.rect.current,data:lt.data,disabled:lt.disabled}:null,it={active:Ze,activatorEvent:Rt,collisions:ft,delta:{x:yt.x,y:yt.y},over:qt};Ni.unstable_batchedUpdates(()=>{Mn(qt),xt==null||xt(it),_({type:"onDragOver",event:it})})},[an]),fs(()=>{he.current={activatorEvent:ee,active:Ne,activeNode:ae,collisionRect:vt,collisions:_t,droppableRects:le,draggableNodes:P,draggingNode:mt,draggingNodeRect:Ue,droppableContainers:ce,over:dt,scrollableAncestors:jt,scrollAdjustedTranslate:gt},me.current={initial:Ue,translated:vt}},[Ne,ae,_t,vt,P,mt,Ue,le,ce,dt,jt,gt]),FS({..._e,delta:Q,draggingRect:vt,pointerCoordinates:Y,scrollableAncestors:jt,scrollableAncestorRects:Ft});const ln=y.useMemo(()=>({active:Ne,activeNode:ae,activeNodeRect:je,activatorEvent:ee,collisions:_t,containerNodeRect:ge,dragOverlay:Ie,draggableNodes:P,droppableContainers:ce,droppableRects:le,over:dt,measureDroppableContainers:H,scrollableAncestors:jt,scrollableAncestorRects:Ft,measuringConfiguration:$,measuringScheduled:q,windowRect:St}),[Ne,ae,je,ee,_t,ge,Ie,P,ce,le,dt,H,jt,Ft,$,q,St]),Kt=y.useMemo(()=>({activatorEvent:ee,activators:gn,active:Ne,activeNodeRect:je,ariaDescribedById:{draggable:G},dispatch:N,draggableNodes:P,over:dt,measureDroppableContainers:H}),[ee,gn,Ne,je,N,G,P,dt,H]);return ct.createElement(Xv.Provider,{value:z},ct.createElement(qi.Provider,{value:Kt},ct.createElement(py.Provider,{value:ln},ct.createElement(rc.Provider,{value:hs},g)),ct.createElement(ab,{disabled:(f==null?void 0:f.restoreFocus)===!1})),ct.createElement(dS,{...f,hiddenTextDescribedById:G}));function vn(){const Ze=(J==null?void 0:J.autoScrollEnabled)===!1,Rt=typeof h=="object"?h.enabled===!1:h===!1,ft=X&&!Ze&&!Rt;return typeof h=="object"?{...h,enabled:ft}:{enabled:ft}}}),ub=y.createContext(null),Vm="button",db="Draggable";function fb(e){let{id:n,data:r,disabled:o=!1,attributes:a}=e;const c=Gi(db),{activators:d,activatorEvent:f,active:h,activeNodeRect:g,ariaDescribedById:v,draggableNodes:k,over:x}=y.useContext(qi),{role:S=Vm,roleDescription:E="draggable",tabIndex:b=0}=a??{},T=(h==null?void 0:h.id)===n,N=y.useContext(T?rc:ub),[_,z]=Al(),[M,O]=Al(),X=JS(d,n),U=Pi(r);fs(()=>(k.set(n,{id:n,key:c,node:_,activatorNode:M,data:U}),()=>{const Q=k.get(n);Q&&Q.key===c&&k.delete(n)}),[k,n]);const P=y.useMemo(()=>({role:S,tabIndex:b,"aria-disabled":o,"aria-pressed":T&&S===Vm?!0:void 0,"aria-roledescription":E,"aria-describedby":v.draggable}),[o,S,b,T,E,v.draggable]);return{active:h,activatorEvent:f,activeNodeRect:g,attributes:P,isDragging:T,listeners:o?void 0:X,node:_,over:x,setNodeRef:z,setActivatorNodeRef:O,transform:N}}function gy(){return y.useContext(py)}const pb="Droppable",hb={timeout:25};function vy(e){let{data:n,disabled:r=!1,id:o,resizeObserverConfig:a}=e;const c=Gi(pb),{active:d,dispatch:f,over:h,measureDroppableContainers:g}=y.useContext(qi),v=y.useRef({disabled:r}),k=y.useRef(!1),x=y.useRef(null),S=y.useRef(null),{disabled:E,updateMeasurementsFor:b,timeout:T}={...hb,...a},N=Pi(b??o),_=y.useCallback(()=>{if(!k.current){k.current=!0;return}S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{g(Array.isArray(N.current)?N.current:[N.current]),S.current=null},T)},[T]),z=sc({callback:_,disabled:E||!d}),M=y.useCallback((P,Q)=>{z&&(Q&&(z.unobserve(Q),k.current=!1),P&&z.observe(P))},[z]),[O,X]=Al(M),U=Pi(n);return y.useEffect(()=>{!z||!O.current||(z.disconnect(),k.current=!1,z.observe(O.current))},[O,z]),y.useEffect(()=>(f({type:Ht.RegisterDroppable,element:{id:o,key:c,disabled:r,node:O,rect:x,data:U}}),()=>f({type:Ht.UnregisterDroppable,key:c,id:o})),[o]),y.useEffect(()=>{r!==v.current.disabled&&(f({type:Ht.SetDroppableDisabled,id:o,key:c,disabled:r}),v.current.disabled=r)},[o,c,r,f]),{active:d,rect:x,isOver:(h==null?void 0:h.id)===o,node:O,over:h,setNodeRef:X}}function mb(e){let{animation:n,children:r}=e;const[o,a]=y.useState(null),[c,d]=y.useState(null),f=Il(r);return!r&&!o&&f&&a(f),fs(()=>{if(!c)return;const h=o==null?void 0:o.key,g=o==null?void 0:o.props.id;if(h==null||g==null){a(null);return}Promise.resolve(n(g,c)).then(()=>{a(null)})},[n,o,c]),ct.createElement(ct.Fragment,null,r,o?y.cloneElement(o,{ref:d}):null)}const gb={x:0,y:0,scaleX:1,scaleY:1};function vb(e){let{children:n}=e;return ct.createElement(qi.Provider,{value:fy},ct.createElement(rc.Provider,{value:gb},n))}const yb={position:"fixed",touchAction:"none"},xb=e=>tc(e)?"transform 250ms ease":void 0,wb=y.forwardRef((e,n)=>{let{as:r,activatorEvent:o,adjustScale:a,children:c,className:d,rect:f,style:h,transform:g,transition:v=xb}=e;if(!f)return null;const k=a?g:{...g,scaleX:1,scaleY:1},x={...yb,width:f.width,height:f.height,top:f.top,left:f.left,transform:Es.Transform.toString(k),transformOrigin:a&&o?pS(o,f):void 0,transition:typeof v=="function"?v(o):v,...h};return ct.createElement(r,{className:d,style:x,ref:n},c)}),kb=e=>n=>{let{active:r,dragOverlay:o}=n;const a={},{styles:c,className:d}=e;if(c!=null&&c.active)for(const[f,h]of Object.entries(c.active))h!==void 0&&(a[f]=r.node.style.getPropertyValue(f),r.node.style.setProperty(f,h));if(c!=null&&c.dragOverlay)for(const[f,h]of Object.entries(c.dragOverlay))h!==void 0&&o.node.style.setProperty(f,h);return d!=null&&d.active&&r.node.classList.add(d.active),d!=null&&d.dragOverlay&&o.node.classList.add(d.dragOverlay),function(){for(const[h,g]of Object.entries(a))r.node.style.setProperty(h,g);d!=null&&d.active&&r.node.classList.remove(d.active)}},Sb=e=>{let{transform:{initial:n,final:r}}=e;return[{transform:Es.Transform.toString(n)},{transform:Es.Transform.toString(r)}]},bb={duration:250,easing:"ease",keyframes:Sb,sideEffects:kb({styles:{active:{opacity:"0"}}})};function Nb(e){let{config:n,draggableNodes:r,droppableContainers:o,measuringConfiguration:a}=e;return ec((c,d)=>{if(n===null)return;const f=r.get(c);if(!f)return;const h=f.node.current;if(!h)return;const g=dy(d);if(!g)return;const{transform:v}=Cn(d).getComputedStyle(d),k=ey(v);if(!k)return;const x=typeof n=="function"?n:Tb(n);return ay(h,a.draggable.measure),x({active:{id:c,data:f.data,node:h,rect:a.draggable.measure(h)},draggableNodes:r,dragOverlay:{node:d,rect:a.dragOverlay.measure(g)},droppableContainers:o,measuringConfiguration:a,transform:k})})}function Tb(e){const{duration:n,easing:r,sideEffects:o,keyframes:a}={...bb,...e};return c=>{let{active:d,dragOverlay:f,transform:h,...g}=c;if(!n)return;const v={x:f.rect.left-d.rect.left,y:f.rect.top-d.rect.top},k={scaleX:h.scaleX!==1?d.rect.width*h.scaleX/f.rect.width:1,scaleY:h.scaleY!==1?d.rect.height*h.scaleY/f.rect.height:1},x={x:h.x-v.x,y:h.y-v.y,...k},S=a({...g,active:d,dragOverlay:f,transform:{initial:h,final:x}}),[E]=S,b=S[S.length-1];if(JSON.stringify(E)===JSON.stringify(b))return;const T=o==null?void 0:o({active:d,dragOverlay:f,...g}),N=f.node.animate(S,{duration:n,easing:r,fill:"forwards"});return new Promise(_=>{N.onfinish=()=>{T==null||T(),_()}})}}let Km=0;function Cb(e){return y.useMemo(()=>{if(e!=null)return Km++,Km},[e])}const Eb=ct.memo(e=>{let{adjustScale:n=!1,children:r,dropAnimation:o,style:a,transition:c,modifiers:d,wrapperElement:f="div",className:h,zIndex:g=999}=e;const{activatorEvent:v,active:k,activeNodeRect:x,containerNodeRect:S,draggableNodes:E,droppableContainers:b,dragOverlay:T,over:N,measuringConfiguration:_,scrollableAncestors:z,scrollableAncestorRects:M,windowRect:O}=gy(),X=y.useContext(rc),U=Cb(k==null?void 0:k.id),P=hy(d,{activatorEvent:v,active:k,activeNodeRect:x,containerNodeRect:S,draggingNodeRect:T.rect,over:N,overlayNodeRect:T.rect,scrollableAncestors:z,scrollableAncestorRects:M,transform:X,windowRect:O}),Q=cf(x),ce=Nb({config:o,draggableNodes:E,droppableContainers:b,measuringConfiguration:_}),ue=Q?T.setRef:void 0;return ct.createElement(vb,null,ct.createElement(mb,{animation:ce},k&&U?ct.createElement(wb,{key:U,id:k.id,ref:ue,as:f,activatorEvent:v,adjustScale:n,className:h,transition:c,rect:Q,style:{zIndex:g,...a},transform:P},r):null))});function yy(e,n,r){const o=e.slice();return o.splice(r<0?o.length+r:r,0,o.splice(n,1)[0]),o}function jb(e,n){return e.reduce((r,o,a)=>{const c=n.get(o);return c&&(r[a]=c),r},Array(e.length))}function tl(e){return e!==null&&e>=0}function _b(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}function Rb(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const nl={scaleX:1,scaleY:1},Ab=e=>{var n;let{rects:r,activeNodeRect:o,activeIndex:a,overIndex:c,index:d}=e;const f=(n=r[a])!=null?n:o;if(!f)return null;const h=Ib(r,d,a);if(d===a){const g=r[c];return g?{x:a<c?g.left+g.width-(f.left+f.width):g.left-f.left,y:0,...nl}:null}return d>a&&d<=c?{x:-f.width-h,y:0,...nl}:d<a&&d>=c?{x:f.width+h,y:0,...nl}:{x:0,y:0,...nl}};function Ib(e,n,r){const o=e[n],a=e[n-1],c=e[n+1];return!o||!a&&!c?0:r<n?a?o.left-(a.left+a.width):c.left-(o.left+o.width):c?c.left-(o.left+o.width):o.left-(a.left+a.width)}const xy=e=>{let{rects:n,activeIndex:r,overIndex:o,index:a}=e;const c=yy(n,o,r),d=n[a],f=c[a];return!f||!d?null:{x:f.left-d.left,y:f.top-d.top,scaleX:f.width/d.width,scaleY:f.height/d.height}},sl={scaleX:1,scaleY:1},Gm=e=>{var n;let{activeIndex:r,activeNodeRect:o,index:a,rects:c,overIndex:d}=e;const f=(n=c[r])!=null?n:o;if(!f)return null;if(a===r){const g=c[d];return g?{x:0,y:r<d?g.top+g.height-(f.top+f.height):g.top-f.top,...sl}:null}const h=Db(c,a,r);return a>r&&a<=d?{x:0,y:-f.height-h,...sl}:a<r&&a>=d?{x:0,y:f.height+h,...sl}:{x:0,y:0,...sl}};function Db(e,n,r){const o=e[n],a=e[n-1],c=e[n+1];return o?r<n?a?o.top-(a.top+a.height):c?c.top-(o.top+o.height):0:c?c.top-(o.top+o.height):a?o.top-(a.top+a.height):0:0}const wy="Sortable",ky=ct.createContext({activeIndex:-1,containerId:wy,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:xy,disabled:{draggable:!1,droppable:!1}});function Nd(e){let{children:n,id:r,items:o,strategy:a=xy,disabled:c=!1}=e;const{active:d,dragOverlay:f,droppableRects:h,over:g,measureDroppableContainers:v}=gy(),k=Gi(wy,r),x=f.rect!==null,S=y.useMemo(()=>o.map(X=>typeof X=="object"&&"id"in X?X.id:X),[o]),E=d!=null,b=d?S.indexOf(d.id):-1,T=g?S.indexOf(g.id):-1,N=y.useRef(S),_=!_b(S,N.current),z=T!==-1&&b===-1||_,M=Rb(c);fs(()=>{_&&E&&v(S)},[_,S,E,v]),y.useEffect(()=>{N.current=S},[S]);const O=y.useMemo(()=>({activeIndex:b,containerId:k,disabled:M,disableTransforms:z,items:S,overIndex:T,useDragOverlay:x,sortedRects:jb(S,h),strategy:a}),[b,k,M.draggable,M.droppable,z,S,T,h,x,a]);return ct.createElement(ky.Provider,{value:O},n)}const Mb=e=>{let{id:n,items:r,activeIndex:o,overIndex:a}=e;return yy(r,o,a).indexOf(n)},Lb=e=>{let{containerId:n,isSorting:r,wasDragging:o,index:a,items:c,newIndex:d,previousItems:f,previousContainerId:h,transition:g}=e;return!g||!o||f!==c&&a===d?!1:r?!0:d!==a&&n===h},Ob={duration:200,easing:"ease"},Sy="transform",$b=Es.Transition.toString({property:Sy,duration:0,easing:"linear"}),Pb={roleDescription:"sortable"};function zb(e){let{disabled:n,index:r,node:o,rect:a}=e;const[c,d]=y.useState(null),f=y.useRef(r);return fs(()=>{if(!n&&r!==f.current&&o.current){const h=a.current;if(h){const g=Oo(o.current,{ignoreTransform:!0}),v={x:h.left-g.left,y:h.top-g.top,scaleX:h.width/g.width,scaleY:h.height/g.height};(v.x||v.y)&&d(v)}}r!==f.current&&(f.current=r)},[n,r,o,a]),y.useEffect(()=>{c&&d(null)},[c]),c}function uf(e){let{animateLayoutChanges:n=Lb,attributes:r,disabled:o,data:a,getNewIndex:c=Mb,id:d,strategy:f,resizeObserverConfig:h,transition:g=Ob}=e;const{items:v,containerId:k,activeIndex:x,disabled:S,disableTransforms:E,sortedRects:b,overIndex:T,useDragOverlay:N,strategy:_}=y.useContext(ky),z=Fb(o,S),M=v.indexOf(d),O=y.useMemo(()=>({sortable:{containerId:k,index:M,items:v},...a}),[k,a,M,v]),X=y.useMemo(()=>v.slice(v.indexOf(d)),[v,d]),{rect:U,node:P,isOver:Q,setNodeRef:ce}=vy({id:d,data:O,disabled:z.droppable,resizeObserverConfig:{updateMeasurementsFor:X,...h}}),{active:ue,activatorEvent:me,activeNodeRect:Ne,attributes:Me,setNodeRef:J,listeners:re,isDragging:ee,over:F,setActivatorNodeRef:Z,transform:G}=fb({id:d,data:O,attributes:{...Pb,...r},disabled:z.draggable}),I=Z1(ce,J),$=!!ue,le=$&&!E&&tl(x)&&tl(T),H=!N&&ee,q=H&&le?G:null,Se=le?q??(f??_)({rects:b,activeNodeRect:Ne,activeIndex:x,overIndex:T,index:M}):null,_e=tl(x)&&tl(T)?c({id:d,items:v,activeIndex:x,overIndex:T}):M,Ae=ue==null?void 0:ue.id,je=y.useRef({activeId:Ae,items:v,newIndex:_e,containerId:k}),ge=v!==je.current.items,he=n({active:ue,containerId:k,isDragging:ee,isSorting:$,id:d,index:M,items:v,newIndex:je.current.newIndex,previousItems:je.current.items,previousContainerId:je.current.containerId,transition:g,wasDragging:je.current.activeId!=null}),Ve=zb({disabled:!he,index:M,node:P,rect:U});return y.useEffect(()=>{$&&je.current.newIndex!==_e&&(je.current.newIndex=_e),k!==je.current.containerId&&(je.current.containerId=k),v!==je.current.items&&(je.current.items=v)},[$,_e,k,v]),y.useEffect(()=>{if(Ae===je.current.activeId)return;if(Ae!=null&&je.current.activeId==null){je.current.activeId=Ae;return}const mt=setTimeout(()=>{je.current.activeId=Ae},50);return()=>clearTimeout(mt)},[Ae]),{active:ue,activeIndex:x,attributes:Me,data:O,rect:U,index:M,newIndex:_e,items:v,isOver:Q,isSorting:$,isDragging:ee,listeners:re,node:P,overIndex:T,over:F,setNodeRef:I,setActivatorNodeRef:Z,setDroppableNodeRef:ce,setDraggableNodeRef:J,transform:Ve??Se,transition:Ie()};function Ie(){if(Ve||ge&&je.current.newIndex===M)return $b;if(!(H&&!tc(me)||!g)&&($||he))return Es.Transition.toString({...g,property:Sy})}}function Fb(e,n){var r,o;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:n.draggable,droppable:(o=e==null?void 0:e.droppable)!=null?o:n.droppable}}nt.Down,nt.Right,nt.Up,nt.Left;function rl(e){const[n,r]=y.useState(()=>{try{const a=localStorage.getItem(e);if(a==null)return new Set;const c=JSON.parse(a);return Array.isArray(c)?new Set(c.filter(d=>typeof d=="string")):new Set}catch{return new Set}}),o=y.useCallback(a=>{r(c=>{const d=a(new Set(c));try{localStorage.setItem(e,JSON.stringify([...d]))}catch{}return d})},[e]);return[n,o]}function Ub(e,n=!1){const[r,o]=y.useState(()=>{try{const c=localStorage.getItem(e);return c==="1"?!0:c==="0"?!1:n}catch{return n}}),a=y.useCallback(c=>{o(c);try{localStorage.setItem(e,c?"1":"0")}catch{}},[e]);return[r,a]}async function Fi(e){try{return await navigator.clipboard.writeText(e),!0}catch{try{const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select();const r=document.execCommand("copy");return document.body.removeChild(n),r}catch{return!1}}}function Bb(e){return e.origin_app_id!=null&&!e.user_touched&&!e.starred}const Td="(no directory)";function gr(e){return e.replaceAll("\\","/").replace(/\/+$/,"")}function Cd(e,n){if(!n||!e.cwd)return!1;const r=gr(e.cwd),o=gr(n);return r.startsWith(`${o}/`)}function Wb(e,n){const r=new Map;for(const d of n){const f=d.cwd||Td,h=r.get(f)??[];h.push(d),r.set(f,h)}const o=new Set,a=new Set(e.filter(d=>d.deleted===1).map(d=>d.path)),c=[];for(const d of e){if(d.deleted===1){o.add(d.path);continue}o.add(d.path),c.push({path:d.path,label:d.label||d.path.split("/").pop()||d.path,sessions:r.get(d.path)??[],workspace:d})}for(const[d,f]of r)o.has(d)||a.has(d)||c.push({path:d,label:d===Td?"Other":d.split("/").pop()||d,sessions:f,workspace:null});return c}function Hb(e,n,r){if(n.length===0)return!1;const o=new Set(e.filter(a=>a.deleted===1).map(a=>a.path));return n.some(a=>!Cd(a,r)&&!o.has(a.cwd||Td))}function $l(e){return[...e].sort((n,r)=>r.sort_order-n.sort_order||(n.created_at<r.created_at?1:-1))}function qm(e,n,r,o){const a=n.map(c=>({folder:c,sessions:e.sessions.filter(d=>d.folder_id===c.id),finishedKey:`folder:${c.id}:finished`,hidden:o.has(c.id)}));return a.push({folder:null,sessions:e.sessions.filter(c=>!(c.folder_id&&r.has(c.folder_id))),finishedKey:`${e.path}:finished`,hidden:!1}),a}function Xm(e,n){return{working:$l(e.sessions.filter(r=>r.lifecycle!=="finished")),finished:$l(e.sessions.filter(r=>r.lifecycle==="finished")),finishedCollapsed:n.has(e.finishedKey)}}function ol(e,n){return e.folder_id&&n.has(e.folder_id)?e.folder_id:null}function Vb(e){const n=new Set(e.map(o=>o.name));if(!n.has("New Folder"))return"New Folder";let r=2;for(;n.has(`New Folder ${r}`);)r++;return`New Folder ${r}`}function Ym({id:e,children:n,className:r}){const{setNodeRef:o,isOver:a}=vy({id:e});return l.jsx("div",{ref:o,className:`${r??""}${a?" drop-over":""}`,children:n})}function df({inputRef:e,value:n,onChange:r,onConfirm:o,onCancel:a}){return l.jsx("input",{ref:e,className:"tree-rename-input",value:n,onChange:c=>r(c.target.value),onClick:c=>c.stopPropagation(),onPointerDown:c=>c.stopPropagation(),onKeyDown:c=>{c.key==="Enter"&&o(),c.key==="Escape"&&a()},onBlur:o})}function Kb({s:e,backgroundTaskCount:n,isActive:r,isSelected:o,originApp:a,renaming:c,renameValue:d,renameRef:f,onRenameValue:h,onRenameConfirm:g,onRenameCancel:v,onSelect:k,onCtxMenu:x,onToggleStar:S}){const{attributes:E,listeners:b,setNodeRef:T,transform:N,transition:_,isDragging:z}=uf({id:`s:${e.id}`}),M=Xl(e,n);return l.jsxs("div",{ref:T,style:{transform:Es.Transform.toString(N),transition:_},className:`tree-item ${r?"active":""}${o?" selected":""} ${M.isFinished?"tree-item-finished":""}${z?" dragging":""}${e.starred?" tree-item-starred":""}`,...E,...b,onClick:k,onContextMenu:x,children:[l.jsx(nf,{iconClass:M.iconClass,iconText:M.iconText,size:16}),a&&l.jsx("span",{className:"tree-app-badge",title:"Created by a mini app",children:l.jsx(Do,{iconNode:a.iconNode,size:10})}),c?l.jsx(df,{inputRef:f,value:d,onChange:h,onConfirm:g,onCancel:v}):l.jsx("span",{className:"tree-label",children:e.title||e.id.slice(0,8)}),!c&&l.jsx("button",{className:`star-btn${e.starred?" starred":""}`,title:e.starred?"Unstar session":"Star session",onClick:O=>{O.stopPropagation(),S()},onPointerDown:O=>O.stopPropagation(),children:l.jsx(Rl,{size:10,fill:e.starred?"currentColor":"none"})}),M.dot&&l.jsx(tf,{status:M.dot,title:M.dotTitle})]})}function Gb({folder:e,count:n,collapsed:r,renaming:o,renameValue:a,renameRef:c,onRenameValue:d,onRenameConfirm:f,onRenameCancel:h,onToggle:g,onCtxMenu:v,children:k}){const{attributes:x,listeners:S,setNodeRef:E,transform:b,transition:T,isDragging:N,over:_}=uf({id:`f:${e.id}`}),z=_!=null&&String(_.id).startsWith("s:");return l.jsxs("div",{ref:E,style:{transform:Es.Transform.toString(b),transition:T},className:`tree-folder ${r?"collapsed":""}${N?" dragging":""}`,children:[l.jsx("div",{className:`tree-folder-header${z?" drop-over":""}`,...x,...S,onClick:()=>{o||g()},onContextMenu:v,children:o?l.jsx(df,{inputRef:c,value:a,onChange:d,onConfirm:f,onCancel:h}):l.jsxs(l.Fragment,{children:[l.jsx(_o,{size:8,className:"tree-chevron"}),l.jsx(_l,{size:12}),l.jsx("span",{className:"tree-folder-label",children:e.name}),l.jsx("span",{className:"tree-count",children:n})]})}),!r&&l.jsx("div",{className:"tree-folder-children",children:k})]})}function qb(){const e=A(R=>R.sessions),n=A(R=>R.backgroundTasks),r=A(R=>R.workspaces),o=A(R=>R.folders),a=A(R=>R.activeSessionId),c=A(R=>R.selectSession),d=A(R=>R.deleteSession),f=A(R=>R.removeWorkspace),h=A(R=>R.createSessionInWorkspace),g=A(R=>R.pickAndAddWorkspace),v=A(R=>R.setImportSessionsWorkspace),k=A(R=>R.renameSession),x=A(R=>R.markFinished),S=A(R=>R.markFinishedMany),E=A(R=>R.toggleStar),b=A(R=>R.reopenSession),T=A(R=>R.reopenSessionMany),N=A(R=>R.deleteSessionMany),_=A(R=>R.createSidebarFolder),z=A(R=>R.renameFolder),M=A(R=>R.deleteFolder),O=A(R=>R.applyMoves),X=A(R=>R.reorderFolders),U=A(R=>R.apps),P=A(R=>R.appsRootPath),Q=A(R=>R.activeAppTabId),ce=A(R=>R.openAppTab),ue=A(R=>R.startAppEdit),me=A(R=>R.toggleAppPin),Ne=A(R=>R.deleteApp),Me=A(R=>R.openAppCatalog),[J,re]=rl("agentpane:sidebar-ws-collapsed"),[ee,F]=rl("agentpane:sidebar-sub-collapsed"),[Z,G]=rl("agentpane:sidebar-folders-collapsed"),[I,$]=rl("agentpane:sidebar-app-edits-collapsed"),[le,H]=Ub("agentpane:sidebar-hide-auto-sessions"),[q,ae]=y.useState(null),[Se,_e]=y.useState(null),[Ae,je]=y.useState(""),[ge,he]=y.useState(null),[Ve,Ie]=y.useState(new Set),[mt,Ue]=y.useState(null),Vt=y.useRef(null),tn=y.useRef(null),St=y.useRef(null),jt=y.useRef(!1),Ft=Qv(Yv(nc,{activationConstraint:{distance:5}}));function Ot(){Ie(new Set),Ue(null)}Wi(Vt,()=>ae(null),!!q),Io(()=>{ae(null),Ot()},!!q||Ve.size>0),y.useLayoutEffect(()=>{const R=Vt.current;if(!q||!R)return;const pe=8,{offsetWidth:ie,offsetHeight:we}=R,$e=q.x+ie>window.innerWidth-pe?Math.max(pe,q.x-ie):q.x,qe=q.y+we>window.innerHeight-pe?Math.max(pe,q.y-we):q.y;R.style.left=`${$e}px`,R.style.top=`${qe}px`},[q]);const Y=y.useMemo(()=>new Map(e.map(R=>[R.id,R])),[e]),ve=y.useMemo(()=>new Map(o.map(R=>[R.id,R])),[o]),Be=y.useMemo(()=>{const R=new Map;for(const pe of[...o].sort((ie,we)=>ie.sort_order-we.sort_order)){const ie=R.get(pe.workspace_path)??[];ie.push(pe),R.set(pe.workspace_path,ie)}return R},[o]);function rt(R){re(pe=>{const ie=new Set(pe);return ie.has(R)?ie.delete(R):ie.add(R),ie})}function gt(R){F(pe=>{const ie=new Set(pe);return ie.has(R)?ie.delete(R):ie.add(R),ie})}function vt(R){G(pe=>{const ie=new Set(pe);return ie.has(R)?ie.delete(R):ie.add(R),ie})}function _t(){H(!le),Ot()}function an(R){$(pe=>{const ie=new Set(pe);return ie.has(R)?ie.delete(R):ie.add(R),ie})}y.useEffect(()=>{Se&&tn.current&&(tn.current.focus(),tn.current.select())},[Se]),y.useEffect(()=>{var R,pe,ie;jt.current||!a||(jt.current=!0,(ie=(pe=(R=St.current)==null?void 0:R.querySelector(".tree-item.active, .sidebar-app-edit-row.active"))==null?void 0:pe.scrollIntoView)==null||ie.call(pe,{block:"nearest"}))},[a]);function dt(R,pe,ie,we=""){_e({kind:R,id:pe}),je(ie||we)}function Mn(){if(Se){const R=Ae.trim();R&&(Se.kind==="session"?k(Se.id,R):z(Se.id,R))}_e(null)}function Ln(){_e(null),je("")}async function hs(R){const pe=Vb(Be.get(R)??[]),ie=await _(R,pe);ie&&dt("folder",ie.id,ie.name)}function ms(R){const pe=String(R.active.id);if(pe.startsWith("s:")){const ie=Y.get(pe.slice(2));ie&&he({kind:"session",label:ie.title||ie.id.slice(0,8)})}else if(pe.startsWith("f:")){const ie=ve.get(pe.slice(2));ie&&he({kind:"folder",label:ie.name})}}function ns(R){he(null);const{active:pe,over:ie}=R;if(!ie)return;const we=String(pe.id),$e=String(ie.id);if(we.startsWith("s:")){const qe=Y.get(we.slice(2));if(!qe)return;const Pe=qe.cwd||"(no directory)",Ut=ol(qe,ve);let $n,We;if($e.startsWith("f:")){const Je=ve.get($e.slice(2));if(!Je)return;$n=Je.workspace_path,We=Je.id}else if($e.startsWith("s:")){const Je=Y.get($e.slice(2));if(!Je)return;$n=Je.cwd||"(no directory)",We=ol(Je,ve)}else if($e.startsWith("c:")){const Je=$e.slice(2),At=Je.lastIndexOf("|");$n=Je.slice(0,At);const vs=Je.slice(At+1);We=vs==="root"?null:vs}else return;if($n!==Pe)return;const yn=$l(e.filter(Je=>(Je.cwd||"(no directory)")===$n&&ol(Je,ve)===We)),js=yn.filter(Je=>Je.id!==qe.id);let Bs=js.length;if($e.startsWith("s:")){const Je=js.findIndex(At=>At.id===$e.slice(2));Je>=0&&(Bs=Je)}const Pn=[...js.slice(0,Bs),qe,...js.slice(Bs)],gs=[];if(We===Ut){if(Pn.length===yn.length&&Pn.every((Je,At)=>Je.id===yn[At].id))return;Pn.forEach((Je,At)=>gs.push({id:Je.id,folder_id:We,sort_order:Pn.length-1-At}))}else{const Je=$l(e.filter(At=>(At.cwd||"(no directory)")===Pe&&ol(At,ve)===Ut)).filter(At=>At.id!==qe.id);Je.forEach((At,vs)=>gs.push({id:At.id,folder_id:Ut,sort_order:Je.length-1-vs})),Pn.forEach((At,vs)=>gs.push({id:At.id,folder_id:We,sort_order:Pn.length-1-vs}))}O(gs);return}if(we.startsWith("f:")){if(!$e.startsWith("f:"))return;const qe=ve.get(we.slice(2)),Pe=ve.get($e.slice(2));if(!qe||!Pe||qe.id===Pe.id||qe.workspace_path!==Pe.workspace_path)return;const Ut=(Be.get(qe.workspace_path)??[]).map(yn=>yn.id),$n=Ut.indexOf(qe.id),We=Ut.indexOf(Pe.id);Ut.splice(We,0,...Ut.splice($n,1)),X(Ut)}}const On=P?e.filter(R=>!Cd(R,P)):e,gn=new Set(le?On.filter(R=>Bb(R)&&R.id!==a).map(R=>R.id):[]),ln=Wb(r,gn.size>0?On.filter(R=>!gn.has(R.id)):On),Kt=y.useMemo(()=>{const R=new Map;if(!P)return R;const pe=gr(P);for(const ie of e){if(!Cd(ie,P))continue;const we=gr(ie.cwd).slice(pe.length+1).split("/")[0],$e=R.get(we)??[];$e.push(ie),R.set(we,$e)}return R},[e,P]);function vn(R){return{folder:null,sessions:Kt.get(R)??[],finishedKey:`app:${R}:finished`,hidden:I.has(R)}}const Ze=[],Rt=R=>{if(R.hidden)return;const{working:pe,finished:ie,finishedCollapsed:we}=Xm(R,ee);Ze.push(...pe.map($e=>$e.id)),we||Ze.push(...ie.map($e=>$e.id))};for(const R of ln){if(J.has(R.path))continue;const pe=Be.get(R.path)??[],ie=new Set(pe.map(we=>we.id));qm(R,pe,ie,Z).forEach(Rt)}U.forEach(R=>Rt(vn(R.id)));const ft=e.filter(R=>Ve.has(R.id)),Gt=ft.filter(R=>R.lifecycle!=="finished").map(R=>R.id),yt=ft.filter(R=>R.lifecycle==="finished").map(R=>R.id);function xt(R,pe){if(pe.metaKey||pe.ctrlKey){pe.preventDefault(),Ue(R.id),Ie(ie=>{const we=new Set(ie);return we.has(R.id)?we.delete(R.id):we.add(R.id),we});return}if(pe.shiftKey){pe.preventDefault();const ie=mt??R.id;Ue(ie);const we=Ze.indexOf(ie),$e=Ze.indexOf(R.id);if(we>=0&&$e>=0){const[qe,Pe]=we<$e?[we,$e]:[$e,we];Ie(new Set(Ze.slice(qe,Pe+1)))}return}Ot(),Ue(R.id),c(R.id)}function lt(R,pe){pe.preventDefault();const ie=Ve.has(R.id)&&Ve.size>1;Ve.has(R.id)||(Ie(new Set),Ue(R.id)),ae({x:pe.clientX,y:pe.clientY,type:"session",sessionId:R.id,sessionTitle:R.title,sessionLifecycle:R.lifecycle,sessionExternalId:R.external_thread_id,multi:ie})}function qt(R){var ie;const pe=R.origin_app_id?U.find(we=>we.id===R.origin_app_id):null;return l.jsx(Kb,{s:R,backgroundTaskCount:((ie=n[R.id])==null?void 0:ie.length)??0,isActive:a===R.id,isSelected:Ve.has(R.id),originApp:pe??null,renaming:(Se==null?void 0:Se.kind)==="session"&&Se.id===R.id,renameValue:Ae,renameRef:tn,onRenameValue:je,onRenameConfirm:Mn,onRenameCancel:Ln,onSelect:we=>xt(R,we),onToggleStar:()=>E(R.id),onCtxMenu:we=>lt(R,we)},R.id)}function it(R){var ie;const pe=Xl(R,((ie=n[R.id])==null?void 0:ie.length)??0);return l.jsxs("div",{className:`sidebar-app-edit-row${a===R.id?" active":""}${Ve.has(R.id)?" selected":""}${pe.isFinished?" tree-item-finished":""}`,title:"App edit session — click to open",onClick:we=>xt(R,we),onContextMenu:we=>lt(R,we),children:[l.jsx(nf,{iconClass:pe.iconClass,iconText:pe.iconText,size:14}),(Se==null?void 0:Se.kind)==="session"&&Se.id===R.id?l.jsx(df,{inputRef:tn,value:Ae,onChange:je,onConfirm:Mn,onCancel:Ln}):l.jsx("span",{className:"tree-label",children:R.title||R.id.slice(0,8)}),pe.dot&&l.jsx(tf,{status:pe.dot,title:pe.dotTitle})]},R.id)}function $t(R,pe="workspace"){const{working:ie,finished:we,finishedCollapsed:$e}=Xm(R,ee),qe=pe==="workspace"?qt:it,Pe=l.jsxs(l.Fragment,{children:[ie.length===0&&we.length===0?l.jsx("div",{className:"tree-empty",children:"No sessions"}):ie.map(qe),we.length>0&&l.jsxs("div",{className:`tree-subgroup ${$e?"collapsed":""}`,children:[l.jsxs("div",{className:"tree-subgroup-header",onClick:()=>gt(R.finishedKey),children:[l.jsx(_o,{size:8,className:"tree-chevron"}),l.jsx("span",{className:"tree-subgroup-label",children:"Finished"}),l.jsx("span",{className:"tree-subgroup-count",children:we.length})]}),!$e&&l.jsx("div",{className:"tree-subgroup-items",children:we.map(qe)})]})]});if(pe==="app")return Pe;const Ut=[...ie,...we].map($n=>`s:${$n.id}`);return l.jsx(Nd,{items:Ut,strategy:Gm,children:Pe})}return l.jsxs("div",{className:"ide-sidebar",ref:St,children:[l.jsxs("div",{className:"sidebar-header",children:[l.jsx("span",{className:"sidebar-header-title",children:"Workspaces"}),l.jsxs("div",{className:"sidebar-header-actions",children:[l.jsx("button",{className:`sidebar-add sidebar-filter${le?" active":""}`,title:le?`Show automatic sessions (${gn.size} hidden)`:"Hide automatic sessions — the ones mini apps run on their own. Sessions you message, stop, rewind, rename or star stay visible.","aria-label":le?"Show automatic sessions":"Hide automatic sessions","aria-pressed":le,onClick:_t,children:le?l.jsx(p1,{size:14}):l.jsx(vr,{size:14})}),l.jsx("button",{className:"sidebar-add",title:"Add workspace",onClick:()=>g(),children:l.jsx(pr,{size:14})})]})]}),l.jsxs(my,{sensors:Ft,collisionDetection:Zv,onDragStart:ms,onDragEnd:ns,children:[ln.length===0?l.jsx("div",{className:"empty-state",style:{padding:"16px"},children:"No workspaces yet. Click + to add one."}):ln.map(R=>{const pe=J.has(R.path),ie=Be.get(R.path)??[],we=new Set(ie.map(Pe=>Pe.id)),$e=qm(R,ie,we,Z),qe=$e[$e.length-1];return l.jsxs("div",{className:`tree-section ${pe?"collapsed":""}`,children:[l.jsxs("div",{className:"tree-section-header",onClick:()=>rt(R.path),onContextMenu:Pe=>{Pe.preventDefault(),ae({x:Pe.clientX,y:Pe.clientY,type:"workspace",path:R.path})},children:[l.jsx(_o,{size:9,className:"tree-chevron"}),l.jsx(_l,{size:14}),l.jsx("span",{className:"tree-section-label",children:R.label}),l.jsx("button",{className:"tree-section-add",title:"New session in this workspace",onClick:Pe=>{Pe.stopPropagation(),h(R.path)},children:l.jsx(pr,{size:11})}),l.jsx("button",{className:"tree-section-add",title:"New folder in this workspace",onClick:Pe=>{Pe.stopPropagation(),hs(R.path)},children:l.jsx(ed,{size:11})}),l.jsx("span",{className:"tree-count",children:R.sessions.length})]}),!pe&&l.jsxs("div",{className:"tree-children",children:[l.jsx(Nd,{items:ie.map(Pe=>`f:${Pe.id}`),strategy:Gm,children:$e.filter(Pe=>Pe.folder).map(Pe=>l.jsx(Gb,{folder:Pe.folder,count:Pe.sessions.length,collapsed:Pe.hidden,renaming:(Se==null?void 0:Se.kind)==="folder"&&Se.id===Pe.folder.id,renameValue:Ae,renameRef:tn,onRenameValue:je,onRenameConfirm:Mn,onRenameCancel:Ln,onToggle:()=>vt(Pe.folder.id),onCtxMenu:Ut=>{Ut.preventDefault(),ae({x:Ut.clientX,y:Ut.clientY,type:"folder",folderId:Pe.folder.id,folderName:Pe.folder.name})},children:l.jsx(Ym,{id:`c:${R.path}|${Pe.folder.id}`,children:$t(Pe)})},Pe.folder.id))}),l.jsx(Ym,{id:`c:${R.path}|root`,children:$t(qe)})]})]},R.path)}),l.jsx(Eb,{children:ge&&l.jsxs("div",{className:"drag-overlay",children:[ge.kind==="folder"&&l.jsx(_l,{size:12}),l.jsx("span",{children:ge.label})]})})]}),l.jsxs("div",{className:"sidebar-apps",children:[l.jsxs("div",{className:"sidebar-header sidebar-apps-header",children:[l.jsx("span",{className:"sidebar-header-title",children:"Apps"}),l.jsx("button",{className:"sidebar-add",title:"Add mini app",onClick:()=>Me(),children:l.jsx(pr,{size:14})})]}),U.length===0&&l.jsx("div",{className:"tree-empty",children:"No apps yet"}),U.map(R=>{const pe=vn(R.id),ie=pe.sessions.length>0&&!pe.hidden;return l.jsxs("div",{className:"sidebar-app-block",children:[l.jsxs("div",{className:`sidebar-app-row${Q===R.id?" active":""}`,title:R.description??void 0,onClick:()=>ce(R.id),onContextMenu:we=>{we.preventDefault(),ae({x:we.clientX,y:we.clientY,type:"app",appId:R.id,appPinned:R.pinned})},children:[pe.sessions.length>0&&l.jsx("button",{className:`sidebar-app-chevron${ie?"":" closed"}`,title:"Edit sessions of this app",onClick:we=>{we.stopPropagation(),an(R.id)},children:l.jsx(_o,{size:10,className:"tree-chevron"})}),l.jsx(Do,{iconNode:R.iconNode,size:14,className:"sidebar-app-icon"}),l.jsx("span",{className:"tree-label",children:R.title}),pe.sessions.length>0&&l.jsx("span",{className:"sidebar-app-count",children:pe.sessions.length}),R.pinned&&l.jsx(Rl,{size:10,className:"sidebar-app-pin",fill:"currentColor"})]}),ie&&l.jsx("div",{className:"sidebar-app-edits",children:$t(pe,"app")})]},R.id)})]}),l.jsxs("div",{className:"sidebar-footer",onClick:()=>g(),children:[l.jsx(ed,{size:14}),l.jsx("span",{children:"Add workspace"})]}),q&&l.jsxs("div",{ref:Vt,className:"ctx-menu",style:{position:"fixed",left:q.x,top:q.y,zIndex:500},children:[q.type==="workspace"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{h(q.path),ae(null)},children:[l.jsx(pr,{size:12})," New Session"]}),l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{hs(q.path),ae(null)},children:[l.jsx(ed,{size:12})," New Folder"]}),l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{v(q.path),ae(null)},children:[l.jsx(zv,{size:12})," Import Sessions…"]}),l.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{f(q.path),ae(null)},children:[l.jsx(us,{size:12})," Hide Workspace"]})]}),q.type==="folder"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{dt("folder",q.folderId,q.folderName??""),ae(null)},children:[l.jsx(hl,{size:12})," Rename Folder"]}),l.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{M(q.folderId),ae(null)},children:[l.jsx(us,{size:12})," Delete Folder"]})]}),q.type==="session"&&!q.multi&&l.jsx(l.Fragment,{children:q.sessionLifecycle!=="finished"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{dt("session",q.sessionId,q.sessionTitle??""),ae(null)},children:[l.jsx(hl,{size:12})," Rename"]}),l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{x(q.sessionId),ae(null)},children:[l.jsx(jl,{size:12})," Mark as Finished"]}),l.jsxs("div",{className:`ctx-menu-item${q.sessionExternalId?"":" ctx-disabled"}`,title:q.sessionExternalId?void 0:"Session not started",onClick:()=>{q.sessionExternalId&&(Fi(q.sessionExternalId),ae(null))},children:[l.jsx(Oi,{size:12})," Copy Session ID"]}),l.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{d(q.sessionId),ae(null)},children:[l.jsx(us,{size:12})," Delete Session"]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{b(q.sessionId),ae(null)},children:[l.jsx($i,{size:12})," Reopen"]}),l.jsxs("div",{className:`ctx-menu-item${q.sessionExternalId?"":" ctx-disabled"}`,title:q.sessionExternalId?void 0:"Session not started",onClick:()=>{q.sessionExternalId&&(Fi(q.sessionExternalId),ae(null))},children:[l.jsx(Oi,{size:12})," Copy Session ID"]}),l.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{d(q.sessionId),ae(null)},children:[l.jsx(us,{size:12})," Delete Session"]})]})}),q.type==="session"&&q.multi&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctx-menu-header",children:[ft.length," sessions selected"]}),Gt.length>0&&l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{S(Gt),ae(null),Ot()},children:[l.jsx(jl,{size:12})," Mark ",Gt.length," as Finished"]}),yt.length>0&&l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{T(yt),ae(null),Ot()},children:[l.jsx($i,{size:12})," Reopen ",yt.length]}),l.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{N([...Ve]),ae(null),Ot()},children:[l.jsx(us,{size:12})," Delete ",ft.length," Sessions"]})]}),q.type==="app"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{ue(q.appId),ae(null)},children:[l.jsx(hl,{size:12})," Edit App"]}),l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{me(q.appId),ae(null)},children:[l.jsx(Rl,{size:12})," ",q.appPinned?"Unpin":"Pin"]}),l.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{Ne(q.appId),ae(null)},children:[l.jsx(us,{size:12})," Delete App"]})]})]})]})}const il=4,Xb=({transform:e})=>({...e,y:0});function Qm({tabKey:e,title:n,active:r,icon:o,badge:a,onSelect:c,onClose:d,onMenu:f}){const{attributes:h,listeners:g,setNodeRef:v,transform:k,transition:x,isDragging:S}=uf({id:e});return l.jsxs("div",{ref:v,style:{transform:Es.Translate.toString(k),transition:x},className:`ide-tab ${r?"active":""} ${S?"dragging":""}`,title:n,...h,...g,onClick:c,onMouseDown:E=>{E.button===1&&E.preventDefault()},onAuxClick:E=>{E.button===1&&d()},onContextMenu:E=>{E.preventDefault(),E.stopPropagation(),f(E.clientX,E.clientY)},children:[o,n,a,l.jsx("span",{className:"ide-tab-close",onClick:E=>{E.stopPropagation(),d()},children:l.jsx(Tn,{size:12})})]})}function Yb({menu:e,tabs:n,onDone:r}){const o=A(k=>k.closeTabs),a=A(k=>k.reopenClosedTab),c=A(k=>k.closedTabs.some(x=>gv(k,x.key))),d=y.useRef(null),[f,h]=y.useState({left:e.x,top:e.y});Wi(d,r,!0),Io(r,!0),y.useLayoutEffect(()=>{if(!d.current)return;const{width:k,height:x}=d.current.getBoundingClientRect();h({left:Math.max(il,Math.min(e.x,window.innerWidth-k-il)),top:Math.max(il,Math.min(e.y,window.innerHeight-x-il))})},[e.x,e.y]);const g=e.key!==null&&n.includes(e.key)?e.key:null,v=(k,x,S=!1)=>l.jsx("div",{role:"menuitem","aria-disabled":S,className:`ctx-menu-item ${S?"ctx-disabled":""}`,onClick:()=>{S||(x(),r())},children:k});return l.jsxs("div",{ref:d,role:"menu",className:"ctx-menu",style:{position:"fixed",...f,zIndex:500},children:[g!==null&&l.jsxs(l.Fragment,{children:[v("Close",()=>o([g])),v("Close Others",()=>o(n.filter(k=>k!==g)),n.length<2),v("Close to the Right",()=>o(n.slice(n.indexOf(g)+1)),n.at(-1)===g),v("Close All",()=>o(n))]}),v("Reopen Closed Tab",a,!c)]})}function Qb(){const e=A(O=>O.tabOrder),n=A(O=>O.activeSessionId),r=A(O=>O.sessions),o=A(O=>O.backgroundTasks),a=A(O=>O.selectSession),c=A(O=>O.closeTab),d=A(O=>O.setShowNewSessionDialog),f=A(O=>O.apps),h=A(O=>O.activeAppTabId),g=A(O=>O.openAppTab),v=A(O=>O.closeAppTab),k=A(O=>O.moveTab),[x,S]=y.useState(null),E=y.useRef(null),b=Qv(Yv(nc,{activationConstraint:{distance:5}})),T=Kd({activeSessionId:n,activeAppTabId:h});y.useEffect(()=>{var O,X,U;(U=(X=(O=E.current)==null?void 0:O.querySelector(".ide-tab.active"))==null?void 0:X.scrollIntoView)==null||U.call(X,{block:"nearest",inline:"nearest"})},[T]);const N=e.filter(O=>{const{kind:X,id:U}=mr(O);return X==="app"||r.some(P=>P.id===U)}),_=({active:O,over:X})=>{X&&k(String(O.id),String(X.id))},z=O=>{O.preventDefault(),S({x:O.clientX,y:O.clientY,key:null})},M=O=>{var ue;const{kind:X,id:U}=mr(O),P=(me,Ne)=>S({x:me,y:Ne,key:O});if(X==="app"){const me=f.find(Ne=>Ne.id===U);return l.jsx(Qm,{tabKey:O,title:(me==null?void 0:me.title)??U,active:h===U,icon:l.jsx(Do,{iconNode:me==null?void 0:me.iconNode,size:12,className:"miniapp-tab-icon"}),onSelect:()=>g(U),onClose:()=>v(U),onMenu:P},O)}const Q=r.find(me=>me.id===U);if(!Q)return null;const ce=Xl(Q,((ue=o[U])==null?void 0:ue.length)??0);return l.jsx(Qm,{tabKey:O,title:Q.title||U.slice(0,8),active:n===U&&h==null,icon:l.jsx(nf,{iconClass:ce.iconClass,iconText:ce.iconText,size:14}),badge:ce.dot&&l.jsx(tf,{status:ce.dot,title:ce.dotTitle}),onSelect:()=>void a(U),onClose:()=>c(U),onMenu:P},O)};return l.jsxs(my,{sensors:b,collisionDetection:Zv,modifiers:[Xb],onDragEnd:_,children:[l.jsx(Nd,{items:N,strategy:Ab,children:l.jsxs("div",{ref:E,className:"ide-tabs",onContextMenu:z,onWheel:O=>{O.deltaX===0&&(O.currentTarget.scrollLeft+=O.deltaY)},children:[N.map(M),l.jsx("div",{className:"ide-tab-add",title:"New Session",onClick:()=>d(!0),children:l.jsx(pr,{size:14})})]})}),x&&l.jsx(Yb,{menu:x,tabs:N,onDone:()=>S(null)})]})}function ff(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Br=ff();function by(e){Br=e}var Ri={exec:()=>null};function ot(e,n=""){let r=typeof e=="string"?e:e.source;const o={replace:(a,c)=>{let d=typeof c=="string"?c:c.source;return d=d.replace(Nn.caret,"$1"),r=r.replace(a,d),o},getRegex:()=>new RegExp(r,n)};return o}var Nn={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},Zb=/^(?:[ \t]*(?:\n|$))+/,Jb=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,eN=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Xi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,tN=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,pf=/(?:[*+-]|\d{1,9}[.)])/,Ny=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ty=ot(Ny).replace(/bull/g,pf).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(),nN=ot(Ny).replace(/bull/g,pf).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(),hf=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,sN=/^[^\n]+/,mf=/(?!\s*\])(?:\\.|[^\[\]\\])+/,rN=ot(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",mf).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),oN=ot(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,pf).getRegex(),oc="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",gf=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,iN=ot("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",gf).replace("tag",oc).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Cy=ot(hf).replace("hr",Xi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oc).getRegex(),aN=ot(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Cy).getRegex(),vf={blockquote:aN,code:Jb,def:rN,fences:eN,heading:tN,hr:Xi,html:iN,lheading:Ty,list:oN,newline:Zb,paragraph:Cy,table:Ri,text:sN},Zm=ot("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Xi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oc).getRegex(),lN={...vf,lheading:nN,table:Zm,paragraph:ot(hf).replace("hr",Xi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Zm).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",oc).getRegex()},cN={...vf,html:ot(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",gf).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ri,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ot(hf).replace("hr",Xi).replace("heading",` *#{1,6} *[^
|
|
452
|
+
]`).replace("lheading",Ty).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},uN=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,dN=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ey=/^( {2,}|\\)\n(?!\s*$)/,fN=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ic=/[\p{P}\p{S}]/u,yf=/[\s\p{P}\p{S}]/u,jy=/[^\s\p{P}\p{S}]/u,pN=ot(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,yf).getRegex(),_y=/(?!~)[\p{P}\p{S}]/u,hN=/(?!~)[\s\p{P}\p{S}]/u,mN=/(?:[^\s\p{P}\p{S}]|~)/u,gN=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Ry=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,vN=ot(Ry,"u").replace(/punct/g,ic).getRegex(),yN=ot(Ry,"u").replace(/punct/g,_y).getRegex(),Ay="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",xN=ot(Ay,"gu").replace(/notPunctSpace/g,jy).replace(/punctSpace/g,yf).replace(/punct/g,ic).getRegex(),wN=ot(Ay,"gu").replace(/notPunctSpace/g,mN).replace(/punctSpace/g,hN).replace(/punct/g,_y).getRegex(),kN=ot("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,jy).replace(/punctSpace/g,yf).replace(/punct/g,ic).getRegex(),SN=ot(/\\(punct)/,"gu").replace(/punct/g,ic).getRegex(),bN=ot(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),NN=ot(gf).replace("(?:-->|$)","-->").getRegex(),TN=ot("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",NN).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Pl=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,CN=ot(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Pl).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Iy=ot(/^!?\[(label)\]\[(ref)\]/).replace("label",Pl).replace("ref",mf).getRegex(),Dy=ot(/^!?\[(ref)\](?:\[\])?/).replace("ref",mf).getRegex(),EN=ot("reflink|nolink(?!\\()","g").replace("reflink",Iy).replace("nolink",Dy).getRegex(),xf={_backpedal:Ri,anyPunctuation:SN,autolink:bN,blockSkip:gN,br:Ey,code:dN,del:Ri,emStrongLDelim:vN,emStrongRDelimAst:xN,emStrongRDelimUnd:kN,escape:uN,link:CN,nolink:Dy,punctuation:pN,reflink:Iy,reflinkSearch:EN,tag:TN,text:fN,url:Ri},jN={...xf,link:ot(/^!?\[(label)\]\((.*?)\)/).replace("label",Pl).getRegex(),reflink:ot(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Pl).getRegex()},Ed={...xf,emStrongRDelimAst:wN,emStrongLDelim:yN,url:ot(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},_N={...Ed,br:ot(Ey).replace("{2,}","*").getRegex(),text:ot(Ed.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},al={normal:vf,gfm:lN,pedantic:cN},yi={normal:xf,gfm:Ed,breaks:_N,pedantic:jN},RN={"&":"&","<":"<",">":">",'"':""","'":"'"},Jm=e=>RN[e];function Ns(e,n){if(n){if(Nn.escapeTest.test(e))return e.replace(Nn.escapeReplace,Jm)}else if(Nn.escapeTestNoEncode.test(e))return e.replace(Nn.escapeReplaceNoEncode,Jm);return e}function eg(e){try{e=encodeURI(e).replace(Nn.percentDecode,"%")}catch{return null}return e}function tg(e,n){var c;const r=e.replace(Nn.findPipe,(d,f,h)=>{let g=!1,v=f;for(;--v>=0&&h[v]==="\\";)g=!g;return g?"|":" |"}),o=r.split(Nn.splitPipe);let a=0;if(o[0].trim()||o.shift(),o.length>0&&!((c=o.at(-1))!=null&&c.trim())&&o.pop(),n)if(o.length>n)o.splice(n);else for(;o.length<n;)o.push("");for(;a<o.length;a++)o[a]=o[a].trim().replace(Nn.slashPipe,"|");return o}function xi(e,n,r){const o=e.length;if(o===0)return"";let a=0;for(;a<o&&e.charAt(o-a-1)===n;)a++;return e.slice(0,o-a)}function AN(e,n){if(e.indexOf(n[1])===-1)return-1;let r=0;for(let o=0;o<e.length;o++)if(e[o]==="\\")o++;else if(e[o]===n[0])r++;else if(e[o]===n[1]&&(r--,r<0))return o;return r>0?-2:-1}function ng(e,n,r,o,a){const c=n.href,d=n.title||null,f=e[1].replace(a.other.outputLinkReplace,"$1");o.state.inLink=!0;const h={type:e[0].charAt(0)==="!"?"image":"link",raw:r,href:c,title:d,text:f,tokens:o.inlineTokens(f)};return o.state.inLink=!1,h}function IN(e,n,r){const o=e.match(r.other.indentCodeCompensation);if(o===null)return n;const a=o[1];return n.split(`
|
|
453
|
+
`).map(c=>{const d=c.match(r.other.beginningSpace);if(d===null)return c;const[f]=d;return f.length>=a.length?c.slice(a.length):c}).join(`
|
|
454
|
+
`)}var zl=class{constructor(e){at(this,"options");at(this,"rules");at(this,"lexer");this.options=e||Br}space(e){const n=this.rules.block.newline.exec(e);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(e){const n=this.rules.block.code.exec(e);if(n){const r=n[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?r:xi(r,`
|
|
455
|
+
`)}}}fences(e){const n=this.rules.block.fences.exec(e);if(n){const r=n[0],o=IN(r,n[3]||"",this.rules);return{type:"code",raw:r,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:o}}}heading(e){const n=this.rules.block.heading.exec(e);if(n){let r=n[2].trim();if(this.rules.other.endingHash.test(r)){const o=xi(r,"#");(this.options.pedantic||!o||this.rules.other.endingSpaceChar.test(o))&&(r=o.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){const n=this.rules.block.hr.exec(e);if(n)return{type:"hr",raw:xi(n[0],`
|
|
456
|
+
`)}}blockquote(e){const n=this.rules.block.blockquote.exec(e);if(n){let r=xi(n[0],`
|
|
457
|
+
`).split(`
|
|
458
|
+
`),o="",a="";const c=[];for(;r.length>0;){let d=!1;const f=[];let h;for(h=0;h<r.length;h++)if(this.rules.other.blockquoteStart.test(r[h]))f.push(r[h]),d=!0;else if(!d)f.push(r[h]);else break;r=r.slice(h);const g=f.join(`
|
|
459
|
+
`),v=g.replace(this.rules.other.blockquoteSetextReplace,`
|
|
460
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");o=o?`${o}
|
|
461
|
+
${g}`:g,a=a?`${a}
|
|
462
|
+
${v}`:v;const k=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(v,c,!0),this.lexer.state.top=k,r.length===0)break;const x=c.at(-1);if((x==null?void 0:x.type)==="code")break;if((x==null?void 0:x.type)==="blockquote"){const S=x,E=S.raw+`
|
|
463
|
+
`+r.join(`
|
|
464
|
+
`),b=this.blockquote(E);c[c.length-1]=b,o=o.substring(0,o.length-S.raw.length)+b.raw,a=a.substring(0,a.length-S.text.length)+b.text;break}else if((x==null?void 0:x.type)==="list"){const S=x,E=S.raw+`
|
|
465
|
+
`+r.join(`
|
|
466
|
+
`),b=this.list(E);c[c.length-1]=b,o=o.substring(0,o.length-x.raw.length)+b.raw,a=a.substring(0,a.length-S.raw.length)+b.raw,r=E.substring(c.at(-1).raw.length).split(`
|
|
467
|
+
`);continue}}return{type:"blockquote",raw:o,tokens:c,text:a}}}list(e){let n=this.rules.block.list.exec(e);if(n){let r=n[1].trim();const o=r.length>1,a={type:"list",raw:"",ordered:o,start:o?+r.slice(0,-1):"",loose:!1,items:[]};r=o?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=o?r:"[*+-]");const c=this.rules.other.listItemRegex(r);let d=!1;for(;e;){let h=!1,g="",v="";if(!(n=c.exec(e))||this.rules.block.hr.test(e))break;g=n[0],e=e.substring(g.length);let k=n[2].split(`
|
|
468
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,N=>" ".repeat(3*N.length)),x=e.split(`
|
|
469
|
+
`,1)[0],S=!k.trim(),E=0;if(this.options.pedantic?(E=2,v=k.trimStart()):S?E=n[1].length+1:(E=n[2].search(this.rules.other.nonSpaceChar),E=E>4?1:E,v=k.slice(E),E+=n[1].length),S&&this.rules.other.blankLine.test(x)&&(g+=x+`
|
|
470
|
+
`,e=e.substring(x.length+1),h=!0),!h){const N=this.rules.other.nextBulletRegex(E),_=this.rules.other.hrRegex(E),z=this.rules.other.fencesBeginRegex(E),M=this.rules.other.headingBeginRegex(E),O=this.rules.other.htmlBeginRegex(E);for(;e;){const X=e.split(`
|
|
471
|
+
`,1)[0];let U;if(x=X,this.options.pedantic?(x=x.replace(this.rules.other.listReplaceNesting," "),U=x):U=x.replace(this.rules.other.tabCharGlobal," "),z.test(x)||M.test(x)||O.test(x)||N.test(x)||_.test(x))break;if(U.search(this.rules.other.nonSpaceChar)>=E||!x.trim())v+=`
|
|
472
|
+
`+U.slice(E);else{if(S||k.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||z.test(k)||M.test(k)||_.test(k))break;v+=`
|
|
473
|
+
`+x}!S&&!x.trim()&&(S=!0),g+=X+`
|
|
474
|
+
`,e=e.substring(X.length+1),k=U.slice(E)}}a.loose||(d?a.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(d=!0));let b=null,T;this.options.gfm&&(b=this.rules.other.listIsTask.exec(v),b&&(T=b[0]!=="[ ] ",v=v.replace(this.rules.other.listReplaceTask,""))),a.items.push({type:"list_item",raw:g,task:!!b,checked:T,loose:!1,text:v,tokens:[]}),a.raw+=g}const f=a.items.at(-1);if(f)f.raw=f.raw.trimEnd(),f.text=f.text.trimEnd();else return;a.raw=a.raw.trimEnd();for(let h=0;h<a.items.length;h++)if(this.lexer.state.top=!1,a.items[h].tokens=this.lexer.blockTokens(a.items[h].text,[]),!a.loose){const g=a.items[h].tokens.filter(k=>k.type==="space"),v=g.length>0&&g.some(k=>this.rules.other.anyLine.test(k.raw));a.loose=v}if(a.loose)for(let h=0;h<a.items.length;h++)a.items[h].loose=!0;return a}}html(e){const n=this.rules.block.html.exec(e);if(n)return{type:"html",block:!0,raw:n[0],pre:n[1]==="pre"||n[1]==="script"||n[1]==="style",text:n[0]}}def(e){const n=this.rules.block.def.exec(e);if(n){const r=n[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),o=n[2]?n[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",a=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):n[3];return{type:"def",tag:r,raw:n[0],href:o,title:a}}}table(e){var d;const n=this.rules.block.table.exec(e);if(!n||!this.rules.other.tableDelimiter.test(n[2]))return;const r=tg(n[1]),o=n[2].replace(this.rules.other.tableAlignChars,"").split("|"),a=(d=n[3])!=null&&d.trim()?n[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
475
|
+
`):[],c={type:"table",raw:n[0],header:[],align:[],rows:[]};if(r.length===o.length){for(const f of o)this.rules.other.tableAlignRight.test(f)?c.align.push("right"):this.rules.other.tableAlignCenter.test(f)?c.align.push("center"):this.rules.other.tableAlignLeft.test(f)?c.align.push("left"):c.align.push(null);for(let f=0;f<r.length;f++)c.header.push({text:r[f],tokens:this.lexer.inline(r[f]),header:!0,align:c.align[f]});for(const f of a)c.rows.push(tg(f,c.header.length).map((h,g)=>({text:h,tokens:this.lexer.inline(h),header:!1,align:c.align[g]})));return c}}lheading(e){const n=this.rules.block.lheading.exec(e);if(n)return{type:"heading",raw:n[0],depth:n[2].charAt(0)==="="?1:2,text:n[1],tokens:this.lexer.inline(n[1])}}paragraph(e){const n=this.rules.block.paragraph.exec(e);if(n){const r=n[1].charAt(n[1].length-1)===`
|
|
476
|
+
`?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:r,tokens:this.lexer.inline(r)}}}text(e){const n=this.rules.block.text.exec(e);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(e){const n=this.rules.inline.escape.exec(e);if(n)return{type:"escape",raw:n[0],text:n[1]}}tag(e){const n=this.rules.inline.tag.exec(e);if(n)return!this.lexer.state.inLink&&this.rules.other.startATag.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(e){const n=this.rules.inline.link.exec(e);if(n){const r=n[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;const c=xi(r.slice(0,-1),"\\");if((r.length-c.length)%2===0)return}else{const c=AN(n[2],"()");if(c===-2)return;if(c>-1){const f=(n[0].indexOf("!")===0?5:4)+n[1].length+c;n[2]=n[2].substring(0,c),n[0]=n[0].substring(0,f).trim(),n[3]=""}}let o=n[2],a="";if(this.options.pedantic){const c=this.rules.other.pedanticHrefTitle.exec(o);c&&(o=c[1],a=c[3])}else a=n[3]?n[3].slice(1,-1):"";return o=o.trim(),this.rules.other.startAngleBracket.test(o)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?o=o.slice(1):o=o.slice(1,-1)),ng(n,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer,this.rules)}}reflink(e,n){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){const o=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),a=n[o.toLowerCase()];if(!a){const c=r[0].charAt(0);return{type:"text",raw:c,text:c}}return ng(r,a,r[0],this.lexer,this.rules)}}emStrong(e,n,r=""){let o=this.rules.inline.emStrongLDelim.exec(e);if(!o||o[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(o[1]||o[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const c=[...o[0]].length-1;let d,f,h=c,g=0;const v=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(v.lastIndex=0,n=n.slice(-1*e.length+c);(o=v.exec(n))!=null;){if(d=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!d)continue;if(f=[...d].length,o[3]||o[4]){h+=f;continue}else if((o[5]||o[6])&&c%3&&!((c+f)%3)){g+=f;continue}if(h-=f,h>0)continue;f=Math.min(f,f+h+g);const k=[...o[0]][0].length,x=e.slice(0,c+o.index+k+f);if(Math.min(c,f)%2){const E=x.slice(1,-1);return{type:"em",raw:x,text:E,tokens:this.lexer.inlineTokens(E)}}const S=x.slice(2,-2);return{type:"strong",raw:x,text:S,tokens:this.lexer.inlineTokens(S)}}}}codespan(e){const n=this.rules.inline.code.exec(e);if(n){let r=n[2].replace(this.rules.other.newLineCharGlobal," ");const o=this.rules.other.nonSpaceChar.test(r),a=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return o&&a&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:n[0],text:r}}}br(e){const n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}}del(e){const n=this.rules.inline.del.exec(e);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(e){const n=this.rules.inline.autolink.exec(e);if(n){let r,o;return n[2]==="@"?(r=n[1],o="mailto:"+r):(r=n[1],o=r),{type:"link",raw:n[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}url(e){var r;let n;if(n=this.rules.inline.url.exec(e)){let o,a;if(n[2]==="@")o=n[0],a="mailto:"+o;else{let c;do c=n[0],n[0]=((r=this.rules.inline._backpedal.exec(n[0]))==null?void 0:r[0])??"";while(c!==n[0]);o=n[0],n[1]==="www."?a="http://"+n[0]:a=n[0]}return{type:"link",raw:n[0],text:o,href:a,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(e){const n=this.rules.inline.text.exec(e);if(n){const r=this.lexer.state.inRawBlock;return{type:"text",raw:n[0],text:n[0],escaped:r}}}},Ps=class jd{constructor(n){at(this,"tokens");at(this,"options");at(this,"state");at(this,"tokenizer");at(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=n||Br,this.options.tokenizer=this.options.tokenizer||new zl,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const r={other:Nn,block:al.normal,inline:yi.normal};this.options.pedantic?(r.block=al.pedantic,r.inline=yi.pedantic):this.options.gfm&&(r.block=al.gfm,this.options.breaks?r.inline=yi.breaks:r.inline=yi.gfm),this.tokenizer.rules=r}static get rules(){return{block:al,inline:yi}}static lex(n,r){return new jd(r).lex(n)}static lexInline(n,r){return new jd(r).inlineTokens(n)}lex(n){n=n.replace(Nn.carriageReturn,`
|
|
477
|
+
`),this.blockTokens(n,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){const o=this.inlineQueue[r];this.inlineTokens(o.src,o.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(n,r=[],o=!1){var a,c,d;for(this.options.pedantic&&(n=n.replace(Nn.tabCharGlobal," ").replace(Nn.spaceLine,""));n;){let f;if((c=(a=this.options.extensions)==null?void 0:a.block)!=null&&c.some(g=>(f=g.call({lexer:this},n,r))?(n=n.substring(f.raw.length),r.push(f),!0):!1))continue;if(f=this.tokenizer.space(n)){n=n.substring(f.raw.length);const g=r.at(-1);f.raw.length===1&&g!==void 0?g.raw+=`
|
|
478
|
+
`:r.push(f);continue}if(f=this.tokenizer.code(n)){n=n.substring(f.raw.length);const g=r.at(-1);(g==null?void 0:g.type)==="paragraph"||(g==null?void 0:g.type)==="text"?(g.raw+=`
|
|
479
|
+
`+f.raw,g.text+=`
|
|
480
|
+
`+f.text,this.inlineQueue.at(-1).src=g.text):r.push(f);continue}if(f=this.tokenizer.fences(n)){n=n.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.heading(n)){n=n.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.hr(n)){n=n.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.blockquote(n)){n=n.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.list(n)){n=n.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.html(n)){n=n.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.def(n)){n=n.substring(f.raw.length);const g=r.at(-1);(g==null?void 0:g.type)==="paragraph"||(g==null?void 0:g.type)==="text"?(g.raw+=`
|
|
481
|
+
`+f.raw,g.text+=`
|
|
482
|
+
`+f.raw,this.inlineQueue.at(-1).src=g.text):this.tokens.links[f.tag]||(this.tokens.links[f.tag]={href:f.href,title:f.title});continue}if(f=this.tokenizer.table(n)){n=n.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.lheading(n)){n=n.substring(f.raw.length),r.push(f);continue}let h=n;if((d=this.options.extensions)!=null&&d.startBlock){let g=1/0;const v=n.slice(1);let k;this.options.extensions.startBlock.forEach(x=>{k=x.call({lexer:this},v),typeof k=="number"&&k>=0&&(g=Math.min(g,k))}),g<1/0&&g>=0&&(h=n.substring(0,g+1))}if(this.state.top&&(f=this.tokenizer.paragraph(h))){const g=r.at(-1);o&&(g==null?void 0:g.type)==="paragraph"?(g.raw+=`
|
|
483
|
+
`+f.raw,g.text+=`
|
|
484
|
+
`+f.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=g.text):r.push(f),o=h.length!==n.length,n=n.substring(f.raw.length);continue}if(f=this.tokenizer.text(n)){n=n.substring(f.raw.length);const g=r.at(-1);(g==null?void 0:g.type)==="text"?(g.raw+=`
|
|
485
|
+
`+f.raw,g.text+=`
|
|
486
|
+
`+f.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=g.text):r.push(f);continue}if(n){const g="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(g);break}else throw new Error(g)}}return this.state.top=!0,r}inline(n,r=[]){return this.inlineQueue.push({src:n,tokens:r}),r}inlineTokens(n,r=[]){var f,h,g;let o=n,a=null;if(this.tokens.links){const v=Object.keys(this.tokens.links);if(v.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(o))!=null;)v.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(o))!=null;)o=o.slice(0,a.index)+"++"+o.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(a=this.tokenizer.rules.inline.blockSkip.exec(o))!=null;)o=o.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let c=!1,d="";for(;n;){c||(d=""),c=!1;let v;if((h=(f=this.options.extensions)==null?void 0:f.inline)!=null&&h.some(x=>(v=x.call({lexer:this},n,r))?(n=n.substring(v.raw.length),r.push(v),!0):!1))continue;if(v=this.tokenizer.escape(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.tag(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.link(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(v.raw.length);const x=r.at(-1);v.type==="text"&&(x==null?void 0:x.type)==="text"?(x.raw+=v.raw,x.text+=v.text):r.push(v);continue}if(v=this.tokenizer.emStrong(n,o,d)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.codespan(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.br(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.del(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.autolink(n)){n=n.substring(v.raw.length),r.push(v);continue}if(!this.state.inLink&&(v=this.tokenizer.url(n))){n=n.substring(v.raw.length),r.push(v);continue}let k=n;if((g=this.options.extensions)!=null&&g.startInline){let x=1/0;const S=n.slice(1);let E;this.options.extensions.startInline.forEach(b=>{E=b.call({lexer:this},S),typeof E=="number"&&E>=0&&(x=Math.min(x,E))}),x<1/0&&x>=0&&(k=n.substring(0,x+1))}if(v=this.tokenizer.inlineText(k)){n=n.substring(v.raw.length),v.raw.slice(-1)!=="_"&&(d=v.raw.slice(-1)),c=!0;const x=r.at(-1);(x==null?void 0:x.type)==="text"?(x.raw+=v.raw,x.text+=v.text):r.push(v);continue}if(n){const x="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return r}},Fl=class{constructor(e){at(this,"options");at(this,"parser");this.options=e||Br}space(e){return""}code({text:e,lang:n,escaped:r}){var c;const o=(c=(n||"").match(Nn.notSpaceStart))==null?void 0:c[0],a=e.replace(Nn.endingNewline,"")+`
|
|
487
|
+
`;return o?'<pre><code class="language-'+Ns(o)+'">'+(r?a:Ns(a,!0))+`</code></pre>
|
|
488
|
+
`:"<pre><code>"+(r?a:Ns(a,!0))+`</code></pre>
|
|
489
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
490
|
+
${this.parser.parse(e)}</blockquote>
|
|
491
|
+
`}html({text:e}){return e}heading({tokens:e,depth:n}){return`<h${n}>${this.parser.parseInline(e)}</h${n}>
|
|
492
|
+
`}hr(e){return`<hr>
|
|
493
|
+
`}list(e){const n=e.ordered,r=e.start;let o="";for(let d=0;d<e.items.length;d++){const f=e.items[d];o+=this.listitem(f)}const a=n?"ol":"ul",c=n&&r!==1?' start="'+r+'"':"";return"<"+a+c+`>
|
|
494
|
+
`+o+"</"+a+`>
|
|
495
|
+
`}listitem(e){var r;let n="";if(e.task){const o=this.checkbox({checked:!!e.checked});e.loose?((r=e.tokens[0])==null?void 0:r.type)==="paragraph"?(e.tokens[0].text=o+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=o+" "+Ns(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:o+" ",text:o+" ",escaped:!0}):n+=o+" "}return n+=this.parser.parse(e.tokens,!!e.loose),`<li>${n}</li>
|
|
496
|
+
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
497
|
+
`}table(e){let n="",r="";for(let a=0;a<e.header.length;a++)r+=this.tablecell(e.header[a]);n+=this.tablerow({text:r});let o="";for(let a=0;a<e.rows.length;a++){const c=e.rows[a];r="";for(let d=0;d<c.length;d++)r+=this.tablecell(c[d]);o+=this.tablerow({text:r})}return o&&(o=`<tbody>${o}</tbody>`),`<table>
|
|
498
|
+
<thead>
|
|
499
|
+
`+n+`</thead>
|
|
500
|
+
`+o+`</table>
|
|
501
|
+
`}tablerow({text:e}){return`<tr>
|
|
502
|
+
${e}</tr>
|
|
503
|
+
`}tablecell(e){const n=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+n+`</${r}>
|
|
504
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Ns(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:n,tokens:r}){const o=this.parser.parseInline(r),a=eg(e);if(a===null)return o;e=a;let c='<a href="'+e+'"';return n&&(c+=' title="'+Ns(n)+'"'),c+=">"+o+"</a>",c}image({href:e,title:n,text:r,tokens:o}){o&&(r=this.parser.parseInline(o,this.parser.textRenderer));const a=eg(e);if(a===null)return Ns(r);e=a;let c=`<img src="${e}" alt="${r}"`;return n&&(c+=` title="${Ns(n)}"`),c+=">",c}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Ns(e.text)}},wf=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},zs=class _d{constructor(n){at(this,"options");at(this,"renderer");at(this,"textRenderer");this.options=n||Br,this.options.renderer=this.options.renderer||new Fl,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new wf}static parse(n,r){return new _d(r).parse(n)}static parseInline(n,r){return new _d(r).parseInline(n)}parse(n,r=!0){var a,c;let o="";for(let d=0;d<n.length;d++){const f=n[d];if((c=(a=this.options.extensions)==null?void 0:a.renderers)!=null&&c[f.type]){const g=f,v=this.options.extensions.renderers[g.type].call({parser:this},g);if(v!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(g.type)){o+=v||"";continue}}const h=f;switch(h.type){case"space":{o+=this.renderer.space(h);continue}case"hr":{o+=this.renderer.hr(h);continue}case"heading":{o+=this.renderer.heading(h);continue}case"code":{o+=this.renderer.code(h);continue}case"table":{o+=this.renderer.table(h);continue}case"blockquote":{o+=this.renderer.blockquote(h);continue}case"list":{o+=this.renderer.list(h);continue}case"html":{o+=this.renderer.html(h);continue}case"paragraph":{o+=this.renderer.paragraph(h);continue}case"text":{let g=h,v=this.renderer.text(g);for(;d+1<n.length&&n[d+1].type==="text";)g=n[++d],v+=`
|
|
505
|
+
`+this.renderer.text(g);r?o+=this.renderer.paragraph({type:"paragraph",raw:v,text:v,tokens:[{type:"text",raw:v,text:v,escaped:!0}]}):o+=v;continue}default:{const g='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(g),"";throw new Error(g)}}}return o}parseInline(n,r=this.renderer){var a,c;let o="";for(let d=0;d<n.length;d++){const f=n[d];if((c=(a=this.options.extensions)==null?void 0:a.renderers)!=null&&c[f.type]){const g=this.options.extensions.renderers[f.type].call({parser:this},f);if(g!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(f.type)){o+=g||"";continue}}const h=f;switch(h.type){case"escape":{o+=r.text(h);break}case"html":{o+=r.html(h);break}case"link":{o+=r.link(h);break}case"image":{o+=r.image(h);break}case"strong":{o+=r.strong(h);break}case"em":{o+=r.em(h);break}case"codespan":{o+=r.codespan(h);break}case"br":{o+=r.br(h);break}case"del":{o+=r.del(h);break}case"text":{o+=r.text(h);break}default:{const g='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(g),"";throw new Error(g)}}}return o}},hd,gl=(hd=class{constructor(e){at(this,"options");at(this,"block");this.options=e||Br}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?Ps.lex:Ps.lexInline}provideParser(){return this.block?zs.parse:zs.parseInline}},at(hd,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),hd),DN=class{constructor(...e){at(this,"defaults",ff());at(this,"options",this.setOptions);at(this,"parse",this.parseMarkdown(!0));at(this,"parseInline",this.parseMarkdown(!1));at(this,"Parser",zs);at(this,"Renderer",Fl);at(this,"TextRenderer",wf);at(this,"Lexer",Ps);at(this,"Tokenizer",zl);at(this,"Hooks",gl);this.use(...e)}walkTokens(e,n){var o,a;let r=[];for(const c of e)switch(r=r.concat(n.call(this,c)),c.type){case"table":{const d=c;for(const f of d.header)r=r.concat(this.walkTokens(f.tokens,n));for(const f of d.rows)for(const h of f)r=r.concat(this.walkTokens(h.tokens,n));break}case"list":{const d=c;r=r.concat(this.walkTokens(d.items,n));break}default:{const d=c;(a=(o=this.defaults.extensions)==null?void 0:o.childTokens)!=null&&a[d.type]?this.defaults.extensions.childTokens[d.type].forEach(f=>{const h=d[f].flat(1/0);r=r.concat(this.walkTokens(h,n))}):d.tokens&&(r=r.concat(this.walkTokens(d.tokens,n)))}}return r}use(...e){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{const o={...r};if(o.async=this.defaults.async||o.async||!1,r.extensions&&(r.extensions.forEach(a=>{if(!a.name)throw new Error("extension name required");if("renderer"in a){const c=n.renderers[a.name];c?n.renderers[a.name]=function(...d){let f=a.renderer.apply(this,d);return f===!1&&(f=c.apply(this,d)),f}:n.renderers[a.name]=a.renderer}if("tokenizer"in a){if(!a.level||a.level!=="block"&&a.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const c=n[a.level];c?c.unshift(a.tokenizer):n[a.level]=[a.tokenizer],a.start&&(a.level==="block"?n.startBlock?n.startBlock.push(a.start):n.startBlock=[a.start]:a.level==="inline"&&(n.startInline?n.startInline.push(a.start):n.startInline=[a.start]))}"childTokens"in a&&a.childTokens&&(n.childTokens[a.name]=a.childTokens)}),o.extensions=n),r.renderer){const a=this.defaults.renderer||new Fl(this.defaults);for(const c in r.renderer){if(!(c in a))throw new Error(`renderer '${c}' does not exist`);if(["options","parser"].includes(c))continue;const d=c,f=r.renderer[d],h=a[d];a[d]=(...g)=>{let v=f.apply(a,g);return v===!1&&(v=h.apply(a,g)),v||""}}o.renderer=a}if(r.tokenizer){const a=this.defaults.tokenizer||new zl(this.defaults);for(const c in r.tokenizer){if(!(c in a))throw new Error(`tokenizer '${c}' does not exist`);if(["options","rules","lexer"].includes(c))continue;const d=c,f=r.tokenizer[d],h=a[d];a[d]=(...g)=>{let v=f.apply(a,g);return v===!1&&(v=h.apply(a,g)),v}}o.tokenizer=a}if(r.hooks){const a=this.defaults.hooks||new gl;for(const c in r.hooks){if(!(c in a))throw new Error(`hook '${c}' does not exist`);if(["options","block"].includes(c))continue;const d=c,f=r.hooks[d],h=a[d];gl.passThroughHooks.has(c)?a[d]=g=>{if(this.defaults.async)return Promise.resolve(f.call(a,g)).then(k=>h.call(a,k));const v=f.call(a,g);return h.call(a,v)}:a[d]=(...g)=>{let v=f.apply(a,g);return v===!1&&(v=h.apply(a,g)),v}}o.hooks=a}if(r.walkTokens){const a=this.defaults.walkTokens,c=r.walkTokens;o.walkTokens=function(d){let f=[];return f.push(c.call(this,d)),a&&(f=f.concat(a.call(this,d))),f}}this.defaults={...this.defaults,...o}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,n){return Ps.lex(e,n??this.defaults)}parser(e,n){return zs.parse(e,n??this.defaults)}parseMarkdown(e){return(r,o)=>{const a={...o},c={...this.defaults,...a},d=this.onError(!!c.silent,!!c.async);if(this.defaults.async===!0&&a.async===!1)return d(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return d(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return d(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));c.hooks&&(c.hooks.options=c,c.hooks.block=e);const f=c.hooks?c.hooks.provideLexer():e?Ps.lex:Ps.lexInline,h=c.hooks?c.hooks.provideParser():e?zs.parse:zs.parseInline;if(c.async)return Promise.resolve(c.hooks?c.hooks.preprocess(r):r).then(g=>f(g,c)).then(g=>c.hooks?c.hooks.processAllTokens(g):g).then(g=>c.walkTokens?Promise.all(this.walkTokens(g,c.walkTokens)).then(()=>g):g).then(g=>h(g,c)).then(g=>c.hooks?c.hooks.postprocess(g):g).catch(d);try{c.hooks&&(r=c.hooks.preprocess(r));let g=f(r,c);c.hooks&&(g=c.hooks.processAllTokens(g)),c.walkTokens&&this.walkTokens(g,c.walkTokens);let v=h(g,c);return c.hooks&&(v=c.hooks.postprocess(v)),v}catch(g){return d(g)}}}onError(e,n){return r=>{if(r.message+=`
|
|
506
|
+
Please report this to https://github.com/markedjs/marked.`,e){const o="<p>An error occurred:</p><pre>"+Ns(r.message+"",!0)+"</pre>";return n?Promise.resolve(o):o}if(n)return Promise.reject(r);throw r}}},Ur=new DN;function Ge(e,n){return Ur.parse(e,n)}Ge.options=Ge.setOptions=function(e){return Ur.setOptions(e),Ge.defaults=Ur.defaults,by(Ge.defaults),Ge};Ge.getDefaults=ff;Ge.defaults=Br;Ge.use=function(...e){return Ur.use(...e),Ge.defaults=Ur.defaults,by(Ge.defaults),Ge};Ge.walkTokens=function(e,n){return Ur.walkTokens(e,n)};Ge.parseInline=Ur.parseInline;Ge.Parser=zs;Ge.parser=zs.parse;Ge.Renderer=Fl;Ge.TextRenderer=wf;Ge.Lexer=Ps;Ge.lexer=Ps.lex;Ge.Tokenizer=zl;Ge.Hooks=gl;Ge.parse=Ge;Ge.options;Ge.setOptions;Ge.use;Ge.walkTokens;Ge.parseInline;zs.parse;Ps.lex;/*! @license DOMPurify 3.4.13 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.13/LICENSE */function sg(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=Array(n);r<n;r++)o[r]=e[r];return o}function MN(e){if(Array.isArray(e))return e}function LN(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,a,c,d,f=[],h=!0,g=!1;try{if(c=(r=r.call(e)).next,n!==0)for(;!(h=(o=c.call(r)).done)&&(f.push(o.value),f.length!==n);h=!0);}catch(v){g=!0,a=v}finally{try{if(!h&&r.return!=null&&(d=r.return(),Object(d)!==d))return}finally{if(g)throw a}}return f}}function ON(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
507
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $N(e,n){return MN(e)||LN(e,n)||PN(e,n)||ON()}function PN(e,n){if(e){if(typeof e=="string")return sg(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?sg(e,n):void 0}}const My=Object.entries,rg=Object.setPrototypeOf,zN=Object.isFrozen,FN=Object.getPrototypeOf,UN=Object.getOwnPropertyDescriptor;let rn=Object.freeze,on=Object.seal,ko=Object.create,Ly=typeof Reflect<"u"&&Reflect,Rd=Ly.apply,Ad=Ly.construct;rn||(rn=function(n){return n});on||(on=function(n){return n});Rd||(Rd=function(n,r){for(var o=arguments.length,a=new Array(o>2?o-2:0),c=2;c<o;c++)a[c-2]=arguments[c];return n.apply(r,a)});Ad||(Ad=function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];return new n(...o)});const go=zt(Array.prototype.forEach),BN=zt(Array.prototype.lastIndexOf),og=zt(Array.prototype.pop),vo=zt(Array.prototype.push),WN=zt(Array.prototype.splice),fr=Array.isArray,Ti=zt(String.prototype.toLowerCase),od=zt(String.prototype.toString),ig=zt(String.prototype.match),wi=zt(String.prototype.replace),ag=zt(String.prototype.indexOf),HN=zt(String.prototype.trim),VN=zt(Number.prototype.toString),KN=zt(Boolean.prototype.toString),lg=typeof BigInt>"u"?null:zt(BigInt.prototype.toString),cg=typeof Symbol>"u"?null:zt(Symbol.prototype.toString),Jt=zt(Object.prototype.hasOwnProperty),ki=zt(Object.prototype.toString),Zt=zt(RegExp.prototype.test),$r=GN(TypeError);function zt(e){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var r=arguments.length,o=new Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];return Rd(e,n,o)}}function GN(e){return function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return Ad(e,r)}}function Ke(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ti;if(rg&&rg(e,null),!fr(n))return e;let o=n.length;for(;o--;){let a=n[o];if(typeof a=="string"){const c=r(a);c!==a&&(zN(n)||(n[o]=c),a=c)}e[a]=!0}return e}function qN(e){for(let n=0;n<e.length;n++)Jt(e,n)||(e[n]=null);return e}function pn(e){const n=ko(null);for(const o of My(e)){var r=$N(o,2);const a=r[0],c=r[1];Jt(e,a)&&(fr(c)?n[a]=qN(c):c&&typeof c=="object"&&c.constructor===Object?n[a]=pn(c):n[a]=c)}return n}function XN(e){switch(typeof e){case"string":return e;case"number":return VN(e);case"boolean":return KN(e);case"bigint":return lg?lg(e):"0";case"symbol":return cg?cg(e):"Symbol()";case"undefined":return ki(e);case"function":case"object":{if(e===null)return ki(e);const n=e,r=cs(n,"toString");if(typeof r=="function"){const o=r(n);return typeof o=="string"?o:ki(o)}return ki(e)}default:return ki(e)}}function cs(e,n){for(;e!==null;){const o=UN(e,n);if(o){if(o.get)return zt(o.get);if(typeof o.value=="function")return zt(o.value)}e=FN(e)}function r(){return null}return r}function YN(e){try{return Zt(e,""),!0}catch{return!1}}const ug=rn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),id=rn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ad=rn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),QN=rn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),ld=rn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),ZN=rn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),dg=rn(["#text"]),fg=rn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),cd=rn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),pg=rn(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ll=rn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),JN=on(/{{[\w\W]*|^[\w\W]*}}/g),eT=on(/<%[\w\W]*|^[\w\W]*%>/g),tT=on(/\${[\w\W]*/g),nT=on(/^data-[\-\w.\u00B7-\uFFFF]+$/),sT=on(/^aria-[\-\w]+$/),hg=on(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),rT=on(/^(?:\w+script|data):/i),oT=on(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),iT=on(/^html$/i),aT=on(/^[a-z][.\w]*(-[.\w]+)+$/i),mg=on(/<[/\w!]/g),gg=on(/<[/\w]/g),lT=on(/<\/no(script|embed|frames)/i),cT=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},uT=function(){return typeof window>"u"?null:window},dT=function(n,r){if(typeof n!="object"||typeof n.createPolicy!="function")return null;let o=null;const a="data-tt-policy-suffix";r&&r.hasAttribute(a)&&(o=r.getAttribute(a));const c="dompurify"+(o?"#"+o:"");try{return n.createPolicy(c,{createHTML(d){return d},createScriptURL(d){return d}})}catch{return console.warn("TrustedTypes policy "+c+" could not be created."),null}},vg=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},ur=function(n,r,o,a){return Jt(n,r)&&fr(n[r])?Ke(a.base?pn(a.base):{},n[r],a.transform):o};function Oy(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:uT();const n=de=>Oy(de);if(n.version="3.4.13",n.removed=[],!e||!e.document||e.document.nodeType!==Hn.document||!e.Element)return n.isSupported=!1,n;let r=e.document;const o=r,a=o.currentScript;e.DocumentFragment;const c=e.HTMLTemplateElement,d=e.Node,f=e.Element,h=e.NodeFilter,g=e.NamedNodeMap;g===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const v=e.DOMParser,k=e.trustedTypes,x=f.prototype,S=cs(x,"cloneNode"),E=cs(x,"remove"),b=cs(x,"nextSibling"),T=cs(x,"childNodes"),N=cs(x,"parentNode"),_=cs(x,"shadowRoot"),z=cs(x,"attributes"),M=d&&d.prototype?cs(d.prototype,"nodeType"):null,O=d&&d.prototype?cs(d.prototype,"nodeName"):null,X=d&&d.prototype?cs(d.prototype,"ownerDocument"):null;if(typeof c=="function"){const de=r.createElement("template");de.content&&de.content.ownerDocument&&(r=de.content.ownerDocument)}let U,P="",Q,ce=!1,ue=0;const me=function(){if(ue>0)throw $r('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Ne=function(C){me(),ue++;try{return U.createHTML(C)}finally{ue--}},Me=function(C){me(),ue++;try{return U.createScriptURL(C)}finally{ue--}},J=function(){return ce||(Q=dT(k,a),ce=!0),Q},re=r,ee=re.implementation,F=re.createNodeIterator,Z=re.createDocumentFragment,G=re.getElementsByTagName,I=o.importNode;let $=vg();n.isSupported=typeof My=="function"&&typeof N=="function"&&ee&&ee.createHTMLDocument!==void 0;const le=JN,H=eT,q=tT,ae=nT,Se=sT,_e=rT,Ae=oT,je=aT;let ge=hg,he=null;const Ve=Ke({},[...ug,...id,...ad,...ld,...dg]);let Ie=null;const mt=Ke({},[...fg,...cd,...pg,...ll]);let Ue=Object.seal(ko(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Vt=null,tn=null;const St=Object.seal(ko(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let jt=!0,Ft=!0,Ot=!1,Y=!0,ve=!1,Be=!0,rt=!1,gt=!1,vt=null,_t=null,an=!1,dt=!1,Mn=!1,Ln=!1,hs=!0,ms=!1;const ns="user-content-";let On=!0,gn=!1,ln={},Kt=null;const vn=Ke({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Ze=null;const Rt=Ke({},["audio","video","img","source","image","track"]);let ft=null;const Gt=Ke({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),yt="http://www.w3.org/1998/Math/MathML",xt="http://www.w3.org/2000/svg",lt="http://www.w3.org/1999/xhtml";let qt=lt,it=!1,$t=null;const R=Ke({},[yt,xt,lt],od),pe=rn(["mi","mo","mn","ms","mtext"]);let ie=Ke({},pe);const we=rn(["annotation-xml"]);let $e=Ke({},we);const qe=Ke({},["title","style","font","a","script"]);let Pe=null;const Ut=["application/xhtml+xml","text/html"],$n="text/html";let We=null,yn=null;const js=r.createElement("form"),Bs=function(C){return C instanceof RegExp||C instanceof Function},Pn=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(yn&&yn===C)return;(!C||typeof C!="object")&&(C={}),C=pn(C),Pe=Ut.indexOf(C.PARSER_MEDIA_TYPE)===-1?$n:C.PARSER_MEDIA_TYPE,We=Pe==="application/xhtml+xml"?od:Ti,he=ur(C,"ALLOWED_TAGS",Ve,{transform:We}),Ie=ur(C,"ALLOWED_ATTR",mt,{transform:We}),$t=ur(C,"ALLOWED_NAMESPACES",R,{transform:od}),ft=ur(C,"ADD_URI_SAFE_ATTR",Gt,{transform:We,base:Gt}),Ze=ur(C,"ADD_DATA_URI_TAGS",Rt,{transform:We,base:Rt}),Kt=ur(C,"FORBID_CONTENTS",vn,{transform:We}),Vt=ur(C,"FORBID_TAGS",pn({}),{transform:We}),tn=ur(C,"FORBID_ATTR",pn({}),{transform:We}),ln=Jt(C,"USE_PROFILES")?C.USE_PROFILES&&typeof C.USE_PROFILES=="object"?pn(C.USE_PROFILES):C.USE_PROFILES:!1,jt=C.ALLOW_ARIA_ATTR!==!1,Ft=C.ALLOW_DATA_ATTR!==!1,Ot=C.ALLOW_UNKNOWN_PROTOCOLS||!1,Y=C.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ve=C.SAFE_FOR_TEMPLATES||!1,Be=C.SAFE_FOR_XML!==!1,rt=C.WHOLE_DOCUMENT||!1,dt=C.RETURN_DOM||!1,Mn=C.RETURN_DOM_FRAGMENT||!1,Ln=C.RETURN_TRUSTED_TYPE||!1,an=C.FORCE_BODY||!1,hs=C.SANITIZE_DOM!==!1,ms=C.SANITIZE_NAMED_PROPS||!1,On=C.KEEP_CONTENT!==!1,gn=C.IN_PLACE||!1,ge=YN(C.ALLOWED_URI_REGEXP)?C.ALLOWED_URI_REGEXP:hg,qt=typeof C.NAMESPACE=="string"?C.NAMESPACE:lt,ie=Jt(C,"MATHML_TEXT_INTEGRATION_POINTS")&&C.MATHML_TEXT_INTEGRATION_POINTS&&typeof C.MATHML_TEXT_INTEGRATION_POINTS=="object"?pn(C.MATHML_TEXT_INTEGRATION_POINTS):Ke({},pe),$e=Jt(C,"HTML_INTEGRATION_POINTS")&&C.HTML_INTEGRATION_POINTS&&typeof C.HTML_INTEGRATION_POINTS=="object"?pn(C.HTML_INTEGRATION_POINTS):Ke({},we);const B=Jt(C,"CUSTOM_ELEMENT_HANDLING")&&C.CUSTOM_ELEMENT_HANDLING&&typeof C.CUSTOM_ELEMENT_HANDLING=="object"?pn(C.CUSTOM_ELEMENT_HANDLING):ko(null);if(Ue=ko(null),Jt(B,"tagNameCheck")&&Bs(B.tagNameCheck)&&(Ue.tagNameCheck=B.tagNameCheck),Jt(B,"attributeNameCheck")&&Bs(B.attributeNameCheck)&&(Ue.attributeNameCheck=B.attributeNameCheck),Jt(B,"allowCustomizedBuiltInElements")&&typeof B.allowCustomizedBuiltInElements=="boolean"&&(Ue.allowCustomizedBuiltInElements=B.allowCustomizedBuiltInElements),on(Ue),ve&&(Ft=!1),Mn&&(dt=!0),ln&&(he=Ke({},dg),Ie=ko(null),ln.html===!0&&(Ke(he,ug),Ke(Ie,fg)),ln.svg===!0&&(Ke(he,id),Ke(Ie,cd),Ke(Ie,ll)),ln.svgFilters===!0&&(Ke(he,ad),Ke(Ie,cd),Ke(Ie,ll)),ln.mathMl===!0&&(Ke(he,ld),Ke(Ie,pg),Ke(Ie,ll))),St.tagCheck=null,St.attributeCheck=null,Jt(C,"ADD_TAGS")&&(typeof C.ADD_TAGS=="function"?St.tagCheck=C.ADD_TAGS:fr(C.ADD_TAGS)&&(he===Ve&&(he=pn(he)),Ke(he,C.ADD_TAGS,We))),Jt(C,"ADD_ATTR")&&(typeof C.ADD_ATTR=="function"?St.attributeCheck=C.ADD_ATTR:fr(C.ADD_ATTR)&&(Ie===mt&&(Ie=pn(Ie)),Ke(Ie,C.ADD_ATTR,We))),Jt(C,"ADD_URI_SAFE_ATTR")&&fr(C.ADD_URI_SAFE_ATTR)&&Ke(ft,C.ADD_URI_SAFE_ATTR,We),Jt(C,"FORBID_CONTENTS")&&fr(C.FORBID_CONTENTS)&&(Kt===vn&&(Kt=pn(Kt)),Ke(Kt,C.FORBID_CONTENTS,We)),Jt(C,"ADD_FORBID_CONTENTS")&&fr(C.ADD_FORBID_CONTENTS)&&(Kt===vn&&(Kt=pn(Kt)),Ke(Kt,C.ADD_FORBID_CONTENTS,We)),On&&(he["#text"]=!0),rt&&Ke(he,["html","head","body"]),he.table&&(Ke(he,["tbody"]),delete Vt.tbody),C.TRUSTED_TYPES_POLICY){if(typeof C.TRUSTED_TYPES_POLICY.createHTML!="function")throw $r('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof C.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw $r('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const te=U;U=C.TRUSTED_TYPES_POLICY;try{P=Ne("")}catch(Te){throw U=te,Te}}else C.TRUSTED_TYPES_POLICY===null?(U=void 0,P=""):(U===void 0&&(U=J()),U&&typeof P=="string"&&(P=Ne("")));rn&&rn(C),yn=C},gs=Ke({},[...id,...ad,...QN]),Je=Ke({},[...ld,...ZN]),At=function(C,B,te){return B.namespaceURI===lt?C==="svg":B.namespaceURI===yt?C==="svg"&&(te==="annotation-xml"||ie[te]):!!gs[C]},vs=function(C,B,te){return B.namespaceURI===lt?C==="math":B.namespaceURI===xt?C==="math"&&$e[te]:!!Je[C]},lc=function(C,B,te){return B.namespaceURI===xt&&!$e[te]||B.namespaceURI===yt&&!ie[te]?!1:!Je[C]&&(qe[C]||!gs[C])},bt=function(C){let B=N(C);(!B||!B.tagName)&&(B={namespaceURI:qt,tagName:"template"});const te=Ti(C.tagName),Te=Ti(B.tagName);return $t[C.namespaceURI]?C.namespaceURI===xt?At(te,B,Te):C.namespaceURI===yt?vs(te,B,Te):C.namespaceURI===lt?lc(te,B,Te):!!(Pe==="application/xhtml+xml"&&$t[C.namespaceURI]):!1},ys=function(C){vo(n.removed,{element:C});try{N(C).removeChild(C)}catch{if(E(C),!N(C))throw $r("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Ws=function(C){xr(C);const B=T(C);if(B){const Te=[];go(B,Re=>{vo(Te,Re)}),go(Te,Re=>{try{E(Re)}catch{}})}const te=z(C);if(te)for(let Te=te.length-1;Te>=0;--Te){const Re=te[Te],Fe=Re&&Re.name;if(typeof Fe=="string")try{C.removeAttribute(Fe)}catch{}}},xs=function(C,B){try{vo(n.removed,{attribute:B.getAttributeNode(C),from:B})}catch{vo(n.removed,{attribute:null,from:B})}if(B.removeAttribute(C),C==="is")if(dt||Mn)try{ys(B)}catch{}else try{B.setAttribute(C,"")}catch{}},Wr=function(C){const B=z(C);if(B)for(let te=B.length-1;te>=0;--te){const Te=B[te],Re=Te&&Te.name;if(!(typeof Re!="string"||Ie[We(Re)]))try{C.removeAttribute(Re)}catch{}}},xr=function(C){const B=[C];for(;B.length>0;){const te=B.pop();(M?M(te):te.nodeType)===Hn.element&&Wr(te);const Re=T(te);if(Re)for(let Fe=Re.length-1;Fe>=0;--Fe)B.push(Re[Fe])}},Yi=function(C){if(!Be)return;const B=[C];for(;B.length>0;){const te=B.pop(),Te=M?M(te):te.nodeType;if(Te===Hn.processingInstruction||Te===Hn.comment&&Zt(gg,te.data)){try{E(te)}catch{}continue}if(Te===Hn.element){const Fe=te,Ye=We(O?O(te):te.nodeName);try{Fe.hasAttribute&&Fe.hasAttribute("patchsrc")&&Fe.removeAttribute("patchsrc"),Fe.hasAttribute&&Fe.hasAttribute("for")&&Ye!=="label"&&Ye!=="output"&&Fe.removeAttribute("for")}catch{}}const Re=T(te);if(Re)for(let Fe=Re.length-1;Fe>=0;--Fe)B.push(Re[Fe])}},wr=function(C){let B=null,te=null;if(an)C="<remove></remove>"+C;else{const Fe=ig(C,/^[\r\n\t ]+/);te=Fe&&Fe[0]}Pe==="application/xhtml+xml"&&qt===lt&&(C='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+C+"</body></html>");const Te=U?Ne(C):C;if(qt===lt)try{B=new v().parseFromString(Te,Pe)}catch{}if(!B||!B.documentElement){B=ee.createDocument(qt,"template",null);try{B.documentElement.innerHTML=it?P:Te}catch{}}const Re=B.body||B.documentElement;return C&&te&&Re.insertBefore(r.createTextNode(te),Re.childNodes[0]||null),qt===lt?G.call(B,rt?"html":"body")[0]:rt?B.documentElement:Re},zn=function(C){const B=X?X(C):C.ownerDocument;return F.call(B||C,C,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Hr=function(C){return C=wi(C,le," "),C=wi(C,H," "),C=wi(C,q," "),C},xn=function(C){var B;C.normalize();const te=X?X(C):C.ownerDocument,Te=F.call(te||C,C,h.SHOW_TEXT|h.SHOW_COMMENT|h.SHOW_CDATA_SECTION|h.SHOW_PROCESSING_INSTRUCTION,null);let Re=Te.nextNode();for(;Re;)Re.data=Hr(Re.data),Re=Te.nextNode();const Fe=(B=C.querySelectorAll)===null||B===void 0?void 0:B.call(C,"template");Fe&&go(Fe,Ye=>{Hs(Ye.content)&&xn(Ye.content)})},Vr=function(C){const B=O?O(C):null;return typeof B!="string"||We(B)!=="form"?!1:typeof C.nodeName!="string"||typeof C.textContent!="string"||typeof C.removeChild!="function"||C.attributes!==z(C)||typeof C.removeAttribute!="function"||typeof C.setAttribute!="function"||typeof C.namespaceURI!="string"||typeof C.insertBefore!="function"||typeof C.hasChildNodes!="function"||C.nodeType!==M(C)||C.childNodes!==T(C)},Hs=function(C){if(!M||typeof C!="object"||C===null)return!1;try{return M(C)===Hn.documentFragment}catch{return!1}},kr=function(C){if(!M||typeof C!="object"||C===null)return!1;try{return typeof M(C)=="number"}catch{return!1}};function wn(de,C,B){de.length!==0&&go(de,te=>{te.call(n,C,B,yn)})}const Kr=function(C,B){return!!(Be&&C.hasChildNodes()&&!kr(C.firstElementChild)&&Zt(mg,C.textContent)&&Zt(mg,C.innerHTML)||Be&&C.namespaceURI===lt&&B==="style"&&kr(C.firstElementChild)||C.nodeType===Hn.processingInstruction||Be&&C.nodeType===Hn.comment&&Zt(gg,C.data))},Sr=function(C,B,te){if(!Vt[B]&&Po(B)&&(Ue.tagNameCheck instanceof RegExp&&Zt(Ue.tagNameCheck,B)||Ue.tagNameCheck instanceof Function&&Ue.tagNameCheck(B)))return!1;if(On&&!Kt[B]){const Te=N(C),Re=T(C);if(Re&&Te){const Fe=Re.length;for(let Ye=Fe-1;Ye>=0;--Ye){const et=C===te?S(Re[Ye],!0):Re[Ye];Te.insertBefore(et,b(C))}}}return ys(C),!0},br=function(C,B,te,Te){return C.length===0?B:B===te||B===Te?pn(B):B},Qi=function(C,B){if(wn($.beforeSanitizeElements,C,null),C!==B&&N(C)===null)return gn&&xr(C),!0;if(Vr(C))return ys(C),!0;const te=We(O?O(C):C.nodeName);if(he=br($.uponSanitizeElement,he,Ve,vt),wn($.uponSanitizeElement,C,{tagName:te,allowedTags:he}),C!==B&&N(C)===null)return gn&&xr(C),!0;if(Kr(C,te))return ys(C),!0;if(Vt[te]||!(St.tagCheck instanceof Function&&St.tagCheck(te))&&!he[te]){const Re=Sr(C,te,B);return Re===!1&&wn($.afterSanitizeElements,C,null),Re}if((M?M(C):C.nodeType)===Hn.element&&!bt(C)||(te==="noscript"||te==="noembed"||te==="noframes")&&Zt(lT,C.innerHTML))return ys(C),!0;if(ve&&C.nodeType===Hn.text){const Re=Hr(C.textContent);C.textContent!==Re&&(vo(n.removed,{element:C.cloneNode()}),C.textContent=Re)}return wn($.afterSanitizeElements,C,null),!1},Zi=function(C,B,te){if(tn[B]||Be&&B==="patchsrc"||Be&&B==="for"&&C!=="label"&&C!=="output"||hs&&(B==="id"||B==="name")&&(te in r||te in js))return!1;const Te=Ie[B]||St.attributeCheck instanceof Function&&St.attributeCheck(B,C);if(!(Ft&&Zt(ae,B))){if(!(jt&&Zt(Se,B))){if(Te){if(!ft[B]){if(!Zt(ge,wi(te,Ae,""))){if(!((B==="src"||B==="xlink:href"||B==="href")&&C!=="script"&&ag(te,"data:")===0&&Ze[C])){if(!(Ot&&!Zt(_e,wi(te,Ae,"")))){if(te)return!1}}}}}else if(!(Po(C)&&(Ue.tagNameCheck instanceof RegExp&&Zt(Ue.tagNameCheck,C)||Ue.tagNameCheck instanceof Function&&Ue.tagNameCheck(C))&&(Ue.attributeNameCheck instanceof RegExp&&Zt(Ue.attributeNameCheck,B)||Ue.attributeNameCheck instanceof Function&&Ue.attributeNameCheck(B,C))||B==="is"&&Ue.allowCustomizedBuiltInElements&&(Ue.tagNameCheck instanceof RegExp&&Zt(Ue.tagNameCheck,te)||Ue.tagNameCheck instanceof Function&&Ue.tagNameCheck(te))))return!1}}return!0},$o=Ke({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Po=function(C){return!$o[Ti(C)]&&Zt(je,C)},zo=function(C,B,te,Te){if(U&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!te)switch(k.getAttributeType(C,B)){case"TrustedHTML":return Ne(Te);case"TrustedScriptURL":return Me(Te)}return Te},Nr=function(C,B,te,Te){try{te?C.setAttributeNS(te,B,Te):C.setAttribute(B,Te),Vr(C)?ys(C):og(n.removed)}catch{xs(B,C)}},Ji=function(C){wn($.beforeSanitizeAttributes,C,null);const B=C.attributes;if(!B||Vr(C))return;Ie=br($.uponSanitizeAttribute,Ie,mt,_t);const te={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ie,forceKeepAttr:void 0};let Te=B.length;const Re=We(C.nodeName);for(;Te--;){const Fe=B[Te],Ye=Fe.name,et=Fe.namespaceURI,Nt=Fe.value,Tt=We(Ye),_s=Nt;let Dt=Ye==="value"?_s:HN(_s);if(te.attrName=Tt,te.attrValue=Dt,te.keepAttr=!0,te.forceKeepAttr=void 0,wn($.uponSanitizeAttribute,C,te),Dt=te.attrValue,ms&&(Tt==="id"||Tt==="name")&&ag(Dt,ns)!==0&&(xs(Ye,C),Dt=ns+Dt),Be&&Zt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Dt)){xs(Ye,C);continue}if(Tt==="attributename"&&ig(Dt,"href")){xs(Ye,C);continue}if(!te.forceKeepAttr){if(!te.keepAttr){xs(Ye,C);continue}if(!Y&&Zt(cT,Dt)){xs(Ye,C);continue}if(ve&&(Dt=Hr(Dt)),!Zi(Re,Tt,Dt)){xs(Ye,C);continue}Dt=zo(Re,Tt,et,Dt),Dt!==_s&&Nr(C,Ye,et,Dt)}}wn($.afterSanitizeAttributes,C,null)},Vs=function(C){let B=null;const te=zn(C);for(wn($.beforeSanitizeShadowDOM,C,null);B=te.nextNode();)if(wn($.uponSanitizeShadowNode,B,null),Qi(B,C),Ji(B),Hs(B.content)&&Vs(B.content),(M?M(B):B.nodeType)===Hn.element){const Re=_(B);Hs(Re)&&(Xe(Re),Vs(Re))}wn($.afterSanitizeShadowDOM,C,null)},Xe=function(C){const B=[{node:C,shadow:null}];for(;B.length>0;){const te=B.pop();if(te.shadow){Vs(te.shadow);continue}const Te=te.node,Fe=(M?M(Te):Te.nodeType)===Hn.element,Ye=T(Te);if(Ye)for(let et=Ye.length-1;et>=0;--et)B.push({node:Ye[et],shadow:null});if(Fe){const et=O?O(Te):null;if(typeof et=="string"&&We(et)==="template"){const Nt=Te.content;Hs(Nt)&&B.push({node:Nt,shadow:null})}}if(Fe){const et=_(Te);Hs(et)&&B.push({node:null,shadow:et},{node:et,shadow:null})}}};return n.sanitize=function(de){let C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},B=null,te=null,Te=null,Re=null;if(it=!de,it&&(de="<!-->"),typeof de!="string"&&!kr(de)&&(de=XN(de),typeof de!="string"))throw $r("dirty is not a string, aborting");if(!n.isSupported)return de;gt?(he=vt,Ie=_t):Pn(C),($.uponSanitizeElement.length>0||$.uponSanitizeAttribute.length>0)&&(he=pn(he)),$.uponSanitizeAttribute.length>0&&(Ie=pn(Ie)),n.removed=[];const Fe=gn&&typeof de!="string"&&kr(de);if(Fe){Yi(de);const Nt=O?O(de):de.nodeName;if(typeof Nt=="string"){const Tt=We(Nt);if(!he[Tt]||Vt[Tt])throw Ws(de),$r("root node is forbidden and cannot be sanitized in-place")}if(Vr(de))throw Ws(de),$r("root node is clobbered and cannot be sanitized in-place");try{Xe(de)}catch(Tt){throw Ws(de),Tt}}else if(kr(de))B=wr("<!---->"),te=B.ownerDocument.importNode(de,!0),te.nodeType===Hn.element&&te.nodeName==="BODY"||te.nodeName==="HTML"?B=te:B.appendChild(te),Xe(te);else{if(!dt&&!ve&&!rt&&de.indexOf("<")===-1)return U&&Ln?Ne(de):de;if(B=wr(de),!B)return dt?null:Ln?P:""}B&&an&&ys(B.firstChild);const Ye=Fe?de:B;try{const Nt=zn(Ye);for(;Te=Nt.nextNode();)Qi(Te,Ye),Ji(Te),Hs(Te.content)&&Vs(Te.content)}catch(Nt){throw Fe&&(Ws(de),go(n.removed,Tt=>{Tt.element&&xr(Tt.element)})),Nt}if(Fe)return go(n.removed,Nt=>{Nt.element&&xr(Nt.element)}),ve&&xn(de),de;if(dt){if(ve&&xn(B),Mn)for(Re=Z.call(B.ownerDocument);B.firstChild;)Re.appendChild(B.firstChild);else Re=B;return(Ie.shadowroot||Ie.shadowrootmode)&&(Re=I.call(o,Re,!0)),Re}let et=rt?B.outerHTML:B.innerHTML;return rt&&he["!doctype"]&&B.ownerDocument&&B.ownerDocument.doctype&&B.ownerDocument.doctype.name&&Zt(iT,B.ownerDocument.doctype.name)&&(et="<!DOCTYPE "+B.ownerDocument.doctype.name+`>
|
|
508
|
+
`+et),ve&&(et=Hr(et)),U&&Ln?Ne(et):et},n.setConfig=function(){let de=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Pn(de),gt=!0,vt=he,_t=Ie},n.clearConfig=function(){yn=null,gt=!1,vt=null,_t=null,U=Q,P=""},n.isValidAttribute=function(de,C,B){yn||Pn({});const te=We(de),Te=We(C);return Zi(te,Te,B)},n.addHook=function(de,C){typeof C=="function"&&Jt($,de)&&vo($[de],C)},n.removeHook=function(de,C){if(Jt($,de)){if(C!==void 0){const B=BN($[de],C);return B===-1?void 0:WN($[de],B,1)[0]}return og($[de])}},n.removeHooks=function(de){Jt($,de)&&($[de]=[])},n.removeAllHooks=function(){$=vg()},n}var kf=Oy();const fT=new Set(["command_execution","file_change","mcp_tool_call","web_search"]),pT=100;function yg(e){return fT.has(e.type)}function hT({items:e,runtimeType:n,turn:r,threads:o=[]}){const[a,c]=y.useState(!1),[d,f]=y.useState(!1);if(e.length===0)return null;const h=e.length,g=d?0:Math.max(0,h-pT),v=g>0?e.slice(g):e;return l.jsxs("div",{className:"tool-calls",children:[l.jsxs("div",{className:"tool-calls-header",onClick:()=>c(k=>!k),children:[l.jsx("span",{className:"tool-calls-icon",children:l.jsx(G1,{size:12})}),l.jsxs("span",{className:"tool-calls-summary",children:[h," tool call",h>1?"s":""]}),l.jsx(Li,{size:14,className:"tool-calls-chevron",style:{transform:a?"rotate(90deg)":"none"}})]}),a&&l.jsxs("div",{className:"tool-calls-body",children:[g>0&&l.jsx("div",{className:"render-load-earlier",children:l.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>f(!0),children:["Show ",g," earlier tool call",g>1?"s":""]})}),v.map(k=>l.jsx(Pr,{item:k,runtimeType:n,turn:r,threads:o},k.id))]})]})}Ge.setOptions({breaks:!0,gfm:!0});function mT(e){const n=Ge.parse(e);return kf.sanitize(n)}function xg(e,n){var a;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o=0;for(;r.nextNode();){const c=r.currentNode,d=((a=c.textContent)==null?void 0:a.length)??0;if(o+d>n)return{node:c,offset:n-o};o+=d}return null}function gT(e,n,r){const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),a=[];for(;o.nextNode();){const c=o.currentNode;if(!c.textContent||c.textContent.trim()==="")continue;const d=document.createRange();d.selectNodeContents(c),!(d.compareBoundaryPoints(Range.START_TO_END,n)<=0)&&(d.compareBoundaryPoints(Range.END_TO_START,n)>=0||a.push(c))}for(const c of a){const d=c.length;let f=0,h=d;if(c===n.startContainer&&(f=Math.min(n.startOffset,d)),c===n.endContainer&&(h=Math.min(n.endOffset,d)),f>=h)continue;h<d&&c.splitText(h);const g=f>0?c.splitText(f):c,v=r(),k=g.parentNode;k&&(k.insertBefore(v,g),v.appendChild(g))}}function vT(e,n){e.querySelectorAll("mark[data-thread-id]").forEach(r=>{const o=r.parentNode;if(!o)return;const a=document.createTextNode(r.textContent||"");o.replaceChild(a,r),o.normalize()});for(const r of n){if(r.start_offset===null||r.end_offset===null)continue;const o=xg(e,r.start_offset),a=xg(e,r.end_offset);if(!o||!a)continue;const c=document.createRange();c.setStart(o.node,o.offset),c.setEnd(a.node,a.offset),gT(e,c,()=>{const d=document.createElement("mark");return d.setAttribute("data-thread-id",r.id),r.status==="resolved"&&d.classList.add("thread-mark-resolved"),d})}}function yT(e){const n=window.getSelection();if(!n||n.rangeCount===0)return null;const r=n.getRangeAt(0);if(r.collapsed||!e.contains(r.commonAncestorContainer))return null;const o=document.createRange();o.setStart(e,0),o.setEnd(r.startContainer,r.startOffset);const a=o.toString().length,c=r.toString();return{start:a,end:a+c.length,text:c}}function xT({itemId:e,turnId:n,sessionId:r,content:o,threads:a}){const c=y.useRef(null),d=y.useRef(null),f=y.useRef(null),h=y.useRef(""),g=y.useRef(0),[v,k]=y.useState(!1),[x,S]=y.useState({x:0,y:0}),[E,b]=y.useState(!1),[T,N]=y.useState({x:0,y:0}),[_,z]=y.useState(""),[M,O]=y.useState(null),[X,U]=y.useState(!1),P=A(G=>G.createThread),Q=A(G=>G.switchRightTab),ce=A(G=>Vl(G.sessionDetails[r])),ue=y.useCallback(async()=>{await Fi(o||""),U(!0),setTimeout(()=>U(!1),1500)},[o]),me=y.useCallback(()=>{var I;if(!M)return;const G=`
|
|
509
|
+
\`\`\`QUOTE
|
|
510
|
+
${M.text}
|
|
511
|
+
\`\`\`
|
|
512
|
+
|
|
513
|
+
`;A.setState({quotedText:G}),k(!1),O(null),(I=window.getSelection())==null||I.removeAllRanges()},[M]),Ne=y.useMemo(()=>mT(o||"…"),[o]),Me=y.useMemo(()=>a.filter(G=>G.item_id===e),[a,e]);y.useEffect(()=>{c.current&&vT(c.current,Me)},[Ne,Me]),y.useEffect(()=>{h.current=_},[_]),y.useEffect(()=>{function G(I){d.current&&!d.current.contains(I.target)&&(k(!1),h.current.trim()||b(!1))}return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[]);const J=y.useCallback(()=>{k(!1),h.current.trim()||b(!1)},[]),re=y.useCallback(()=>{const G=c.current;if(!G)return;const I=yT(G);if(I&&I.text.trim().length>0){const $=window.getSelection();if($&&$.rangeCount>0&&$.anchorNode&&$.focusNode){const H=$.getRangeAt(0).getBoundingClientRect(),q=28,ae=6,Se=170;let _e=!1;try{const ge=document.createRange();ge.setStart($.focusNode,$.focusOffset),ge.setEnd($.focusNode,$.focusOffset);const he=document.createRange();he.setStart($.anchorNode,$.anchorOffset),he.setEnd($.anchorNode,$.anchorOffset),_e=he.compareBoundaryPoints(Range.START_TO_START,ge)>0}catch{_e=!1}let Ae=H.top-q-ae;Ae<8&&(Ae=H.bottom+ae);let je=_e?H.left-Se:H.right;je=Math.max(8,Math.min(je,window.innerWidth-Se-8)),S({x:je,y:Ae}),k(!0),O(I)}}else k(!1)},[]);y.useEffect(()=>{function G(I){const $=I.target;$&&($.closest(".selection-actions")||$.closest(".thread-create-popover"))||re()}return document.addEventListener("mouseup",G),()=>document.removeEventListener("mouseup",G)},[re]);const ee=y.useCallback(()=>{k(!1),b(!0),N({x:x.x,y:x.y})},[x]);y.useLayoutEffect(()=>{if(!E)return;const G=f.current;if(!G)return;const I=G.offsetWidth,$=G.offsetHeight,le=8;let H=x.x,q=x.y;H-I<le&&(H=I+le),H>window.innerWidth-le&&(H=window.innerWidth-le),q<le&&(q=le),q+$>window.innerHeight-le&&(q=window.innerHeight-$-le),N({x:H,y:q})},[E,x]);const F=y.useCallback(async()=>{var G;ce||!M||!_.trim()||(await P(r,{itemId:e,turnId:n,startOffset:M.start,endOffset:M.end,selectedText:M.text,message:_.trim()}),z(""),b(!1),O(null),(G=window.getSelection())==null||G.removeAllRanges(),Q("threads"))},[M,_,P,r,e,n,Q,ce]),Z=y.useCallback(G=>{const I=G.target;if(I.tagName==="MARK"&&I.hasAttribute("data-thread-id")){G.preventDefault(),Q("threads");const $=I.getAttribute("data-thread-id");setTimeout(()=>{const le=document.getElementById(`thread-${$}`);le&&(le.scrollIntoView({behavior:"smooth",block:"center"}),le.classList.add("thread-card-highlighted"),setTimeout(()=>le.classList.remove("thread-card-highlighted"),1500))},100)}},[Q]);return l.jsxs("div",{className:"copy-text-wrapper",style:{position:"relative"},ref:d,children:[l.jsx("div",{ref:c,dangerouslySetInnerHTML:{__html:Ne},onMouseDown:J,onClick:Z}),l.jsx("button",{className:`copy-text-btn${X?" copied":""}`,onClick:ue,title:X?"Copied":"Copy message","aria-label":"Copy message text",children:X?l.jsx(Cs,{size:14}):l.jsx(Oi,{size:14})}),v&&!E&&l.jsxs("div",{className:"selection-actions",style:{left:x.x,top:x.y},children:[!ce&&l.jsxs("button",{className:"discuss-button",onClick:ee,title:"Start a discussion about this text",children:[l.jsx(A1,{size:14}),l.jsx("span",{children:"Discuss"})]}),l.jsxs("button",{className:"discuss-button",onClick:me,title:"Quote this text in your message",children:[l.jsx(Bv,{size:14}),l.jsx("span",{children:"Quote"})]})]}),E&&l.jsxs("div",{ref:f,className:"thread-create-popover",style:{left:T.x,top:T.y},children:[l.jsxs("div",{className:"thread-create-header",children:[l.jsxs("span",{className:"thread-create-quote",children:['"',M==null?void 0:M.text.slice(0,80),M&&M.text.length>80?"…":"",'"']}),l.jsx("button",{className:"thread-create-close",onClick:()=>{b(!1),O(null)},children:l.jsx(Tn,{size:14})})]}),l.jsx("textarea",{className:"thread-create-input",placeholder:"Ask about this text…",value:_,onChange:G=>z(G.target.value),autoFocus:!0,rows:2,onKeyDown:G=>{if(G.key==="Enter"&&(G.metaKey||G.ctrlKey)&&(G.preventDefault(),F()),G.key==="Escape")if(h.current.trim()){const I=Date.now();g.current&&I-g.current<400?(g.current=0,b(!1),O(null)):g.current=I}else b(!1),O(null)}}),l.jsxs("div",{className:"thread-create-footer",children:[l.jsx("span",{className:"thread-create-hint",children:"⌘↵ to send · Esc to cancel"}),l.jsxs("button",{className:"thread-create-send",onClick:F,disabled:!_.trim()||ce,title:ce?"Wait for the running turn to finish first":void 0,children:[l.jsx(Hi,{size:13}),l.jsx("span",{children:"Send"})]})]})]})]})}const wg=y.memo(xT),Ul=new Map,$y=new Set,Id=new Set,kg=new Map;function Py(){Id.forEach(e=>e())}function zy(e,n){return`${e}:${n}`}function wT(e,n,r,o,a){var h;const c=zy(n,r),d=Ul.get(e)??new Map,f=new Map(d);((h=f.get(c))==null?void 0:h.answer)===a?f.delete(c):f.set(c,{itemIndex:n,groupIndex:r,question:o,answer:a}),Ul.set(e,f),Py()}function kT(e){Ul.delete(e),Py()}function ST(e){$y.add(e),kT(e)}function bT(e){const n=y.useCallback(r=>(Id.add(r),()=>{Id.delete(r)}),[]);return y.useSyncExternalStore(n,()=>Ul.get(e)??kg,()=>kg)}function NT(e){return[...e].sort((n,r)=>n.itemIndex-r.itemIndex||n.groupIndex-r.groupIndex).map(n=>`> ${n.question}
|
|
514
|
+
${n.answer}`).join(`
|
|
515
|
+
|
|
516
|
+
`)}function Sg({item:e,turn:n}){var S;const r=e.data??{},o=y.useMemo(()=>Array.isArray(r.groups)?r.groups.filter(E=>!!E&&Array.isArray(E.selections)&&E.selections.length>0):[],[r.groups]),a=bT(n.id),c=A(E=>n.session_id?E.sessionDetails[n.session_id]:null),d=A(E=>E.activeSessionId),f=n.items.filter(E=>E.type==="ask_user"||E.type==="final_result").findIndex(E=>E.id===e.id),h=c?((S=c.turns[c.turns.length-1])==null?void 0:S.id)===n.id:!0,g=$y.has(n.id),v=g||hv(c)||!h||n.session_id!==d,k=(E,b,T)=>{v||wT(n.id,f,E,b,T)},x=()=>{const E=[...a.values()];if(E.length===0)return;const b=NT(E);ST(n.id),A.getState().submitPrompt(b)};return l.jsxs("div",{className:"render-content ask-user-card",children:[l.jsxs("div",{className:"turn-header",children:[l.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:l.jsx(g1,{size:14})}),l.jsx("span",{className:"turn-header-title",children:"Question"}),g&&l.jsx("span",{className:"turn-header-meta",children:"answered"})]}),o.length>0?l.jsxs("div",{className:"ask-user-groups",children:[o.map((E,b)=>l.jsxs("div",{className:"ask-user-group",children:[E.question&&l.jsx("div",{className:"ask-user-question",children:E.question}),l.jsx("div",{className:"ask-user-options",children:E.selections.map(T=>{var _;const N=((_=a.get(zy(f,b)))==null?void 0:_.answer)===T;return l.jsx("button",{type:"button",className:`ask-user-option ${N?"selected":""}`,disabled:v,onClick:()=>k(b,E.question,T),children:T},T)})})]},b)),v?g&&l.jsx("div",{className:"ask-user-submitted",children:"Answer sent"}):l.jsxs("button",{type:"button",className:"ask-user-send",disabled:a.size===0,onClick:x,children:[l.jsx(Hi,{size:12}),"Send"]})]}):r.question?l.jsx("p",{className:"user-message",children:r.question}):l.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:"Waiting for user response"})]})}const TT={host_shutdown:"host shutdown",host_restart:"host restart",process_exit:"agent process stopped",network:"network error",auth:"signed out",usage_limit:"usage limit"};function vl(e){return e&&TT[e]||"interrupted"}function Bl(e){if(!e)return"";const n=new Date(e);return Number.isNaN(n.getTime())?"":n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function CT(e){switch(e.interrupt_reason){case"network":return"Interrupted — network error. Will resume when the connection is back.";case"auth":return"Interrupted — Claude is signed out. Sign in again from a terminal, then resume.";case"usage_limit":{const n=Bl(e.resume_at);return n?`Usage limit reached — resumes at ${n}.`:"Usage limit reached — resume once it is over."}case"process_exit":return"Interrupted — the agent process stopped. Resuming automatically…";case"host_shutdown":return"Interrupted — the agent host shut down. Resuming automatically…";default:return"Interrupted — the agent host restarted. Resuming automatically…"}}function ET(e){return e.items.filter(n=>n.type==="interruption").map(n=>n.data)}function jT({item:e}){const n=e.data,r=Bl(n.interrupted_at);let o="";switch(n.outcome){case"waiting":o="waiting to resume";break;case"resuming":o="resuming…";break;case"resumed":o=n.resumed_at?`resumed ${Bl(n.resumed_at)}`:"resumed";break;case"cancelled":o="stopped";break;case"unsupported":o="cannot be resumed";break;default:o="not resumed"}return l.jsx("div",{className:"interruption-marker",title:n.detail??void 0,children:l.jsxs("span",{children:["Interrupted",r?` ${r}`:""," (",vl(n.reason),") · ",o]})})}function _T({turn:e,label:n}){const[r,o]=y.useState(!1),a=A(d=>d.addToast),c=()=>{o(!0),m0(e.session_id,e.id).catch(d=>a("error",`Could not resume the turn — ${d.message}`)).finally(()=>o(!1))};return l.jsxs("button",{type:"button",className:"banner-action",onClick:c,disabled:r,children:[l.jsx(Wv,{size:12}),n]})}function RT({turn:e}){const n=e.resume_state;if(!n||n==="cancelled"||n==="resumed")return null;const r=e.interrupt_reason,o=ET(e),a=o[o.length-1],c=Bl(e.interrupted_at??(a==null?void 0:a.interrupted_at));let d,f=null,h=null;switch(n){case"waiting":{const g=r==="usage_limit"&&!e.resume_at;d=CT(e),f=g?(a==null?void 0:a.detail)??null:null,h=r==="auth"||g?"Resume":"Resume now";break}case"resuming":d=`Interrupted (${vl(r)}) — resuming from where it left off…`;break;case"gave_up":{const g=Math.max(o.length,1);d=`Interrupted ${g===1?"once":`${g} times`} — automatic resume stopped.`,f=e.error&&!e.error.startsWith("Automatic resume stopped")?e.error:null,h="Resume";break}case"skipped":d=`Interrupted${c?` ${c}`:""} (${vl(r)}) — too long ago to resume automatically.`,h="Resume";break;default:d=`Interrupted (${vl(r)}) — this turn cannot be resumed.`,f=e.error}return l.jsxs("div",{className:"interruption-banner","data-state":n,children:[l.jsx("span",{className:"banner-icon",children:r==="network"?l.jsx(Kv,{size:12}):l.jsx(Yl,{size:12})}),l.jsxs("span",{className:"banner-text",children:[d,f&&l.jsx("span",{className:"banner-detail",children:f})]}),h&&l.jsx(_T,{turn:e,label:h})]})}function AT({turnId:e}){const n=A(o=>o.retryStates[e]);if(!n)return null;const r=n.errorStatus?`API error ${n.errorStatus}`:"Connection problem";return l.jsxs("div",{className:"retry-banner",children:[l.jsx("span",{className:"banner-icon",children:l.jsx(Kv,{size:12})}),l.jsxs("span",{className:"banner-text",children:[r," — retrying (attempt ",n.attempt," of ",n.maxRetries,")…"]})]})}const IT='(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});',DT=["https://cdnjs.cloudflare.com","https://cdn.jsdelivr.net","https://unpkg.com","https://esm.sh"],Fy="agentpane-widget",Uy="agentpane-pane",By="allow-scripts allow-popups allow-popups-to-escape-sandbox",Si=DT.join(" "),Wy=["default-src 'none'",`script-src 'unsafe-inline' 'unsafe-eval' ${Si}`,`style-src 'unsafe-inline' ${Si}`,`img-src data: blob: ${Si}`,`font-src data: ${Si}`,`connect-src ${Si}`,"media-src data: blob:","frame-src 'none'","form-action 'none'","base-uri 'none'"].join("; ");function Hy(){const e=typeof document<"u"?getComputedStyle(document.documentElement):null,n=(r,o)=>(e==null?void 0:e.getPropertyValue(r).trim())||o;return{"--color-text-primary":n("--text","#1c1b18"),"--color-text-secondary":n("--text-2","#54504a"),"--color-text-muted":n("--text-3","#78736c"),"--color-background-primary":n("--canvas","#fdfdfc"),"--color-background-secondary":n("--surface-0","#f8f7f5"),"--color-border":n("--border","#e2e0db"),"--color-accent":n("--accent","#d97706"),"--font-sans":n("--font-sans","'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"),"--font-mono":n("--font-mono","'JetBrains Mono', 'SF Mono', 'Fira Code', monospace"),"--radius":n("--r-lg","8px"),"--color-series-1":"#2a78d6","--color-series-2":"#eb6834","--color-series-3":"#1baf7a","--color-series-4":"#eda100","--color-series-5":"#e87ba4","--color-series-6":"#008300","--color-series-7":"#6250d6","--color-series-8":"#e34948","--color-good":"#0ca30c","--color-warning":"#fab219","--color-serious":"#ec835a","--color-critical":"#d03b3b"}}const Vy=`window.addEventListener('click', function (e) {
|
|
517
|
+
if (e.defaultPrevented || e.button !== 0) return;
|
|
518
|
+
var a = e.target && e.target.closest ? e.target.closest('a[href]') : null;
|
|
519
|
+
if (!a) return;
|
|
520
|
+
var href = (a.getAttribute('href') || '').trim();
|
|
521
|
+
if (href.charAt(0) === '#' || /^javascript:/i.test(href)) return;
|
|
522
|
+
e.preventDefault();
|
|
523
|
+
if (!/^https?:\\/\\//i.test(href)) return;
|
|
524
|
+
try {
|
|
525
|
+
window.open(new URL(href).href, '_blank', 'noopener,noreferrer');
|
|
526
|
+
} catch (err) {}
|
|
527
|
+
});`,MT=`(function () {
|
|
528
|
+
var SELF = '${Fy}';
|
|
529
|
+
var PANE = '${Uy}';
|
|
530
|
+
var SCRIPT_TIMEOUT_MS = 15000;
|
|
531
|
+
var root = document.getElementById('root');
|
|
532
|
+
var finished = false;
|
|
533
|
+
var lastHtml = null;
|
|
534
|
+
|
|
535
|
+
function post(msg) {
|
|
536
|
+
msg.source = SELF;
|
|
537
|
+
parent.postMessage(msg, '*');
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
function parse(html, keepScripts) {
|
|
541
|
+
var tmp = document.createElement('div');
|
|
542
|
+
tmp.innerHTML = html;
|
|
543
|
+
if (!keepScripts) {
|
|
544
|
+
var scripts = tmp.querySelectorAll('script');
|
|
545
|
+
for (var i = 0; i < scripts.length; i++) scripts[i].remove();
|
|
546
|
+
}
|
|
547
|
+
return tmp;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function morph(html, isFinal) {
|
|
551
|
+
var added = new Set();
|
|
552
|
+
morphdom(root, parse(html, isFinal), {
|
|
553
|
+
childrenOnly: true,
|
|
554
|
+
onBeforeElUpdated: function (from, to) { return !from.isEqualNode(to); },
|
|
555
|
+
onNodeAdded: function (node) {
|
|
556
|
+
added.add(node);
|
|
557
|
+
if (!isFinal && node.nodeType === 1 && node.animate && !added.has(node.parentNode)) {
|
|
558
|
+
node.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 220, easing: 'ease-out' });
|
|
559
|
+
}
|
|
560
|
+
return node;
|
|
561
|
+
},
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
// Scripts parsed by innerHTML never run; replace each with a fresh copy.
|
|
566
|
+
function runScripts(done) {
|
|
567
|
+
var scripts = Array.prototype.slice.call(root.querySelectorAll('script'));
|
|
568
|
+
var i = 0;
|
|
569
|
+
function next() {
|
|
570
|
+
if (i >= scripts.length) return done();
|
|
571
|
+
var old = scripts[i++];
|
|
572
|
+
var s = document.createElement('script');
|
|
573
|
+
for (var a = 0; a < old.attributes.length; a++) s.setAttribute(old.attributes[a].name, old.attributes[a].value);
|
|
574
|
+
s.text = old.textContent || '';
|
|
575
|
+
if (!old.src) {
|
|
576
|
+
old.replaceWith(s);
|
|
577
|
+
return next();
|
|
578
|
+
}
|
|
579
|
+
s.async = false;
|
|
580
|
+
var settled = false;
|
|
581
|
+
var timer = setTimeout(go, SCRIPT_TIMEOUT_MS);
|
|
582
|
+
function go() {
|
|
583
|
+
if (settled) return;
|
|
584
|
+
settled = true;
|
|
585
|
+
clearTimeout(timer);
|
|
586
|
+
next();
|
|
587
|
+
}
|
|
588
|
+
s.onload = go;
|
|
589
|
+
s.onerror = function () {
|
|
590
|
+
post({ type: 'error', message: 'Could not load ' + old.src });
|
|
591
|
+
go();
|
|
592
|
+
};
|
|
593
|
+
old.replaceWith(s);
|
|
594
|
+
}
|
|
595
|
+
next();
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
function finish() {
|
|
599
|
+
document.dispatchEvent(new Event('DOMContentLoaded', { bubbles: true }));
|
|
600
|
+
window.dispatchEvent(new Event('load'));
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
window.addEventListener('message', function (e) {
|
|
604
|
+
if (e.source !== parent) return;
|
|
605
|
+
var msg = e.data;
|
|
606
|
+
if (!msg || msg.source !== PANE || msg.type !== 'content' || finished) return;
|
|
607
|
+
var html = typeof msg.html === 'string' ? msg.html : '';
|
|
608
|
+
var isFinal = msg.final === true;
|
|
609
|
+
if (!isFinal && html === lastHtml) return;
|
|
610
|
+
lastHtml = html;
|
|
611
|
+
morph(html, isFinal);
|
|
612
|
+
if (isFinal) {
|
|
613
|
+
finished = true;
|
|
614
|
+
runScripts(finish);
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
|
|
618
|
+
window.addEventListener('error', function (e) {
|
|
619
|
+
var message = String(e.message || 'Script error');
|
|
620
|
+
// Benign: a layout change inside a ResizeObserver callback.
|
|
621
|
+
if (/ResizeObserver loop/.test(message)) return;
|
|
622
|
+
post({ type: 'error', message: message });
|
|
623
|
+
});
|
|
624
|
+
|
|
625
|
+
${Vy}
|
|
626
|
+
|
|
627
|
+
// The frame is as tall as the document's content: the bottom of the
|
|
628
|
+
// lowest in-flow child of <body> (#root, or what a script appended), plus
|
|
629
|
+
// the body's own padding, border and margin below it. Not the viewport or
|
|
630
|
+
// a box styled height: 100% — those follow the frame itself.
|
|
631
|
+
function px(style, prop) {
|
|
632
|
+
return parseFloat(style.getPropertyValue(prop)) || 0;
|
|
633
|
+
}
|
|
634
|
+
function contentHeight() {
|
|
635
|
+
var bottom = 0;
|
|
636
|
+
var children = document.body.children;
|
|
637
|
+
for (var i = 0; i < children.length; i++) {
|
|
638
|
+
var child = children[i];
|
|
639
|
+
if (child.tagName === 'SCRIPT') continue;
|
|
640
|
+
var style = getComputedStyle(child);
|
|
641
|
+
if (style.position === 'absolute' || style.position === 'fixed' || style.display === 'none') continue;
|
|
642
|
+
bottom = Math.max(bottom, child.getBoundingClientRect().bottom + px(style, 'margin-bottom'));
|
|
643
|
+
}
|
|
644
|
+
var body = getComputedStyle(document.body);
|
|
645
|
+
return bottom + window.scrollY + px(body, 'padding-bottom') + px(body, 'border-bottom-width') + px(body, 'margin-bottom');
|
|
646
|
+
}
|
|
647
|
+
var lastHeight = -1;
|
|
648
|
+
function reportHeight() {
|
|
649
|
+
var h = Math.ceil(contentHeight());
|
|
650
|
+
if (h === lastHeight) return;
|
|
651
|
+
lastHeight = h;
|
|
652
|
+
post({ type: 'height', height: h });
|
|
653
|
+
}
|
|
654
|
+
var sizes = new ResizeObserver(reportHeight);
|
|
655
|
+
sizes.observe(root);
|
|
656
|
+
sizes.observe(document.body);
|
|
657
|
+
// Elements a script adds next to #root count too.
|
|
658
|
+
new MutationObserver(function (records) {
|
|
659
|
+
for (var r = 0; r < records.length; r++) {
|
|
660
|
+
for (var n = 0; n < records[r].addedNodes.length; n++) {
|
|
661
|
+
if (records[r].addedNodes[n].nodeType === 1) sizes.observe(records[r].addedNodes[n]);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
reportHeight();
|
|
665
|
+
}).observe(document.body, { childList: true });
|
|
666
|
+
reportHeight();
|
|
667
|
+
post({ type: 'ready' });
|
|
668
|
+
})();`;function Dd(e){return`<script>${e.replace(/<\/script/gi,"<\\/script")}<\/script>`}function LT(){const e=Object.entries(Hy()).map(([n,r])=>`${n}: ${r};`).join(" ");return["<!DOCTYPE html>","<html><head>",'<meta charset="utf-8">',`<meta http-equiv="Content-Security-Policy" content="${Wy}">`,"<style>",`:root { ${e} color-scheme: light; }`,"html, body { margin: 0; padding: 0; background: transparent; overflow: hidden; }","body { font: 14px/1.5 var(--font-sans); color: var(--color-text-primary); -webkit-font-smoothing: antialiased; }","#root { position: relative; display: flow-root; }","*, *::before, *::after { box-sizing: border-box; }","</style>",Dd(IT),'</head><body><div id="root"></div>',Dd(MT),"</body></html>"].join(`
|
|
669
|
+
`)}let bg=null;function OT(){return bg??(bg=LT()),bg}const $T=4e3,PT=3,So=new Map,zT=500;function FT(e,n){if(So.delete(e),So.set(e,n),So.size>zT){const r=So.keys().next().value;r!==void 0&&So.delete(r)}}function UT({widgetId:e,title:n,html:r,final:o,onError:a}){const c=y.useRef(null),[d,f]=y.useState(()=>So.get(e)??0),h=y.useRef({html:r,final:o});h.current={html:r,final:o};const g=y.useRef(a);g.current=a;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>PT)return;const E=h.current,b=k.current;b&&(b.final||b.html===E.html&&b.final===E.final)||(k.current=E,S.postMessage({source:Uy,type:"content",html:E.html,final:E.final},"*"))},[]);return y.useEffect(()=>{function S(E){var N;const b=c.current;if(!b||E.source!==b.contentWindow)return;const T=E.data;if(!(!T||typeof T!="object"||T.source!==Fy))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 _=Math.min($T,Math.max(0,Math.ceil(T.height)));f(_),FT(e,_)}else T.type==="error"&&typeof T.message=="string"&&((N=g.current)==null||N.call(g,T.message.slice(0,500)))}return window.addEventListener("message",S),()=>window.removeEventListener("message",S)},[e,x]),y.useEffect(()=>{x()},[r,o,x]),l.jsx("iframe",{ref:c,className:"widget-frame",sandbox:By,srcDoc:OT(),title:n||"Widget",style:{height:`${d}px`}})}const BT=720,WT=20;function Md(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function HT(e,n){const r=Object.entries(Hy()).map(([o,a])=>`${o}: ${a};`).join(" ");return["<!DOCTYPE html>","<html><head>",'<meta charset="utf-8">',`<meta http-equiv="Content-Security-Policy" content="${Wy}">`,'<meta name="viewport" content="width=device-width, initial-scale=1">',`<title>${Md(e||"Widget")}</title>`,"<style>",`:root { ${r} color-scheme: light; }`,"html { background: var(--color-background-primary); }","body { margin: 0; padding: 32px 24px; font: 14px/1.5 var(--font-sans); color: var(--color-text-primary); -webkit-font-smoothing: antialiased; }",`#root { position: relative; display: flow-root; max-width: ${BT}px; margin: 0 auto; }`,"*, *::before, *::after { box-sizing: border-box; }","</style>",Dd(Vy),'</head><body><div id="root">',n,"</div></body></html>"].join(`
|
|
670
|
+
`)}function VT(e,n){const r=Md(e||"Widget");return["<!DOCTYPE html>","<html><head>",'<meta charset="utf-8">','<meta name="viewport" content="width=device-width, initial-scale=1">',`<title>${r}</title>`,"<style>html, body { margin: 0; height: 100%; } iframe { display: block; width: 100%; height: 100%; border: 0; }</style>","</head><body>",`<iframe sandbox="${By}" title="${r}" srcdoc="${Md(HT(e,n))}"></iframe>`,"</body></html>"].join(`
|
|
671
|
+
`)}const yo=new Map;function KT(e,n,r){const o=VT(n,r);let a=yo.get(e);a&&a.doc!==o&&(URL.revokeObjectURL(a.url),a=void 0),a??(a={doc:o,url:URL.createObjectURL(new Blob([o],{type:"text/html;charset=utf-8"}))}),yo.delete(e),yo.set(e,a);for(const[d,f]of yo){if(yo.size<=WT)break;URL.revokeObjectURL(f.url),yo.delete(d)}const c=window.open(a.url,"_blank");c&&(c.opener=null)}function GT({item:e}){const[n,r]=y.useState(null),o=e.data??{},a=typeof o.title=="string"?o.title.trim():"",c=typeof o.html=="string"?o.html:"",d=o.partial===!0,f=typeof o.error=="string"&&o.error?o.error:null,h=e.external_item_id??e.id;return l.jsxs("div",{className:"render-content widget-card",children:[l.jsxs("div",{className:"turn-header",children:[l.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:l.jsx(B1,{size:14})}),l.jsx("span",{className:"turn-header-title",children:a||"Visual"}),d&&l.jsx("span",{className:"turn-header-meta",children:"drawing…"}),f&&l.jsx("span",{className:"turn-header-meta",style:{color:"var(--red)"},children:"failed"}),!d&&c.trim()!==""&&l.jsx("button",{type:"button",className:"widget-open-btn",title:"Open in a new tab","aria-label":"Open in a new tab",onClick:()=>KT(h,a,c),children:l.jsx(Lv,{size:14})})]}),c.trim()?l.jsx(UT,{widgetId:h,title:a,html:c,final:!d,onError:r}):!f&&l.jsx("div",{className:"widget-placeholder",children:d?"Drawing…":"Nothing to show"}),f&&l.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:l.jsx("code",{children:f})}),n&&!f&&l.jsxs("div",{className:"widget-script-error",title:n,children:["Script error: ",n]})]})}function Sf(e){return(e??[]).filter(n=>n.task_type!=="local_agent").length}function bf(e){switch(e){case"local_agent":return"subagent";case"local_bash":return"monitor";case"background_terminal":return"command";default:return"task"}}function Ky(e,n){switch(bf(e)){case"subagent":return`Subagent${n?`: ${n}`:""}`;case"monitor":return"Monitor";case"command":return"Background command";default:return"Background Task"}}const qT={subagent:vr,monitor:Hv,command:Ql,task:Mv};Ge.setOptions({breaks:!0,gfm:!0});const XT=10,YT=100;function QT({attachments:e}){const[n,r]=y.useState(null);return y.useEffect(()=>{if(!n)return;function o(a){a.key==="Escape"&&r(null)}return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[n]),!Array.isArray(e)||e.length===0?null:l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"attachment-pills",children:e.map((o,a)=>{const c=o.media_type.startsWith("image/"),d=`data:${o.media_type};base64,${o.data}`;return l.jsxs("span",{className:"attachment-pill",title:o.name,onClick:c?()=>r(d):void 0,style:c?{cursor:"pointer"}:void 0,children:[c?l.jsx("img",{src:d,alt:o.name,className:"attachment-pill-thumb"}):l.jsx(Ov,{size:12,className:"attachment-pill-icon"}),l.jsx("span",{className:"attachment-pill-name",children:o.name})]},a)})}),n&&l.jsx("div",{className:"image-preview-modal",onClick:()=>r(null),children:l.jsxs("div",{className:"image-preview-content",onClick:o=>o.stopPropagation(),children:[l.jsx("img",{src:n,alt:"preview"}),l.jsx("button",{className:"image-preview-close",onClick:()=>r(null),children:l.jsx(Tn,{size:20})})]})})]})}function ZT(e){const n=Ge.parse(e);return kf.sanitize(n)}function Ng(e){var n;return(n=e.data)!=null&&n.text?e.data.text:""}function JT(e){const n=e.match(/^\/bin\/\w+\s+-\w+\s+"(.*)"$/s);return n?n[1]:e}const Tg='<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 eC(e){return/<\/body>/i.test(e)?e.replace(/<\/body>/i,`${Tg}</body>`):e+Tg}function tC({html:e}){const[n,r]=y.useState(480),o=y.useRef(null);return y.useEffect(()=>{function a(c){var d;c.source===((d=o.current)==null?void 0:d.contentWindow)&&typeof c.data=="number"&&c.data>0&&r(c.data)}return window.addEventListener("message",a),()=>window.removeEventListener("message",a)},[]),l.jsx("iframe",{ref:o,sandbox:"allow-scripts",srcDoc:eC(e),title:"HTML content",style:{width:"100%",height:`${n}px`,border:"1px solid var(--border)",borderRadius:"var(--r-md)",background:"#fff",marginTop:"8px"}})}const Cg=1e4;function nC({item:e,runtimeType:n,turn:r,threads:o}){var f,h,g,v,k,x,S,E;const a=e.status==="in_progress",[c,d]=y.useState(!1);switch(e.type){case"agent_message":{const{iconClass:b,iconText:T}=wd(n??"codex");return l.jsxs("div",{className:"render-content",children:[l.jsxs("div",{className:"turn-header",children:[l.jsx("span",{className:`turn-header-icon ${b}`,children:T}),l.jsx("span",{className:"turn-header-title",children:"Agent"}),a&&l.jsx("span",{className:"turn-header-meta",children:"writing…"})]}),l.jsx(wg,{itemId:e.id,turnId:r.id,sessionId:r.session_id,content:Ng(e)||"…",threads:o,runtimeType:n})]})}case"reasoning":return l.jsxs("div",{className:"render-content",children:[l.jsxs("div",{className:"turn-header",children:[l.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:l.jsx(h1,{size:14})}),l.jsx("span",{className:"turn-header-title",children:"Reasoning"})]}),l.jsx("div",{dangerouslySetInnerHTML:{__html:ZT(Ng(e))}})]});case"command_execution":{const b=e.data||{},T=JT(b.command||""),N=b.aggregated_output||"",_=b.exit_code,z=a?"running…":_!==null?`exit ${_}`:"",M=N.length>Cg,O=M&&!c?N.slice(0,Cg)+`
|
|
672
|
+
… (truncated, click to expand)`:N;return l.jsxs("div",{className:"render-content",children:[l.jsxs("div",{className:"turn-header",children:[l.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:l.jsx(Ql,{size:14})}),l.jsx("span",{className:"turn-header-title",children:"Command"}),z&&l.jsx("span",{className:"turn-header-meta",children:z})]}),l.jsx("pre",{className:"cmd-block",children:l.jsx("code",{children:T})}),N&&l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:"cmd-output",children:l.jsx("code",{children:O})}),M&&l.jsx("button",{className:"cmd-output-toggle",onClick:()=>d(X=>!X),children:c?"Show less":`Show full output (${(N.length/1024).toFixed(0)}KB)`})]})]})}case"file_change":{const b=(f=e.data)==null?void 0:f.changes,T=Array.isArray(b)?b:[],N=`${T.length} file${T.length!==1?"s":""}`;return l.jsxs("div",{className:"render-content",children:[l.jsxs("div",{className:"turn-header",children:[l.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:l.jsx(w1,{size:14})}),l.jsx("span",{className:"turn-header-title",children:"File Changes"}),l.jsx("span",{className:"turn-header-meta",children:N})]}),l.jsx("div",{className:"file-change-list",children:T.map((_,z)=>{const M=_.kind==="add"?"A":_.kind==="delete"?"D":"M",O=_.kind==="add"?"fc-add":_.kind==="delete"?"fc-del":"fc-mod";return l.jsxs("div",{className:"file-change",children:[l.jsx("span",{className:`fc-status ${O}`,children:M}),l.jsx("span",{className:"fc-name",children:_.path})]},z)})})]})}case"mcp_tool_call":{const b=e.data||{},T=b.tool||"mcp";if(T==="Agent"){const P=b.arguments,Q=(P==null?void 0:P.description)||(P==null?void 0:P.prompt)||"Subagent",ce=e.status==="failed",ue=a?"running…":ce?"failed":"done";return l.jsxs("div",{className:"agent-call-card",children:[l.jsx("span",{className:"agent-call-icon",children:l.jsx(vr,{size:14})}),l.jsx("span",{className:"agent-call-desc",children:Q}),l.jsx("span",{className:`agent-call-status ${a?"running":ce?"failed":"done"}`,children:ue})]})}const N=b.server||"",_=b.arguments,z=b.result,M=b.error,O=e.status==="failed"||!!M,X=a?"running…":O?"failed":"done",U=((h=z==null?void 0:z.content)==null?void 0:h.filter(P=>P.type==="text").map(P=>P.text))??[];return l.jsxs("div",{className:"render-content",children:[l.jsxs("div",{className:"turn-header",children:[l.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:l.jsx(z1,{size:14})}),l.jsxs("span",{className:"turn-header-title",children:["MCP: ",T]}),N&&l.jsx("span",{className:"turn-header-meta",children:N}),l.jsx("span",{className:"turn-header-meta",style:O?{color:"var(--red)"}:void 0,children:X})]}),_&&Object.keys(_).length>0&&l.jsx("div",{className:"mcp-args",children:Object.entries(_).map(([P,Q])=>l.jsxs("div",{className:"mcp-arg",children:[l.jsx("span",{className:"mcp-arg-key",children:P}),P==="code"?l.jsx("pre",{className:"cmd-block",children:l.jsx("code",{children:String(Q)})}):l.jsx("span",{className:"mcp-arg-value",children:typeof Q=="string"?Q:JSON.stringify(Q,null,2)})]},P))}),U.length>0&&U.map((P,Q)=>l.jsx("pre",{className:"cmd-output",children:l.jsx("code",{children:P})},Q)),M&&l.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:l.jsx("code",{children:M})})]})}case"web_search":{const b=((g=e.data)==null?void 0:g.query)||"";return l.jsxs("div",{className:"render-content",children:[l.jsxs("div",{className:"turn-header",children:[l.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:l.jsx(U1,{size:14})}),l.jsx("span",{className:"turn-header-title",children:"Web Search"})]}),l.jsx("p",{className:"user-message",children:b})]})}case"todo_list":{const b=((v=e.data)==null?void 0:v.items)||[];return l.jsxs("div",{className:"render-content",children:[l.jsxs("div",{className:"turn-header",children:[l.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:l.jsx(j1,{size:14})}),l.jsx("span",{className:"turn-header-title",children:"Todo List"})]}),l.jsx("ul",{className:"todo-list",children:b.map((T,N)=>l.jsxs("li",{className:T.completed?"todo-done":"todo-pending",children:[T.completed?l.jsx(Cs,{size:14}):l.jsx(yr,{size:14})," ",T.text]},N))})]})}case"ask_user":return l.jsx(Sg,{item:e,turn:r});case"final_result":{const b=e.data??{},T=b.text||"",N=b.html||null,_=Array.isArray(b.groups)?b.groups.filter(O=>!!O&&Array.isArray(O.selections)&&O.selections.length>0):[],{iconClass:z,iconText:M}=wd(n??"codex");return l.jsxs(l.Fragment,{children:[(T||N)&&l.jsxs("div",{className:"render-content",children:[l.jsxs("div",{className:"turn-header",children:[l.jsx("span",{className:`turn-header-icon ${z}`,children:M}),l.jsx("span",{className:"turn-header-title",children:"Agent"})]}),T&&l.jsx(wg,{itemId:e.id,turnId:r.id,sessionId:r.session_id,content:T,threads:o,runtimeType:n}),N&&l.jsx(tC,{html:N})]}),_.length>0&&l.jsx(Sg,{item:e,turn:r})]})}case"background_task":{const b=e.data||{},T=b.task_type||"unknown",N=b.subagent_type||null,_=b.description||"",z=b.status||"running",M=b.last_tool_name||null,O=b.token_count||null,X=qT[bf(T)],U=Ky(T,N),P=z==="running"?"running…":z==="completed"?"done":z==="failed"?"failed":z==="stopped"?"stopped":z,Q=e.status==="failed"||z==="failed";return l.jsxs("div",{className:"render-content",children:[l.jsxs("div",{className:"turn-header",children:[l.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:l.jsx(X,{size:14})}),l.jsx("span",{className:"turn-header-title",children:U}),l.jsx("span",{className:"turn-header-meta",style:Q?{color:"var(--red)"}:void 0,children:P})]}),_&&l.jsx("p",{className:"user-message",style:{fontSize:"13px"},children:_}),M&&a&&l.jsxs("div",{className:"cmd-output",style:{color:"var(--text-3)",fontSize:"12px"},children:["last tool: ",M,O!=null&&` · ${O.toLocaleString()} tokens`]}),l.jsx("div",{className:"cmd-output",style:{color:"var(--text-muted)",fontSize:"11px"},children:"Output available in Tasks panel — click the status bar indicator or the Tasks tab."})]})}case"context_compaction":{const b=((k=e.data)==null?void 0:k.trigger)??"auto",T=typeof((x=e.data)==null?void 0:x.pre_tokens)=="number"?e.data.pre_tokens:null,N=typeof((S=e.data)==null?void 0:S.post_tokens)=="number"?e.data.post_tokens:null,_=b==="manual"?"Context compacted (/compact)":"Context auto-compacted",z=T!==null&&N!==null?`${T.toLocaleString()} → ${N.toLocaleString()} tokens (${T>0?Math.round((1-N/T)*100):0}% reduction)`:T!==null?`${T.toLocaleString()} tokens before`:N!==null?`${N.toLocaleString()} tokens after`:null;return l.jsxs("div",{className:"render-content",children:[l.jsxs("div",{className:"turn-header",children:[l.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:l.jsx(I1,{size:14})}),l.jsx("span",{className:"turn-header-title",children:_})]}),z&&l.jsx("div",{className:"cmd-output",style:{color:"var(--text-3)"},children:z})]})}case"interruption":return l.jsx(jT,{item:e});case"widget":return l.jsx(GT,{item:e});case"error":{const b=((E=e.data)==null?void 0:E.message)||"Unknown error";return l.jsxs("div",{className:"render-content",children:[l.jsxs("div",{className:"turn-header",children:[l.jsx("span",{className:"turn-header-icon",style:{background:"var(--red)",color:"#fff"},children:l.jsx(Yl,{size:14})}),l.jsx("span",{className:"turn-header-title",children:"Error"})]}),l.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:l.jsx("code",{children:b})})]})}default:return null}}const Pr=y.memo(nC,(e,n)=>e.item===n.item&&e.runtimeType===n.runtimeType&&e.threads===n.threads&&e.turn.id===n.turn.id);function sC(e){return e.type==="widget"?`widget-${e.external_item_id??e.id}`:e.id}function rC({turn:e,runtimeType:n,threads:r=[]}){Lt.trackRender("TurnContent");const[o,a]=y.useState(!1),[c,d]=y.useState(!1),[f,h]=y.useState(!1),[g,v]=y.useState(!1),k=A(H=>H.loadDeferredItems),x=e.items.some(H=>H.type==="background_task"&&H.status==="in_progress");y.useEffect(()=>{e.status==="running"||e.status==="pending"?a(!0):e.status==="completed"&&!x&&a(!1)},[e.status,x]);const S=e.deferred_item_count??0,E=Fs(e),b=y.useRef(E);y.useEffect(()=>{const H=b.current&&!E&&e.status==="completed"&&!x;if(b.current=E,H||!o||S===0||g||E&&!c)return;let q=!1;return k(e.session_id,e.id).then(ae=>{!ae&&!q&&v(!0)}),()=>{q=!0}},[o,S,g,E,c,e.status,x,k,e.session_id,e.id]);let T=-1;for(let H=e.items.length-1;H>=0;H--)if(e.items[H].type==="agent_message"){T=H;break}const N=T>=0,_=N?e.items.slice(0,T):e.items,z=e.items.some(H=>H.type==="final_result"||H.type==="ask_user"),M=!N&&e.status==="completed"&&e.agent_response&&!z?{id:`response-${e.id}`,turn_id:e.id,external_item_id:`response-${e.id}`,type:"agent_message",data:{text:e.agent_response},status:"completed",created_at:e.created_at,updated_at:e.updated_at}:null,O=_.filter(H=>{var q;return!(H.type==="reasoning"&&(!((q=H.data)!=null&&q.text)||H.data.text===""))}),X=e.items.some(H=>{var q;return H.type==="interruption"&&((q=H.data)==null?void 0:q.reason)==="auth"}),U=e.items.some(H=>{var q;return H.type==="interruption"&&((q=H.data)==null?void 0:q.reason)==="usage_limit"}),P=O.filter(H=>{var q,ae;return!(H.type==="background_task"||H.type==="ask_user"||H.type==="final_result"||H.type==="widget"||H.type==="context_compaction"||X&&H.type==="error"&&((q=H.data)==null?void 0:q.error)==="authentication_failed"||U&&H.type==="error"&&((ae=H.data)==null?void 0:ae.error)==="rate_limit")}),Q=c?0:Math.max(0,P.length-YT),ce=Q>0?P.slice(Q):P,ue=[];let me=null;for(const H of ce)H.type==="agent_message"?(me&&ue.push(me),me={agentMessage:H,toolItems:[],otherItems:[]}):H.type==="interruption"||H.type==="error"?(me&&ue.push(me),ue.push({agentMessage:null,toolItems:[],otherItems:[H]}),me=null):(me||(me={agentMessage:null,toolItems:[],otherItems:[]}),yg(H)?me.toolItems.push(H):me.otherItems.push(H));me&&ue.push(me);const Ne=e.status==="running"||e.status==="pending",Me=H=>{var q;return H.type==="widget"&&(Ne||((q=H.data)==null?void 0:q.partial)!==!0)},J=N?e.items[T]:M,re=[..._.filter(H=>Me(H)||H.type==="context_compaction"),...J?[J]:[],...N?e.items.slice(T+1).filter(H=>H.type!=="ask_user"&&H.type!=="background_task"&&H.type!=="final_result"&&(H.type!=="widget"||Me(H))):[]],ee=e.items.filter(H=>H.type==="background_task"),F=f?0:Math.max(0,ee.length-XT),Z=F>0?ee.slice(F):ee,G=P.filter(H=>yg(H)).length+(e.deferred_tool_calls??0),I=G>0||E&&(P.length>0||S>0),$=e.status==="pending"&&e.resume_state==="waiting",le=e.resume_state==="gave_up"||e.resume_state==="skipped"||e.resume_state==="unsupported";return l.jsxs("div",{className:"turn-group",children:[l.jsxs("div",{className:"render-content",children:[l.jsxs("div",{className:"turn-header",children:[l.jsx("span",{className:"turn-header-icon",style:{background:"var(--amber)",color:"#fff"},children:"U"}),l.jsx("span",{className:"turn-header-title",children:"You"})]}),l.jsx("p",{className:"user-message",children:e.user_prompt}),Array.isArray(e.attachments)&&e.attachments.length>0&&l.jsx(QT,{attachments:e.attachments})]}),I&&l.jsxs("div",{className:"tool-calls",children:[l.jsxs("div",{className:"tool-calls-header",onClick:()=>a(H=>!H),children:[l.jsx("span",{className:"tool-calls-icon",children:l.jsx(T1,{size:12})}),l.jsx("span",{className:"tool-calls-summary",children:G>0?`${G} tool call${G>1?"s":""}`:$?"interrupted":"thinking…"}),l.jsx(Li,{size:14,className:"tool-calls-chevron",style:{transform:o?"rotate(90deg)":"none"}})]}),o&&l.jsxs("div",{className:"tool-calls-body",children:[S>0&&l.jsx("div",{className:"render-load-earlier",children:g?l.jsx("button",{className:"render-load-earlier-btn",onClick:()=>v(!1),children:"Couldn't load these steps. Try again"}):E&&!c?l.jsx("button",{className:"render-load-earlier-btn",onClick:()=>d(!0),children:"Show earlier steps"}):l.jsx("span",{className:"tool-calls-loading",children:"Loading steps…"})}),(S===0||E)&&l.jsxs(l.Fragment,{children:[S===0&&Q>0&&l.jsx("div",{className:"render-load-earlier",children:l.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>d(!0),children:["Show ",Q," earlier step",Q>1?"s":""]})}),ue.map((H,q)=>l.jsxs("div",{className:"intermediate-segment",children:[H.agentMessage&&l.jsx(Pr,{item:H.agentMessage,runtimeType:n,turn:e,threads:r}),H.otherItems.map(ae=>l.jsx(Pr,{item:ae,runtimeType:n,turn:e,threads:r},ae.id)),H.toolItems.length>0&&l.jsx(hT,{items:H.toolItems,runtimeType:n,turn:e,threads:r})]},q))]})]})]}),F>0&&l.jsx("div",{className:"render-load-earlier",children:l.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>h(!0),children:["Show ",F," earlier background task",F>1?"s":""]})}),Z.map(H=>l.jsx(Pr,{item:H,runtimeType:n,turn:e,threads:r},`task-${H.id}`)),re.map(H=>l.jsx(Pr,{item:H,runtimeType:n,turn:e,threads:r},sC(H))),e.items.filter(H=>H.type==="final_result").map(H=>l.jsx(Pr,{item:H,runtimeType:n,turn:e,threads:r},`final-${H.id}`)),e.items.filter(H=>H.type==="ask_user").map(H=>l.jsx(Pr,{item:H,runtimeType:n,turn:e,threads:r},`ask-${H.id}`)),e.items.length===0&&!e.error&&(e.status==="pending"||e.status==="running")&&l.jsx("div",{className:"render-content",children:l.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:e.status==="running"?"Agent is thinking…":"Waiting to start…"})}),e.error&&!le&&l.jsx("div",{className:"render-content",children:l.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:l.jsx("code",{children:e.error})})}),e.status==="running"&&l.jsx(AT,{turnId:e.id}),l.jsx(RT,{turn:e}),e.status==="aborted"&&l.jsxs("div",{className:"aborted-banner",children:[l.jsx("span",{className:"banner-icon",children:l.jsx(yr,{size:12})}),l.jsx("span",{className:"banner-text",children:"Turn stopped — work generated so far is kept."})]})]})}const oC=y.memo(rC),iC=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.userAgent)?"⌘K":"Ctrl+K";function aC(){const e=A(N=>N.workspaces),n=A(N=>N.loadPickerSupport),r=A(N=>N.pickAndAddWorkspace),o=A(N=>N.createSessionInWorkspace),a=A(N=>N.setImportSessionsWorkspace);y.useEffect(()=>{n()},[n]);const c=e.filter(N=>N.deleted===0),[d,f]=y.useState(null),h=c.find(N=>N.path===d)??c[c.length-1]??null,g=(h==null?void 0:h.path)??null,[v,k]=y.useState(null);y.useEffect(()=>{if(!g)return;let N=!1;return Sv(g).then(({sessions:_})=>{N||k({path:g,runtimes:_.map(z=>z.runtime)})}),()=>{N=!0}},[g]);const x=v&&v.path===g?v.runtimes:[],S=x.length,[E,b]=y.useState(!1);async function T(N){b(!0);try{await o(N)}finally{b(!1)}}return l.jsx("div",{className:"render-scroll welcome-scroll",children:l.jsxs("main",{className:"welcome","aria-labelledby":"welcome-title",children:[l.jsx("h1",{className:"welcome-title",id:"welcome-title",children:"Welcome to Repoburg"}),l.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."}),l.jsxs("ol",{className:"welcome-steps",children:[l.jsxs("li",{className:`welcome-step${h?" done":" current"}`,children:[l.jsx("span",{className:"welcome-step-mark","aria-hidden":"true",children:h?l.jsx(Cs,{size:13}):"1"}),l.jsxs("div",{className:"welcome-step-body",children:[l.jsx("h2",{className:"welcome-step-title",children:"Add a workspace"}),h?l.jsx("p",{className:"welcome-step-text",children:l.jsx("code",{title:h.path,children:h.path})}):l.jsxs("button",{className:"dialog-btn-create welcome-primary",onClick:()=>void r(),children:[l.jsx(S1,{size:14})," Open folder…"]})]})]}),l.jsxs("li",{className:`welcome-step${h?" current":" upcoming"}`,children:[l.jsx("span",{className:"welcome-step-mark","aria-hidden":"true",children:"2"}),l.jsxs("div",{className:"welcome-step-body",children:[l.jsx("h2",{className:"welcome-step-title",children:"Start your first session"}),h&&g?l.jsxs(l.Fragment,{children:[c.length>1&&l.jsxs("label",{className:"welcome-step-text welcome-target",children:["In",l.jsx("select",{className:"dialog-input dialog-select",value:g,onChange:N=>f(N.target.value),children:c.map(N=>l.jsx("option",{value:N.path,children:N.label||N.path},N.id))})]}),l.jsxs("div",{className:"welcome-actions",children:[l.jsxs("button",{className:"dialog-btn-create welcome-primary",disabled:E,onClick:()=>void T(g),children:[l.jsx(pr,{size:14})," New session"]}),S>0&&l.jsxs("button",{className:"dialog-btn-cancel",onClick:()=>a(g),children:[l.jsx(zv,{size:14})," Import ",kv(x)]})]}),S>0&&l.jsxs("p",{className:"welcome-step-text",children:["Sessions you started with ",l.jsx("code",{children:"claude"})," or ",l.jsx("code",{children:"codex"})," in this folder continue right where they left off."]})]}):l.jsx("p",{className:"welcome-step-text",children:"Then start an agent session in it."})]})]})]}),l.jsxs("p",{className:"welcome-tip",children:["Later: right-click a workspace to import its Claude Code and Codex sessions, and press"," ",l.jsx("kbd",{children:iC})," for the command palette."]})]})})}const lC=[],cl=50;function cC(){Lt.trackRender("RenderArea");const e=A(S=>S.activeSessionId),n=A(S=>S.activeSessionId?S.sessionDetails[S.activeSessionId]:null),r=A(S=>S.submittingPrompt),o=A(S=>S.loading),a=A(S=>!S.activeSessionId&&!Hb(S.workspaces,S.sessions,S.appsRootPath)),c=(n==null?void 0:n.turns)??[],d=(n==null?void 0:n.threads)??lC,f=y.useRef(null),[h,g]=y.useState(cl);y.useEffect(()=>{g(cl)},[e]);const v=c.filter(S=>!S.thread_id),k=Math.max(0,v.length-h),x=v.slice(k);return y.useEffect(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},[e,c.length]),o&&!n?l.jsx("div",{className:"render-scroll",children:l.jsxs("div",{className:"skeleton-bars",children:[l.jsx("div",{className:"skeleton-bar"}),l.jsx("div",{className:"skeleton-bar"}),l.jsx("div",{className:"skeleton-bar"}),l.jsx("div",{className:"skeleton-bar"}),l.jsx("div",{className:"skeleton-bar"})]})}):n?l.jsxs("div",{className:"render-scroll",ref:f,children:[r&&l.jsx("div",{className:"turn-block",children:l.jsxs("div",{className:"turn-group",children:[l.jsxs("div",{className:"render-content",children:[l.jsxs("div",{className:"turn-header",children:[l.jsx("span",{className:"turn-header-icon",style:{background:"var(--amber)",color:"#fff"},children:"U"}),l.jsx("span",{className:"turn-header-title",children:"You"})]}),l.jsx("p",{className:"user-message",children:r})]}),l.jsx("div",{className:"render-content",children:l.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:"Sending…"})})]})}),c.length===0&&!r&&l.jsx("div",{className:"empty-state",children:"No turns yet. Send a message below to start."}),k>0&&l.jsx("div",{className:"render-load-earlier",children:l.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>g(S=>S+cl),children:["Show ",Math.min(cl,k)," earlier turns (",k," hidden)"]})}),x.map((S,E)=>l.jsx("div",{id:`turn-${k+E}`,className:"turn-block",children:l.jsx(oC,{turn:S,runtimeType:n.runtime_type,threads:d})},S.id))]}):a?l.jsx(aC,{}):l.jsx("div",{className:"render-scroll",children:l.jsx("div",{className:"empty-state",children:"No session selected"})})}const uC=y.memo(cC),dC=[{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 fC(e){return e.map(n=>({id:n.name,label:`/${n.name}`,hint:n.description,capability:null,insertAsText:!0}))}function pC(e,n,r=[]){const o=[...dC,...fC(r)],a=new Set;return o.filter(c=>!(a.has(c.label)||(a.add(c.label),c.capability&&!n[c.capability])||e&&!c.label.toLowerCase().includes(e.toLowerCase())))}function hC({commands:e,selectedIndex:n,onSelect:r,onHover:o}){return l.jsxs("div",{className:"slash-popup",children:[l.jsx("div",{className:"slash-popup-header",children:"Commands"}),e.length===0&&l.jsx("div",{className:"slash-popup-empty",children:"No matching commands"}),e.map((a,c)=>l.jsxs("div",{className:`slash-popup-item ${c===n?"selected":""}`,onMouseEnter:()=>o(c),onClick:()=>r(a),children:[l.jsx("span",{className:"slash-popup-label",children:a.label}),l.jsx("span",{className:"slash-popup-hint",children:a.hint})]},a.id))]})}function ud({title:e,options:n,currentValue:r,onSelect:o,onClose:a}){return l.jsxs("div",{className:"slash-popup",children:[l.jsxs("div",{className:"slash-popup-header",children:[l.jsx("button",{className:"slash-popup-back",onClick:a,children:"← Back"}),l.jsx("span",{children:e})]}),n.map(c=>l.jsxs("div",{className:`slash-popup-item ${c.value===r?"selected":""}`,onClick:()=>o(c.value),children:[l.jsxs("div",{className:"slash-popup-item-main",children:[l.jsx("span",{className:"slash-popup-label",children:c.label}),c.description&&l.jsx("span",{className:"slash-popup-hint",children:c.description})]}),c.value===r&&l.jsx("span",{className:"slash-popup-check",children:"✓"})]},c.value))]})}function mC(e){return kt("/skills")}function gC({filter:e,onSelect:n,onClose:r}){const[o,a]=y.useState([]),[c,d]=y.useState(!0),[f,h]=y.useState(0),g=y.useRef(null);y.useEffect(()=>{mC().then(a).catch(()=>a([])).finally(()=>d(!1))},[]);const v=o.filter(k=>k.name.toLowerCase().includes(e.toLowerCase())||k.description.toLowerCase().includes(e.toLowerCase()));return y.useEffect(()=>{h(0)},[e]),y.useEffect(()=>{function k(x){x.key==="ArrowDown"?(x.preventDefault(),h(S=>Math.min(S+1,v.length-1))):x.key==="ArrowUp"?(x.preventDefault(),h(S=>Math.max(S-1,0))):x.key==="Enter"?(x.preventDefault(),v[f]&&n(v[f])):x.key==="Escape"&&(x.preventDefault(),r())}return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[v,f,n,r]),l.jsxs("div",{className:"slash-popup",ref:g,children:[l.jsxs("div",{className:"slash-popup-header",children:[l.jsx("button",{className:"slash-popup-back",onClick:r,children:"← Back"}),l.jsx("span",{children:"Skills"})]}),c&&l.jsx("div",{className:"slash-popup-empty",children:"Loading skills…"}),!c&&v.length===0&&l.jsx("div",{className:"slash-popup-empty",children:"No matching skills"}),v.map((k,x)=>l.jsxs("div",{className:`slash-popup-item ${x===f?"selected":""}`,onMouseEnter:()=>h(x),onClick:()=>n(k),children:[l.jsxs("div",{className:"slash-popup-item-main",children:[l.jsx("span",{className:"slash-popup-label",children:k.name}),k.description&&l.jsx("span",{className:"slash-popup-hint",children:k.description})]}),!!k.metadata.isSystem&&l.jsx("span",{className:"slash-popup-hint",children:"system"})]},k.id))]})}function Gy(){return kt("/providers")}function vC(e,n){const r=n?`?cwd=${encodeURIComponent(n)}`:"";return kt(`/providers/${e}/commands${r}`)}const yC={dynamicModels:!1,skills:!1,plugins:!1,mcpServers:!1,imageAttachments:!1,sandbox:!1,webSearch:!1,networkAccess:!1,fileReferences:!1};function xC(e){const[n,r]=y.useState([]),[o,a]=y.useState(!0);y.useEffect(()=>{Gy().then(r).catch(()=>r([])).finally(()=>a(!1))},[]);const c=n.find(d=>d.id===e)??null;return{provider:c,capabilities:(c==null?void 0:c.capabilities)??yC,loading:o}}const xo=32,dd=200;function Eg(e){if(!e)return{};try{return JSON.parse(e)}catch{return{}}}function jg(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}let _g=0;function wC(){return _g+=1,`att-${Date.now()}-${_g}`}function kC(){Lt.trackRender("CommandInputBar");const[e,n]=y.useState(""),r=y.useRef(null),o=y.useRef(xo),a=y.useRef(null),{submitPrompt:c,cancelTurn:d,updateRuntimeConfig:f,setShowModelSelector:h}=A(),g=A(Y=>Y.activeSessionId),v=A(Y=>Y.activeSessionId?Y.sessionDetails[Y.activeSessionId]:null),k=A(Y=>Y.quotedText),x=hv(v),S=!!(v!=null&&v.turns.some(Y=>Y.status==="pending"&&Y.resume_state==="waiting")),E=!g,{capabilities:b}=xC(v==null?void 0:v.runtime_type),T=(v==null?void 0:v.runtime_type)??null,N=b.imageAttachments,[_,z]=y.useState([]),[M,O]=y.useState(!1),[X,U]=y.useState(null),[P,Q]=y.useState([]);y.useEffect(()=>{if(!T){Q([]);return}let Y=!1;return vC(T,(v==null?void 0:v.cwd)??void 0).then(ve=>{Y||Q(ve)}).catch(()=>{Y||Q([])}),()=>{Y=!0}},[T,v==null?void 0:v.cwd]);const[ce,ue]=y.useState(!1),[me,Ne]=y.useState(""),[Me,J]=y.useState(0),[re,ee]=y.useState(void 0),[F,Z]=y.useState(!1),[G,I]=y.useState(""),[$,le]=y.useState([]),H=ce?pC(me,b,P):[];y.useEffect(()=>{k!==null&&(n(Y=>Y+k),setTimeout(()=>{if(r.current){he(),r.current.focus();const Y=r.current.value.length;r.current.setSelectionRange(Y,Y)}},0),A.setState({quotedText:null}))},[k]),y.useEffect(()=>{if(!x)return;function Y(ve){ve.key==="Escape"&&(ve.preventDefault(),d())}return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[x,d]),y.useEffect(()=>{ue(!1),ee(void 0),Z(!1),le([]),z(Y=>{for(const ve of Y)ve.previewUrl&&URL.revokeObjectURL(ve.previewUrl);return[]})},[g]),y.useEffect(()=>{if(!X)return;function Y(ve){ve.key==="Escape"&&(ve.preventDefault(),U(null))}return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[X]);const q=y.useCallback(Y=>{if(!Y)return;const ve=Array.from(Y);for(const Be of ve){const rt=new FileReader;rt.onload=()=>{const vt=rt.result.split(",")[1]??"",_t=Be.type.startsWith("image/")?URL.createObjectURL(Be):void 0;z(an=>[...an,{id:wC(),name:Be.name,media_type:Be.type||"application/octet-stream",data:vt,previewUrl:_t,size:Be.size}])},rt.readAsDataURL(Be)}},[]),ae=y.useCallback(Y=>{z(ve=>{const Be=ve.find(rt=>rt.id===Y);return Be!=null&&Be.previewUrl&&URL.revokeObjectURL(Be.previewUrl),ve.filter(rt=>rt.id!==Y)})},[]),Se=y.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),!(!N||x)&&O(!0)},[N,x]),_e=y.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),O(!1)},[]),Ae=y.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),O(!1),!(!N||x)&&q(Y.dataTransfer.files)},[N,x,q]),je=y.useCallback(Y=>{var rt;if(!N)return;const ve=(rt=Y.clipboardData)==null?void 0:rt.items;if(!ve)return;const Be=[];for(let gt=0;gt<ve.length;gt++){const vt=ve[gt];if(vt.type.startsWith("image/")){const _t=vt.getAsFile();_t&&Be.push(_t)}}Be.length>0&&(Y.preventDefault(),q(Be))},[N,q]);function ge(Y){const ve=r.current;ve&&(ve.style.height=`${Y}px`,o.current=Y)}function he(){const Y=r.current;if(Y){if(Y.scrollHeight>Y.clientHeight){const ve=Math.min(Y.scrollHeight,dd);ve!==o.current&&ge(ve);return}o.current>xo&&(Y.style.height="auto",ge(Math.min(Y.scrollHeight,dd)))}}function Ve(){const Y=e.trim();if(!Y||x)return;let ve=Y;$.length>0&&(ve=`${$.map(gt=>`$${gt.name}`).join(" ")}
|
|
673
|
+
|
|
674
|
+
${Y}`);const Be=_.map(({id:rt,previewUrl:gt,size:vt,..._t})=>_t);n(""),le([]),ge(xo),ue(!1),ee(void 0),Z(!1);for(const rt of _)rt.previewUrl&&URL.revokeObjectURL(rt.previewUrl);z([]),c(ve,Be.length>0?Be:void 0)}function Ie(Y){if(Y.insertAsText){const ve=`/${Y.id} `;n(ve),ue(!1),ee(void 0),requestAnimationFrame(()=>{if(r.current){r.current.focus();const Be=ve.length;r.current.setSelectionRange(Be,Be),he()}});return}Y.subPopup?ee(Y.subPopup):Y.id==="skills"?(Z(!0),I(""),ue(!1),n("")):Y.id==="model"?(h(!0),ue(!1),n("")):(ue(!1),n(""))}function mt(Y){le(ve=>[...ve,Y]),Z(!1),n(""),ge(xo)}function Ue(Y){const ve=Eg(v==null?void 0:v.runtime_config);re==="sandbox"?ve.sandboxMode=Y:re==="websearch"?ve.webSearchMode=Y:re==="network"&&(ve.networkAccessEnabled=Y==="true"),f(ve),ee(void 0),ue(!1),n(""),ge(xo)}function Vt(Y){if(Lt.markKeystroke(),ce&&!re){if(Y.key==="ArrowDown"){Y.preventDefault(),J(ve=>Math.min(ve+1,H.length-1));return}if(Y.key==="ArrowUp"){Y.preventDefault(),J(ve=>Math.max(ve-1,0));return}if(Y.key==="Enter"){Y.preventDefault(),H[Me]&&Ie(H[Me]);return}if(Y.key==="Escape"){Y.preventDefault(),ue(!1),n("");return}}if(re&&Y.key==="Escape"){Y.preventDefault(),ee(void 0);return}if(Y.key==="Enter"&&(Y.metaKey||Y.ctrlKey)&&!x){Y.preventDefault(),Ve();return}Y.key==="Escape"&&x&&(Y.preventDefault(),d())}function tn(Y){Lt.markInputChange();const ve=Y.target.value;n(ve),he(),ve.startsWith("/")&&!ve.includes(" ")&&!x?(ue(!0),Ne(ve.slice(1)),J(0)):(ue(!1),ee(void 0)),ve.startsWith("$")&&!x?(Z(!0),I(ve.slice(1))):ve.startsWith("$")||Z(!1)}const St=Eg(v==null?void 0:v.runtime_config),jt=[{value:"read-only",label:"Read Only",description:"Agent can only read files"},{value:"workspace-write",label:"Workspace Write",description:"Agent can read and write in workspace"},{value:"danger-full-access",label:"Danger Full Access",description:"Agent has unrestricted access"}],Ft=[{value:"disabled",label:"Disabled",description:"No web search"},{value:"cached",label:"Cached",description:"Use cached search results"},{value:"live",label:"Live",description:"Perform live web searches"}],Ot=[{value:"false",label:"Disabled",description:"No network access"},{value:"true",label:"Enabled",description:"Allow network access in sandbox"}];return l.jsxs("div",{className:`cmd-bar${M?" drag-over":""}`,onDragOver:Se,onDragLeave:_e,onDrop:Ae,children:[ce&&!re&&l.jsx(hC,{commands:H,selectedIndex:Me,onSelect:Ie,onHover:J}),ce&&re==="sandbox"&&l.jsx(ud,{title:"Sandbox Mode",options:jt,currentValue:St.sandboxMode,onSelect:Ue,onClose:()=>ee(void 0)}),ce&&re==="websearch"&&l.jsx(ud,{title:"Web Search",options:Ft,currentValue:St.webSearchMode,onSelect:Ue,onClose:()=>ee(void 0)}),ce&&re==="network"&&l.jsx(ud,{title:"Network Access",options:Ot,currentValue:St.networkAccessEnabled===!0?"true":"false",onSelect:Ue,onClose:()=>ee(void 0)}),F&&l.jsx(gC,{filter:G,onSelect:mt,onClose:()=>{Z(!1),n("")}}),$.length>0&&l.jsx("div",{className:"skill-badges",children:$.map(Y=>l.jsxs("span",{className:"skill-badge",children:["$",Y.name,l.jsx("button",{className:"skill-badge-remove",onClick:()=>le(ve=>ve.filter(Be=>Be.id!==Y.id)),children:"×"})]},Y.id))}),_.length>0&&l.jsx("div",{className:"attachment-preview-area",children:_.map(Y=>l.jsxs("div",{className:"attachment-chip",title:Y.name,children:[Y.previewUrl?l.jsx("img",{src:Y.previewUrl,alt:Y.name,className:"attachment-thumb",onClick:()=>U(Y),style:{cursor:"pointer"}}):l.jsx(Ov,{size:20,className:"attachment-file-icon"}),l.jsxs("div",{className:"attachment-info",children:[l.jsx("span",{className:"attachment-name",children:Y.name}),l.jsx("span",{className:"attachment-size",children:jg(Y.size)})]}),l.jsx("button",{className:"attachment-remove",onClick:()=>ae(Y.id),title:"Remove attachment",children:l.jsx(Tn,{size:14})})]},Y.id))}),N&&!x&&!E&&l.jsx("input",{ref:a,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=>{q(Y.target.files),Y.target.value=""}}),l.jsxs("div",{className:"cmd-input-row",children:[N&&!x&&!E&&l.jsx("button",{className:"attachment-clip-btn",onClick:()=>{var Y;return(Y=a.current)==null?void 0:Y.click()},title:"Attach files",disabled:x,children:l.jsx($1,{size:16})}),l.jsx("textarea",{ref:r,className:"cmd-textarea",placeholder:E?"Select or create a session…":S?"Interrupted — waiting to resume…":x?"Agent is running…":"Type a message… Use / for commands",autoComplete:"off",value:e,disabled:x||E,rows:1,style:{minHeight:xo,maxHeight:dd},onChange:tn,onKeyDown:Vt,onPaste:je}),x?l.jsx("button",{className:"cmd-stop-btn",onClick:()=>d(),title:"Stop (Esc)",children:l.jsx(yr,{size:15})}):l.jsx("button",{className:"cmd-send-btn",onClick:Ve,disabled:!e.trim()||E,title:"Send (⌘↵)",children:l.jsx(Dv,{size:16})})]}),X&&l.jsx("div",{className:"image-preview-modal",onClick:()=>U(null),children:l.jsxs("div",{className:"image-preview-content",onClick:Y=>Y.stopPropagation(),children:[l.jsx("img",{src:X.previewUrl,alt:X.name}),l.jsxs("div",{className:"image-preview-info",children:[l.jsx("span",{children:X.name}),l.jsx("span",{children:jg(X.size)})]}),l.jsx("button",{className:"image-preview-close",onClick:()=>U(null),children:l.jsx(Tn,{size:20})})]})})]})}function SC(){const e=A(T=>T.activeSessionId),n=A(T=>T.activeSessionId?T.sessionDetails[T.activeSessionId]:null),r=A(T=>T.activeTurnIndex),o=A(T=>T.setActiveTurnIndex),a=A(T=>T.rewindToTurn),c=A(T=>T.restoreSession),d=A(T=>T.branchFromTurn),f=(n==null?void 0:n.turns)??[],h=Vl(n),g=!!(n!=null&&n.rewound_at_turn_id),v=(n==null?void 0:n.runtime_type)==="repoburg",k=v?"Rewind to this turn? Runtime history after this point is PERMANENTLY deleted and cannot be restored.":"Rewind to this turn? Hidden turns can be restored later.",[x,S]=y.useState(null),E=y.useRef(null);if(Wi(E,()=>S(null),!!x),Io(()=>S(null),!!x),f.length===0)return l.jsx("div",{className:"empty-state",children:"No turns yet"});function b(T){o(T),requestAnimationFrame(()=>{var N;(N=document.getElementById(`turn-${T}`))==null||N.scrollIntoView({behavior:"smooth",block:"start"})})}return l.jsxs("div",{className:"right-section",children:[l.jsx("div",{className:"right-section-title",children:"Conversation"}),f.map((T,N)=>{const _=N===r,z=T.user_prompt.length>50?T.user_prompt.slice(0,50)+"…":T.user_prompt,M=T.status==="running"||T.status==="pending";return l.jsx("div",{children:l.jsxs("div",{className:`turn-item ${_?"active":""}`,onClick:()=>b(N),onContextMenu:O=>{O.preventDefault(),S({x:O.clientX,y:O.clientY,turnId:T.id,turnIndex:N,isLast:N===f.length-1,isSlashCommand:T.user_prompt.trimStart().startsWith("/")})},children:[l.jsx("span",{className:"turn-item-icon",style:{background:"var(--amber)",color:"#fff"},children:l.jsx(K1,{size:12})}),l.jsx("span",{className:"turn-item-label",children:z}),M&&l.jsx("span",{className:"turn-item-status",children:T.status==="pending"&&T.resume_state==="waiting"?"interrupted":"running…"})]})},T.id)}),x&&l.jsxs("div",{ref:E,className:"ctx-menu",style:{position:"fixed",left:x.x,top:x.y,zIndex:500},children:[l.jsxs("div",{className:`ctx-menu-item ${x.isLast||h||x.isSlashCommand?"ctx-disabled":""}`,onClick:()=>{x.isLast||h||x.isSlashCommand||(window.confirm(k)&&a(e,x.turnId),S(null))},children:[l.jsx(F1,{size:12})," Rewind to Here",x.isSlashCommand?" (slash command)":""]}),g&&!v&&l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{c(e),S(null)},children:[l.jsx($i,{size:12})," Restore Rewind"]}),l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{d(e,x.turnId),S(null)},children:[l.jsx(Pv,{size:12})," Branch from Here"]})]})]})}const bC={subagent:vr,monitor:Hv,command:Ql,task:Mv},Rg=2e4;function NC(e){const n=[];return e.forEach((r,o)=>{var a;for(const c of r.items)if(c.type==="background_task"){if((((a=c.data)==null?void 0:a.task_type)||"unknown")==="local_agent")continue;n.push({item:c,turnIndex:o,turnPrompt:r.user_prompt})}}),n}function TC({entry:e,sessionId:n}){const{item:r,turnIndex:o,turnPrompt:a}=e,c=A(ee=>ee.addToast),[d,f]=y.useState(!1),h=r.data||{},g=h.task_type||"unknown",v=h.subagent_type||null,k=h.description||"",x=h.summary||null,S=h.last_tool_name||null,E=h.token_count||null,b=h.output||"",T=r.status==="in_progress",N=h.status||"running",_=!T&&N==="running"?"stopped":N,z=h.task_id||null,M=bC[bf(g)],O=Ky(g,v),X=_==="running"?"running…":_==="completed"?"done":_==="failed"?"failed":_==="stopped"?"stopped":_,U=_==="failed"||r.status==="failed"&&_!=="stopped",[P,Q]=y.useState(T),[ce,ue]=y.useState(!1),me=y.useRef(null);y.useEffect(()=>{T&&Q(!0)},[T]),y.useEffect(()=>{P&&T&&me.current&&(me.current.scrollTop=me.current.scrollHeight)},[P,T,b]);const Ne=b.length>Rg,Me=Ne&&!ce?b.slice(0,Rg)+`
|
|
675
|
+
… (truncated, click to expand)`:b,J=T?null:_==="completed"?l.jsx(Cs,{size:12}):U?l.jsx(Yl,{size:12}):l.jsx(yr,{size:12});async function re(ee){if(ee.stopPropagation(),!(!n||!z||d)){f(!0);try{await h0(n,z)}catch(F){c("error",`Could not stop the task — ${F.message}`)}finally{f(!1)}}}return l.jsxs("div",{className:`task-card ${T?"task-running":""} ${U?"task-failed":""}`,children:[l.jsxs("div",{className:"task-card-header",onClick:()=>Q(ee=>!ee),style:{cursor:"pointer"},children:[l.jsx("span",{className:"task-card-icon",children:l.jsx(M,{size:14})}),l.jsx("span",{className:"task-card-type",children:O}),l.jsxs("span",{className:`task-card-status ${U?"task-status-failed":T?"task-status-running":"task-status-done"}`,children:[J," ",X]}),T&&z&&n&&l.jsxs("button",{className:"task-card-stop",onClick:re,disabled:d,title:"Stop this task","aria-label":"Stop task",children:[l.jsx(yr,{size:10})," ",d?"Stopping…":"Stop"]}),l.jsx(Li,{size:14,className:"task-card-chevron",style:{transform:P?"rotate(90deg)":"none",marginLeft:"auto"}})]}),k&&l.jsx("div",{className:"task-card-desc",children:k}),T&&S&&l.jsxs("div",{className:"task-card-meta",children:["last tool: ",S,E!=null&&` · ${E.toLocaleString()} tokens`]}),P&&l.jsxs("div",{className:"task-card-body",children:[b?l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:"cmd-output task-output",ref:me,children:l.jsx("code",{children:Me})}),Ne&&l.jsx("button",{className:"cmd-output-toggle",onClick:()=>ue(ee=>!ee),children:ce?"Show less":`Show full output (${(b.length/1024).toFixed(0)}KB)`})]}):x?l.jsx("pre",{className:"cmd-output task-output",children:l.jsx("code",{children:x})}):T?l.jsx("div",{className:"task-card-placeholder",children:"Waiting for output…"}):l.jsx("div",{className:"task-card-placeholder",children:"No output captured."}),l.jsxs("div",{className:"task-card-context",title:a,children:["from turn ",o+1,": ",a.length>60?a.slice(0,60)+"…":a]})]})]})}const CC=y.memo(TC);function EC(){const e=A(f=>f.activeSessionId),n=A(f=>f.activeSessionId?f.sessionDetails[f.activeSessionId]:null),r=A(f=>f.activeSessionId?f.backgroundTasks[f.activeSessionId]:void 0),o=(n==null?void 0:n.turns)??[],a=NC(o),c=[...a].sort((f,h)=>{const g=f.item.status==="in_progress",v=h.item.status==="in_progress";return g&&!v?-1:!g&&v?1:h.turnIndex-f.turnIndex}),d=Sf(r);return a.length===0?l.jsx("div",{className:"empty-state",children:"No background tasks yet"}):l.jsxs("div",{className:"right-section",children:[l.jsxs("div",{className:"right-section-title",children:["Background Tasks (",a.length,")",d>0&&l.jsxs("span",{className:"task-count-badge",style:{color:"var(--amber)"},children:[" ",d," running"]})]}),c.map(f=>l.jsx(CC,{entry:f,sessionId:e},f.item.id))]})}const jC=y.memo(EC),_C="Your job is to answer questions about this session:",Ag="Understand the user's question below, read the session file given above, and answer.",RC=new Set(["claude","codex"]);function AC(e){return RC.has(e)}function Nf(e){return e.kind==="sidecar"}function IC(e){const n=(e??[]).filter(Nf);return n.length?n[n.length-1]:null}function DC(e){if(!e.startsWith(_C))return e;const n=e.indexOf(Ag);return n<0?e:e.slice(n+Ag.length).replace(/^\n+/,"")}function MC({thread:e,onClose:n}){const{activeSessionId:r,resolveThread:o,shareThread:a}=A(),[c,d]=y.useState(""),[f,h]=y.useState(!1),[g,v]=y.useState(!1);async function k(){if(!r||f)return;h(!0),await a(r,e.id,c)?n():h(!1)}async function x(){!r||g||(v(!0),await o(r,e.id),n())}const S=f||g;return l.jsx("div",{className:"dialog-overlay",onClick:S?void 0:n,children:l.jsxs("div",{className:"dialog",onClick:E=>E.stopPropagation(),children:[l.jsxs("div",{className:"dialog-header",children:[l.jsx("span",{className:"dialog-title",children:"Resolve thread"}),l.jsx("button",{className:"dialog-close",onClick:n,disabled:S,children:l.jsx(Tn,{size:16})})]}),l.jsxs("div",{className:"dialog-body",children:[l.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."}),l.jsxs("label",{className:"dialog-label",children:["Summarization directives (optional)",l.jsx("textarea",{className:"dialog-input share-directives-input",placeholder:"e.g. focus on the performance findings, keep file paths",value:c,onChange:E=>d(E.target.value),rows:3,disabled:S,autoFocus:!0})]})]}),l.jsxs("div",{className:"dialog-footer",children:[l.jsx("button",{className:"dialog-btn-cancel",onClick:n,disabled:S,children:"Cancel"}),l.jsxs("button",{className:"dialog-btn-cancel",onClick:x,disabled:S,title:"Resolve without sharing",children:[g?l.jsx(hn,{size:13,className:"spin"}):l.jsx(jl,{size:13}),"Resolve only"]}),l.jsxs("button",{className:"dialog-btn-create",onClick:k,disabled:S,children:[f?l.jsx(hn,{size:13,className:"spin"}):l.jsx(W1,{size:13}),f?"Summarizing…":"Share & Resolve"]})]})]})})}const Ig=[];Ge.setOptions({breaks:!0,gfm:!0});function LC(e){const n=Ge.parse(e);return kf.sanitize(n)}function OC(e){var n,r,o;if(e.type==="agent_message"||e.type==="final_result"){const a=(n=e.data)==null?void 0:n.text;return typeof a=="string"&&a?a:null}if(e.type==="ask_user"){const a=Array.isArray((r=e.data)==null?void 0:r.groups)?e.data.groups:[],c=[(o=e.data)==null?void 0:o.question,...a.map(d=>d.question)].filter(d=>typeof d=="string"&&!!d);return c.length?c.join(`
|
|
676
|
+
|
|
677
|
+
`):null}return null}function $C(e){const n=e.match(/^\[Quoting from your previous response\]:\n> .*\n\n([\s\S]*)$/);return n?n[1]:e}function qy({turn:e,formatPrompt:n=$C}){const r=n(e.user_prompt),o=e.items.map(OC).filter(a=>a!==null);return o.length===0&&e.status==="completed"&&e.agent_response&&o.push(e.agent_response),l.jsxs("div",{className:"thread-card-turn",children:[l.jsx("div",{className:"thread-card-user-message",children:r}),o.map((a,c)=>l.jsx("div",{className:"thread-card-ai-response",dangerouslySetInnerHTML:{__html:LC(a)}},c)),o.length===0&&(e.status==="pending"||e.status==="running")&&l.jsx("div",{className:"thread-card-pending",children:e.status==="running"?"AI is responding…":"Waiting…"}),e.status==="failed"&&l.jsx("div",{className:"thread-card-pending",children:e.error||"Turn failed"})]})}function PC({thread:e,threadTurns:n,onStop:r,onResolve:o,onReopen:a,onDelete:c,onFollowup:d,onLocate:f}){var Ne,Me,J;const[h,g]=y.useState(""),[v,k]=y.useState(!0),x=y.useRef(null),S=y.useRef(null),[E,b]=y.useState(!1),[T,N]=y.useState({x:0,y:0}),[_,z]=y.useState(""),M=n.some(Fs),O=28,X=120,U=y.useRef(O);y.useEffect(()=>{const re=S.current;re&&(re.scrollTop=re.scrollHeight)},[n.length,v]);function P(re){const ee=x.current;ee&&(ee.style.height=`${re}px`,U.current=re)}function Q(){const re=x.current;if(re){if(re.scrollHeight>re.clientHeight){const ee=Math.min(re.scrollHeight,X);ee!==U.current&&P(ee);return}U.current>O&&(re.style.height="auto",P(Math.min(re.scrollHeight,X)))}}const ce=y.useCallback(()=>{b(!1)},[]),ue=y.useCallback(()=>{const re=S.current;if(!re)return;const ee=window.getSelection();if(!ee||ee.rangeCount===0||ee.isCollapsed){b(!1);return}const F=ee.getRangeAt(0);if(!re.contains(F.commonAncestorContainer)){b(!1);return}const Z=F.commonAncestorContainer.nodeType===Node.TEXT_NODE?F.commonAncestorContainer.parentElement:F.commonAncestorContainer;if(!(Z!=null&&Z.closest(".thread-card-ai-response"))){b(!1);return}const G=ee.toString();if(!G.trim()){b(!1);return}const I=F.getBoundingClientRect(),$=28,le=6,H=170;let q=!1;if(ee.anchorNode&&ee.focusNode)try{const _e=document.createRange();_e.setStart(ee.focusNode,ee.focusOffset),_e.setEnd(ee.focusNode,ee.focusOffset);const Ae=document.createRange();Ae.setStart(ee.anchorNode,ee.anchorOffset),Ae.setEnd(ee.anchorNode,ee.anchorOffset),q=Ae.compareBoundaryPoints(Range.START_TO_START,_e)>0}catch{q=!1}let ae=I.top-$-le;ae<8&&(ae=I.bottom+le);let Se=q?I.left-H:I.right;Se=Math.max(8,Math.min(Se,window.innerWidth-H-8)),N({x:Se,y:ae}),z(G),b(!0)},[]);y.useEffect(()=>{function re(ee){const F=ee.target;F&&F.closest(".selection-actions")||ue()}return document.addEventListener("mouseup",re),()=>document.removeEventListener("mouseup",re)},[ue]);const me=y.useCallback(()=>{var ee;const re=`
|
|
678
|
+
\`\`\`QUOTE
|
|
679
|
+
${_}
|
|
680
|
+
\`\`\`
|
|
681
|
+
|
|
682
|
+
`;g(F=>F+re),b(!1),z(""),(ee=window.getSelection())==null||ee.removeAllRanges(),setTimeout(()=>{if(x.current){Q(),x.current.focus();const F=x.current.value.length;x.current.setSelectionRange(F,F)}},0)},[_]);return l.jsxs("div",{className:`thread-card ${e.status==="resolved"?"thread-resolved":""}`,id:`thread-${e.id}`,children:[l.jsxs("div",{className:"thread-card-header",onClick:()=>k(re=>!re),children:[l.jsx("div",{className:"thread-card-quote",children:e.selected_text===null?((J=(Me=(Ne=e.turns)==null?void 0:Ne[0])==null?void 0:Me.user_prompt)==null?void 0:J.slice(0,100))||"Quick question":`“${e.selected_text.slice(0,100)}${e.selected_text.length>100?"…":""}”`}),l.jsxs("div",{className:"thread-card-header-right",children:[e.selected_text!==null&&l.jsx("button",{className:"thread-locate-btn",onClick:re=>{re.stopPropagation(),f()},title:"Scroll to text",children:l.jsx(D1,{size:12})}),l.jsx("span",{className:`thread-status-badge ${e.status==="open"?"thread-status-open":"thread-status-resolved"}`,children:e.status==="open"?"Open":"Resolved"})]})]}),v&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"thread-card-conversation",ref:S,onMouseDown:ce,children:[n.map(re=>l.jsx(qy,{turn:re},re.id)),n.length===0&&l.jsx("div",{className:"thread-card-placeholder",children:"No messages yet."})]}),E&&l.jsx("div",{className:"selection-actions",style:{left:T.x,top:T.y},children:l.jsxs("button",{className:"discuss-button",onClick:me,title:"Quote this text in your follow-up",children:[l.jsx(Bv,{size:14}),l.jsx("span",{children:"Quote"})]})}),e.status==="open"&&l.jsxs("div",{className:"thread-card-followup",children:[l.jsx("textarea",{ref:x,className:"thread-card-followup-input",placeholder:M?"Agent is running…":"Type a follow-up…",value:h,onChange:re=>{Lt.markInputChange(),g(re.target.value),Q()},disabled:M,rows:1,style:{minHeight:O,maxHeight:X},onKeyDown:re=>{Lt.markKeystroke(),re.key==="Enter"&&(re.metaKey||re.ctrlKey)&&!M&&h.trim()&&(re.preventDefault(),d(h.trim()),g(""),P(O))}}),l.jsx("button",{className:"thread-card-followup-send",disabled:M||!h.trim(),onClick:()=>{d(h.trim()),g("")},children:l.jsx(Hi,{size:13})}),M&&l.jsx("button",{className:"thread-card-followup-stop",onClick:r,title:"Stop this thread's turn (Esc)",children:l.jsx(yr,{size:13})})]}),l.jsxs("div",{className:"thread-card-actions",children:[e.status==="open"?l.jsxs("button",{className:"thread-action-btn",onClick:o,title:"Resolve thread",children:[l.jsx(jl,{size:13})," Resolve"]}):l.jsxs("button",{className:"thread-action-btn",onClick:a,title:"Reopen thread",children:[l.jsx($i,{size:13})," Reopen"]}),l.jsxs("button",{className:"thread-action-btn thread-action-danger",onClick:c,title:"Delete thread",children:[l.jsx(us,{size:13})," Delete"]})]})]})]})}function zC(){Lt.trackRender("ThreadsPanel");const e=A(N=>N.activeSessionId),n=A(N=>{var _;return N.activeSessionId?((_=N.sessionDetails[N.activeSessionId])==null?void 0:_.threads)??Ig:Ig}),r=y.useMemo(()=>n.filter(N=>!Nf(N)),[n]),o=A(N=>N.followupThread),a=A(N=>N.cancelThreadTurn),c=A(N=>N.reopenThread),d=A(N=>N.deleteThread),f=A(N=>N.deepLinkThreadId),h=A(N=>N.setDeepLinkThreadId),[g,v]=y.useState("open"),[k,x]=y.useState(null);y.useEffect(()=>{if(!f)return;const N=f;h(null),v(z=>r.some(M=>M.id===N&&M.status==="open")?z:"all");const _=setTimeout(()=>{const z=document.getElementById(`thread-${N}`);z&&(z.scrollIntoView({behavior:"smooth",block:"center"}),z.classList.add("thread-card-highlighted"),setTimeout(()=>z.classList.remove("thread-card-highlighted"),1500))},100);return()=>clearTimeout(_)},[f,h,r]);const S=r.filter(N=>g==="open"?N.status==="open":g==="resolved"?N.status==="resolved":!0),E=r.filter(N=>N.status==="open").length,b=r.filter(N=>N.status==="resolved").length;function T(N){setTimeout(()=>{const _=document.querySelector(`mark[data-thread-id="${N}"]`);_&&(_.scrollIntoView({behavior:"smooth",block:"center"}),_.classList.add("thread-mark-flash"),setTimeout(()=>_.classList.remove("thread-mark-flash"),1500))},50)}return e?r.length===0?l.jsxs("div",{className:"empty-state",children:[l.jsx(Uv,{size:24,style:{opacity:.3,marginBottom:8}}),l.jsx("div",{children:"No threads yet."}),l.jsx("div",{style:{fontSize:"11px",marginTop:"4px"},children:"Select text in an agent response to start a discussion."})]}):l.jsxs("div",{children:[l.jsxs("div",{className:"thread-filter-tabs",children:[l.jsxs("button",{className:`thread-filter-tab ${g==="open"?"active":""}`,onClick:()=>v("open"),children:["Open (",E,")"]}),l.jsxs("button",{className:`thread-filter-tab ${g==="resolved"?"active":""}`,onClick:()=>v("resolved"),children:["Resolved (",b,")"]}),l.jsxs("button",{className:`thread-filter-tab ${g==="all"?"active":""}`,onClick:()=>v("all"),children:["All (",r.length,")"]})]}),S.length===0?l.jsxs("div",{className:"empty-state",style:{padding:"20px 0"},children:["No ",g," threads."]}):S.map(N=>l.jsx(PC,{thread:N,threadTurns:N.turns??[],onStop:()=>a(e,N.id),onResolve:()=>x(N),onReopen:()=>c(e,N.id),onDelete:()=>d(e,N.id),onFollowup:_=>o(e,N.id,_),onLocate:()=>T(N.id)},N.id)),k&&l.jsx(MC,{thread:k,onClose:()=>x(null)})]}):l.jsx("div",{className:"empty-state",children:"No session selected"})}function FC(){const e=A(d=>d.apps),n=A(d=>d.activeAppTabId),r=A(d=>d.openAppTab),o=A(d=>d.startAppEdit),a=A(d=>d.toggleAppPin),c=A(d=>d.deleteApp);return e.length===0?l.jsx("div",{className:"empty-state",style:{padding:"16px"},children:"No mini apps yet. Add one with the + button in the sidebar Apps section."}):l.jsx("div",{className:"apps-panel",children:e.map(d=>l.jsxs("div",{className:`apps-panel-row${n===d.id?" active":""}`,onClick:()=>r(d.id),title:d.description??void 0,children:[l.jsx(Do,{iconNode:d.iconNode,size:14,className:"sidebar-app-icon"}),l.jsxs("div",{className:"apps-panel-info",children:[l.jsx("span",{className:"apps-panel-title",children:d.title}),d.description&&l.jsx("span",{className:"apps-panel-desc",children:d.description})]}),l.jsx("button",{className:"apps-panel-action",title:"Edit app with the agent",onClick:f=>{f.stopPropagation(),o(d.id)},children:l.jsx(hl,{size:12})}),l.jsx("button",{className:`apps-panel-action${d.pinned?" pinned":""}`,title:d.pinned?"Unpin app":"Pin app (sorts first)",onClick:f=>{f.stopPropagation(),a(d.id)},children:l.jsx(Rl,{size:12,fill:d.pinned?"currentColor":"none"})}),l.jsx("button",{className:"apps-panel-action apps-panel-danger",title:"Delete app",onClick:f=>{f.stopPropagation(),c(d.id)},children:l.jsx(us,{size:12})})]},d.id))})}const UC=24;function BC(){Lt.trackRender("SidecarPanel");const e=A(N=>N.activeSessionId),n=A(N=>{var _;return N.activeSessionId?(_=N.sessionDetails[N.activeSessionId])==null?void 0:_.runtime_type:void 0}),r=A(N=>{var _;return N.activeSessionId?IC((_=N.sessionDetails[N.activeSessionId])==null?void 0:_.threads):null}),o=A(N=>N.askSidecar),a=A(N=>N.cancelThreadTurn),c=A(N=>N.deleteThread),[d,f]=y.useState(""),[h,g]=y.useState(!1),v=y.useRef(null),k=y.useRef(!0),x=(r==null?void 0:r.turns)??[],S=x[x.length-1],E=x.some(Fs);if(y.useEffect(()=>{k.current=!0},[e,x.length]),y.useEffect(()=>{const N=v.current;N&&k.current&&(N.scrollTop=N.scrollHeight)},[e,x.length,S==null?void 0:S.items.length,S==null?void 0:S.status]),!e||!n)return l.jsx("div",{className:"empty-state",children:"No session selected"});if(!AC(n))return l.jsxs("div",{className:"empty-state",children:[l.jsx(vr,{size:24,style:{opacity:.3,marginBottom:8}}),l.jsxs("div",{children:["The sidecar is not available for ",n," sessions yet."]})]});const b=!E&&!h&&d.trim().length>0;async function T(){if(!e||!b)return;g(!0);const N=await o(e,d.trim());g(!1),N&&f("")}return l.jsxs("div",{className:"sidecar-panel",children:[l.jsx("div",{ref:v,className:"sidecar-conversation",onScroll:N=>{const _=N.currentTarget;k.current=_.scrollHeight-_.scrollTop-_.clientHeight<=UC},children:x.length===0?l.jsxs("div",{className:"empty-state",children:[l.jsx(vr,{size:24,style:{opacity:.3,marginBottom:8}}),l.jsx("div",{children:"Ask about this session."}),l.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(N=>l.jsx(qy,{turn:N,formatPrompt:DC},N.id))}),l.jsxs("div",{className:"sidecar-footer",children:[l.jsxs("div",{className:"thread-card-followup",children:[l.jsx("textarea",{className:"thread-card-followup-input","aria-label":"Ask the sidecar",placeholder:E?"Sidecar is answering…":"Ask about this session… (⌘/Ctrl+Enter)",value:d,rows:2,disabled:E,onChange:N=>{Lt.markInputChange(),f(N.target.value)},onKeyDown:N=>{Lt.markKeystroke(),N.key==="Enter"&&(N.metaKey||N.ctrlKey)&&(N.preventDefault(),T())}}),E&&r?l.jsx("button",{className:"thread-card-followup-stop",title:"Stop the answer","aria-label":"Stop the answer",onClick:()=>a(e,r.id),children:l.jsx(yr,{size:13})}):l.jsx("button",{className:"thread-card-followup-send",title:"Ask","aria-label":"Ask",disabled:!b,onClick:()=>void T(),children:l.jsx(Hi,{size:13})})]}),r&&l.jsx("div",{className:"thread-card-actions",children:l.jsxs("button",{className:"thread-action-btn thread-action-danger",title:"Clear the sidecar conversation",disabled:E,onClick:()=>c(e,r.id),children:[l.jsx(us,{size:13})," Clear"]})})]})]})}function WC(){var h;Lt.trackRender("RightPanel");const e=A(g=>g.activeRightTab),n=A(g=>g.switchRightTab),r=A(g=>g.rightPanelCollapsed),o=A(g=>g.toggleRightPanel),a=A(g=>g.activeSessionId?g.sessionDetails[g.activeSessionId]:null),c=A(g=>g.activeSessionId?Sf(g.backgroundTasks[g.activeSessionId]):0),d=((h=a==null?void 0:a.threads)==null?void 0:h.filter(g=>g.status==="open"&&!Nf(g)).length)??0,f=[{id:"turns",label:"Turns",icon:E1},{id:"sidecar",label:"Sidecar",icon:vr},{id:"tasks",label:"Tasks",icon:C1,badge:c||void 0},{id:"threads",label:"Threads",icon:Uv,badge:d||void 0},{id:"apps",label:"Apps",icon:Fv}];return r?l.jsxs("div",{className:"ide-right collapsed",children:[l.jsx("button",{type:"button",className:"right-icon-btn",title:"Expand panel","aria-label":"Expand panel","aria-expanded":!1,onClick:o,children:l.jsx(L1,{size:15})}),l.jsx("div",{className:"right-rail-divider"}),f.map(g=>{const v=g.icon,k=g.badge?`${g.label} (${g.badge})`:g.label;return l.jsxs("button",{type:"button",className:`right-icon-btn right-rail-tab ${e===g.id?"active":""}`,title:k,"aria-label":k,onClick:()=>n(g.id),children:[l.jsx(v,{size:15}),g.badge?l.jsx("span",{className:"right-tab-badge",children:g.badge}):null]},g.id)})]}):l.jsxs("div",{className:"ide-right",children:[l.jsxs("div",{className:"right-header",children:[l.jsx("div",{className:"right-tabs",children:f.map(g=>l.jsxs("div",{className:`right-tab ${e===g.id?"active":""}`,onClick:()=>n(g.id),children:[g.label,g.badge?l.jsx("span",{className:"right-tab-badge",children:g.badge}):null]},g.id))}),l.jsx("button",{type:"button",className:"right-icon-btn right-collapse-btn",title:"Collapse panel","aria-label":"Collapse panel","aria-expanded":!0,onClick:o,children:l.jsx(M1,{size:14})})]}),l.jsxs("div",{className:"right-content",children:[e==="turns"&&l.jsx(SC,{}),e==="sidecar"&&l.jsx(BC,{}),e==="tasks"&&l.jsx(jC,{}),e==="threads"&&l.jsx(zC,{}),e==="apps"&&l.jsx(FC,{})]})]})}const De={low:{effort:"low",label:"Low"},medium:{effort:"medium",label:"Medium"},high:{effort:"high",label:"High"},xhigh:{effort:"xhigh",label:"Extra High"},max:{effort:"max",label:"Max"},ultra:{effort:"ultra",label:"Ultra"}},Ld=[{id:"codex",label:"Codex",available:!0,models:[{slug:"gpt-5.6-sol",displayName:"GPT-5.6-Sol",description:"Flagship — complex, open-ended work",defaultReasoning:"low",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max,De.ultra]},{slug:"gpt-5.6-terra",displayName:"GPT-5.6-Terra",description:"Balanced all-rounder for everyday work",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max,De.ultra]},{slug:"gpt-5.6-luna",displayName:"GPT-5.6-Luna",description:"Fast, affordable — clear, repeatable tasks",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max]},{slug:"gpt-5.5",displayName:"GPT-5.5",description:"Previous-gen frontier model",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh]}]},{id:"claude",label:"Claude",available:!0,models:[{slug:"claude-sonnet-5-5",displayName:"Claude Sonnet 5.5",description:"Best combination of speed and intelligence",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max]},{slug:"claude-sonnet-5",displayName:"Claude Sonnet 5",description:"Previous-gen balanced all-rounder",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max]},{slug:"claude-opus-5",displayName:"Claude Opus 5",description:"Deep reasoning for complex tasks",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max]},{slug:"claude-fable-5",displayName:"Claude Fable 5",description:"Fast and efficient for simple tasks",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max]}]},{id:"repoburg",label:"Repoburg",available:!0,models:[{slug:"ollama/glm-5.3:cloud",displayName:"GLM-5.3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high]},{slug:"ollama/glm-5.3-flash:cloud",displayName:"GLM-5.3 Flash",description:"Ollama Cloud — fast",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high]},{slug:"ollama/minimax-m3:cloud",displayName:"MiniMax M3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high]},{slug:"ollama/deepseek-v4-pro:cloud",displayName:"DeepSeek V4 Pro",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high]}]}];function HC(e){return Ld.find(n=>n.id===e)}function Tf(e){const n=HC(e);return(n==null?void 0:n.models)??[]}function Xy(e,n){return Tf(e).find(r=>r.slug===n)}function Od(e,n){var r;return((r=Xy(e,n))==null?void 0:r.reasoningLevels)??[]}function $d(e,n){var r;return(r=Xy(e,n))==null?void 0:r.defaultReasoning}function VC(){const{activeSessionId:e,sessions:n,updateModelConfig:r}=A(),o=A(J=>J.showModelSelector),a=A(J=>J.setShowModelSelector),c=n.find(J=>J.id===e),d=A(J=>J.models),f=A(J=>J.modelsLoading),h=A(J=>J.loadModels),[g,v]=y.useState(!1),k=y.useRef(null);if(Wi(k,()=>v(!1),g),Io(()=>v(!1),g),y.useEffect(()=>{o&&(v(!0),a(!1))},[o,a]),y.useEffect(()=>{c!=null&&c.runtime_type&&h(c.runtime_type,c.cwd??void 0)},[c==null?void 0:c.runtime_type,c==null?void 0:c.cwd,h]),!c)return null;const x=c.runtime_type,S=c.model??"",E=c.model_reasoning_effort??"",b=d.length>0?d:[],T=Tf(x),_=[...b.length>0?b:T];if(S&&!_.some(J=>J.slug===S)){const J=T[0];_.unshift({slug:S,displayName:S,description:"Custom model",defaultReasoning:(J==null?void 0:J.defaultReasoning)??"medium",reasoningLevels:(J==null?void 0:J.reasoningLevels)??[]})}function z(J){return _.find(re=>re.slug===J)}function M(J){var re;return b.length>0?((re=z(J))==null?void 0:re.reasoningLevels)??[]:Od(x,J)}function O(J){var re;return b.length>0?(re=z(J))==null?void 0:re.defaultReasoning:$d(x,J)}const X=Ld.find(J=>J.id===x),U=z(S),P=S?M(S):[],Q=(X==null?void 0:X.label)??x,ce=(U==null?void 0:U.displayName)??(S||"Default"),ue=P.find(J=>J.effort===E),me=(ue==null?void 0:ue.label)??(E||"Default");function Ne(J){var Z;const re=M(J),F=re.some(G=>G.effort===E)?E:O(J)??((Z=re[0])==null?void 0:Z.effort)??"";r(J,F),v(!1)}function Me(J){r(S,J),v(!1)}return l.jsxs("div",{className:"model-selector",ref:k,children:[l.jsxs("button",{className:"model-selector-btn",onClick:()=>v(!g),title:"Change model and thinking level",children:[l.jsx("span",{className:"model-selector-provider",children:Q}),l.jsx("span",{className:"model-selector-sep",children:"›"}),l.jsx("span",{className:"model-selector-model",children:ce}),me!=="Default"&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"model-selector-sep",children:"›"}),l.jsx("span",{className:"model-selector-reasoning",children:me})]}),l.jsx(_o,{size:12,className:"model-selector-chevron"})]}),g&&l.jsxs("div",{className:"model-selector-popover",children:[l.jsxs("div",{className:"model-selector-column",children:[l.jsx("div",{className:"model-selector-col-header",children:"Provider"}),Ld.map(J=>l.jsxs("div",{className:`model-selector-item ${J.id===x?"selected":""} ${J.available?"":"disabled"}`,onClick:()=>{if(J.available){if(J.id===x){v(!1);return}r("","",J.id)}},children:[l.jsx("span",{children:J.label}),!J.available&&l.jsxs("span",{className:"model-selector-coming-soon",children:[l.jsx(R1,{size:10})," Soon"]}),J.id===x&&l.jsx(Cs,{size:12})]},J.id))]}),l.jsxs("div",{className:"model-selector-column",children:[l.jsx("div",{className:"model-selector-col-header",children:"Model"}),f&&l.jsx("div",{className:"model-selector-empty",children:"Loading models…"}),!f&&_.length===0&&l.jsx("div",{className:"model-selector-empty",children:"No models available"}),_.map(J=>l.jsxs("div",{className:`model-selector-item ${J.slug===S?"selected":""}`,onClick:()=>Ne(J.slug),children:[l.jsxs("div",{className:"model-selector-item-main",children:[l.jsx("span",{className:"model-selector-item-name",children:J.displayName}),l.jsx("span",{className:"model-selector-item-desc",children:J.description})]}),J.slug===S&&l.jsx(Cs,{size:12})]},J.slug))]}),l.jsxs("div",{className:"model-selector-column",children:[l.jsx("div",{className:"model-selector-col-header",children:"Thinking"}),P.length===0&&l.jsx("div",{className:"model-selector-empty",children:"Select a model first"}),P.map(J=>l.jsxs("div",{className:`model-selector-item ${J.effort===E?"selected":""}`,onClick:()=>Me(J.effort),children:[l.jsx("span",{children:J.label}),J.effort===E&&l.jsx(Cs,{size:12})]},J.effort))]})]})]})}function bi(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6===0?0:1)}M`:e>=1e3?`${Math.round(e/1e3)}K`:String(e)}function Dg(){const e=A(r=>r.canGoBack),n=A(r=>r.canGoForward);return l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"sb-item sb-btn",title:"Back","aria-label":"Back",disabled:!e,onClick:()=>window.history.back(),children:l.jsx(d1,{size:14})}),l.jsx("button",{className:"sb-item sb-btn",title:"Forward","aria-label":"Forward",disabled:!n,onClick:()=>window.history.forward(),children:l.jsx(f1,{size:14})})]})}function Mg(){const e=A(n=>n.setShowRemoteModal);return l.jsxs("div",{className:"sb-item",style:{cursor:"pointer"},title:"Remote access — make this machine remote",onClick:()=>e(!0),children:[l.jsx(q1,{size:14})," Repoburg"]})}function Lg(){const e=A(r=>r.usageViewOpen),n=A(r=>r.toggleUsageView);return l.jsxs("button",{className:`sb-item sb-btn${e?" sb-item-active":""}`,title:e?"Back to the agent view":"Usage Center",onClick:n,children:[l.jsx($v,{size:14})," Usage"]})}function Og(){const e=A(r=>r.vscodeViewOpen),n=A(r=>r.toggleVscodeView);return l.jsxs("button",{className:`sb-item sb-btn${e?" sb-item-active":""}`,title:e?"Back to the agent view":"Open VS Code",onClick:n,children:[l.jsx(y1,{size:14})," Code"]})}function $g(){const e=A(r=>r.terminalViewOpen),n=A(r=>r.toggleTerminalView);return l.jsxs("button",{className:`sb-item sb-btn${e?" sb-item-active":""}`,title:e?"Back to the agent view":"Open a terminal",onClick:n,children:[l.jsx(Vv,{size:14})," Terminal"]})}function KC(){Lt.trackRender("StatusBar");const e=A(v=>v.activeSessionId),n=A(v=>e?v.sessions.find(k=>k.id===e)??null:null),r=A(v=>e?v.sessionDetails[e]??null:null),o=A(v=>e?v.backgroundTasks[e]:void 0),a=A(v=>v.wsConnected),c=A(v=>v.switchRightTab),d=(r==null?void 0:r.contextUsage)??null;if(!n)return l.jsxs("div",{className:"ide-statusbar",children:[l.jsx(Dg,{}),l.jsx(Mg,{}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsx(Og,{}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsx($g,{}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsx(Lg,{}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsx("div",{className:"sb-item",title:a?"WebSocket connected":"WebSocket disconnected",children:a?"Live":"Offline"}),l.jsx("div",{className:"sb-spacer"}),l.jsxs("div",{className:"sb-item",children:[l.jsx(Am,{size:14})," K"]})]});const f=o??[],h=Xl(n,f.length),g=Sf(f);return l.jsxs("div",{className:"ide-statusbar",children:[l.jsx(Dg,{}),l.jsx(Mg,{}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsx(Og,{}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsx($g,{}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsx(Lg,{}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsx(VC,{}),g>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"sb-divider",children:"|"}),l.jsxs("div",{className:"sb-item",style:{color:"var(--amber)",cursor:"pointer"},title:`${g} Monitor task${g>1?"s":""} running — click to view`,onClick:()=>c("tasks"),children:[l.jsx(Ql,{size:14})," ",g]})]}),l.jsx("div",{className:"sb-spacer"}),l.jsx("div",{className:"sb-item",title:a?"WebSocket connected":"WebSocket disconnected",children:a?"Live":"Offline"}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsx("div",{className:"sb-item",style:h.dot==="background"?{color:"var(--purple)"}:n.status==="failed"?{color:"var(--red)"}:void 0,title:h.dot==="background"?h.dotTitle:void 0,children:h.label}),d&&l.jsx(GC,{usage:d}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsxs("div",{className:"sb-item",children:[l.jsx(Am,{size:14})," K"]})]})}function GC({usage:e}){const n=e.percentage>=85?"var(--red)":e.percentage>=60?"var(--amber)":"var(--green)",r=`${bi(e.totalTokens)} / ${bi(e.contextWindow)} tokens`+(e.autoCompactThreshold?` · auto-compacts at ${bi(e.autoCompactThreshold)}`:"");return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"sb-divider",children:"|"}),l.jsx("div",{className:"sb-context",title:r,children:l.jsxs("span",{className:"sb-context-text",style:{color:n},children:[Math.round(e.percentage),"% / ",bi(e.totalTokens)," / ",bi(e.contextWindow)]})})]})}function Pg(e){return kt(`/vscode-web/status?folder=${encodeURIComponent(e??"")}`)}function qC(e){return st("/vscode-web/start",{folder:e})}function XC(e){return st("/vscode-web/heartbeat",{id:e})}const YC=1e3,QC=5*6e4;function zg({children:e}){const n=A(r=>r.toggleVscodeView);return l.jsxs("div",{className:"vscode-view vscode-view--loading",children:[e,l.jsx("button",{className:"dialog-close vscode-view-close",title:"Close VS Code view","aria-label":"Close VS Code view",onClick:n,children:l.jsx(Tn,{size:16})})]})}function ZC(){const e=A(E=>E.vscodeState),n=A(E=>E.vscodeId),r=A(E=>E.vscodeToken),o=A(E=>E.setVscodeView),a=A(E=>{var T;const b=E.activeSessionId?E.sessions.find(N=>N.id===E.activeSessionId):null;return b!=null&&b.cwd?b.cwd:((T=E.workspaces.find(N=>N.deleted===0))==null?void 0:T.path)??null}),[c,d]=y.useState(!1),[f,h]=y.useState(0),g=y.useRef(null),v=mn(),k=v===""||v===window.location.origin,x=`${v}/vscode/${n??""}/?tkn=${r??""}${a?`&folder=${encodeURIComponent(a)}`:""}`;y.useEffect(()=>{let E=!1;function b(){g.current&&(clearInterval(g.current),g.current=null)}async function T(){try{let _=await Pg(a);if((_.state==="stopped"||_.state==="error")&&(_=await qC(a)),E||(o(_.state,_.id,_.token),_.state==="running"||_.state==="error"))return;g.current=setInterval(async()=>{const z=await Pg(a);E||(o(z.state,z.id,z.token),(z.state==="running"||z.state==="error"||z.state==="stopped")&&b())},YC)}catch{E||o("error",null,null)}}T();const N=setInterval(()=>{const _=A.getState().vscodeId;_&&XC(_).catch(()=>{})},QC);return()=>{E=!0,b(),clearInterval(N)}},[f,a,o]);function S(){d(!1),o("starting",null,null),h(E=>E+1)}return e!=="running"||!r||!n?l.jsx(zg,{children:e==="error"?l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"VS Code could not start."}),l.jsxs("button",{className:"dialog-btn-cancel",onClick:S,children:[l.jsx($i,{size:14})," Retry"]})]}):l.jsxs("span",{className:"vscode-view-hint",children:[l.jsx(hn,{size:16,className:"spin"})," Starting VS Code — first start downloads the server component (~20 s)."]})}):k?l.jsxs("div",{className:"vscode-view",children:[!c&&l.jsxs("div",{className:"vscode-view-overlay",children:[l.jsx(hn,{size:16,className:"spin"})," Loading VS Code…"]}),l.jsx("iframe",{src:x,title:"VS Code",className:"vscode-view-frame",onLoad:()=>d(!0)},n)]}):l.jsxs(zg,{children:[l.jsx("span",{children:"VS Code cannot be embedded on this host — serve-web allows same-origin frames only."}),l.jsxs("button",{className:"dialog-btn-cancel",onClick:()=>window.open(x,"_blank","noopener"),children:[l.jsx(Lv,{size:14})," Open VS Code in a new tab"]})]})}function JC(e){const n=new URLSearchParams;return e.since&&n.set("since",e.since),e.until&&n.set("until",e.until),n.set("tz",e.timezone),e.fresh&&n.set("fresh","1"),kt(`/usage/report?${n.toString()}`)}const eE=[{id:"today",label:"Today"},{id:"7d",label:"7 days"},{id:"30d",label:"30 days"},{id:"month",label:"This month"},{id:"all",label:"All"}];function bo(e){return Math.round(e).toLocaleString("en-US")}function ts(e){return`$${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function No(e){return new Intl.NumberFormat("en-US",{notation:"compact",maximumSignificantDigits:3}).format(e)}function Cf(e){const n=e.startsWith("anthropic/claude-")?e.slice(17):e.startsWith("claude-")?e.slice(7):e,r=n.split("-");return r.length>=3&&r[r.length-1].length===8?r.slice(0,-1).join("-"):n}const tE={claude:"Claude",codex:"Codex",repoburg:"Repoburg",opencode:"OpenCode",amp:"Amp",droid:"Droid",gemini:"Gemini",copilot:"Copilot",pi:"pi",kimi:"Kimi",qwen:"Qwen"};function yl(e){return tE[e]??e.charAt(0).toUpperCase()+e.slice(1)}const Wl=e=>String(e).padStart(2,"0");function ac(e){return`${e.getFullYear()}-${Wl(e.getMonth()+1)}-${Wl(e.getDate())}`}function nE(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:`${ac(n)} ${Wl(n.getHours())}:${Wl(n.getMinutes())}`}function Fg(e,n=new Date){if(e==="all")return{since:null,until:null};const r=new Date(n.getFullYear(),n.getMonth(),n.getDate());return e==="7d"?r.setDate(r.getDate()-6):e==="30d"?r.setDate(r.getDate()-29):e==="month"&&r.setDate(1),{since:ac(r),until:null}}function Ug(e){const n=new Date(`${e}T00:00:00Z`);return n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+6)%7),n.toISOString().slice(0,10)}function Ef(e,n){const r=[],o=new Date(`${e}T00:00:00Z`),a=new Date(`${n}T00:00:00Z`);for(;o<=a&&r.length<3700;)r.push(o.toISOString().slice(0,10)),o.setUTCDate(o.getUTCDate()+1);return r}const sE=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Pd(e){const n=/^(\d{4})-(\d{2})(?:-(\d{2}))?$/.exec(e);if(!n)return e;const r=sE[Number(n[2])-1]??n[2];return n[3]?`${r} ${Number(n[3])}`:`${r} ${n[1]}`}function rE(e,n=Date.now()){const r=Math.max(0,Math.round((n-Date.parse(e))/1e3));if(r<45)return"just now";const o=Math.round(r/60);if(o<60)return`${o} min ago`;const a=Math.round(o/60);return a<24?`${a} h ago`:ac(new Date(e))}const zr=7,oE=92;function Yy(e,n){const r=n.indexOf(e);return r>=0&&r<zr?r:zr}function xl(e){return e<zr?`var(--usage-series-${e+1})`:"var(--usage-series-other)"}function iE(e,n){return Ef(Ug(e),Ug(n)).filter((r,o)=>o%7===0)}function aE(e,n){const{daily:r}=e;if(r.length===0)return null;const o=e.window.since??r[0].period,a=r[r.length-1].period,c=e.window.until??(n>a?n:a),d=Ef(o,c);if(d.length<2)return null;const f=d.length>oE,h=new Map((f?e.weekly:r).map(x=>[x.period,x])),g=new Map,v=(f?iE(o,c):d).map(x=>{const S=h.get(x),E=new Map;let b=0;for(const _ of(S==null?void 0:S.breakdown)??[]){if(_.cost_usd<=0)continue;const z=Yy(_.model,e.model_order),M=E.get(z)??{slot:z,label:z<zr?Cf(_.model):"Other",cost:0};M.cost+=_.cost_usd,b+=_.cost_usd,E.set(z,M)}const T=((S==null?void 0:S.cost_usd)??0)-b;if(T>.005){const _=E.get(zr)??{slot:zr,label:"Other",cost:0};_.cost+=T,E.set(zr,_)}const N=[...E.values()].sort((_,z)=>_.slot-z.slot);for(const _ of N)g.set(_.slot,_.label);return{period:x,label:f?`Week of ${Pd(x)}`:Pd(x),total:N.reduce((_,z)=>_+z.cost,0),segments:N}});if(!v.some(x=>x.total>0))return null;const k=[...g.entries()].sort((x,S)=>x[0]-S[0]).map(([x,S])=>({slot:x,label:S}));return{unit:f?"week":"day",columns:v,series:k}}function lE(e){if(!(e>0))return[0,1];if(e<.01)return[0,.01];const n=e/4,r=10**Math.floor(Math.log10(n)),o=n/r,a=(o<=1?1:o<=2?2:o<=2.5?2.5:o<=5?5:10)*r,c=[];for(let d=0;d*a<e+a*1e-9||c.length<2;d++)c.push(d*a);return c[c.length-1]<e&&c.push(c.length*a),c}function cE(e,n){if(e>=1e4)return`$${No(e)}`;let r=0;for(;r<3&&Math.abs(Math.round(n*10**r)-n*10**r)>1e-9;)r++;return`$${e.toLocaleString("en-US",{minimumFractionDigits:r,maximumFractionDigits:r})}`}const wo=e=>`${e}%`;function uE({data:e}){const{columns:n,series:r,unit:o}=e,[a,c]=y.useState(null),d=y.useMemo(()=>lE(Math.max(...n.map(b=>b.total))),[n]),f=d[d.length-1],h=d[1]-d[0],g=n.reduce((b,T,N)=>T.total>n[b].total?N:b,0),v=Math.max(1,Math.ceil(n.length/8)),k=n.length,x=b=>{const T={ArrowLeft:-1,ArrowRight:1,Home:-k,End:k};b.key in T&&(b.preventDefault(),c(N=>Math.min(k-1,Math.max(0,(N??k-1)+T[b.key]))))},S=a===null?null:n[a],E=a===null?0:(a+.5)/k*100;return l.jsxs("div",{className:"usage-chart",children:[l.jsxs("div",{className:"usage-chart-head",children:[l.jsx("div",{className:"usage-section-title",children:o==="week"?"Weekly cost (USD)":"Daily cost (USD)"}),r.length>=2&&l.jsx("ul",{className:"usage-legend","aria-label":"Models",children:r.map(b=>l.jsxs("li",{className:"usage-legend-item",children:[l.jsx("span",{className:"usage-swatch",style:{background:xl(b.slot)}}),b.label]},b.slot))})]}),l.jsxs("div",{className:"usage-plot-wrap",children:[l.jsx("div",{className:"usage-yaxis","aria-hidden":"true",children:d.map(b=>l.jsx("span",{className:"usage-ytick",style:{bottom:wo(b/f*100)},children:cE(b,h)},b))}),l.jsxs("div",{className:"usage-plot",role:"group",tabIndex:0,"aria-label":`${o==="week"?"Weekly":"Daily"} cost chart. Arrow keys move between ${o}s.`,onKeyDown:x,onFocus:()=>c(b=>b??k-1),onBlur:()=>c(null),onMouseLeave:()=>c(null),children:[d.map(b=>l.jsx("div",{className:`usage-gridline${b===0?" usage-gridline-base":""}`,style:{bottom:wo(b/f*100)}},b)),l.jsx("div",{className:"usage-cols",children:n.map((b,T)=>l.jsxs("div",{className:`usage-col${a===T?" usage-col-active":""}`,"data-period":b.period,onMouseEnter:()=>c(T),children:[T===g&&b.total>0&&a!==T&&l.jsx("span",{className:"usage-peak",style:{bottom:`calc(${wo(b.total/f*100)} + 3px)`},children:ts(b.total)}),b.total>0&&l.jsx("div",{className:"usage-bar",style:{height:wo(b.total/f*100)},children:b.segments.map(N=>l.jsx("div",{className:"usage-seg",style:{flexGrow:N.cost,background:xl(N.slot)}},N.slot))})]},b.period))}),S&&l.jsxs("div",{className:"usage-tooltip",role:"status",style:{left:wo(E),transform:E<20?"translateX(-12px)":E>80?"translateX(calc(-100% + 12px))":"translateX(-50%)"},children:[l.jsxs("div",{className:"usage-tooltip-head",children:[l.jsx("span",{children:S.label}),l.jsx("strong",{children:ts(S.total)})]}),S.segments.length===0&&l.jsx("div",{className:"usage-tooltip-empty",children:"No usage"}),[...S.segments].sort((b,T)=>T.cost-b.cost).map(b=>l.jsxs("div",{className:"usage-tooltip-line",children:[l.jsx("span",{className:"usage-swatch",style:{background:xl(b.slot)}}),l.jsx("span",{className:"usage-tooltip-model",children:b.label}),l.jsx("span",{children:ts(b.cost)})]},b.slot))]})]}),l.jsx("div",{}),l.jsx("div",{className:"usage-xaxis","aria-hidden":"true",children:n.map((b,T)=>(k-1-T)%v===0?l.jsx("span",{className:"usage-xtick",style:{left:wo((T+.5)/k*100),transform:T===0&&k>1?"translateX(-30%)":T===k-1?"translateX(-70%)":"translateX(-50%)"},children:Pd(b.period)},b.period):null)})]})]})}const Bg=[{id:"daily",label:"Daily",column:"Date"},{id:"weekly",label:"Weekly",column:"Week"},{id:"monthly",label:"Monthly",column:"Month"},{id:"session",label:"Session",column:"Session"}],dE={weekly:"Weeks start on Monday.",session:"Sessions last active in this range, with their whole usage."},fd=50,fE={input_tokens:0,output_tokens:0,cache_creation_tokens:0,cache_read_tokens:0,total_tokens:0,cost_usd:0};function pE(e){return e.reduce((n,r)=>({input_tokens:n.input_tokens+r.input_tokens,output_tokens:n.output_tokens+r.output_tokens,cache_creation_tokens:n.cache_creation_tokens+r.cache_creation_tokens,cache_read_tokens:n.cache_read_tokens+r.cache_read_tokens,total_tokens:n.total_tokens+r.total_tokens,cost_usd:n.cost_usd+r.cost_usd}),fE)}function pd({t:e}){return l.jsxs(l.Fragment,{children:[l.jsx("td",{className:"usage-num",children:bo(e.input_tokens)}),l.jsx("td",{className:"usage-num",children:bo(e.output_tokens)}),l.jsx("td",{className:"usage-num",children:bo(e.cache_creation_tokens)}),l.jsx("td",{className:"usage-num",children:bo(e.cache_read_tokens)}),l.jsx("td",{className:"usage-num",children:bo(e.total_tokens)}),l.jsx("td",{className:"usage-num usage-cost",children:ts(e.cost_usd)})]})}function hE({models:e,order:n}){return l.jsx("span",{className:"usage-models",children:e.map(r=>l.jsxs("span",{className:"usage-model",title:r,children:[l.jsx("span",{className:"usage-swatch",style:{background:xl(Yy(r,n))}}),Cf(r)]},r))})}function mE({row:e,onOpen:n}){const r=e.pane_session;if(!r)return l.jsx("span",{className:"usage-session-id usage-session-id-main",title:e.period,children:e.period});const o=r.title||"Untitled session";return l.jsxs("span",{className:"usage-session",children:[l.jsxs("span",{className:"usage-session-title",children:[l.jsx("button",{className:"usage-session-link",title:`Open "${o}"`,onClick:()=>n(r.id),children:o}),r.kind==="discussion"&&l.jsx("span",{className:"usage-tag",children:"discussion"})]}),l.jsx("span",{className:"usage-session-id",title:e.period,children:e.period})]})}function gE({report:e,onOpenSession:n}){var E;const[r,o]=y.useState("daily"),[a,c]=y.useState(!1),[d,f]=y.useState(!1),h=r==="session",g=h?e.sessions:e[r],v=h&&!d?g.slice(0,fd):g,k=h?pE(e.sessions):e.totals,x=h?10:9,S=dE[r];return l.jsxs("div",{className:"usage-table-wrap",children:[l.jsxs("div",{className:"usage-table-head",children:[l.jsx("div",{className:"usage-tabs",role:"tablist","aria-label":"Report",children:Bg.map(b=>l.jsx("button",{role:"tab","aria-selected":r===b.id,className:`usage-tab${r===b.id?" usage-tab-active":""}`,onClick:()=>o(b.id),children:b.label},b.id))}),S&&l.jsx("span",{className:"usage-table-note",children:S}),l.jsxs("label",{className:"usage-check",title:"One line per agent and model, like ccusage --breakdown",children:[l.jsx("input",{type:"checkbox",checked:a,onChange:b=>c(b.target.checked)}),"Breakdown"]})]}),l.jsx("div",{className:"usage-table-scroll",role:"tabpanel",children:l.jsxs("table",{className:"usage-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:(E=Bg.find(b=>b.id===r))==null?void 0:E.column}),l.jsx("th",{children:"Agent"}),l.jsx("th",{children:"Models"}),l.jsx("th",{className:"usage-num",children:"Input"}),l.jsx("th",{className:"usage-num",children:"Output"}),l.jsx("th",{className:"usage-num",children:"Cache Create"}),l.jsx("th",{className:"usage-num",children:"Cache Read"}),l.jsx("th",{className:"usage-num",children:"Total Tokens"}),l.jsx("th",{className:"usage-num",children:"Cost (USD)"}),h&&l.jsx("th",{children:"Last Activity"})]})}),l.jsxs("tbody",{children:[g.length===0&&l.jsx("tr",{children:l.jsx("td",{colSpan:x,className:"usage-empty",children:"No usage in this range."})}),v.map(b=>{const T=h?b:null;return l.jsxs(y.Fragment,{children:[l.jsxs("tr",{className:"usage-row",children:[l.jsx("td",{className:"usage-period",children:T?l.jsx(mE,{row:T,onOpen:n}):b.period}),l.jsx("td",{children:T?yl(T.agent):b.agents.map(yl).join(", ")}),l.jsx("td",{children:l.jsx(hE,{models:b.models,order:e.model_order})}),l.jsx(pd,{t:b}),T&&l.jsx("td",{className:"usage-when",children:T.last_activity?nE(T.last_activity):"—"})]}),a&&b.breakdown.map(N=>l.jsxs("tr",{className:"usage-sub",children:[l.jsx("td",{}),l.jsx("td",{children:yl(N.agent)}),l.jsxs("td",{title:N.model,children:[l.jsx("span",{className:"usage-branch",children:"└─"})," ",Cf(N.model)]}),l.jsx(pd,{t:N}),T&&l.jsx("td",{})]},`${N.agent}\0${N.model}`))]},b.period)})]}),g.length>0&&l.jsx("tfoot",{children:l.jsxs("tr",{className:"usage-total",children:[l.jsx("td",{children:"Total"}),l.jsx("td",{}),l.jsx("td",{}),l.jsx(pd,{t:k}),h&&l.jsx("td",{})]})})]})}),h&&g.length>fd&&l.jsx("button",{className:"usage-more",onClick:()=>f(b=>!b),children:d?`Show the top ${fd}`:`Show all ${g.length} sessions`})]})}const Qy="agentpane:usage-budget",vE=6e4;function yE(){try{const e=Number(localStorage.getItem(Qy));return Number.isFinite(e)&&e>0?e:0}catch{return 0}}function xE(e){try{localStorage.setItem(Qy,String(e))}catch{}}function wE(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function wl({label:e,value:n,title:r,children:o}){return l.jsxs("div",{className:"usage-kpi",children:[l.jsx("div",{className:"usage-kpi-label",children:e}),l.jsx("div",{className:"usage-kpi-value",title:r,children:n}),o]})}function kE({spent:e}){const[n,r]=y.useState(yE),o=n>0?e/n:0,a=o>=1?"over":o>=.8?"near":"ok",c=d=>{const f=Number(d.replace(",",".")),h=Number.isFinite(f)&&f>0?f:0;r(h),xE(h)};return l.jsxs(wl,{label:"This month",value:ts(e),children:[n>0?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:`usage-meter usage-meter-${a}`,role:"meter","aria-label":"Monthly budget used","aria-valuemin":0,"aria-valuemax":n,"aria-valuenow":Math.min(e,n),children:l.jsx("div",{className:"usage-meter-fill",style:{width:`${Math.min(100,o*100)}%`}})}),l.jsx("div",{className:`usage-kpi-sub${a==="over"?" usage-over":""}`,children:a==="over"?l.jsxs(l.Fragment,{children:[l.jsx(Zl,{size:11})," ",ts(e-n)," over the ",ts(n)," budget"]}):`${ts(n-e)} left of ${ts(n)}`})]}):l.jsx("div",{className:"usage-kpi-sub",children:"No monthly budget set"}),l.jsxs("div",{className:"usage-budget",children:[l.jsx("label",{htmlFor:"usage-budget-input",children:"Monthly budget (USD)"}),l.jsx("input",{id:"usage-budget-input",type:"number",min:"0",step:"1",defaultValue:n>0?n:"",placeholder:"none",onBlur:d=>c(d.target.value),onKeyDown:d=>{d.key==="Enter"&&c(d.currentTarget.value)}})]})]})}const SE=(e,n)=>e.since===n.since&&e.until===n.until;function bE(){const e=A(z=>z.toggleUsageView),n=A(z=>z.selectSession),[r,o]=y.useState("30d"),[a,c]=y.useState(null),[d,f]=y.useState(null),[h,g]=y.useState(!1),v=y.useMemo(wE,[]),k=y.useRef(0),x=y.useCallback(z=>{const M=++k.current,{since:O,until:X}=Fg(r),U=async P=>{const Q=await JC({since:O,until:X,timezone:v,fresh:P});M===k.current&&(c(Q),f(null),!P&&Q.generated_at&&Date.now()-Date.parse(Q.generated_at)>vE&&await U(!0))};g(!0),U(z).catch(P=>{M===k.current&&f(P.message)}).finally(()=>{M===k.current&&g(!1)})},[r,v]);y.useEffect(()=>{x(!1)},[x]),y.useEffect(()=>()=>{k.current++},[]);const S=z=>{e(),n(z)},E=ac(new Date),b=y.useMemo(()=>a?aE(a,E):null,[a,E]),T=h&&a!==null&&!SE(a.window,Fg(r)),N=a==null?void 0:a.totals,_=a&&a.daily.length>0?Ef(a.window.since??a.daily[0].period,a.window.until??E).length:0;return l.jsxs("div",{className:"usage-view",children:[l.jsxs("div",{className:"usage-header",children:[l.jsxs("div",{className:"usage-title",children:[l.jsx($v,{size:18})," Usage Center"]}),l.jsxs("div",{className:"usage-controls",children:[eE.map(z=>l.jsx("button",{className:`usage-range-btn${r===z.id?" usage-range-btn-active":""}`,"aria-pressed":r===z.id,onClick:()=>o(z.id),children:z.label},z.id)),l.jsx("button",{className:"usage-range-btn usage-refresh",onClick:()=>x(!0),title:"Read the logs again (runs ccusage)","aria-label":"Refresh",children:l.jsx(Dm,{size:13,className:h?"spin":void 0})}),l.jsx("button",{className:"dialog-close",title:"Close usage view","aria-label":"Close usage view",onClick:e,children:l.jsx(Tn,{size:16})})]})]}),d&&l.jsxs("div",{className:"usage-error",children:["Could not load usage data: ",d]}),!a&&!d&&l.jsxs("div",{className:"usage-loading",children:[l.jsx(Dm,{size:14,className:"spin"})," Reading the Claude Code and Codex logs with ccusage…"]}),a&&N&&l.jsxs("div",{className:`usage-body${T?" usage-body-stale":""}`,"aria-busy":h,children:[a.source.ccusage_error&&l.jsxs("div",{className:"usage-warning",role:"alert",children:[l.jsx(Zl,{size:13}),l.jsxs("span",{children:["ccusage could not read the Claude Code and Codex logs, so only Repoburg calls are counted:"," ",a.source.ccusage_error]})]}),l.jsxs("div",{className:"usage-kpis",children:[l.jsx(wl,{label:"Cost (USD)",value:ts(N.cost_usd),children:l.jsx("div",{className:"usage-kpi-sub",children:a.by_agent.length===0?"No usage in this range":a.by_agent.map(z=>`${yl(z.agent)} ${ts(z.cost_usd)}`).join(" · ")})}),l.jsx(kE,{spent:a.month_to_date_cost_usd}),l.jsxs(wl,{label:"Total tokens",value:No(N.total_tokens),title:`${bo(N.total_tokens)} tokens`,children:[l.jsxs("div",{className:"usage-kpi-sub",children:["Input ",No(N.input_tokens)," · Output ",No(N.output_tokens)]}),l.jsxs("div",{className:"usage-kpi-sub",children:["Cache Create ",No(N.cache_creation_tokens)," · Cache Read"," ",No(N.cache_read_tokens)]})]}),l.jsx(wl,{label:"Daily average",value:_>0?ts(N.cost_usd/_):"—",children:l.jsx("div",{className:"usage-kpi-sub",children:_>0?`over ${_} ${_===1?"day":"days"} · ${a.daily.length} with usage`:"No usage in this range"})})]}),b&&l.jsx(uE,{data:b}),l.jsx(gE,{report:a,onOpenSession:S}),a.unpriced_models.length>0&&l.jsxs("div",{className:"usage-note",children:["No price for these Repoburg models, counted as $0: ",a.unpriced_models.join(", ")]}),l.jsxs("div",{className:"usage-source",children:["Claude Code and Codex costs by"," ",l.jsx("a",{href:"https://github.com/ryoppippi/ccusage",target:"_blank",rel:"noreferrer",children:"ccusage"}),a.source.ccusage_version?` ${a.source.ccusage_version}`:""," with LiteLLM prices · Repoburg calls priced by AgentPane · days in ",a.timezone,a.generated_at&&` · logs read ${rE(a.generated_at)}`]})]})]})}const Wg="claude auth login";function NE(){const e=A(f=>Object.keys(f.signedOutTurns).length),n=A(f=>f.terminalViewOpen),r=A(f=>f.toggleTerminalView),o=A(f=>f.addToast),[a,c]=y.useState(!1);if(e===0)return null;const d=()=>{c(!0),g0().catch(f=>o("error",`Could not resume the turns — ${hr(f)}`)).finally(()=>c(!1))};return l.jsxs("div",{className:"signed-out-band",role:"status",children:[l.jsx("span",{className:"banner-icon",children:l.jsx(N1,{size:12})}),l.jsxs("span",{className:"banner-text",children:["Claude is signed out — ",e===1?"1 turn is":`${e} turns are`," waiting. Run"," ",l.jsx("code",{children:Wg})," in a terminal, then resume."]}),l.jsxs("button",{type:"button",className:"banner-action",onClick:()=>void Fi(Wg),children:[l.jsx(Oi,{size:12}),"Copy"]}),!n&&l.jsxs("button",{type:"button",className:"banner-action",onClick:r,children:[l.jsx(Vv,{size:12}),"Open terminal"]}),l.jsxs("button",{type:"button",className:"banner-action",onClick:d,disabled:a,children:[l.jsx(Wv,{size:12}),e===1?"Resume turn":"Resume turns"]})]})}const Hg=/^[a-f0-9]{64}\.(?:png|jpg|gif|webp)$/,TE=/^(?:https?:\/\/[^/?#]+)?\/api\/apps\/([^/?#]+)\/files\/([^/?#]+)$/i,CE={png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp"};function Zy(){return mn()||window.location.origin}function Jy(e,n){let r=n;if(r&&typeof r=="object"){const d=r;r=typeof d.id=="string"?d.id:d.url}if(typeof r!="string")return null;const o=r.trim();if(Hg.test(o))return o;const a=TE.exec(o);if(!a)return null;let c;try{c=decodeURIComponent(a[1])}catch{return null}return c===e&&Hg.test(a[2])?a[2]:null}function Vg(e){return/^https?:\/\//i.test(e.url)?e:{...e,url:`${Zy()}${e.url}`}}function EE(e){return CE[e.slice(e.lastIndexOf(".")+1)]??"application/octet-stream"}function ex(e){return new Promise((n,r)=>{const o=new FileReader;o.onload=()=>{const a=String(o.result??"");n(a.slice(a.indexOf(",")+1))},o.onerror=()=>r(o.error??new Error("Could not read the file")),o.readAsDataURL(e)})}function jE(e,n){const r=/^data:([^;,]*)(?:;[^;,]*)*;base64,/i.exec(e);return r?{type:n||r[1]||void 0,data:e.slice(r[0].length)}:{type:n,data:e}}async function tx(e){if(e instanceof Blob){const n=e.name;return{name:typeof n=="string"&&n?n:void 0,type:e.type||void 0,data:await ex(e)}}if(e&&typeof e=="object"&&typeof e.data=="string"){const n=e;return{name:typeof n.name=="string"&&n.name?n.name:void 0,type:typeof n.type=="string"&&n.type?n.type:void 0,data:n.data}}return null}async function _E(e){const n=await tx(e);if(!n)throw new Error("uploadFile: expected a Blob/File or { name, type, data }");return n}async function RE(e,n,r){if(n==null)return[];if(!Array.isArray(n))throw new Error("submitTurn: attachments must be an array");const o=[];for(let a=0;a<n.length;a++){const c=n[a],d=await tx(c);if(d){const{type:g,data:v}=jE(d.data,d.type);if(!g)throw new Error(`submitTurn: attachment ${a+1} has no type`);o.push({name:d.name??`attachment-${a+1}`,media_type:g,data:v});continue}const f=Jy(e,c);if(!f)throw new Error(`submitTurn: attachment ${a+1} is not a file of this app`);const h=await r(f);o.push({name:f,media_type:EE(f),data:await ex(h)})}return o}const AE=`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
|
+
listSessions: function (opts) {
|
|
784
|
+
var params = {};
|
|
785
|
+
if (opts && (opts.lifecycle === 'working' || opts.lifecycle === 'finished')) params.lifecycle = opts.lifecycle;
|
|
786
|
+
if (opts && typeof opts.running === 'boolean') params.running = opts.running;
|
|
787
|
+
return call('listSessions', params);
|
|
788
|
+
},
|
|
789
|
+
getSessionInfo: function (sessionId) { return call('getSessionInfo', { sessionId: sessionId }); },
|
|
790
|
+
cancelTurn: function (sessionId) { return call('cancelTurn', { sessionId: sessionId }); },
|
|
791
|
+
setSessionLifecycle: function (sessionId, lifecycle) { return call('setSessionLifecycle', { sessionId: sessionId, lifecycle: lifecycle }); },
|
|
792
|
+
callTool: function (tool, args) { return call('callTool', { tool: tool, args: args }); },
|
|
793
|
+
listProviders: function () { return call('listProviders'); },
|
|
794
|
+
listModels: function (runtime, cwd) { return call('listModels', { runtime: runtime, cwd: cwd }); },
|
|
795
|
+
pickDirectory: function () { return call('pickDirectory'); },
|
|
796
|
+
onTurnCompleted: function (cb) { listeners.push(function (event, payload) { if (event === 'turn:completed' || event === 'turn:failed') cb(event, payload); }); },
|
|
797
|
+
onTurnDelta: function (cb) { listeners.push(function (event, payload) { if (event === 'turn:delta' && payload) cb(payload); }); },
|
|
798
|
+
onToolCall: function (cb) { listeners.push(function (event, payload) { if (event === 'tool_call' && payload) cb(payload); }); },
|
|
799
|
+
onStateChanged: function (cb) { listeners.push(function (event, payload) { if (event === 'state_changed') cb(payload || {}); }); },
|
|
800
|
+
onBackgroundTasks: function (cb) { listeners.push(function (event, payload) { if (event === 'background_tasks' && payload) cb(payload); }); },
|
|
801
|
+
resolveToolCall: function (callId, result) { return call('resolveToolCall', { callId: callId, result: result }); },
|
|
802
|
+
openSession: function (sessionId) { return call('openSession', { sessionId: sessionId }); },
|
|
803
|
+
openUrl: function (url) {
|
|
804
|
+
var href = externalUrl(url);
|
|
805
|
+
if (!href) return Promise.reject(new Error('openUrl: expected an absolute http(s) URL, got ' + JSON.stringify(url)));
|
|
806
|
+
try { openTab(href); } catch (err) { return Promise.reject(err); }
|
|
807
|
+
return Promise.resolve({ ok: true });
|
|
808
|
+
},
|
|
809
|
+
uploadFile: function (file) { return call('uploadFile', { file: file }); },
|
|
810
|
+
getFile: function (ref) { return call('getFile', { ref: ref }); },
|
|
811
|
+
fileUrl: fileUrl
|
|
812
|
+
};
|
|
813
|
+
// Runtime error reporting — surface compile checks' blind side to the pane.
|
|
814
|
+
window.addEventListener('error', function (e) {
|
|
815
|
+
parent.postMessage({
|
|
816
|
+
source: 'agentpane-app', report: 'error',
|
|
817
|
+
message: e.message || 'Unknown error',
|
|
818
|
+
stack: (e.error && e.error.stack) || '',
|
|
819
|
+
line: e.lineno || 0, col: e.colno || 0
|
|
820
|
+
}, '*');
|
|
821
|
+
});
|
|
822
|
+
window.addEventListener('unhandledrejection', function (e) {
|
|
823
|
+
var r = e.reason;
|
|
824
|
+
var msg = r && (r.message || String(r)) || 'unknown';
|
|
825
|
+
parent.postMessage({
|
|
826
|
+
source: 'agentpane-app', report: 'error',
|
|
827
|
+
message: 'Unhandled promise rejection: ' + msg,
|
|
828
|
+
stack: (r && r.stack) || '', line: 0, col: 0
|
|
829
|
+
}, '*');
|
|
830
|
+
});
|
|
831
|
+
}`;function IE(e){return`(${AE})(${JSON.stringify(e)});`}function Kg(e){return e.replace(/<\/script/gi,"<\\/script")}function DE(e,n){const r=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(r,"gi");let a=-1,c;for(;(c=o.exec(e))!==null;)a=c.index;return a}function Gg(e,n,r){const o=DE(e,n);return o===-1?e+r:e.slice(0,o)+r+e.slice(o)}function ME(e,n,r){let o=e;const a=`<script>${Kg(n)}<\/script>`;if(/<\/head>/i.test(o)?o=Gg(o,"</head>",a):/<html[^>]*>/i.test(o)?o=o.replace(/(<html[^>]*>)/i,`$1<head>${a}</head>`):o=`${a}${o}`,r){const c=`<script>${Kg(r)}<\/script>`;o=Gg(o,"</body>",c)}return o}function LE(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?`tab-${e.randomUUID()}`:`tab-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function OE(e){var r;if(!(e instanceof Ui)||e.status!==409)return null;const n=(r=e.body)==null?void 0:r.state;return n&&typeof n=="object"?n:null}function $E({appId:e,workspace:n=""}){const r=y.useRef(null),o=y.useRef({pinned:!1,data:null}),[a,c]=y.useState(null),[d,f]=y.useState(null),[h,g]=y.useState([]);y.useEffect(()=>{let S=!0;const E=LE(),b=N=>{const _=o.current.version;typeof N.version=="number"&&typeof _=="number"&&N.version<_||(o.current=N)};$0(e,N=>{var _,z;return(z=(_=r.current)==null?void 0:_.contentWindow)==null?void 0:z.postMessage(N,"*")},n);const T=async N=>{var U,P,Q,ce,ue,me,Ne,Me,J,re,ee,F,Z,G,I,$,le,H,q,ae,Se,_e,Ae,je;if(N.source!==((U=r.current)==null?void 0:U.contentWindow))return;const _=N.data;if(!_||_.source!=="agentpane-app")return;if(_.report==="error"){const ge={message:String(_.message??"Unknown error"),stack:String(_.stack??"")};g(he=>{const Ve=he[he.length-1];return Ve&&Ve.message===ge.message?he:[...he,ge].slice(-20)});return}if(typeof _.method!="string")return;let z=!0,M,O,X=null;try{switch(_.method){case"getApp":M={id:e,workspace:n};break;case"getState":try{const ge=await Tm(e,n);b(ge),M=ge}catch{M=o.current}break;case"setState":{const ge=((P=_.params)==null?void 0:P.data)??null,he=(Q=_.params)==null?void 0:Q.ifVersion,Ve={data:ge,writer:E};typeof he=="number"&&(Ve.ifVersion=he);try{const Ie=await Tv(e,Ve,n);b(Ie),M=Ie}catch(Ie){if(X=OE(Ie),!X)throw Ie;b(X);const mt=Ie.body;throw new Error(typeof(mt==null?void 0:mt.error)=="string"?mt.error:"App state changed since that version")}break}case"createSession":{const ge=_.params??{},he=await Vd({title:typeof ge.title=="string"?ge.title:void 0,runtime_type:typeof ge.runtime_type=="string"?ge.runtime_type:void 0,model:typeof ge.model=="string"?ge.model:void 0,model_reasoning_effort:typeof ge.model_reasoning_effort=="string"?ge.model_reasoning_effort:void 0,cwd:typeof ge.cwd=="string"?ge.cwd:void 0,origin_app_id:e,origin_app_workspace:n});dl(he.id,e),A.getState().addSession(he),M=he;break}case"submitTurn":{const ge=String(((ce=_.params)==null?void 0:ce.sessionId)??"");if(!await Cm(e,ge))throw new Error(`submitTurn: ${ge} is not a session of this app`);const he=String(((ue=_.params)==null?void 0:ue.prompt)??""),Ve=await RE(e,(me=_.params)==null?void 0:me.attachments,mt=>Wk(e,mt)),Ie=await uv(ge,he,Ve.length?Ve:void 0,{originAppId:e});dl(ge,e),M=Ie;break}case"getSession":{M=await Cm(e,String(((Ne=_.params)==null?void 0:Ne.sessionId)??""));break}case"listSessions":{const ge=(Me=_.params)==null?void 0:Me.lifecycle,he=(J=_.params)==null?void 0:J.running;M=await Rk(e,n,{lifecycle:ge==="working"||ge==="finished"?ge:void 0,running:typeof he=="boolean"?he:void 0});break}case"getSessionInfo":{M=await Ak(e,n,String(((re=_.params)==null?void 0:re.sessionId)??""));break}case"cancelTurn":{M=await Ik(e,String(((ee=_.params)==null?void 0:ee.sessionId)??""));break}case"setSessionLifecycle":{M=await Dk(e,String(((F=_.params)==null?void 0:F.sessionId)??""),String(((Z=_.params)==null?void 0:Z.lifecycle)??""));break}case"callTool":{const ge=(G=_.params)==null?void 0:G.args;M=await Mk(e,n,String(((I=_.params)==null?void 0:I.tool)??""),ge&&typeof ge=="object"?ge:{});break}case"listProviders":{M=await Gy();break}case"listModels":{const ge=typeof(($=_.params)==null?void 0:$.runtime)=="string"?_.params.runtime.trim():"";if(!ge)throw new Error("listModels: runtime is required");const he=(le=_.params)==null?void 0:le.cwd;M=await bv(ge,typeof he=="string"&&he?he:void 0);break}case"pickDirectory":{if(A.getState().activeAppTabId!==e)throw new Error("pickDirectory: the app is not on screen — call it from a click in the app");M=await fv();break}case"resolveToolCall":{const ge=String(((H=_.params)==null?void 0:H.callId)??""),he=(q=_.params)==null?void 0:q.result;await zk(ge,he),M={ok:!0};break}case"openSession":{if(A.getState().activeAppTabId!==e)throw new Error("openSession: the app is not on screen — call it from a click in the app");const ge=typeof((ae=_.params)==null?void 0:ae.sessionId)=="string"?_.params.sessionId.trim():"";if(!ge)throw new Error("openSession: sessionId is required");try{await A.getState().revealSession(ge)}catch(he){throw new Error(`openSession: ${he instanceof Error?he.message:String(he)}`)}M={ok:!0};break}case"uploadFile":{const ge=await _E((Se=_.params)==null?void 0:Se.file);try{M=Vg(await Uk(e,ge))}catch(he){throw new Error(`uploadFile: ${he instanceof Error?he.message:String(he)}`)}break}case"getFile":{const ge=Jy(e,(_e=_.params)==null?void 0:_e.ref),he=ge?await Bk(e,ge):null;M=he?Vg(he):null;break}default:throw new Error(`Unknown bridge method: ${_.method}`)}}catch(ge){z=!1,O=ge instanceof Error?ge.message:String(ge)}(je=(Ae=r.current)==null?void 0:Ae.contentWindow)==null||je.postMessage(X?{source:"agentpane-host",id:_.id,ok:z,error:O,code:"conflict",state:X}:{source:"agentpane-host",id:_.id,ok:z,result:M,error:O},"*")};return window.addEventListener("message",T),H0(e,N=>{var _,z;typeof N.workspace=="string"&&N.workspace!==n||N.writer!==E&&((z=(_=r.current)==null?void 0:_.contentWindow)==null||z.postMessage({source:"agentpane-host",event:"state_changed",payload:typeof N.version=="number"?{version:N.version}:{}},"*"))}),B0(e,()=>{Nm(e).then(N=>{S&&(c(N),g([]))}).catch(()=>{})}),(async()=>{try{const[N,_,z]=await Promise.all([Nm(e),Tm(e,n),_k(e).catch(()=>[])]);if(!S)return;o.current=_,z.forEach(M=>dl(M.id,e)),c(N)}catch(N){S&&f(N instanceof Error?N.message:String(N))}})(),()=>{S=!1,P0(e),W0(e),V0(e),window.removeEventListener("message",T)}},[e,n]),y.useEffect(()=>{a&&z0(e,a.manifest.headlessSessions===!0)},[e,a]);const v=y.useMemo(()=>a?ME(a.html,IE({appId:e,apiOrigin:Zy()}),a.js):"",[a,e]);if(d)return l.jsxs("div",{className:"empty-state",style:{padding:"24px"},children:["Mini app failed to load: ",d]});if(!v)return l.jsx("div",{className:"empty-state",style:{padding:"24px"},children:"Loading mini app…"});const k=(a==null?void 0:a.diagnostics)??[],x=k.some(S=>S.severity==="error");return l.jsxs("div",{className:"miniapp-runtime",children:[k.length>0&&l.jsxs("div",{className:`miniapp-diagnostics${x?"":" miniapp-diagnostics-warn"}`,"data-testid":"miniapp-diagnostics",children:[l.jsx("div",{className:"miniapp-diagnostics-title",children:x?`Compile errors in ${(a==null?void 0:a.sourceFile)??"the app logic"} — the pane serves the last code that parsed:`:"Warnings — the app runs, but fix these:"}),k.map((S,E)=>l.jsxs("div",{className:"miniapp-diag",children:[S.file,":",S.line,":",S.column," — ",S.message]},E))]}),l.jsx("iframe",{ref:r,className:"miniapp-frame",sandbox:"allow-scripts allow-popups allow-popups-to-escape-sandbox",allow:"loopback-network; local-network; local-network-access",title:`Mini app: ${e}`,srcDoc:v}),h.length>0&&l.jsx("div",{className:"miniapp-rt-errors","data-testid":"miniapp-rt-errors",children:h.map((S,E)=>l.jsxs("div",{className:"miniapp-rt-error",children:[l.jsx("div",{className:"miniapp-rt-error-message",children:S.message}),S.stack&&l.jsx("pre",{className:"miniapp-rt-error-stack",children:S.stack})]},E))})]})}function PE({appId:e,active:n}){const r=A(x=>x.apps),o=A(x=>x.workspaces),a=A(x=>x.appWorkspaces),c=A(x=>x.setAppWorkspace),d=A(x=>x.setActiveAppTab),f=A(x=>x.startAppEdit),h=r.find(x=>x.id===e),g=a[e]??"",v=o.filter(x=>x.deleted!==1),k=g!==""&&!v.some(x=>x.path===g)?g:null;return l.jsxs("div",{className:`miniapp-view ${n?"":"miniapp-view-hidden"}`,children:[l.jsxs("div",{className:"miniapp-header",children:[l.jsx(Do,{iconNode:h==null?void 0:h.iconNode,size:14,className:"miniapp-header-icon"}),l.jsx("span",{className:"miniapp-header-title",children:(h==null?void 0:h.title)??e}),l.jsxs("select",{className:"miniapp-workspace-select",title:"Workspace this app instance is bound to (state and pinning are scoped per workspace)",value:g,onChange:x=>c(e,x.target.value),children:[l.jsx("option",{value:"",children:"All workspaces (global)"}),v.map(x=>l.jsx("option",{value:x.path,children:x.label||x.path.split("/").pop()||x.path},x.path)),k&&l.jsx("option",{value:k,children:`${k} (unknown workspace)`})]}),l.jsxs("button",{className:"miniapp-header-btn",title:"Edit this app with the agent (opens an edit session on the app folder)",onClick:()=>void f(e),children:[l.jsx(P1,{size:13}),"Edit"]}),l.jsx("button",{className:"miniapp-header-close",title:"Close app",onClick:()=>d(null),children:l.jsx(Tn,{size:14})})]}),l.jsx("div",{className:"miniapp-body",children:l.jsx($E,{appId:e,workspace:g},`${e}:${g}`)})]})}function zE({side:e,minWidth:n,maxWidth:r,getWidth:o,setWidth:a}){const[c,d]=y.useState(!1),f=y.useRef(0),h=y.useRef(0),g=y.useCallback(x=>{const S=x.clientX-f.current,E=e==="left"?h.current+S:h.current-S,b=Math.min(r,Math.max(n,E));a(b)},[e,n,r,a]),v=y.useCallback(()=>{window.removeEventListener("pointermove",g),window.removeEventListener("pointerup",v),document.body.classList.remove("is-resizing"),d(!1)},[g]);return{onPointerDown:y.useCallback(x=>{var S,E;x.preventDefault(),x.stopPropagation();try{(E=(S=x.currentTarget)==null?void 0:S.setPointerCapture)==null||E.call(S,x.pointerId)}catch{}f.current=x.clientX,h.current=o(),d(!0),document.body.classList.add("is-resizing"),window.addEventListener("pointermove",g),window.addEventListener("pointerup",v)},[o,g,v]),dragging:c}}function qg({side:e,minWidth:n,maxWidth:r,getWidth:o,setWidth:a}){const{onPointerDown:c,dragging:d}=zE({side:e,minWidth:n,maxWidth:r,getWidth:o,setWidth:a});return l.jsx("div",{className:`resize-handle ${e}${d?" dragging":""}`,onPointerDown:c,role:"separator","aria-orientation":"vertical","aria-label":`Resize ${e} panel`,"data-resizing":d?"":void 0})}const FE=y.lazy(()=>i1(()=>import("./TerminalView-CWb7lwEQ.js"),__vite__mapDeps([0,1])));function UE(){Lt.trackRender("IdeWorkspace");const e=A(S=>S.sidebarWidth),n=A(S=>S.rightPanelWidth),r=A(S=>S.setSidebarWidth),o=A(S=>S.setRightPanelWidth),a=A(S=>S.rightPanelCollapsed),c=A(S=>S.vscodeViewOpen),d=A(S=>S.usageViewOpen),f=A(S=>S.terminalViewOpen),[h,g]=y.useState(!1);f&&!h&&g(!0);const v=A(S=>S.activeAppTabId),k=A(S=>S.openAppTabs);y.useEffect(()=>{const S=()=>{const E=bl(),{rightPanelWidth:b,setRightPanelWidth:T}=A.getState();b>E&&T(E)};return window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const x=a?`${e}px 6px 1fr ${Sk}px`:`${e}px 6px 1fr 6px ${n}px`;return l.jsxs("div",{className:"ide-root",children:[l.jsx(NE,{}),l.jsxs("div",{className:`ide-layout ${c||d||f?"ide-hidden":""}`,style:{gridTemplateColumns:x},children:[l.jsx(qb,{}),l.jsx(qg,{side:"left",minWidth:vd,maxWidth:yd,getWidth:()=>A.getState().sidebarWidth,setWidth:r}),l.jsxs("div",{className:"ide-center",children:[l.jsx(Qb,{}),l.jsxs("div",{className:"ide-render",children:[k.map(S=>l.jsx(PE,{appId:S,active:v===S},S)),v==null&&l.jsx(uC,{})]}),l.jsx(kC,{})]}),!a&&l.jsx(qg,{side:"right",minWidth:Sl,maxWidth:bl(),getWidth:()=>A.getState().rightPanelWidth,setWidth:o}),l.jsx(WC,{})]}),c&&l.jsx(ZC,{}),d&&l.jsx(bE,{}),h&&l.jsx(y.Suspense,{fallback:null,children:l.jsx(FE,{visible:f})}),l.jsx(KC,{})]})}function BE(){const{showNewSessionDialog:e,setShowNewSessionDialog:n,createSession:r,lastModelConfig:o}=A(),a=(o==null?void 0:o.provider)??"codex",c=(o==null?void 0:o.model)??"",d=(o==null?void 0:o.reasoning)??"",[f,h]=y.useState(""),[g,v]=y.useState(c),[k,x]=y.useState(d),[S,E]=y.useState("");if(!e)return null;const b=Tf(a),T=g?Od(a,g):[];function N(){r({title:f.trim()||void 0,model:g||void 0,model_reasoning_effort:k||void 0,cwd:S.trim()||void 0,runtime_type:a}),h(""),E("")}function _(M){M.key==="Escape"&&n(!1)}function z(M){var U;v(M);const O=Od(a,M);O.some(P=>P.effort===k)||x($d(a,M)??((U=O[0])==null?void 0:U.effort)??"")}return l.jsx("div",{className:"dialog-overlay",onClick:()=>n(!1),children:l.jsxs("div",{className:"dialog",onClick:M=>M.stopPropagation(),onKeyDown:_,children:[l.jsxs("div",{className:"dialog-header",children:[l.jsx("span",{className:"dialog-title",children:"New Session"}),l.jsx("button",{className:"dialog-close",onClick:()=>n(!1),children:l.jsx(Tn,{size:16})})]}),l.jsxs("div",{className:"dialog-body",children:[l.jsxs("label",{className:"dialog-label",children:["Title (optional)",l.jsx("input",{className:"dialog-input",type:"text",value:f,onChange:M=>h(M.target.value),placeholder:"e.g. refactor auth module",autoFocus:!0})]}),l.jsxs("label",{className:"dialog-label",children:["Model",l.jsxs("select",{className:"dialog-input dialog-select",value:g,onChange:M=>z(M.target.value),children:[l.jsx("option",{value:"",children:"Default (Codex picks)"}),b.map(M=>l.jsxs("option",{value:M.slug,children:[M.displayName," — ",M.description]},M.slug))]})]}),T.length>0&&l.jsxs("label",{className:"dialog-label",children:["Thinking Level",l.jsxs("select",{className:"dialog-input dialog-select",value:k,onChange:M=>x(M.target.value),children:[l.jsxs("option",{value:"",children:["Default (",$d(a,g),")"]}),T.map(M=>l.jsx("option",{value:M.effort,children:M.label},M.effort))]})]}),l.jsxs("label",{className:"dialog-label",children:["Working Directory (optional)",l.jsx("input",{className:"dialog-input",type:"text",value:S,onChange:M=>E(M.target.value),placeholder:"e.g. /Users/me/projects/my-app"})]})]}),l.jsxs("div",{className:"dialog-footer",children:[l.jsx("button",{className:"dialog-btn-cancel",onClick:()=>n(!1),children:"Cancel"}),l.jsx("button",{className:"dialog-btn-create",onClick:N,children:"Create"})]})]})})}function WE(e,n){const r=n!==""&&(e===n||e.startsWith(`${n}/`)),o=[r?{label:"~",path:n}:{label:"/",path:"/"}],a=e.slice(r?n.length:0);let c=o[0].path;for(const d of a.split("/").filter(Boolean))c=c==="/"?`/${d}`:`${c}/${d}`,o.push({label:d,path:c});return o}function HE(e){const n=e.filter(a=>a.deleted===0).at(-1);if(!n)return;const r=gr(n.path),o=r.lastIndexOf("/");return o>0?r.slice(0,o):void 0}function VE(){return A(n=>n.showAddWorkspaceDialog)?l.jsx(KE,{}):null}function KE(){var U;const e=A(P=>P.setShowAddWorkspaceDialog),n=A(P=>P.workspaces),r=A(P=>P.createWorkspaceAt),o=A(P=>P.addToast),[a,c]=y.useState(null),[d,f]=y.useState(!0),[h,g]=y.useState(null),[v,k]=y.useState(!1),x=y.useRef(0),[S]=y.useState(()=>HE(A.getState().workspaces)),E=y.useRef(null),b=y.useCallback(()=>{v||e(!1)},[v,e]);Io(b);const T=y.useCallback(async(P,Q=!1)=>{const ce=++x.current;f(!0);let ue=null,me=null;try{ue=await im(P)}catch(Ne){if(me=hr(Ne),Q&&P)try{ue=await im(),me=null}catch(Me){me=hr(Me)}}ce===x.current&&(ue&&c(ue),g(me),f(!1))},[]);y.useEffect(()=>{T(S,!0)},[T,S]);const N=a==null?void 0:a.path;y.useEffect(()=>{E.current&&(E.current.scrollTop=0)},[N]);const _=new Set(n.filter(P=>P.deleted===0).map(P=>gr(P.path)));async function z(P){if(!v){k(!0),g(null);try{const Q=await r(P);e(!1),o("success",`Workspace added — ${Q.path}`)}catch(Q){g(hr(Q)),k(!1)}}}const M=a?WE(a.path,a.home):[],O=((U=M.at(-1))==null?void 0:U.label)??"",X=a!==null&&_.has(gr(a.path));return l.jsx("div",{className:"dialog-overlay",onClick:b,children:l.jsxs("div",{className:"dialog folder-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"folder-dialog-title",onClick:P=>P.stopPropagation(),children:[l.jsxs("div",{className:"dialog-header",children:[l.jsx("span",{className:"dialog-title",id:"folder-dialog-title",children:"Add workspace"}),l.jsx("button",{className:"dialog-close",onClick:b,"aria-label":"Close",disabled:v,children:l.jsx(Tn,{size:16})})]}),l.jsxs("div",{className:"dialog-body",children:[l.jsxs("p",{className:"dialog-hint",children:["Choose a project folder",a&&l.jsxs(l.Fragment,{children:[" ","on ",l.jsx("strong",{children:a.hostname})]}),"."]}),l.jsxs("div",{className:"folder-nav",children:[l.jsx("button",{className:"folder-up",onClick:()=>(a==null?void 0:a.parent)&&void T(a.parent),disabled:!(a!=null&&a.parent),"aria-label":"Parent folder",title:"Parent folder",children:l.jsx(Dv,{size:14})}),l.jsx("nav",{className:"folder-crumbs","aria-label":"Folder path",children:M.map((P,Q)=>l.jsxs(y.Fragment,{children:[Q>0&&l.jsx(Li,{size:12,className:"folder-crumb-sep","aria-hidden":"true"}),Q===M.length-1?l.jsx("span",{className:"folder-crumb current","aria-current":"location",title:P.path,children:P.label}):l.jsx("button",{className:"folder-crumb",onClick:()=>void T(P.path),title:P.path,children:P.label})]},P.path))}),d&&a&&l.jsx(hn,{size:14,className:"spin folder-spinner","aria-label":"Loading"})]}),l.jsx("ul",{ref:E,className:`folder-list${d&&a?" loading":""}`,"aria-label":"Folders",children:a?a.folders.length===0?l.jsx("li",{className:"folder-empty",children:"No folders here."}):a.folders.map(P=>l.jsxs("li",{className:"folder-item",children:[l.jsxs("button",{className:"folder-row",onClick:()=>void T(P.path),title:P.path,"aria-label":P.git?`${P.name} (git repository)`:P.name,children:[P.git?l.jsx(k1,{size:15,className:"folder-icon git","aria-hidden":"true"}):l.jsx(_l,{size:15,className:"folder-icon","aria-hidden":"true"}),l.jsx("span",{className:"folder-name",children:P.name}),l.jsx(Li,{size:13,className:"folder-chevron","aria-hidden":"true"})]}),_.has(gr(P.path))?l.jsx("span",{className:"folder-tag",children:"Added"}):l.jsx("button",{className:"folder-add",onClick:()=>void z(P.path),disabled:v,"aria-label":`Add ${P.name}`,children:"Add"})]},P.path)):d&&l.jsxs("li",{className:"folder-empty",role:"status",children:[l.jsx(hn,{size:14,className:"spin"})," Loading folders…"]})}),(a==null?void 0:a.truncated)&&l.jsxs("p",{className:"folder-note",children:["Showing the first ",a.folders.length," folders."]}),h&&l.jsx("p",{className:"folder-error",role:"alert",children:h})]}),l.jsxs("div",{className:"dialog-footer",children:[l.jsx("button",{className:"dialog-btn-cancel",onClick:b,disabled:v,children:"Cancel"}),l.jsx("button",{className:"dialog-btn-create",onClick:()=>a&&void z(a.path),disabled:!a||d||v||X,children:v?"Adding…":X?"Already added":`Add “${O}”`})]})]})})}const zd=6e4,Fd=60*zd,ul=24*Fd;function GE(e,n=Date.now()){const r=Date.parse(e);if(Number.isNaN(r))return"";const o=Math.max(0,n-r);return o<zd?"just now":o<Fd?`${Math.floor(o/zd)} min ago`:o<ul?`${Math.floor(o/Fd)} h ago`:o<2*ul?"yesterday":o<7*ul?`${Math.floor(o/ul)} days ago`:new Date(r).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function qE(){const e=A(n=>n.importSessionsWorkspace);return e?l.jsx(XE,{workspace:e},e):null}function XE({workspace:e}){const n=A(U=>U.setImportSessionsWorkspace),r=A(U=>U.importSessions),[o,a]=y.useState(null),[c,d]=y.useState(null),[f,h]=y.useState({}),[g,v]=y.useState(new Set),[k,x]=y.useState(!1),[S,E]=y.useState(new Map),b=y.useCallback(()=>{k||n(null)},[k,n]);Io(b),y.useEffect(()=>{let U=!1;return Sv(e).then(({sessions:P,errors:Q})=>{if(U)return;const ce=Object.values(Q);if(ce.length===gd.length){d([...new Set(ce)].join("; "));return}a(P),h(Q)}).catch(P=>{U||d(hr(P))}),()=>{U=!0}},[e]);function T(U){v(P=>{const Q=new Set(P);return Q.has(U)?Q.delete(U):Q.add(U),Q})}const N=o??[],_=U=>qu({runtime:U.runtime,id:U.session_id}),z=N.length>0&&N.every(U=>g.has(_(U)));async function M(){const U=N.filter(ce=>g.has(_(ce))).map(ce=>({runtime:ce.runtime,id:ce.session_id}));if(U.length===0)return;x(!0);const{failed:P}=await r(e,U);if(x(!1),P.length===0){n(null);return}const Q=new Set(P.map(qu));a(ce=>(ce??[]).filter(ue=>!g.has(_(ue))||Q.has(_(ue)))),v(Q),E(new Map(P.map(ce=>[qu(ce),ce.error])))}const O=e.split("/").pop()||e,X=g.size;return l.jsx("div",{className:"dialog-overlay",onClick:b,children:l.jsxs("div",{className:"dialog import-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"import-dialog-title",onClick:U=>U.stopPropagation(),children:[l.jsxs("div",{className:"dialog-header",children:[l.jsx("span",{className:"dialog-title",id:"import-dialog-title",children:"Import sessions"}),l.jsx("button",{className:"dialog-close",onClick:b,"aria-label":"Close",disabled:k,children:l.jsx(Tn,{size:16})})]}),l.jsxs("div",{className:"dialog-body",children:[l.jsxs("p",{className:"dialog-hint",children:["Sessions you started with ",l.jsx("code",{children:"claude"})," or ",l.jsx("code",{children:"codex"})," in"," ",l.jsx("strong",{title:e,children:O}),", in a terminal or an IDE. An imported session keeps its history and continues the same conversation."]}),c?l.jsxs("p",{className:"import-error",role:"alert",children:["Could not list the sessions — ",c]}):o===null?l.jsxs("div",{className:"import-loading",role:"status",children:[l.jsx(hn,{size:14,className:"spin"})," Looking for sessions…"]}):o.length===0?l.jsxs("div",{className:"import-empty",children:["No Claude Code or Codex sessions to import here. Sessions you start with ",l.jsx("code",{children:"claude"})," or"," ",l.jsx("code",{children:"codex"})," in this folder will show up here.",l.jsx(Xg,{errors:f})]}):l.jsxs(l.Fragment,{children:[l.jsxs("label",{className:"import-select-all",children:[l.jsx("input",{type:"checkbox",checked:z,disabled:k,onChange:()=>v(z?new Set:new Set(N.map(_)))}),"Select all (",o.length,")"]}),l.jsx("ul",{className:"import-list",children:o.map(U=>{const P=_(U),Q=S.get(P);return l.jsx("li",{children:l.jsxs("label",{className:`import-row${g.has(P)?" selected":""}`,children:[l.jsx("input",{type:"checkbox",checked:g.has(P),disabled:k,onChange:()=>T(P)}),l.jsxs("span",{className:"import-row-main",children:[l.jsx("span",{className:"import-row-title",title:U.title,children:U.title}),l.jsxs("span",{className:"import-row-meta",children:[l.jsx("span",{className:`import-row-runtime ${U.runtime}`,children:ql[U.runtime]}),l.jsx("span",{title:new Date(U.last_modified).toLocaleString(),children:GE(U.last_modified)}),U.git_branch&&l.jsxs("span",{className:"import-row-branch",title:"Git branch",children:[l.jsx(Pv,{size:10})," ",U.git_branch]})]}),U.recently_active&&l.jsxs("span",{className:"import-row-warn",children:[l.jsx(Zl,{size:11})," Active in the last few minutes. If it is still open in a terminal, close it there first: both would write to the same session."]}),Q&&l.jsx("span",{className:"import-row-error",role:"alert",children:Q})]})]})},P)})}),l.jsx(Xg,{errors:f})]})]}),l.jsxs("div",{className:"dialog-footer",children:[l.jsx("button",{className:"dialog-btn-cancel",onClick:b,disabled:k,children:"Cancel"}),l.jsx("button",{className:"dialog-btn-create",onClick:()=>void M(),disabled:X===0||k,children:k?l.jsxs(l.Fragment,{children:[l.jsx(hn,{size:12,className:"spin"})," Importing…"]}):X>1?`Import ${X} sessions`:"Import"})]})]})})}function Xg({errors:e}){const n=Object.entries(e);return n.length===0?null:l.jsx(l.Fragment,{children:n.map(([r,o])=>l.jsxs("p",{className:"import-note",children:["Could not list the ",ql[r]," sessions — ",o]},r))})}const YE=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,QE=512*1024;function ZE(e){const n=e.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"");return/^[a-z0-9]/.test(n)?n:""}function JE(){const{appCatalogOpen:e,closeAppCatalog:n,apps:r,installExampleApp:o,createSkeletonApp:a,importAppFolder:c}=A(),[d,f]=y.useState("examples"),[h,g]=y.useState(null),[v,k]=y.useState(null),[x,S]=y.useState(!1),[E,b]=y.useState(""),[T,N]=y.useState(""),[_,z]=y.useState(""),[M,O]=y.useState(""),[X,U]=y.useState(null),[P,Q]=y.useState(""),ce=y.useRef(null);if(y.useEffect(()=>{e&&(g(null),Lk().then(g).catch(()=>g([])))},[e]),y.useEffect(()=>{ce.current&&(ce.current.webkitdirectory=!0)},[d]),!e)return null;const ue=new Set(r.map(F=>F.id));async function me(F){k(F);try{await o(F)&&n()}finally{k(null)}}async function Ne(){if(x)return;const F=E.trim(),Z=T.trim();if(!(!F||!Z)){S(!0);try{await a({id:F,title:Z,description:_.trim()||void 0,icon:M.trim()||void 0})&&(b(""),N(""),z(""),O(""),n())}finally{S(!1)}}}async function Me(F){const Z=Array.from(F.target.files??[]),G={};let I="";for(const $ of Z){const H=($.webkitRelativePath??"").split("/");!I&&H.length>1&&(I=H[0]);const q=H[H.length-1];if(!(!q||!YE.test(q))&&!($.size>QE))try{G[q]=await $.text()}catch{}}U(Object.keys(G).length>0?G:null),Q(ZE(I))}async function J(){if(!(x||!X||!P.trim())){S(!0);try{await c(P.trim(),X)&&(U(null),Q(""),n())}finally{S(!1)}}}function re(F){F.key==="Escape"&&n()}const ee=[{key:"examples",label:"Examples"},{key:"new",label:"New App"},{key:"upload",label:"Upload"}];return l.jsx("div",{className:"dialog-overlay",onClick:n,children:l.jsxs("div",{className:"dialog app-catalog",onClick:F=>F.stopPropagation(),onKeyDown:re,children:[l.jsxs("div",{className:"dialog-header",children:[l.jsx("span",{className:"dialog-title",children:"Add Mini App"}),l.jsx("button",{className:"dialog-close",onClick:n,children:"✕"})]}),l.jsx("div",{className:"catalog-tabs",children:ee.map(F=>l.jsx("button",{className:`catalog-tab${d===F.key?" active":""}`,onClick:()=>f(F.key),children:F.label},F.key))}),l.jsxs("div",{className:"dialog-body catalog-body",children:[d==="examples"&&l.jsx("div",{className:"catalog-examples",children:h===null?l.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"Loading examples…"}):h.length===0?l.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"No example apps available."}):h.map(F=>{const Z=ue.has(F.id);return l.jsxs("div",{className:"example-row",children:[l.jsx(Do,{iconNode:F.iconNode,size:14,className:"sidebar-app-icon"}),l.jsxs("div",{className:"example-info",children:[l.jsx("span",{className:"example-title",children:F.title}),F.description&&l.jsx("span",{className:"example-desc",children:F.description})]}),l.jsx("button",{className:"example-install",disabled:Z||v===F.id,onClick:()=>me(F.id),title:Z?"Already installed":"Install this example",children:Z?"Installed":v===F.id?"Installing…":"Install"})]},F.id)})}),d==="new"&&l.jsxs(l.Fragment,{children:[l.jsxs("label",{className:"dialog-label",children:["App id (folder name)",l.jsx("input",{className:"dialog-input",type:"text",value:E,onChange:F=>b(F.target.value),placeholder:"e.g. todo-list",autoFocus:!0})]}),l.jsxs("label",{className:"dialog-label",children:["Title",l.jsx("input",{className:"dialog-input",type:"text",value:T,onChange:F=>N(F.target.value),placeholder:"e.g. Todo List"})]}),l.jsxs("label",{className:"dialog-label",children:["Description (optional)",l.jsx("input",{className:"dialog-input",type:"text",value:_,onChange:F=>z(F.target.value),placeholder:"What does this app do?"})]}),l.jsxs("label",{className:"dialog-label",children:[l.jsxs("span",{children:["Icon (optional, a"," ",l.jsx("a",{href:"https://lucide.dev/icons",target:"_blank",rel:"noreferrer",children:"Lucide icon"})," ","name)"]}),l.jsx("input",{className:"dialog-input",type:"text",value:M,onChange:F=>O(F.target.value),placeholder:"e.g. notebook-pen",spellCheck:!1,autoCapitalize:"off"})]}),l.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:x||!E.trim()||!T.trim(),onClick:Ne,children:[l.jsx(pr,{size:13})," Create App"]})]}),d==="upload"&&l.jsxs(l.Fragment,{children:[l.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."}),l.jsx("input",{ref:ce,type:"file",multiple:!0,onChange:Me}),X&&l.jsxs(l.Fragment,{children:[l.jsxs("label",{className:"dialog-label",children:["App id",l.jsx("input",{className:"dialog-input",type:"text",value:P,onChange:F=>Q(F.target.value)})]}),l.jsxs("div",{className:"catalog-upload-summary",children:[Object.keys(X).length," file(s):"," ",Object.keys(X).slice(0,6).join(", "),Object.keys(X).length>6?", …":""]})]}),l.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:x||!X||!P.trim(),onClick:J,children:[l.jsx(V1,{size:13})," Import App"]})]})]}),l.jsx("div",{className:"dialog-footer",children:l.jsx("button",{className:"dialog-btn-cancel",onClick:n,children:"Close"})})]})})}function ej(){const e=A(k=>k.showCommandPalette),n=A(k=>k.setShowCommandPalette),r=A(),[o,a]=y.useState(""),[c,d]=y.useState(0),f=y.useRef(null),h=y.useMemo(()=>{const k=r.activeSessionId?r.sessionDetails[r.activeSessionId]:null,x=Vl(k);return[{id:"new-session",label:"New Session",hint:"Create a new Codex session",icon:pr,action:()=>r.setShowNewSessionDialog(!0),available:!0},{id:"delete-session",label:"Delete Session",hint:"Delete the active session",icon:us,action:()=>{r.activeSessionId&&r.deleteSession(r.activeSessionId)},available:!!r.activeSessionId},{id:"send-message",label:"Send Message",hint:"Focus the message input",icon:Hi,action:()=>{const S=document.querySelector(".cmd-input");S==null||S.focus()},available:!!r.activeSessionId&&!x},{id:"cancel-turn",label:"Cancel Turn",hint:"Cancel the running turn",icon:yr,action:()=>r.cancelTurn(),available:x},{id:"tab-turns",label:"Switch to Turns Tab",hint:"View conversation timeline",icon:_1,action:()=>r.switchRightTab("turns"),available:!!r.activeSessionId},{id:"tab-sidecar",label:"Ask Sidecar",hint:"Ask about this session — status, blockers, what is left",icon:vr,action:()=>r.switchRightTab("sidecar"),available:!!r.activeSessionId},{id:"toggle-right-panel",label:"Toggle Right Panel",hint:r.rightPanelCollapsed?"Expand the right panel":"Collapse the right panel to its icon rail",icon:O1,action:()=>r.toggleRightPanel(),available:!0},{id:"close-tab",label:"Close Tab",hint:"Close the active session tab",icon:Tn,action:()=>{r.activeSessionId&&r.closeTab(r.activeSessionId)},available:!!r.activeSessionId}]},[r]),g=y.useMemo(()=>{const k=o.toLowerCase().trim(),x=h.filter(S=>S.available);return k?x.filter(S=>S.label.toLowerCase().includes(k)||S.hint.toLowerCase().includes(k)):x},[h,o]);y.useEffect(()=>{e&&(a(""),d(0),setTimeout(()=>{var k;return(k=f.current)==null?void 0:k.focus()},50))},[e]);function v(k){if(k.key==="ArrowDown")k.preventDefault(),d(x=>Math.min(x+1,g.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=g[c];x&&(x.action(),n(!1))}else k.key==="Escape"&&n(!1)}return e?l.jsx("div",{className:"palette-overlay",onClick:()=>n(!1),children:l.jsxs("div",{className:"palette",onClick:k=>k.stopPropagation(),children:[l.jsxs("div",{className:"palette-search",children:[l.jsx("input",{ref:f,type:"text",placeholder:"Type a command…",value:o,onChange:k=>{a(k.target.value),d(0)},onKeyDown:v}),l.jsx("span",{className:"palette-esc",children:"ESC"})]}),g.length===0?l.jsx("div",{className:"palette-empty",children:"No matching commands"}):l.jsx("div",{className:"palette-list",children:g.map((k,x)=>{const S=k.icon;return l.jsxs("div",{className:`palette-item ${x===c?"selected":""}`,onClick:()=>{k.action(),n(!1)},onMouseEnter:()=>d(x),children:[l.jsx("span",{className:"palette-item-icon",children:l.jsx(S,{size:16})}),l.jsx("span",{className:"palette-item-label",children:k.label}),l.jsx("span",{className:"palette-item-hint",children:k.hint}),x===c&&l.jsx(x1,{size:12,className:"palette-item-enter"})]},k.id)})}),l.jsxs("div",{className:"palette-footer",children:[l.jsxs("span",{className:"palette-footer-hint",children:[l.jsx("span",{className:"kbd",children:"↑"}),l.jsx("span",{className:"kbd",children:"↓"})," Navigate"]}),l.jsxs("span",{className:"palette-footer-hint",children:[l.jsx("span",{className:"kbd",children:"↵"})," Select"]}),l.jsxs("span",{className:"palette-footer-hint",children:[l.jsx("span",{className:"kbd",children:"Esc"})," Close"]})]})]})}):null}const Yg=/^[a-z][a-z0-9-]{1,30}$/,tj=2e3;function nj(){const{showRemoteModal:e,setShowRemoteModal:n,selectSession:r}=A(),[o,a]=y.useState(null),[c,d]=y.useState(null),[f,h]=y.useState(!1),[g,v]=y.useState(!1),[k,x]=y.useState(!1),[S,E]=y.useState(!1),[b,T]=y.useState("main"),[N,_]=y.useState(""),[z,M]=y.useState(!1),[O,X]=y.useState(null),U=y.useRef(null);Wi(U,()=>E(!1),S);const P=g||k,Q=y.useCallback(async()=>{h(!0),d(null);try{const F=await fetch(`${mn()}/remote/status`,{headers:{Accept:"application/json"}});if(!F.ok)throw new Error(`status ${F.status}`);a(await F.json())}catch{a(null),d("Machine management is only available from this machine's local pane.")}finally{h(!1)}},[]);y.useEffect(()=>{e&&(T("main"),X(null),Q())},[e,Q]);const ce=O!==null&&O.state==="running";if(y.useEffect(()=>{if(!ce)return;const F=setInterval(async()=>{try{const Z=await fetch(`${mn()}/remote/enable`,{headers:{Accept:"application/json"}});Z.ok&&X(await Z.json())}catch{}},tj);return()=>clearInterval(F)},[ce]),!e)return null;const ue=!!(o!=null&&o.tunnel.provisioned)&&!!(o!=null&&o.service.running)&&!!(o!=null&&o.connection.ok);function me(F){F.key==="Escape"&&n(!1)}async function Ne(F){if(Yg.test(F)){M(!0);try{const Z=await fetch(`${mn()}/remote/enable`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mahlas:F})});if(!Z.ok)throw new Error(`enable ${Z.status}`);X(await Z.json()),T("setup")}catch{d("Could not start the setup — check the daemon logs.")}finally{M(!1)}}}function Me(){O!=null&&O.troubleshootingSessionId&&(r(O.troubleshootingSessionId),n(!1))}async function J(){v(!0);try{await fetch(`${mn()}/remote/disable`,{method:"POST"}),await Q()}catch{d("Could not stop the tunnel service — check the service logs.")}finally{v(!1)}}async function re(){if(E(!1),!!window.confirm(`Remove the tunnel completely?
|
|
832
|
+
|
|
833
|
+
This deletes the Cloudflare tunnel, its DNS record and Access app, and this machine's remote state. The mahlas is released.
|
|
834
|
+
|
|
835
|
+
This cannot be undone.`)){x(!0);try{const Z=await fetch(`${mn()}/remote/uninstall`,{method:"DELETE"});if(!Z.ok)throw new Error(`uninstall ${Z.status}`);await Q()}catch{d("Could not remove the tunnel — check the daemon logs.")}finally{x(!1)}}}function ee(){if(!O)return l.jsxs(l.Fragment,{children:[l.jsxs("label",{className:"dialog-label",children:["Machine name (mahlas)",l.jsx("input",{className:"dialog-input",value:N,onChange:I=>_(I.target.value.toLowerCase()),placeholder:"my-macbook",autoFocus:!0})]}),l.jsx("div",{className:"dialog-label",style:{opacity:.7,marginTop:-4},children:"The machine will be reachable at https://<name>.repoburg.com"}),l.jsxs("div",{className:"dialog-footer",children:[l.jsx("button",{className:"dialog-btn-cancel",onClick:()=>T("main"),children:"Back"}),l.jsxs("button",{className:"dialog-btn-create",disabled:!Yg.test(N)||z,onClick:()=>void Ne(N),children:[z?l.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Start setup"]})]})]});const F=["detect","provision","install","verify","ready"],Z=F.indexOf(O.step),G=O.state==="ready";return l.jsxs(l.Fragment,{children:[O.state==="running"&&l.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[l.jsx(hn,{size:14,className:"spin"})," Setting up the remote tunnel…"]}),O.state==="ready"&&l.jsxs("div",{className:"dialog-label",style:{color:"var(--green)",display:"flex",alignItems:"center",gap:6},children:[l.jsx(Cs,{size:14})," Setup complete — you can close this window."]}),O.state==="ready"&&O.hostname&&l.jsxs("div",{className:"dialog-label",children:["This machine is accessible at"," ",l.jsx("a",{href:`https://${O.hostname}`,target:"_blank",rel:"noreferrer",children:O.hostname})]}),l.jsx("ol",{className:"dialog-label",style:{margin:"4px 0",paddingLeft:0,listStyle:"none"},children:F.map((I,$)=>{const le=G||Z>-1&&$<Z,H=!G&&$===Z&&O.state==="running";return l.jsxs("li",{style:{display:"flex",alignItems:"center",gap:6,opacity:le||H?1:.4,color:le?"var(--green)":void 0},children:[le?l.jsx(Cs,{size:13}):H?l.jsx(hn,{size:13,className:"spin"}):l.jsx(v1,{size:9,style:{marginLeft:2,marginRight:2}}),I]},I)})}),O.logs.length>0&&l.jsx("div",{className:"dialog-label",style:{opacity:.7,fontSize:12,whiteSpace:"pre-wrap"},children:O.logs.slice(-3).map(I=>I.message).join(`
|
|
836
|
+
`)}),O.state==="troubleshooting"&&l.jsxs(l.Fragment,{children:[l.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."}),l.jsx("div",{className:"dialog-footer",children:l.jsx("button",{className:"dialog-btn-create",onClick:Me,children:"Open troubleshooting session"})})]}),O.state==="failed"&&l.jsxs("div",{className:"dialog-label",style:{color:"var(--red)"},children:["Setup failed: ",O.error]}),l.jsx("div",{className:"dialog-footer",children:l.jsx("button",{className:"dialog-btn-cancel",onClick:()=>void Q(),children:"Refresh status"})})]})}return l.jsx("div",{className:"dialog-overlay",onClick:()=>n(!1),children:l.jsxs("div",{className:"dialog",onClick:F=>F.stopPropagation(),onKeyDown:me,children:[l.jsxs("div",{className:"dialog-header",children:[l.jsx("span",{className:"dialog-title",children:"Remote Access"}),l.jsx("button",{className:"dialog-close",onClick:()=>n(!1),children:l.jsx(Tn,{size:16})})]}),l.jsxs("div",{className:"dialog-body",children:[f&&l.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[l.jsx(hn,{size:14,className:"spin"})," Loading machine status…"]}),c&&l.jsx("div",{className:"dialog-label",style:{color:"var(--red)"},children:c}),b==="setup"?ee():l.jsxs(l.Fragment,{children:[ue&&(o==null?void 0:o.tunnel.hostname)&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"dialog-label",children:["This machine is reachable at"," ",l.jsx("a",{href:`https://${o.tunnel.hostname}`,target:"_blank",rel:"noreferrer",children:o.tunnel.hostname})]}),l.jsxs("div",{style:{position:"relative",display:"flex",marginTop:8},children:[l.jsxs("button",{className:"dialog-btn-cancel",style:{flex:1,borderTopRightRadius:0,borderBottomRightRadius:0},onClick:()=>void J(),disabled:P,children:[g?l.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Stop tunnel connection"]}),l.jsx("button",{className:"dialog-btn-cancel",style:{width:30,borderLeft:"none",borderTopLeftRadius:0,borderBottomLeftRadius:0,display:"inline-flex",alignItems:"center",justifyContent:"center"},onClick:()=>E(F=>!F),disabled:P,"aria-label":"More tunnel actions","aria-haspopup":"menu","aria-expanded":S,children:k?l.jsx(hn,{size:14,className:"spin"}):l.jsx(_o,{size:14})}),S&&l.jsx("div",{ref:U,className:"ctx-menu",role:"menu",style:{position:"absolute",right:0,top:"calc(100% + 4px)",zIndex:10},children:l.jsxs("div",{className:"ctx-menu-item ctx-danger",role:"menuitem",onClick:()=>void re(),children:[l.jsx(us,{size:12})," Remove tunnel"]})})]})]}),!ue&&l.jsx(l.Fragment,{children:o!=null&&o.tunnel.provisioned&&o.tunnel.mahlas&&o.tunnel.hostname?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"dialog-label",children:["Tunnel exists as"," ",l.jsx("a",{href:`https://${o.tunnel.hostname}`,target:"_blank",rel:"noreferrer",children:o.tunnel.hostname})," ","but the connection is stopped."]}),l.jsxs("button",{className:"dialog-btn-create",style:{width:"100%"},onClick:()=>void Ne(o.tunnel.mahlas),disabled:z,children:[z?l.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):l.jsx(Im,{size:16,style:{verticalAlign:"middle",marginRight:6}}),"Resume tunnel connection"]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("button",{className:"dialog-btn-create",style:{width:"100%"},onClick:()=>T("setup"),children:[l.jsx(Im,{size:16,style:{verticalAlign:"middle",marginRight:6}}),"Make this machine remote"]}),l.jsx("div",{className:"dialog-label",style:{opacity:.7,marginTop:-4},children:"The daemon sets everything up and shows the progress here."})]})})]})]})]})})}const sj={success:m1,error:Yl,info:b1,warn:Zl},rj=4e3;function oj({toast:e}){const n=A(d=>d.removeToast),r=sj[e.type],o=y.useRef(null);y.useEffect(()=>{function d(){o.current=setTimeout(()=>n(e.id),rj)}return d(),()=>{o.current&&clearTimeout(o.current)}},[e.id,n]);function a(){o.current&&(clearTimeout(o.current),o.current=null)}function c(){o.current=setTimeout(()=>n(e.id),2e3)}return l.jsxs("div",{className:`toast toast-${e.type}`,onMouseEnter:a,onMouseLeave:c,children:[l.jsx(r,{size:16}),l.jsx("span",{className:"toast-message",children:e.message}),e.undoAction&&l.jsxs("button",{className:"toast-undo",onClick:()=>{var d;(d=e.undoAction)==null||d.call(e),n(e.id)},children:[l.jsx(H1,{size:12})," ",e.undoLabel||"Undo"]}),l.jsx("button",{className:"toast-close",onClick:()=>n(e.id),children:l.jsx(Tn,{size:14})})]})}function ij(){const e=A(n=>n.toasts);return e.length===0?null:l.jsx("div",{className:"toast-container",children:e.map(n=>l.jsx(oj,{toast:n},n.id))})}function aj(){const[e]=y.useState(gk),[n,r]=y.useState(!1),[o,a]=y.useState(!1),c=y.useRef(void 0);y.useEffect(()=>()=>clearTimeout(c.current),[]);async function d(){await Fi(vm)&&(r(!0),a(!0),clearTimeout(c.current),c.current=setTimeout(()=>r(!1),1500))}return l.jsxs("main",{className:"daemon-download",children:[l.jsx("h1",{className:"daemon-download-title",children:"Repoburg"}),e&&l.jsx("p",{className:"daemon-download-text",children:"Open the Repoburg app to continue."}),l.jsxs("div",{className:"daemon-download-install",children:[e&&l.jsx("p",{className:"daemon-download-label",children:"Not installed? Run this in Terminal:"}),l.jsxs("div",{className:"daemon-download-cmd",onCopy:()=>a(!0),children:[l.jsx("span",{className:"daemon-download-prompt","aria-hidden":"true",children:"$"}),l.jsx("code",{children:vm}),l.jsx("button",{type:"button",className:`daemon-download-copy${n?" copied":""}`,onClick:()=>void d(),"aria-label":"Copy the install command",title:n?"Copied":"Copy",children:n?l.jsx(Cs,{size:15}):l.jsx(Oi,{size:15})})]}),!e&&l.jsx("p",{className:"daemon-download-meta",children:"Apple Silicon · macOS 13+"})]}),o&&l.jsx("p",{className:"daemon-download-hint",children:"Paste it into Terminal and press Return. Repoburg installs and opens in your menu bar."}),(e||o)&&l.jsxs("p",{className:"daemon-download-waiting",role:"status",children:[l.jsx(hn,{size:13,className:"spin"}),"Waiting for Repoburg to start…"]})]})}let Jn=null,Ao=null,Ai=1e3;const lj=1e4;function Ud(){Jn&&(Jn.readyState===WebSocket.OPEN||Jn.readyState===WebSocket.CONNECTING)||(Jn=new WebSocket(o0("/ws")),Jn.onopen=()=>{const e=Ai>1e3;if(Ai=1e3,A.getState().setWsConnected(!0),A.getState().addLogEntry("INFO","WebSocket connected"),e){K0();const n=A.getState();n.activeSessionId&&(n.refreshActiveSession(),n.addToast("info","WebSocket reconnected — session state reconciled"))}},Jn.onclose=()=>{A.getState().setWsConnected(!1),A.getState().addLogEntry("WARN","WebSocket disconnected"),A.getState().addToast("warn","WebSocket disconnected — reconnecting…"),uj()},Jn.onerror=()=>{},Jn.onmessage=e=>{try{const n=JSON.parse(e.data);Lt.trackWsEvent(typeof n.event=="string"?n.event:"unknown",typeof e.data=="string"?e.data.length:0);const r=dj[n.event];r&&r(n.data)}catch{}})}function cj(){Ao&&(clearTimeout(Ao),Ao=null),Jn&&(Jn.onclose=null,Jn.close(),Jn=null),A.getState().setWsConnected(!1)}function uj(){Ao||(Ao=window.setTimeout(()=>{Ao=null,Ud()},Ai),Ai=Math.min(Ai*2,lj))}const dj={"turn:created":e=>{const n=e;A.getState().onTurnCreated(n.sessionId,n.turn)},"turn:started":e=>{const n=e;Lt.note(`turn:started — ${n.turnId.slice(0,8)}`),A.getState().onTurnStarted(n.sessionId,n.turnId)},"item:started":e=>{const n=e;Bu(n.sessionId,n.turnId,n.item),A.getState().onItemStarted(n.sessionId,n.turnId,n.item)},"item:updated":e=>{const n=e;Bu(n.sessionId,n.turnId,n.item),A.getState().onItemUpdated(n.sessionId,n.turnId,n.item)},"item:completed":e=>{const n=e;Bu(n.sessionId,n.turnId,n.item),A.getState().onItemCompleted(n.sessionId,n.turnId,n.item)},"item:delta":e=>{const n=e,r=l0(n.sessionId,n.turnId,n.itemId,n.delta);A.getState().onItemDelta(n.sessionId,n.turnId,n.itemId,n.delta,r)},"streams:snapshot":e=>{const n=e,r=A.getState();for(const o of c0(n.sessionId??null,Array.isArray(n.streams)?n.streams:[]))r.onItemText(o.sessionId,o.turnId,o.itemId,o.text)},"widget:delta":e=>{const n=e;typeof n.itemId!="string"||typeof n.html!="string"||A.getState().onWidgetDelta(n.sessionId,n.turnId,n.itemId,typeof n.title=="string"?n.title:"",n.html)},"turn:completed":e=>{const n=e;Lt.note(`turn:completed — ${n.turnId.slice(0,8)}`),gi(n.sessionId,n.turnId),A.getState().onTurnCompleted(n.sessionId,n.turnId,n.usage,n.hasUnreviewed,n.response??void 0)},"turn:tokenUsage":e=>{const n=e;A.getState().onTokenUsageUpdated(n.sessionId,n.turnId,n.usage)},"turn:contextUsage":e=>{const n=e,r={totalTokens:n.totalTokens,contextWindow:n.contextWindow,percentage:n.percentage,...n.autoCompactThreshold?{autoCompactThreshold:n.autoCompactThreshold}:{}};A.getState().onContextUsageUpdated(n.sessionId,r)},"turn:failed":e=>{const n=e;gi(n.sessionId,n.turnId),A.getState().onTurnFailed(n.sessionId,n.turnId,n.error,n.resumeState)},"turn:interrupted":e=>{const n=e;Lt.note(`turn:interrupted — ${n.turnId.slice(0,8)} (${n.reason})`),gi(n.sessionId,n.turnId),A.getState().onTurnInterrupted(n.sessionId,n.turnId,{reason:n.reason,interruptedAt:n.interruptedAt,attempts:n.attempts,detail:n.detail??null,resumeAt:n.resumeAt??null})},"turn:resuming":e=>{const n=e;gi(n.sessionId,n.turnId),A.getState().onTurnResuming(n.sessionId,n.turnId,n.attempt)},"turn:resumed":e=>{const n=e;A.getState().onTurnResumed(n.sessionId,n.turnId)},"turn:retrying":e=>{const n=e;A.getState().onTurnRetrying(n.sessionId,n.turnId,{attempt:n.attempt,maxRetries:n.maxRetries,retryDelayMs:n.retryDelayMs,errorStatus:n.errorStatus??null,error:n.error??null})},"turn:cancelled":e=>{const n=e;gi(n.sessionId,n.turnId),A.getState().onTurnCancelled(n.sessionId,n.turnId)},"session:title":e=>{const n=e;A.getState().onSessionTitle(n.sessionId,n.title)},"session:touched":e=>{const n=e;A.getState().onSessionTouched(n.sessionId)},"session:created":e=>{const{session:n}=e;n.origin_app_id&&dl(n.id,n.origin_app_id),A.getState().addSession(n)},"session:resync":e=>{const n=e,r=A.getState();r.activeSessionId===n.sessionId&&r.refreshActiveSession()},"session:updated":e=>{const n=e;A.getState().onSessionUpdated(n.session)},background_tasks:e=>{const n=e;Lt.note(`background_tasks — ${n.tasks.length} live (${n.tasks.map(r=>r.task_type).join(", ")||"none"})`),A.getState().onBackgroundTasksChanged(n.sessionId,n.tasks)},"background_tasks:snapshot":e=>{const n=e;A.getState().onBackgroundTasksSnapshot(n.sessions??{})},"signed_out_turns:snapshot":e=>{const n=e;A.getState().onSignedOutTurnsSnapshot(n.turns??[])},"thread:created":e=>{const n=e;A.getState().onThreadCreated(n.sessionId,n.thread,n.turn)},"thread:followup":e=>{const n=e;A.getState().onThreadFollowup(n.sessionId,n.threadId,n.turn)},"thread:resolved":e=>{const n=e;A.getState().onThreadResolved(n.sessionId,n.threadId,n.status)},"thread:deleted":e=>{const n=e;A.getState().onThreadDeleted(n.sessionId,n.threadId)},"app:tool_call":e=>{const n=e;F0(n.appId,n.callId,n.tool,n.args??{},n.workspace,n.caller)},"app:source:updated":e=>{G0(e.appId),A.getState().refreshApps()},"app:state_changed":e=>{const{appId:n,...r}=e;wv(n,r)}};function fj(){const e=A(n=>n.init);return y.useEffect(()=>{s0();function n(){e(),Ud()}const{daemonStatus:r,setDaemonStatus:o}=A.getState();let a=null;r==="ready"?n():a=yk({onMissing:()=>o("missing"),onReady:()=>{o("ready"),n()}});function c(){if(document.visibilityState!=="visible")return;const d=A.getState(),f=d.activeSessionId;if(!f)return;const h=d.sessionDetails[f];d.wsConnected||Ud(),h&&h.is_running===1&&(d.refreshActiveSession(),d.addLogEntry("INFO","Tab returned — reconciling session state"))}return document.addEventListener("visibilitychange",c),()=>{a==null||a(),cj(),document.removeEventListener("visibilitychange",c)}},[e]),null}const nx="agentpaneView";function Bd(e){return{tab:Kd(e),vscode:e.vscodeViewOpen,usage:e.usageViewOpen,terminal:e.terminalViewOpen}}function sx(e,n){return e.tab===n.tab&&e.vscode===n.vscode&&e.usage===n.usage&&e.terminal===n.terminal}function Qg(e){return e.tab===null&&!e.vscode&&!e.usage&&!e.terminal}function Zg(e,n){return n.tab!==null&&!e.tabOrder.includes(n.tab)?!1:!sx(n,Bd(e))}function Jg(e){const n=e==null?void 0:e[nx];return typeof(n==null?void 0:n.index)!="number"?null:{...n,view:{...n.view,terminal:!!n.view.terminal}}}function pj(e,n){e.getState().vscodeViewOpen!==n.vscode&&e.getState().toggleVscodeView(),e.getState().usageViewOpen!==n.usage&&e.getState().toggleUsageView(),e.getState().terminalViewOpen!==n.terminal&&e.getState().toggleTerminalView();const r=e.getState();if(n.tab===null)return;const{kind:o,id:a}=mr(n.tab);o==="app"?r.openAppTab(a):r.activeSessionId===a?r.setActiveAppTab(null):r.selectSession(a)}function hj(e){let n=Jg(window.history.state)??{index:0,newest:0,view:Bd(e.getState())},r=n.newest,o=!1;const a=new Map([[n.index,n.view]]),c=x=>{const S=e.getState();for(let E=n.index+x;E>=0&&E<=r;E+=x){const b=a.get(E);if(!b||Zg(S,b))return!0}return!1},d=()=>{const x=c(-1),S=c(1),E=e.getState();(E.canGoBack!==x||E.canGoForward!==S)&&e.setState({canGoBack:x,canGoForward:S})},f=()=>({[nx]:{...n,newest:r}}),h=()=>{window.history.replaceState({...window.history.state,...f()},"")},g=x=>{if(a.set(n.index,n.view),Qg(n.view))n={...n,view:x},h();else{n={index:n.index+1,newest:n.index+1,view:x},r=n.index;for(const S of a.keys())S>r&&a.delete(S);window.history.pushState(f(),"")}a.set(n.index,x)},v=x=>{const S=Jg(x.state);if(!S)return;a.set(S.index,S.view),r=Math.max(r,S.index);const E=e.getState(),b=Math.sign(S.index-n.index);if(b!==0&&!Zg(E,S.view)){const T=S.index+b;window.history.go(T<0||T>r?n.index-S.index:b);return}n=S,h(),o=!0;try{pj(e,S.view)}finally{o=!1}d()};h(),d(),window.addEventListener("popstate",v);const k=e.subscribe((x,S)=>{const E=x.activeSessionId!==S.activeSessionId||x.activeAppTabId!==S.activeAppTabId||x.vscodeViewOpen!==S.vscodeViewOpen||x.usageViewOpen!==S.usageViewOpen||x.terminalViewOpen!==S.terminalViewOpen;if(!(!E&&x.tabOrder===S.tabOrder)){if(E&&!o){const b=Bd(x);!Qg(b)&&!sx(b,n.view)&&g(b)}d()}});return()=>{k(),window.removeEventListener("popstate",v)}}function mj(){const e=A(c=>c.loading),n=A(c=>c.error),r=A(c=>c.sessions),o=A(c=>c.daemonStatus),a=A(c=>c.setShowCommandPalette);return y.useEffect(()=>Lt.start(),[]),y.useEffect(()=>hj(A),[]),y.useEffect(()=>{function c(d){(d.metaKey||d.ctrlKey)&&d.key==="k"&&(d.preventDefault(),a(!0))}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[a]),l.jsxs(l.Fragment,{children:[l.jsx(fj,{}),o==="missing"?l.jsx(aj,{}):o==="checking"||e&&r.length===0?l.jsx("div",{className:"empty-state",children:"Loading sessions…"}):n&&r.length===0?l.jsxs("div",{className:"empty-state",children:["Error: ",n]}):l.jsxs(l.Fragment,{children:[l.jsx(UE,{}),l.jsx(BE,{}),l.jsx(VE,{}),l.jsx(qE,{}),l.jsx(JE,{}),l.jsx(nj,{}),l.jsx(ej,{}),l.jsx(ij,{})]})]})}Kw.createRoot(document.getElementById("root")).render(l.jsx(ct.StrictMode,{children:l.jsx(mj,{})}));export{$i as R,Tn as X,o0 as b,ye as c,l as j,y as r,A as u};
|